@veil-cash/sdk 0.6.5 → 0.7.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/dist/index.cjs CHANGED
@@ -10,6 +10,9 @@ var chains = require('viem/chains');
10
10
  var MerkleTree = require('fixed-merkle-tree-legacy');
11
11
  var snarkjs = require('snarkjs');
12
12
  var ffjavascript = require('ffjavascript');
13
+ var client = require('@x402/core/client');
14
+ var client$1 = require('@x402/evm/exact/client');
15
+ var evm = require('@x402/evm');
13
16
 
14
17
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
15
18
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -55,7 +58,9 @@ var poseidonHash2 = (a, b) => poseidonHash([a, b]);
55
58
  var randomBN = (nbytes = 31) => {
56
59
  const cryptoApi = globalThis.crypto;
57
60
  if (!cryptoApi?.getRandomValues) {
58
- throw new Error("Secure random number generation is unavailable in this runtime");
61
+ throw new Error(
62
+ "Secure random number generation is unavailable. Provide globalThis.crypto.getRandomValues in this runtime."
63
+ );
59
64
  }
60
65
  const bytes = cryptoApi.getRandomValues(new Uint8Array(nbytes));
61
66
  let hex = "0x";
@@ -627,14 +632,6 @@ var QUEUE_ABI = [
627
632
  outputs: [{ name: "count", type: "uint256" }],
628
633
  stateMutability: "view",
629
634
  type: "function"
630
- },
631
- // Get remaining daily free deposits for an address (V3+)
632
- {
633
- inputs: [{ name: "_depositor", type: "address" }],
634
- name: "getDailyFreeRemaining",
635
- outputs: [{ name: "remaining", type: "uint256" }],
636
- stateMutability: "view",
637
- type: "function"
638
635
  }
639
636
  ];
640
637
  var POOL_ABI = [
@@ -1352,25 +1349,6 @@ async function getQueueBalance(options) {
1352
1349
  pendingCount: pendingDeposits.length
1353
1350
  };
1354
1351
  }
1355
- async function getDailyFreeRemaining(options) {
1356
- const { address, pool = "eth", rpcUrl } = options;
1357
- const queueAddress = getQueueAddress(pool);
1358
- const publicClient = viem.createPublicClient({
1359
- chain: chains.base,
1360
- transport: viem.http(rpcUrl)
1361
- });
1362
- try {
1363
- const remaining = await publicClient.readContract({
1364
- address: queueAddress,
1365
- abi: QUEUE_ABI,
1366
- functionName: "getDailyFreeRemaining",
1367
- args: [address]
1368
- });
1369
- return Number(remaining);
1370
- } catch {
1371
- return 0;
1372
- }
1373
- }
1374
1352
  async function getPrivateBalance(options) {
1375
1353
  const { keypair, pool = "eth", rpcUrl, onProgress } = options;
1376
1354
  const poolAddress = getPoolAddress(pool);
@@ -1950,12 +1928,13 @@ async function buildWithdrawProof(options) {
1950
1928
  };
1951
1929
  }
