@truecarry/mcp 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 (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +141 -0
  3. package/dist/adapters/InMemoryStorageAdapter.d.ts +49 -0
  4. package/dist/adapters/InMemoryStorageAdapter.d.ts.map +1 -0
  5. package/dist/adapters/LocalSignerAdapter.d.ts +107 -0
  6. package/dist/adapters/LocalSignerAdapter.d.ts.map +1 -0
  7. package/dist/adapters/SqliteSignerAdapter.d.ts +119 -0
  8. package/dist/adapters/SqliteSignerAdapter.d.ts.map +1 -0
  9. package/dist/adapters/SqliteStorageAdapter.d.ts +81 -0
  10. package/dist/adapters/SqliteStorageAdapter.d.ts.map +1 -0
  11. package/dist/adapters/TelegramUserContextProvider.d.ts +70 -0
  12. package/dist/adapters/TelegramUserContextProvider.d.ts.map +1 -0
  13. package/dist/adapters/index.d.ts +19 -0
  14. package/dist/adapters/index.d.ts.map +1 -0
  15. package/dist/cli.d.ts +9 -0
  16. package/dist/cli.d.ts.map +1 -0
  17. package/dist/cli.js +90209 -0
  18. package/dist/core/LimitsManager.d.ts +59 -0
  19. package/dist/core/LimitsManager.d.ts.map +1 -0
  20. package/dist/core/PendingTransactionManager.d.ts +122 -0
  21. package/dist/core/PendingTransactionManager.d.ts.map +1 -0
  22. package/dist/core/UserScopedSigner.d.ts +96 -0
  23. package/dist/core/UserScopedSigner.d.ts.map +1 -0
  24. package/dist/core/UserScopedStorage.d.ts +59 -0
  25. package/dist/core/UserScopedStorage.d.ts.map +1 -0
  26. package/dist/core/index.d.ts +15 -0
  27. package/dist/core/index.d.ts.map +1 -0
  28. package/dist/factory.d.ts +53 -0
  29. package/dist/factory.d.ts.map +1 -0
  30. package/dist/index.cjs +91029 -0
  31. package/dist/index.d.ts +30 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +91015 -0
  34. package/dist/services/McpWalletService.d.ts +253 -0
  35. package/dist/services/McpWalletService.d.ts.map +1 -0
  36. package/dist/services/WalletService.d.ts +144 -0
  37. package/dist/services/WalletService.d.ts.map +1 -0
  38. package/dist/storage/SecureStorage.d.ts +79 -0
  39. package/dist/storage/SecureStorage.d.ts.map +1 -0
  40. package/dist/tools/balance.d.ts +167 -0
  41. package/dist/tools/balance.d.ts.map +1 -0
  42. package/dist/tools/index.d.ts +15 -0
  43. package/dist/tools/index.d.ts.map +1 -0
  44. package/dist/tools/mcp-tools.d.ts +439 -0
  45. package/dist/tools/mcp-tools.d.ts.map +1 -0
  46. package/dist/tools/swap.d.ts +110 -0
  47. package/dist/tools/swap.d.ts.map +1 -0
  48. package/dist/tools/transfer.d.ts +146 -0
  49. package/dist/tools/transfer.d.ts.map +1 -0
  50. package/dist/tools/wallet.d.ts +138 -0
  51. package/dist/tools/wallet.d.ts.map +1 -0
  52. package/dist/types/config.d.ts +65 -0
  53. package/dist/types/config.d.ts.map +1 -0
  54. package/dist/types/contacts.d.ts +61 -0
  55. package/dist/types/contacts.d.ts.map +1 -0
  56. package/dist/types/index.d.ts +16 -0
  57. package/dist/types/index.d.ts.map +1 -0
  58. package/dist/types/signer.d.ts +120 -0
  59. package/dist/types/signer.d.ts.map +1 -0
  60. package/dist/types/storage.d.ts +41 -0
  61. package/dist/types/storage.d.ts.map +1 -0
  62. package/dist/types/user-context.d.ts +48 -0
  63. package/dist/types/user-context.d.ts.map +1 -0
  64. package/package.json +76 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,439 @@
1
+ /**
2
+ * Copyright (c) TonTech.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ /**
9
+ * MCP tools for multi-user deployments with authentication
10
+ *
11
+ * These tools wrap the McpWalletService with user isolation.
12
+ * They are used by the createTonWalletMCP factory.
13
+ */
14
+ import { z } from 'zod';
15
+ import type { McpWalletService } from '../services/McpWalletService.js';
16
+ interface ToolResponse {
17
+ [key: string]: unknown;
18
+ content: Array<{
19
+ type: 'text';
20
+ text: string;
21
+ }>;
22
+ isError?: boolean;
23
+ }
24
+ type AuthenticatedHandlerWrapper = <TArgs, TResult>(handler: (args: TArgs, userId: string, service: McpWalletService) => Promise<TResult>) => (args: TArgs, extra: unknown) => Promise<TResult>;
25
+ export declare const createWalletSchema: z.ZodObject<{
26
+ name: z.ZodString;
27
+ version: z.ZodOptional<z.ZodEnum<["v5r1", "v4r2"]>>;
28
+ network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ name: string;
31
+ version?: "v5r1" | "v4r2" | undefined;
32
+ network?: "mainnet" | "testnet" | undefined;
33
+ }, {
34
+ name: string;
35
+ version?: "v5r1" | "v4r2" | undefined;
36
+ network?: "mainnet" | "testnet" | undefined;
37
+ }>;
38
+ export declare const importWalletSchema: z.ZodObject<{
39
+ name: z.ZodString;
40
+ mnemonic: z.ZodString;
41
+ version: z.ZodOptional<z.ZodEnum<["v5r1", "v4r2"]>>;
42
+ network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ name: string;
45
+ mnemonic: string;
46
+ version?: "v5r1" | "v4r2" | undefined;
47
+ network?: "mainnet" | "testnet" | undefined;
48
+ }, {
49
+ name: string;
50
+ mnemonic: string;
51
+ version?: "v5r1" | "v4r2" | undefined;
52
+ network?: "mainnet" | "testnet" | undefined;
53
+ }>;
54
+ export declare const removeWalletSchema: z.ZodObject<{
55
+ name: z.ZodString;
56
+ }, "strip", z.ZodTypeAny, {
57
+ name: string;
58
+ }, {
59
+ name: string;
60
+ }>;
61
+ export declare function createMcpWalletTools(_walletService: McpWalletService, wrapHandler: AuthenticatedHandlerWrapper): {
62
+ create_wallet: {
63
+ description: string;
64
+ inputSchema: z.ZodObject<{
65
+ name: z.ZodString;
66
+ version: z.ZodOptional<z.ZodEnum<["v5r1", "v4r2"]>>;
67
+ network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ name: string;
70
+ version?: "v5r1" | "v4r2" | undefined;
71
+ network?: "mainnet" | "testnet" | undefined;
72
+ }, {
73
+ name: string;
74
+ version?: "v5r1" | "v4r2" | undefined;
75
+ network?: "mainnet" | "testnet" | undefined;
76
+ }>;
77
+ handler: (args: {
78
+ name: string;
79
+ version?: "v5r1" | "v4r2" | undefined;
80
+ network?: "mainnet" | "testnet" | undefined;
81
+ }, extra: unknown) => Promise<ToolResponse>;
82
+ };
83
+ import_wallet: {
84
+ description: string;
85
+ inputSchema: z.ZodObject<{
86
+ name: z.ZodString;
87
+ mnemonic: z.ZodString;
88
+ version: z.ZodOptional<z.ZodEnum<["v5r1", "v4r2"]>>;
89
+ network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
90
+ }, "strip", z.ZodTypeAny, {
91
+ name: string;
92
+ mnemonic: string;
93
+ version?: "v5r1" | "v4r2" | undefined;
94
+ network?: "mainnet" | "testnet" | undefined;
95
+ }, {
96
+ name: string;
97
+ mnemonic: string;
98
+ version?: "v5r1" | "v4r2" | undefined;
99
+ network?: "mainnet" | "testnet" | undefined;
100
+ }>;
101
+ handler: (args: {
102
+ name: string;
103
+ mnemonic: string;
104
+ version?: "v5r1" | "v4r2" | undefined;
105
+ network?: "mainnet" | "testnet" | undefined;
106
+ }, extra: unknown) => Promise<ToolResponse>;
107
+ };
108
+ list_wallets: {
109
+ description: string;
110
+ inputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
111
+ handler: (args: Record<string, never>, extra: unknown) => Promise<ToolResponse>;
112
+ };
113
+ remove_wallet: {
114
+ description: string;
115
+ inputSchema: z.ZodObject<{
116
+ name: z.ZodString;
117
+ }, "strip", z.ZodTypeAny, {
118
+ name: string;
119
+ }, {
120
+ name: string;
121
+ }>;
122
+ handler: (args: {
123
+ name: string;
124
+ }, extra: unknown) => Promise<ToolResponse>;
125
+ };
126
+ };
127
+ export declare const getBalanceSchema: z.ZodObject<{
128
+ wallet: z.ZodString;
129
+ }, "strip", z.ZodTypeAny, {
130
+ wallet: string;
131
+ }, {
132
+ wallet: string;
133
+ }>;
134
+ export declare const getJettonBalanceSchema: z.ZodObject<{
135
+ wallet: z.ZodString;
136
+ jettonAddress: z.ZodString;
137
+ }, "strip", z.ZodTypeAny, {
138
+ wallet: string;
139
+ jettonAddress: string;
140
+ }, {
141
+ wallet: string;
142
+ jettonAddress: string;
143
+ }>;
144
+ export declare const getJettonsSchema: z.ZodObject<{
145
+ wallet: z.ZodString;
146
+ }, "strip", z.ZodTypeAny, {
147
+ wallet: string;
148
+ }, {
149
+ wallet: string;
150
+ }>;
151
+ export declare const getTransactionsSchema: z.ZodObject<{
152
+ wallet: z.ZodString;
153
+ limit: z.ZodOptional<z.ZodNumber>;
154
+ }, "strip", z.ZodTypeAny, {
155
+ wallet: string;
156
+ limit?: number | undefined;
157
+ }, {
158
+ wallet: string;
159
+ limit?: number | undefined;
160
+ }>;
161
+ export declare function createMcpBalanceTools(_walletService: McpWalletService, wrapHandler: AuthenticatedHandlerWrapper): {
162
+ get_balance: {
163
+ description: string;
164
+ inputSchema: z.ZodObject<{
165
+ wallet: z.ZodString;
166
+ }, "strip", z.ZodTypeAny, {
167
+ wallet: string;
168
+ }, {
169
+ wallet: string;
170
+ }>;
171
+ handler: (args: {
172
+ wallet: string;
173
+ }, extra: unknown) => Promise<ToolResponse>;
174
+ };
175
+ get_jetton_balance: {
176
+ description: string;
177
+ inputSchema: z.ZodObject<{
178
+ wallet: z.ZodString;
179
+ jettonAddress: z.ZodString;
180
+ }, "strip", z.ZodTypeAny, {
181
+ wallet: string;
182
+ jettonAddress: string;
183
+ }, {
184
+ wallet: string;
185
+ jettonAddress: string;
186
+ }>;
187
+ handler: (args: {
188
+ wallet: string;
189
+ jettonAddress: string;
190
+ }, extra: unknown) => Promise<ToolResponse>;
191
+ };
192
+ get_jettons: {
193
+ description: string;
194
+ inputSchema: z.ZodObject<{
195
+ wallet: z.ZodString;
196
+ }, "strip", z.ZodTypeAny, {
197
+ wallet: string;
198
+ }, {
199
+ wallet: string;
200
+ }>;
201
+ handler: (args: {
202
+ wallet: string;
203
+ }, extra: unknown) => Promise<ToolResponse>;
204
+ };
205
+ get_transactions: {
206
+ description: string;
207
+ inputSchema: z.ZodObject<{
208
+ wallet: z.ZodString;
209
+ limit: z.ZodOptional<z.ZodNumber>;
210
+ }, "strip", z.ZodTypeAny, {
211
+ wallet: string;
212
+ limit?: number | undefined;
213
+ }, {
214
+ wallet: string;
215
+ limit?: number | undefined;
216
+ }>;
217
+ handler: (args: {
218
+ wallet: string;
219
+ limit?: number | undefined;
220
+ }, extra: unknown) => Promise<ToolResponse>;
221
+ };
222
+ };
223
+ export declare const sendTonSchema: z.ZodObject<{
224
+ wallet: z.ZodString;
225
+ toAddress: z.ZodString;
226
+ amount: z.ZodString;
227
+ comment: z.ZodOptional<z.ZodString>;
228
+ }, "strip", z.ZodTypeAny, {
229
+ wallet: string;
230
+ toAddress: string;
231
+ amount: string;
232
+ comment?: string | undefined;
233
+ }, {
234
+ wallet: string;
235
+ toAddress: string;
236
+ amount: string;
237
+ comment?: string | undefined;
238
+ }>;
239
+ export declare const sendJettonSchema: z.ZodObject<{
240
+ wallet: z.ZodString;
241
+ toAddress: z.ZodString;
242
+ jettonAddress: z.ZodString;
243
+ amount: z.ZodString;
244
+ comment: z.ZodOptional<z.ZodString>;
245
+ }, "strip", z.ZodTypeAny, {
246
+ wallet: string;
247
+ jettonAddress: string;
248
+ toAddress: string;
249
+ amount: string;
250
+ comment?: string | undefined;
251
+ }, {
252
+ wallet: string;
253
+ jettonAddress: string;
254
+ toAddress: string;
255
+ amount: string;
256
+ comment?: string | undefined;
257
+ }>;
258
+ export declare function createMcpTransferTools(_walletService: McpWalletService, wrapHandler: AuthenticatedHandlerWrapper): {
259
+ send_ton: {
260
+ description: string;
261
+ inputSchema: z.ZodObject<{
262
+ wallet: z.ZodString;
263
+ toAddress: z.ZodString;
264
+ amount: z.ZodString;
265
+ comment: z.ZodOptional<z.ZodString>;
266
+ }, "strip", z.ZodTypeAny, {
267
+ wallet: string;
268
+ toAddress: string;
269
+ amount: string;
270
+ comment?: string | undefined;
271
+ }, {
272
+ wallet: string;
273
+ toAddress: string;
274
+ amount: string;
275
+ comment?: string | undefined;
276
+ }>;
277
+ handler: (args: {
278
+ wallet: string;
279
+ toAddress: string;
280
+ amount: string;
281
+ comment?: string | undefined;
282
+ }, extra: unknown) => Promise<ToolResponse>;
283
+ };
284
+ send_jetton: {
285
+ description: string;
286
+ inputSchema: z.ZodObject<{
287
+ wallet: z.ZodString;
288
+ toAddress: z.ZodString;
289
+ jettonAddress: z.ZodString;
290
+ amount: z.ZodString;
291
+ comment: z.ZodOptional<z.ZodString>;
292
+ }, "strip", z.ZodTypeAny, {
293
+ wallet: string;
294
+ jettonAddress: string;
295
+ toAddress: string;
296
+ amount: string;
297
+ comment?: string | undefined;
298
+ }, {
299
+ wallet: string;
300
+ jettonAddress: string;
301
+ toAddress: string;
302
+ amount: string;
303
+ comment?: string | undefined;
304
+ }>;
305
+ handler: (args: {
306
+ wallet: string;
307
+ jettonAddress: string;
308
+ toAddress: string;
309
+ amount: string;
310
+ comment?: string | undefined;
311
+ }, extra: unknown) => Promise<ToolResponse>;
312
+ };
313
+ };
314
+ export declare const getSwapQuoteSchema: z.ZodObject<{
315
+ wallet: z.ZodString;
316
+ fromToken: z.ZodString;
317
+ toToken: z.ZodString;
318
+ amount: z.ZodString;
319
+ slippageBps: z.ZodOptional<z.ZodNumber>;
320
+ }, "strip", z.ZodTypeAny, {
321
+ fromToken: string;
322
+ toToken: string;
323
+ wallet: string;
324
+ amount: string;
325
+ slippageBps?: number | undefined;
326
+ }, {
327
+ fromToken: string;
328
+ toToken: string;
329
+ wallet: string;
330
+ amount: string;
331
+ slippageBps?: number | undefined;
332
+ }>;
333
+ export declare const executeSwapSchema: z.ZodObject<{
334
+ wallet: z.ZodString;
335
+ quoteId: z.ZodString;
336
+ }, "strip", z.ZodTypeAny, {
337
+ wallet: string;
338
+ quoteId: string;
339
+ }, {
340
+ wallet: string;
341
+ quoteId: string;
342
+ }>;
343
+ export declare function createMcpSwapTools(_walletService: McpWalletService, wrapHandler: AuthenticatedHandlerWrapper): {
344
+ get_swap_quote: {
345
+ description: string;
346
+ inputSchema: z.ZodObject<{
347
+ wallet: z.ZodString;
348
+ fromToken: z.ZodString;
349
+ toToken: z.ZodString;
350
+ amount: z.ZodString;
351
+ slippageBps: z.ZodOptional<z.ZodNumber>;
352
+ }, "strip", z.ZodTypeAny, {
353
+ fromToken: string;
354
+ toToken: string;
355
+ wallet: string;
356
+ amount: string;
357
+ slippageBps?: number | undefined;
358
+ }, {
359
+ fromToken: string;
360
+ toToken: string;
361
+ wallet: string;
362
+ amount: string;
363
+ slippageBps?: number | undefined;
364
+ }>;
365
+ handler: (args: {
366
+ fromToken: string;
367
+ toToken: string;
368
+ wallet: string;
369
+ amount: string;
370
+ slippageBps?: number | undefined;
371
+ }, extra: unknown) => Promise<ToolResponse>;
372
+ };
373
+ execute_swap: {
374
+ description: string;
375
+ inputSchema: z.ZodObject<{
376
+ wallet: z.ZodString;
377
+ quoteId: z.ZodString;
378
+ }, "strip", z.ZodTypeAny, {
379
+ wallet: string;
380
+ quoteId: string;
381
+ }, {
382
+ wallet: string;
383
+ quoteId: string;
384
+ }>;
385
+ handler: (args: {
386
+ wallet: string;
387
+ quoteId: string;
388
+ }, extra: unknown) => Promise<ToolResponse>;
389
+ };
390
+ };
391
+ export declare const confirmTransactionSchema: z.ZodObject<{
392
+ transactionId: z.ZodString;
393
+ }, "strip", z.ZodTypeAny, {
394
+ transactionId: string;
395
+ }, {
396
+ transactionId: string;
397
+ }>;
398
+ export declare const cancelTransactionSchema: z.ZodObject<{
399
+ transactionId: z.ZodString;
400
+ }, "strip", z.ZodTypeAny, {
401
+ transactionId: string;
402
+ }, {
403
+ transactionId: string;
404
+ }>;
405
+ export declare function createMcpPendingTools(_walletService: McpWalletService, wrapHandler: AuthenticatedHandlerWrapper): {
406
+ confirm_transaction: {
407
+ description: string;
408
+ inputSchema: z.ZodObject<{
409
+ transactionId: z.ZodString;
410
+ }, "strip", z.ZodTypeAny, {
411
+ transactionId: string;
412
+ }, {
413
+ transactionId: string;
414
+ }>;
415
+ handler: (args: {
416
+ transactionId: string;
417
+ }, extra: unknown) => Promise<ToolResponse>;
418
+ };
419
+ cancel_transaction: {
420
+ description: string;
421
+ inputSchema: z.ZodObject<{
422
+ transactionId: z.ZodString;
423
+ }, "strip", z.ZodTypeAny, {
424
+ transactionId: string;
425
+ }, {
426
+ transactionId: string;
427
+ }>;
428
+ handler: (args: {
429
+ transactionId: string;
430
+ }, extra: unknown) => Promise<ToolResponse>;
431
+ };
432
+ list_pending_transactions: {
433
+ description: string;
434
+ inputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
435
+ handler: (args: Record<string, never>, extra: unknown) => Promise<ToolResponse>;
436
+ };
437
+ };
438
+ export {};
439
+ //# sourceMappingURL=mcp-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-tools.d.ts","sourceRoot":"","sources":["../../src/tools/mcp-tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,UAAU,YAAY;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAGD,KAAK,2BAA2B,GAAG,CAAC,KAAK,EAAE,OAAO,EAC9C,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC,KACpF,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAkBvD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAU7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAW7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AAEH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,2BAA2B;;;;;;;;;;;;;;;;;;;;kBA/CrF,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;kBAAP,OAAO;;;;;sDAAP,OAAO;;;;;;;;;;;;;kBAAP,OAAO;;EAwQhC;AAMD,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;EAQhC,CAAC;AAEH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,2BAA2B;;;;;;;;;;;;kBArStF,OAAO;;;;;;;;;;;;;;;;;kBAAP,OAAO;;;;;;;;;;;;;kBAAP,OAAO;;;;;;;;;;;;;;;;;kBAAP,OAAO;;EAihBhC;AAMD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;EAKxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAEH,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;kBAtiBvF,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAP,OAAO;;EA2tBhC;AAsBD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;EAM7B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;EAG5B,CAAC;AAEH,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA9vBnF,OAAO;;;;;;;;;;;;;;;;;kBAAP,OAAO;;EAq7BhC;AAMD,eAAO,MAAM,wBAAwB;;;;;;EAEnC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAC;AAEH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,2BAA2B;;;;;;;;;;;;kBAn8BtF,OAAO;;;;;;;;;;;;;kBAAP,OAAO;;;;;sDAAP,OAAO;;EAwkChC"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Copyright (c) TonTech.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ /**
9
+ * Swap MCP tools for token swapping on TON blockchain
10
+ *
11
+ * Uses the Omniston (STON.fi) protocol for swap operations.
12
+ * Swap flow:
13
+ * 1. Get a quote using get_swap_quote
14
+ * 2. Execute the swap using execute_swap with the quote
15
+ */
16
+ import { z } from 'zod';
17
+ import type { WalletService } from '../services/WalletService.js';
18
+ export declare const getSwapQuoteSchema: z.ZodObject<{
19
+ wallet: z.ZodString;
20
+ fromToken: z.ZodString;
21
+ toToken: z.ZodString;
22
+ amount: z.ZodString;
23
+ slippageBps: z.ZodOptional<z.ZodNumber>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ fromToken: string;
26
+ toToken: string;
27
+ wallet: string;
28
+ amount: string;
29
+ slippageBps?: number | undefined;
30
+ }, {
31
+ fromToken: string;
32
+ toToken: string;
33
+ wallet: string;
34
+ amount: string;
35
+ slippageBps?: number | undefined;
36
+ }>;
37
+ export declare const executeSwapSchema: z.ZodObject<{
38
+ wallet: z.ZodString;
39
+ quoteId: z.ZodString;
40
+ }, "strip", z.ZodTypeAny, {
41
+ wallet: string;
42
+ quoteId: string;
43
+ }, {
44
+ wallet: string;
45
+ quoteId: string;
46
+ }>;
47
+ export declare function createSwapTools(walletService: WalletService): {
48
+ get_swap_quote: {
49
+ description: string;
50
+ inputSchema: z.ZodObject<{
51
+ wallet: z.ZodString;
52
+ fromToken: z.ZodString;
53
+ toToken: z.ZodString;
54
+ amount: z.ZodString;
55
+ slippageBps: z.ZodOptional<z.ZodNumber>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ fromToken: string;
58
+ toToken: string;
59
+ wallet: string;
60
+ amount: string;
61
+ slippageBps?: number | undefined;
62
+ }, {
63
+ fromToken: string;
64
+ toToken: string;
65
+ wallet: string;
66
+ amount: string;
67
+ slippageBps?: number | undefined;
68
+ }>;
69
+ handler: (args: z.infer<typeof getSwapQuoteSchema>) => Promise<{
70
+ content: {
71
+ type: "text";
72
+ text: string;
73
+ }[];
74
+ isError?: undefined;
75
+ } | {
76
+ content: {
77
+ type: "text";
78
+ text: string;
79
+ }[];
80
+ isError: boolean;
81
+ }>;
82
+ };
83
+ execute_swap: {
84
+ description: string;
85
+ inputSchema: z.ZodObject<{
86
+ wallet: z.ZodString;
87
+ quoteId: z.ZodString;
88
+ }, "strip", z.ZodTypeAny, {
89
+ wallet: string;
90
+ quoteId: string;
91
+ }, {
92
+ wallet: string;
93
+ quoteId: string;
94
+ }>;
95
+ handler: (args: z.infer<typeof executeSwapSchema>) => Promise<{
96
+ content: {
97
+ type: "text";
98
+ text: string;
99
+ }[];
100
+ isError: boolean;
101
+ } | {
102
+ content: {
103
+ type: "text";
104
+ text: string;
105
+ }[];
106
+ isError?: undefined;
107
+ }>;
108
+ };
109
+ };
110
+ //# sourceMappingURL=swap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/tools/swap.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAkBlE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;EAoB7B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;EAG5B,CAAC;AAEH,wBAAgB,eAAe,CAAC,aAAa,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;wBAM1B,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;wBAgElC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC;;;;;;;;;;;;;;EAkFlE"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Copyright (c) TonTech.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ /**
9
+ * Transfer MCP tools for sending TON and Jettons
10
+ *
11
+ * Amount handling:
12
+ * - User provides human-readable amounts (e.g., "1.5" TON or "0.001" USDT)
13
+ * - Tool converts to raw units using token decimals (TON has 9 decimals, most jettons have 6-9)
14
+ * - Conversion: rawAmount = userAmount * 10^decimals
15
+ */
16
+ import { z } from 'zod';
17
+ import type { WalletService } from '../services/WalletService.js';
18
+ /**
19
+ * Converts a human-readable amount to raw units (smallest denomination).
20
+ *
21
+ * @param amount - Human-readable amount as string (e.g., "1.5", "0.001")
22
+ * @param decimals - Number of decimal places for the token (e.g., 9 for TON, 6 for USDT)
23
+ * @returns Raw amount as string (e.g., "1500000000" for 1.5 TON)
24
+ *
25
+ * @example
26
+ * toRawAmount("1.5", 9) // "1500000000" (1.5 TON)
27
+ * toRawAmount("0.001", 6) // "1000" (0.001 USDT with 6 decimals)
28
+ * toRawAmount("100", 9) // "100000000000" (100 TON)
29
+ */
30
+ declare function toRawAmount(amount: string, decimals: number): string;
31
+ /**
32
+ * Converts raw units to human-readable amount.
33
+ *
34
+ * @param rawAmount - Raw amount as string (e.g., "1500000000")
35
+ * @param decimals - Number of decimal places for the token
36
+ * @returns Human-readable amount as string (e.g., "1.5")
37
+ */
38
+ declare function fromRawAmount(rawAmount: string, decimals: number): string;
39
+ /** TON has 9 decimal places (1 TON = 1,000,000,000 nanoTON) */
40
+ declare const TON_DECIMALS = 9;
41
+ export declare const sendTonSchema: z.ZodObject<{
42
+ wallet: z.ZodString;
43
+ toAddress: z.ZodString;
44
+ amount: z.ZodString;
45
+ comment: z.ZodOptional<z.ZodString>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ wallet: string;
48
+ toAddress: string;
49
+ amount: string;
50
+ comment?: string | undefined;
51
+ }, {
52
+ wallet: string;
53
+ toAddress: string;
54
+ amount: string;
55
+ comment?: string | undefined;
56
+ }>;
57
+ export declare const sendJettonSchema: z.ZodObject<{
58
+ wallet: z.ZodString;
59
+ toAddress: z.ZodString;
60
+ jettonAddress: z.ZodString;
61
+ amount: z.ZodString;
62
+ comment: z.ZodOptional<z.ZodString>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ wallet: string;
65
+ jettonAddress: string;
66
+ toAddress: string;
67
+ amount: string;
68
+ comment?: string | undefined;
69
+ }, {
70
+ wallet: string;
71
+ jettonAddress: string;
72
+ toAddress: string;
73
+ amount: string;
74
+ comment?: string | undefined;
75
+ }>;
76
+ export declare function createTransferTools(walletService: WalletService): {
77
+ send_ton: {
78
+ description: string;
79
+ inputSchema: z.ZodObject<{
80
+ wallet: z.ZodString;
81
+ toAddress: z.ZodString;
82
+ amount: z.ZodString;
83
+ comment: z.ZodOptional<z.ZodString>;
84
+ }, "strip", z.ZodTypeAny, {
85
+ wallet: string;
86
+ toAddress: string;
87
+ amount: string;
88
+ comment?: string | undefined;
89
+ }, {
90
+ wallet: string;
91
+ toAddress: string;
92
+ amount: string;
93
+ comment?: string | undefined;
94
+ }>;
95
+ handler: (args: z.infer<typeof sendTonSchema>) => Promise<{
96
+ content: {
97
+ type: "text";
98
+ text: string;
99
+ }[];
100
+ isError: boolean;
101
+ } | {
102
+ content: {
103
+ type: "text";
104
+ text: string;
105
+ }[];
106
+ isError?: undefined;
107
+ }>;
108
+ };
109
+ send_jetton: {
110
+ description: string;
111
+ inputSchema: z.ZodObject<{
112
+ wallet: z.ZodString;
113
+ toAddress: z.ZodString;
114
+ jettonAddress: z.ZodString;
115
+ amount: z.ZodString;
116
+ comment: z.ZodOptional<z.ZodString>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ wallet: string;
119
+ jettonAddress: string;
120
+ toAddress: string;
121
+ amount: string;
122
+ comment?: string | undefined;
123
+ }, {
124
+ wallet: string;
125
+ jettonAddress: string;
126
+ toAddress: string;
127
+ amount: string;
128
+ comment?: string | undefined;
129
+ }>;
130
+ handler: (args: z.infer<typeof sendJettonSchema>) => Promise<{
131
+ content: {
132
+ type: "text";
133
+ text: string;
134
+ }[];
135
+ isError: boolean;
136
+ } | {
137
+ content: {
138
+ type: "text";
139
+ text: string;
140
+ }[];
141
+ isError?: undefined;
142
+ }>;
143
+ };
144
+ };
145
+ export { toRawAmount, fromRawAmount, TON_DECIMALS };
146
+ //# sourceMappingURL=transfer.d.ts.map