Skip to content

Commit

Permalink
Merge pull request #661 from xmtp/rygine/update-bindings
Browse files Browse the repository at this point in the history
Upgrade node bindings, add `inboxState` to Client
  • Loading branch information
rygine authored Sep 11, 2024
2 parents fed1b91 + b8d9b36 commit 5d20914
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/olive-beans-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@xmtp/mls-client": patch
---

Upgrade node bindings, add `inboxState` to Client
2 changes: 1 addition & 1 deletion packages/mls-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"dependencies": {
"@xmtp/content-type-primitives": "^1.0.1",
"@xmtp/content-type-text": "^1.0.0",
"@xmtp/mls-client-bindings-node": "^0.0.10",
"@xmtp/mls-client-bindings-node": "^0.0.11",
"@xmtp/proto": "^3.62.1"
},
"devDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion packages/mls-client/src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class Client {

addScwSignature(
signatureBytes: Uint8Array,
chainId: string,
chainId: bigint,
accountAddress: string,
chainRpcUrl: string,
blockNumber: bigint
Expand Down Expand Up @@ -204,4 +204,8 @@ export class Client {
async getInboxIdByAddress(accountAddress: string) {
return this.#innerClient.findInboxIdByAddress(accountAddress)
}

async inboxState(refreshFromNetwork: boolean = false) {
return this.#innerClient.inboxState(refreshFromNetwork)
}
}
12 changes: 12 additions & 0 deletions packages/mls-client/test/Client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,16 @@ describe('Client', () => {
const inboxId = await client.getInboxIdByAddress(user.account.address)
expect(inboxId).toBe(client.inboxId)
})

it('should return the correct inbox state', async () => {
const user = createUser()
const client = await createRegisteredClient(user)
const inboxState = await client.inboxState()
expect(inboxState.inboxId).toBe(client.inboxId)
expect(inboxState.installationIds).toEqual([client.installationId])
expect(inboxState.accountAddresses).toEqual([
user.account.address.toLowerCase(),
])
expect(inboxState.recoveryAddress).toBe(user.account.address.toLowerCase())
})
})
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2915,10 +2915,10 @@ __metadata:
languageName: node
linkType: hard

"@xmtp/mls-client-bindings-node@npm:^0.0.10":
version: 0.0.10
resolution: "@xmtp/mls-client-bindings-node@npm:0.0.10"
checksum: 10/f41609e165a47df71d85f0e073b23fec5324992ae7e17fd5781b445c200a05f966459f97a195637395483f2b58da2d2f3ef6286b4b813a2347bd6c7561be290f
"@xmtp/mls-client-bindings-node@npm:^0.0.11":
version: 0.0.11
resolution: "@xmtp/mls-client-bindings-node@npm:0.0.11"
checksum: 10/a607e3e2e2df0fe4a2cade349c384f3e131b237c5589d2e5308baef0e7a4439dcce42f4948b726de3cb457306b291f20ede920607144318139aa43f349c1f26d
languageName: node
linkType: hard

Expand All @@ -2935,7 +2935,7 @@ __metadata:
"@vitest/coverage-v8": "npm:^2.0.3"
"@xmtp/content-type-primitives": "npm:^1.0.1"
"@xmtp/content-type-text": "npm:^1.0.0"
"@xmtp/mls-client-bindings-node": "npm:^0.0.10"
"@xmtp/mls-client-bindings-node": "npm:^0.0.11"
"@xmtp/proto": "npm:^3.62.1"
"@xmtp/xmtp-js": "workspace:^"
eslint: "npm:^8.57.0"
Expand Down

0 comments on commit 5d20914

Please sign in to comment.