x402-svm-mantle 2.1.1-mantle

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 (59) hide show
  1. package/README.md +200 -0
  2. package/dist/cjs/exact/client/index.d.ts +37 -0
  3. package/dist/cjs/exact/client/index.js +281 -0
  4. package/dist/cjs/exact/client/index.js.map +1 -0
  5. package/dist/cjs/exact/facilitator/index.d.ts +110 -0
  6. package/dist/cjs/exact/facilitator/index.js +714 -0
  7. package/dist/cjs/exact/facilitator/index.js.map +1 -0
  8. package/dist/cjs/exact/server/index.d.ts +87 -0
  9. package/dist/cjs/exact/server/index.js +209 -0
  10. package/dist/cjs/exact/server/index.js.map +1 -0
  11. package/dist/cjs/exact/v1/client/index.d.ts +33 -0
  12. package/dist/cjs/exact/v1/client/index.js +169 -0
  13. package/dist/cjs/exact/v1/client/index.js.map +1 -0
  14. package/dist/cjs/exact/v1/facilitator/index.d.ts +71 -0
  15. package/dist/cjs/exact/v1/facilitator/index.js +384 -0
  16. package/dist/cjs/exact/v1/facilitator/index.js.map +1 -0
  17. package/dist/cjs/index.d.ts +118 -0
  18. package/dist/cjs/index.js +433 -0
  19. package/dist/cjs/index.js.map +1 -0
  20. package/dist/cjs/scheme-CkL_b_xl.d.ts +29 -0
  21. package/dist/cjs/scheme-MoBRXFM8.d.ts +29 -0
  22. package/dist/cjs/signer-BMkbhFYE.d.ts +123 -0
  23. package/dist/cjs/v1/index.d.ts +12 -0
  24. package/dist/cjs/v1/index.js +180 -0
  25. package/dist/cjs/v1/index.js.map +1 -0
  26. package/dist/esm/chunk-M7NDDMX7.mjs +111 -0
  27. package/dist/esm/chunk-M7NDDMX7.mjs.map +1 -0
  28. package/dist/esm/chunk-PHFXLBH6.mjs +157 -0
  29. package/dist/esm/chunk-PHFXLBH6.mjs.map +1 -0
  30. package/dist/esm/chunk-TA6OPUHK.mjs +108 -0
  31. package/dist/esm/chunk-TA6OPUHK.mjs.map +1 -0
  32. package/dist/esm/chunk-WRDCPYFH.mjs +339 -0
  33. package/dist/esm/chunk-WRDCPYFH.mjs.map +1 -0
  34. package/dist/esm/chunk-WWACQNRQ.mjs +7 -0
  35. package/dist/esm/chunk-WWACQNRQ.mjs.map +1 -0
  36. package/dist/esm/exact/client/index.d.mts +37 -0
  37. package/dist/esm/exact/client/index.mjs +36 -0
  38. package/dist/esm/exact/client/index.mjs.map +1 -0
  39. package/dist/esm/exact/facilitator/index.d.mts +110 -0
  40. package/dist/esm/exact/facilitator/index.mjs +350 -0
  41. package/dist/esm/exact/facilitator/index.mjs.map +1 -0
  42. package/dist/esm/exact/server/index.d.mts +87 -0
  43. package/dist/esm/exact/server/index.mjs +129 -0
  44. package/dist/esm/exact/server/index.mjs.map +1 -0
  45. package/dist/esm/exact/v1/client/index.d.mts +33 -0
  46. package/dist/esm/exact/v1/client/index.mjs +8 -0
  47. package/dist/esm/exact/v1/client/index.mjs.map +1 -0
  48. package/dist/esm/exact/v1/facilitator/index.d.mts +71 -0
  49. package/dist/esm/exact/v1/facilitator/index.mjs +8 -0
  50. package/dist/esm/exact/v1/facilitator/index.mjs.map +1 -0
  51. package/dist/esm/index.d.mts +118 -0
  52. package/dist/esm/index.mjs +198 -0
  53. package/dist/esm/index.mjs.map +1 -0
  54. package/dist/esm/scheme-VFikrqtD.d.mts +29 -0
  55. package/dist/esm/signer-BMkbhFYE.d.mts +123 -0
  56. package/dist/esm/v1/index.d.mts +12 -0
  57. package/dist/esm/v1/index.mjs +13 -0
  58. package/dist/esm/v1/index.mjs.map +1 -0
  59. package/package.json +130 -0
