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 diff --git a/examples/gated-group/README.md b/examples/gated-group/README.md index 66fc2b4..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://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, }); return; diff --git a/examples/gated-group/src/index.ts b/examples/gated-group/src/index.ts index 725a1e0..d05b0f2 100644 --- a/examples/gated-group/src/index.ts +++ b/examples/gated-group/src/index.ts @@ -20,9 +20,8 @@ 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://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: {}, }); @@ -68,7 +67,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}`, ); } diff --git a/examples/gm/src/index.ts b/examples/gm/src/index.ts index 0241131..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 https://xmtp.chat/dm/${client.address}`, + `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 5c038a6..dc54c0f 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}`, ); } diff --git a/packages/agent-starter/tests/Deeplink.test.ts b/packages/agent-starter/tests/Deeplink.test.ts new file mode 100644 index 0000000..e669180 --- /dev/null +++ b/packages/agent-starter/tests/Deeplink.test.ts @@ -0,0 +1,28 @@ +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(); + + if (!xmtp.address) { + expect(xmtp.address).toBeUndefined(); + return; + } + const inboxId = await xmtp.client?.getInboxIdByAddress(xmtp.address); + if (!inboxId) { + expect(inboxId).toBeUndefined(); + return; + } + + let dm = xmtp.client?.conversations.getDmByInboxId(inboxId); + console.log("dm", dm); + if (!dm) { + const dmGroup = await xmtp.client?.conversations.newDm(xmtp.address); + dm = dmGroup; + } + console.log("dm", dm?.id); + expect(dm?.id).toBeDefined(); + }, 25000); +});