@t402/mcp 2.4.0 → 2.5.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.
@@ -1,5 +1,6 @@
1
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-CWK2p9_n.js';
2
+ import { S as SupportedNetwork, C as ChainBalance, b as PaymentResult, G as GaslessPaymentResult, B as BridgeFeeQuote, a as BridgeResult } from '../types-CwwW_c2B.js';
3
+ import { T402WDK } from '@t402/wdk';
3
4
  import 'viem';
4
5
 
5
6
  /**
@@ -244,12 +245,302 @@ declare function executeBridge(input: BridgeInput, options: BridgeOptions): Prom
244
245
  */
245
246
  declare function formatBridgeResult(result: BridgeResult): string;
246
247
 
248
+ /**
249
+ * wdk/getWallet - Get wallet info from WDK
250
+ */
251
+
252
+ /**
253
+ * Input schema for wdk/getWallet tool
254
+ */
255
+ declare const wdkGetWalletInputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
256
+ type WdkGetWalletInput = z.infer<typeof wdkGetWalletInputSchema>;
257
+ /**
258
+ * Wallet info result
259
+ */
260
+ interface WdkWalletInfo {
261
+ /** EVM address */
262
+ evmAddress: string;
263
+ /** Supported chains */
264
+ chains: string[];
265
+ }
266
+ /**
267
+ * Execute wdk/getWallet tool
268
+ *
269
+ * @param _input - Empty input (no params needed)
270
+ * @param wdk - T402WDK instance
271
+ * @returns Wallet info
272
+ */
273
+ declare function executeWdkGetWallet(_input: WdkGetWalletInput, wdk: T402WDK): Promise<WdkWalletInfo>;
274
+ /**
275
+ * Execute wdk/getWallet in demo mode
276
+ *
277
+ * @returns Demo wallet info
278
+ */
279
+ declare function executeWdkGetWalletDemo(): WdkWalletInfo;
280
+ /**
281
+ * Format wallet info for display
282
+ *
283
+ * @param info - Wallet info
284
+ * @returns Formatted string
285
+ */
286
+ declare function formatWdkWalletResult(info: WdkWalletInfo): string;
287
+
288
+ /**
289
+ * wdk/getBalances - Get multi-chain balances via WDK
290
+ */
291
+
292
+ /**
293
+ * Input schema for wdk/getBalances tool
294
+ */
295
+ declare const wdkGetBalancesInputSchema: z.ZodObject<{
296
+ chains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
297
+ }, "strip", z.ZodTypeAny, {
298
+ chains?: string[] | undefined;
299
+ }, {
300
+ chains?: string[] | undefined;
301
+ }>;
302
+ type WdkGetBalancesInput = z.infer<typeof wdkGetBalancesInputSchema>;
303
+ /**
304
+ * WDK balance result
305
+ */
306
+ interface WdkBalancesResult {
307
+ /** Per-chain balances */
308
+ chains: Array<{
309
+ chain: string;
310
+ usdt0: string;
311
+ usdc: string;
312
+ native: string;
313
+ }>;
314
+ /** Total USDT0 across all chains */
315
+ totalUsdt0: string;
316
+ /** Total USDC across all chains */
317
+ totalUsdc: string;
318
+ }
319
+ /**
320
+ * Execute wdk/getBalances tool
321
+ *
322
+ * @param input - Input with optional chains filter
323
+ * @param wdk - T402WDK instance
324
+ * @returns Multi-chain balances
325
+ */
326
+ declare function executeWdkGetBalances(input: WdkGetBalancesInput, wdk: T402WDK): Promise<WdkBalancesResult>;
327
+ /**
328
+ * Execute wdk/getBalances in demo mode
329
+ *
330
+ * @returns Demo balances
331
+ */
332
+ declare function executeWdkGetBalancesDemo(): WdkBalancesResult;
333
+ /**
334
+ * Format balances for display
335
+ *
336
+ * @param result - Balances result
337
+ * @returns Formatted string
338
+ */
339
+ declare function formatWdkBalancesResult(result: WdkBalancesResult): string;
340
+
341
+ /**
342
+ * wdk/transfer - Send tokens via WDK
343
+ */
344
+
345
+ /**
346
+ * Input schema for wdk/transfer tool
347
+ */
348
+ declare const wdkTransferInputSchema: z.ZodObject<{
349
+ to: z.ZodString;
350
+ amount: z.ZodString;
351
+ token: z.ZodEnum<["USDC", "USDT", "USDT0"]>;
352
+ chain: z.ZodString;
353
+ }, "strip", z.ZodTypeAny, {
354
+ to: string;
355
+ amount: string;
356
+ chain: string;
357
+ token: "USDC" | "USDT" | "USDT0";
358
+ }, {
359
+ to: string;
360
+ amount: string;
361
+ chain: string;
362
+ token: "USDC" | "USDT" | "USDT0";
363
+ }>;
364
+ type WdkTransferInput = z.infer<typeof wdkTransferInputSchema>;
365
+ /**
366
+ * Transfer result
367
+ */
368
+ interface WdkTransferResult {
369
+ /** Transaction hash */
370
+ txHash: string;
371
+ /** Amount transferred */
372
+ amount: string;
373
+ /** Token transferred */
374
+ token: string;
375
+ /** Chain used */
376
+ chain: string;
377
+ /** Recipient */
378
+ to: string;
379
+ /** Explorer URL */
380
+ explorerUrl: string;
381
+ }
382
+ /**
383
+ * Execute wdk/transfer tool
384
+ *
385
+ * @param input - Transfer parameters
386
+ * @param wdk - T402WDK instance
387
+ * @returns Transfer result
388
+ */
389
+ declare function executeWdkTransfer(input: WdkTransferInput, wdk: T402WDK): Promise<WdkTransferResult>;
390
+ /**
391
+ * Execute wdk/transfer in demo mode
392
+ *
393
+ * @param input - Transfer parameters
394
+ * @returns Demo transfer result
395
+ */
396
+ declare function executeWdkTransferDemo(input: WdkTransferInput): WdkTransferResult;
397
+ /**
398
+ * Format transfer result for display
399
+ *
400
+ * @param result - Transfer result
401
+ * @returns Formatted string
402
+ */
403
+ declare function formatWdkTransferResult(result: WdkTransferResult): string;
404
+
405
+ /**
406
+ * wdk/swap - Swap tokens via WDK
407
+ */
408
+
409
+ /**
410
+ * Input schema for wdk/swap tool
411
+ */
412
+ declare const wdkSwapInputSchema: z.ZodObject<{
413
+ fromToken: z.ZodString;
414
+ toToken: z.ZodString;
415
+ amount: z.ZodString;
416
+ chain: z.ZodString;
417
+ }, "strip", z.ZodTypeAny, {
418
+ amount: string;
419
+ chain: string;
420
+ fromToken: string;
421
+ toToken: string;
422
+ }, {
423
+ amount: string;
424
+ chain: string;
425
+ fromToken: string;
426
+ toToken: string;
427
+ }>;
428
+ type WdkSwapInput = z.infer<typeof wdkSwapInputSchema>;
429
+ /**
430
+ * Swap result
431
+ */
432
+ interface WdkSwapResult {
433
+ /** Input amount */
434
+ fromAmount: string;
435
+ /** Input token */
436
+ fromToken: string;
437
+ /** Output amount (estimated or actual) */
438
+ toAmount: string;
439
+ /** Output token */
440
+ toToken: string;
441
+ /** Chain */
442
+ chain: string;
443
+ /** Transaction hash (if executed) */
444
+ txHash?: string;
445
+ }
446
+ /**
447
+ * Execute wdk/swap tool
448
+ *
449
+ * @param input - Swap parameters
450
+ * @param wdk - T402WDK instance
451
+ * @returns Swap result
452
+ */
453
+ declare function executeWdkSwap(input: WdkSwapInput, wdk: T402WDK): Promise<WdkSwapResult>;
454
+ /**
455
+ * Execute wdk/swap in demo mode
456
+ *
457
+ * @param input - Swap parameters
458
+ * @returns Demo swap result
459
+ */
460
+ declare function executeWdkSwapDemo(input: WdkSwapInput): WdkSwapResult;
461
+ /**
462
+ * Format swap result for display
463
+ *
464
+ * @param result - Swap result
465
+ * @returns Formatted string
466
+ */
467
+ declare function formatWdkSwapResult(result: WdkSwapResult): string;
468
+
469
+ /**
470
+ * t402/autoPay - Smart payment orchestrator
471
+ *
472
+ * Fetches a URL, detects 402 payment requirements, checks WDK balances,
473
+ * signs payment, and returns the paid content.
474
+ */
475
+
476
+ /**
477
+ * Input schema for t402/autoPay tool
478
+ */
479
+ declare const autoPayInputSchema: z.ZodObject<{
480
+ url: z.ZodString;
481
+ maxAmount: z.ZodOptional<z.ZodString>;
482
+ preferredChain: z.ZodOptional<z.ZodString>;
483
+ }, "strip", z.ZodTypeAny, {
484
+ url: string;
485
+ maxAmount?: string | undefined;
486
+ preferredChain?: string | undefined;
487
+ }, {
488
+ url: string;
489
+ maxAmount?: string | undefined;
490
+ preferredChain?: string | undefined;
491
+ }>;
492
+ type AutoPayInput = z.infer<typeof autoPayInputSchema>;
493
+ /**
494
+ * AutoPay result
495
+ */
496
+ interface AutoPayResult {
497
+ /** Whether the resource was successfully accessed */
498
+ success: boolean;
499
+ /** HTTP status code */
500
+ statusCode: number;
501
+ /** Response body (truncated if large) */
502
+ body: string;
503
+ /** Content type of the response */
504
+ contentType?: string;
505
+ /** Payment details (if payment was made) */
506
+ payment?: {
507
+ network: string;
508
+ scheme: string;
509
+ amount: string;
510
+ payTo: string;
511
+ };
512
+ /** Error message (if failed) */
513
+ error?: string;
514
+ }
515
+ /**
516
+ * Execute t402/autoPay tool
517
+ *
518
+ * @param input - AutoPay parameters
519
+ * @param wdk - T402WDK instance
520
+ * @returns AutoPay result
521
+ */
522
+ declare function executeAutoPay(input: AutoPayInput, wdk: T402WDK): Promise<AutoPayResult>;
523
+ /**
524
+ * Execute t402/autoPay in demo mode
525
+ *
526
+ * @param input - AutoPay parameters
527
+ * @returns Demo autopay result
528
+ */
529
+ declare function executeAutoPayDemo(input: AutoPayInput): AutoPayResult;
530
+ /**
531
+ * Format autopay result for display
532
+ *
533
+ * @param result - AutoPay result
534
+ * @returns Formatted string
535
+ */
536
+ declare function formatAutoPayResult(result: AutoPayResult): string;
537
+
247
538
  /**
248
539
  * t402 MCP Tools - Export all payment tools
249
540
  */
