@truecarry/mcp 0.1.3 → 0.1.5

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 (70) hide show
  1. package/dist/cli.js +654 -1579
  2. package/dist/factory.d.ts +35 -21
  3. package/dist/factory.d.ts.map +1 -1
  4. package/dist/index.cjs +781 -4180
  5. package/dist/index.d.ts +5 -16
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +781 -4167
  8. package/dist/services/McpWalletService.d.ts +74 -133
  9. package/dist/services/McpWalletService.d.ts.map +1 -1
  10. package/dist/tools/balance-tools.d.ts +61 -0
  11. package/dist/tools/balance-tools.d.ts.map +1 -0
  12. package/dist/tools/index.d.ts +5 -7
  13. package/dist/tools/index.d.ts.map +1 -1
  14. package/dist/tools/known-jettons-tools.d.ts +44 -0
  15. package/dist/tools/known-jettons-tools.d.ts.map +1 -0
  16. package/dist/tools/nft-tools.d.ts +85 -0
  17. package/dist/tools/nft-tools.d.ts.map +1 -0
  18. package/dist/tools/swap-tools.d.ts +49 -0
  19. package/dist/tools/swap-tools.d.ts.map +1 -0
  20. package/dist/tools/transfer-tools.d.ts +159 -0
  21. package/dist/tools/transfer-tools.d.ts.map +1 -0
  22. package/dist/tools/types.d.ts +21 -0
  23. package/dist/tools/types.d.ts.map +1 -0
  24. package/dist/types/config.d.ts +12 -36
  25. package/dist/types/config.d.ts.map +1 -1
  26. package/dist/types/index.d.ts +1 -4
  27. package/dist/types/index.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/dist/adapters/InMemoryStorageAdapter.d.ts +0 -49
  30. package/dist/adapters/InMemoryStorageAdapter.d.ts.map +0 -1
  31. package/dist/adapters/LocalSignerAdapter.d.ts +0 -107
  32. package/dist/adapters/LocalSignerAdapter.d.ts.map +0 -1
  33. package/dist/adapters/SqliteSignerAdapter.d.ts +0 -119
  34. package/dist/adapters/SqliteSignerAdapter.d.ts.map +0 -1
  35. package/dist/adapters/SqliteStorageAdapter.d.ts +0 -81
  36. package/dist/adapters/SqliteStorageAdapter.d.ts.map +0 -1
  37. package/dist/adapters/TelegramUserContextProvider.d.ts +0 -70
  38. package/dist/adapters/TelegramUserContextProvider.d.ts.map +0 -1
  39. package/dist/adapters/index.d.ts +0 -19
  40. package/dist/adapters/index.d.ts.map +0 -1
  41. package/dist/core/LimitsManager.d.ts +0 -59
  42. package/dist/core/LimitsManager.d.ts.map +0 -1
  43. package/dist/core/PendingTransactionManager.d.ts +0 -122
  44. package/dist/core/PendingTransactionManager.d.ts.map +0 -1
  45. package/dist/core/UserScopedSigner.d.ts +0 -96
  46. package/dist/core/UserScopedSigner.d.ts.map +0 -1
  47. package/dist/core/UserScopedStorage.d.ts +0 -59
  48. package/dist/core/UserScopedStorage.d.ts.map +0 -1
  49. package/dist/core/index.d.ts +0 -15
  50. package/dist/core/index.d.ts.map +0 -1
  51. package/dist/services/WalletService.d.ts +0 -144
  52. package/dist/services/WalletService.d.ts.map +0 -1
  53. package/dist/storage/SecureStorage.d.ts +0 -79
  54. package/dist/storage/SecureStorage.d.ts.map +0 -1
  55. package/dist/tools/balance.d.ts +0 -167
  56. package/dist/tools/balance.d.ts.map +0 -1
  57. package/dist/tools/mcp-tools.d.ts +0 -439
  58. package/dist/tools/mcp-tools.d.ts.map +0 -1
  59. package/dist/tools/swap.d.ts +0 -110
  60. package/dist/tools/swap.d.ts.map +0 -1
  61. package/dist/tools/transfer.d.ts +0 -146
  62. package/dist/tools/transfer.d.ts.map +0 -1
  63. package/dist/tools/wallet.d.ts +0 -138
  64. package/dist/tools/wallet.d.ts.map +0 -1
  65. package/dist/types/signer.d.ts +0 -120
  66. package/dist/types/signer.d.ts.map +0 -1
  67. package/dist/types/storage.d.ts +0 -41
  68. package/dist/types/storage.d.ts.map +0 -1
  69. package/dist/types/user-context.d.ts +0 -48
  70. package/dist/types/user-context.d.ts.map +0 -1