1952
1930
  async function withdraw(options) {
1953
- const { amount, recipient, pool = "eth", onProgress } = options;
1931
+ const { amount, recipient, pool = "eth", onProgress, relayUrl } = options;
1954
1932
  const proof = await buildWithdrawProof(options);
1955
1933
  onProgress?.("Submitting to relay...");
1956
1934
  const relayResult = await submitRelay({
1957
1935
  type: "withdraw",
1958
1936
  pool,
1937
+ relayUrl,
1959
1938
  proofArgs: proof.proofArgs,
1960
1939
  extData: proof.extData,
1961
1940
  metadata: {
@@ -1973,6 +1952,333 @@ async function withdraw(options) {
1973
1952
  recipient
1974
1953
  };
1975
1954
  }
1955
+ var X402_PAYER_DOMAIN = "veil-x402-payer";
1956
+ var BASE_NETWORK = `eip155:${ADDRESSES.chainId}`;
1957
+ var USDC_DECIMALS = POOL_CONFIG.usdc.decimals;
1958
+ var X402_MIN_WITHDRAW_ATOMIC = 1000n;
1959
+ function assertPrivateKey(value, label) {
1960
+ if (!/^0x[a-fA-F0-9]{64}$/.test(value)) {
1961
+ throw new Error(`${label} must be a 0x-prefixed 32-byte hex string`);
1962
+ }
1963
+ }
1964
+ function normalizePayerIndex(index) {
1965
+ const normalized = typeof index === "bigint" ? index : typeof index === "number" ? BigInt(index) : BigInt(index);
1966
+ if (normalized < 0n) {
1967
+ throw new Error("payerIndex must be non-negative");
1968
+ }
1969
+ return normalized;
1970
+ }
1971
+ function normalizeAtomicAmount(amount) {
1972
+ if (!/^\d+$/.test(amount)) {
1973
+ throw new Error(`x402 amount must be an atomic integer string, received: ${amount}`);
1974
+ }
1975
+ if (BigInt(amount) <= 0n) {
1976
+ throw new Error("x402 amount must be greater than 0");
1977
+ }
1978
+ return amount;
1979
+ }
1980
+ function usdcAtomicToDecimalString(amountAtomic) {
1981
+ const atomic = typeof amountAtomic === "bigint" ? amountAtomic.toString() : normalizeAtomicAmount(amountAtomic);
1982
+ return viem.formatUnits(BigInt(atomic), USDC_DECIMALS);
1983
+ }
1984
+ function usdcDecimalToAtomic(amount) {
1985
+ if (!/^\d+(\.\d+)?$/.test(amount.trim())) {
1986
+ throw new Error(`Invalid USDC amount: ${amount}`);
1987
+ }
1988
+ return viem.parseUnits(amount.trim(), USDC_DECIMALS);
1989
+ }
1990
+ function deriveX402PayerKey(rootPrivateKey, index) {
1991
+ assertPrivateKey(rootPrivateKey, "rootPrivateKey");
1992
+ const normalizedIndex = normalizePayerIndex(index);
1993
+ return viem.keccak256(
1994
+ viem.encodePacked(
1995
+ ["bytes32", "string", "uint256"],
1996
+ [rootPrivateKey, X402_PAYER_DOMAIN, normalizedIndex]
1997
+ )
1998
+ );
1999
+ }
2000
+ function deriveX402PayerAddress(rootPrivateKey, index) {
2001
+ return accounts.privateKeyToAddress(deriveX402PayerKey(rootPrivateKey, index));
2002
+ }
2003
+ function selectBaseUsdcExactRequirement(paymentRequired) {
2004
+ if (paymentRequired.x402Version !== 2) {
2005
+ throw new Error(`Unsupported x402 version ${paymentRequired.x402Version}; expected v2`);
2006
+ }
2007
+ const requirement = paymentRequired.accepts.find(
2008
+ (candidate) => candidate.scheme === "exact" && candidate.network === BASE_NETWORK && candidate.asset.toLowerCase() === ADDRESSES.usdcToken.toLowerCase()
2009
+ );
2010
+ if (!requirement) {
2011
+ throw new Error("No supported x402 payment requirement found. Veil supports x402 v2 exact Base USDC only.");
2012
+ }
2013
+ if (!viem.isAddress(requirement.payTo)) {
2014
+ throw new Error("Selected x402 requirement has an invalid payTo address");
2015
+ }
2016
+ normalizeAtomicAmount(requirement.amount);
2017
+ return requirement;
2018
+ }
2019
+ async function parsePaymentRequired(response, httpClient) {
2020
+ let body;
2021
+ try {
2022
+ body = await response.clone().json();
2023
+ } catch {
2024
+ body = void 0;
2025
+ }
2026
+ return httpClient.getPaymentRequiredResponse(
2027
+ (name) => response.headers.get(name),
2028
+ body
2029
+ );
2030
+ }
2031
+ async function payX402Resource(options) {
2032
+ const fetchImpl = options.fetchImpl ?? globalThis.fetch;
2033
+ if (!fetchImpl) {
2034
+ throw new Error("fetch is not available; pass fetchImpl");
2035
+ }
2036
+ const payerIndex = normalizePayerIndex(options.payerIndex);
2037
+ const payerPrivateKey = deriveX402PayerKey(options.rootPrivateKey, payerIndex);
2038
+ const payerAccount = accounts.privateKeyToAccount(payerPrivateKey);
2039
+ const publicClient = viem.createPublicClient({
2040
+ chain: chains.base,
2041
+ transport: viem.http(options.rpcUrl)
2042
+ });
2043
+ const signer = evm.toClientEvmSigner(payerAccount, publicClient);
2044
+ const client$2 = new client.x402Client(
2045
+ (_version, requirements) => selectBaseUsdcExactRequirement({
2046
+ x402Version: 2,
2047
+ resource: { url: options.url },
2048
+ accepts: requirements
2049
+ })
2050
+ );
2051
+ client$1.registerExactEvmScheme(client$2, {
2052
+ signer,
2053
+ networks: [BASE_NETWORK],
2054
+ schemeOptions: options.rpcUrl ? { rpcUrl: options.rpcUrl } : void 0
2055
+ });
2056
+ const httpClient = new client.x402HTTPClient(client$2);
2057
+ options.onProgress?.("Fetching x402 requirement...");
2058
+ const initialResponse = await fetchImpl(options.url, options.init);
2059
+ if (initialResponse.status !== 402) {
2060
+ return {
2061
+ response: initialResponse,
2062
+ payerAddress: payerAccount.address,
2063
+ payerIndex: payerIndex.toString(),
2064
+ amount: "0",
2065
+ amountAtomic: "0",
2066
+ relayTransactionHash: "",
2067
+ relayBlockNumber: ""
2068
+ };
2069
+ }
2070
+ const paymentRequired = await parsePaymentRequired(initialResponse, httpClient);
2071
+ const requirement = selectBaseUsdcExactRequirement(paymentRequired);
2072
+ const amountAtomic = normalizeAtomicAmount(requirement.amount);
2073
+ const amount = usdcAtomicToDecimalString(amountAtomic);
2074
+ if (options.maxPayment !== void 0) {
2075
+ const maxAtomic = usdcDecimalToAtomic(options.maxPayment);
2076
+ if (BigInt(amountAtomic) > maxAtomic) {
2077
+ throw new Error(
2078
+ `x402 payment of ${amount} USDC exceeds maxPayment cap of ${usdcAtomicToDecimalString(maxAtomic)} USDC. Payment was not sent.`
2079
+ );
2080
+ }
2081
+ }
2082
+ let relayTransactionHash = "";
2083
+ let relayBlockNumber = "";
2084
+ let fundAtomic = BigInt(amountAtomic);
2085
+ if (options.reuseExistingBalance) {
2086
+ const payerBalance = await publicClient.readContract({
2087
+ address: ADDRESSES.usdcToken,
2088
+ abi: ERC20_ABI,
2089
+ functionName: "balanceOf",
2090
+ args: [payerAccount.address]
2091
+ });
2092
+ if (payerBalance >= BigInt(amountAtomic)) {
2093
+ fundAtomic = 0n;
2094
+ } else if (options.reuseExistingBalance === "topup") {
2095
+ fundAtomic = BigInt(amountAtomic) - payerBalance;
2096
+ } else {
2097
+ throw new Error(
2098
+ `Cannot reuse payer index ${payerIndex.toString()}: holds ${viem.formatUnits(payerBalance, USDC_DECIMALS)} USDC but the resource requires ${amount} USDC. Pass reuseExistingBalance: 'topup' to fund the shortfall.`
2099
+ );
2100
+ }
2101
+ }
2102
+ if (fundAtomic === 0n) {
2103
+ options.onProgress?.("Reusing funded x402 payer...", `${amount} USDC on ${payerAccount.address}`);
2104
+ } else {
2105
+ if (fundAtomic < X402_MIN_WITHDRAW_ATOMIC) {
2106
+ fundAtomic = X402_MIN_WITHDRAW_ATOMIC;
2107
+ }
2108
+ const fundAmount = usdcAtomicToDecimalString(fundAtomic);
2109
+ options.onProgress?.("Funding x402 payer...", `${fundAmount} USDC to ${payerAccount.address}`);
2110
+ const proof = await buildWithdrawProof({
2111
+ amount: fundAmount,
2112
+ recipient: payerAccount.address,
2113
+ keypair: new Keypair(options.rootPrivateKey),
2114
+ pool: "usdc",
2115
+ rpcUrl: options.rpcUrl,
2116
+ provingKeyPath: options.provingKeyPath,
2117
+ onProgress: options.onProgress
2118
+ });
2119
+ const relayResult = await submitRelay({
2120
+ type: "withdraw",
2121
+ pool: "usdc",
2122
+ // x402 funding must target the low-minimum /x402 relay route. Default to it
2123
+ // so direct SDK consumers do not silently hit the main relay's 5 USDC floor.
2124
+ relayUrl: options.relayUrl ?? `${getRelayUrl()}/x402`,
2125
+ proofArgs: proof.proofArgs,
2126
+ extData: proof.extData,
2127
+ metadata: {
2128
+ amount: fundAmount,
2129
+ amountAtomic: fundAtomic.toString(),
2130
+ recipient: payerAccount.address,
2131
+ inputUtxoCount: proof.inputCount,
2132
+ outputUtxoCount: proof.outputCount,
2133
+ x402: true,
2134
+ payerIndex: payerIndex.toString()
2135
+ }
2136
+ });
2137
+ relayTransactionHash = relayResult.transactionHash;
2138
+ relayBlockNumber = relayResult.blockNumber;
2139
+ if (options.onPayerFunded) {
2140
+ try {
2141
+ options.onPayerFunded({
2142
+ payerAddress: payerAccount.address,
2143
+ payerIndex: payerIndex.toString(),
2144
+ amount,
2145
+ amountAtomic,
2146
+ relayTransactionHash,
2147
+ relayBlockNumber
2148
+ });
2149
+ } catch {
2150
+ }
2151
+ }
2152
+ }
2153
+ options.onProgress?.("Signing x402 payment...");
2154
+ const paymentPayload = await httpClient.createPaymentPayload({
2155
+ ...paymentRequired,
2156
+ accepts: [requirement]
2157
+ });
2158
+ const paymentHeaders = httpClient.encodePaymentSignatureHeader(paymentPayload);
2159
+ const headers = new Headers(options.init?.headers);
2160
+ for (const [key, value] of Object.entries(paymentHeaders)) {
2161
+ headers.set(key, value);
2162
+ }
2163
+ options.onProgress?.("Requesting paid resource...");
2164
+ const paidResponse = await fetchImpl(options.url, {
2165
+ ...options.init,
2166
+ headers
2167
+ });
2168
+ let paymentResponse;
2169
+ try {
2170
+ paymentResponse = httpClient.getPaymentSettleResponse((name) => paidResponse.headers.get(name));
2171
+ } catch {
2172
+ paymentResponse = void 0;
2173
+ }
2174
+ return {
2175
+ response: paidResponse,
2176
+ payerAddress: payerAccount.address,
2177
+ payerIndex: payerIndex.toString(),
2178
+ amount,
2179
+ amountAtomic,
2180
+ relayTransactionHash,
2181
+ relayBlockNumber,
2182
+ paymentResponse,
2183
+ paymentTransactionHash: paymentResponse?.transaction
2184
+ };
2185
+ }
2186
+ async function quoteX402Resource(options) {
2187
+ const fetchImpl = options.fetchImpl ?? globalThis.fetch;
2188
+ if (!fetchImpl) {
2189
+ throw new Error("fetch is not available; pass fetchImpl");
2190
+ }
2191
+ const client$1 = new client.x402Client(
2192
+ (_version, requirements) => selectBaseUsdcExactRequirement({
2193
+ x402Version: 2,
2194
+ resource: { url: options.url },
2195
+ accepts: requirements
2196
+ })
2197
+ );
2198
+ const httpClient = new client.x402HTTPClient(client$1);
2199
+ const initialResponse = await fetchImpl(options.url, options.init);
2200
+ if (initialResponse.status !== 402) {
2201
+ let body;
2202
+ try {
2203
+ body = await initialResponse.clone().json();
2204
+ } catch {
2205
+ try {
2206
+ body = await initialResponse.clone().text();
2207
+ } catch {
2208
+ body = void 0;
2209
+ }
2210
+ }
2211
+ return {
2212
+ requiresPayment: false,
2213
+ supported: false,
2214
+ status: initialResponse.status,
2215
+ body
2216
+ };
2217
+ }
2218
+ let requirement;
2219
+ try {
2220
+ const paymentRequired = await parsePaymentRequired(initialResponse, httpClient);
2221
+ requirement = selectBaseUsdcExactRequirement(paymentRequired);
2222
+ } catch (error) {
2223
+ return {
2224
+ requiresPayment: true,
2225
+ supported: false,
2226
+ status: 402,
2227
+ error: error instanceof Error ? error.message : "Unsupported x402 requirement"
2228
+ };
2229
+ }
2230
+ const amountAtomic = normalizeAtomicAmount(requirement.amount);
2231
+ const amount = usdcAtomicToDecimalString(amountAtomic);
2232
+ let exceedsMax;
2233
+ if (options.maxPayment !== void 0) {
2234
+ exceedsMax = BigInt(amountAtomic) > usdcDecimalToAtomic(options.maxPayment);
2235
+ }
2236
+ return {
2237
+ requiresPayment: true,
2238
+ supported: true,
2239
+ status: 402,
2240
+ amount,
2241
+ amountAtomic,
2242
+ payTo: requirement.payTo,
2243
+ network: requirement.network,
2244
+ asset: requirement.asset,
2245
+ exceedsMax,
2246
+ maxPayment: options.maxPayment
2247
+ };
2248
+ }
2249
+ async function getX402PayerBalances(options) {
2250
+ assertPrivateKey(options.rootPrivateKey, "rootPrivateKey");
2251
+ const start = normalizePayerIndex(options.startIndex ?? 0n);
2252
+ const count = options.count ?? 16;
2253
+ if (!Number.isInteger(count) || count <= 0 || count > 256) {
2254
+ throw new Error("count must be an integer between 1 and 256");
2255
+ }
2256
+ const publicClient = viem.createPublicClient({
2257
+ chain: chains.base,
2258
+ transport: viem.http(options.rpcUrl)
2259
+ });
2260
+ const results = [];
2261
+ for (let i = 0; i < count; i++) {
2262
+ const index = start + BigInt(i);
2263
+ const payerAddress = deriveX402PayerAddress(options.rootPrivateKey, index);
2264
+ const balance = await publicClient.readContract({
2265
+ address: ADDRESSES.usdcToken,
2266
+ abi: ERC20_ABI,
2267
+ functionName: "balanceOf",
2268
+ args: [payerAddress]
2269
+ });
2270
+ if (options.nonZeroOnly && balance === 0n) {
2271
+ continue;
2272
+ }
2273
+ results.push({
2274
+ payerIndex: index.toString(),
2275
+ payerAddress,
2276
+ usdc: viem.formatUnits(balance, USDC_DECIMALS),
2277
+ usdcAtomic: balance.toString()
2278
+ });
2279
+ }
2280
+ return results;
2281
+ }
1976
2282
  async function checkRecipientRegistration(address, rpcUrl) {
1977
2283
  const addresses = getAddresses();
1978
2284
  const publicClient = viem.createPublicClient({
@@ -2261,7 +2567,7 @@ function createBaseClient(rpcUrl) {
2261
2567
  transport: viem.http(rpcUrl)
2262
2568
  });
2263
2569
  }
2264
- function assertPrivateKey(value, label) {
2570
+ function assertPrivateKey2(value, label) {
2265
2571
  if (!/^0x[a-fA-F0-9]{64}$/.test(value)) {
2266
2572
  throw new Error(`${label} must be a 0x-prefixed 32-byte hex string`);
2267
2573
  }
@@ -2296,7 +2602,7 @@ function normalizeDeadline(deadline) {
2296
2602
  return nextDeadline;
2297
2603
  }
2298
2604
  function deriveSubaccountChildPrivateKey(rootPrivateKey, slot) {
2299
- assertPrivateKey(rootPrivateKey, "rootPrivateKey");
2605
+ assertPrivateKey2(rootPrivateKey, "rootPrivateKey");
2300
2606
  const normalizedSlot = normalizeSlot(slot);
2301
2607
  return viem.keccak256(
2302
2608
  viem.encodePacked(
@@ -2306,7 +2612,7 @@ function deriveSubaccountChildPrivateKey(rootPrivateKey, slot) {
2306
2612
  );
2307
2613
  }
2308
2614
  function deriveSubaccountSalt(rootPrivateKey, slot) {
2309
- assertPrivateKey(rootPrivateKey, "rootPrivateKey");
2615
+ assertPrivateKey2(rootPrivateKey, "rootPrivateKey");
2310
2616
  const normalizedSlot = normalizeSlot(slot);
2311
2617
  return viem.keccak256(
2312
2618
  viem.encodePacked(
@@ -2316,11 +2622,11 @@ function deriveSubaccountSalt(rootPrivateKey, slot) {
2316
2622
  );
2317
2623
  }
2318
2624
  function deriveSubaccountChildOwner(childPrivateKey) {
2319
- assertPrivateKey(childPrivateKey, "childPrivateKey");
2625
+ assertPrivateKey2(childPrivateKey, "childPrivateKey");
2320
2626
  return accounts.privateKeyToAddress(childPrivateKey);
2321
2627
  }
2322
2628
  function deriveSubaccountChildDepositKey(childPrivateKey) {
2323
- assertPrivateKey(childPrivateKey, "childPrivateKey");
2629
+ assertPrivateKey2(childPrivateKey, "childPrivateKey");
2324
2630
  return new Keypair(childPrivateKey).depositKey();
2325
2631
  }
2326
2632
  async function predictSubaccountForwarder(options) {
@@ -2413,7 +2719,7 @@ function toPrivateBalanceStatus(result) {
2413
2719
  }
2414
2720
  async function getSubaccountPrivateBalance(options) {
2415
2721
  const normalizedSlot = normalizeSlot(options.slot);
2416
- assertPrivateKey(options.rootPrivateKey, "rootPrivateKey");
2722
+ assertPrivateKey2(options.rootPrivateKey, "rootPrivateKey");
2417
2723
  const childPrivateKey = deriveSubaccountChildPrivateKey(options.rootPrivateKey, normalizedSlot);
2418
2724
  const childKeypair = new Keypair(childPrivateKey);
2419
2725
  return getPrivateBalance({
@@ -2523,7 +2829,7 @@ function buildSubaccountWithdrawTypedData(options) {
2523
2829
  };
2524
2830
  }
2525
2831
  async function signSubaccountWithdraw(options) {
2526
- assertPrivateKey(options.childPrivateKey, "childPrivateKey");
2832
+ assertPrivateKey2(options.childPrivateKey, "childPrivateKey");
2527
2833
  const account = accounts.privateKeyToAccount(options.childPrivateKey);
2528
2834
  return account.signTypedData({
2529
2835
  domain: options.typedData.domain,
@@ -2636,7 +2942,7 @@ async function mergeSubaccount(options) {
2636
2942
  onProgress
2637
2943
  } = options;
2638
2944
  const normalizedSlot = normalizeSlot(slot);
2639
- assertPrivateKey(rootPrivateKey, "rootPrivateKey");
2945
+ assertPrivateKey2(rootPrivateKey, "rootPrivateKey");
2640
2946
  const poolConfig = POOL_CONFIG[pool];
2641
2947
  const poolAddress = getPoolAddress(pool);
2642
2948
  const childPrivateKey = deriveSubaccountChildPrivateKey(rootPrivateKey, normalizedSlot);
@@ -2795,9 +3101,10 @@ exports.deriveSubaccountChildOwner = deriveSubaccountChildOwner;
2795
3101
  exports.deriveSubaccountChildPrivateKey = deriveSubaccountChildPrivateKey;
2796
3102
  exports.deriveSubaccountSalt = deriveSubaccountSalt;
2797
3103
  exports.deriveSubaccountSlot = deriveSubaccountSlot;
3104
+ exports.deriveX402PayerAddress = deriveX402PayerAddress;
3105
+ exports.deriveX402PayerKey = deriveX402PayerKey;
2798
3106
  exports.findNextSubaccountWithdrawNonce = findNextSubaccountWithdrawNonce;
2799
3107
  exports.getAddresses = getAddresses;
2800
- exports.getDailyFreeRemaining = getDailyFreeRemaining;
2801
3108
  exports.getExtDataHash = getExtDataHash;
2802
3109
  exports.getForwarderFactoryAddress = getForwarderFactoryAddress;
2803
3110
  exports.getMerklePath = getMerklePath;
@@ -2809,17 +3116,21 @@ exports.getRelayInfo = getRelayInfo;
2809
3116
  exports.getRelayUrl = getRelayUrl;
2810
3117
  exports.getSubaccountPrivateBalance = getSubaccountPrivateBalance;
2811
3118
  exports.getSubaccountStatus = getSubaccountStatus;
3119
+ exports.getX402PayerBalances = getX402PayerBalances;
2812
3120
  exports.isSubaccountForwarderDeployed = isSubaccountForwarderDeployed;
2813
3121
  exports.isSubaccountWithdrawNonceUsed = isSubaccountWithdrawNonceUsed;
2814
3122
  exports.mergeSubaccount = mergeSubaccount;
2815
3123
  exports.mergeUtxos = mergeUtxos;
2816
3124
  exports.packEncryptedMessage = packEncryptedMessage;
3125
+ exports.payX402Resource = payX402Resource;
2817
3126
  exports.poseidonHash = poseidonHash;
2818
3127
  exports.poseidonHash2 = poseidonHash2;
2819
3128
  exports.predictSubaccountForwarder = predictSubaccountForwarder;
2820
3129
  exports.prepareTransaction = prepareTransaction;
2821
3130
  exports.prove = prove;
3131
+ exports.quoteX402Resource = quoteX402Resource;
2822
3132
  exports.randomBN = randomBN;
3133
+ exports.selectBaseUsdcExactRequirement = selectBaseUsdcExactRequirement;
2823
3134
  exports.selectCircuit = selectCircuit;
2824
3135
  exports.selectUtxosForWithdraw = selectUtxosForWithdraw;
2825
3136
  exports.shuffle = shuffle;
@@ -2830,6 +3141,8 @@ exports.toBuffer = toBuffer;
2830
3141
  exports.toFixedHex = toFixedHex;
2831
3142
  exports.transfer = transfer;
2832
3143
  exports.unpackEncryptedMessage = unpackEncryptedMessage;
3144
+ exports.usdcAtomicToDecimalString = usdcAtomicToDecimalString;
3145
+ exports.usdcDecimalToAtomic = usdcDecimalToAtomic;
2833
3146
  exports.withdraw = withdraw;
2834
3147
  //# sourceMappingURL=index.cjs.map
2835
3148
  //# sourceMappingURL=index.cjs.map