Skip to content

Commit 3078648

Browse files
committed
update to rc
1 parent b46fd64 commit 3078648

16 files changed

+68
-39
lines changed

examples/gated-group/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Start your XMTP client and begin listening to messages. The bot responds to the
3333
if (message.content === "/create") {
3434
console.log("Creating group");
3535
const group = await client.conversations.newGroup([]);
36-
await group.addMembersByInboxId([message.senderInboxId]);
36+
await group.addMembers([message.senderInboxId]);
3737
await group.addSuperAdmin(message.senderInboxId);
3838

3939
await conversation.send(

examples/gated-group/index.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ async function main() {
3636
console.log("Syncing conversations...");
3737
await client.conversations.sync();
3838

39+
const identifier = await signer.getIdentifier();
40+
const address = identifier.identifier;
3941
console.log(
40-
`Agent initialized on ${client.accountAddress}\nSend a message on http://xmtp.chat/dm/${client.accountAddress}`,
42+
`Agent initialized on ${address}\nSend a message on http://xmtp.chat/dm/${address}`,
4143
);
4244

4345
console.log("Waiting for messages...");
@@ -74,7 +76,7 @@ async function main() {
7476
const group = await client.conversations.newGroup([]);
7577
console.log("Group created", group.id);
7678
// First add the sender to the group
77-
await group.addMembersByInboxId([message.senderInboxId]);
79+
await group.addMembers([message.senderInboxId]);
7880
// Then make the sender a super admin
7981
await group.addSuperAdmin(message.senderInboxId);
8082
console.log(

examples/gm/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ async function main() {
3636
/* Sync the conversations from the network to update the local db */
3737
await client.conversations.sync();
3838

39+
const identifier = await signer.getIdentifier();
40+
const address = identifier.identifier;
3941
console.log(
40-
`Agent initialized on ${client.accountAddress}\nSend a message on http://xmtp.chat/dm/${client.accountAddress}?env=${env}`,
42+
`Agent initialized on ${address}\nSend a message on http://xmtp.chat/dm/${address}`,
4143
);
4244

4345
console.log("Waiting for messages...");

examples/gm/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ async function main() {
3030
/* Sync the conversations from the network to update the local db */
3131
await client.conversations.sync();
3232

33+
const identifier = await signer.getIdentifier();
34+
const address = identifier.identifier;
3335
console.log(
34-
`Agent initialized on ${client.accountAddress}\nSend a message on http://xmtp.chat/dm/${client.accountAddress}?env=${env}`,
36+
`Agent initialized on ${address}\nSend a message on http://xmtp.chat/dm/${address}`,
3537
);
3638

3739
console.log("Waiting for messages...");

examples/gpt/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async function main() {
6060
await client.conversations.sync();
6161

6262
console.log(
63-
`Agent initialized on ${client.accountAddress}\nSend a message on http://xmtp.chat/dm/${client.accountAddress}`,
63+
`Agent initialized on ${address}\nSend a message on http://xmtp.chat/dm/${address}`,
6464
);
6565

6666
console.log("Waiting for messages...");

examples/gpt/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ async function main() {
4646
/* Sync the conversations from the network to update the local db */
4747
await client.conversations.sync();
4848

49+
const identifier = await signer.getIdentifier();
50+
const address = identifier.identifier;
4951
console.log(
50-
`Agent initialized on ${client.accountAddress}\nSend a message on http://xmtp.chat/dm/${client.accountAddress}?env=${env}`,
52+
`Agent initialized on ${address}\nSend a message on http://xmtp.chat/dm/${address}`,
5153
);
5254

5355
console.log("Waiting for messages...");

helpers/index.ts

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
import { getRandomValues } from "node:crypto";
2-
import type { Signer } from "@xmtp/node-sdk";
2+
import { IdentifierKind } from "@xmtp/node-bindings";
3+
import { type Signer } from "@xmtp/node-sdk";
34
import { fromString, toString } from "uint8arrays";
45
import { createWalletClient, http, toBytes } from "viem";
56
import { privateKeyToAccount } from "viem/accounts";
67
import { sepolia } from "viem/chains";
78

89
interface User {
9-
key: string;
10+
key: `0x${string}`;
1011
account: ReturnType<typeof privateKeyToAccount>;
1112
wallet: ReturnType<typeof createWalletClient>;
1213
}
1314

14-
export const createUser = (key: string): User => {
15-
const account = privateKeyToAccount(key as `0x${string}`);
15+
export const createUser = (key: `0x${string}`): User => {
16+
const accountKey = key;
17+
const account = privateKeyToAccount(accountKey);
1618
return {
17-
key,
19+
key: accountKey,
1820
account,
1921
wallet: createWalletClient({
2022
account,
@@ -24,11 +26,14 @@ export const createUser = (key: string): User => {
2426
};
2527
};
2628

27-
export const createSigner = (key: string): Signer => {
29+
export const createSigner = (key: `0x${string}`): Signer => {
2830
const user = createUser(key);
2931
return {
30-
walletType: "EOA",
31-
getAddress: () => user.account.address,
32+
type: "EOA",
33+
getIdentifier: () => ({
34+
identifierKind: IdentifierKind.Ethereum,
35+
identifier: user.account.address.toLowerCase(),
36+
}),
3237
signMessage: async (message: string) => {
3338
const signature = await user.wallet.signMessage({
3439
message,

integrations/gaia/README.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ import { Client, type XmtpEnv } from "@xmtp/node-sdk";
3232
import OpenAI from "openai";
3333
import { createSigner, getEncryptionKeyFromHex } from "@/helpers";
3434

35-
const { WALLET_KEY, ENCRYPTION_KEY, GAIA_NODE_URL, GAIA_API_KEY, GAIA_MODEL_NAME } = process.env;
35+
const {
36+
WALLET_KEY,
37+
ENCRYPTION_KEY,
38+
GAIA_NODE_URL,
39+
GAIA_API_KEY,
40+
GAIA_MODEL_NAME,
41+
} = process.env;
3642

3743
if (!WALLET_KEY) {
3844
throw new Error("WALLET_KEY must be set");
@@ -59,9 +65,9 @@ if (!GAIA_MODEL_NAME) {
5965

6066
const signer = createSigner(WALLET_KEY);
6167
const encryptionKey = getEncryptionKeyFromHex(ENCRYPTION_KEY);
62-
const openai = new OpenAI({
63-
baseURL: GAIA_NODE_URL,
64-
apiKey: GAIA_API_KEY
68+
const openai = new OpenAI({
69+
baseURL: GAIA_NODE_URL,
70+
apiKey: GAIA_API_KEY,
6571
});
6672

6773
/* Set the environment to dev or production */
@@ -77,8 +83,10 @@ async function main() {
7783
/* Sync the conversations from the network to update the local db */
7884
await client.conversations.sync();
7985

86+
const identifier = await signer.getIdentifier();
87+
const address = identifier.identifier;
8088
console.log(
81-
`Agent initialized on ${client.accountAddress}\nSend a message on http://xmtp.chat/dm/${client.accountAddress}`,
89+
`Agent initialized on ${address}\nSend a message on http://xmtp.chat/dm/${address}`,
8290
);
8391

8492
console.log("Waiting for messages...");

integrations/gaia/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ async function main() {
6565
/* Sync the conversations from the network to update the local db */
6666
await client.conversations.sync();
6767

68+
const identifier = await signer.getIdentifier();
69+
const address = identifier.identifier;
6870
console.log(
69-
`Agent initialized on ${client.accountAddress}\nSend a message on http://xmtp.chat/dm/${client.accountAddress}`,
71+
`Agent initialized on ${address}\nSend a message on http://xmtp.chat/dm/${address}`,
7072
);
7173

7274
console.log("Waiting for messages...");

integrations/gaia/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"gen:keys": "tsx ../../scripts/generateKeys.ts"
99
},
1010
"dependencies": {
11-
"@xmtp/node-sdk": "0.0.47",
11+
"@xmtp/node-sdk": "1.0.0-rc1",
1212
"tsx": "^4.19.2",
1313
"uint8arrays": "^5.1.0",
1414
"viem": "^2.22.17"

integrations/grok/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,12 @@ async function main() {
6868
/* Sync the conversations from the network to update the local db */
6969
await client.conversations.sync();
7070

71+
const identifier = await signer.getIdentifier();
72+
const address = identifier.identifier;
7173
console.log(
72-
`Agent initialized on ${client.accountAddress}\nSend a message on http://xmtp.chat/dm/${client.accountAddress}?env=${env}`,
74+
`Agent initialized on ${address}\nSend a message on http://xmtp.chat/dm/${address}`,
7375
);
76+
7477
console.log("Waiting for messages...");
7578
/* Stream all messages from the network */
7679
const stream = client.conversations.streamAllMessages();

integrations/grok/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ async function main() {
4242
/* Sync the conversations from the network to update the local db */
4343
await client.conversations.sync();
4444

45+
const identifier = await signer.getIdentifier();
46+
const address = identifier.identifier;
4547
console.log(
46-
`Agent initialized on ${client.accountAddress}\nSend a message on http://xmtp.chat/dm/${client.accountAddress}?env=${env}`,
48+
`Agent initialized on ${address}\nSend a message on http://xmtp.chat/dm/${address}`,
4749
);
50+
4851
console.log("Waiting for messages...");
4952
/* Stream all messages from the network */
5053
const stream = client.conversations.streamAllMessages();

integrations/grok/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"gen:keys": "tsx ../../scripts/generateKeys.ts"
99
},
1010
"dependencies": {
11-
"@xmtp/node-sdk": "0.0.47",
11+
"@xmtp/node-sdk": "1.0.0-rc1",
1212
"tsx": "^4.19.2",
1313
"uint8arrays": "^5.1.0",
1414
"viem": "^2.22.17"

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"typecheck": "tsc"
2222
},
2323
"dependencies": {
24-
"@xmtp/node-sdk": "0.0.47",
24+
"@xmtp/node-sdk": "1.0.0-rc1",
2525
"alchemy-sdk": "^3.0.0",
2626
"openai": "latest",
2727
"tsx": "^4.19.2",

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"declaration": true,
77
"declarationMap": true,
88
"forceConsistentCasingInFileNames": true,
9-
"isolatedModules": true,
9+
"isolatedModules": false,
1010
"lib": ["ESNext"],
1111
"module": "ESNext",
1212
"moduleResolution": "Bundler",

yarn.lock

+12-12
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ __metadata:
812812
version: 0.0.0-use.local
813813
resolution: "@integrations/gaia@workspace:integrations/gaia"
814814
dependencies:
815-
"@xmtp/node-sdk": "npm:0.0.47"
815+
"@xmtp/node-sdk": "npm:1.0.0-rc1"
816816
tsx: "npm:^4.19.2"
817817
uint8arrays: "npm:^5.1.0"
818818
viem: "npm:^2.22.17"
@@ -823,7 +823,7 @@ __metadata:
823823
version: 0.0.0-use.local
824824
resolution: "@integrations/gpt@workspace:integrations/grok"
825825
dependencies:
826-
"@xmtp/node-sdk": "npm:0.0.47"
826+
"@xmtp/node-sdk": "npm:1.0.0-rc1"
827827
tsx: "npm:^4.19.2"
828828
uint8arrays: "npm:^5.1.0"
829829
viem: "npm:^2.22.17"
@@ -1285,23 +1285,23 @@ __metadata:
12851285
languageName: node
12861286
linkType: hard
12871287

1288-
"@xmtp/node-bindings@npm:^0.0.41":
1289-
version: 0.0.41
1290-
resolution: "@xmtp/node-bindings@npm:0.0.41"
1291-
checksum: 10/809347d36de2b4f205fe46cc3869b1eab7595107fd14b0535457732745d14851121d1e7b0f22a0845deb32e48dfca29a7ad36a12bf9fc5c46b445a308a589c10
1288+
"@xmtp/node-bindings@npm:^1.0.0-rc2":
1289+
version: 1.0.0-rc2
1290+
resolution: "@xmtp/node-bindings@npm:1.0.0-rc2"
1291+
checksum: 10/2cd22b55accdc90f463d983eba43e3b78335e974036622808c42488b99589b9c94a8c7dfce6e76f32d6e5da5fc65cb2888a09f2dc7210a85ed058109f26a50bf
12921292
languageName: node
12931293
linkType: hard
12941294

1295-
"@xmtp/node-sdk@npm:0.0.47":
1296-
version: 0.0.47
1297-
resolution: "@xmtp/node-sdk@npm:0.0.47"
1295+
"@xmtp/node-sdk@npm:1.0.0-rc1":
1296+
version: 1.0.0-rc1
1297+
resolution: "@xmtp/node-sdk@npm:1.0.0-rc1"
12981298
dependencies:
12991299
"@xmtp/content-type-group-updated": "npm:^2.0.0"
13001300
"@xmtp/content-type-primitives": "npm:^2.0.0"
13011301
"@xmtp/content-type-text": "npm:^2.0.0"
1302-
"@xmtp/node-bindings": "npm:^0.0.41"
1302+
"@xmtp/node-bindings": "npm:^1.0.0-rc2"
13031303
"@xmtp/proto": "npm:^3.72.3"
1304-
checksum: 10/bf3b5e59cc5be0b9ec02acd2d7cf59bcae5f478971b5ffc772e6153c8d59515032c95436faf2c741e1de334d9572dc1991098395d9813ec5364f0eb09666a815
1304+
checksum: 10/0f79fd211e56a627250015104c90605ca4b4cf39716877761311bc067c9dcf61b31e687a88880809a6a89d8fdb2729a271b309a961001660a53fec88ae2afbce
13051305
languageName: node
13061306
linkType: hard
13071307

@@ -3842,7 +3842,7 @@ __metadata:
38423842
"@ianvs/prettier-plugin-sort-imports": "npm:^4.4.1"
38433843
"@types/eslint__js": "npm:^8.42.3"
38443844
"@types/node": "npm:^22.13.0"
3845-
"@xmtp/node-sdk": "npm:0.0.47"
3845+
"@xmtp/node-sdk": "npm:1.0.0-rc1"
38463846
alchemy-sdk: "npm:^3.0.0"
38473847
eslint: "npm:^9.19.0"
38483848
eslint-config-prettier: "npm:^10.0.1"

0 commit comments

Comments
 (0)