@t402/svm 2.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.
Files changed (58) 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 +720 -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 +207 -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 +388 -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 +429 -0
  19. package/dist/cjs/index.js.map +1 -0
  20. package/dist/cjs/scheme-ByJE6QYY.d.ts +29 -0
  21. package/dist/cjs/signer-BMkbhFYE.d.ts +123 -0
  22. package/dist/cjs/v1/index.d.ts +12 -0
  23. package/dist/cjs/v1/index.js +180 -0
  24. package/dist/cjs/v1/index.js.map +1 -0
  25. package/dist/esm/chunk-4BFJL7IW.mjs +341 -0
  26. package/dist/esm/chunk-4BFJL7IW.mjs.map +1 -0
  27. package/dist/esm/chunk-7S5RSPMY.mjs +108 -0
  28. package/dist/esm/chunk-7S5RSPMY.mjs.map +1 -0
  29. package/dist/esm/chunk-FPXYRDTG.mjs +111 -0
  30. package/dist/esm/chunk-FPXYRDTG.mjs.map +1 -0
  31. package/dist/esm/chunk-JFN5MEH3.mjs +157 -0
  32. package/dist/esm/chunk-JFN5MEH3.mjs.map +1 -0
  33. package/dist/esm/chunk-WWACQNRQ.mjs +7 -0
  34. package/dist/esm/chunk-WWACQNRQ.mjs.map +1 -0
  35. package/dist/esm/exact/client/index.d.mts +37 -0
  36. package/dist/esm/exact/client/index.mjs +36 -0
  37. package/dist/esm/exact/client/index.mjs.map +1 -0
  38. package/dist/esm/exact/facilitator/index.d.mts +110 -0
  39. package/dist/esm/exact/facilitator/index.mjs +352 -0
  40. package/dist/esm/exact/facilitator/index.mjs.map +1 -0
  41. package/dist/esm/exact/server/index.d.mts +87 -0
  42. package/dist/esm/exact/server/index.mjs +129 -0
  43. package/dist/esm/exact/server/index.mjs.map +1 -0
  44. package/dist/esm/exact/v1/client/index.d.mts +33 -0
  45. package/dist/esm/exact/v1/client/index.mjs +8 -0
  46. package/dist/esm/exact/v1/client/index.mjs.map +1 -0
  47. package/dist/esm/exact/v1/facilitator/index.d.mts +71 -0
  48. package/dist/esm/exact/v1/facilitator/index.mjs +8 -0
  49. package/dist/esm/exact/v1/facilitator/index.mjs.map +1 -0
  50. package/dist/esm/index.d.mts +118 -0
  51. package/dist/esm/index.mjs +194 -0
  52. package/dist/esm/index.mjs.map +1 -0
  53. package/dist/esm/scheme-DRerE5zq.d.mts +29 -0
  54. package/dist/esm/signer-BMkbhFYE.d.mts +123 -0
  55. package/dist/esm/v1/index.d.mts +12 -0
  56. package/dist/esm/v1/index.mjs +13 -0
  57. package/dist/esm/v1/index.mjs.map +1 -0
  58. package/package.json +132 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,71 @@
