create-message-kit 1.2.23 → 1.2.25

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 (86) hide show
  1. package/index.js +14 -13
  2. package/package.json +1 -2
  3. package/templates/ens/.cursorrules +0 -112
  4. package/templates/ens/package.json +1 -2
  5. package/templates/ens/src/index.ts +2 -16
  6. package/templates/ens/src/prompt.ts +1 -1
  7. package/templates/simple/.cursorrules +0 -112
  8. package/templates/simple/src/index.ts +0 -1
  9. package/templates/coinbase-agent/.cursorrules +0 -290
  10. package/templates/coinbase-agent/.env.example +0 -4
  11. package/templates/coinbase-agent/.yarnrc.yml +0 -9
  12. package/templates/coinbase-agent/package.json +0 -22
  13. package/templates/coinbase-agent/src/index.ts +0 -29
  14. package/templates/coinbase-agent/src/plugins/learnweb3.ts +0 -96
  15. package/templates/coinbase-agent/src/plugins/redis.ts +0 -15
  16. package/templates/coinbase-agent/src/prompt.ts +0 -64
  17. package/templates/coinbase-agent/src/skills/drip.ts +0 -83
  18. package/templates/coinbase-agent/src/skills/mint.ts +0 -99
  19. package/templates/coinbase-agent/src/skills/pay.ts +0 -35
  20. package/templates/coinbase-agent/src/skills/swap.ts +0 -52
  21. package/templates/faucet/.cursorrules +0 -290
  22. package/templates/faucet/.env.example +0 -5
  23. package/templates/faucet/.yarnrc.yml +0 -9
  24. package/templates/faucet/package.json +0 -22
  25. package/templates/faucet/src/index.ts +0 -28
  26. package/templates/faucet/src/plugins/learnweb3.ts +0 -96
  27. package/templates/faucet/src/plugins/redis.ts +0 -15
  28. package/templates/faucet/src/prompt.ts +0 -11
  29. package/templates/faucet/src/skills/faucet.ts +0 -140
  30. package/templates/gated-group/.cursorrules +0 -290
  31. package/templates/gated-group/.env.example +0 -3
  32. package/templates/gated-group/.yarnrc.yml +0 -9
  33. package/templates/gated-group/package.json +0 -23
  34. package/templates/gated-group/src/index.ts +0 -17
  35. package/templates/gated-group/src/plugins/alchemy.ts +0 -27
  36. package/templates/gated-group/src/plugins/xmtp.ts +0 -137
  37. package/templates/gated-group/src/prompt.ts +0 -11
  38. package/templates/gated-group/src/skills/gated.ts +0 -88
  39. package/templates/gm/.cursorrules +0 -290
  40. package/templates/gm/.env.example +0 -2
  41. package/templates/gm/.yarnrc.yml +0 -9
  42. package/templates/gm/package.json +0 -20
  43. package/templates/gm/src/index.ts +0 -16
  44. package/templates/hackathon-store/.cursorrules +0 -290
  45. package/templates/hackathon-store/.env.example +0 -6
  46. package/templates/hackathon-store/.yarnrc.yml +0 -9
  47. package/templates/hackathon-store/package.json +0 -20
  48. package/templates/hackathon-store/src/index.ts +0 -47
  49. package/templates/hackathon-store/src/plugins/notion.ts +0 -60
  50. package/templates/hackathon-store/src/prompt.md +0 -27
  51. package/templates/playground/.cursorrules +0 -290
  52. package/templates/playground/.env.example +0 -6
  53. package/templates/playground/.yarnrc.yml +0 -9
  54. package/templates/playground/package.json +0 -26
  55. package/templates/playground/src/index.ts +0 -38
  56. package/templates/playground/src/plugins/alchemy.ts +0 -27
  57. package/templates/playground/src/plugins/minilog.ts +0 -26
  58. package/templates/playground/src/plugins/usdc.ts +0 -99
  59. package/templates/playground/src/plugins/xmtp.ts +0 -137
  60. package/templates/playground/src/prompt.ts +0 -11
  61. package/templates/playground/src/skills/broadcast.ts +0 -39
  62. package/templates/playground/src/skills/cash.ts +0 -122
  63. package/templates/playground/src/skills/cryptoPrice.ts +0 -63
  64. package/templates/playground/src/skills/dalle.ts +0 -61
  65. package/templates/playground/src/skills/gated.ts +0 -88
  66. package/templates/playground/src/skills/search.ts +0 -159
  67. package/templates/playground/src/skills/todo.ts +0 -79
  68. package/templates/playground/src/skills/token.ts +0 -57
  69. package/templates/playground/src/skills/web.ts +0 -83
  70. package/templates/playground/src/skills/wordle.ts +0 -96
  71. package/templates/playground/src/vibes/chill.ts +0 -9
  72. package/templates/playground/src/vibes/friendly.ts +0 -9
  73. package/templates/playground/src/vibes/inquisitive.ts +0 -10
  74. package/templates/playground/src/vibes/playful.ts +0 -10
  75. package/templates/playground/src/vibes/professional.ts +0 -9
  76. package/templates/toss/.cursorrules +0 -290
  77. package/templates/toss/.env.example +0 -7
  78. package/templates/toss/.yarnrc.yml +0 -9
  79. package/templates/toss/package.json +0 -21
  80. package/templates/toss/src/index.ts +0 -29
  81. package/templates/toss/src/plugins/helpers.ts +0 -174
  82. package/templates/toss/src/plugins/redis.ts +0 -15
  83. package/templates/toss/src/prompt.ts +0 -54
  84. package/templates/toss/src/skills/toss.ts +0 -318
  85. package/templates/toss/src/skills/waas.ts +0 -116
  86. package/templates.json +0 -58
