Skip to content

Commit

Permalink
Prepare node bindings for release (#1135)
Browse files Browse the repository at this point in the history
* Prepare node bindings for release

* Update tests
  • Loading branch information
rygine authored Oct 11, 2024
1 parent 387d033 commit 0f84a88
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
7 changes: 6 additions & 1 deletion bindings_node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# @xmtp/mls-client-bindings-node
# @xmtp/node-bindings

## 0.0.13

- Added logging option when creating a client
- Added `inboxAddresses` to client

## 0.0.12

Expand Down
4 changes: 2 additions & 2 deletions bindings_node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xmtp/mls-client-bindings-node",
"version": "0.0.12",
"name": "@xmtp/node-bindings",
"version": "0.0.13",
"repository": {
"type": "git",
"url": "git+https://git@github.com/xmtp/libxmtp.git",
Expand Down
24 changes: 24 additions & 0 deletions bindings_node/test/Client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,28 @@ describe('Client', () => {
await client2.getConsentState(NapiConsentEntityType.GroupId, group2.id())
).toBe(NapiConsentState.Denied)
})

it('should get inbox addresses', async () => {
const user = createUser()
const user2 = createUser()
const client = await createRegisteredClient(user)
const client2 = await createRegisteredClient(user2)
const inboxAddresses = await client.addressesFromInboxId(true, [
client.inboxId(),
])
expect(inboxAddresses.length).toBe(1)
expect(inboxAddresses[0].inboxId).toBe(client.inboxId())
expect(inboxAddresses[0].accountAddresses).toEqual([
user.account.address.toLowerCase(),
])

const inboxAddresses2 = await client2.addressesFromInboxId(true, [
client2.inboxId(),
])
expect(inboxAddresses2.length).toBe(1)
expect(inboxAddresses2[0].inboxId).toBe(client2.inboxId())
expect(inboxAddresses2[0].accountAddresses).toEqual([
user2.account.address.toLowerCase(),
])
})
})
11 changes: 10 additions & 1 deletion bindings_node/test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ export const createClient = async (user: User) => {
const inboxId =
(await getInboxIdForAddress(TEST_API_URL, false, user.account.address)) ||
generateInboxId(user.account.address)
return create(TEST_API_URL, false, dbPath, inboxId, user.account.address)
return create(
TEST_API_URL,
false,
dbPath,
inboxId,
user.account.address,
undefined,
undefined,
'off'
)
}

export const createRegisteredClient = async (user: User) => {
Expand Down
4 changes: 2 additions & 2 deletions bindings_node/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1503,9 +1503,9 @@ __metadata:
languageName: node
linkType: hard

"@xmtp/mls-client-bindings-node@workspace:.":
"@xmtp/node-bindings@workspace:.":
version: 0.0.0-use.local
resolution: "@xmtp/mls-client-bindings-node@workspace:."
resolution: "@xmtp/node-bindings@workspace:."
dependencies:
"@ianvs/prettier-plugin-sort-imports": "npm:^4.2.1"
"@napi-rs/cli": "npm:^3.0.0-alpha.55"
Expand Down

0 comments on commit 0f84a88

Please sign in to comment.