create-message-kit 1.2.21 → 1.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +2 -5
  2. package/index.js +7 -3
  3. package/package.json +2 -2
  4. package/templates/coinbase-agent/src/index.ts +5 -7
  5. package/templates/ens/src/index.ts +4 -24
  6. package/templates/ens/src/skills/info.ts +6 -3
  7. package/templates/faucet/src/index.ts +5 -16
  8. package/templates/gated-group/src/index.ts +2 -2
  9. package/templates/gm/src/index.ts +15 -7
  10. package/templates/hackathon-store/.env.example +6 -0
  11. package/templates/{thegeneralstore → hackathon-store}/package.json +1 -5
  12. package/templates/hackathon-store/src/index.ts +47 -0
  13. package/templates/{thegeneralstore → hackathon-store}/src/plugins/notion.ts +0 -29
  14. package/templates/hackathon-store/src/prompt.md +27 -0
  15. package/templates/playground/src/index.ts +9 -8
  16. package/templates/playground/src/vibes/chill.ts +9 -0
  17. package/templates/playground/src/vibes/friendly.ts +9 -0
  18. package/templates/playground/src/vibes/inquisitive.ts +10 -0
  19. package/templates/playground/src/vibes/playful.ts +10 -0
  20. package/templates/playground/src/vibes/professional.ts +9 -0
  21. package/templates/simple/src/index.ts +10 -9
  22. package/templates/toss/.env.example +1 -0
  23. package/templates/toss/src/index.ts +7 -10
  24. package/templates/toss/src/skills/toss.ts +0 -114
  25. package/templates/toss/src/skills/waas.ts +116 -0
  26. package/templates.json +58 -0
  27. package/templates/thegeneralstore/.env.example +0 -9
  28. package/templates/thegeneralstore/src/data/db.json +0 -812
  29. package/templates/thegeneralstore/src/index.ts +0 -37
  30. package/templates/thegeneralstore/src/plugins/learnweb3.ts +0 -96
  31. package/templates/thegeneralstore/src/plugins/lowdb.ts +0 -11
  32. package/templates/thegeneralstore/src/plugins/redis.ts +0 -15
  33. package/templates/thegeneralstore/src/prompt.md +0 -51
  34. package/templates/thegeneralstore/src/prompt.ts +0 -3
  35. package/templates/thegeneralstore/src/skills/faucet.ts +0 -114
  36. package/templates/thegeneralstore/src/skills/notion.ts +0 -17
  37. package/templates/thegeneralstore/src/skills/poap.ts +0 -48
  38. package/templates/thegeneralstore/src/skills.ts +0 -37
  39. /package/templates/{thegeneralstore → hackathon-store}/.cursorrules +0 -0
  40. /package/templates/{thegeneralstore → hackathon-store}/.yarnrc.yml +0 -0