@@ -1,29 +0,0 @@
1
- import { registerSkill as swapSkill } from "./skills/swap.js";
2
- import { registerSkill as mintSkill } from "./skills/mint.js";
3
- import { registerSkill as dripSkill } from "./skills/drip.js";
4
- import { registerSkill as paySkill } from "./skills/pay.js";
5
- import { run, XMTPContext, agentReply, Agent } from "@xmtp/message-kit";
6
- import { replaceVariables } from "@xmtp/message-kit";
7
- import { systemPrompt } from "./prompt.js";
8
-
9
- export const frameUrl = "https://ens.steer.fun/";
10
- export const baseUrl = "https://base-tx-frame.vercel.app/transaction";
11
- export const ensUrl = "https://app.ens.domains/";
12
-
13
- export const agent: Agent = {
14
- name: "Swap Bot",
15
- tag: "@base",
16
- description: "Swap bot for base.",
17
- skills: [swapSkill, mintSkill, dripSkill, paySkill],
18
- onMessage: async (context: XMTPContext) => {
19
- const {
20
- message: { sender },
21
- agent,
22
- } = context;
23
-
24
- let prompt = await replaceVariables(systemPrompt, sender.address, agent);
25
- await agentReply(context, prompt);
26
- },
27
- };
28
-
29
- run(agent);
@@ -1,96 +0,0 @@
1
- import axios from "axios";
2
-
3
- export const SUPPORTED_NETWORKS = [
4
- "arbitrum_goerli",
5
- "arbitrum_sepolia",
6
- "base_goerli",
7
- "base_sepolia",
8
- "base_sepolia_usdc",
9
- "celo_alfajores",
10
- "fantom_testnet",
11
- "goerli",
12
- "holesky",
13
- "linea_goerli",
14
- "linea_sepolia",
15
- "manta_testnet",
16
- "mode_sepolia",
17
- "morph_sepolia",
18
- "optimism_goerli",
19
- "optimism_sepolia",
20
- "polygon_amoy",
21
- "polygon_mumbai",
22
- "polygon_zkevm",
23
- "scroll_sepolia",
24
- "sepolia",
25
- "taiko_jolnir",
26
- "zksync_sepolia",
27
- "zora_sepolia",
28
- ] as const;
29
-
30
- export const CLAIM_EVERY = 24 * 60 * 60 * 1000; // 24 hours
31
-
32
- export const ONE_DAY = 24 * 60 * 60 * 1000; // 24 hours
33
-
34
- export const FIVE_MINUTES = 5 * 60 * 1000; // 5 minutes
35
-
36
- export const EVM_TOKENS = ["ETH", "MATIC", "USDC", "CELO", "BERA"];
37
-
38
- export interface Network {
39
- networkId: string;
40
- networkName: string;
41
- networkLogo: string;
42
- tokenName: string;
43
- dripAmount: number;
44
- address: string;
45
- isERC20: boolean;
46
- erc20Address?: string;
47
- erc20Decimals?: number;
48
- isActive: boolean;
49
- balance: string;
50
- }
51
- export interface DripTokensResponse {
52
- ok: boolean;
53
- error?: string;
54
- value?: string;
55
- }
56
-
57
- export class LearnWeb3Client {
58
- public BASE_URL = "https://learnweb3.io/api/faucet";
59
- private apiKey = process.env.LEARN_WEB3_API_KEY;
60
- constructor() {
61
- if (!process.env.LEARN_WEB3_API_KEY) {
62
- throw new Error("Please set the LEARN_WEB3_API_KEY environment variable");
63
- }
64
- this.apiKey = process.env.LEARN_WEB3_API_KEY;
65
- }
66
-
67
- async getNetworks(onlyEvm = true): Promise<Network[]> {
68
- const response = await axios(`${this.BASE_URL}/networks`);
69
- const data: Network[] = response.data;
70
- if (onlyEvm) {
71
- return data.filter(
72
- (network) =>
73
- EVM_TOKENS.some((t) =>
74
- network.tokenName.toLowerCase().includes(t.toLowerCase()),
75
- ) && network.isActive,
76
- );
77
- }
78
- return data.filter((network) => network.isActive);
79
- }
80
-
81
- async dripTokens(
82
- networkId: string,
83
- recipientAddress: string,
84
- ): Promise<DripTokensResponse> {
85
- const response = await axios.post(
86
- `${this.BASE_URL}/drip`,
87
- { networkId, recipientAddress },
88
- {
89
- headers: {
90
- authorization: `Bearer ${this.apiKey}`,
91
- },
92
- },
93
- );
94
- return response.data;
95
- }
96
- }
@@ -1,15 +0,0 @@
1
- import { createClient } from "@redis/client";
2
- import { RedisClientType } from "@redis/client";
3
-
4
- export const getRedisClient = async () => {
5
- const client = createClient({
6
- url: process.env.REDIS_CONNECTION_STRING,
7
- });
8
-
9
- client.on("error", (err) => {
10
- console.error("Redis client error:", err);
11
- });
12
-
13
- await client.connect();
14
- return client as RedisClientType;
15
- };
@@ -1,64 +0,0 @@
1
- export const systemPrompt = `
2
- Your are helpful and playful agent called {agent_name} that lives inside a web3 messaging app called Converse.
3
-
4
- {rules}
5
-
6
- {user_context}
7
-
8
- {skills}
9
-
10
- ## Response Scenarios:
11
-
12
- 1. When user wants to swap tokens:
13
- Hey {PREFERRED_NAME! I can help you swap tokens on Base.
14
- Let me help you swap 10 USDC to ETH
15
- /swap 10 usdc eth
16
-
17
- 2. When user wants to swap a specific amount:
18
- Sure! I'll help you swap 5 DEGEN to DAI
19
- /swap 5 degen dai
20
-
21
- 3. When user wants to pay a specific token:
22
- I'll help you pay 1 USDC to 0x123...
23
- /pay 1 {TOKEN} 0x123456789...
24
- *This will return a url to pay
25
-
26
- 4. If the user wants to pay a eth domain:
27
- I'll help you pay 1 USDC to vitalik.eth
28
- Be aware that this only works on mobile with a installed wallet on Base network
29
- /pay 1 vitalik.eth
30
- *This will return a url to pay
31
-
32
- 5. If the user wants to pay a username:
33
- I'll help you pay 1 USDC to @fabri
34
- Be aware that this only works on mobile with a installed wallet on Base network
35
- /pay 1 @fabri
36
- *This will return a url to pay
37
-
38
- 6. When user asks about supported tokens:
39
- I can help you swap or pay these tokens on Base (ETH, USDC, DAI, DEGEN):
40
- Just let me know the amount and which tokens you'd like to swap or send!
41
-
42
- 7. When user wants to tip default to 1 usdc:
43
- Let's go ahead and tip 1 USDC to nick.eth
44
- /pay 1 usdc 0x123456789...
45
-
46
- 8. If the users greets or wants to know more or what else can he do:
47
- I can assist you with swapping, minting, tipping, dripping testnet tokens and sending tokens (all on Base). Just let me know what you need help with!.
48
-
49
- 9. If the user wants to mint they can specify the collection and token id or a Url from Coinbase Wallet URL or Zora URL:
50
- I'll help you mint the token with id 1 from collection 0x123456789...
51
- /mint 0x123456789... 1
52
- I'll help you mint the token from this url
53
- /url_mint https://wallet.coinbase.com/nft/mint/eip155:1:erc721:0x123456789...
54
- I'll help you mint the token from this url
55
- /url_mint https://zora.co/collect/base/0x123456789/1...
56
-
57
- 10. If the user wants testnet tokens and doesn't specify the network:
58
- Just let me know which network you'd like to drip to Base Sepolia or Base Goerli?
59
-
60
- 11. If the user wants testnet tokens and specifies the network:
61
- I'll help you get testnet tokens for Base Sepolia\n/drip base_sepolia 0x123456789...
62
-
63
- {issues}
64
- `;
@@ -1,83 +0,0 @@
1
- import { XMTPContext, clearMemory } from "@xmtp/message-kit";
2
- import type { Skill } from "@xmtp/message-kit";
3
- import { getRedisClient } from "../plugins/redis.js";
4
- import { LearnWeb3Client, Network } from "../plugins/learnweb3.js";
5
-
6
- export const registerSkill: Skill[] = [
7
- {
8
- skill: "drip",
9
- handler: handler,
10
- examples: [
11
- "/drip base_sepolia 0x123456789",
12
- "/drip base_goerli 0x123456789",
13
- ],
14
- description:
15
- "Drip a default amount of testnet tokens to a specified address.",
16
- params: {
17
- network: {
18
- default: "base_sepolia",
19
- type: "string",
20
- values: ["base_sepolia", "base_goerli"],
21
- },
22
- address: {
23
- default: "",
24
- type: "address",
25
- },
26
- },
27
- },
28
- ];
29
-
30
- export async function handler(context: XMTPContext) {
31
- const {
32
- message: {
33
- content: { params },
34
- sender,
35
- },
36
- } = context;
37
-
38
- const { network } = params;
39
- if (!network) {
40
- await context.send("Invalid network. Please select a valid option.");
41
- return;
42
- }
43
- context.send("Fetching testnet tokens...");
44
- const redisClient = await getRedisClient();
45
-
46
- const learnWeb3Client = new LearnWeb3Client();
47
- // Fetch supported networks from Redis cache or API
48
- let supportedNetworks: Network[];
49
- const cachedSupportedNetworksData =
50
- await redisClient.get("supported-networks");
51
- supportedNetworks = JSON.parse(
52
- cachedSupportedNetworksData!,
53
- ).supportedNetworks;
54
- await context.send(
55
- "Your testnet tokens are being processed. Please wait a moment for the transaction to process.",
56
- );
57
- const selectedNetwork = supportedNetworks.find(
58
- (n) => n.networkId.toLowerCase() === network.toLowerCase(),
59
- );
60
- if (!selectedNetwork) {
61
- await context.send(
62
- "The network currently does not have funds provided by web3 api's\nTry again later...",
63
- );
64
- return;
65
- }
66
- const result = await learnWeb3Client.dripTokens(
67
- selectedNetwork!.networkId,
68
- sender.address,
69
- );
70
-
71
- if (!result.ok) {
72
- await context.send(
73
- `❌ Sorry, there was an error processing your request:\n\n"${result.error!}"`,
74
- );
75
- return;
76
- }
77
-
78
- await context.send("Here's your transaction receipt:");
79
- await context.sendReceipt(result.value!);
80
- // Clear any in-memory cache or state related to the prompt
81
- clearMemory();
82
- return;
83
- }
@@ -1,99 +0,0 @@
1
- import { XMTPContext } from "@xmtp/message-kit";
2
- import type { Skill } from "@xmtp/message-kit";
3
- import { baseUrl } from "../index.js";
4
-
5
- export const registerSkill: Skill[] = [
6
- {
7
- skill: "mint",
8
- examples: [
9
- "/mint 0x73a333cb82862d4f66f0154229755b184fb4f5b0 1",
10
- "/mint https://zora.co/collect/base/0x123456789/1...",
11
- ],
12
-
13
- handler: handler,
14
- description: "Mint a specific token from a collection.",
15
- params: {
16
- collection: {
17
- default: "0x73a333cb82862d4f66f0154229755b184fb4f5b0",
18
- type: "string",
19
- },
20
- token_id: {
21
- default: "1",
22
- type: "number",
23
- },
24
- url: {
25
- type: "url",
26
- },
27
- },
28
- },
29
- ];
30
- export async function handler(context: XMTPContext) {
31
- const {
32
- message: {
33
- content: { params },
34
- },
35
- } = context;
36
-
37
- if (params.url) {
38
- const MINT_URL = "https://xmtp-mintiaml.vercel.app";
39
- const { url } = context.message.content.params;
40
-
41
- const urlPatterns = [
42
- {
43
- pattern: /https?:\/\/zora\.co\/collect\/([^:]+):([^/]+)\/(\d+)/,
44
- transform: (chain: string, address: string, tokenId: string) =>
45
- `${MINT_URL}/${chain}/${address}/${tokenId}`,
46
- },
47
- {
48
- pattern:
49
- /https?:\/\/wallet\.coinbase\.com\/nft\/mint\/eip155:(\d+):erc721:([^:]+)/,
50
- transform: (chain: string, address: string) =>
51
- `${MINT_URL}/eip155/${chain}/erc721/${address}`,
52
- },
53
- {
54
- pattern:
55
- /https?:\/\/wallet\.coinbase\.com\/nft\/mint\/eip155:(\d+):erc1155:([^:]+):(\d+)/,
56
- transform: (chain: string, address: string, tokenId: string) =>
57
- `${MINT_URL}/eip155/${chain}/erc1155/${address}/${tokenId}`,
58
- },
59
- ];
60
- //https://wallet.coinbase.com/nft/mint/eip155:8453:erc1155:0x9a83e7b27b8a9b68e8dc665a0049f2f004287a20:1
61
- //https://wallet.coinbase.com/nft/mint/eip155:8453:erc721:0x2a8e46E78BA9667c661326820801695dcf1c403E
62
- //https://zora.co/collect/base:0xa902601ece8b81d906b7deceb67f5badcbdff7df/1
63
-
64
- //https://xmtp-mintiaml.vercel.app/eip155/8453/erc721/0xf16755b43eE1a458161f0faE5a9124729f4f6B1B
65
- let parsedUrl = null;
66
- for (const { pattern, transform } of urlPatterns) {
67
- const match = url.match(pattern);
68
-
69
- if (match) {
70
- parsedUrl = transform(match[1], match[2], match[3]);
71
- break;
72
- }
73
- }
74
- if (parsedUrl) {
75
- await context.send("Here is your Mint Frame URL: ");
76
- await context.send(parsedUrl);
77
- return;
78
- } else {
79
- await context.send(
80
- "Error: Unable to parse the provided URL. Please ensure you're sending a valid Zora or Coinbase Wallet URL.",
81
- );
82
- return;
83
- }
84
- } else {
85
- const { collection, token_id } = params;
86
- console.log(collection, token_id);
87
- if (!collection || !token_id) {
88
- context.reply(
89
- "Missing required parameters. Please provide collection and token_id.",
90
- );
91
- return;
92
- }
93
- let mintUrl = `${baseUrl}/?transaction_type=mint&collection=${collection}&token_id=${token_id}`;
94
- return {
95
- code: 200,
96
- message: mintUrl,
97
- };
98
- }
99
- }
@@ -1,35 +0,0 @@
1
- import { XMTPContext } from "@xmtp/message-kit";
2
- import type { Skill } from "@xmtp/message-kit";
3
-
4
- export const registerSkill: Skill[] = [
5
- {
6
- skill: "pay",
7
- examples: ["/pay 10 vitalik.eth"],
8
- description:
9
- "Send a specified amount of a cryptocurrency to a destination address.",
10
- handler: handler,
11
- params: {
12
- amount: {
13
- default: 10,
14
- type: "number",
15
- },
16
- token: {
17
- default: "usdc",
18
- type: "string",
19
- values: ["eth", "dai", "usdc", "degen"], // Accepted tokens
20
- },
21
- username: {
22
- default: "",
23
- type: "username",
24
- },
25
- },
26
- },
27
- ];
28
-
29
- export async function handler(context: XMTPContext) {
30
- const { params } = context.message.content;
31
-
32
- const { amount: amountSend, token: tokenSend, username } = params;
33
-
34
- await context.requestPayment(amountSend, tokenSend, username);
35
- }
@@ -1,52 +0,0 @@
1
- import { XMTPContext } from "@xmtp/message-kit";
2
- import type { Skill } from "@xmtp/message-kit";
3
- import { baseUrl } from "../index.js";
4
-
5
- export const registerSkill: Skill[] = [
6
- {
7
- skill: "swap",
8
- examples: ["/swap 10 usdc eth", "/swap 1 dai usdc"],
9
- handler: handler,
10
- description: "Exchange one type of cryptocurrency for another.",
11
- params: {
12
- amount: {
13
- default: 10,
14
- type: "number",
15
- },
16
- token_from: {
17
- default: "usdc",
18
- type: "string",
19
- values: ["eth", "dai", "usdc", "degen"], // Accepted tokens
20
- },
21
- token_to: {
22
- default: "eth",
23
- type: "string",
24
- values: ["eth", "dai", "usdc", "degen"], // Accepted tokenss
25
- },
26
- },
27
- },
28
- ];
29
-
30
- export async function handler(context: XMTPContext) {
31
- // Destructure and validate parameters for the swap command
32
- const {
33
- message: {
34
- content: { params },
35
- },
36
- } = context;
37
-
38
- const { amount, token_from, token_to } = params;
39
-
40
- if (!amount || !token_from || !token_to) {
41
- context.reply(
42
- "Missing required parameters. Please provide amount, token_from, and token_to.",
43
- );
44
- return;
45
- }
46
-
47
- let swapUrl = `${baseUrl}/?transaction_type=swap&token_from=${token_from}&token_to=${token_to}&amount=${amount}`;
48
- return {
49
- code: 200,
50
- message: swapUrl,
51
- };
52
- }