@@ -0,0 +1,110 @@
1
+ import { SchemeNetworkFacilitator, PaymentPayload, PaymentRequirements, VerifyResponse, SettleResponse, Network } from 'x402-core-mantle/types';
2
+ import { F as FacilitatorSvmSigner } from '../../signer-BMkbhFYE.js';
3
+ import { x402Facilitator } from 'x402-core-mantle/facilitator';
4
+ import '@solana/kit';
5
+
6
+ /**
7
+ * SVM facilitator implementation for the Exact payment scheme.
8
+ */
9
+ declare class ExactSvmScheme implements SchemeNetworkFacilitator {
10
+ private readonly signer;
11
+ readonly scheme = "exact";
12
+ readonly caipFamily = "solana:*";
13
+ /**
14
+ * Creates a new ExactSvmFacilitator instance.
15
+ *
16
+ * @param signer - The SVM RPC client for facilitator operations
17
+ * @returns ExactSvmFacilitator instance
18
+ */
19
+ constructor(signer: FacilitatorSvmSigner);
20
+ /**
21
+ * Get mechanism-specific extra data for the supported kinds endpoint.
22
+ * For SVM, this includes a randomly selected fee payer address.
23
+ * Random selection distributes load across multiple signers.
24
+ *
25
+ * @param _ - The network identifier (unused for SVM)
26
+ * @returns Extra data with feePayer address
27
+ */
28
+ getExtra(_: string): Record<string, unknown> | undefined;
29
+ /**
30
+ * Get signer addresses used by this facilitator.
31
+ * For SVM, returns all available fee payer addresses.
32
+ *
33
+ * @param _ - The network identifier (unused for SVM)
34
+ * @returns Array of fee payer addresses
35
+ */
36
+ getSigners(_: string): string[];
37
+ /**
38
+ * Verifies a payment payload.
39
+ *
40
+ * @param payload - The payment payload to verify
41
+ * @param requirements - The payment requirements
42
+ * @returns Promise resolving to verification response
43
+ */
44
+ verify(payload: PaymentPayload, requirements: PaymentRequirements): Promise<VerifyResponse>;
45
+ /**
46
+ * Settles a payment by submitting the transaction.
47
+ * Ensures the correct signer is used based on the feePayer specified in requirements.
48
+ *
49
+ * @param payload - The payment payload to settle
50
+ * @param requirements - The payment requirements
51
+ * @returns Promise resolving to settlement response
52
+ */
53
+ settle(payload: PaymentPayload, requirements: PaymentRequirements): Promise<SettleResponse>;
54
+ /**
55
+ * Verify that the compute limit instruction is valid.
56
+ *
57
+ * @param instruction - The compute limit instruction
58
+ * @param instruction.programAddress - Program address
59
+ * @param instruction.data - Instruction data bytes
60
+ */
61
+ private verifyComputeLimitInstruction;
62
+ /**
63
+ * Verify that the compute price instruction is valid.
64
+ *
65
+ * @param instruction - The compute price instruction
66
+ * @param instruction.programAddress - Program address
67
+ * @param instruction.data - Instruction data bytes
68
+ */
69
+ private verifyComputePriceInstruction;
70
+ }
71
+
72
+ /**
73
+ * Configuration options for registering SVM schemes to an x402Facilitator
74
+ */
75
+ interface SvmFacilitatorConfig {
76
+ /**
77
+ * The SVM signer for facilitator operations
78
+ */
79
+ signer: FacilitatorSvmSigner;
80
+ /**
81
+ * Networks to register (single network or array of networks)
82
+ * Examples: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", ["solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"]
83
+ */
84
+ networks: Network | Network[];
85
+ }
86
+ /**
87
+ * Registers SVM payment schemes to an existing x402Facilitator instance.
88
+ *
89
+ * @param facilitator - The x402Facilitator instance to register schemes to
90
+ * @param config - Configuration for SVM facilitator registration
91
+ * @returns The facilitator instance for chaining
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * // Single network
96
+ * registerExactSvmScheme(facilitator, {
97
+ * signer: svmSigner,
98
+ * networks: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1" // Devnet
99
+ * });
100
+ *
101
+ * // Multiple networks (will auto-derive solana:* pattern)
102
+ * registerExactSvmScheme(facilitator, {
103
+ * signer: svmSigner,
104
+ * networks: ["solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"]
105
+ * });
106
+ * ```
107
+ */
108
+ declare function registerExactSvmScheme(facilitator: x402Facilitator, config: SvmFacilitatorConfig): x402Facilitator;
109
+
110
+ export { ExactSvmScheme, type SvmFacilitatorConfig, registerExactSvmScheme };