@@ -0,0 +1,116 @@
1
+ import { Skill, XMTPContext, getUserInfo } from "@xmtp/message-kit";
2
+ import { DM_HELP_MESSAGE } from "../plugins/helpers.js";
3
+
4
+ export const waas: Skill[] = [
5
+ {
6
+ skill: "create",
7
+ description: "Create an agent wallet.",
8
+ handler: handleDM,
9
+ examples: ["/create"],
10
+ },
11
+ {
12
+ skill: "fund",
13
+ description: "Fund your account.",
14
+ handler: handleDM,
15
+ examples: ["/fund 10"],
16
+ params: {
17
+ amount: {
18
+ type: "number",
19
+ },
20
+ },
21
+ },
22
+ {
23
+ skill: "withdraw",
24
+ description: "Withdraw funds from your account.",
25
+ handler: handleDM,
26
+ examples: ["/withdraw 10"],
27
+ params: {
28
+ amount: {
29
+ type: "number",
30
+ },
31
+ },
32
+ },
33
+ {
34
+ skill: "help",
35
+ description: "Get help with tossing.",
36
+ handler: handleDM,
37
+ examples: ["/help"],
38
+ },
39
+ {
40
+ skill: "balance",
41
+ description: "Check your balance.",
42
+ handler: handleDM,
43
+ examples: ["/balance"],
44
+ },
45
+ ];
46
+
47
+ export async function handleDM(context: XMTPContext) {
48
+ const {
49
+ message: {
50
+ content: {
51
+ skill,
52
+ params: { amount },
53
+ },
54
+ sender,
55
+ },
56
+ group,
57
+ walletService,
58
+ } = context;
59
+ if (group && skill == "help") {
60
+ await context.reply("Check your DM's");
61
+ await context.sendTo(DM_HELP_MESSAGE, [sender.address]);
62
+ return;
63
+ } else if (skill === "help") {
64
+ await context.send(DM_HELP_MESSAGE);
65
+ } else if (skill === "create") {
66
+ const walletExist = await walletService.getWallet(sender.address);
67
+ if (walletExist) {
68
+ await context.reply("You already have an agent wallet.");
69
+ return;
70
+ }
71
+ await walletService.createWallet(sender.address);
72
+ } else if (skill === "balance") {
73
+ context.sendTo(
74
+ `Your agent wallet for address is ${sender.address}\nBalance: $${await walletService.checkBalance(sender.address)}`,
75
+ [sender.address],
76
+ );
77
+ } else if (skill === "fund") {
78
+ const balance = await walletService.checkBalance(sender.address);
79
+ if (balance === 10) {
80
+ await context.reply("You have maxed out your funds.");
81
+ return;
82
+ } else if (amount) {
83
+ if (amount + balance <= 10) {
84
+ return walletService.requestFunds(Number(amount));
85
+ } else {
86
+ await context.send("Wrong amount. Max 10 USDC.");
87
+ return;
88
+ }
89
+ }
90
+ await context.reply(
91
+ `You have $${balance} in your account. You can fund up to $${10 - balance} more.`,
92
+ );
93
+ const options = Array.from({ length: Math.floor(10 - balance) }, (_, i) =>
94
+ (i + 1).toString(),
95
+ );
96
+ const response = await context.awaitResponse(
97
+ `Please specify the amount of USDC to prefund (1 to ${10 - balance}):`,
98
+ options,
99
+ );
100
+ return walletService.requestFunds(Number(response));
101
+ } else if (skill === "withdraw") {
102
+ const balance = await walletService.checkBalance(sender.address);
103
+ if (balance === 0) {
104
+ await context.reply("You have no funds to withdraw.");
105
+ return;
106
+ }
107
+ const options = Array.from({ length: Math.floor(balance) }, (_, i) =>
108
+ (i + 1).toString(),
109
+ );
110
+ const response = await context.awaitResponse(
111
+ `Please specify the amount of USDC to withdraw (1 to ${balance}):`,
112
+ options,
113
+ );
114
+ await walletService.withdrawFunds(Number(response));
115
+ }
116
+ }
package/templates.json ADDED
@@ -0,0 +1,58 @@
1
+ [
2
+ {
3
+ "href": "/templates/ens",
4
+ "title": "ENS Agent",
5
+ "description": "A template for working with ENS domains.",
6
+ "icon": "🔗",
7
+ "author": "humanagent"
8
+ },
9
+ {
10
+ "href": "/templates/simple",
11
+ "title": "Simple Template",
12
+ "description": "A simple template without skills.",
13
+ "icon": "🤖",
14
+ "author": "humanagent"
15
+ },
16
+ {
17
+ "href": "/templates/coinbase-agent",
18
+ "title": "Coinbase Agent",
19
+ "description": "A template for a Coinbase features.",
20
+ "icon": "💰",
21
+ "author": "humanagent"
22
+ },
23
+ {
24
+ "href": "/templates/hackathon-store",
25
+ "title": "Hackathon Store",
26
+ "description": "All the goodies needed in a hackathon.",
27
+ "icon": "🏪",
28
+ "author": "humanagent"
29
+ },
30
+ {
31
+ "href": "/templates/faucet",
32
+ "title": "Faucet Agent",
33
+ "description": "A template for requesting testnet funds.",
34
+ "icon": "💧",
35
+ "author": "humanagent"
36
+ },
37
+ {
38
+ "href": "/templates/gated-group",
39
+ "title": "Gated Group",
40
+ "description": "A template for a gated group.",
41
+ "icon": "🔒",
42
+ "author": "humanagent"
43
+ },
44
+ {
45
+ "href": "/templates/gm",
46
+ "title": "GM Bot",
47
+ "description": "A template for a GM bot.",
48
+ "icon": "👑",
49
+ "author": "humanagent"
50
+ },
51
+ {
52
+ "href": "/templates/toss",
53
+ "title": "Toss",
54
+ "description": "A friendly game for groups.",
55
+ "icon": "🪙",
56
+ "author": "humanagent"
57
+ }
58
+ ]
@@ -1,9 +0,0 @@
1
- KEY= # the private key of the agent wallet
2
- TEST_ENCRYPTION_KEY= # a different private key for encryption
3
- NOTION_API_KEY= # your Notion API key
4
- NOTION_PAGE_ID= # the ID of the Notion page
5
- NOTION_POAP_DB= # the ID of the Notion database
6
- OPEN_AI_API_KEY= # your OpenAI API key
7
- REDIS_CONNECTION_STRING= # your Redis connection string
8
- LEARN_WEB3_API_KEY= # your Learn Web3 API key
9
- FRAME_BASE_URL= # the URL of the Frame API