create-message-kit 1.2.22 → 1.2.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. package/README.md +2 -5
  2. package/index.js +15 -15
  3. package/package.json +1 -2
  4. package/templates/ens/.cursorrules +0 -112
  5. package/templates/ens/package.json +1 -2
  6. package/templates/ens/src/index.ts +4 -38
  7. package/templates/ens/src/prompt.ts +1 -1
  8. package/templates/ens/src/skills/info.ts +6 -3
  9. package/templates/simple/.cursorrules +0 -112
  10. package/templates/simple/src/index.ts +10 -9
  11. package/templates/coinbase-agent/.cursorrules +0 -290
  12. package/templates/coinbase-agent/.env.example +0 -4
  13. package/templates/coinbase-agent/.yarnrc.yml +0 -9
  14. package/templates/coinbase-agent/package.json +0 -22
  15. package/templates/coinbase-agent/src/index.ts +0 -31
  16. package/templates/coinbase-agent/src/plugins/learnweb3.ts +0 -96
  17. package/templates/coinbase-agent/src/plugins/redis.ts +0 -15
  18. package/templates/coinbase-agent/src/prompt.ts +0 -64
  19. package/templates/coinbase-agent/src/skills/drip.ts +0 -83
  20. package/templates/coinbase-agent/src/skills/mint.ts +0 -99
  21. package/templates/coinbase-agent/src/skills/pay.ts +0 -35
  22. package/templates/coinbase-agent/src/skills/swap.ts +0 -52
  23. package/templates/faucet/.cursorrules +0 -290
  24. package/templates/faucet/.env.example +0 -5
  25. package/templates/faucet/.yarnrc.yml +0 -9
  26. package/templates/faucet/package.json +0 -22
  27. package/templates/faucet/src/index.ts +0 -39
  28. package/templates/faucet/src/plugins/learnweb3.ts +0 -96
  29. package/templates/faucet/src/plugins/redis.ts +0 -15
  30. package/templates/faucet/src/prompt.ts +0 -11
  31. package/templates/faucet/src/skills/faucet.ts +0 -140
  32. package/templates/gated-group/.cursorrules +0 -290
  33. package/templates/gated-group/.env.example +0 -3
  34. package/templates/gated-group/.yarnrc.yml +0 -9
  35. package/templates/gated-group/package.json +0 -23
  36. package/templates/gated-group/src/index.ts +0 -17
  37. package/templates/gated-group/src/plugins/alchemy.ts +0 -27
  38. package/templates/gated-group/src/plugins/xmtp.ts +0 -137
  39. package/templates/gated-group/src/prompt.ts +0 -11
  40. package/templates/gated-group/src/skills/gated.ts +0 -88
  41. package/templates/gm/.cursorrules +0 -290
  42. package/templates/gm/.env.example +0 -2
  43. package/templates/gm/.yarnrc.yml +0 -9
  44. package/templates/gm/package.json +0 -20
  45. package/templates/gm/src/index.ts +0 -8
  46. package/templates/playground/.cursorrules +0 -290
  47. package/templates/playground/.env.example +0 -6
  48. package/templates/playground/.yarnrc.yml +0 -9
  49. package/templates/playground/package.json +0 -26
  50. package/templates/playground/src/index.ts +0 -37
  51. package/templates/playground/src/plugins/alchemy.ts +0 -27
  52. package/templates/playground/src/plugins/minilog.ts +0 -26
  53. package/templates/playground/src/plugins/usdc.ts +0 -99
  54. package/templates/playground/src/plugins/xmtp.ts +0 -137
  55. package/templates/playground/src/prompt.ts +0 -11
  56. package/templates/playground/src/skills/broadcast.ts +0 -39
  57. package/templates/playground/src/skills/cash.ts +0 -122
  58. package/templates/playground/src/skills/cryptoPrice.ts +0 -63
  59. package/templates/playground/src/skills/dalle.ts +0 -61
  60. package/templates/playground/src/skills/gated.ts +0 -88
  61. package/templates/playground/src/skills/search.ts +0 -159
  62. package/templates/playground/src/skills/todo.ts +0 -79
  63. package/templates/playground/src/skills/token.ts +0 -57
  64. package/templates/playground/src/skills/web.ts +0 -83
  65. package/templates/playground/src/skills/wordle.ts +0 -96
  66. package/templates/toss/.cursorrules +0 -290
  67. package/templates/toss/.env.example +0 -6
  68. package/templates/toss/.yarnrc.yml +0 -9
  69. package/templates/toss/package.json +0 -21
  70. package/templates/toss/src/index.ts +0 -32
  71. package/templates/toss/src/plugins/helpers.ts +0 -174
  72. package/templates/toss/src/plugins/redis.ts +0 -15
  73. package/templates/toss/src/prompt.ts +0 -54
  74. package/templates/toss/src/skills/toss.ts +0 -432
  75. package/templates.json +0 -58
