@paysponge/sdk 0.1.0

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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +138 -0
  3. package/dist/admin.d.ts +81 -0
  4. package/dist/admin.d.ts.map +1 -0
  5. package/dist/admin.js +108 -0
  6. package/dist/admin.js.map +1 -0
  7. package/dist/api/agents.d.ts +37 -0
  8. package/dist/api/agents.d.ts.map +1 -0
  9. package/dist/api/agents.js +63 -0
  10. package/dist/api/agents.js.map +1 -0
  11. package/dist/api/http.d.ts +29 -0
  12. package/dist/api/http.d.ts.map +1 -0
  13. package/dist/api/http.js +101 -0
  14. package/dist/api/http.js.map +1 -0
  15. package/dist/api/index.d.ts +6 -0
  16. package/dist/api/index.d.ts.map +1 -0
  17. package/dist/api/index.js +6 -0
  18. package/dist/api/index.js.map +1 -0
  19. package/dist/api/public-tools.d.ts +52 -0
  20. package/dist/api/public-tools.d.ts.map +1 -0
  21. package/dist/api/public-tools.js +68 -0
  22. package/dist/api/public-tools.js.map +1 -0
  23. package/dist/api/transactions.d.ts +30 -0
  24. package/dist/api/transactions.d.ts.map +1 -0
  25. package/dist/api/transactions.js +176 -0
  26. package/dist/api/transactions.js.map +1 -0
  27. package/dist/api/wallets.d.ts +33 -0
  28. package/dist/api/wallets.d.ts.map +1 -0
  29. package/dist/api/wallets.js +121 -0
  30. package/dist/api/wallets.js.map +1 -0
  31. package/dist/auth/credentials.d.ts +37 -0
  32. package/dist/auth/credentials.d.ts.map +1 -0
  33. package/dist/auth/credentials.js +100 -0
  34. package/dist/auth/credentials.js.map +1 -0
  35. package/dist/auth/device-flow.d.ts +25 -0
  36. package/dist/auth/device-flow.d.ts.map +1 -0
  37. package/dist/auth/device-flow.js +161 -0
  38. package/dist/auth/device-flow.js.map +1 -0
  39. package/dist/auth/index.d.ts +3 -0
  40. package/dist/auth/index.d.ts.map +1 -0
  41. package/dist/auth/index.js +3 -0
  42. package/dist/auth/index.js.map +1 -0
  43. package/dist/bin/cli.d.ts +3 -0
  44. package/dist/bin/cli.d.ts.map +1 -0
  45. package/dist/bin/cli.js +116 -0
  46. package/dist/bin/cli.js.map +1 -0
  47. package/dist/client.d.ts +383 -0
  48. package/dist/client.d.ts.map +1 -0
  49. package/dist/client.js +384 -0
  50. package/dist/client.js.map +1 -0
  51. package/dist/index.d.ts +11 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +18 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/mcp/config.d.ts +27 -0
  56. package/dist/mcp/config.d.ts.map +1 -0
  57. package/dist/mcp/config.js +34 -0
  58. package/dist/mcp/config.js.map +1 -0
  59. package/dist/mcp/index.d.ts +2 -0
  60. package/dist/mcp/index.d.ts.map +1 -0
  61. package/dist/mcp/index.js +2 -0
  62. package/dist/mcp/index.js.map +1 -0
  63. package/dist/tools/definitions.d.ts +16 -0
  64. package/dist/tools/definitions.d.ts.map +1 -0
  65. package/dist/tools/definitions.js +330 -0
  66. package/dist/tools/definitions.js.map +1 -0
  67. package/dist/tools/executor.d.ts +56 -0
  68. package/dist/tools/executor.d.ts.map +1 -0
  69. package/dist/tools/executor.js +182 -0
  70. package/dist/tools/executor.js.map +1 -0
  71. package/dist/tools/index.d.ts +3 -0
  72. package/dist/tools/index.d.ts.map +1 -0
  73. package/dist/tools/index.js +3 -0
  74. package/dist/tools/index.js.map +1 -0
  75. package/dist/types/index.d.ts +2 -0
  76. package/dist/types/index.d.ts.map +1 -0
  77. package/dist/types/index.js +2 -0
  78. package/dist/types/index.js.map +1 -0
  79. package/dist/types/schemas.d.ts +924 -0
  80. package/dist/types/schemas.d.ts.map +1 -0
  81. package/dist/types/schemas.js +360 -0
  82. package/dist/types/schemas.js.map +1 -0
  83. package/package.json +70 -0
