From cf838e1004c3034ab4d5fb702cfe7cb8ee4f7bff Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 18 Nov 2024 18:37:29 -0600 Subject: [PATCH 1/6] Fix example vite config --- examples/react-vite-browser-sdk/vite.config.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/react-vite-browser-sdk/vite.config.ts b/examples/react-vite-browser-sdk/vite.config.ts index 3d7f96fe2..675f09667 100644 --- a/examples/react-vite-browser-sdk/vite.config.ts +++ b/examples/react-vite-browser-sdk/vite.config.ts @@ -5,7 +5,8 @@ import { defineConfig } from "vite"; export default defineConfig({ plugins: [react()], optimizeDeps: { - exclude: ["@xmtp/wasm-bindings"], + exclude: ["@xmtp/browser-sdk"], + include: ["@xmtp/proto"], }, server: { headers: { From 4bb4ea5e2ca0dc467c3d517d6d98791f8110d910 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 18 Nov 2024 18:37:50 -0600 Subject: [PATCH 2/6] Update Browser SDK README --- sdks/browser-sdk/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdks/browser-sdk/README.md b/sdks/browser-sdk/README.md index 25de3133f..dbaacafa9 100644 --- a/sdks/browser-sdk/README.md +++ b/sdks/browser-sdk/README.md @@ -68,7 +68,7 @@ export default nextConfig; ### Bundlers -This SDK uses a WebAssembly (WASM) module and some bundlers must be configured properly to handle it. +This SDK and some of its dependencies use `import.meta.url`. Some bundlers must be configured to account for this during development. #### Vite @@ -79,7 +79,8 @@ import { defineConfig } from "vite"; export default defineConfig({ optimizeDeps: { - exclude: ["@xmtp/wasm-bindings"], + exclude: ["@xmtp/browser-sdk"], + include: ["@xmtp/proto"], }, }); ``` From 12df29b2711adf72d06c13656c77d0f7601aae8c Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 18 Nov 2024 18:41:18 -0600 Subject: [PATCH 3/6] Include src in packages for source maps --- content-types/content-type-group-updated/package.json | 5 ++++- content-types/content-type-primitives/package.json | 5 ++++- content-types/content-type-reaction/package.json | 5 ++++- content-types/content-type-read-receipt/package.json | 5 ++++- content-types/content-type-remote-attachment/package.json | 5 ++++- content-types/content-type-reply/package.json | 5 ++++- content-types/content-type-text/package.json | 5 ++++- .../content-type-transaction-reference/package.json | 5 ++++- packages/frames-validator/package.json | 5 ++++- 9 files changed, 36 insertions(+), 9 deletions(-) diff --git a/content-types/content-type-group-updated/package.json b/content-types/content-type-group-updated/package.json index dfe9f7823..b27fe5a75 100644 --- a/content-types/content-type-group-updated/package.json +++ b/content-types/content-type-group-updated/package.json @@ -38,7 +38,10 @@ "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*", + "tsconfig.json" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-primitives/package.json b/content-types/content-type-primitives/package.json index ab40fb0dc..c1407d104 100644 --- a/content-types/content-type-primitives/package.json +++ b/content-types/content-type-primitives/package.json @@ -38,7 +38,10 @@ "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*", + "tsconfig.json" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-reaction/package.json b/content-types/content-type-reaction/package.json index b862c90d1..e87059fbd 100644 --- a/content-types/content-type-reaction/package.json +++ b/content-types/content-type-reaction/package.json @@ -38,7 +38,10 @@ "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*", + "tsconfig.json" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-read-receipt/package.json b/content-types/content-type-read-receipt/package.json index 68a95c94c..77f0fb5d3 100644 --- a/content-types/content-type-read-receipt/package.json +++ b/content-types/content-type-read-receipt/package.json @@ -38,7 +38,10 @@ "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*", + "tsconfig.json" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-remote-attachment/package.json b/content-types/content-type-remote-attachment/package.json index 8b44b4f5f..7e59d1d34 100644 --- a/content-types/content-type-remote-attachment/package.json +++ b/content-types/content-type-remote-attachment/package.json @@ -38,7 +38,10 @@ "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*", + "tsconfig.json" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-reply/package.json b/content-types/content-type-reply/package.json index 1cab69ce4..11d5105da 100644 --- a/content-types/content-type-reply/package.json +++ b/content-types/content-type-reply/package.json @@ -38,7 +38,10 @@ "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*", + "tsconfig.json" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-text/package.json b/content-types/content-type-text/package.json index 69b473db3..2f8fa0e61 100644 --- a/content-types/content-type-text/package.json +++ b/content-types/content-type-text/package.json @@ -38,7 +38,10 @@ "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*", + "tsconfig.json" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-transaction-reference/package.json b/content-types/content-type-transaction-reference/package.json index b703a4e53..b90f3f7d4 100644 --- a/content-types/content-type-transaction-reference/package.json +++ b/content-types/content-type-transaction-reference/package.json @@ -38,7 +38,10 @@ "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*", + "tsconfig.json" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/packages/frames-validator/package.json b/packages/frames-validator/package.json index 1680877bf..2c4fe7e05 100644 --- a/packages/frames-validator/package.json +++ b/packages/frames-validator/package.json @@ -20,7 +20,10 @@ "module": "dist/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*", + "tsconfig.json" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", From 5ebff39d8ab9f9aaf48e1f9983f5ab8bd1384ed2 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Tue, 19 Nov 2024 08:55:18 -0600 Subject: [PATCH 4/6] Remove tsconfig.json from published files --- content-types/content-type-group-updated/package.json | 3 +-- content-types/content-type-primitives/package.json | 3 +-- content-types/content-type-reaction/package.json | 3 +-- content-types/content-type-read-receipt/package.json | 3 +-- content-types/content-type-remote-attachment/package.json | 3 +-- content-types/content-type-reply/package.json | 3 +-- content-types/content-type-text/package.json | 3 +-- content-types/content-type-transaction-reference/package.json | 3 +-- packages/consent-proof-signature/package.json | 3 +-- packages/frames-client/package.json | 3 +-- packages/frames-validator/package.json | 3 +-- sdks/browser-sdk/package.json | 3 +-- sdks/js-sdk/package.json | 3 +-- 13 files changed, 13 insertions(+), 26 deletions(-) diff --git a/content-types/content-type-group-updated/package.json b/content-types/content-type-group-updated/package.json index b27fe5a75..65dd4e330 100644 --- a/content-types/content-type-group-updated/package.json +++ b/content-types/content-type-group-updated/package.json @@ -40,8 +40,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-primitives/package.json b/content-types/content-type-primitives/package.json index c1407d104..25afac4df 100644 --- a/content-types/content-type-primitives/package.json +++ b/content-types/content-type-primitives/package.json @@ -40,8 +40,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-reaction/package.json b/content-types/content-type-reaction/package.json index e87059fbd..49d2a4cd9 100644 --- a/content-types/content-type-reaction/package.json +++ b/content-types/content-type-reaction/package.json @@ -40,8 +40,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-read-receipt/package.json b/content-types/content-type-read-receipt/package.json index 77f0fb5d3..8cb1cb822 100644 --- a/content-types/content-type-read-receipt/package.json +++ b/content-types/content-type-read-receipt/package.json @@ -40,8 +40,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-remote-attachment/package.json b/content-types/content-type-remote-attachment/package.json index 7e59d1d34..35d4cd7b6 100644 --- a/content-types/content-type-remote-attachment/package.json +++ b/content-types/content-type-remote-attachment/package.json @@ -40,8 +40,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-reply/package.json b/content-types/content-type-reply/package.json index 11d5105da..3d404a6cd 100644 --- a/content-types/content-type-reply/package.json +++ b/content-types/content-type-reply/package.json @@ -40,8 +40,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-text/package.json b/content-types/content-type-text/package.json index 2f8fa0e61..300970abf 100644 --- a/content-types/content-type-text/package.json +++ b/content-types/content-type-text/package.json @@ -40,8 +40,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-transaction-reference/package.json b/content-types/content-type-transaction-reference/package.json index b90f3f7d4..45823dc8e 100644 --- a/content-types/content-type-transaction-reference/package.json +++ b/content-types/content-type-transaction-reference/package.json @@ -40,8 +40,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 7c4e12cde..0b56b2c6d 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -38,8 +38,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 280227493..88a03565c 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -36,8 +36,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/packages/frames-validator/package.json b/packages/frames-validator/package.json index 2c4fe7e05..d2166f1a9 100644 --- a/packages/frames-validator/package.json +++ b/packages/frames-validator/package.json @@ -22,8 +22,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/sdks/browser-sdk/package.json b/sdks/browser-sdk/package.json index 5613fd61e..6a14eb640 100644 --- a/sdks/browser-sdk/package.json +++ b/sdks/browser-sdk/package.json @@ -36,8 +36,7 @@ "types": "dist/index.d.ts", "files": [ "dist", - "src", - "tsconfig.json" + "src" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/sdks/js-sdk/package.json b/sdks/js-sdk/package.json index d434d82d8..41f2c2af6 100644 --- a/sdks/js-sdk/package.json +++ b/sdks/js-sdk/package.json @@ -59,8 +59,7 @@ "types": "dist/index.d.ts", "files": [ "dist", - "src", - "tsconfig.json" + "src" ], "scripts": { "bench": "yarn build:bench && node dist/bench/index.cjs", From 04fbb0d5a722218297654811b1d21b585aac540f Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Tue, 19 Nov 2024 09:03:22 -0600 Subject: [PATCH 5/6] Export package.json --- content-types/content-type-group-updated/package.json | 3 ++- content-types/content-type-primitives/package.json | 3 ++- content-types/content-type-reaction/package.json | 3 ++- content-types/content-type-read-receipt/package.json | 3 ++- content-types/content-type-remote-attachment/package.json | 3 ++- content-types/content-type-reply/package.json | 3 ++- content-types/content-type-text/package.json | 3 ++- content-types/content-type-transaction-reference/package.json | 3 ++- packages/consent-proof-signature/package.json | 3 ++- packages/frames-client/package.json | 3 ++- packages/frames-validator/package.json | 3 ++- sdks/browser-sdk/package.json | 3 ++- sdks/node-sdk/package.json | 3 ++- 13 files changed, 26 insertions(+), 13 deletions(-) diff --git a/content-types/content-type-group-updated/package.json b/content-types/content-type-group-updated/package.json index 65dd4e330..309e620e1 100644 --- a/content-types/content-type-group-updated/package.json +++ b/content-types/content-type-group-updated/package.json @@ -31,7 +31,8 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/content-types/content-type-primitives/package.json b/content-types/content-type-primitives/package.json index 25afac4df..b37db9052 100644 --- a/content-types/content-type-primitives/package.json +++ b/content-types/content-type-primitives/package.json @@ -31,7 +31,8 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/content-types/content-type-reaction/package.json b/content-types/content-type-reaction/package.json index 49d2a4cd9..858b28c1c 100644 --- a/content-types/content-type-reaction/package.json +++ b/content-types/content-type-reaction/package.json @@ -31,7 +31,8 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/content-types/content-type-read-receipt/package.json b/content-types/content-type-read-receipt/package.json index 8cb1cb822..b86367e22 100644 --- a/content-types/content-type-read-receipt/package.json +++ b/content-types/content-type-read-receipt/package.json @@ -31,7 +31,8 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/content-types/content-type-remote-attachment/package.json b/content-types/content-type-remote-attachment/package.json index 35d4cd7b6..0027bbcba 100644 --- a/content-types/content-type-remote-attachment/package.json +++ b/content-types/content-type-remote-attachment/package.json @@ -31,7 +31,8 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/content-types/content-type-reply/package.json b/content-types/content-type-reply/package.json index 3d404a6cd..7d7ea876a 100644 --- a/content-types/content-type-reply/package.json +++ b/content-types/content-type-reply/package.json @@ -31,7 +31,8 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/content-types/content-type-text/package.json b/content-types/content-type-text/package.json index 300970abf..2912aacd2 100644 --- a/content-types/content-type-text/package.json +++ b/content-types/content-type-text/package.json @@ -31,7 +31,8 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/content-types/content-type-transaction-reference/package.json b/content-types/content-type-transaction-reference/package.json index 45823dc8e..472f77c6e 100644 --- a/content-types/content-type-transaction-reference/package.json +++ b/content-types/content-type-transaction-reference/package.json @@ -31,7 +31,8 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 0b56b2c6d..e18cc73c6 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -29,7 +29,8 @@ "types": "./dist/index.d.ts", "require": "./dist/index.cjs", "import": "./dist/index.js" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 88a03565c..533889cde 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -28,7 +28,8 @@ ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" - } + }, + "./package.json": "./package.json" }, "module": "dist/index.js", "browser": "dist/index.js", diff --git a/packages/frames-validator/package.json b/packages/frames-validator/package.json index d2166f1a9..f5bb07a64 100644 --- a/packages/frames-validator/package.json +++ b/packages/frames-validator/package.json @@ -14,7 +14,8 @@ "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/sdks/browser-sdk/package.json b/sdks/browser-sdk/package.json index 6a14eb640..e83c5b8e8 100644 --- a/sdks/browser-sdk/package.json +++ b/sdks/browser-sdk/package.json @@ -29,7 +29,8 @@ ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" - } + }, + "./package.json": "./package.json" }, "module": "dist/index.js", "browser": "dist/index.js", diff --git a/sdks/node-sdk/package.json b/sdks/node-sdk/package.json index 9fbcb9145..d6e5bebe5 100644 --- a/sdks/node-sdk/package.json +++ b/sdks/node-sdk/package.json @@ -28,7 +28,8 @@ "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", From 931ce8208d1a9c1c1a09fe3aead904334ac9a147 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Tue, 19 Nov 2024 09:12:12 -0600 Subject: [PATCH 6/6] Rename newConversation => newGroup --- sdks/node-sdk/src/Conversations.ts | 5 +- sdks/node-sdk/test/Client.test.ts | 4 +- sdks/node-sdk/test/Conversation.test.ts | 32 ++++++------- sdks/node-sdk/test/Conversations.test.ts | 58 ++++++++++++------------ 4 files changed, 45 insertions(+), 54 deletions(-) diff --git a/sdks/node-sdk/src/Conversations.ts b/sdks/node-sdk/src/Conversations.ts index 6312cd332..15c508d02 100644 --- a/sdks/node-sdk/src/Conversations.ts +++ b/sdks/node-sdk/src/Conversations.ts @@ -47,10 +47,7 @@ export class Conversations { } } - async newConversation( - accountAddresses: string[], - options?: CreateGroupOptions, - ) { + async newGroup(accountAddresses: string[], options?: CreateGroupOptions) { const group = await this.#conversations.createGroup( accountAddresses, options, diff --git a/sdks/node-sdk/test/Client.test.ts b/sdks/node-sdk/test/Client.test.ts index 2514c36da..5beff1d26 100644 --- a/sdks/node-sdk/test/Client.test.ts +++ b/sdks/node-sdk/test/Client.test.ts @@ -164,9 +164,7 @@ describe("Client", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const group = await client1.conversations.newConversation([ - user2.account.address, - ]); + const group = await client1.conversations.newGroup([user2.account.address]); await client2.conversations.sync(); const group2 = client2.conversations.getConversationById(group.id); diff --git a/sdks/node-sdk/test/Conversation.test.ts b/sdks/node-sdk/test/Conversation.test.ts index 0002e2319..63f8c3b90 100644 --- a/sdks/node-sdk/test/Conversation.test.ts +++ b/sdks/node-sdk/test/Conversation.test.ts @@ -13,7 +13,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); const newName = "foo"; @@ -39,7 +39,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); const imageUrl = "https://foo/bar.jpg"; @@ -65,7 +65,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); const newDescription = "foo"; @@ -91,7 +91,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); const pinnedFrameUrl = "https://foo/bar"; @@ -119,7 +119,7 @@ describe("Conversation", () => { const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -158,7 +158,7 @@ describe("Conversation", () => { const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -194,7 +194,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -226,7 +226,7 @@ describe("Conversation", () => { codecs: [new TestCodec()], }); await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -242,7 +242,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -281,7 +281,7 @@ describe("Conversation", () => { codecs: [new TestCodec()], }); await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -297,7 +297,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -311,7 +311,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -350,7 +350,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -376,7 +376,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -404,9 +404,7 @@ describe("Conversation", () => { const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); - const group = await client1.conversations.newConversation([ - user2.account.address, - ]); + const group = await client1.conversations.newGroup([user2.account.address]); expect(group).toBeDefined(); const dmGroup = await client1.conversations.newDm(user3.account.address); expect(dmGroup).toBeDefined(); diff --git a/sdks/node-sdk/test/Conversations.test.ts b/sdks/node-sdk/test/Conversations.test.ts index a6dc93df7..e70215b2b 100644 --- a/sdks/node-sdk/test/Conversations.test.ts +++ b/sdks/node-sdk/test/Conversations.test.ts @@ -12,12 +12,12 @@ describe("Conversations", () => { expect((await client.conversations.listGroups()).length).toBe(0); }); - it("should create a new conversation", async () => { + it("should create a group", async () => { const user1 = createUser(); const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); expect(conversation).toBeDefined(); @@ -71,7 +71,7 @@ describe("Conversations", () => { expect((await client2.conversations.listGroups()).length).toBe(1); }); - it("should create a dm group", async () => { + it("should create a dm", async () => { const user1 = createUser(); const user2 = createUser(); const client1 = await createRegisteredClient(user1); @@ -142,9 +142,7 @@ describe("Conversations", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); await createRegisteredClient(user2); - const group = await client1.conversations.newConversation([ - user2.account.address, - ]); + const group = await client1.conversations.newGroup([user2.account.address]); expect(group).toBeDefined(); expect(group.id).toBeDefined(); const foundGroup = client1.conversations.getConversationById(group.id); @@ -157,9 +155,7 @@ describe("Conversations", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); await createRegisteredClient(user2); - const group = await client1.conversations.newConversation([ - user2.account.address, - ]); + const group = await client1.conversations.newGroup([user2.account.address]); const messageId = await group.send("gm!"); expect(messageId).toBeDefined(); @@ -168,7 +164,7 @@ describe("Conversations", () => { expect(message!.id).toBe(messageId); }); - it("should create a new conversation with options", async () => { + it("should create a group with options", async () => { const user1 = createUser(); const user2 = createUser(); const user3 = createUser(); @@ -179,7 +175,7 @@ describe("Conversations", () => { await createRegisteredClient(user3); await createRegisteredClient(user4); await createRegisteredClient(user5); - const groupWithName = await client1.conversations.newConversation( + const groupWithName = await client1.conversations.newGroup( [user2.account.address], { groupName: "foo", @@ -189,7 +185,7 @@ describe("Conversations", () => { expect(groupWithName.name).toBe("foo"); expect(groupWithName.imageUrl).toBe(""); - const groupWithImageUrl = await client1.conversations.newConversation( + const groupWithImageUrl = await client1.conversations.newGroup( [user3.account.address], { groupImageUrlSquare: "https://foo/bar.png", @@ -199,16 +195,18 @@ describe("Conversations", () => { expect(groupWithImageUrl.name).toBe(""); expect(groupWithImageUrl.imageUrl).toBe("https://foo/bar.png"); - const groupWithNameAndImageUrl = - await client1.conversations.newConversation([user4.account.address], { + const groupWithNameAndImageUrl = await client1.conversations.newGroup( + [user4.account.address], + { groupImageUrlSquare: "https://foo/bar.png", groupName: "foo", - }); + }, + ); expect(groupWithNameAndImageUrl).toBeDefined(); expect(groupWithNameAndImageUrl.name).toBe("foo"); expect(groupWithNameAndImageUrl.imageUrl).toBe("https://foo/bar.png"); - const groupWithPermissions = await client1.conversations.newConversation( + const groupWithPermissions = await client1.conversations.newGroup( [user4.account.address], { permissions: GroupPermissionsOptions.AdminOnly, @@ -232,7 +230,7 @@ describe("Conversations", () => { updateGroupPinnedFrameUrlPolicy: 2, }); - const groupWithDescription = await client1.conversations.newConversation( + const groupWithDescription = await client1.conversations.newGroup( [user2.account.address], { groupDescription: "foo", @@ -243,7 +241,7 @@ describe("Conversations", () => { expect(groupWithDescription.imageUrl).toBe(""); expect(groupWithDescription.description).toBe("foo"); - const groupWithPinnedFrameUrl = await client1.conversations.newConversation( + const groupWithPinnedFrameUrl = await client1.conversations.newGroup( [user2.account.address], { groupPinnedFrameUrl: "https://foo/bar", @@ -264,10 +262,10 @@ describe("Conversations", () => { const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); const stream = client3.conversations.stream(); - const conversation1 = await client1.conversations.newConversation([ + const conversation1 = await client1.conversations.newGroup([ user3.account.address, ]); - const conversation2 = await client2.conversations.newConversation([ + const conversation2 = await client2.conversations.newGroup([ user3.account.address, ]); let count = 0; @@ -301,10 +299,10 @@ describe("Conversations", () => { const client4 = await createRegisteredClient(user4); const stream = client3.conversations.streamGroups(); await client4.conversations.newDm(user3.account.address); - const group1 = await client1.conversations.newConversation([ + const group1 = await client1.conversations.newGroup([ user3.account.address, ]); - const group2 = await client2.conversations.newConversation([ + const group2 = await client2.conversations.newGroup([ user3.account.address, ]); let count = 0; @@ -331,8 +329,8 @@ describe("Conversations", () => { const client3 = await createRegisteredClient(user3); const client4 = await createRegisteredClient(user4); const stream = client3.conversations.streamDms(); - await client1.conversations.newConversation([user3.account.address]); - await client2.conversations.newConversation([user3.account.address]); + await client1.conversations.newGroup([user3.account.address]); + await client2.conversations.newGroup([user3.account.address]); const group3 = await client4.conversations.newDm(user3.account.address); let count = 0; for await (const convo of stream) { @@ -353,8 +351,8 @@ describe("Conversations", () => { const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); - await client1.conversations.newConversation([user2.account.address]); - await client1.conversations.newConversation([user3.account.address]); + await client1.conversations.newGroup([user2.account.address]); + await client1.conversations.newGroup([user3.account.address]); const stream = await client1.conversations.streamAllMessages(); @@ -391,8 +389,8 @@ describe("Conversations", () => { const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); const client4 = await createRegisteredClient(user4); - await client1.conversations.newConversation([user2.account.address]); - await client1.conversations.newConversation([user3.account.address]); + await client1.conversations.newGroup([user2.account.address]); + await client1.conversations.newGroup([user3.account.address]); await client1.conversations.newDm(user4.account.address); const stream = await client1.conversations.streamAllGroupMessages(); @@ -437,8 +435,8 @@ describe("Conversations", () => { const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); const client4 = await createRegisteredClient(user4); - await client1.conversations.newConversation([user2.account.address]); - await client1.conversations.newConversation([user3.account.address]); + await client1.conversations.newGroup([user2.account.address]); + await client1.conversations.newGroup([user3.account.address]); await client1.conversations.newDm(user4.account.address); const stream = await client1.conversations.streamAllDmMessages();