@@ -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
- }
@@ -1,290 +0,0 @@
1
- # MessageKit Skill Template
2
-
3
- ## Examples
4
-
5
- ### Check if a Domain is Available
6
-
7
-
8
- import { ensUrl } from "../index.js";
9
- import { XMTPContext } from "@xmtp/message-kit";
10
- import type { Skill } from "@xmtp/message-kit";
11
-
12
- // Define Skill
13
- export const checkDomain: Skill[] = [
14
- {
15
- skill: "check",
16
- handler: handler,
17
- examples: ["/check vitalik.eth", "/check fabri.base.eth"],
18
- description: "Check if a domain is available.",
19
- params: {
20
- domain: {
21
- type: "string",
22
- },
23
- },
24
- },
25
- ];
26
-
27
- // Handler Implementation
28
- export async function handler(context: XMTPContext) {
29
- const {
30
- message: {
31
- content: {
32
- params: { domain },
33
- },
34
- },
35
- } = context;
36
-
37
- const data = await context.getUserInfo(domain);
38
-
39
- if (!data?.address) {
40
- let message = `Looks like ${domain} is available! Here you can register it: ${ensUrl}${domain} or would you like to see some cool alternatives?`;
41
- return {
42
- code: 200,
43
- message,
44
- };
45
- } else {
46
- let message = `Looks like ${domain} is already registered!`;
47
- await context.executeSkill("/cool " + domain);
48
- return {
49
- code: 404,
50
- message,
51
- };
52
- }
53
- }
54
-
55
- ### Generate a payment request
56
-
57
-
58
- import { XMTPContext } from "@xmtp/message-kit";
59
- import type { Skill } from "@xmtp/message-kit";
60
-
61
- // Define Skill
62
- export const paymentRequest: Skill[] = [
63
- {
64
- skill: "pay",
65
- examples: [
66
- "/pay 10 vitalik.eth",
67
- "/pay 1 usdc to 0xC60E6Bb79322392761BFe3081E302aEB79B30B03",
68
- ],
69
- description:
70
- "Send a specified amount of a cryptocurrency to a destination address. \nWhen tipping, you can assume it's 1 USDC.",
71
- handler: handler,
72
- params: {
73
- amount: {
74
- default: 10,
75
- type: "number",
76
- },
77
- token: {
78
- default: "usdc",
79
- type: "string",
80
- values: ["eth", "dai", "usdc", "degen"], // Accepted tokens
81
- },
82
- username: {
83
- default: "",
84
- type: "username",
85
- },
86
- address: {
87
- default: "",
88
- type: "address",
89
- },
90
- },
91
- },
92
- ];
93
-
94
- // Handler Implementation
95
- export async function handler(context: XMTPContext) {
96
- const {
97
- message: {
98
- content: {
99
- params: { amount, token, username, address },
100
- },
101
- },
102
- } = context;
103
- let receiverAddress = address;
104
- if (username) {
105
- receiverAddress = (await context.getUserInfo(username))?.address;
106
- }
107
- if (address) {
108
- // Prioritize address over username
109
- receiverAddress = address;
110
- }
111
-
112
- await context.requestPayment(amount, token, receiverAddress);
113
- }
114
-
115
-
116
- ## Types
117
-
118
- import { XMTPContext } from "../plugins/xmtp.js";
119
- import { ClientOptions, GroupMember } from "@xmtp/node-sdk";
120
- import { ContentTypeId } from "@xmtp/content-type-primitives";
121
-
122
- export type MessageAbstracted = {
123
- id: string;
124
- sent: Date;
125
- content: {
126
- text?: string | undefined;
127
- reply?: string | undefined;
128
- previousMsg?: string | undefined;
129
- react?: string | undefined;
130
- content?: any | undefined;
131
- params?: any | undefined;
132
- reference?: string | undefined;
133
- skill?: string | undefined;
134
- };
135
- version: "v2" | "v3";
136
- sender: AbstractedMember;
137
- typeId: string;
138
- };
139
- export type GroupAbstracted = {
140
- id: string;
141
- sync: () => Promise<void>;
142
- addMembers: (addresses: string[]) => Promise<void>;
143
- addMembersByInboxId: (inboxIds: string[]) => Promise<void>;
144
- send: (content: string, contentType?: ContentTypeId) => Promise<string>;
145
- isAdmin: (inboxId: string) => boolean;
146
- isSuperAdmin: (inboxId: string) => boolean;
147
- admins: string[];
148
- superAdmins: string[];
149
- createdAt: Date;
150
- members: GroupMember[];
151
- };
152
- export type SkillResponse = {
153
- code: number;
154
- message: string;
155
- data?: any;
156
- };
157
-
158
- export type SkillHandler = (
159
- context: XMTPContext,
160
- ) => Promise<SkillResponse | void>;
161
-
162
- export type Handler = (context: XMTPContext) => Promise<void>;
163
-
164
- export type RunConfig = {
165
- // client options from XMTP client
166
- client?: ClientOptions;
167
- // private key to be used for the client, if not, default from env
168
- privateKey?: string;
169
- // if true, the init log message with messagekit logo and stuff will be hidden
170
- experimental?: boolean;
171
- // hide the init log message with messagekit logo and stuff
172
- hideInitLogMessage?: boolean;
173
- // if true, attachments will be enabled
174
- attachments?: boolean;
175
- // if true, member changes will be enabled, like adding members to the group
176
- memberChange?: boolean;
177
- // skills to be used
178
- agent?: Agent;
179
- // model to be used
180
- gptModel?: string;
181
- };
182
- export interface SkillParamConfig {
183
- default?: string | number | boolean;
184
- type:
185
- | "number"
186
- | "string"
187
- | "username"
188
- | "quoted"
189
- | "address"
190
- | "prompt"
191
- | "url";
192
- plural?: boolean;
193
- values?: string[]; // Accepted values for the parameter
194
- }
195
-
196
- export interface Frame {
197
- title: string;
198
- buttons: { content: string; action: string; target: string }[];
199
- image: string;
200
- }
201
- export interface Agent {
202
- name: string;
203
- description: string;
204
- tag: string;
205
- skills: Skill[];
206
- }
207
- export interface Skill {
208
- skill: string;
209
- handler?: SkillHandler | undefined;
210
- adminOnly?: boolean;
211
- description: string;
212
- examples: string[];
213
- params: Record<string, SkillParamConfig>;
214
- }
215
-
216
- export interface AbstractedMember {
217
- inboxId: string;
218
- address: string;
219
- accountAddresses: string[];
220
- installationIds?: string[];
221
- }
222
-
223
- export type MetadataValue = string | number | boolean;
224
- export type Metadata = Record<string, MetadataValue | MetadataValue[]>;
225
-
226
-
227
- ## Example final prompt
228
-
229
- Your are a helpful and playful ens agent called @bot that lives inside a messaging app called Converse.
230
-
231
-
232
- # Rules
233
- - You can respond with multiple messages if needed. Each message should be separated by a newline character.
234
- - You can trigger skills by only sending the command in a newline message.
235
- - Each command starts with a slash (/).
236
- - Never announce actions without using a command separated by a newline character.
237
- - Never use markdown in your responses.
238
- - Do not make guesses or assumptions
239
- - Only answer if the verified information is in the prompt.
240
- - Check that you are not missing a command
241
- - Focus only on helping users with operations detailed below.
242
- - Date: Fri, 06 Dec 2024 16:03:22 GMT
243
- - When mentioning any action related to available skills, you MUST trigger the corresponding command in a new line
244
- - If you suggest an action that has a command, you must trigger that command
245
-
246
-
247
- ## User context
248
- - Start by fetch their domain from or Converse username
249
- - Call the user by their name or domain, in case they have one
250
- - Ask for a name (if they don't have one) so you can suggest domains.
251
- - Message sent date: 2024-12-06T16:03:36.582Z
252
- - Users address is: 0x40f08f0f853d1c42c61815652b7ccd5a50f0be09
253
- - Users name is: ArizonaOregon
254
- - Converse username is: ArizonaOregon
255
-
256
- ## Commands
257
- /check [domain] - Check if a domain is available.
258
- /cool [domain] - Get cool alternatives for a .eth domain.
259
- /info [domain] - Get detailed information about an ENS domain including owner, expiry date, and resolver.
260
- /register [domain] - Register a new ENS domain. Returns a URL to complete the registration process.
261
- /renew [domain] - Extend the registration period of your ENS domain. Returns a URL to complete the renewal.
262
- /reset - Reset the conversation clearing memory and usernames cache.
263
- /pay [amount] [token] [username] [address] - Send a specified amount of a cryptocurrency to a destination address.
264
- When tipping, you can asume its 1 usdc.
265
-
266
- ## Examples
267
- /check vitalik.eth
268
- /check fabri.base.eth
269
- /cool vitalik.eth
270
- /info nick.eth
271
- /register vitalik.eth
272
- /renew fabri.base.eth
273
- /reset
274
- /pay 10 vitalik.eth
275
- /pay 1 usdc to 0xC60E6Bb79322392761BFe3081E302aEB79B30B03
276
-
277
- ## Scenarios
278
- 1. Missing commands in responses
279
- **Issue**: Sometimes responses are sent without the required command.
280
- **Example**:
281
- Incorrect:
282
- > "Looks like vitalik.eth is registered! What about these cool alternatives?"
283
- Correct:
284
- > "Looks like vitalik.eth is registered! What about these cool alternatives?
285
- > /cool vitalik.eth"
286
-
287
- Incorrect:
288
- > Here is a summary of your TODOs. I will now send it via email.
289
- Correct:
290
- > /todo
@@ -1,5 +0,0 @@
1
- KEY= # The private key for the bot
2
- TEST_ENCRYPTION_KEY= # The private key for the test app (with the 0x prefix)
3
- LEARN_WEB3_API_KEY= # Your LearnWeb3 API key
4
- REDIS_CONNECTION_STRING= # Redis connection string for caching
5
- FRAME_BASE_URL= # Base URL for the frame application
@@ -1,9 +0,0 @@
1
- compressionLevel: mixed
2
-
3
- enableGlobalCache: false
4
-
5
- enableTelemetry: false
6
-
7
- nodeLinker: node-modules
8
-
9
- yarnPath: .yarn/releases/yarn-4.5.1.cjs
@@ -1,22 +0,0 @@
1
- {
2
- "name": "faucet-agent",
3
- "private": true,
4
- "type": "module",
5
- "scripts": {
6
- "build": "tsc",
7
- "dev": "tsc -w & sleep 1 && NODE_NO_WARNINGS=1 node --watch dist/index.js",
8
- "start": "node dist/index.js"
9
- },
10
- "dependencies": {
11
- "@redis/client": "^1.5.14",
12
- "@xmtp/message-kit": "workspace:*",
13
- "axios": "^1.6.8"
14
- },
15
- "devDependencies": {
16
- "@types/node": "^20.14.2",
17
- "typescript": "^5.4.5"
18
- },
19
- "engines": {
20
- "node": ">=20"
21
- }
22
- }
@@ -1,39 +0,0 @@
1
- import {
2
- run,
3
- agentReply,
4
- replaceVariables,
5
- XMTPContext,
6
- Agent,
7
- } from "@xmtp/message-kit";
8
- import { systemPrompt } from "./prompt.js";
9
- import { faucet } from "./skills/faucet.js";
10
- import fs from "fs";
11
-
12
- // [!region skills]
13
- export const agent: Agent = {
14
- name: "Faucet Agent",
15
- tag: "@bot",
16
- description: "A faucet delivery agent.",
17
- skills: [...faucet],
18
- };
19
- // [!endregion skills]
20
-
21
- // [!region run1]
22
- run(
23
- async (context: XMTPContext) => {
24
- const {
25
- message: { sender },
26
- agent,
27
- } = context;
28
-
29
- let prompt = await replaceVariables(systemPrompt, sender.address, agent);
30
- // [!endregion run1]
31
- //This is only used for to update the docs.
32
- fs.writeFileSync("example_prompt.md", prompt);
33
- // [!region run2]
34
- await agentReply(context, prompt);
35
- },
36
- { agent },
37
- );
38
-
39
- // [!endregion run2]
@@ -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,11 +0,0 @@
1
- export const systemPrompt = `
2
- Your are a helpful and playful faucet delivery agent called {agent_name} that lives inside a messaging app called Converse.
3
-
4
- {rules}
5
-
6
- {user_context}
7
-
8
- {skills}
9
-
10
- {issues}
11
- `;