From c493ed6a2d9ef6dda67e41daf77fff83b8ecb902 Mon Sep 17 00:00:00 2001 From: fabri Date: Sat, 25 Jan 2025 18:26:21 -0500 Subject: [PATCH 1/8] init --- examples/gated-group/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gated-group/README.md b/examples/gated-group/README.md index 66fc2b4..b125c6a 100644 --- a/examples/gated-group/README.md +++ b/examples/gated-group/README.md @@ -28,7 +28,7 @@ const agent = await xmtpClient({ ); console.log("Group created", group?.id); await client.send({ - message: `Group created!\n- ID: ${group?.id}\n- Group URL: https://converse.xyz/group/${group?.id}: \n- This url will deelink to the group inside Converse\n- Once in the other group you can share the invite with your friends.`, + message: `Group created!\n- ID: ${group?.id}\n- Group URL: https://xmtp.chat.xyz/${group?.id}: \n- This url will deelink to the group inside Converse\n- Once in the other group you can share the invite with your friends.`, originalMessage: message, }); return; From 0ee35fdcfb06540a1630162bea2f715ee6e4bf9a Mon Sep 17 00:00:00 2001 From: fabri Date: Sat, 25 Jan 2025 18:49:13 -0500 Subject: [PATCH 2/8] deeplink test --- packages/agent-starter/tests/Deeplink.test.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 packages/agent-starter/tests/Deeplink.test.ts diff --git a/packages/agent-starter/tests/Deeplink.test.ts b/packages/agent-starter/tests/Deeplink.test.ts new file mode 100644 index 0000000..5aa9172 --- /dev/null +++ b/packages/agent-starter/tests/Deeplink.test.ts @@ -0,0 +1,29 @@ +import { XMTP } from "@xmtp/agent-starter"; +import { describe, expect, test } from "vitest"; + +describe("Deeplink Tests", () => { + test("If no dm created, create one", async () => { + const xmtp = new XMTP(); + await xmtp.init(); + console.log("address", xmtp.address); + if (!xmtp.address) { + expect(xmtp.address).toBeUndefined(); + return; + } + const inboxId = await xmtp.client?.getInboxIdByAddress(xmtp.address); + if (!inboxId) { + expect(inboxId).toBeUndefined(); + return; + } + console.log("inboxId", inboxId); + let dm = xmtp.client?.conversations.getDmByInboxId(inboxId); + console.log("dm", dm); + if (!dm) { + const dmGroup = await xmtp.client?.conversations.newDm(xmtp.address); + console.log("dmGroup", dmGroup); + dm = dmGroup; + } + console.log("dm", dm?.id); + expect(dm?.id).toBeDefined(); + }, 25000); +}); From bda2004a6751894f742dd08706601ef0aaa8c53a Mon Sep 17 00:00:00 2001 From: fabri Date: Sat, 25 Jan 2025 18:51:10 -0500 Subject: [PATCH 3/8] test --- packages/agent-starter/tests/Deeplink.test.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/agent-starter/tests/Deeplink.test.ts b/packages/agent-starter/tests/Deeplink.test.ts index 5aa9172..e669180 100644 --- a/packages/agent-starter/tests/Deeplink.test.ts +++ b/packages/agent-starter/tests/Deeplink.test.ts @@ -5,7 +5,7 @@ describe("Deeplink Tests", () => { test("If no dm created, create one", async () => { const xmtp = new XMTP(); await xmtp.init(); - console.log("address", xmtp.address); + if (!xmtp.address) { expect(xmtp.address).toBeUndefined(); return; @@ -15,12 +15,11 @@ describe("Deeplink Tests", () => { expect(inboxId).toBeUndefined(); return; } - console.log("inboxId", inboxId); + let dm = xmtp.client?.conversations.getDmByInboxId(inboxId); console.log("dm", dm); if (!dm) { const dmGroup = await xmtp.client?.conversations.newDm(xmtp.address); - console.log("dmGroup", dmGroup); dm = dmGroup; } console.log("dm", dm?.id); From f17893354f69b21c581b923c2752330b36cd6463 Mon Sep 17 00:00:00 2001 From: fabri Date: Sat, 25 Jan 2025 19:17:56 -0500 Subject: [PATCH 4/8] env prod --- examples/gated-group/src/index.ts | 2 +- examples/gm/src/index.ts | 2 +- examples/gpt/src/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/gated-group/src/index.ts b/examples/gated-group/src/index.ts index 725a1e0..f13bf29 100644 --- a/examples/gated-group/src/index.ts +++ b/examples/gated-group/src/index.ts @@ -68,7 +68,7 @@ async function main() { ); }); console.log( - `XMTP client initialized on ${client.address}\nSend a message on https://xmtp.chat/dm/${client.address}`, + `XMTP agent initialized on ${client.address}\nSend a message on http://xmtp.chat/dm/${client.address}?env=production`, ); } diff --git a/examples/gm/src/index.ts b/examples/gm/src/index.ts index 0241131..a06ba12 100644 --- a/examples/gm/src/index.ts +++ b/examples/gm/src/index.ts @@ -16,7 +16,7 @@ async function main() { }); console.log( - `XMTP agent initialized on ${client.address}\nSend a message on https://xmtp.chat/dm/${client.address}`, + `XMTP agent initialized on ${client.address}\nSend a message on http://xmtp.chat/dm/${client.address}?env=production`, ); } diff --git a/examples/gpt/src/index.ts b/examples/gpt/src/index.ts index 5c038a6..3bc243b 100644 --- a/examples/gpt/src/index.ts +++ b/examples/gpt/src/index.ts @@ -36,7 +36,7 @@ async function main() { }); console.log( - `XMTP client initialized on ${client.address}\nSend a message on https://xmtp.chat/dm/${client.address}`, + `XMTP agent initialized on ${client.address}\nSend a message on http://xmtp.chat/dm/${client.address}?env=production`, ); } From 9ea47950f7371a04155da502dd2c27f759094cf7 Mon Sep 17 00:00:00 2001 From: fabri Date: Sat, 25 Jan 2025 19:30:29 -0500 Subject: [PATCH 5/8] label --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1bee76c..a3e7526 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,7 @@ Result: > Learn more about [`lookup`](/packages/lookup/) library -## Quickstart +## Development ```bash # clone the repository From 9c7d1f4d8e58befcdcced0e213419b1fe467c455 Mon Sep 17 00:00:00 2001 From: fabri Date: Sat, 25 Jan 2025 20:03:08 -0500 Subject: [PATCH 6/8] ok --- examples/gated-group/src/index.ts | 2 +- examples/gm/src/index.ts | 2 +- examples/gpt/src/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/gated-group/src/index.ts b/examples/gated-group/src/index.ts index f13bf29..924e727 100644 --- a/examples/gated-group/src/index.ts +++ b/examples/gated-group/src/index.ts @@ -68,7 +68,7 @@ async function main() { ); }); console.log( - `XMTP agent initialized on ${client.address}\nSend a message on http://xmtp.chat/dm/${client.address}?env=production`, + `XMTP agent initialized on ${client.address}\nSend a message on http://xmtp.chat/dm/${client.address}`, ); } diff --git a/examples/gm/src/index.ts b/examples/gm/src/index.ts index a06ba12..d683248 100644 --- a/examples/gm/src/index.ts +++ b/examples/gm/src/index.ts @@ -16,7 +16,7 @@ async function main() { }); console.log( - `XMTP agent initialized on ${client.address}\nSend a message on http://xmtp.chat/dm/${client.address}?env=production`, + `XMTP agent initialized on ${client.address}\nSend a message on http://xmtp.chat/dm/${client.address}`, ); } diff --git a/examples/gpt/src/index.ts b/examples/gpt/src/index.ts index 3bc243b..dc54c0f 100644 --- a/examples/gpt/src/index.ts +++ b/examples/gpt/src/index.ts @@ -36,7 +36,7 @@ async function main() { }); console.log( - `XMTP agent initialized on ${client.address}\nSend a message on http://xmtp.chat/dm/${client.address}?env=production`, + `XMTP agent initialized on ${client.address}\nSend a message on http://xmtp.chat/dm/${client.address}`, ); } From baf6a029f19a9cc3597bab7565b4768500a1dd81 Mon Sep 17 00:00:00 2001 From: fabri Date: Sat, 25 Jan 2025 20:05:33 -0500 Subject: [PATCH 7/8] ok --- examples/gated-group/README.md | 2 +- examples/gated-group/src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/gated-group/README.md b/examples/gated-group/README.md index b125c6a..96d5cc0 100644 --- a/examples/gated-group/README.md +++ b/examples/gated-group/README.md @@ -28,7 +28,7 @@ const agent = await xmtpClient({ ); console.log("Group created", group?.id); await client.send({ - message: `Group created!\n- ID: ${group?.id}\n- Group URL: https://xmtp.chat.xyz/${group?.id}: \n- This url will deelink to the group inside Converse\n- Once in the other group you can share the invite with your friends.`, + message: `Group created!\n- ID: ${group?.id}\n- Group URL: https://xmtp.chat/conversations/${group?.id}: \n- This url will deeplink to the group created\n- Once in the other group you can share the invite with your friends.`, originalMessage: message, }); return; diff --git a/examples/gated-group/src/index.ts b/examples/gated-group/src/index.ts index 924e727..884e61e 100644 --- a/examples/gated-group/src/index.ts +++ b/examples/gated-group/src/index.ts @@ -22,7 +22,7 @@ async function main() { ); console.log("Group created", group?.id); await client.send({ - message: `Group created!\n- ID: ${group?.id}\n- Group URL: https://converse.xyz/group/${group?.id}: \n- This url will deelink to the group inside Converse\n- Once in the other group you can share the invite with your friends.`, + message: `Group created!\n- ID: ${group?.id}\n- Group URL: https://xmtp.chat/conversations/${group?.id}: \n- This url will deeplink to the group created\n- Once in the other group you can share the invite with your friends.`, originalMessage: message, metadata: {}, }); From db7da83f0b6b0039d4b08b4a96fa1c64bdcf0931 Mon Sep 17 00:00:00 2001 From: fabri Date: Sat, 25 Jan 2025 20:06:39 -0500 Subject: [PATCH 8/8] copy --- examples/gated-group/src/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/gated-group/src/index.ts b/examples/gated-group/src/index.ts index 884e61e..d05b0f2 100644 --- a/examples/gated-group/src/index.ts +++ b/examples/gated-group/src/index.ts @@ -20,7 +20,6 @@ async function main() { message.sender.address, client.address as string, ); - console.log("Group created", group?.id); await client.send({ message: `Group created!\n- ID: ${group?.id}\n- Group URL: https://xmtp.chat/conversations/${group?.id}: \n- This url will deeplink to the group created\n- Once in the other group you can share the invite with your friends.`, originalMessage: message,