@t402/mcp 1.0.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.
- package/README.md +228 -0
- package/bin/t402-mcp.js +53 -0
- package/dist/cjs/index.d.ts +69 -0
- package/dist/cjs/index.js +1692 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/server/index.d.ts +59 -0
- package/dist/cjs/server/index.js +1613 -0
- package/dist/cjs/server/index.js.map +1 -0
- package/dist/cjs/tools/index.d.ts +424 -0
- package/dist/cjs/tools/index.js +1404 -0
- package/dist/cjs/tools/index.js.map +1 -0
- package/dist/cjs/types-BINGE6ja.d.ts +147 -0
- package/dist/esm/chunk-AN6P2M7N.mjs +272 -0
- package/dist/esm/chunk-AN6P2M7N.mjs.map +1 -0
- package/dist/esm/chunk-SB4O25HA.mjs +1399 -0
- package/dist/esm/chunk-SB4O25HA.mjs.map +1 -0
- package/dist/esm/index.d.mts +69 -0
- package/dist/esm/index.mjs +81 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/server/index.d.mts +59 -0
- package/dist/esm/server/index.mjs +12 -0
- package/dist/esm/server/index.mjs.map +1 -0
- package/dist/esm/tools/index.d.mts +424 -0
- package/dist/esm/tools/index.mjs +45 -0
- package/dist/esm/tools/index.mjs.map +1 -0
- package/dist/esm/types-BINGE6ja.d.mts +147 -0
- package/package.json +93 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { S as SupportedNetwork, C as ChainBalance, a as PaymentResult, G as GaslessPaymentResult, B as BridgeFeeQuote, b as BridgeResult } from '../types-BINGE6ja.mjs';
|
|
3
|
+
import 'viem';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* t402/getBalance - Get token balance for a specific network
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Input schema for getBalance tool
|
|
11
|
+
*/
|
|
12
|
+
declare const getBalanceInputSchema: z.ZodObject<{
|
|
13
|
+
network: z.ZodEnum<["ethereum", "base", "arbitrum", "optimism", "polygon", "avalanche", "ink", "berachain", "unichain"]>;
|
|
14
|
+
address: z.ZodString;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
address: string;
|
|
17
|
+
network: "ethereum" | "base" | "arbitrum" | "optimism" | "polygon" | "avalanche" | "ink" | "berachain" | "unichain";
|
|
18
|
+
}, {
|
|
19
|
+
address: string;
|
|
20
|
+
network: "ethereum" | "base" | "arbitrum" | "optimism" | "polygon" | "avalanche" | "ink" | "berachain" | "unichain";
|
|
21
|
+
}>;
|
|
22
|
+
type GetBalanceInput = z.infer<typeof getBalanceInputSchema>;
|
|
23
|
+
/**
|
|
24
|
+
* Execute getBalance tool
|
|
25
|
+
*/
|
|
26
|
+
declare function executeGetBalance(input: GetBalanceInput, rpcUrls?: Partial<Record<SupportedNetwork, string>>): Promise<ChainBalance>;
|
|
27
|
+
/**
|
|
28
|
+
* Format balance result for display
|
|
29
|
+
*/
|
|
30
|
+
declare function formatBalanceResult(balance: ChainBalance): string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* t402/getAllBalances - Get token balances across all supported networks
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Input schema for getAllBalances tool
|
|
38
|
+
*/
|
|
39
|
+
declare const getAllBalancesInputSchema: z.ZodObject<{
|
|
40
|
+
address: z.ZodString;
|
|
41
|
+
networks: z.ZodOptional<z.ZodArray<z.ZodEnum<["ethereum", "base", "arbitrum", "optimism", "polygon", "avalanche", "ink", "berachain", "unichain"]>, "many">>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
address: string;
|
|
44
|
+
networks?: ("ethereum" | "base" | "arbitrum" | "optimism" | "polygon" | "avalanche" | "ink" | "berachain" | "unichain")[] | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
address: string;
|
|
47
|
+
networks?: ("ethereum" | "base" | "arbitrum" | "optimism" | "polygon" | "avalanche" | "ink" | "berachain" | "unichain")[] | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
type GetAllBalancesInput = z.infer<typeof getAllBalancesInputSchema>;
|
|
50
|
+
/**
|
|
51
|
+
* Result of getAllBalances
|
|
52
|
+
*/
|
|
53
|
+
interface AllBalancesResult {
|
|
54
|
+
address: string;
|
|
55
|
+
balances: ChainBalance[];
|
|
56
|
+
totalUsdcBalance: string;
|
|
57
|
+
totalUsdtBalance: string;
|
|
58
|
+
summary: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Execute getAllBalances tool
|
|
62
|
+
*/
|
|
63
|
+
declare function executeGetAllBalances(input: GetAllBalancesInput, rpcUrls?: Partial<Record<SupportedNetwork, string>>): Promise<AllBalancesResult>;
|
|
64
|
+
/**
|
|
65
|
+
* Format all balances result for display
|
|
66
|
+
*/
|
|
67
|
+
declare function formatAllBalancesResult(result: AllBalancesResult): string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* t402/pay - Execute a payment on a specific network
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Input schema for pay tool
|
|
75
|
+
*/
|
|
76
|
+
declare const payInputSchema: z.ZodObject<{
|
|
77
|
+
to: z.ZodString;
|
|
78
|
+
amount: z.ZodString;
|
|
79
|
+
token: z.ZodEnum<["USDC", "USDT", "USDT0"]>;
|
|
80
|
+
network: z.ZodEnum<["ethereum", "base", "arbitrum", "optimism", "polygon", "avalanche", "ink", "berachain", "unichain"]>;
|
|
81
|
+
memo: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
to: string;
|
|
84
|
+
amount: string;
|
|
85
|
+
network: "ethereum" | "base" | "arbitrum" | "optimism" | "polygon" | "avalanche" | "ink" | "berachain" | "unichain";
|
|
86
|
+
token: "USDC" | "USDT" | "USDT0";
|
|
87
|
+
memo?: string | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
to: string;
|
|
90
|
+
amount: string;
|
|
91
|
+
network: "ethereum" | "base" | "arbitrum" | "optimism" | "polygon" | "avalanche" | "ink" | "berachain" | "unichain";
|
|
92
|
+
token: "USDC" | "USDT" | "USDT0";
|
|
93
|
+
memo?: string | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
type PayInput = z.infer<typeof payInputSchema>;
|
|
96
|
+
/**
|
|
97
|
+
* Options for executing payment
|
|
98
|
+
*/
|
|
99
|
+
interface PayOptions {
|
|
100
|
+
/** Private key for signing (hex with 0x prefix) */
|
|
101
|
+
privateKey: string;
|
|
102
|
+
/** Custom RPC URL */
|
|
103
|
+
rpcUrl?: string;
|
|
104
|
+
/** Demo mode - simulate without executing */
|
|
105
|
+
demoMode?: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Execute pay tool
|
|
109
|
+
*/
|
|
110
|
+
declare function executePay(input: PayInput, options: PayOptions): Promise<PaymentResult>;
|
|
111
|
+
/**
|
|
112
|
+
* Format payment result for display
|
|
113
|
+
*/
|
|
114
|
+
declare function formatPaymentResult(result: PaymentResult): string;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* t402/payGasless - Execute a gasless payment using ERC-4337
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Input schema for payGasless tool
|
|
122
|
+
*/
|
|
123
|
+
declare const payGaslessInputSchema: z.ZodObject<{
|
|
124
|
+
to: z.ZodString;
|
|
125
|
+
amount: z.ZodString;
|
|
126
|
+
token: z.ZodEnum<["USDC", "USDT", "USDT0"]>;
|
|
127
|
+
network: z.ZodEnum<["ethereum", "base", "arbitrum", "optimism", "polygon", "avalanche"]>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
to: string;
|
|
130
|
+
amount: string;
|
|
131
|
+
network: "ethereum" | "base" | "arbitrum" | "optimism" | "polygon" | "avalanche";
|
|
132
|
+
token: "USDC" | "USDT" | "USDT0";
|
|
133
|
+
}, {
|
|
134
|
+
to: string;
|
|
135
|
+
amount: string;
|
|
136
|
+
network: "ethereum" | "base" | "arbitrum" | "optimism" | "polygon" | "avalanche";
|
|
137
|
+
token: "USDC" | "USDT" | "USDT0";
|
|
138
|
+
}>;
|
|
139
|
+
type PayGaslessInput = z.infer<typeof payGaslessInputSchema>;
|
|
140
|
+
/**
|
|
141
|
+
* Networks that support ERC-4337 gasless transactions
|
|
142
|
+
*/
|
|
143
|
+
declare const GASLESS_SUPPORTED_NETWORKS: SupportedNetwork[];
|
|
144
|
+
/**
|
|
145
|
+
* Options for executing gasless payment
|
|
146
|
+
*/
|
|
147
|
+
interface PayGaslessOptions {
|
|
148
|
+
/** Private key for signing (hex with 0x prefix) */
|
|
149
|
+
privateKey: string;
|
|
150
|
+
/** Bundler URL for ERC-4337 */
|
|
151
|
+
bundlerUrl: string;
|
|
152
|
+
/** Paymaster URL for sponsoring gas */
|
|
153
|
+
paymasterUrl: string;
|
|
154
|
+
/** Custom RPC URL */
|
|
155
|
+
rpcUrl?: string;
|
|
156
|
+
/** Demo mode - simulate without executing */
|
|
157
|
+
demoMode?: boolean;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Execute payGasless tool
|
|
161
|
+
*/
|
|
162
|
+
declare function executePayGasless(input: PayGaslessInput, options: PayGaslessOptions): Promise<GaslessPaymentResult>;
|
|
163
|
+
/**
|
|
164
|
+
* Format gasless payment result for display
|
|
165
|
+
*/
|
|
166
|
+
declare function formatGaslessPaymentResult(result: GaslessPaymentResult): string;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* t402/getBridgeFee - Get fee quote for bridging USDT0 between chains
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Input schema for getBridgeFee tool
|
|
174
|
+
*/
|
|
175
|
+
declare const getBridgeFeeInputSchema: z.ZodObject<{
|
|
176
|
+
fromChain: z.ZodEnum<["ethereum", "arbitrum", "ink", "berachain", "unichain"]>;
|
|
177
|
+
toChain: z.ZodEnum<["ethereum", "arbitrum", "ink", "berachain", "unichain"]>;
|
|
178
|
+
amount: z.ZodString;
|
|
179
|
+
recipient: z.ZodString;
|
|
180
|
+
}, "strip", z.ZodTypeAny, {
|
|
181
|
+
amount: string;
|
|
182
|
+
fromChain: "ethereum" | "arbitrum" | "ink" | "berachain" | "unichain";
|
|
183
|
+
toChain: "ethereum" | "arbitrum" | "ink" | "berachain" | "unichain";
|
|
184
|
+
recipient: string;
|
|
185
|
+
}, {
|
|
186
|
+
amount: string;
|
|
187
|
+
fromChain: "ethereum" | "arbitrum" | "ink" | "berachain" | "unichain";
|
|
188
|
+
toChain: "ethereum" | "arbitrum" | "ink" | "berachain" | "unichain";
|
|
189
|
+
recipient: string;
|
|
190
|
+
}>;
|
|
191
|
+
type GetBridgeFeeInput = z.infer<typeof getBridgeFeeInputSchema>;
|
|
192
|
+
/**
|
|
193
|
+
* Execute getBridgeFee tool
|
|
194
|
+
*/
|
|
195
|
+
declare function executeGetBridgeFee(input: GetBridgeFeeInput, rpcUrls?: Partial<Record<SupportedNetwork, string>>): Promise<BridgeFeeQuote>;
|
|
196
|
+
/**
|
|
197
|
+
* Format bridge fee result for display
|
|
198
|
+
*/
|
|
199
|
+
declare function formatBridgeFeeResult(result: BridgeFeeQuote): string;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* t402/bridge - Bridge USDT0 between chains using LayerZero OFT
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Input schema for bridge tool
|
|
207
|
+
*/
|
|
208
|
+
declare const bridgeInputSchema: z.ZodObject<{
|
|
209
|
+
fromChain: z.ZodEnum<["ethereum", "arbitrum", "ink", "berachain", "unichain"]>;
|
|
210
|
+
toChain: z.ZodEnum<["ethereum", "arbitrum", "ink", "berachain", "unichain"]>;
|
|
211
|
+
amount: z.ZodString;
|
|
212
|
+
recipient: z.ZodString;
|
|
213
|
+
}, "strip", z.ZodTypeAny, {
|
|
214
|
+
amount: string;
|
|
215
|
+
fromChain: "ethereum" | "arbitrum" | "ink" | "berachain" | "unichain";
|
|
216
|
+
toChain: "ethereum" | "arbitrum" | "ink" | "berachain" | "unichain";
|
|
217
|
+
recipient: string;
|
|
218
|
+
}, {
|
|
219
|
+
amount: string;
|
|
220
|
+
fromChain: "ethereum" | "arbitrum" | "ink" | "berachain" | "unichain";
|
|
221
|
+
toChain: "ethereum" | "arbitrum" | "ink" | "berachain" | "unichain";
|
|
222
|
+
recipient: string;
|
|
223
|
+
}>;
|
|
224
|
+
type BridgeInput = z.infer<typeof bridgeInputSchema>;
|
|
225
|
+
/**
|
|
226
|
+
* Options for executing bridge
|
|
227
|
+
*/
|
|
228
|
+
interface BridgeOptions {
|
|
229
|
+
/** Private key for signing (hex with 0x prefix) */
|
|
230
|
+
privateKey: string;
|
|
231
|
+
/** Custom RPC URL */
|
|
232
|
+
rpcUrl?: string;
|
|
233
|
+
/** Demo mode - simulate without executing */
|
|
234
|
+
demoMode?: boolean;
|
|
235
|
+
/** Slippage tolerance percentage (default: 0.5) */
|
|
236
|
+
slippageTolerance?: number;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Execute bridge tool
|
|
240
|
+
*/
|
|
241
|
+
declare function executeBridge(input: BridgeInput, options: BridgeOptions): Promise<BridgeResult>;
|
|
242
|
+
/**
|
|
243
|
+
* Format bridge result for display
|
|
244
|
+
*/
|
|
245
|
+
declare function formatBridgeResult(result: BridgeResult): string;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* t402 MCP Tools - Export all payment tools
|
|
249
|
+
*/
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Tool definitions for MCP server registration
|
|
253
|
+
*/
|
|
254
|
+
declare const TOOL_DEFINITIONS: {
|
|
255
|
+
"t402/getBalance": {
|
|
256
|
+
name: string;
|
|
257
|
+
description: string;
|
|
258
|
+
inputSchema: {
|
|
259
|
+
type: "object";
|
|
260
|
+
properties: {
|
|
261
|
+
network: {
|
|
262
|
+
type: string;
|
|
263
|
+
enum: string[];
|
|
264
|
+
description: string;
|
|
265
|
+
};
|
|
266
|
+
address: {
|
|
267
|
+
type: string;
|
|
268
|
+
pattern: string;
|
|
269
|
+
description: string;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
required: string[];
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
"t402/getAllBalances": {
|
|
276
|
+
name: string;
|
|
277
|
+
description: string;
|
|
278
|
+
inputSchema: {
|
|
279
|
+
type: "object";
|
|
280
|
+
properties: {
|
|
281
|
+
address: {
|
|
282
|
+
type: string;
|
|
283
|
+
pattern: string;
|
|
284
|
+
description: string;
|
|
285
|
+
};
|
|
286
|
+
networks: {
|
|
287
|
+
type: string;
|
|
288
|
+
items: {
|
|
289
|
+
type: string;
|
|
290
|
+
enum: string[];
|
|
291
|
+
};
|
|
292
|
+
description: string;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
required: string[];
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
"t402/pay": {
|
|
299
|
+
name: string;
|
|
300
|
+
description: string;
|
|
301
|
+
inputSchema: {
|
|
302
|
+
type: "object";
|
|
303
|
+
properties: {
|
|
304
|
+
to: {
|
|
305
|
+
type: string;
|
|
306
|
+
pattern: string;
|
|
307
|
+
description: string;
|
|
308
|
+
};
|
|
309
|
+
amount: {
|
|
310
|
+
type: string;
|
|
311
|
+
pattern: string;
|
|
312
|
+
description: string;
|
|
313
|
+
};
|
|
314
|
+
token: {
|
|
315
|
+
type: string;
|
|
316
|
+
enum: string[];
|
|
317
|
+
description: string;
|
|
318
|
+
};
|
|
319
|
+
network: {
|
|
320
|
+
type: string;
|
|
321
|
+
enum: string[];
|
|
322
|
+
description: string;
|
|
323
|
+
};
|
|
324
|
+
memo: {
|
|
325
|
+
type: string;
|
|
326
|
+
description: string;
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
required: string[];
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
"t402/payGasless": {
|
|
333
|
+
name: string;
|
|
334
|
+
description: string;
|
|
335
|
+
inputSchema: {
|
|
336
|
+
type: "object";
|
|
337
|
+
properties: {
|
|
338
|
+
to: {
|
|
339
|
+
type: string;
|
|
340
|
+
pattern: string;
|
|
341
|
+
description: string;
|
|
342
|
+
};
|
|
343
|
+
amount: {
|
|
344
|
+
type: string;
|
|
345
|
+
pattern: string;
|
|
346
|
+
description: string;
|
|
347
|
+
};
|
|
348
|
+
token: {
|
|
349
|
+
type: string;
|
|
350
|
+
enum: string[];
|
|
351
|
+
description: string;
|
|
352
|
+
};
|
|
353
|
+
network: {
|
|
354
|
+
type: string;
|
|
355
|
+
enum: string[];
|
|
356
|
+
description: string;
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
required: string[];
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
"t402/getBridgeFee": {
|
|
363
|
+
name: string;
|
|
364
|
+
description: string;
|
|
365
|
+
inputSchema: {
|
|
366
|
+
type: "object";
|
|
367
|
+
properties: {
|
|
368
|
+
fromChain: {
|
|
369
|
+
type: string;
|
|
370
|
+
enum: string[];
|
|
371
|
+
description: string;
|
|
372
|
+
};
|
|
373
|
+
toChain: {
|
|
374
|
+
type: string;
|
|
375
|
+
enum: string[];
|
|
376
|
+
description: string;
|
|
377
|
+
};
|
|
378
|
+
amount: {
|
|
379
|
+
type: string;
|
|
380
|
+
pattern: string;
|
|
381
|
+
description: string;
|
|
382
|
+
};
|
|
383
|
+
recipient: {
|
|
384
|
+
type: string;
|
|
385
|
+
pattern: string;
|
|
386
|
+
description: string;
|
|
387
|
+
};
|
|
388
|
+
};
|
|
389
|
+
required: string[];
|
|
390
|
+
};
|
|
391
|
+
};
|
|
392
|
+
"t402/bridge": {
|
|
393
|
+
name: string;
|
|
394
|
+
description: string;
|
|
395
|
+
inputSchema: {
|
|
396
|
+
type: "object";
|
|
397
|
+
properties: {
|
|
398
|
+
fromChain: {
|
|
399
|
+
type: string;
|
|
400
|
+
enum: string[];
|
|
401
|
+
description: string;
|
|
402
|
+
};
|
|
403
|
+
toChain: {
|
|
404
|
+
type: string;
|
|
405
|
+
enum: string[];
|
|
406
|
+
description: string;
|
|
407
|
+
};
|
|
408
|
+
amount: {
|
|
409
|
+
type: string;
|
|
410
|
+
pattern: string;
|
|
411
|
+
description: string;
|
|
412
|
+
};
|
|
413
|
+
recipient: {
|
|
414
|
+
type: string;
|
|
415
|
+
pattern: string;
|
|
416
|
+
description: string;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
required: string[];
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
export { type AllBalancesResult, type BridgeInput, type BridgeOptions, GASLESS_SUPPORTED_NETWORKS, type GetAllBalancesInput, type GetBalanceInput, type GetBridgeFeeInput, type PayGaslessInput, type PayGaslessOptions, type PayInput, type PayOptions, TOOL_DEFINITIONS, bridgeInputSchema, executeBridge, executeGetAllBalances, executeGetBalance, executeGetBridgeFee, executePay, executePayGasless, formatAllBalancesResult, formatBalanceResult, formatBridgeFeeResult, formatBridgeResult, formatGaslessPaymentResult, formatPaymentResult, getAllBalancesInputSchema, getBalanceInputSchema, getBridgeFeeInputSchema, payGaslessInputSchema, payInputSchema };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GASLESS_SUPPORTED_NETWORKS,
|
|
3
|
+
TOOL_DEFINITIONS,
|
|
4
|
+
bridgeInputSchema,
|
|
5
|
+
executeBridge,
|
|
6
|
+
executeGetAllBalances,
|
|
7
|
+
executeGetBalance,
|
|
8
|
+
executeGetBridgeFee,
|
|
9
|
+
executePay,
|
|
10
|
+
executePayGasless,
|
|
11
|
+
formatAllBalancesResult,
|
|
12
|
+
formatBalanceResult,
|
|
13
|
+
formatBridgeFeeResult,
|
|
14
|
+
formatBridgeResult,
|
|
15
|
+
formatGaslessPaymentResult,
|
|
16
|
+
formatPaymentResult,
|
|
17
|
+
getAllBalancesInputSchema,
|
|
18
|
+
getBalanceInputSchema,
|
|
19
|
+
getBridgeFeeInputSchema,
|
|
20
|
+
payGaslessInputSchema,
|
|
21
|
+
payInputSchema
|
|
22
|
+
} from "../chunk-SB4O25HA.mjs";
|
|
23
|
+
export {
|
|
24
|
+
GASLESS_SUPPORTED_NETWORKS,
|
|
25
|
+
TOOL_DEFINITIONS,
|
|
26
|
+
bridgeInputSchema,
|
|
27
|
+
executeBridge,
|
|
28
|
+
executeGetAllBalances,
|
|
29
|
+
executeGetBalance,
|
|
30
|
+
executeGetBridgeFee,
|
|
31
|
+
executePay,
|
|
32
|
+
executePayGasless,
|
|
33
|
+
formatAllBalancesResult,
|
|
34
|
+
formatBalanceResult,
|
|
35
|
+
formatBridgeFeeResult,
|
|
36
|
+
formatBridgeResult,
|
|
37
|
+
formatGaslessPaymentResult,
|
|
38
|
+
formatPaymentResult,
|
|
39
|
+
getAllBalancesInputSchema,
|
|
40
|
+
getBalanceInputSchema,
|
|
41
|
+
getBridgeFeeInputSchema,
|
|
42
|
+
payGaslessInputSchema,
|
|
43
|
+
payInputSchema
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Type definitions for t402 MCP Server
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Supported blockchain networks
|
|
9
|
+
*/
|
|
10
|
+
type SupportedNetwork = "ethereum" | "base" | "arbitrum" | "optimism" | "polygon" | "avalanche" | "ink" | "berachain" | "unichain";
|
|
11
|
+
/**
|
|
12
|
+
* Token balance information
|
|
13
|
+
*/
|
|
14
|
+
interface TokenBalance {
|
|
15
|
+
/** Token symbol (e.g., "USDC", "USDT") */
|
|
16
|
+
symbol: string;
|
|
17
|
+
/** Token contract address */
|
|
18
|
+
address: Address;
|
|
19
|
+
/** Balance in smallest unit (wei/satoshi equivalent) */
|
|
20
|
+
balance: string;
|
|
21
|
+
/** Human-readable balance with decimals */
|
|
22
|
+
formatted: string;
|
|
23
|
+
/** Token decimals */
|
|
24
|
+
decimals: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Chain balance information
|
|
28
|
+
*/
|
|
29
|
+
interface ChainBalance {
|
|
30
|
+
/** Network identifier */
|
|
31
|
+
network: SupportedNetwork;
|
|
32
|
+
/** Chain ID */
|
|
33
|
+
chainId: number;
|
|
34
|
+
/** Native token balance (ETH/MATIC/etc) */
|
|
35
|
+
native: {
|
|
36
|
+
symbol: string;
|
|
37
|
+
balance: string;
|
|
38
|
+
formatted: string;
|
|
39
|
+
};
|
|
40
|
+
/** Supported stablecoin balances */
|
|
41
|
+
tokens: TokenBalance[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Payment parameters
|
|
45
|
+
*/
|
|
46
|
+
interface PaymentParams {
|
|
47
|
+
/** Recipient address */
|
|
48
|
+
to: Address;
|
|
49
|
+
/** Amount to pay (in token units) */
|
|
50
|
+
amount: string;
|
|
51
|
+
/** Token to use for payment */
|
|
52
|
+
token: "USDC" | "USDT" | "USDT0";
|
|
53
|
+
/** Network to execute payment on */
|
|
54
|
+
network: SupportedNetwork;
|
|
55
|
+
/** Optional: memo/reference for payment */
|
|
56
|
+
memo?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Payment result
|
|
60
|
+
*/
|
|
61
|
+
interface PaymentResult {
|
|
62
|
+
/** Transaction hash */
|
|
63
|
+
txHash: string;
|
|
64
|
+
/** Network where payment was executed */
|
|
65
|
+
network: SupportedNetwork;
|
|
66
|
+
/** Amount paid (formatted) */
|
|
67
|
+
amount: string;
|
|
68
|
+
/** Token used */
|
|
69
|
+
token: string;
|
|
70
|
+
/** Recipient address */
|
|
71
|
+
to: Address;
|
|
72
|
+
/** Block explorer URL */
|
|
73
|
+
explorerUrl: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Gasless payment result (ERC-4337)
|
|
77
|
+
*/
|
|
78
|
+
interface GaslessPaymentResult extends PaymentResult {
|
|
79
|
+
/** User operation hash */
|
|
80
|
+
userOpHash: string;
|
|
81
|
+
/** Paymaster used */
|
|
82
|
+
paymaster?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Bridge fee quote
|
|
86
|
+
*/
|
|
87
|
+
interface BridgeFeeQuote {
|
|
88
|
+
/** Source chain */
|
|
89
|
+
fromChain: SupportedNetwork;
|
|
90
|
+
/** Destination chain */
|
|
91
|
+
toChain: SupportedNetwork;
|
|
92
|
+
/** Amount to bridge (formatted) */
|
|
93
|
+
amount: string;
|
|
94
|
+
/** Native fee required (in source chain native token) */
|
|
95
|
+
nativeFee: string;
|
|
96
|
+
/** Native fee formatted with symbol */
|
|
97
|
+
nativeFeeFormatted: string;
|
|
98
|
+
/** Estimated time in seconds */
|
|
99
|
+
estimatedTime: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Bridge result
|
|
103
|
+
*/
|
|
104
|
+
interface BridgeResult {
|
|
105
|
+
/** Source chain transaction hash */
|
|
106
|
+
txHash: string;
|
|
107
|
+
/** LayerZero message GUID for tracking */
|
|
108
|
+
messageGuid: string;
|
|
109
|
+
/** Amount bridged (formatted) */
|
|
110
|
+
amount: string;
|
|
111
|
+
/** Source chain */
|
|
112
|
+
fromChain: SupportedNetwork;
|
|
113
|
+
/** Destination chain */
|
|
114
|
+
toChain: SupportedNetwork;
|
|
115
|
+
/** Estimated delivery time in seconds */
|
|
116
|
+
estimatedTime: number;
|
|
117
|
+
/** LayerZero Scan URL for tracking */
|
|
118
|
+
trackingUrl: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* MCP Server configuration
|
|
122
|
+
*/
|
|
123
|
+
interface McpServerConfig {
|
|
124
|
+
/** Private key for signing transactions (hex string) */
|
|
125
|
+
privateKey?: string;
|
|
126
|
+
/** RPC URLs by network */
|
|
127
|
+
rpcUrls?: Partial<Record<SupportedNetwork, string>>;
|
|
128
|
+
/** Enable demo mode (simulates transactions without executing) */
|
|
129
|
+
demoMode?: boolean;
|
|
130
|
+
/** Paymaster URL for gasless transactions */
|
|
131
|
+
paymasterUrl?: string;
|
|
132
|
+
/** Bundler URL for ERC-4337 */
|
|
133
|
+
bundlerUrl?: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Tool execution context
|
|
137
|
+
*/
|
|
138
|
+
interface ToolContext {
|
|
139
|
+
/** Server configuration */
|
|
140
|
+
config: McpServerConfig;
|
|
141
|
+
/** Get wallet client for a network */
|
|
142
|
+
getWalletClient: (network: SupportedNetwork) => Promise<unknown>;
|
|
143
|
+
/** Get public client for a network */
|
|
144
|
+
getPublicClient: (network: SupportedNetwork) => Promise<unknown>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export type { BridgeFeeQuote as B, ChainBalance as C, GaslessPaymentResult as G, McpServerConfig as M, PaymentParams as P, SupportedNetwork as S, TokenBalance as T, PaymentResult as a, BridgeResult as b, ToolContext as c };
|