@@ -0,0 +1,330 @@
1
+ /**
2
+ * Tool definitions for use with the Anthropic SDK
3
+ *
4
+ * These definitions follow the Anthropic tool schema format
5
+ */
6
+ export const TOOL_DEFINITIONS = [
7
+ {
8
+ name: "get_balance",
9
+ description: "Get the balance of your wallet. Returns balances for native tokens and USDC across all supported chains.",
10
+ input_schema: {
11
+ type: "object",
12
+ properties: {
13
+ chain: {
14
+ type: "string",
15
+ enum: [
16
+ "ethereum",
17
+ "base",
18
+ "sepolia",
19
+ "base-sepolia",
20
+ "tempo",
21
+ "solana",
22
+ "solana-devnet",
23
+ ],
24
+ description: "Optional: Specific chain to check balance for. If not provided, returns balances for all chains.",
25
+ },
26
+ allowedChains: {
27
+ type: "array",
28
+ items: { type: "string" },
29
+ description: "Optional: Restrict balance results to these chains (e.g., ['base','solana'])",
30
+ },
31
+ onlyUsdc: {
32
+ type: "boolean",
33
+ description: "Optional: Only return USDC balances",
34
+ },
35
+ },
36
+ required: [],
37
+ },
38
+ },
39
+ {
40
+ name: "evm_transfer",
41
+ description: "Transfer ETH or USDC on Ethereum, Base, or their testnets. Supports native ETH and USDC transfers.",
42
+ input_schema: {
43
+ type: "object",
44
+ properties: {
45
+ chain: {
46
+ type: "string",
47
+ enum: ["ethereum", "base", "sepolia", "base-sepolia"],
48
+ description: "The chain to transfer on",
49
+ },
50
+ to: {
51
+ type: "string",
52
+ description: "The recipient address (0x...)",
53
+ },
54
+ amount: {
55
+ type: "string",
56
+ description: "The amount to transfer (e.g., '0.1' for 0.1 ETH or '100' for 100 USDC)",
57
+ },
58
+ currency: {
59
+ type: "string",
60
+ enum: ["ETH", "USDC"],
61
+ description: "The currency to transfer",
62
+ },
63
+ },
64
+ required: ["chain", "to", "amount", "currency"],
65
+ },
66
+ },
67
+ {
68
+ name: "solana_transfer",
69
+ description: "Transfer SOL or USDC on Solana mainnet or devnet. Supports native SOL and USDC transfers.",
70
+ input_schema: {
71
+ type: "object",
72
+ properties: {
73
+ chain: {
74
+ type: "string",
75
+ enum: ["solana", "solana-devnet"],
76
+ description: "The Solana network to use",
77
+ },
78
+ to: {
79
+ type: "string",
80
+ description: "The recipient address",
81
+ },
82
+ amount: {
83
+ type: "string",
84
+ description: "The amount to transfer",
85
+ },
86
+ currency: {
87
+ type: "string",
88
+ enum: ["SOL", "USDC"],
89
+ description: "The currency to transfer",
90
+ },
91
+ },
92
+ required: ["chain", "to", "amount", "currency"],
93
+ },
94
+ },
95
+ {
96
+ name: "solana_swap",
97
+ description: "Swap tokens on Solana using Jupiter aggregator. Finds the best route and executes the swap.",
98
+ input_schema: {
99
+ type: "object",
100
+ properties: {
101
+ chain: {
102
+ type: "string",
103
+ enum: ["solana", "solana-devnet"],
104
+ description: "The Solana network to use",
105
+ },
106
+ inputToken: {
107
+ type: "string",
108
+ description: "The token to swap from (symbol like 'SOL', 'USDC', or token address)",
109
+ },
110
+ outputToken: {
111
+ type: "string",
112
+ description: "The token to swap to (symbol like 'SOL', 'USDC', or token address)",
113
+ },
114
+ amount: {
115
+ type: "string",
116
+ description: "The amount of input token to swap",
117
+ },
118
+ slippageBps: {
119
+ type: "number",
120
+ description: "Slippage tolerance in basis points (default: 50 = 0.5%)",
121
+ },
122
+ },
123
+ required: ["chain", "inputToken", "outputToken", "amount"],
124
+ },
125
+ },
126
+ {
127
+ name: "get_solana_tokens",
128
+ description: "List all SPL tokens held by the agent's Solana wallet, with balances and metadata.",
129
+ input_schema: {
130
+ type: "object",
131
+ properties: {
132
+ chain: {
133
+ type: "string",
134
+ enum: ["solana", "solana-devnet"],
135
+ description: "The Solana network to use",
136
+ },
137
+ },
138
+ required: ["chain"],
139
+ },
140
+ },
141
+ {
142
+ name: "search_solana_tokens",
143
+ description: "Search the Jupiter token list by symbol or name.",
144
+ input_schema: {
145
+ type: "object",
146
+ properties: {
147
+ query: {
148
+ type: "string",
149
+ description: "Search query (symbol or name)",
150
+ },
151
+ limit: {
152
+ type: "number",
153
+ description: "Max results (default 10, max 20)",
154
+ },
155
+ },
156
+ required: ["query"],
157
+ },
158
+ },
159
+ {
160
+ name: "get_transaction_status",
161
+ description: "Check the status of a transaction by its hash/signature.",
162
+ input_schema: {
163
+ type: "object",
164
+ properties: {
165
+ txHash: {
166
+ type: "string",
167
+ description: "The transaction hash (EVM) or signature (Solana)",
168
+ },
169
+ chain: {
170
+ type: "string",
171
+ enum: [
172
+ "ethereum",
173
+ "base",
174
+ "sepolia",
175
+ "base-sepolia",
176
+ "tempo",
177
+ "solana",
178
+ "solana-devnet",
179
+ ],
180
+ description: "Chain for the transaction",
181
+ },
182
+ },
183
+ required: ["txHash", "chain"],
184
+ },
185
+ },
186
+ {
187
+ name: "get_transaction_history",
188
+ description: "Get recent transaction history for this agent's wallets.",
189
+ input_schema: {
190
+ type: "object",
191
+ properties: {
192
+ limit: {
193
+ type: "number",
194
+ description: "Maximum number of transactions to return (default: 50)",
195
+ },
196
+ chain: {
197
+ type: "string",
198
+ description: "Optional: filter by chain",
199
+ },
200
+ },
201
+ required: [],
202
+ },
203
+ },
204
+ {
205
+ name: "request_funding",
206
+ description: "Request funding from the owner (creates an approval request).",
207
+ input_schema: {
208
+ type: "object",
209
+ properties: {
210
+ amount: {
211
+ type: "string",
212
+ description: "Amount to request",
213
+ },
214
+ reason: {
215
+ type: "string",
216
+ description: "Reason for the request",
217
+ },
218
+ chain: {
219
+ type: "string",
220
+ description: "Chain to request on (default: tempo)",
221
+ },
222
+ currency: {
223
+ type: "string",
224
+ description: "Currency (pathUSD, USDC, ETH, SOL)",
225
+ },
226
+ },
227
+ required: ["amount"],
228
+ },
229
+ },
230
+ {
231
+ name: "withdraw_to_main_wallet",
232
+ description: "Withdraw funds back to the owner's main wallet.",
233
+ input_schema: {
234
+ type: "object",
235
+ properties: {
236
+ chain: {
237
+ type: "string",
238
+ enum: [
239
+ "ethereum",
240
+ "base",
241
+ "sepolia",
242
+ "base-sepolia",
243
+ "tempo",
244
+ "solana",
245
+ "solana-devnet",
246
+ ],
247
+ description: "Chain to withdraw from",
248
+ },
249
+ amount: {
250
+ type: "string",
251
+ description: "Amount to withdraw",
252
+ },
253
+ currency: {
254
+ type: "string",
255
+ enum: ["native", "USDC"],
256
+ description: "Token to withdraw (default: native)",
257
+ },
258
+ },
259
+ required: ["chain", "amount"],
260
+ },
261
+ },
262
+ // x402 paid API tools - temporarily disabled
263
+ // {
264
+ // name: "sponge",
265
+ // description:
266
+ // "Call paid APIs via x402 (search, image, predict, crawl, parse, prospect, llm).",
267
+ // input_schema: {
268
+ // type: "object",
269
+ // properties: {
270
+ // task: {
271
+ // type: "string",
272
+ // description: "Task name (search, image, predict, crawl, parse, prospect, llm)",
273
+ // },
274
+ // },
275
+ // required: ["task"],
276
+ // },
277
+ // },
278
+ // {
279
+ // name: "create_x402_payment",
280
+ // description: "Create a signed x402 payment payload.",
281
+ // input_schema: {
282
+ // type: "object",
283
+ // properties: {
284
+ // chain: {
285
+ // type: "string",
286
+ // description: "Chain to pay on (e.g., base, solana, tempo)",
287
+ // },
288
+ // to: {
289
+ // type: "string",
290
+ // description: "Recipient address from 402 response",
291
+ // },
292
+ // token: {
293
+ // type: "string",
294
+ // description: "Token address or mint (optional)",
295
+ // },
296
+ // amount: {
297
+ // type: "string",
298
+ // description: "Amount to pay",
299
+ // },
300
+ // decimals: {
301
+ // type: "number",
302
+ // description: "Token decimals (optional)",
303
+ // },
304
+ // valid_for_seconds: {
305
+ // type: "number",
306
+ // description: "Payment validity window in seconds",
307
+ // },
308
+ // resource_url: {
309
+ // type: "string",
310
+ // description: "Resource URL for x402 preflight or metadata",
311
+ // },
312
+ // resource_description: {
313
+ // type: "string",
314
+ // description: "Resource description",
315
+ // },
316
+ // fee_payer: {
317
+ // type: "string",
318
+ // description: "Solana fee payer from 402 response (optional)",
319
+ // },
320
+ // http_method: {
321
+ // type: "string",
322
+ // enum: ["GET", "POST"],
323
+ // description: "HTTP method used for 402 preflight (default: GET)",
324
+ // },
325
+ // },
326
+ // required: ["chain", "to", "amount"],
327
+ // },
328
+ // },
329
+ ];
330
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mapp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;IACD,6CAA6C;IAC7C,IAAI;IACJ,oBAAoB;IACpB,iBAAiB;IACjB,wFAAwF;IACxF,oBAAoB;IACpB,sBAAsB;IACtB,oBAAoB;IACpB,gBAAgB;IAChB,0BAA0B;IAC1B,0FAA0F;IAC1F,WAAW;IACX,SAAS;IACT,0BAA0B;IAC1B,OAAO;IACP,KAAK;IACL,IAAI;IACJ,iCAAiC;IACjC,0DAA0D;IAC1D,oBAAoB;IACpB,sBAAsB;IACtB,oBAAoB;IACpB,iBAAiB;IACjB,0BAA0B;IAC1B,sEAAsE;IACtE,WAAW;IACX,cAAc;IACd,0BAA0B;IAC1B,8DAA8D;IAC9D,WAAW;IACX,iBAAiB;IACjB,0BAA0B;IAC1B,2DAA2D;IAC3D,WAAW;IACX,kBAAkB;IAClB,0BAA0B;IAC1B,wCAAwC;IACxC,WAAW;IACX,oBAAoB;IACpB,0BAA0B;IAC1B,oDAAoD;IACpD,WAAW;IACX,6BAA6B;IAC7B,0BAA0B;IAC1B,6DAA6D;IAC7D,WAAW;IACX,wBAAwB;IACxB,0BAA0B;IAC1B,sEAAsE;IACtE,WAAW;IACX,gCAAgC;IAChC,0BAA0B;IAC1B,+CAA+C;IAC/C,WAAW;IACX,qBAAqB;IACrB,0BAA0B;IAC1B,wEAAwE;IACxE,WAAW;IACX,uBAAuB;IACvB,0BAA0B;IAC1B,iCAAiC;IACjC,4EAA4E;IAC5E,WAAW;IACX,SAAS;IACT,2CAA2C;IAC3C,OAAO;IACP,KAAK;CACN,CAAC"}
@@ -0,0 +1,56 @@
1
+ import type { HttpClient } from "../api/http.js";
2
+ import type { ToolResult } from "../types/schemas.js";
3
+ import { type ToolDefinition } from "./definitions.js";
4
+ /**
5
+ * Tool executor for use with the Anthropic SDK
6
+ *
7
+ * Provides tool definitions and an execute method to run tools
8
+ */
9
+ export declare class ToolExecutor {
10
+ private readonly http;
11
+ private readonly agentId;
12
+ constructor(http: HttpClient, agentId: string);
13
+ /**
14
+ * Get tool definitions for use with Anthropic SDK
15
+ */
16
+ get definitions(): ToolDefinition[];
17
+ /**
18
+ * Execute a tool by name
19
+ *
20
+ * @param name - Tool name
21
+ * @param input - Tool input
22
+ * @returns Tool result
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const tools = wallet.tools();
27
+ *
28
+ * const response = await anthropic.messages.create({
29
+ * model: 'claude-sonnet-4-20250514',
30
+ * tools: tools.definitions,
31
+ * messages: [{ role: 'user', content: 'Check balance' }],
32
+ * });
33
+ *
34
+ * for (const block of response.content) {
35
+ * if (block.type === 'tool_use') {
36
+ * const result = await tools.execute(block.name, block.input);
37
+ * console.log(result);
38
+ * }
39
+ * }
40
+ * ```
41
+ */
42
+ execute(name: string, input: unknown): Promise<ToolResult>;
43
+ /**
44
+ * Call the MCP tool endpoint
45
+ */
46
+ private callTool;
47
+ }
48
+ /**
49
+ * Create a tool executor for use with the Anthropic SDK
50
+ *
51
+ * @param http - HTTP client instance
52
+ * @param agentId - Agent ID
53
+ * @returns Tool executor with definitions and execute method
54
+ */
55
+ export declare function createTools(http: HttpClient, agentId: string): ToolExecutor;
56
+ //# sourceMappingURL=executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/tools/executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE;;;;GAIG;AACH,qBAAa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,MAAM;IAGlC;;OAEG;IACH,IAAI,WAAW,IAAI,cAAc,EAAE,CAElC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;IAehE;;OAEG;YACW,QAAQ;CA2GvB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,CAE3E"}
@@ -0,0 +1,182 @@
1
+ import { z } from "zod";
2
+ import { TOOL_DEFINITIONS } from "./definitions.js";
3
+ /**
4
+ * Tool executor for use with the Anthropic SDK
5
+ *
6
+ * Provides tool definitions and an execute method to run tools
7
+ */
8
+ export class ToolExecutor {
9
+ http;
10
+ agentId;
11
+ constructor(http, agentId) {
12
+ this.http = http;
13
+ this.agentId = agentId;
14
+ }
15
+ /**
16
+ * Get tool definitions for use with Anthropic SDK
17
+ */
18
+ get definitions() {
19
+ return TOOL_DEFINITIONS;
20
+ }
21
+ /**
22
+ * Execute a tool by name
23
+ *
24
+ * @param name - Tool name
25
+ * @param input - Tool input
26
+ * @returns Tool result
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const tools = wallet.tools();
31
+ *
32
+ * const response = await anthropic.messages.create({
33
+ * model: 'claude-sonnet-4-20250514',
34
+ * tools: tools.definitions,
35
+ * messages: [{ role: 'user', content: 'Check balance' }],
36
+ * });
37
+ *
38
+ * for (const block of response.content) {
39
+ * if (block.type === 'tool_use') {
40
+ * const result = await tools.execute(block.name, block.input);
41
+ * console.log(result);
42
+ * }
43
+ * }
44
+ * ```
45
+ */
46
+ async execute(name, input) {
47
+ try {
48
+ const result = await this.callTool(name, input);
49
+ return {
50
+ status: "success",
51
+ data: result,
52
+ };
53
+ }
54
+ catch (error) {
55
+ return {
56
+ status: "error",
57
+ error: error instanceof Error ? error.message : String(error),
58
+ };
59
+ }
60
+ }
61
+ /**
62
+ * Call the MCP tool endpoint
63
+ */
64
+ async callTool(name, input) {
65
+ // Validate tool name
66
+ const tool = TOOL_DEFINITIONS.find((t) => t.name === name);
67
+ if (!tool) {
68
+ throw new Error(`Unknown tool: ${name}`);
69
+ }
70
+ const args = z.record(z.unknown()).parse(input ?? {});
71
+ switch (name) {
72
+ case "get_balance": {
73
+ const allowedChains = Array.isArray(args.allowedChains)
74
+ ? args.allowedChains.map(String).join(",")
75
+ : typeof args.allowedChains === "string"
76
+ ? args.allowedChains
77
+ : undefined;
78
+ const params = {
79
+ chain: args.chain ?? "all",
80
+ };
81
+ if (allowedChains)
82
+ params.allowedChains = allowedChains;
83
+ if (args.onlyUsdc)
84
+ params.onlyUsdc = "true";
85
+ return this.http.get("/api/balances", params);
86
+ }
87
+ case "evm_transfer":
88
+ return this.http.post("/api/transfers/evm", {
89
+ chain: args.chain,
90
+ to: args.to,
91
+ amount: args.amount,
92
+ currency: args.currency,
93
+ });
94
+ case "solana_transfer":
95
+ return this.http.post("/api/transfers/solana", {
96
+ chain: args.chain,
97
+ to: args.to,
98
+ amount: args.amount,
99
+ currency: args.currency,
100
+ });
101
+ case "solana_swap":
102
+ return this.http.post("/api/transactions/swap", {
103
+ chain: args.chain,
104
+ inputToken: args.inputToken ?? args.input_token,
105
+ outputToken: args.outputToken ?? args.output_token,
106
+ amount: args.amount,
107
+ slippageBps: args.slippageBps ?? args.slippage_bps,
108
+ });
109
+ case "get_solana_tokens":
110
+ return this.http.get("/api/solana/tokens", {
111
+ chain: String(args.chain ?? ""),
112
+ });
113
+ case "search_solana_tokens": {
114
+ const searchParams = {
115
+ query: String(args.query ?? ""),
116
+ };
117
+ if (args.limit !== undefined)
118
+ searchParams.limit = String(args.limit);
119
+ return this.http.get("/api/solana/tokens/search", searchParams);
120
+ }
121
+ case "get_transaction_status": {
122
+ const txHash = (args.txHash ?? args.transaction_hash);
123
+ if (!txHash) {
124
+ throw new Error("txHash is required");
125
+ }
126
+ if (!args.chain) {
127
+ throw new Error("chain is required");
128
+ }
129
+ return this.http.get(`/api/transactions/status/${encodeURIComponent(txHash)}`, { chain: String(args.chain) });
130
+ }
131
+ case "get_transaction_history": {
132
+ const historyParams = {};
133
+ if (args.limit !== undefined)
134
+ historyParams.limit = String(args.limit);
135
+ if (args.chain)
136
+ historyParams.chain = String(args.chain);
137
+ return this.http.get("/api/transactions/history", historyParams);
138
+ }
139
+ case "request_funding":
140
+ return this.http.post("/api/funding-requests", {
141
+ amount: args.amount,
142
+ reason: args.reason,
143
+ chain: args.chain,
144
+ currency: args.currency,
145
+ });
146
+ case "withdraw_to_main_wallet":
147
+ return this.http.post("/api/wallets/withdraw-to-main", {
148
+ chain: args.chain,
149
+ amount: args.amount,
150
+ currency: args.currency,
151
+ });
152
+ case "sponge":
153
+ return this.http.post("/api/sponge", args);
154
+ case "create_x402_payment":
155
+ return this.http.post("/api/x402/payments", {
156
+ chain: args.chain,
157
+ to: args.to,
158
+ token: args.token,
159
+ amount: args.amount,
160
+ decimals: args.decimals,
161
+ valid_for_seconds: args.valid_for_seconds,
162
+ resource_url: args.resource_url,
163
+ resource_description: args.resource_description,
164
+ fee_payer: args.fee_payer,
165
+ http_method: args.http_method,
166
+ });
167
+ default:
168
+ throw new Error(`Tool not implemented: ${name}`);
169
+ }
170
+ }
171
+ }
172
+ /**
173
+ * Create a tool executor for use with the Anthropic SDK
174
+ *
175
+ * @param http - HTTP client instance
176
+ * @param agentId - Agent ID
177
+ * @returns Tool executor with definitions and execute method
178
+ */
179
+ export function createTools(http, agentId) {
180
+ return new ToolExecutor(http, agentId);
181
+ }
182
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/tools/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAuB,MAAM,kBAAkB,CAAC;AAEzE;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAEJ;IACA;IAFnB,YACmB,IAAgB,EAChB,OAAe;QADf,SAAI,GAAJ,IAAI,CAAY;QAChB,YAAO,GAAP,OAAO,CAAQ;IAC/B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EAAE,IAAI,CAAC,oBAAoB;oBAC/C,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,WAAW,EAAE,IAAI,CAAC,WAAW;iBAC9B,CAAC,CAAC;YACL;gBACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,IAAgB,EAAE,OAAe;IAC3D,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./definitions.js";
2
+ export * from "./executor.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./definitions.js";
2
+ export * from "./executor.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./schemas.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./schemas.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}