250
541
 
251
542
  /**
252
- * Tool definitions for MCP server registration
543
+ * Base tool definitions (always available)
253
544
  */
254
545
  declare const TOOL_DEFINITIONS: {
255
546
  't402/getBalance': {
@@ -420,5 +711,114 @@ declare const TOOL_DEFINITIONS: {
420
711
  };
421
712
  };
422
713
  };
714
+ /**
715
+ * WDK tool definitions (only available when WDK seed phrase is configured)
716
+ */
717
+ declare const WDK_TOOL_DEFINITIONS: {
718
+ 'wdk/getWallet': {
719
+ name: string;
720
+ description: string;
721
+ inputSchema: {
722
+ type: "object";
723
+ properties: {};
724
+ required: string[];
725
+ };
726
+ };
727
+ 'wdk/getBalances': {
728
+ name: string;
729
+ description: string;
730
+ inputSchema: {
731
+ type: "object";
732
+ properties: {
733
+ chains: {
734
+ type: string;
735
+ items: {
736
+ type: string;
737
+ };
738
+ description: string;
739
+ };
740
+ };
741
+ required: string[];
742
+ };
743
+ };
744
+ 'wdk/transfer': {
745
+ name: string;
746
+ description: string;
747
+ inputSchema: {
748
+ type: "object";
749
+ properties: {
750
+ to: {
751
+ type: string;
752
+ description: string;
753
+ };
754
+ amount: {
755
+ type: string;
756
+ pattern: string;
757
+ description: string;
758
+ };
759
+ token: {
760
+ type: string;
761
+ enum: string[];
762
+ description: string;
763
+ };
764
+ chain: {
765
+ type: string;
766
+ description: string;
767
+ };
768
+ };
769
+ required: string[];
770
+ };
771
+ };
772
+ 'wdk/swap': {
773
+ name: string;
774
+ description: string;
775
+ inputSchema: {
776
+ type: "object";
777
+ properties: {
778
+ fromToken: {
779
+ type: string;
780
+ description: string;
781
+ };
782
+ toToken: {
783
+ type: string;
784
+ description: string;
785
+ };
786
+ amount: {
787
+ type: string;
788
+ pattern: string;
789
+ description: string;
790
+ };
791
+ chain: {
792
+ type: string;
793
+ description: string;
794
+ };
795
+ };
796
+ required: string[];
797
+ };
798
+ };
799
+ 't402/autoPay': {
800
+ name: string;
801
+ description: string;
802
+ inputSchema: {
803
+ type: "object";
804
+ properties: {
805
+ url: {
806
+ type: string;
807
+ description: string;
808
+ };
809
+ maxAmount: {
810
+ type: string;
811
+ pattern: string;
812
+ description: string;
813
+ };
814
+ preferredChain: {
815
+ type: string;
816
+ description: string;
817
+ };
818
+ };
819
+ required: string[];
820
+ };
821
+ };
822
+ };
423
823
 
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 };
824
+ export { type AllBalancesResult, type AutoPayInput, type AutoPayResult, type BridgeInput, type BridgeOptions, GASLESS_SUPPORTED_NETWORKS, type GetAllBalancesInput, type GetBalanceInput, type GetBridgeFeeInput, type PayGaslessInput, type PayGaslessOptions, type PayInput, type PayOptions, TOOL_DEFINITIONS, WDK_TOOL_DEFINITIONS, type WdkBalancesResult, type WdkGetBalancesInput, type WdkGetWalletInput, type WdkSwapInput, type WdkSwapResult, type WdkTransferInput, type WdkTransferResult, type WdkWalletInfo, autoPayInputSchema, bridgeInputSchema, executeAutoPay, executeAutoPayDemo, executeBridge, executeGetAllBalances, executeGetBalance, executeGetBridgeFee, executePay, executePayGasless, executeWdkGetBalances, executeWdkGetBalancesDemo, executeWdkGetWallet, executeWdkGetWalletDemo, executeWdkSwap, executeWdkSwapDemo, executeWdkTransfer, executeWdkTransferDemo, formatAllBalancesResult, formatAutoPayResult, formatBalanceResult, formatBridgeFeeResult, formatBridgeResult, formatGaslessPaymentResult, formatPaymentResult, formatWdkBalancesResult, formatWdkSwapResult, formatWdkTransferResult, formatWdkWalletResult, getAllBalancesInputSchema, getBalanceInputSchema, getBridgeFeeInputSchema, payGaslessInputSchema, payInputSchema, wdkGetBalancesInputSchema, wdkGetWalletInputSchema, wdkSwapInputSchema, wdkTransferInputSchema };