File tree 8 files changed +465
-0
lines changed
8 files changed +465
-0
lines changed Original file line number Diff line number Diff line change
1
+ WALLET_KEY = # the private key of the wallet
2
+ ENCRYPTION_KEY = # a second random 32 bytes encryption key for local db encryption
Original file line number Diff line number Diff line change
1
+ # Main
2
+ .env
3
+ node_modules /
4
+ .data /
5
+ dist /
6
+ .DS_Store
7
+
8
+ # Logs
9
+ logs /
10
+ * .log
11
+ npm-debug.log *
12
+ yarn-debug.log *
13
+ yarn-error.log *
14
+
15
+ # IDE files
16
+ .vscode /
17
+ .idea /
18
+
19
+ # packages
20
+ .yarn /
21
+ .pnpm /
22
+ .pnpm-workspace /
Original file line number Diff line number Diff line change
1
+ ## GM agent
2
+
3
+ > Try XMTP using [ xmtp.chat] ( https://xmtp.chat )
4
+
5
+ This agent replies GM
6
+
7
+ ``` tsx
8
+ import { Message , xmtpClient } from " @xmtp/agent-starter" ;
9
+
10
+ async function main() {
11
+ const client = await xmtpClient ({
12
+ walletKey: process .env .WALLET_KEY as string ,
13
+ onMessage : async (message : Message ) => {
14
+ console .log (
15
+ ` Decoded message: ${message ?.content .text } by ${message .sender .address } ` ,
16
+ );
17
+ await client .send ({
18
+ message: " gm" ,
19
+ originalMessage: message ,
20
+ });
21
+ },
22
+ });
23
+
24
+ console .log (" client is up and running..." );
25
+ }
26
+
27
+ main ().catch (console .error );
28
+ ```
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " @example/gm-text" ,
3
+ "private" : true ,
4
+ "type" : " module" ,
5
+ "scripts" : {
6
+ "build" : " tsc" ,
7
+ "clean" : " rm -rf .turbo && rm -rf node_modules && rm -rf dist" ,
8
+ "dev" : " tsc -w & sleep 1 && NODE_NO_WARNINGS=1 node --watch dist/index.js" ,
9
+ "start" : " node dist/index.js"
10
+ },
11
+ "dependencies" : {
12
+ "@xmtp/content-type-text" : " ^2.0.0" ,
13
+ "@xmtp/node-sdk" : " ^0.0.40"
14
+ },
15
+ "devDependencies" : {
16
+ "@types/express" : " ^4.17.21" ,
17
+ "@types/node" : " ^22.10.9" ,
18
+ "typescript" : " ^5.7.3"
19
+ },
20
+ "engines" : {
21
+ "node" : " >=22"
22
+ }
23
+ }
Original file line number Diff line number Diff line change
1
+ import { xmtpClient , type Message } from "./lib/helper.js" ;
2
+
3
+ async function main ( ) {
4
+ const client = await xmtpClient ( {
5
+ walletKey : process . env . WALLET_KEY as string ,
6
+ onMessage : async ( message : Message ) => {
7
+ console . log (
8
+ `Decoded message: ${ message . content . text } by ${ message . sender . address } ` ,
9
+ ) ;
10
+ await client . send ( {
11
+ message : "gm" ,
12
+ originalMessage : message ,
13
+ } ) ;
14
+ } ,
15
+ } ) ;
16
+
17
+ console . log (
18
+ `XMTP agent initialized on ${ client . address } \nSend a message on https://converse.xyz/dm/${ client . address } ` ,
19
+ ) ;
20
+ }
21
+
22
+ main ( ) . catch ( console . error ) ;
You can’t perform that action at this time.
0 commit comments