Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare node bindings for release #1135

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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