1
+ import { SchemeNetworkFacilitator, PaymentPayload, PaymentRequirements, VerifyResponse, SettleResponse } from '@t402/core/types';
2
+ import { F as FacilitatorSvmSigner } from '../../../signer-BMkbhFYE.mjs';
3
+ import '@solana/kit';
4
+
5
+ /**
6
+ * SVM facilitator implementation for the Exact payment scheme (V1).
7
+ */
8
+ declare class ExactSvmSchemeV1 implements SchemeNetworkFacilitator {
9
+ private readonly signer;
10
+ readonly scheme = "exact";
11
+ readonly caipFamily = "solana:*";
12
+ /**
13
+ * Creates a new ExactSvmFacilitatorV1 instance.
14
+ *
15
+ * @param signer - The SVM RPC client for facilitator operations
16
+ * @returns ExactSvmFacilitatorV1 instance
17
+ */
18
+ constructor(signer: FacilitatorSvmSigner);
19
+ /**
20
+ * Get mechanism-specific extra data for the supported kinds endpoint.
21
+ * For SVM, this includes a randomly selected fee payer address.
22
+ * Random selection distributes load across multiple signers.
23
+ *
24
+ * @param _ - The network identifier (unused for SVM)
25
+ * @returns Extra data with feePayer address
26
+ */
27
+ getExtra(_: string): Record<string, unknown> | undefined;
28
+ /**
29
+ * Get signer addresses used by this facilitator.
30
+ * For SVM, returns all available fee payer addresses.
31
+ *
32
+ * @param _ - The network identifier (unused for SVM)
33
+ * @returns Array of fee payer addresses
34
+ */
35
+ getSigners(_: string): string[];
36
+ /**
37
+ * Verifies a payment payload (V1).
38
+ *
39
+ * @param payload - The payment payload to verify
40
+ * @param requirements - The payment requirements
41
+ * @returns Promise resolving to verification response
42
+ */
43
+ verify(payload: PaymentPayload, requirements: PaymentRequirements): Promise<VerifyResponse>;
44
+ /**
45
+ * Settles a payment by submitting the transaction (V1).
46
+ * Ensures the correct signer is used based on the feePayer specified in requirements.
47
+ *
48
+ * @param payload - The payment payload to settle
49
+ * @param requirements - The payment requirements
50
+ * @returns Promise resolving to settlement response
51
+ */
52
+ settle(payload: PaymentPayload, requirements: PaymentRequirements): Promise<SettleResponse>;
53
+ /**
54
+ * Verify compute limit instruction
55
+ *
56
+ * @param instruction - The compute limit instruction
57
+ * @param instruction.programAddress - Program address
58
+ * @param instruction.data - Instruction data bytes
59
+ */
60
+ private verifyComputeLimitInstruction;
61
+ /**
62
+ * Verify compute price instruction
63
+ *
64
+ * @param instruction - The compute price instruction
65
+ * @param instruction.programAddress - Program address
66
+ * @param instruction.data - Instruction data bytes
67
+ */
68
+ private verifyComputePriceInstruction;
69
+ }
70
+
71
+ export { ExactSvmSchemeV1 };
@@ -0,0 +1,8 @@
1
+ import {
2
+ ExactSvmSchemeV1
3
+ } from "../../../chunk-4BFJL7IW.mjs";
4
+ import "../../../chunk-JFN5MEH3.mjs";
5
+ export {
6
+ ExactSvmSchemeV1
7
+ };
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,118 @@
1
+ export { E as ExactSvmScheme } from './scheme-DRerE5zq.mjs';
2
+ export { a as ClientSvmConfig, C as ClientSvmSigner, c as FacilitatorRpcClient, d as FacilitatorRpcConfig, F as FacilitatorSvmSigner, t as toClientSvmSigner, b as toFacilitatorSvmSigner } from './signer-BMkbhFYE.mjs';
3
+ import { Transaction, RpcDevnet, SolanaRpcApiDevnet, RpcTestnet, SolanaRpcApiTestnet, RpcMainnet, SolanaRpcApiMainnet } from '@solana/kit';
4
+ import { Network } from '@t402/core/types';
5
+
6
+ /**
7
+ * Exact SVM payload structure containing a base64 encoded Solana transaction
8
+ */
9
+ type ExactSvmPayloadV1 = {
10
+ /**
11
+ * Base64 encoded Solana transaction
12
+ */
13
+ transaction: string;
14
+ };
15
+ /**
16
+ * Exact SVM payload V2 structure (currently same as V1, reserved for future extensions)
17
+ */
18
+ type ExactSvmPayloadV2 = ExactSvmPayloadV1;
19
+
20
+ /**
21
+ * Token program addresses for SPL Token and Token-2022
22
+ * These addresses are the same across all Solana networks (mainnet, devnet, testnet)
23
+ */
24
+ declare const TOKEN_PROGRAM_ADDRESS = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
25
+ declare const TOKEN_2022_PROGRAM_ADDRESS = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
26
+ declare const COMPUTE_BUDGET_PROGRAM_ADDRESS = "ComputeBudget111111111111111111111111111111";
27
+ /**
28
+ * Default RPC URLs for Solana networks
29
+ */
30
+ declare const DEVNET_RPC_URL = "https://api.devnet.solana.com";
31
+ declare const TESTNET_RPC_URL = "https://api.testnet.solana.com";
32
+ declare const MAINNET_RPC_URL = "https://api.mainnet-beta.solana.com";
33
+ declare const DEVNET_WS_URL = "wss://api.devnet.solana.com";
34
+ declare const TESTNET_WS_URL = "wss://api.testnet.solana.com";
35
+ declare const MAINNET_WS_URL = "wss://api.mainnet-beta.solana.com";
36
+ /**
37
+ * USDC token mint addresses (default stablecoin)
38
+ */
39
+ declare const USDC_MAINNET_ADDRESS = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
40
+ declare const USDC_DEVNET_ADDRESS = "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
41
+ declare const USDC_TESTNET_ADDRESS = "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
42
+ /**
43
+ * Compute budget configuration
44
+ * All prices are in microlamports (1 lamport = 1,000,000 microlamports)
45
+ */
46
+ declare const DEFAULT_COMPUTE_UNIT_PRICE_MICROLAMPORTS = 1;
47
+ declare const MAX_COMPUTE_UNIT_PRICE_MICROLAMPORTS = 5000000;
48
+ declare const DEFAULT_COMPUTE_UNIT_LIMIT = 6500;
49
+ /**
50
+ * Solana address validation regex (base58, 32-44 characters)
51
+ */
52
+ declare const SVM_ADDRESS_REGEX: RegExp;
53
+ /**
54
+ * CAIP-2 network identifiers for Solana (V2)
55
+ */
56
+ declare const SOLANA_MAINNET_CAIP2 = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
57
+ declare const SOLANA_DEVNET_CAIP2 = "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
58
+ declare const SOLANA_TESTNET_CAIP2 = "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";
59
+ /**
60
+ * V1 to V2 network identifier mappings (for backwards compatibility)
61
+ * V1 used simple names like solana, V2 uses CAIP-2
62
+ */
63
+ declare const V1_TO_V2_NETWORK_MAP: Record<string, string>;
64
+
65
+ /**
66
+ * Normalize network identifier to CAIP-2 format
67
+ * Handles both V1 names (solana, solana-devnet) and V2 CAIP-2 format
68
+ *
69
+ * @param network - Network identifier (V1 or V2 format)
70
+ * @returns CAIP-2 network identifier
71
+ */
72
+ declare function normalizeNetwork(network: Network): string;
73
+ /**
74
+ * Validate Solana address format
75
+ *
76
+ * @param address - Base58 encoded address string
77
+ * @returns true if address is valid, false otherwise
78
+ */
79
+ declare function validateSvmAddress(address: string): boolean;
80
+ /**
81
+ * Decode a base64 encoded transaction from an SVM payload
82
+ *
83
+ * @param svmPayload - The SVM payload containing a base64 encoded transaction
84
+ * @returns Decoded Transaction object
85
+ */
86
+ declare function decodeTransactionFromPayload(svmPayload: ExactSvmPayloadV1): Transaction;
87
+ /**
88
+ * Extract the token sender (owner of the source token account) from a TransferChecked instruction
89
+ *
90
+ * @param transaction - The decoded transaction
91
+ * @returns The token payer address as a base58 string
92
+ */
93
+ declare function getTokenPayerFromTransaction(transaction: Transaction): string;
94
+ /**
95
+ * Create an RPC client for the specified network
96
+ *
97
+ * @param network - Network identifier (CAIP-2 or V1 format)
98
+ * @param customRpcUrl - Optional custom RPC URL
99
+ * @returns RPC client for the specified network
100
+ */
101
+ declare function createRpcClient(network: Network, customRpcUrl?: string): RpcDevnet<SolanaRpcApiDevnet> | RpcTestnet<SolanaRpcApiTestnet> | RpcMainnet<SolanaRpcApiMainnet>;
102
+ /**
103
+ * Get the default USDC mint address for a network
104
+ *
105
+ * @param network - Network identifier (CAIP-2 or V1 format)
106
+ * @returns USDC mint address for the network
107
+ */
108
+ declare function getUsdcAddress(network: Network): string;
109
+ /**
110
+ * Convert a decimal amount to token smallest units
111
+ *
112
+ * @param decimalAmount - The decimal amount (e.g., "0.10")
113
+ * @param decimals - The number of decimals for the token (e.g., 6 for USDC)
114
+ * @returns The amount in smallest units as a string
115
+ */
116
+ declare function convertToTokenAmount(decimalAmount: string, decimals: number): string;
117
+
118
+ export { COMPUTE_BUDGET_PROGRAM_ADDRESS, DEFAULT_COMPUTE_UNIT_LIMIT, DEFAULT_COMPUTE_UNIT_PRICE_MICROLAMPORTS, DEVNET_RPC_URL, DEVNET_WS_URL, type ExactSvmPayloadV1, type ExactSvmPayloadV2, MAINNET_RPC_URL, MAINNET_WS_URL, MAX_COMPUTE_UNIT_PRICE_MICROLAMPORTS, SOLANA_DEVNET_CAIP2, SOLANA_MAINNET_CAIP2, SOLANA_TESTNET_CAIP2, SVM_ADDRESS_REGEX, TESTNET_RPC_URL, TESTNET_WS_URL, TOKEN_2022_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS, USDC_DEVNET_ADDRESS, USDC_MAINNET_ADDRESS, USDC_TESTNET_ADDRESS, V1_TO_V2_NETWORK_MAP, convertToTokenAmount, createRpcClient, decodeTransactionFromPayload, getTokenPayerFromTransaction, getUsdcAddress, normalizeNetwork, validateSvmAddress };
@@ -0,0 +1,194 @@
1
+ import {
2
+ ExactSvmScheme
3
+ } from "./chunk-7S5RSPMY.mjs";
4
+ import {
5
+ COMPUTE_BUDGET_PROGRAM_ADDRESS,
6
+ DEFAULT_COMPUTE_UNIT_LIMIT,
7
+ DEFAULT_COMPUTE_UNIT_PRICE_MICROLAMPORTS,
8
+ DEVNET_RPC_URL,
9
+ DEVNET_WS_URL,
10
+ MAINNET_RPC_URL,
11
+ MAINNET_WS_URL,
12
+ MAX_COMPUTE_UNIT_PRICE_MICROLAMPORTS,
13
+ SOLANA_DEVNET_CAIP2,
14
+ SOLANA_MAINNET_CAIP2,
15
+ SOLANA_TESTNET_CAIP2,
16
+ SVM_ADDRESS_REGEX,
17
+ TESTNET_RPC_URL,
18
+ TESTNET_WS_URL,
19
+ TOKEN_2022_PROGRAM_ADDRESS,
20
+ TOKEN_PROGRAM_ADDRESS,
21
+ USDC_DEVNET_ADDRESS,
22
+ USDC_MAINNET_ADDRESS,
23
+ USDC_TESTNET_ADDRESS,
24
+ V1_TO_V2_NETWORK_MAP,
25
+ convertToTokenAmount,
26
+ createRpcClient,
27
+ decodeTransactionFromPayload,
28
+ getTokenPayerFromTransaction,
29
+ getUsdcAddress,
30
+ normalizeNetwork,
31
+ validateSvmAddress
32
+ } from "./chunk-JFN5MEH3.mjs";
33
+
34
+ // src/signer.ts
35
+ import { getBase64EncodedWireTransaction } from "@solana/kit";
36
+ function toClientSvmSigner(signer) {
37
+ return signer;
38
+ }
39
+ function createRpcCapabilitiesFromRpc(rpc) {
40
+ return {
41
+ getBalance: async (address) => {
42
+ const result = await rpc.getBalance(address).send();
43
+ return result.value;
44
+ },
45
+ getTokenAccountBalance: async (address) => {
46
+ const accountInfo = await rpc.getAccountInfo(address, {
47
+ encoding: "jsonParsed"
48
+ }).send();
49
+ if (!accountInfo.value) {
50
+ throw new Error(`Token account not found: ${address}`);
51
+ }
52
+ const parsed = accountInfo.value.data;
53
+ return BigInt(parsed.parsed.info.tokenAmount.amount);
54
+ },
55
+ getLatestBlockhash: async () => {
56
+ const result = await rpc.getLatestBlockhash().send();
57
+ return {
58
+ blockhash: result.value.blockhash,
59
+ lastValidBlockHeight: result.value.lastValidBlockHeight
60
+ };
61
+ },
62
+ simulateTransaction: async (transaction, config) => {
63
+ return await rpc.simulateTransaction(transaction, config).send();
64
+ },
65
+ sendTransaction: async (transaction) => {
66
+ return await rpc.sendTransaction(transaction, {
67
+ encoding: "base64"
68
+ }).send();
69
+ },
70
+ confirmTransaction: async (signature) => {
71
+ let confirmed = false;
72
+ let attempts = 0;
73
+ const maxAttempts = 30;
74
+ while (!confirmed && attempts < maxAttempts) {
75
+ const status = await rpc.getSignatureStatuses([signature]).send();
76
+ if (status.value[0]?.confirmationStatus === "confirmed" || status.value[0]?.confirmationStatus === "finalized") {
77
+ confirmed = true;
78
+ return status.value[0];
79
+ }
80
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
81
+ attempts++;
82
+ }
83
+ throw new Error("Transaction confirmation timeout");
84
+ },
85
+ fetchMint: async (address) => {
86
+ const { fetchMint } = await import("@solana-program/token-2022");
87
+ return await fetchMint(rpc, address);
88
+ }
89
+ };
90
+ }
91
+ function toFacilitatorSvmSigner(signer, rpcConfig) {
92
+ let rpcMap = {};
93
+ let defaultRpcUrl;
94
+ if (rpcConfig) {
95
+ if ("defaultRpcUrl" in rpcConfig && typeof rpcConfig.defaultRpcUrl === "string") {
96
+ defaultRpcUrl = rpcConfig.defaultRpcUrl;
97
+ } else if ("getBalance" in rpcConfig || "getSlot" in rpcConfig) {
98
+ rpcMap["*"] = rpcConfig;
99
+ } else {
100
+ rpcMap = rpcConfig;
101
+ }
102
+ }
103
+ const getRpcForNetwork = (network) => {
104
+ if (rpcMap[network]) {
105
+ return rpcMap[network];
106
+ }
107
+ if (rpcMap["*"]) {
108
+ return rpcMap["*"];
109
+ }
110
+ return createRpcClient(network, defaultRpcUrl);
111
+ };
112
+ return {
113
+ getAddresses: () => {
114
+ return [signer.address];
115
+ },
116
+ signTransaction: async (transaction, feePayer, _) => {
117
+ if (feePayer !== signer.address) {
118
+ throw new Error(`No signer for feePayer ${feePayer}. Available: ${signer.address}`);
119
+ }
120
+ const tx = decodeTransactionFromPayload({ transaction });
121
+ const signableMessage = {
122
+ content: tx.messageBytes,
123
+ signatures: tx.signatures
124
+ };
125
+ const [facilitatorSignatureDictionary] = await signer.signMessages([
126
+ signableMessage
127
+ ]);
128
+ const fullySignedTx = {
129
+ ...tx,
130
+ signatures: {
131
+ ...tx.signatures,
132
+ ...facilitatorSignatureDictionary
133
+ }
134
+ };
135
+ return getBase64EncodedWireTransaction(fullySignedTx);
136
+ },
137
+ simulateTransaction: async (transaction, network) => {
138
+ const rpc = getRpcForNetwork(network);
139
+ const result = await rpc.simulateTransaction(transaction, {
140
+ sigVerify: true,
141
+ replaceRecentBlockhash: false,
142
+ commitment: "confirmed",
143
+ encoding: "base64"
144
+ }).send();
145
+ if (result.value.err) {
146
+ throw new Error(`Simulation failed: ${JSON.stringify(result.value.err)}`);
147
+ }
148
+ },
149
+ sendTransaction: async (transaction, network) => {
150
+ const rpc = getRpcForNetwork(network);
151
+ return await rpc.sendTransaction(transaction, {
152
+ encoding: "base64"
153
+ }).send();
154
+ },
155
+ confirmTransaction: async (signature, network) => {
156
+ const rpc = getRpcForNetwork(network);
157
+ const rpcCapabilities = createRpcCapabilitiesFromRpc(rpc);
158
+ await rpcCapabilities.confirmTransaction(signature);
159
+ }
160
+ };
161
+ }
162
+ export {
163
+ COMPUTE_BUDGET_PROGRAM_ADDRESS,
164
+ DEFAULT_COMPUTE_UNIT_LIMIT,
165
+ DEFAULT_COMPUTE_UNIT_PRICE_MICROLAMPORTS,
166
+ DEVNET_RPC_URL,
167
+ DEVNET_WS_URL,
168
+ ExactSvmScheme,
169
+ MAINNET_RPC_URL,
170
+ MAINNET_WS_URL,
171
+ MAX_COMPUTE_UNIT_PRICE_MICROLAMPORTS,
172
+ SOLANA_DEVNET_CAIP2,
173
+ SOLANA_MAINNET_CAIP2,
174
+ SOLANA_TESTNET_CAIP2,
175
+ SVM_ADDRESS_REGEX,
176
+ TESTNET_RPC_URL,
177
+ TESTNET_WS_URL,
178
+ TOKEN_2022_PROGRAM_ADDRESS,
179
+ TOKEN_PROGRAM_ADDRESS,
180
+ USDC_DEVNET_ADDRESS,
181
+ USDC_MAINNET_ADDRESS,
182
+ USDC_TESTNET_ADDRESS,
183
+ V1_TO_V2_NETWORK_MAP,
184
+ convertToTokenAmount,
185
+ createRpcClient,
186
+ decodeTransactionFromPayload,
187
+ getTokenPayerFromTransaction,
188
+ getUsdcAddress,
189
+ normalizeNetwork,
190
+ toClientSvmSigner,
191
+ toFacilitatorSvmSigner,
192
+ validateSvmAddress
193
+ };
194
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/signer.ts"],"sourcesContent":["import type {\n TransactionSigner,\n MessagePartialSigner,\n RpcDevnet,\n SolanaRpcApiDevnet,\n RpcTestnet,\n SolanaRpcApiTestnet,\n RpcMainnet,\n SolanaRpcApiMainnet,\n Address,\n} from \"@solana/kit\";\nimport { getBase64EncodedWireTransaction } from \"@solana/kit\";\nimport { createRpcClient, decodeTransactionFromPayload } from \"./utils\";\n\n/**\n * Client-side signer for creating and signing Solana transactions\n * This is a wrapper around TransactionSigner from @solana/kit\n */\nexport type ClientSvmSigner = TransactionSigner;\n\n/**\n * Configuration for client operations\n */\nexport type ClientSvmConfig = {\n /**\n * Optional custom RPC URL for the client to use\n */\n rpcUrl?: string;\n};\n\n/**\n * Signing capabilities needed by the facilitator\n * Must support both transaction and message signing\n * KeyPairSigner from @solana/kit satisfies this interface\n */\nexport type FacilitatorSigningCapabilities = TransactionSigner & MessagePartialSigner;\n\n/**\n * RPC client type from @solana/kit\n * Can be devnet, testnet, or mainnet RPC client\n */\nexport type FacilitatorRpcClient =\n | RpcDevnet<SolanaRpcApiDevnet>\n | RpcTestnet<SolanaRpcApiTestnet>\n | RpcMainnet<SolanaRpcApiMainnet>;\n\n/**\n * RPC capabilities needed by the facilitator for verification and settlement\n * This is a legacy interface for custom RPC implementations\n */\nexport type FacilitatorRpcCapabilities = {\n /**\n * Get the SOL balance of an account\n *\n * @param address - Base58 encoded address\n * @returns Balance in lamports\n */\n getBalance(address: string): Promise<bigint>;\n\n /**\n * Get the token account balance\n *\n * @param address - Base58 encoded token account address\n * @returns Token balance in smallest units\n */\n getTokenAccountBalance(address: string): Promise<bigint>;\n\n /**\n * Get the latest blockhash information\n *\n * @returns Blockhash and last valid block height\n */\n getLatestBlockhash(): Promise<{ blockhash: string; lastValidBlockHeight: bigint }>;\n\n /**\n * Simulate a transaction to check if it would succeed\n *\n * @param transaction - Base64 encoded transaction\n * @param config - Simulation configuration\n * @returns Simulation result\n */\n simulateTransaction(transaction: string, config: unknown): Promise<unknown>;\n\n /**\n * Send a transaction to the network\n *\n * @param transaction - Base64 encoded signed transaction\n * @returns Transaction signature\n */\n sendTransaction(transaction: string): Promise<string>;\n\n /**\n * Wait for transaction confirmation\n *\n * @param signature - Transaction signature\n * @returns Confirmation result\n */\n confirmTransaction(signature: string): Promise<unknown>;\n\n /**\n * Fetch token mint information\n *\n * @param address - Base58 encoded mint address\n * @returns Mint information including decimals\n */\n fetchMint(address: string): Promise<unknown>;\n};\n\n/**\n * Minimal facilitator signer interface for SVM operations.\n * Supports multiple signers for load balancing and high availability.\n * All implementation details (RPC clients, key management, signature handling) are hidden.\n */\nexport type FacilitatorSvmSigner = {\n /**\n * Get all addresses this facilitator can use as fee payers\n * Enables dynamic address selection for load balancing and key rotation\n *\n * @returns Array of addresses available for signing\n */\n getAddresses(): readonly Address[];\n\n /**\n * Sign a partially-signed transaction with the signer matching feePayer\n * Transaction is decoded, signed, and re-encoded internally\n *\n * @param transaction - Base64 encoded partially-signed transaction\n * @param feePayer - Fee payer address (determines which signer to use)\n * @param network - CAIP-2 network identifier\n * @returns Base64 encoded fully-signed transaction\n * @throws Error if no signer exists for feePayer or signing fails\n */\n signTransaction(transaction: string, feePayer: Address, network: string): Promise<string>;\n\n /**\n * Simulate a signed transaction to verify it would succeed\n * Implementation manages RPC client selection and simulation details\n *\n * @param transaction - Base64 encoded signed transaction\n * @param network - CAIP-2 network identifier\n * @throws Error if simulation fails\n */\n simulateTransaction(transaction: string, network: string): Promise<void>;\n\n /**\n * Send a signed transaction to the network\n * Implementation manages RPC client selection and sending details\n *\n * @param transaction - Base64 encoded signed transaction\n * @param network - CAIP-2 network identifier\n * @returns Transaction signature\n * @throws Error if send fails\n */\n sendTransaction(transaction: string, network: string): Promise<string>;\n\n /**\n * Wait for transaction confirmation\n * Allows signer to implement custom retry logic, timeouts, and confirmation strategies\n *\n * @param signature - Transaction signature to confirm\n * @param network - CAIP-2 network identifier\n * @returns Promise that resolves when transaction is confirmed\n * @throws Error if confirmation fails or times out\n */\n confirmTransaction(signature: string, network: string): Promise<void>;\n};\n\n/**\n * Convert a signer to ClientSvmSigner (identity function for type safety)\n *\n * @param signer - The signer to convert\n * @returns The signer as ClientSvmSigner\n */\nexport function toClientSvmSigner(signer: ClientSvmSigner): ClientSvmSigner {\n return signer;\n}\n\n/**\n * Create RPC capabilities from a Solana Kit RPC client\n *\n * @param rpc - The RPC client from @solana/kit\n * @returns RPC capabilities for the facilitator\n */\nexport function createRpcCapabilitiesFromRpc(\n rpc: FacilitatorRpcClient,\n): FacilitatorRpcCapabilities {\n return {\n getBalance: async address => {\n const result = await rpc.getBalance(address as never).send();\n return result.value;\n },\n getTokenAccountBalance: async address => {\n const accountInfo = await rpc\n .getAccountInfo(address as never, {\n encoding: \"jsonParsed\",\n })\n .send();\n\n if (!accountInfo.value) {\n throw new Error(`Token account not found: ${address}`);\n }\n\n const parsed = accountInfo.value.data as {\n parsed: { info: { tokenAmount: { amount: string } } };\n };\n return BigInt(parsed.parsed.info.tokenAmount.amount);\n },\n getLatestBlockhash: async () => {\n const result = await rpc.getLatestBlockhash().send();\n return {\n blockhash: result.value.blockhash,\n lastValidBlockHeight: result.value.lastValidBlockHeight,\n };\n },\n simulateTransaction: async (transaction, config) => {\n return await rpc.simulateTransaction(transaction as never, config as never).send();\n },\n sendTransaction: async transaction => {\n return await rpc\n .sendTransaction(transaction as never, {\n encoding: \"base64\",\n })\n .send();\n },\n confirmTransaction: async signature => {\n let confirmed = false;\n let attempts = 0;\n const maxAttempts = 30;\n\n while (!confirmed && attempts < maxAttempts) {\n const status = await rpc.getSignatureStatuses([signature as never]).send();\n\n if (\n status.value[0]?.confirmationStatus === \"confirmed\" ||\n status.value[0]?.confirmationStatus === \"finalized\"\n ) {\n confirmed = true;\n return status.value[0];\n }\n\n await new Promise(resolve => setTimeout(resolve, 1000));\n attempts++;\n }\n\n throw new Error(\"Transaction confirmation timeout\");\n },\n fetchMint: async address => {\n const { fetchMint } = await import(\"@solana-program/token-2022\");\n return await fetchMint(rpc, address as never);\n },\n };\n}\n\n/**\n * RPC configuration for the facilitator\n * Can be a single RPC (all networks), a network mapping, or config options\n */\nexport type FacilitatorRpcConfig =\n | FacilitatorRpcClient // Single RPC for all networks\n | Record<string, FacilitatorRpcClient> // Per-network RPC mapping\n | { defaultRpcUrl?: string }; // Custom default RPC URL\n\n/**\n * Create a FacilitatorSvmSigner from a TransactionSigner and optional RPC config\n *\n * @param signer - The TransactionSigner (e.g., from createKeyPairSignerFromBytes)\n * @param rpcConfig - Optional RPC configuration (single RPC, per-network map, or config)\n * @returns A complete FacilitatorSvmSigner\n *\n * @example\n * ```ts\n * import { createKeyPairSignerFromBytes, createSolanaRpc, devnet } from \"@solana/kit\";\n *\n * // Option 1: No RPC - use defaults (SIMPLEST)\n * const keypair = await createKeyPairSignerFromBytes(privateKeyBytes);\n * const facilitator = toFacilitatorSvmSigner(keypair);\n *\n * // Option 2: Single RPC for all networks\n * const rpc = createSolanaRpc(devnet(\"https://api.devnet.solana.com\"));\n * const facilitator = toFacilitatorSvmSigner(keypair, rpc);\n *\n * // Option 3: Per-network RPC (FLEXIBLE)\n * const facilitator = toFacilitatorSvmSigner(keypair, {\n * [SOLANA_MAINNET_CAIP2]: myQuickNodeRpc,\n * // Devnet/testnet use defaults\n * });\n *\n * // Option 4: Custom default RPC URL\n * const facilitator = toFacilitatorSvmSigner(keypair, {\n * defaultRpcUrl: \"https://my-rpc.com\"\n * });\n * ```\n */\nexport function toFacilitatorSvmSigner(\n signer: TransactionSigner & MessagePartialSigner,\n rpcConfig?: FacilitatorRpcConfig,\n): FacilitatorSvmSigner {\n let rpcMap: Record<string, FacilitatorRpcClient> = {};\n let defaultRpcUrl: string | undefined;\n\n if (rpcConfig) {\n // Check if it's a config object with defaultRpcUrl\n if (\"defaultRpcUrl\" in rpcConfig && typeof rpcConfig.defaultRpcUrl === \"string\") {\n defaultRpcUrl = rpcConfig.defaultRpcUrl;\n }\n // Check if it's a single RPC client\n else if (\"getBalance\" in rpcConfig || \"getSlot\" in rpcConfig) {\n rpcMap[\"*\"] = rpcConfig as FacilitatorRpcClient;\n }\n // Otherwise, it's a network mapping\n else {\n rpcMap = rpcConfig as Record<string, FacilitatorRpcClient>;\n }\n }\n\n const getRpcForNetwork = (network: string): FacilitatorRpcClient => {\n // 1. Check for exact network match\n if (rpcMap[network]) {\n return rpcMap[network];\n }\n\n // 2. Check for wildcard RPC\n if (rpcMap[\"*\"]) {\n return rpcMap[\"*\"];\n }\n\n // 3. Create default RPC for this network\n return createRpcClient(network as `${string}:${string}`, defaultRpcUrl);\n };\n\n return {\n getAddresses: () => {\n return [signer.address];\n },\n\n signTransaction: async (transaction: string, feePayer: Address, _: string) => {\n if (feePayer !== signer.address) {\n throw new Error(`No signer for feePayer ${feePayer}. Available: ${signer.address}`);\n }\n\n // Decode transaction from base64\n const tx = decodeTransactionFromPayload({ transaction });\n\n // Sign the transaction\n const signableMessage = {\n content: tx.messageBytes,\n signatures: tx.signatures,\n };\n\n const [facilitatorSignatureDictionary] = await signer.signMessages([\n signableMessage as never,\n ]);\n\n // Merge signatures and encode\n const fullySignedTx = {\n ...tx,\n signatures: {\n ...tx.signatures,\n ...facilitatorSignatureDictionary,\n },\n };\n\n return getBase64EncodedWireTransaction(fullySignedTx);\n },\n\n simulateTransaction: async (transaction: string, network: string) => {\n const rpc = getRpcForNetwork(network);\n const result = await rpc\n .simulateTransaction(transaction as never, {\n sigVerify: true,\n replaceRecentBlockhash: false,\n commitment: \"confirmed\",\n encoding: \"base64\",\n })\n .send();\n\n if (result.value.err) {\n throw new Error(`Simulation failed: ${JSON.stringify(result.value.err)}`);\n }\n },\n\n sendTransaction: async (transaction: string, network: string) => {\n const rpc = getRpcForNetwork(network);\n return await rpc\n .sendTransaction(transaction as never, {\n encoding: \"base64\",\n })\n .send();\n },\n\n confirmTransaction: async (signature: string, network: string) => {\n const rpc = getRpcForNetwork(network);\n const rpcCapabilities = createRpcCapabilitiesFromRpc(rpc);\n await rpcCapabilities.confirmTransaction(signature);\n },\n };\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,29 @@
1
+ import { SchemeNetworkClient, PaymentRequirements, PaymentPayload } from '@t402/core/types';
2
+ import { C as ClientSvmSigner, a as ClientSvmConfig } from './signer-BMkbhFYE.mjs';
3
+
4
+ /**
5
+ * SVM client implementation for the Exact payment scheme.
6
+ */
7
+ declare class ExactSvmScheme implements SchemeNetworkClient {
8
+ private readonly signer;
9
+ private readonly config?;
10
+ readonly scheme = "exact";
11
+ /**
12
+ * Creates a new ExactSvmClient instance.
13
+ *
14
+ * @param signer - The SVM signer for client operations
15
+ * @param config - Optional configuration with custom RPC URL
16
+ * @returns ExactSvmClient instance
17
+ */
18
+ constructor(signer: ClientSvmSigner, config?: ClientSvmConfig | undefined);
19
+ /**
20
+ * Creates a payment payload for the Exact scheme.
21
+ *
22
+ * @param t402Version - The t402 protocol version
23
+ * @param paymentRequirements - The payment requirements
24
+ * @returns Promise resolving to a payment payload
25
+ */
26
+ createPaymentPayload(t402Version: number, paymentRequirements: PaymentRequirements): Promise<Pick<PaymentPayload, "t402Version" | "payload">>;
27
+ }
28
+
29
+ export { ExactSvmScheme as E };
@@ -0,0 +1,123 @@
1
+ import { TransactionSigner, MessagePartialSigner, RpcDevnet, SolanaRpcApiDevnet, RpcTestnet, SolanaRpcApiTestnet, RpcMainnet, SolanaRpcApiMainnet, Address } from '@solana/kit';
2
+
3
+ /**
4
+ * Client-side signer for creating and signing Solana transactions
5
+ * This is a wrapper around TransactionSigner from @solana/kit
6
+ */
7
+ type ClientSvmSigner = TransactionSigner;
8
+ /**
9
+ * Configuration for client operations
10
+ */
11
+ type ClientSvmConfig = {
12
+ /**
13
+ * Optional custom RPC URL for the client to use
14
+ */
15
+ rpcUrl?: string;
16
+ };
17
+ /**
18
+ * RPC client type from @solana/kit
19
+ * Can be devnet, testnet, or mainnet RPC client
20
+ */
21
+ type FacilitatorRpcClient = RpcDevnet<SolanaRpcApiDevnet> | RpcTestnet<SolanaRpcApiTestnet> | RpcMainnet<SolanaRpcApiMainnet>;
22
+ /**
23
+ * Minimal facilitator signer interface for SVM operations.
24
+ * Supports multiple signers for load balancing and high availability.
25
+ * All implementation details (RPC clients, key management, signature handling) are hidden.
26
+ */
27
+ type FacilitatorSvmSigner = {
28
+ /**
29
+ * Get all addresses this facilitator can use as fee payers
30
+ * Enables dynamic address selection for load balancing and key rotation
31
+ *
32
+ * @returns Array of addresses available for signing
33
+ */
34
+ getAddresses(): readonly Address[];
35
+ /**
36
+ * Sign a partially-signed transaction with the signer matching feePayer
37
+ * Transaction is decoded, signed, and re-encoded internally
38
+ *
39
+ * @param transaction - Base64 encoded partially-signed transaction
40
+ * @param feePayer - Fee payer address (determines which signer to use)
41
+ * @param network - CAIP-2 network identifier
42
+ * @returns Base64 encoded fully-signed transaction
43
+ * @throws Error if no signer exists for feePayer or signing fails
44
+ */
45
+ signTransaction(transaction: string, feePayer: Address, network: string): Promise<string>;
46
+ /**
47
+ * Simulate a signed transaction to verify it would succeed
48
+ * Implementation manages RPC client selection and simulation details
49
+ *
50
+ * @param transaction - Base64 encoded signed transaction
51
+ * @param network - CAIP-2 network identifier
52
+ * @throws Error if simulation fails
53
+ */
54
+ simulateTransaction(transaction: string, network: string): Promise<void>;
55
+ /**
56
+ * Send a signed transaction to the network
57
+ * Implementation manages RPC client selection and sending details
58
+ *
59
+ * @param transaction - Base64 encoded signed transaction
60
+ * @param network - CAIP-2 network identifier
61
+ * @returns Transaction signature
62
+ * @throws Error if send fails
63
+ */
64
+ sendTransaction(transaction: string, network: string): Promise<string>;
65
+ /**
66
+ * Wait for transaction confirmation
67
+ * Allows signer to implement custom retry logic, timeouts, and confirmation strategies
68
+ *
69
+ * @param signature - Transaction signature to confirm
70
+ * @param network - CAIP-2 network identifier
71
+ * @returns Promise that resolves when transaction is confirmed
72
+ * @throws Error if confirmation fails or times out
73
+ */
74
+ confirmTransaction(signature: string, network: string): Promise<void>;
75
+ };
76
+ /**
77
+ * Convert a signer to ClientSvmSigner (identity function for type safety)
78
+ *
79
+ * @param signer - The signer to convert
80
+ * @returns The signer as ClientSvmSigner
81
+ */
82
+ declare function toClientSvmSigner(signer: ClientSvmSigner): ClientSvmSigner;
83
+ /**
84
+ * RPC configuration for the facilitator
85
+ * Can be a single RPC (all networks), a network mapping, or config options
86
+ */
87
+ type FacilitatorRpcConfig = FacilitatorRpcClient | Record<string, FacilitatorRpcClient> | {
88
+ defaultRpcUrl?: string;
89
+ };
90
+ /**
91
+ * Create a FacilitatorSvmSigner from a TransactionSigner and optional RPC config
92
+ *
93
+ * @param signer - The TransactionSigner (e.g., from createKeyPairSignerFromBytes)
94
+ * @param rpcConfig - Optional RPC configuration (single RPC, per-network map, or config)
95
+ * @returns A complete FacilitatorSvmSigner
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * import { createKeyPairSignerFromBytes, createSolanaRpc, devnet } from "@solana/kit";
100
+ *
101
+ * // Option 1: No RPC - use defaults (SIMPLEST)
102
+ * const keypair = await createKeyPairSignerFromBytes(privateKeyBytes);
103
+ * const facilitator = toFacilitatorSvmSigner(keypair);
104
+ *
105
+ * // Option 2: Single RPC for all networks
106
+ * const rpc = createSolanaRpc(devnet("https://api.devnet.solana.com"));
107
+ * const facilitator = toFacilitatorSvmSigner(keypair, rpc);
108
+ *
109
+ * // Option 3: Per-network RPC (FLEXIBLE)
110
+ * const facilitator = toFacilitatorSvmSigner(keypair, {
111
+ * [SOLANA_MAINNET_CAIP2]: myQuickNodeRpc,
112
+ * // Devnet/testnet use defaults
113
+ * });
114
+ *
115
+ * // Option 4: Custom default RPC URL
116
+ * const facilitator = toFacilitatorSvmSigner(keypair, {
117
+ * defaultRpcUrl: "https://my-rpc.com"
118
+ * });
119
+ * ```
120
+ */
121
+ declare function toFacilitatorSvmSigner(signer: TransactionSigner & MessagePartialSigner, rpcConfig?: FacilitatorRpcConfig): FacilitatorSvmSigner;
122
+
123
+ export { type ClientSvmSigner as C, type FacilitatorSvmSigner as F, type ClientSvmConfig as a, toFacilitatorSvmSigner as b, type FacilitatorRpcClient as c, type FacilitatorRpcConfig as d, toClientSvmSigner as t };
@@ -0,0 +1,12 @@
1
+ export { ExactSvmSchemeV1 } from '../exact/v1/client/index.mjs';
2
+ import '@t402/core/types';
3
+ import '../signer-BMkbhFYE.mjs';
4
+ import '@solana/kit';
5
+
6
+ /**
7
+ * V1 exports for the SVM mechanism
8
+ */
9
+
10
+ declare const NETWORKS: string[];
11
+
12
+ export { NETWORKS };
@@ -0,0 +1,13 @@
1
+ import {
2
+ NETWORKS
3
+ } from "../chunk-WWACQNRQ.mjs";
4
+ import {
5
+ ExactSvmSchemeV1
6
+ } from "../chunk-FPXYRDTG.mjs";
7
+ import "../chunk-4BFJL7IW.mjs";
8
+ import "../chunk-JFN5MEH3.mjs";
9
+ export {
10
+ ExactSvmSchemeV1,
11
+ NETWORKS
12
+ };
13
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}