@@ -1,110 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,146 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../src/tools/transfer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;;;;;;;;;GAWG;AACH,iBAAS,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED;;;;;;GAMG;AACH,iBAAS,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMlE;AAED,+DAA+D;AAC/D,QAAA,MAAM,YAAY,IAAI,CAAC;AAEvB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;EAKxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAW3B,CAAC;AAEH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,aAAa;;;;;;;;;;;;;;;;;;;wBAM9B,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkD7B,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC;;;;;;;;;;;;;;EAgGjE;AAED,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC"}
@@ -1,138 +0,0 @@
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
- * Wallet management MCP tools
10
- */
11
- import { z } from 'zod';
12
- import type { WalletService } from '../services/WalletService.js';
13
- export declare const createWalletSchema: z.ZodObject<{
14
- name: z.ZodString;
15
- version: z.ZodOptional<z.ZodEnum<["v5r1", "v4r2"]>>;
16
- network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
17
- }, "strip", z.ZodTypeAny, {
18
- name: string;
19
- version?: "v5r1" | "v4r2" | undefined;
20
- network?: "mainnet" | "testnet" | undefined;
21
- }, {
22
- name: string;
23
- version?: "v5r1" | "v4r2" | undefined;
24
- network?: "mainnet" | "testnet" | undefined;
25
- }>;
26
- export declare const importWalletSchema: z.ZodObject<{
27
- name: z.ZodString;
28
- mnemonic: z.ZodString;
29
- version: z.ZodOptional<z.ZodEnum<["v5r1", "v4r2"]>>;
30
- network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
31
- }, "strip", z.ZodTypeAny, {
32
- name: string;
33
- mnemonic: string;
34
- version?: "v5r1" | "v4r2" | undefined;
35
- network?: "mainnet" | "testnet" | undefined;
36
- }, {
37
- name: string;
38
- mnemonic: string;
39
- version?: "v5r1" | "v4r2" | undefined;
40
- network?: "mainnet" | "testnet" | undefined;
41
- }>;
42
- export declare const removeWalletSchema: z.ZodObject<{
43
- name: z.ZodString;
44
- }, "strip", z.ZodTypeAny, {
45
- name: string;
46
- }, {
47
- name: string;
48
- }>;
49
- export declare function createWalletTools(walletService: WalletService): {
50
- create_wallet: {
51
- description: string;
52
- inputSchema: z.ZodObject<{
53
- name: z.ZodString;
54
- version: z.ZodOptional<z.ZodEnum<["v5r1", "v4r2"]>>;
55
- network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
56
- }, "strip", z.ZodTypeAny, {
57
- name: string;
58
- version?: "v5r1" | "v4r2" | undefined;
59
- network?: "mainnet" | "testnet" | undefined;
60
- }, {
61
- name: string;
62
- version?: "v5r1" | "v4r2" | undefined;
63
- network?: "mainnet" | "testnet" | undefined;
64
- }>;
65
- handler: (args: z.infer<typeof createWalletSchema>) => Promise<{
66
- content: {
67
- type: "text";
68
- text: string;
69
- }[];
70
- }>;
71
- };
72
- import_wallet: {
73
- description: string;
74
- inputSchema: z.ZodObject<{
75
- name: z.ZodString;
76
- mnemonic: z.ZodString;
77
- version: z.ZodOptional<z.ZodEnum<["v5r1", "v4r2"]>>;
78
- network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
79
- }, "strip", z.ZodTypeAny, {
80
- name: string;
81
- mnemonic: string;
82
- version?: "v5r1" | "v4r2" | undefined;
83
- network?: "mainnet" | "testnet" | undefined;
84
- }, {
85
- name: string;
86
- mnemonic: string;
87
- version?: "v5r1" | "v4r2" | undefined;
88
- network?: "mainnet" | "testnet" | undefined;
89
- }>;
90
- handler: (args: z.infer<typeof importWalletSchema>) => Promise<{
91
- content: {
92
- type: "text";
93
- text: string;
94
- }[];
95
- isError: boolean;
96
- } | {
97
- content: {
98
- type: "text";
99
- text: string;
100
- }[];
101
- isError?: undefined;
102
- }>;
103
- };
104
- list_wallets: {
105
- description: string;
106
- inputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
107
- handler: () => Promise<{
108
- content: {
109
- type: "text";
110
- text: string;
111
- }[];
112
- }>;
113
- };
114
- remove_wallet: {
115
- description: string;
116
- inputSchema: z.ZodObject<{
117
- name: z.ZodString;
118
- }, "strip", z.ZodTypeAny, {
119
- name: string;
120
- }, {
121
- name: string;
122
- }>;
123
- handler: (args: z.infer<typeof removeWalletSchema>) => Promise<{
124
- content: {
125
- type: "text";
126
- text: string;
127
- }[];
128
- isError: boolean;
129
- } | {
130
- content: {
131
- type: "text";
132
- text: string;
133
- }[];
134
- isError?: undefined;
135
- }>;
136
- };
137
- };
138
- //# sourceMappingURL=wallet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/tools/wallet.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAU7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAW7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AAEH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,aAAa;;;;;;;;;;;;;;;;wBAM5B,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;wBA8BlC,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0ElC,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC;;;;;;;;;;;;;;EA8BnE"}
@@ -1,120 +0,0 @@
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
- * ISignerAdapter - Interface for secure key management and signing operations
10
- *
11
- * Critical: This adapter NEVER returns private keys or seed phrases.
12
- * Seed phrases are accepted as input but stored securely by the adapter implementation.
13
- */
14
- /**
15
- * Wallet information returned by signer operations.
16
- * Contains only public data - no private keys or seed phrases.
17
- */
18
- export interface WalletInfo {
19
- /** Internal wallet ID (may be user-prefixed internally by the adapter) */
20
- walletId: string;
21
- /** Hex-encoded public key */
22
- publicKey: string;
23
- /** TON address (user-friendly format) */
24
- address: string;
25
- /** Network the wallet is configured for */
26
- network: 'mainnet' | 'testnet';
27
- /** Wallet contract version */
28
- version: 'v5r1' | 'v4r2';
29
- /** ISO timestamp when wallet was created */
30
- createdAt: string;
31
- }
32
- /**
33
- * Parameters for creating a new wallet
34
- */
35
- export interface CreateWalletParams {
36
- /** Unique wallet ID (should be user-scoped externally) */
37
- walletId: string;
38
- /** Wallet contract version */
39
- version: 'v5r1' | 'v4r2';
40
- /** Network to create the wallet on */
41
- network: 'mainnet' | 'testnet';
42
- }
43
- /**
44
- * Parameters for importing a wallet from mnemonic
45
- */
46
- export interface ImportWalletParams {
47
- /** Unique wallet ID (should be user-scoped externally) */
48
- walletId: string;
49
- /** 24-word mnemonic phrase (stored securely, never returned) */
50
- mnemonic: string[];
51
- /** Wallet contract version */
52
- version: 'v5r1' | 'v4r2';
53
- /** Network to import the wallet on */
54
- network: 'mainnet' | 'testnet';
55
- }
56
- /**
57
- * Interface for secure key management and signing operations.
58
- *
59
- * Implementations should:
60
- * - Store keys encrypted (e.g., AES-256-GCM with master key derived via PBKDF2/Argon2)
61
- * - Never expose private keys or seed phrases through any method
62
- * - Support user isolation if operating in multi-tenant mode
63
- */
64
- export interface ISignerAdapter {
65
- /**
66
- * Create a new wallet with generated keys.
67
- * The mnemonic is generated and stored securely - NEVER returned.
68
- *
69
- * @param params - Wallet creation parameters
70
- * @returns Wallet info (address, public key) - NO private data
71
- */
72
- createWallet(params: CreateWalletParams): Promise<WalletInfo>;
73
- /**
74
- * Import a wallet from mnemonic.
75
- * The mnemonic is stored securely by the adapter - NEVER returned.
76
- *
77
- * @param params - Import parameters including mnemonic
78
- * @returns Wallet info (address, public key) - NO private data
79
- */
80
- importWallet(params: ImportWalletParams): Promise<WalletInfo>;
81
- /**
82
- * Get wallet info by ID.
83
- *
84
- * @param walletId - The wallet ID
85
- * @returns Wallet info or null if not found
86
- */
87
- getWallet(walletId: string): Promise<WalletInfo | null>;
88
- /**
89
- * List all wallet IDs managed by this adapter.
90
- * For user isolation, the wrapper should filter by user prefix.
91
- *
92
- * @returns Array of wallet IDs
93
- */
94
- listWalletIds(): Promise<string[]>;
95
- /**
96
- * Delete a wallet and its keys.
97
- *
98
- * @param walletId - The wallet ID to delete
99
- * @returns true if deleted, false if not found
100
- */
101
- deleteWallet(walletId: string): Promise<boolean>;
102
- /**
103
- * Sign a transaction.
104
- * The adapter loads the private key internally and signs.
105
- *
106
- * @param walletId - The wallet ID to sign with
107
- * @param unsignedBoc - Base64-encoded unsigned transaction BOC
108
- * @returns Base64-encoded signed transaction BOC
109
- */
110
- signTransaction(walletId: string, unsignedBoc: string): Promise<string>;
111
- /**
112
- * Sign an arbitrary message.
113
- *
114
- * @param walletId - The wallet ID to sign with
115
- * @param message - The message bytes to sign
116
- * @returns The signature bytes
117
- */
118
- signMessage(walletId: string, message: Buffer): Promise<Buffer>;
119
- }
120
- //# sourceMappingURL=signer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src/types/signer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,UAAU;IACvB,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,8BAA8B;IAC9B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,sCAAsC;IACtC,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,sCAAsC;IACtC,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;;;OAMG;IACH,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAE9D;;;;;;OAMG;IACH,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAE9D;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAExD;;;;;OAKG;IACH,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAEnC;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEjD;;;;;;;OAOG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExE;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACnE"}
@@ -1,41 +0,0 @@
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
- * IStorageAdapter - Interface for persistent key-value storage
10
- *
11
- * Purpose: Store wallet metadata, contacts, transaction history, pending transactions.
12
- * Does NOT store: private keys, seed phrases (that's ISignerAdapter's responsibility)
13
- */
14
- export interface IStorageAdapter {
15
- /**
16
- * Get a value by key
17
- * @param key - The storage key
18
- * @returns The stored value or null if not found
19
- */
20
- get<T>(key: string): Promise<T | null>;
21
- /**
22
- * Set a value with optional TTL
23
- * @param key - The storage key
24
- * @param value - The value to store
25
- * @param ttlSeconds - Optional time-to-live in seconds (for pending transactions, etc.)
26
- */
27
- set<T>(key: string, value: T, ttlSeconds?: number): Promise<void>;
28
- /**
29
- * Delete a key
30
- * @param key - The storage key
31
- * @returns true if the key existed and was deleted, false otherwise
32
- */
33
- delete(key: string): Promise<boolean>;
34
- /**
35
- * List all keys matching a prefix
36
- * @param prefix - The key prefix to match
37
- * @returns Array of matching keys
38
- */
39
- list(prefix: string): Promise<string[]>;
40
- }
41
- //# sourceMappingURL=storage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/types/storage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC5B;;;;OAIG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAEvC;;;;;OAKG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElE;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtC;;;;OAIG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC3C"}
@@ -1,48 +0,0 @@
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
- * IUserContextProvider - Interface for extracting authenticated user identity
10
- *
11
- * Purpose: Identify the current user from MCP request context.
12
- * Returns null if user cannot be authenticated (request should be rejected).
13
- */
14
- /**
15
- * Request context passed to the user context provider.
16
- * Contains headers and metadata from the MCP request.
17
- */
18
- export interface RequestContext {
19
- /** HTTP headers (e.g., x-telegram-user-id, authorization) */
20
- headers?: Record<string, string>;
21
- /** Additional metadata from the transport */
22
- metadata?: Record<string, unknown>;
23
- }
24
- /**
25
- * Interface for extracting user identity from request context.
26
- *
27
- * Implementations should:
28
- * - Extract user ID from appropriate header or metadata
29
- * - Return null if user cannot be authenticated
30
- * - Optionally provide user metadata for auditing
31
- */
32
- export interface IUserContextProvider {
33
- /**
34
- * Extract user ID from request context.
35
- *
36
- * @param context - The request context with headers and metadata
37
- * @returns User ID string or null if unauthenticated
38
- */
39
- getUserId(context: RequestContext): Promise<string | null>;
40
- /**
41
- * Optional: Get additional user metadata for logging/auditing.
42
- *
43
- * @param userId - The user ID
44
- * @returns User metadata or null if not available
45
- */
46
- getUserMetadata?(userId: string): Promise<Record<string, unknown> | null>;
47
- }
48
- //# sourceMappingURL=user-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-context.d.ts","sourceRoot":"","sources":["../../src/types/user-context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC3B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;;;OAKG;IACH,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE3D;;;;;OAKG;IACH,eAAe,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;CAC7E"}