@piprail/sdk 2.14.0 → 2.14.1

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
@@ -31,7 +31,8 @@ var _chunkCQQI5IJXcjs = require('./chunk-CQQI5IJX.cjs');
31
31
 
32
32
 
33
33
 
34
- var _chunkGYM46G5Lcjs = require('./chunk-GYM46G5L.cjs');
34
+
35
+ var _chunk57V5DNJTcjs = require('./chunk-57V5DNJT.cjs');
35
36
 
36
37
  // src/drivers/registry.ts
37
38
  var byFamily = /* @__PURE__ */ new Map();
@@ -60,13 +61,13 @@ function resolveNetwork(opts) {
60
61
  const family = familyForChain(opts.chain);
61
62
  const driver = byFamily.get(family);
62
63
  if (!driver) {
63
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedNetworkError)(
64
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedNetworkError)(
64
65
  `No driver registered for the "${family}" family \u2014 it may not be mounted yet (use the async resolveNetwork()).`
65
66
  );
66
67
  }
67
68
  const net = driver.resolve(opts);
68
69
  if (!net) {
69
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedNetworkError)(
70
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedNetworkError)(
70
71
  `The ${family} driver didn't recognise this chain input.`
71
72
  );
72
73
  }
@@ -331,12 +332,12 @@ function resolveChain(input, rpcUrlOverride) {
331
332
 
332
333
  var _accounts = require('viem/accounts');
333
334
  function createWalletAdapter(config, resolved) {
334
- _chunkGYM46G5Lcjs.assertNoLegacyWalletKey.call(void 0, config, "EVM");
335
+ _chunk57V5DNJTcjs.assertNoLegacyWalletKey.call(void 0, config, "EVM");
335
336
  if ("key" in config) {
336
337
  const key = config.key;
337
338
  if (typeof key !== "string" || !/^0x[0-9a-fA-F]{64}$/.test(key)) {
338
339
  const hint = typeof key === "string" && !key.startsWith("0x") ? " (got a non-0x string \u2014 a base58/seed key belongs to another family; pass { key } as the EVM chain's 0x\u2026 hex secret)." : " (expected 0x followed by 64 hex characters).";
339
- throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
340
+ throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
340
341
  `chain is EVM; the wallet { key } is not a valid 0x\u2026 32-byte hex private key${hint}`
341
342
  );
342
343
  }
@@ -344,7 +345,7 @@ function createWalletAdapter(config, resolved) {
344
345
  try {
345
346
  account = _accounts.privateKeyToAccount.call(void 0, key);
346
347
  } catch (err) {
347
- throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
348
+ throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
348
349
  `chain is EVM; the wallet { key } is not a valid 0x\u2026 32-byte hex private key: ${err instanceof Error ? err.message : String(err)}.`
349
350
  );
350
351
  }
@@ -354,12 +355,12 @@ function createWalletAdapter(config, resolved) {
354
355
  }
355
356
  const wc = config.walletClient;
356
357
  if (!wc.account) {
357
- throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
358
+ throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
358
359
  "chain is EVM; the provided walletClient has no attached account. Use `createWalletClient({ account, chain, transport })`, or pass { key }."
359
360
  );
360
361
  }
361
362
  if (wc.chain && wc.chain.id !== resolved.chainId) {
362
- throw new (0, _chunkGYM46G5Lcjs.WrongChainError)(
363
+ throw new (0, _chunk57V5DNJTcjs.WrongChainError)(
363
364
  `PipRailClient: walletClient is on chain ${wc.chain.id} but the SDK was configured with chain ${resolved.chainId}. They must match.`
364
365
  );
365
366
  }
@@ -689,7 +690,7 @@ async function payExactEvm(input) {
689
690
  code = void 0;
690
691
  }
691
692
  if (code && code !== "0x") {
692
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
693
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
693
694
  `exact buyer rail requires an EOA signer; ${account.address} is a contract / EIP-1271 / EIP-7702-delegated account (no recoverable ECDSA signature). Pay via onchain-proof.`
694
695
  );
695
696
  }
@@ -699,13 +700,13 @@ async function payExactEvm(input) {
699
700
  domain = await readExactDomain(publicClient, accept.asset);
700
701
  }
701
702
  if (!domain) {
702
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
703
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
703
704
  `exact: couldn't derive the EIP-712 domain for ${accept.asset} on ${accept.network}. Either it isn't an EIP-3009 token (USDT needs Permit2; native/plain ERC-20 aren't exact-payable) \u2014 pay via onchain-proof \u2014 OR your RPC couldn't read it (transient): if the gate advertised eip3009, pass a reliable rpcUrl and retry.`
704
705
  );
705
706
  }
706
707
  const g = globalThis.crypto;
707
708
  if (!_optionalChain([g, 'optionalAccess', _5 => _5.getRandomValues])) {
708
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
709
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
709
710
  "this runtime lacks Web Crypto (globalThis.crypto.getRandomValues); the exact rail needs a CSPRNG nonce."
710
711
  );
711
712
  }
@@ -962,7 +963,7 @@ async function verifyAndSettleExactEvm(input) {
962
963
  args: writeArgs
963
964
  });
964
965
  } catch (err) {
965
- throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
966
+ throw new (0, _chunk57V5DNJTcjs.SettlementError)(
966
967
  `exact settle: the merchant relayer failed to broadcast transferWithAuthorization (${shorten(err instanceof Error ? err.message : String(err))}). The payer's authorization is still valid and unused \u2014 fund/fix the relayer and the payer can retry.`,
967
968
  { cause: err }
968
969
  );
@@ -974,7 +975,7 @@ async function verifyAndSettleExactEvm(input) {
974
975
  return { ok: false, error: "tx_reverted", detail: `Settlement tx ${txHash} reverted on-chain.` };
975
976
  }
976
977
  } catch (err) {
977
- throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
978
+ throw new (0, _chunk57V5DNJTcjs.SettlementError)(
978
979
  `exact settle: broadcast ${txHash} but couldn't confirm it (${shorten(err instanceof Error ? err.message : String(err))}).`,
979
980
  { cause: err }
980
981
  );
@@ -1105,7 +1106,7 @@ function shorten2(msg) {
1105
1106
  function randomPermit2Nonce() {
1106
1107
  const g = globalThis.crypto;
1107
1108
  if (!_optionalChain([g, 'optionalAccess', _8 => _8.getRandomValues])) {
1108
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
1109
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
1109
1110
  "this runtime lacks Web Crypto (globalThis.crypto.getRandomValues); the permit2 rail needs a CSPRNG nonce."
1110
1111
  );
1111
1112
  }
@@ -1124,7 +1125,7 @@ async function ensurePermit2Allowance(input) {
1124
1125
  args: [account.address, PERMIT2_ADDRESS]
1125
1126
  });
1126
1127
  } catch (err) {
1127
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
1128
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
1128
1129
  `permit2: couldn't read the Permit2 allowance for ${token} (${shorten2(err instanceof Error ? err.message : String(err))}).`
1129
1130
  );
1130
1131
  }
@@ -1141,7 +1142,7 @@ async function ensurePermit2Allowance(input) {
1141
1142
  await publicClient.waitForTransactionReceipt({ hash, confirmations: 1 });
1142
1143
  return hash;
1143
1144
  } catch (err) {
1144
- throw _nullishCoalesce(_chunkGYM46G5Lcjs.toInsufficientFundsError.call(void 0, err), () => ( new (0, _chunkGYM46G5Lcjs.SettlementError)(
1145
+ throw _nullishCoalesce(_chunk57V5DNJTcjs.toInsufficientFundsError.call(void 0, err), () => ( new (0, _chunk57V5DNJTcjs.SettlementError)(
1145
1146
  `permit2: the one-time Permit2 approval for ${token} failed to broadcast (${shorten2(err instanceof Error ? err.message : String(err))}).`,
1146
1147
  { cause: err }
1147
1148
  )));
@@ -1156,7 +1157,7 @@ async function payPermit2Evm(input) {
1156
1157
  code = void 0;
1157
1158
  }
1158
1159
  if (code && code !== "0x") {
1159
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
1160
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
1160
1161
  `permit2 buyer rail requires an EOA signer; ${account.address} is a contract / EIP-1271 / EIP-7702-delegated account. Pay via onchain-proof.`
1161
1162
  );
1162
1163
  }
@@ -1331,7 +1332,7 @@ async function verifyAndSettlePermit2Evm(input) {
1331
1332
  args: settleArgs
1332
1333
  });
1333
1334
  } catch (err) {
1334
- throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
1335
+ throw new (0, _chunk57V5DNJTcjs.SettlementError)(
1335
1336
  `permit2 settle: the merchant relayer failed to broadcast the proxy settle (${shorten2(err instanceof Error ? err.message : String(err))}). The payer's signature is still valid and its nonce unused \u2014 fund/fix the relayer and the payer can retry.`,
1336
1337
  { cause: err }
1337
1338
  );
@@ -1343,7 +1344,7 @@ async function verifyAndSettlePermit2Evm(input) {
1343
1344
  return { ok: false, error: "tx_reverted", detail: `Settlement tx ${txHash} reverted on-chain.` };
1344
1345
  }
1345
1346
  } catch (err) {
1346
- throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
1347
+ throw new (0, _chunk57V5DNJTcjs.SettlementError)(
1347
1348
  `permit2 settle: broadcast ${txHash} but couldn't confirm it (${shorten2(err instanceof Error ? err.message : String(err))}).`,
1348
1349
  { cause: err }
1349
1350
  );
@@ -1441,7 +1442,7 @@ function shorten3(msg) {
1441
1442
  function randomPermit2Nonce2() {
1442
1443
  const g = globalThis.crypto;
1443
1444
  if (!_optionalChain([g, 'optionalAccess', _9 => _9.getRandomValues])) {
1444
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
1445
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
1445
1446
  "this runtime lacks Web Crypto (globalThis.crypto.getRandomValues); the upto rail needs a CSPRNG nonce."
1446
1447
  );
1447
1448
  }
@@ -1458,13 +1459,13 @@ async function payUptoEvm(input) {
1458
1459
  code = void 0;
1459
1460
  }
1460
1461
  if (code && code !== "0x") {
1461
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
1462
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
1462
1463
  `upto buyer rail requires an EOA signer; ${account.address} is a contract / EIP-1271 / EIP-7702-delegated account. Pay via onchain-proof.`
1463
1464
  );
1464
1465
  }
1465
1466
  const facilitatorAddress = _optionalChain([accept, 'access', _10 => _10.extra, 'optionalAccess', _11 => _11.facilitatorAddress]);
1466
1467
  if (typeof facilitatorAddress !== "string" || facilitatorAddress.length === 0) {
1467
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
1468
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
1468
1469
  `upto: the rail carries no extra.facilitatorAddress to bind into witness.facilitator \u2014 refusing to sign.`
1469
1470
  );
1470
1471
  }
@@ -1685,7 +1686,7 @@ async function verifyAndSettleUptoEvm(input) {
1685
1686
  args: settleArgs
1686
1687
  });
1687
1688
  } catch (err) {
1688
- throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
1689
+ throw new (0, _chunk57V5DNJTcjs.SettlementError)(
1689
1690
  `upto settle: the merchant relayer failed to broadcast the proxy settle (${shorten3(err instanceof Error ? err.message : String(err))}). The payer's signature is still valid and its nonce unused \u2014 fund/fix the relayer and the payer can retry.`,
1690
1691
  { cause: err }
1691
1692
  );
@@ -1697,7 +1698,7 @@ async function verifyAndSettleUptoEvm(input) {
1697
1698
  return { ok: false, error: "tx_reverted", detail: `Settlement tx ${txHash} reverted on-chain.` };
1698
1699
  }
1699
1700
  } catch (err) {
1700
- throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
1701
+ throw new (0, _chunk57V5DNJTcjs.SettlementError)(
1701
1702
  `upto settle: broadcast ${txHash} but couldn't confirm it (${shorten3(err instanceof Error ? err.message : String(err))}).`,
1702
1703
  { cause: err }
1703
1704
  );
@@ -2040,7 +2041,7 @@ var evmDriver = {
2040
2041
  try {
2041
2042
  return makeEvmNetwork(resolveChain(opts.chain, opts.rpcUrl));
2042
2043
  } catch (err) {
2043
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedNetworkError)(err instanceof Error ? err.message : String(err), { cause: err });
2044
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedNetworkError)(err instanceof Error ? err.message : String(err), { cause: err });
2044
2045
  }
2045
2046
  }
2046
2047
  let resolved;
@@ -2074,20 +2075,20 @@ function makeEvmNetwork(resolved) {
2074
2075
  const info = resolved.tokens[token.toUpperCase()];
2075
2076
  if (!info) {
2076
2077
  const known = Object.keys(resolved.tokens).join(", ") || "(none built in)";
2077
- throw new (0, _chunkGYM46G5Lcjs.UnknownTokenError)(
2078
+ throw new (0, _chunk57V5DNJTcjs.UnknownTokenError)(
2078
2079
  `token "${token}" isn't built in for ${resolved.chain.name} (known: ${known}). Pass { address, decimals } instead, or use 'native'.`
2079
2080
  );
2080
2081
  }
2081
2082
  return { asset: info.address, decimals: info.decimals, symbol: info.symbol };
2082
2083
  }
2083
- _chunkGYM46G5Lcjs.rejectForeignToken.call(void 0, token, "evm", network);
2084
+ _chunk57V5DNJTcjs.rejectForeignToken.call(void 0, token, "evm", network);
2084
2085
  if (!("address" in token)) {
2085
- throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
2086
+ throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
2086
2087
  `chain ${network} is EVM; a custom token must be { address, decimals }.`
2087
2088
  );
2088
2089
  }
2089
2090
  if (!_viem.isAddress.call(void 0, token.address)) {
2090
- throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
2091
+ throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
2091
2092
  `chain ${network} is EVM, but token address "${token.address}" is not a valid 0x address.`
2092
2093
  );
2093
2094
  }
@@ -2119,20 +2120,20 @@ function makeEvmNetwork(resolved) {
2119
2120
  },
2120
2121
  assertValidPayTo(payTo) {
2121
2122
  if (!_viem.isAddress.call(void 0, payTo)) {
2122
- throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
2123
+ throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
2123
2124
  `chain ${network} is EVM, but payTo "${payTo}" is not a valid 0x address.`
2124
2125
  );
2125
2126
  }
2126
2127
  },
2127
2128
  bindWallet(wallet) {
2128
2129
  if (typeof wallet !== "object" || wallet === null) {
2129
- throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
2130
+ throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
2130
2131
  `chain ${network} is EVM; wallet must be { key } (0x\u2026 hex) or { walletClient }.`
2131
2132
  );
2132
2133
  }
2133
- _chunkGYM46G5Lcjs.assertNoLegacyWalletKey.call(void 0, wallet, "EVM");
2134
+ _chunk57V5DNJTcjs.assertNoLegacyWalletKey.call(void 0, wallet, "EVM");
2134
2135
  if (!("key" in wallet) && !("walletClient" in wallet)) {
2135
- throw new (0, _chunkGYM46G5Lcjs.WrongFamilyError)(
2136
+ throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
2136
2137
  `chain ${network} is EVM; wallet must be { key } (0x\u2026 hex) or { walletClient }.`
2137
2138
  );
2138
2139
  }
@@ -2149,12 +2150,12 @@ function makeEvmNetwork(resolved) {
2149
2150
  });
2150
2151
  } catch (err) {
2151
2152
  if (isViemInsufficientFunds(err)) {
2152
- throw new (0, _chunkGYM46G5Lcjs.InsufficientFundsError)(
2153
+ throw new (0, _chunk57V5DNJTcjs.InsufficientFundsError)(
2153
2154
  err instanceof Error ? err.message : "Insufficient funds for payment.",
2154
2155
  { cause: err }
2155
2156
  );
2156
2157
  }
2157
- throw _nullishCoalesce(_chunkGYM46G5Lcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
2158
+ throw _nullishCoalesce(_chunk57V5DNJTcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
2158
2159
  }
2159
2160
  },
2160
2161
  async confirm(ref, minConfirmations) {
@@ -2165,7 +2166,7 @@ function makeEvmNetwork(resolved) {
2165
2166
  });
2166
2167
  return { height: receipt.blockNumber.toString() };
2167
2168
  } catch (err) {
2168
- throw new (0, _chunkGYM46G5Lcjs.ConfirmationTimeoutError)(
2169
+ throw new (0, _chunk57V5DNJTcjs.ConfirmationTimeoutError)(
2169
2170
  `EVM tx ${ref} did not reach ${minConfirmations} confirmation(s) in time.`,
2170
2171
  { cause: err }
2171
2172
  );
@@ -2176,7 +2177,7 @@ function makeEvmNetwork(resolved) {
2176
2177
  if (accept.scheme === "exact" || accept.scheme === "upto") {
2177
2178
  const m = _optionalChain([accept, 'access', _19 => _19.extra, 'optionalAccess', _20 => _20.assetTransferMethod]);
2178
2179
  const permit2 = m === "permit2" || m === "permit2-exact" || m === "permit2-upto";
2179
- return _chunkGYM46G5Lcjs.nativeCost.call(void 0, {
2180
+ return _chunk57V5DNJTcjs.nativeCost.call(void 0, {
2180
2181
  symbol,
2181
2182
  decimals,
2182
2183
  fee: 0n,
@@ -2187,7 +2188,7 @@ function makeEvmNetwork(resolved) {
2187
2188
  const gasLimit = accept.asset === "native" ? 21000n : 65000n;
2188
2189
  try {
2189
2190
  const gasPrice = await publicClient.getGasPrice();
2190
- return _chunkGYM46G5Lcjs.nativeCost.call(void 0, {
2191
+ return _chunk57V5DNJTcjs.nativeCost.call(void 0, {
2191
2192
  symbol,
2192
2193
  decimals,
2193
2194
  fee: gasPrice * gasLimit,
@@ -2196,7 +2197,7 @@ function makeEvmNetwork(resolved) {
2196
2197
  });
2197
2198
  } catch (e23) {
2198
2199
  const gasPrice = 5000000000n;
2199
- return _chunkGYM46G5Lcjs.nativeCost.call(void 0, {
2200
+ return _chunk57V5DNJTcjs.nativeCost.call(void 0, {
2200
2201
  symbol,
2201
2202
  decimals,
2202
2203
  fee: gasPrice * gasLimit,
@@ -2381,9 +2382,9 @@ var loaders = {
2381
2382
  solana: async () => {
2382
2383
  let mod;
2383
2384
  try {
2384
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./solana-N3UCNCYE.cjs")));
2385
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./solana-B424IQ5I.cjs")));
2385
2386
  } catch (cause) {
2386
- throw new (0, _chunkGYM46G5Lcjs.MissingDriverError)(
2387
+ throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2387
2388
  `Solana selected, but its packages aren't installed. Run: npm install @solana/web3.js @solana/spl-token bs58`,
2388
2389
  { cause }
2389
2390
  );
@@ -2393,9 +2394,9 @@ var loaders = {
2393
2394
  ton: async () => {
2394
2395
  let mod;
2395
2396
  try {
2396
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./ton-5HDVOTMR.cjs")));
2397
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./ton-3SHFVDLP.cjs")));
2397
2398
  } catch (cause) {
2398
- throw new (0, _chunkGYM46G5Lcjs.MissingDriverError)(
2399
+ throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2399
2400
  `TON selected, but its packages aren't installed. Run: npm install @ton/ton @ton/core @ton/crypto`,
2400
2401
  { cause }
2401
2402
  );
@@ -2405,9 +2406,9 @@ var loaders = {
2405
2406
  stellar: async () => {
2406
2407
  let mod;
2407
2408
  try {
2408
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./stellar-Y3SQN7S5.cjs")));
2409
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./stellar-4YR4UZQX.cjs")));
2409
2410
  } catch (cause) {
2410
- throw new (0, _chunkGYM46G5Lcjs.MissingDriverError)(
2411
+ throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2411
2412
  `Stellar selected, but its package isn't installed. Run: npm install @stellar/stellar-sdk`,
2412
2413
  { cause }
2413
2414
  );
@@ -2417,9 +2418,9 @@ var loaders = {
2417
2418
  xrpl: async () => {
2418
2419
  let mod;
2419
2420
  try {
2420
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./xrpl-5TYDLQFS.cjs")));
2421
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./xrpl-SUEFOOKW.cjs")));
2421
2422
  } catch (cause) {
2422
- throw new (0, _chunkGYM46G5Lcjs.MissingDriverError)(
2423
+ throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2423
2424
  `XRPL selected, but its package isn't installed. Run: npm install xrpl`,
2424
2425
  { cause }
2425
2426
  );
@@ -2429,9 +2430,9 @@ var loaders = {
2429
2430
  tron: async () => {
2430
2431
  let mod;
2431
2432
  try {
2432
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./tron-TX2B4N2A.cjs")));
2433
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./tron-BS5EID2U.cjs")));
2433
2434
  } catch (cause) {
2434
- throw new (0, _chunkGYM46G5Lcjs.MissingDriverError)(
2435
+ throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2435
2436
  `Tron selected, but its package isn't installed. Run: npm install tronweb`,
2436
2437
  { cause }
2437
2438
  );
@@ -2441,9 +2442,9 @@ var loaders = {
2441
2442
  sui: async () => {
2442
2443
  let mod;
2443
2444
  try {
2444
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./sui-4AL4E6XU.cjs")));
2445
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./sui-F7UW6JXJ.cjs")));
2445
2446
  } catch (cause) {
2446
- throw new (0, _chunkGYM46G5Lcjs.MissingDriverError)(
2447
+ throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2447
2448
  `Sui selected, but its package isn't installed. Run: npm install @mysten/sui`,
2448
2449
  { cause }
2449
2450
  );
@@ -2453,9 +2454,9 @@ var loaders = {
2453
2454
  near: async () => {
2454
2455
  let mod;
2455
2456
  try {
2456
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./near-YNNK7RW7.cjs")));
2457
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./near-C2IS4RCH.cjs")));
2457
2458
  } catch (cause) {
2458
- throw new (0, _chunkGYM46G5Lcjs.MissingDriverError)(
2459
+ throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2459
2460
  `NEAR selected, but its package isn't installed. Run: npm install near-api-js`,
2460
2461
  { cause }
2461
2462
  );
@@ -2465,9 +2466,9 @@ var loaders = {
2465
2466
  aptos: async () => {
2466
2467
  let mod;
2467
2468
  try {
2468
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./aptos-LFTQGBBK.cjs")));
2469
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./aptos-MVEG5ZPS.cjs")));
2469
2470
  } catch (cause) {
2470
- throw new (0, _chunkGYM46G5Lcjs.MissingDriverError)(
2471
+ throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2471
2472
  `Aptos selected, but its package isn't installed. Run: npm install @aptos-labs/ts-sdk`,
2472
2473
  { cause }
2473
2474
  );
@@ -2477,9 +2478,9 @@ var loaders = {
2477
2478
  algorand: async () => {
2478
2479
  let mod;
2479
2480
  try {
2480
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./algorand-QU6G2DQZ.cjs")));
2481
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./algorand-ICJNXO5V.cjs")));
2481
2482
  } catch (cause) {
2482
- throw new (0, _chunkGYM46G5Lcjs.MissingDriverError)(
2483
+ throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2483
2484
  `Algorand selected, but its package isn't installed. Run: npm install algosdk`,
2484
2485
  { cause }
2485
2486
  );
@@ -2510,7 +2511,7 @@ async function resolveNetwork2(opts) {
2510
2511
  }
2511
2512
 
2512
2513
  // src/indexes.ts
2513
- var DIRECTORY_INFO = {
2514
+ var DIRECTORY_INFO = Object.freeze({
2514
2515
  "402index": {
2515
2516
  source: "402index",
2516
2517
  review: "probe-sync",
@@ -2538,7 +2539,7 @@ var DIRECTORY_INFO = {
2538
2539
  readByDiscover: true,
2539
2540
  caveat: "CDP Bazaar has no register endpoint \u2014 it catalogs a resource only when its own facilitator settles a payment. PipRail verifies locally with no facilitator, so a PipRail resource cannot be listed here (you can still READ Bazaar to find others). List on 402 Index or x402scan instead."
2540
2541
  }
2541
- };
2542
+ });
2542
2543
  function getDirectoryInfo(source) {
2543
2544
  return DIRECTORY_INFO[source];
2544
2545
  }
@@ -3123,7 +3124,7 @@ function encodeBase642(str) {
3123
3124
  }
3124
3125
 
3125
3126
  // src/policy.ts
3126
- var DENOM_PRECISION = _chunkGYM46G5Lcjs.MAX_DECIMALS;
3127
+ var DENOM_PRECISION = _chunk57V5DNJTcjs.MAX_DECIMALS;
3127
3128
  var BUILTIN_DENOMS = {
3128
3129
  USDC: "USD",
3129
3130
  USDT: "USD",
@@ -3238,7 +3239,7 @@ function evaluatePolicy(intent, policy, spentForAssetBase, ctx) {
3238
3239
  }
3239
3240
  }
3240
3241
  if (policy.maxAmount !== void 0) {
3241
- const cap = _chunkGYM46G5Lcjs.floorUnits.call(void 0, policy.maxAmount, intent.decimals);
3242
+ const cap = _chunk57V5DNJTcjs.floorUnits.call(void 0, policy.maxAmount, intent.decimals);
3242
3243
  if (intent.amountBase > cap) {
3243
3244
  return deny(
3244
3245
  "MAX_AMOUNT",
@@ -3247,7 +3248,7 @@ function evaluatePolicy(intent, policy, spentForAssetBase, ctx) {
3247
3248
  }
3248
3249
  }
3249
3250
  if (policy.maxTotal !== void 0) {
3250
- const cap = _chunkGYM46G5Lcjs.floorUnits.call(void 0, policy.maxTotal, intent.decimals);
3251
+ const cap = _chunk57V5DNJTcjs.floorUnits.call(void 0, policy.maxTotal, intent.decimals);
3251
3252
  if (spentForAssetBase + intent.amountBase > cap) {
3252
3253
  return deny(
3253
3254
  "MAX_TOTAL",
@@ -3266,7 +3267,7 @@ function evaluatePolicy(intent, policy, spentForAssetBase, ctx) {
3266
3267
  `token for ${denom} has more than ${DENOM_PRECISION} decimals \u2014 refusing to count it toward policy.maxTotalPerDenom.${denom} on trust (it can't be summed safely).`
3267
3268
  );
3268
3269
  }
3269
- const capScaled = _chunkGYM46G5Lcjs.floorUnits.call(void 0, capStr, DENOM_PRECISION);
3270
+ const capScaled = _chunk57V5DNJTcjs.floorUnits.call(void 0, capStr, DENOM_PRECISION);
3270
3271
  if ((_nullishCoalesce(ctx.spentInDenomScaled, () => ( 0n))) + thisScaled > capScaled) {
3271
3272
  return deny(
3272
3273
  "MAX_TOTAL_DENOM",
@@ -3284,7 +3285,7 @@ function evaluatePolicy(intent, policy, spentForAssetBase, ctx) {
3284
3285
  }
3285
3286
  }
3286
3287
  if (ctx && policy.windowTotal !== void 0 && policy.windowSeconds !== void 0) {
3287
- const cap = _chunkGYM46G5Lcjs.floorUnits.call(void 0, policy.windowTotal, intent.decimals);
3288
+ const cap = _chunk57V5DNJTcjs.floorUnits.call(void 0, policy.windowTotal, intent.decimals);
3288
3289
  if (ctx.spentInWindowBase + intent.amountBase > cap) {
3289
3290
  return deny(
3290
3291
  "WINDOW_TOTAL",
@@ -3350,7 +3351,7 @@ var SpendLedger = (_class = class {
3350
3351
  * read or the constructor.
3351
3352
  */
3352
3353
  isTallyable(r, decimals) {
3353
- return !!r && typeof r.amountBase === "string" && /^\d+$/.test(r.amountBase) && Number.isInteger(decimals) && decimals >= 0 && decimals <= _chunkGYM46G5Lcjs.MAX_DECIMALS;
3354
+ return !!r && typeof r.amountBase === "string" && /^\d+$/.test(r.amountBase) && Number.isInteger(decimals) && decimals >= 0 && decimals <= _chunk57V5DNJTcjs.MAX_DECIMALS;
3354
3355
  }
3355
3356
  /** Apply a record to the in-memory tallies (records + per-asset bucket + denom total).
3356
3357
  * Shared by {@link record} and constructor hydration; does NOT persist. Returns the
@@ -3487,13 +3488,13 @@ var SpendLedger = (_class = class {
3487
3488
  symbol: b.symbol,
3488
3489
  decimals: b.decimals,
3489
3490
  totalBase: b.total.toString(),
3490
- totalFormatted: _chunkGYM46G5Lcjs.formatUnits.call(void 0, b.total, b.decimals),
3491
+ totalFormatted: _chunk57V5DNJTcjs.formatUnits.call(void 0, b.total, b.decimals),
3491
3492
  count: b.count
3492
3493
  })),
3493
3494
  byDenom: [...this.denomTotals.entries()].map(([denom, scaled]) => ({
3494
3495
  denom,
3495
3496
  totalScaled: scaled.toString(),
3496
- totalFormatted: _chunkGYM46G5Lcjs.formatUnits.call(void 0, scaled, DENOM_PRECISION),
3497
+ totalFormatted: _chunk57V5DNJTcjs.formatUnits.call(void 0, scaled, DENOM_PRECISION),
3497
3498
  count: this.records.filter((r) => _optionalChain([r, 'access', _34 => _34.denom, 'optionalAccess', _35 => _35.toUpperCase, 'call', _36 => _36()]) === denom).length
3498
3499
  })),
3499
3500
  records: [...this.records]
@@ -3901,7 +3902,7 @@ var PipRailClient = (_class2 = class {
3901
3902
  const cost = await net.estimateCost(accept);
3902
3903
  return { quote, cost };
3903
3904
  } catch (err) {
3904
- if (err instanceof _chunkGYM46G5Lcjs.InvalidEnvelopeError) return null;
3905
+ if (err instanceof _chunk57V5DNJTcjs.InvalidEnvelopeError) return null;
3905
3906
  throw err;
3906
3907
  }
3907
3908
  }
@@ -3953,14 +3954,14 @@ var PipRailClient = (_class2 = class {
3953
3954
  return Object.entries(caps).map(([rawDenom, capStr]) => {
3954
3955
  const denom = rawDenom.toUpperCase();
3955
3956
  const spentScaled = this.ledger.totalForDenom(denom);
3956
- const capScaled = _chunkGYM46G5Lcjs.floorUnits.call(void 0, capStr, DENOM_PRECISION);
3957
+ const capScaled = _chunk57V5DNJTcjs.floorUnits.call(void 0, capStr, DENOM_PRECISION);
3957
3958
  const remainingScaled = capScaled > spentScaled ? capScaled - spentScaled : 0n;
3958
3959
  const fraction = capScaled === 0n ? spentScaled > 0n ? 1 : 0 : Number(spentScaled * 1000000n / capScaled) / 1e6;
3959
3960
  return {
3960
3961
  denom,
3961
- spentFormatted: _chunkGYM46G5Lcjs.formatUnits.call(void 0, spentScaled, DENOM_PRECISION),
3962
- capFormatted: _chunkGYM46G5Lcjs.formatUnits.call(void 0, capScaled, DENOM_PRECISION),
3963
- remainingFormatted: _chunkGYM46G5Lcjs.formatUnits.call(void 0, remainingScaled, DENOM_PRECISION),
3962
+ spentFormatted: _chunk57V5DNJTcjs.formatUnits.call(void 0, spentScaled, DENOM_PRECISION),
3963
+ capFormatted: _chunk57V5DNJTcjs.formatUnits.call(void 0, capScaled, DENOM_PRECISION),
3964
+ remainingFormatted: _chunk57V5DNJTcjs.formatUnits.call(void 0, remainingScaled, DENOM_PRECISION),
3964
3965
  fraction
3965
3966
  };
3966
3967
  });
@@ -4001,13 +4002,13 @@ var PipRailClient = (_class2 = class {
4001
4002
  spentBase: b.totalBase.toString()
4002
4003
  };
4003
4004
  if (maxTotal === void 0) return base2;
4004
- const capBase = _chunkGYM46G5Lcjs.floorUnits.call(void 0, maxTotal, b.decimals);
4005
+ const capBase = _chunk57V5DNJTcjs.floorUnits.call(void 0, maxTotal, b.decimals);
4005
4006
  const remainingBase = capBase > b.totalBase ? capBase - b.totalBase : 0n;
4006
4007
  return {
4007
4008
  ...base2,
4008
4009
  capBase: capBase.toString(),
4009
4010
  remainingBase: remainingBase.toString(),
4010
- remainingFormatted: _chunkGYM46G5Lcjs.formatUnits.call(void 0, remainingBase, b.decimals)
4011
+ remainingFormatted: _chunk57V5DNJTcjs.formatUnits.call(void 0, remainingBase, b.decimals)
4011
4012
  };
4012
4013
  });
4013
4014
  }
@@ -4047,11 +4048,11 @@ var PipRailClient = (_class2 = class {
4047
4048
  if (res.status !== 402) return null;
4048
4049
  const challenge = await parseChallenge(res);
4049
4050
  if (!challenge) {
4050
- throw new (0, _chunkGYM46G5Lcjs.InvalidEnvelopeError)("402 response did not include a parseable x402 challenge.");
4051
+ throw new (0, _chunk57V5DNJTcjs.InvalidEnvelopeError)("402 response did not include a parseable x402 challenge.");
4051
4052
  }
4052
4053
  const { net, wallet } = await this.ensure();
4053
4054
  if (!wallet) {
4054
- throw new (0, _chunkGYM46G5Lcjs.WalletRequiredError)(
4055
+ throw new (0, _chunk57V5DNJTcjs.WalletRequiredError)(
4055
4056
  "planPayment needs a wallet (it checks YOUR balance, gas, and recipient-readiness). This client is read-only \u2014 construct it with a `wallet` to plan or pay."
4056
4057
  );
4057
4058
  }
@@ -4227,7 +4228,7 @@ var PipRailClient = (_class2 = class {
4227
4228
  async fetch(url, init) {
4228
4229
  const body = _optionalChain([init, 'optionalAccess', _57 => _57.body]);
4229
4230
  if (body !== void 0 && body !== null && !isReplayableBodyInit(body)) {
4230
- throw new (0, _chunkGYM46G5Lcjs.NonReplayableBodyError)(
4231
+ throw new (0, _chunk57V5DNJTcjs.NonReplayableBodyError)(
4231
4232
  "fetch(): init.body is not replayable. Pass a string, FormData, URLSearchParams, ArrayBuffer, or Blob \u2014 not a ReadableStream."
4232
4233
  );
4233
4234
  }
@@ -4237,7 +4238,7 @@ var PipRailClient = (_class2 = class {
4237
4238
  const resolved = await this.resolveChallenge(url, firstResponse, schemes);
4238
4239
  const { net, wallet, challenge } = resolved;
4239
4240
  if (!wallet) {
4240
- throw new (0, _chunkGYM46G5Lcjs.WalletRequiredError)(
4241
+ throw new (0, _chunk57V5DNJTcjs.WalletRequiredError)(
4241
4242
  "Paying a 402 needs a wallet to sign + settle. This client is read-only \u2014 construct it with a `wallet` to pay (quote/discover/register still work without one)."
4242
4243
  );
4243
4244
  }
@@ -4249,7 +4250,7 @@ var PipRailClient = (_class2 = class {
4249
4250
  if (!plan.best) {
4250
4251
  const reason = _nullishCoalesce(plan.fundingHint, () => ( "No rail is settleable for this payment."));
4251
4252
  this.safeEmit({ kind: "payment-failed", reason });
4252
- throw new (0, _chunkGYM46G5Lcjs.PaymentDeclinedError)(reason);
4253
+ throw new (0, _chunk57V5DNJTcjs.PaymentDeclinedError)(reason);
4253
4254
  }
4254
4255
  accept = plan.best.accept;
4255
4256
  quote = plan.best.quote;
@@ -4263,7 +4264,7 @@ var PipRailClient = (_class2 = class {
4263
4264
  return this.payExactRail(net, wallet, accept, url, init, quote);
4264
4265
  }
4265
4266
  if (accept.scheme !== "onchain-proof") {
4266
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
4267
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
4267
4268
  `internal: unrouted accept scheme '${accept.scheme}' reached the onchain-proof pay path.`
4268
4269
  );
4269
4270
  }
@@ -4281,7 +4282,7 @@ var PipRailClient = (_class2 = class {
4281
4282
  async resolveChallenge(url, response, schemes) {
4282
4283
  const challenge = await parseChallenge(response);
4283
4284
  if (!challenge) {
4284
- throw new (0, _chunkGYM46G5Lcjs.InvalidEnvelopeError)(
4285
+ throw new (0, _chunk57V5DNJTcjs.InvalidEnvelopeError)(
4285
4286
  "402 response did not include a parseable x402 challenge."
4286
4287
  );
4287
4288
  }
@@ -4292,7 +4293,7 @@ var PipRailClient = (_class2 = class {
4292
4293
  (a) => a.scheme === "exact" && this.supportsNetwork(net, a.network)
4293
4294
  );
4294
4295
  if (schemes.includes("exact") && exactOnNet && typeof net.payExact !== "function") {
4295
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
4296
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
4296
4297
  `This 402 offers a standard 'exact' rail on ${net.network}, but the ${net.family} family can't pay 'exact' (supported on EVM, Solana, Algorand, Aptos + NEAR today), and no 'onchain-proof' rail was offered.`
4297
4298
  );
4298
4299
  }
@@ -4301,13 +4302,13 @@ var PipRailClient = (_class2 = class {
4301
4302
  (a) => a.scheme === "exact" && this.supportsNetwork(net, a.network) && net.describeAsset(a.asset) != null
4302
4303
  );
4303
4304
  if (payable) {
4304
- throw new (0, _chunkGYM46G5Lcjs.NoCompatibleAcceptError)(
4305
+ throw new (0, _chunk57V5DNJTcjs.NoCompatibleAcceptError)(
4305
4306
  `This 402 is payable only via the standard 'exact' rail on ${net.network}, which is OFF by default. Enable it: new PipRailClient({ \u2026, schemes: ['onchain-proof', 'exact'] }) or per call fetch(url, { schemes: ['exact'] }) (MCP: PIPRAIL_SCHEMES=onchain-proof,exact).`
4306
4307
  );
4307
4308
  }
4308
4309
  }
4309
4310
  const networks = [...new Set(challenge.accepts.map((a) => a.network))].join(", ");
4310
- throw new (0, _chunkGYM46G5Lcjs.NoCompatibleAcceptError)(
4311
+ throw new (0, _chunk57V5DNJTcjs.NoCompatibleAcceptError)(
4311
4312
  `No accepts[] entry payable by this client on ${net.network} (schemes: ${schemes.join(", ")}; challenge offered: ${networks || "none"}).`
4312
4313
  );
4313
4314
  }
@@ -4436,21 +4437,21 @@ var PipRailClient = (_class2 = class {
4436
4437
  if (isExact) {
4437
4438
  if (tokenKnown && bal.token < amount) {
4438
4439
  blockers.push("INSUFFICIENT_TOKEN");
4439
- shortfall.token = _chunkGYM46G5Lcjs.formatUnits.call(void 0, amount - bal.token, quote.decimals);
4440
+ shortfall.token = _chunk57V5DNJTcjs.formatUnits.call(void 0, amount - bal.token, quote.decimals);
4440
4441
  }
4441
4442
  } else if (isNative) {
4442
4443
  if (nativeKnown && bal.native < amount + fee) {
4443
4444
  blockers.push("INSUFFICIENT_TOKEN");
4444
- shortfall.token = _chunkGYM46G5Lcjs.formatUnits.call(void 0, amount + fee - bal.native, quote.decimals);
4445
+ shortfall.token = _chunk57V5DNJTcjs.formatUnits.call(void 0, amount + fee - bal.native, quote.decimals);
4445
4446
  }
4446
4447
  } else {
4447
4448
  if (tokenKnown && bal.token < amount) {
4448
4449
  blockers.push("INSUFFICIENT_TOKEN");
4449
- shortfall.token = _chunkGYM46G5Lcjs.formatUnits.call(void 0, amount - bal.token, quote.decimals);
4450
+ shortfall.token = _chunk57V5DNJTcjs.formatUnits.call(void 0, amount - bal.token, quote.decimals);
4450
4451
  }
4451
4452
  if (nativeKnown && bal.native < fee) {
4452
4453
  blockers.push("INSUFFICIENT_GAS");
4453
- shortfall.native = _chunkGYM46G5Lcjs.formatUnits.call(void 0, fee - bal.native, cost.feeDecimals);
4454
+ shortfall.native = _chunk57V5DNJTcjs.formatUnits.call(void 0, fee - bal.native, cost.feeDecimals);
4454
4455
  } else if (nativeKnown && fee > 0n && bal.native < fee * 3n / 2n) {
4455
4456
  warnings.push("THIN_GAS_MARGIN");
4456
4457
  }
@@ -4475,8 +4476,8 @@ var PipRailClient = (_class2 = class {
4475
4476
  blockers,
4476
4477
  warnings,
4477
4478
  balance: {
4478
- token: bal.token != null ? _chunkGYM46G5Lcjs.formatUnits.call(void 0, bal.token, quote.decimals) : null,
4479
- native: bal.native != null ? _chunkGYM46G5Lcjs.formatUnits.call(void 0, bal.native, cost.feeDecimals) : null
4479
+ token: bal.token != null ? _chunk57V5DNJTcjs.formatUnits.call(void 0, bal.token, quote.decimals) : null,
4480
+ native: bal.native != null ? _chunk57V5DNJTcjs.formatUnits.call(void 0, bal.native, cost.feeDecimals) : null
4480
4481
  },
4481
4482
  need: { token: quote.amountFormatted, native: cost.feeFormatted },
4482
4483
  ...shortfall.token || shortfall.native ? { shortfall } : {},
@@ -4487,12 +4488,12 @@ var PipRailClient = (_class2 = class {
4487
4488
  * driver's describeAsset) + the policy verdict + a symbol-mismatch flag. */
4488
4489
  buildQuote(net, accept, url, description) {
4489
4490
  if (typeof accept.amount !== "string" || !/^\d+$/.test(accept.amount)) {
4490
- throw new (0, _chunkGYM46G5Lcjs.InvalidEnvelopeError)(
4491
+ throw new (0, _chunk57V5DNJTcjs.InvalidEnvelopeError)(
4491
4492
  `challenge amount "${String(accept.amount)}" is not a base-unit integer string.`
4492
4493
  );
4493
4494
  }
4494
4495
  if (typeof accept.asset !== "string" || accept.asset.length === 0) {
4495
- throw new (0, _chunkGYM46G5Lcjs.InvalidEnvelopeError)(
4496
+ throw new (0, _chunk57V5DNJTcjs.InvalidEnvelopeError)(
4496
4497
  `challenge on ${accept.network} states no (string) asset \u2014 refusing to price it.`
4497
4498
  );
4498
4499
  }
@@ -4500,17 +4501,17 @@ var PipRailClient = (_class2 = class {
4500
4501
  const described = net.describeAsset(accept.asset);
4501
4502
  const decimals = _nullishCoalesce(_optionalChain([described, 'optionalAccess', _64 => _64.decimals]), () => ( _optionalChain([accept, 'access', _65 => _65.extra, 'optionalAccess', _66 => _66.decimals])));
4502
4503
  if (typeof decimals !== "number" || !Number.isInteger(decimals) || decimals < 0) {
4503
- throw new (0, _chunkGYM46G5Lcjs.InvalidEnvelopeError)(
4504
+ throw new (0, _chunk57V5DNJTcjs.InvalidEnvelopeError)(
4504
4505
  `challenge for ${accept.asset} on ${accept.network} states no valid decimals and the SDK doesn't recognise the token \u2014 refusing to price it.`
4505
4506
  );
4506
4507
  }
4507
- if (decimals > _chunkGYM46G5Lcjs.MAX_DECIMALS) {
4508
- throw new (0, _chunkGYM46G5Lcjs.InvalidEnvelopeError)(
4509
- `challenge for ${accept.asset} on ${accept.network} states ${decimals} decimals (> ${_chunkGYM46G5Lcjs.MAX_DECIMALS}) \u2014 refusing to price it (no real token is that deep).`
4508
+ if (decimals > _chunk57V5DNJTcjs.MAX_DECIMALS) {
4509
+ throw new (0, _chunk57V5DNJTcjs.InvalidEnvelopeError)(
4510
+ `challenge for ${accept.asset} on ${accept.network} states ${decimals} decimals (> ${_chunk57V5DNJTcjs.MAX_DECIMALS}) \u2014 refusing to price it (no real token is that deep).`
4510
4511
  );
4511
4512
  }
4512
4513
  const symbol = _nullishCoalesce(_optionalChain([described, 'optionalAccess', _67 => _67.symbol]), () => ( _optionalChain([accept, 'access', _68 => _68.extra, 'optionalAccess', _69 => _69.symbol])));
4513
- const amountFormatted = _chunkGYM46G5Lcjs.formatUnits.call(void 0, amountBase, decimals);
4514
+ const amountFormatted = _chunk57V5DNJTcjs.formatUnits.call(void 0, amountBase, decimals);
4514
4515
  const intent = {
4515
4516
  host: hostOf2(url),
4516
4517
  chain: this.opts.chain,
@@ -4615,7 +4616,7 @@ var PipRailClient = (_class2 = class {
4615
4616
  ...opts.quote ? { quote: opts.quote } : {},
4616
4617
  budget: this.budget()
4617
4618
  });
4618
- throw new (0, _chunkGYM46G5Lcjs.PaymentDeclinedError)(reason, {
4619
+ throw new (0, _chunk57V5DNJTcjs.PaymentDeclinedError)(reason, {
4619
4620
  ...opts.reasonCode ? { reasonCode: opts.reasonCode } : {},
4620
4621
  ...opts.cause !== void 0 ? { cause: opts.cause } : {}
4621
4622
  });
@@ -4647,7 +4648,7 @@ var PipRailClient = (_class2 = class {
4647
4648
  const max = BigInt(quote.amount);
4648
4649
  const shown = claimed < max ? claimed : max;
4649
4650
  settledBase = shown.toString();
4650
- settledFormatted = _chunkGYM46G5Lcjs.formatUnits.call(void 0, shown, quote.decimals);
4651
+ settledFormatted = _chunk57V5DNJTcjs.formatUnits.call(void 0, shown, quote.decimals);
4651
4652
  } catch (e36) {
4652
4653
  }
4653
4654
  }
@@ -4698,8 +4699,8 @@ var PipRailClient = (_class2 = class {
4698
4699
  fire(
4699
4700
  "asset",
4700
4701
  `${_nullishCoalesce(r.symbol, () => ( r.asset))} on ${r.network}`,
4701
- _chunkGYM46G5Lcjs.formatUnits.call(void 0, spent, r.decimals),
4702
- _chunkGYM46G5Lcjs.formatUnits.call(void 0, cap, r.decimals),
4702
+ _chunk57V5DNJTcjs.formatUnits.call(void 0, spent, r.decimals),
4703
+ _chunk57V5DNJTcjs.formatUnits.call(void 0, cap, r.decimals),
4703
4704
  fraction
4704
4705
  );
4705
4706
  }
@@ -4710,14 +4711,14 @@ var PipRailClient = (_class2 = class {
4710
4711
  if (_optionalChain([policy, 'optionalAccess', _75 => _75.windowTotal]) !== void 0 && policy.windowSeconds !== void 0) {
4711
4712
  const since = Date.now() - policy.windowSeconds * 1e3;
4712
4713
  for (const r of budget.byAsset) {
4713
- const cap = _chunkGYM46G5Lcjs.floorUnits.call(void 0, policy.windowTotal, r.decimals);
4714
+ const cap = _chunk57V5DNJTcjs.floorUnits.call(void 0, policy.windowTotal, r.decimals);
4714
4715
  const spent = this.ledger.totalSince(r.network, r.asset, since);
4715
4716
  const fraction = cap === 0n ? spent > 0n ? 1 : 0 : Number(spent * 1000000n / cap) / 1e6;
4716
4717
  fire(
4717
4718
  "window",
4718
4719
  `${_nullishCoalesce(r.symbol, () => ( r.asset))} on ${r.network}`,
4719
- _chunkGYM46G5Lcjs.formatUnits.call(void 0, spent, r.decimals),
4720
- _chunkGYM46G5Lcjs.formatUnits.call(void 0, cap, r.decimals),
4720
+ _chunk57V5DNJTcjs.formatUnits.call(void 0, spent, r.decimals),
4721
+ _chunk57V5DNJTcjs.formatUnits.call(void 0, cap, r.decimals),
4721
4722
  fraction
4722
4723
  );
4723
4724
  }
@@ -4738,7 +4739,7 @@ var PipRailClient = (_class2 = class {
4738
4739
  }
4739
4740
  async payAndConfirm(net, wallet, accept) {
4740
4741
  if (!this.supportsNetwork(net, accept.network)) {
4741
- throw new (0, _chunkGYM46G5Lcjs.WrongChainError)(
4742
+ throw new (0, _chunk57V5DNJTcjs.WrongChainError)(
4742
4743
  `Challenge expects ${accept.network} but client is on ${net.network}.`
4743
4744
  );
4744
4745
  }
@@ -4791,7 +4792,7 @@ var PipRailClient = (_class2 = class {
4791
4792
  });
4792
4793
  } catch (err) {
4793
4794
  if (timeoutController.signal.aborted) {
4794
- throw new (0, _chunkGYM46G5Lcjs.PaymentTimeoutError)(
4795
+ throw new (0, _chunk57V5DNJTcjs.PaymentTimeoutError)(
4795
4796
  `Server did not respond within ${this.retryTimeoutMs}ms after broadcasting payment ${ref}. Re-verify or re-submit ref=${ref} \u2014 do NOT re-pay.`,
4796
4797
  { cause: err, ref }
4797
4798
  );
@@ -4815,7 +4816,7 @@ var PipRailClient = (_class2 = class {
4815
4816
  reason: `server returned 402 after broadcasting payment ${ref}${unconfirmedNote} (${why})`,
4816
4817
  ...lastReason ? { code: lastReason.error, detail: lastReason.detail } : {}
4817
4818
  });
4818
- throw new (0, _chunkGYM46G5Lcjs.MaxRetriesExceededError)(
4819
+ throw new (0, _chunk57V5DNJTcjs.MaxRetriesExceededError)(
4819
4820
  `Server still returned 402 after ${attempts} attempt(s) with on-chain proof ref=${ref}${unconfirmedNote}. Last server rejection: ${why}. Re-verify or re-submit ref=${ref} before retrying \u2014 never re-pay (it would double-spend).`,
4820
4821
  { ref }
4821
4822
  );
@@ -4839,7 +4840,7 @@ var PipRailClient = (_class2 = class {
4839
4840
  */
4840
4841
  async payExactRail(net, wallet, accept, url, init, quote) {
4841
4842
  if (!net.payExact) {
4842
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
4843
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
4843
4844
  `the ${net.family} family can't pay a standard 'exact' rail (supported on EVM, Solana, Algorand, Aptos + NEAR today).`
4844
4845
  );
4845
4846
  }
@@ -4849,7 +4850,7 @@ var PipRailClient = (_class2 = class {
4849
4850
  headers.set(HEADER_SIGNATURE, buildExactSignatureHeader({ accepted, payload }));
4850
4851
  const rejectDefinitive = (why2) => {
4851
4852
  this.safeEmit({ kind: "payment-failed", reason: `exact: facilitator rejected nonce=${nonce} (${why2})`, code: why2 });
4852
- throw new (0, _chunkGYM46G5Lcjs.MaxRetriesExceededError)(
4853
+ throw new (0, _chunk57V5DNJTcjs.MaxRetriesExceededError)(
4853
4854
  `exact: the facilitator rejected the payment (${why2}). Fix the cause, then re-present the SAME signed authorization (nonce=${nonce}) \u2014 do NOT re-sign a fresh nonce. ref=${nonce}.`,
4854
4855
  { ref: nonce }
4855
4856
  );
@@ -4872,7 +4873,7 @@ var PipRailClient = (_class2 = class {
4872
4873
  try {
4873
4874
  response = await fetch(url, { ..._nullishCoalesce(init, () => ( {})), headers, signal });
4874
4875
  } catch (err) {
4875
- throw new (0, _chunkGYM46G5Lcjs.PaymentTimeoutError)(
4876
+ throw new (0, _chunk57V5DNJTcjs.PaymentTimeoutError)(
4876
4877
  `exact: no response after submitting the authorization (nonce=${nonce}) to ${hostOf2(url)}. The facilitator may have already settled it \u2014 verify on-chain via ${exactSettleCheckHint(net.family, payerFrom, nonce)} before re-presenting the SAME signed authorization; do NOT re-pay.`,
4877
4878
  { cause: err, ref: nonce }
4878
4879
  );
@@ -4907,7 +4908,7 @@ var PipRailClient = (_class2 = class {
4907
4908
  reason: `exact: 402 after submitting authorization nonce=${nonce} (${why})`,
4908
4909
  ...lastReason ? { code: lastReason.error, detail: lastReason.detail } : {}
4909
4910
  });
4910
- throw new (0, _chunkGYM46G5Lcjs.MaxRetriesExceededError)(
4911
+ throw new (0, _chunk57V5DNJTcjs.MaxRetriesExceededError)(
4911
4912
  `exact: server still returned 402 after submitting the signed authorization (nonce=${nonce}). Last rejection: ${why}. Re-present the SAME authorization \u2014 do NOT re-sign a fresh nonce; verify on-chain via ${exactSettleCheckHint(net.family, payerFrom, nonce)} first. ref=${nonce}.`,
4912
4913
  { ref: nonce }
4913
4914
  );
@@ -4923,7 +4924,7 @@ var PipRailClient = (_class2 = class {
4923
4924
  */
4924
4925
  async payUptoRail(net, wallet, accept, url, init, quote) {
4925
4926
  if (!net.payUpto) {
4926
- throw new (0, _chunkGYM46G5Lcjs.UnsupportedSchemeError)(
4927
+ throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
4927
4928
  `the ${net.family} family can't pay a standard 'upto' rail (EVM-Permit2 only today).`
4928
4929
  );
4929
4930
  }
@@ -4933,7 +4934,7 @@ var PipRailClient = (_class2 = class {
4933
4934
  headers.set(HEADER_SIGNATURE, buildUptoSignatureHeader({ accepted, payload }));
4934
4935
  const rejectDefinitive = (why2) => {
4935
4936
  this.safeEmit({ kind: "payment-failed", reason: `upto: facilitator rejected nonce=${nonce} (${why2})`, code: why2 });
4936
- throw new (0, _chunkGYM46G5Lcjs.MaxRetriesExceededError)(
4937
+ throw new (0, _chunk57V5DNJTcjs.MaxRetriesExceededError)(
4937
4938
  `upto: the server rejected the payment (${why2}). Fix the cause, then re-present the SAME signed authorization (nonce=${nonce}) \u2014 do NOT re-sign a fresh nonce. ref=${nonce}.`,
4938
4939
  { ref: nonce }
4939
4940
  );
@@ -4956,7 +4957,7 @@ var PipRailClient = (_class2 = class {
4956
4957
  try {
4957
4958
  response = await fetch(url, { ..._nullishCoalesce(init, () => ( {})), headers, signal });
4958
4959
  } catch (err) {
4959
- throw new (0, _chunkGYM46G5Lcjs.PaymentTimeoutError)(
4960
+ throw new (0, _chunk57V5DNJTcjs.PaymentTimeoutError)(
4960
4961
  `upto: no response after submitting the authorization (nonce=${nonce}) to ${hostOf2(url)}. The merchant may have already settled it \u2014 verify on-chain before re-presenting; do NOT re-pay.`,
4961
4962
  { cause: err, ref: nonce }
4962
4963
  );
@@ -4992,7 +4993,7 @@ var PipRailClient = (_class2 = class {
4992
4993
  reason: `upto: 402 after submitting authorization nonce=${nonce} (${why})`,
4993
4994
  ...lastReason ? { code: lastReason.error, detail: lastReason.detail } : {}
4994
4995
  });
4995
- throw new (0, _chunkGYM46G5Lcjs.MaxRetriesExceededError)(
4996
+ throw new (0, _chunk57V5DNJTcjs.MaxRetriesExceededError)(
4996
4997
  `upto: server still returned 402 after submitting the signed authorization (nonce=${nonce}). Last rejection: ${why}. Re-present the SAME authorization \u2014 do NOT re-sign a fresh nonce. ref=${nonce}.`,
4997
4998
  { ref: nonce }
4998
4999
  );
@@ -5105,7 +5106,7 @@ async function fetchAcross(clients, url, init) {
5105
5106
  const best = rankAcross(live.map((p) => p.plan)).find((o) => o.state === "payable");
5106
5107
  if (!best) {
5107
5108
  const hint = mergeDeclineHint(live.map((p) => p.plan));
5108
- throw new (0, _chunkGYM46G5Lcjs.PaymentDeclinedError)(hint || "No funded chain can settle this payment right now.");
5109
+ throw new (0, _chunk57V5DNJTcjs.PaymentDeclinedError)(hint || "No funded chain can settle this payment right now.");
5109
5110
  }
5110
5111
  const owner = live.find((p) => p.plan.options.includes(best)).client;
5111
5112
  return owner.fetch(url, { ..._nullishCoalesce(init, () => ( {})), autoRoute: true });
@@ -5505,7 +5506,7 @@ function summarizePlan(plan) {
5505
5506
  return `NOT payable: ${_nullishCoalesce(plan.fundingHint, () => ( `no settleable rail on ${plan.network}`))}`;
5506
5507
  }
5507
5508
  function explainDecline(err) {
5508
- if (!(err instanceof _chunkGYM46G5Lcjs.PipRailError)) {
5509
+ if (!(err instanceof _chunk57V5DNJTcjs.PipRailError)) {
5509
5510
  return `Payment failed: ${err instanceof Error ? err.message : String(err)}`;
5510
5511
  }
5511
5512
  switch (err.code) {
@@ -5536,14 +5537,15 @@ function formatSpendReport(summary) {
5536
5537
  return `${perAsset} \u2014 grand total: ${grand}`;
5537
5538
  }
5538
5539
  function describeChallenge(challenge) {
5539
- const first = challenge.accepts[0];
5540
+ const accepts = Array.isArray(_optionalChain([challenge, 'optionalAccess', _113 => _113.accepts])) ? challenge.accepts : [];
5541
+ const first = accepts[0];
5540
5542
  if (!first) {
5541
5543
  return `${BRAND.name} x402 payment endpoint. Pay with @piprail/sdk (${BRAND.sdkInstall}). Docs: ${BRAND.home}.`;
5542
5544
  }
5543
5545
  const extra = _nullishCoalesce(first.extra, () => ( {}));
5544
5546
  const amount = _nullishCoalesce(extra.amountFormatted, () => ( first.amount));
5545
5547
  const token = _nullishCoalesce(extra.symbol, () => ( first.asset));
5546
- const hasExact = challenge.accepts.some((a) => a.scheme === "exact");
5548
+ const hasExact = accepts.some((a) => a.scheme === "exact");
5547
5549
  const standard = hasExact ? "; or any standard x402 client (an exact rail is offered)" : "";
5548
5550
  return `${BRAND.name} x402 payment endpoint \u2014 pay ${amount} ${token} on ${first.network} to ${first.payTo}. Programmatic: ${BRAND.sdkInstall} then client.fetch(url)${standard}. Docs: ${BRAND.home}.`;
5549
5551
  }
@@ -5657,14 +5659,14 @@ async function readBody(res) {
5657
5659
  }
5658
5660
  }
5659
5661
  function toToolError(err) {
5660
- if (!(err instanceof _chunkGYM46G5Lcjs.PipRailError)) throw err;
5662
+ if (!(err instanceof _chunk57V5DNJTcjs.PipRailError)) throw err;
5661
5663
  const out = {
5662
5664
  ok: false,
5663
5665
  code: err.code,
5664
5666
  reason: err.message,
5665
5667
  explain: explainDecline(err)
5666
5668
  };
5667
- if (err instanceof _chunkGYM46G5Lcjs.PaymentDeclinedError) {
5669
+ if (err instanceof _chunk57V5DNJTcjs.PaymentDeclinedError) {
5668
5670
  out.declined = true;
5669
5671
  if (err.reasonCode) out.reasonCode = err.reasonCode;
5670
5672
  }
@@ -5880,14 +5882,14 @@ function paymentTools(client) {
5880
5882
  ...verifiable ? { verifiableReceipt: { ...verifiable, resource: { url } } } : {}
5881
5883
  };
5882
5884
  } catch (err) {
5883
- if (err instanceof _chunkGYM46G5Lcjs.PipRailError) {
5885
+ if (err instanceof _chunk57V5DNJTcjs.PipRailError) {
5884
5886
  const out = {
5885
5887
  ok: false,
5886
5888
  code: err.code,
5887
5889
  reason: err.message,
5888
5890
  explain: explainDecline(err)
5889
5891
  };
5890
- if (err instanceof _chunkGYM46G5Lcjs.PaymentDeclinedError) {
5892
+ if (err instanceof _chunk57V5DNJTcjs.PaymentDeclinedError) {
5891
5893
  out.declined = true;
5892
5894
  if (err.reasonCode) out.reasonCode = err.reasonCode;
5893
5895
  }
@@ -6035,12 +6037,14 @@ function paymentTools(client) {
6035
6037
 
6036
6038
  // src/classify.ts
6037
6039
  function classifyChallenge(challenge, opts) {
6038
- const accepts = _nullishCoalesce(challenge.accepts, () => ( []));
6040
+ const accepts = Array.isArray(_optionalChain([challenge, 'optionalAccess', _114 => _114.accepts])) ? challenge.accepts : [];
6041
+ const network = _optionalChain([opts, 'optionalAccess', _115 => _115.network]);
6042
+ const schemes = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _116 => _116.schemes]), () => ( []));
6039
6043
  const offeredSchemes = [...new Set(accepts.map((a) => a.scheme))];
6040
6044
  const offeredNetworks = [...new Set(accepts.map((a) => a.network))];
6041
- const onClientChain = accepts.some((a) => a.network === opts.network);
6045
+ const onClientChain = accepts.some((a) => a.network === network);
6042
6046
  const payableScheme = accepts.some(
6043
- (a) => a.network === opts.network && opts.schemes.includes(a.scheme)
6047
+ (a) => a.network === network && schemes.includes(a.scheme)
6044
6048
  );
6045
6049
  const verdict = accepts.length === 0 ? "NO_RAIL" : payableScheme ? "PAYABLE_RAIL" : onClientChain ? "UNPAYABLE_SCHEME" : "WRONG_CHAIN";
6046
6050
  return { onClientChain, payableScheme, offeredSchemes, offeredNetworks, verdict };
@@ -6126,9 +6130,15 @@ function buildWellKnownX402(input) {
6126
6130
  };
6127
6131
  }
6128
6132
  function buildWellKnownX402Manifest(input) {
6133
+ if (!Array.isArray(_optionalChain([input, 'optionalAccess', _117 => _117.resources]))) {
6134
+ throw new (0, _chunk57V5DNJTcjs.InvalidConfigError)(
6135
+ "buildWellKnownX402Manifest: `resources` must be an array of ResourceDescription."
6136
+ );
6137
+ }
6138
+ const lastUpdated = typeof input.lastUpdated === "number" && Number.isFinite(input.lastUpdated) ? input.lastUpdated : Math.floor(Date.now() / 1e3);
6129
6139
  return {
6130
6140
  x402Version: 2,
6131
- lastUpdated: _nullishCoalesce(input.lastUpdated, () => ( Math.floor(Date.now() / 1e3))),
6141
+ lastUpdated,
6132
6142
  items: input.resources.map((r) => ({
6133
6143
  resource: {
6134
6144
  url: r.url,
@@ -6211,10 +6221,10 @@ async function fetchFacilitatorFeePayer(url, network, timeoutMs = 8e3) {
6211
6221
  const res = await fetch(`${base2}/supported`, { signal: ctrl.signal });
6212
6222
  if (!res.ok) return void 0;
6213
6223
  const body = await res.json();
6214
- const kinds = Array.isArray(_optionalChain([body, 'optionalAccess', _113 => _113.kinds])) ? body.kinds : [];
6224
+ const kinds = Array.isArray(_optionalChain([body, 'optionalAccess', _118 => _118.kinds])) ? body.kinds : [];
6215
6225
  const want = normalizeNetwork(network);
6216
- const kind = kinds.find((k) => _optionalChain([k, 'optionalAccess', _114 => _114.scheme]) === "exact" && normalizeNetwork(String(_nullishCoalesce(_optionalChain([k, 'optionalAccess', _115 => _115.network]), () => ( "")))) === want);
6217
- const fp = _optionalChain([kind, 'optionalAccess', _116 => _116.extra, 'optionalAccess', _117 => _117.feePayer]);
6226
+ const kind = kinds.find((k) => _optionalChain([k, 'optionalAccess', _119 => _119.scheme]) === "exact" && normalizeNetwork(String(_nullishCoalesce(_optionalChain([k, 'optionalAccess', _120 => _120.network]), () => ( "")))) === want);
6227
+ const fp = _optionalChain([kind, 'optionalAccess', _121 => _121.extra, 'optionalAccess', _122 => _122.feePayer]);
6218
6228
  return typeof fp === "string" ? fp : void 0;
6219
6229
  } catch (e43) {
6220
6230
  return void 0;
@@ -6223,16 +6233,16 @@ async function fetchFacilitatorFeePayer(url, network, timeoutMs = 8e3) {
6223
6233
  }
6224
6234
  }
6225
6235
  function parseFacilitatorSupported(body) {
6226
- const kinds = _optionalChain([body, 'optionalAccess', _118 => _118.kinds]);
6236
+ const kinds = _optionalChain([body, 'optionalAccess', _123 => _123.kinds]);
6227
6237
  if (!Array.isArray(kinds)) return [];
6228
6238
  const out = [];
6229
6239
  for (const k of kinds) {
6230
6240
  if (!k || typeof k !== "object") continue;
6231
6241
  const o = k;
6232
6242
  if (typeof o.scheme !== "string" || typeof o.network !== "string") continue;
6233
- const fp = _optionalChain([o, 'access', _119 => _119.extra, 'optionalAccess', _120 => _120.feePayer]);
6243
+ const fp = _optionalChain([o, 'access', _124 => _124.extra, 'optionalAccess', _125 => _125.feePayer]);
6234
6244
  const ver = o.x402Version;
6235
- const method = _optionalChain([o, 'access', _121 => _121.extra, 'optionalAccess', _122 => _122.assetTransferMethod]);
6245
+ const method = _optionalChain([o, 'access', _126 => _126.extra, 'optionalAccess', _127 => _127.assetTransferMethod]);
6236
6246
  out.push({
6237
6247
  scheme: o.scheme,
6238
6248
  network: o.network,
@@ -6296,13 +6306,13 @@ async function settleViaFacilitator(input) {
6296
6306
  try {
6297
6307
  verify = await post(`${base2}/verify`, body, auth);
6298
6308
  } catch (err) {
6299
- throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
6309
+ throw new (0, _chunk57V5DNJTcjs.SettlementError)(
6300
6310
  `exact settle (facilitator ${base2}): /verify request failed (${err instanceof Error ? err.message : String(err)}).`,
6301
6311
  { cause: err }
6302
6312
  );
6303
6313
  }
6304
6314
  if (verify.status !== 200) {
6305
- throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
6315
+ throw new (0, _chunk57V5DNJTcjs.SettlementError)(
6306
6316
  `exact settle (facilitator ${base2}): /verify returned HTTP ${verify.status} (transport/auth error).`
6307
6317
  );
6308
6318
  }
@@ -6318,13 +6328,13 @@ async function settleViaFacilitator(input) {
6318
6328
  try {
6319
6329
  settle = await post(`${base2}/settle`, body, auth);
6320
6330
  } catch (err) {
6321
- throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
6331
+ throw new (0, _chunk57V5DNJTcjs.SettlementError)(
6322
6332
  `exact settle (facilitator ${base2}): /settle request failed (${err instanceof Error ? err.message : String(err)}).`,
6323
6333
  { cause: err }
6324
6334
  );
6325
6335
  }
6326
6336
  if (settle.status !== 200) {
6327
- throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
6337
+ throw new (0, _chunk57V5DNJTcjs.SettlementError)(
6328
6338
  `exact settle (facilitator ${base2}): /settle returned HTTP ${settle.status} (transport/auth error).`
6329
6339
  );
6330
6340
  }
@@ -6734,13 +6744,13 @@ function createPaymentGate(options) {
6734
6744
  const net = await resolveNetwork2({ chain: a.chain, rpcUrl: _nullishCoalesce(a.rpcUrl, () => ( options.rpcUrl)) });
6735
6745
  const payTo = _nullishCoalesce(a.payTo, () => ( options.payTo));
6736
6746
  if (!payTo) {
6737
- throw new Error(
6747
+ throw new (0, _chunk57V5DNJTcjs.InvalidConfigError)(
6738
6748
  `requirePayment: no payTo for chain ${net.network}. Set it on the accept entry or pass a top-level payTo.`
6739
6749
  );
6740
6750
  }
6741
6751
  net.assertValidPayTo(payTo);
6742
6752
  const { asset, decimals, symbol } = net.resolveToken(a.token);
6743
- const amountBase = _chunkGYM46G5Lcjs.parseUnits.call(void 0, a.amount, decimals);
6753
+ const amountBase = _chunk57V5DNJTcjs.parseUnits.call(void 0, a.amount, decimals);
6744
6754
  const spec = { net, asset, decimals, symbol, amountBase, amountFormatted: a.amount, payTo };
6745
6755
  if (exactOption) {
6746
6756
  const outcome = await resolveExactRail(net, asset);
@@ -6763,7 +6773,7 @@ function createPaymentGate(options) {
6763
6773
  if (exactOption && !specs.some((s) => s.exact)) {
6764
6774
  const why = exactSkips.length > 0 ? exactSkips.join(" ") : "The standard `exact` rail is EVM ERC-20 (EIP-3009 \u2014 USDC / EURC \u2014 or Permit2, e.g. Binance-Peg USDC on BNB) or a Solana SPL token (SVM) \u2014 NOT native coins, NOT families without a standard `exact` scheme.";
6765
6775
  if (exactOption.settle === "keyless") {
6766
- if (typeof process === "undefined" || !_optionalChain([process, 'optionalAccess', _123 => _123.env, 'optionalAccess', _124 => _124.PIPRAIL_NO_HINTS])) {
6776
+ if (typeof process === "undefined" || !_optionalChain([process, 'optionalAccess', _128 => _128.env, 'optionalAccess', _129 => _129.PIPRAIL_NO_HINTS])) {
6767
6777
  console.warn(
6768
6778
  `[piprail] exact: true \u2014 no offered chain has a gasless \`exact\` rail available, so this gate serves ONCHAIN-PROOF ONLY (buyers PAY GAS \u2014 the fallback when no facilitator can sponsor). ${why} To be gasless: pin \`exact: { settle: { facilitator } }\` or self-settle \`exact: { settle: 'self', relayer }\`. (Suppress with PIPRAIL_NO_HINTS=1.)`
6769
6779
  );
@@ -6791,7 +6801,7 @@ function createPaymentGate(options) {
6791
6801
  skipReason: `${net.network}: \`exact: true\` found no known keyless facilitator for this network. Pass \`exact: { settle: { facilitator } }\`, \`exact: { settle: 'self', relayer }\`, or see the coverage map (KNOWN_FACILITATORS / docs.piprail.com).`
6792
6802
  };
6793
6803
  }
6794
- if (typeof process === "undefined" || _optionalChain([process, 'optionalAccess', _125 => _125.env, 'optionalAccess', _126 => _126.NODE_ENV]) !== "production" && !_optionalChain([process, 'optionalAccess', _127 => _127.env, 'optionalAccess', _128 => _128.PIPRAIL_NO_HINTS])) {
6804
+ if (typeof process === "undefined" || _optionalChain([process, 'optionalAccess', _130 => _130.env, 'optionalAccess', _131 => _131.NODE_ENV]) !== "production" && !_optionalChain([process, 'optionalAccess', _132 => _132.env, 'optionalAccess', _133 => _133.PIPRAIL_NO_HINTS])) {
6795
6805
  console.warn(
6796
6806
  `[piprail] exact: keyless rail on ${net.network} auto-settles via ${picked.url} (zero-config; pin \`exact.settle.facilitator\` in production).`
6797
6807
  );
@@ -6935,7 +6945,7 @@ function createPaymentGate(options) {
6935
6945
  extra: {
6936
6946
  assetTransferMethod: "permit2-upto",
6937
6947
  // facilitatorAddress comes from rail.extra; the spread below carries it (+ name/version).
6938
- facilitatorAddress: _nullishCoalesce(_optionalChain([rail, 'access', _129 => _129.extra, 'optionalAccess', _130 => _130.facilitatorAddress]), () => ( "")),
6948
+ facilitatorAddress: _nullishCoalesce(_optionalChain([rail, 'access', _134 => _134.extra, 'optionalAccess', _135 => _135.facilitatorAddress]), () => ( "")),
6939
6949
  minConfirmations,
6940
6950
  decimals: s.decimals,
6941
6951
  amountFormatted: s.amountFormatted,
@@ -6970,7 +6980,7 @@ function createPaymentGate(options) {
6970
6980
  ...endpointInfo ? { endpoint: endpointInfo } : {},
6971
6981
  ...receiptsOn ? { verifiableReceipts: true } : {}
6972
6982
  });
6973
- const rejectionExt = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _131 => _131.extensions]), () => ( {}));
6983
+ const rejectionExt = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _136 => _136.extensions]), () => ( {}));
6974
6984
  const rejectionPiprail = _nullishCoalesce(rejectionExt.piprail, () => ( {}));
6975
6985
  const bodyPiprail = { ..._nullishCoalesce(selfDescribe, () => ( {})), ...rejectionPiprail };
6976
6986
  const bodyExtensions = {
@@ -6992,7 +7002,7 @@ function createPaymentGate(options) {
6992
7002
  ...options.mimeType ? { mimeType: options.mimeType } : {}
6993
7003
  },
6994
7004
  accepts,
6995
- ..._optionalChain([opts, 'optionalAccess', _132 => _132.error]) ? { error: opts.error } : {},
7005
+ ..._optionalChain([opts, 'optionalAccess', _137 => _137.error]) ? { error: opts.error } : {},
6996
7006
  ...Object.keys(bodyExtensions).length > 0 ? { extensions: bodyExtensions } : {}
6997
7007
  };
6998
7008
  const headerChallenge = {
@@ -7023,7 +7033,7 @@ function createPaymentGate(options) {
7023
7033
  function enrichReceipt(spec, receipt) {
7024
7034
  let amountFormatted = receipt.amount;
7025
7035
  try {
7026
- amountFormatted = _chunkGYM46G5Lcjs.formatUnits.call(void 0, BigInt(receipt.amount), spec.decimals);
7036
+ amountFormatted = _chunk57V5DNJTcjs.formatUnits.call(void 0, BigInt(receipt.amount), spec.decimals);
7027
7037
  } catch (e47) {
7028
7038
  }
7029
7039
  return {
@@ -7275,7 +7285,7 @@ function createPaymentGate(options) {
7275
7285
  const ftMethod = accept.extra.assetTransferMethod;
7276
7286
  const needsFeePayer = ftMethod === "svm" || ftMethod === "algorand" || ftMethod === "aptos" || ftMethod === "near";
7277
7287
  if (needsFeePayer && !accept.extra.feePayer) {
7278
- throw new (0, _chunkGYM46G5Lcjs.SettlementError)(
7288
+ throw new (0, _chunk57V5DNJTcjs.SettlementError)(
7279
7289
  `exact settle: the ${ftMethod} facilitator rail is missing extra.feePayer (the gas sponsor) \u2014 cannot settle.`
7280
7290
  );
7281
7291
  }
@@ -7323,15 +7333,15 @@ function createPaymentGate(options) {
7323
7333
  if (s.endsWith("%")) {
7324
7334
  const pct = s.slice(0, -1).trim();
7325
7335
  if (!/^\d+(\.\d+)?$/.test(pct)) return null;
7326
- const pctScaled = _chunkGYM46G5Lcjs.floorUnits.call(void 0, pct, 4);
7336
+ const pctScaled = _chunk57V5DNJTcjs.floorUnits.call(void 0, pct, 4);
7327
7337
  return maxAmount * pctScaled / (100n * 10n ** 4n);
7328
7338
  }
7329
7339
  if (s.startsWith("$")) {
7330
7340
  const amt = s.slice(1).trim();
7331
- return _chunkGYM46G5Lcjs.floorUnits.call(void 0, amt, decimals);
7341
+ return _chunk57V5DNJTcjs.floorUnits.call(void 0, amt, decimals);
7332
7342
  }
7333
7343
  if (/^\d+$/.test(s)) return BigInt(s);
7334
- return _chunkGYM46G5Lcjs.floorUnits.call(void 0, s, decimals);
7344
+ return _chunk57V5DNJTcjs.floorUnits.call(void 0, s, decimals);
7335
7345
  } catch (e56) {
7336
7346
  return null;
7337
7347
  }
@@ -7382,7 +7392,7 @@ function createPaymentGate(options) {
7382
7392
  result = await spec.net.settleUptoSelf({ relayer, payload: upto.payload, accept, settleAmount });
7383
7393
  } catch (err) {
7384
7394
  await settleTx(nonce, false);
7385
- if (err instanceof _chunkGYM46G5Lcjs.SettlementError) throw err;
7395
+ if (err instanceof _chunk57V5DNJTcjs.SettlementError) throw err;
7386
7396
  return rejection(
7387
7397
  "tx_reverted",
7388
7398
  `upto: metering/settle failed (${err instanceof Error ? err.message : String(err)}).`
@@ -7461,7 +7471,7 @@ function createPaymentGate(options) {
7461
7471
  }
7462
7472
  function requirePayment(options) {
7463
7473
  if (options.upto) {
7464
- throw new (_class3 = class extends _chunkGYM46G5Lcjs.PipRailError {constructor(...args2) { super(...args2); _class3.prototype.__init7.call(this); }
7474
+ throw new (_class3 = class extends _chunk57V5DNJTcjs.PipRailError {constructor(...args2) { super(...args2); _class3.prototype.__init7.call(this); }
7465
7475
  __init7() {this.code = "UNSUPPORTED_SCHEME"}
7466
7476
  }, _class3)(
7467
7477
  "requirePayment: the 'upto' (metered) rail is unsupported through the Express middleware \u2014 it settles before the route handler serves, so metered usage is unknown at settle time. Call gate.verify() directly (createPaymentGate) and meter inside settleAmount; see docs/accepting-payments/upto-rail-seller.md."
@@ -7473,7 +7483,7 @@ function requirePayment(options) {
7473
7483
  try {
7474
7484
  result = await gate.verify(_nullishCoalesce(req.headers[HEADER_SIGNATURE], () => ( req.headers[HEADER_SIGNATURE_V1])));
7475
7485
  } catch (err) {
7476
- if (err instanceof _chunkGYM46G5Lcjs.SettlementError) {
7486
+ if (err instanceof _chunk57V5DNJTcjs.SettlementError) {
7477
7487
  res.status(502);
7478
7488
  res.json({
7479
7489
  x402Version: 2,
@@ -7521,7 +7531,7 @@ function isRetryableStatus(status) {
7521
7531
  }
7522
7532
  var sleep = (ms) => ms > 0 ? new Promise((resolve) => setTimeout(resolve, ms)) : Promise.resolve();
7523
7533
  async function signBody(secret, body) {
7524
- const subtle = _optionalChain([globalThis, 'access', _133 => _133.crypto, 'optionalAccess', _134 => _134.subtle]);
7534
+ const subtle = _optionalChain([globalThis, 'access', _138 => _138.crypto, 'optionalAccess', _139 => _139.subtle]);
7525
7535
  if (!subtle) return null;
7526
7536
  try {
7527
7537
  const enc = new TextEncoder();
@@ -7591,7 +7601,7 @@ async function deliverReceipt(receipt, options) {
7591
7601
  const retryable = status === void 0 ? true : isRetryableStatus(status);
7592
7602
  const willRetry = !ok && retryable && attempt < maxAttempts;
7593
7603
  try {
7594
- _optionalChain([onAttempt, 'optionalCall', _135 => _135({ attempt, ok, ...status !== void 0 ? { status } : {}, ...error ? { error } : {}, willRetry })]);
7604
+ _optionalChain([onAttempt, 'optionalCall', _140 => _140({ attempt, ok, ...status !== void 0 ? { status } : {}, ...error ? { error } : {}, willRetry })]);
7595
7605
  } catch (e59) {
7596
7606
  }
7597
7607
  if (ok) return { delivered: true, attempts: attempt, status };
@@ -7680,13 +7690,13 @@ function toA2APaymentFailed(code, detail, receipts = [], network) {
7680
7690
  };
7681
7691
  }
7682
7692
  function fromA2APaymentRequired(task) {
7683
- const meta = _optionalChain([task, 'access', _136 => _136.status, 'optionalAccess', _137 => _137.message, 'optionalAccess', _138 => _138.metadata]);
7684
- const required = _optionalChain([meta, 'optionalAccess', _139 => _139[A2A_REQUIRED_KEY]]);
7693
+ const meta = _optionalChain([task, 'access', _141 => _141.status, 'optionalAccess', _142 => _142.message, 'optionalAccess', _143 => _143.metadata]);
7694
+ const required = _optionalChain([meta, 'optionalAccess', _144 => _144[A2A_REQUIRED_KEY]]);
7685
7695
  if (!required || typeof required !== "object") return null;
7686
7696
  return required;
7687
7697
  }
7688
7698
  function fromA2APaymentPayload(message) {
7689
- const raw = _optionalChain([message, 'access', _140 => _140.metadata, 'optionalAccess', _141 => _141[A2A_PAYLOAD_KEY]]);
7699
+ const raw = _optionalChain([message, 'access', _145 => _145.metadata, 'optionalAccess', _146 => _146[A2A_PAYLOAD_KEY]]);
7690
7700
  if (raw === void 0 || raw === null) return null;
7691
7701
  return { raw, taskId: _nullishCoalesce(message.taskId, () => ( "")) };
7692
7702
  }
@@ -7719,7 +7729,7 @@ function createA2APaymentHandler(options) {
7719
7729
  const ttlMs = _nullishCoalesce(options.taskTtlMs, () => ( maxTimeoutSeconds * 1e3));
7720
7730
  const store = _nullishCoalesce(options.taskStore, () => ( defaultTaskStore()));
7721
7731
  function appendReceipt(taskId, entry) {
7722
- const prior = _nullishCoalesce(_optionalChain([store, 'access', _142 => _142.get, 'call', _143 => _143(taskId), 'optionalAccess', _144 => _144.receipts]), () => ( []));
7732
+ const prior = _nullishCoalesce(_optionalChain([store, 'access', _147 => _147.get, 'call', _148 => _148(taskId), 'optionalAccess', _149 => _149.receipts]), () => ( []));
7723
7733
  const isDup = "success" in entry && entry.success === true && entry.transaction !== "" && prior.some((r) => "transaction" in r && r.transaction === entry.transaction);
7724
7734
  const next = isDup ? prior : [...prior, entry];
7725
7735
  const receipts = next.length > MAX_TASK_RECEIPTS ? next.slice(-MAX_TASK_RECEIPTS) : next;
@@ -7795,7 +7805,7 @@ function createA2APaymentHandler(options) {
7795
7805
  try {
7796
7806
  result = await gate.verifyObject(inbound.raw);
7797
7807
  } catch (err) {
7798
- if (err instanceof _chunkGYM46G5Lcjs.SettlementError) {
7808
+ if (err instanceof _chunk57V5DNJTcjs.SettlementError) {
7799
7809
  return failedTask(id, "settlement_failed", err.message, attempted);
7800
7810
  }
7801
7811
  const detail = err instanceof Error ? err.message : String(err);
@@ -7827,11 +7837,11 @@ function createA2APaymentHandler(options) {
7827
7837
  }
7828
7838
  }
7829
7839
  function agentCardExtension(opts) {
7830
- const uri = _optionalChain([opts, 'optionalAccess', _145 => _145.version]) === "v0.2" ? A2A_X402_EXTENSION_URI_V02 : A2A_X402_EXTENSION_URI_V01;
7840
+ const uri = _optionalChain([opts, 'optionalAccess', _150 => _150.version]) === "v0.2" ? A2A_X402_EXTENSION_URI_V02 : A2A_X402_EXTENSION_URI_V01;
7831
7841
  return {
7832
7842
  uri,
7833
7843
  description: "Supports payments using the x402 protocol for on-chain settlement.",
7834
- ..._optionalChain([opts, 'optionalAccess', _146 => _146.required]) ? { required: true } : {}
7844
+ ..._optionalChain([opts, 'optionalAccess', _151 => _151.required]) ? { required: true } : {}
7835
7845
  };
7836
7846
  }
7837
7847
  return { handleMessage, agentCardExtension, gate };
@@ -7842,7 +7852,7 @@ function singleNetworkOf(challenge) {
7842
7852
  }
7843
7853
  function networkFromPayload(raw) {
7844
7854
  const v = raw;
7845
- if (v && typeof _optionalChain([v, 'access', _147 => _147.accepted, 'optionalAccess', _148 => _148.network]) === "string") return v.accepted.network;
7855
+ if (v && typeof _optionalChain([v, 'access', _152 => _152.accepted, 'optionalAccess', _153 => _153.network]) === "string") return v.accepted.network;
7846
7856
  if (v && typeof v.network === "string") return v.network;
7847
7857
  return void 0;
7848
7858
  }
@@ -7884,7 +7894,7 @@ function toMcpPaymentResponse(content, receipt) {
7884
7894
  };
7885
7895
  }
7886
7896
  function fromMcpPayment(params) {
7887
- const meta = _optionalChain([params, 'optionalAccess', _149 => _149._meta, 'optionalAccess', _150 => _150[MCP_PAYMENT_META_KEY]]);
7897
+ const meta = _optionalChain([params, 'optionalAccess', _154 => _154._meta, 'optionalAccess', _155 => _155[MCP_PAYMENT_META_KEY]]);
7888
7898
  return meta == null ? null : meta;
7889
7899
  }
7890
7900
  function fromMcpPaymentRequired(result) {
@@ -7893,7 +7903,7 @@ function fromMcpPaymentRequired(result) {
7893
7903
  if (sc && typeof sc === "object" && typeof sc.x402Version === "number") {
7894
7904
  return sc;
7895
7905
  }
7896
- const text = _optionalChain([result, 'access', _151 => _151.content, 'optionalAccess', _152 => _152[0], 'optionalAccess', _153 => _153.text]);
7906
+ const text = _optionalChain([result, 'access', _156 => _156.content, 'optionalAccess', _157 => _157[0], 'optionalAccess', _158 => _158.text]);
7897
7907
  if (typeof text === "string") {
7898
7908
  try {
7899
7909
  const parsed = JSON.parse(text);
@@ -7909,7 +7919,7 @@ function isMcpPaymentRequired(result) {
7909
7919
  return fromMcpPaymentRequired(result) != null;
7910
7920
  }
7911
7921
  function fromMcpPaymentResponse(result) {
7912
- const meta = _optionalChain([result, 'optionalAccess', _154 => _154._meta, 'optionalAccess', _155 => _155[MCP_PAYMENT_RESPONSE_META_KEY]]);
7922
+ const meta = _optionalChain([result, 'optionalAccess', _159 => _159._meta, 'optionalAccess', _160 => _160[MCP_PAYMENT_RESPONSE_META_KEY]]);
7913
7923
  if (!meta || typeof meta !== "object") return null;
7914
7924
  return meta;
7915
7925
  }
@@ -7946,7 +7956,7 @@ function createMcpPaymentTool(options) {
7946
7956
  try {
7947
7957
  result = await gate.verifyObject(raw);
7948
7958
  } catch (err) {
7949
- if (err instanceof _chunkGYM46G5Lcjs.SettlementError) return settlementFailed("settlement_failed", err.message);
7959
+ if (err instanceof _chunk57V5DNJTcjs.SettlementError) return settlementFailed("settlement_failed", err.message);
7950
7960
  throw err;
7951
7961
  }
7952
7962
  if (result.kind === "paid") {
@@ -8112,4 +8122,5 @@ function createMcpPaymentTool(options) {
8112
8122
 
8113
8123
 
8114
8124
 
8115
- exports.A2A_ERROR_KEY = A2A_ERROR_KEY; exports.A2A_EXTENSIONS_HEADER = A2A_EXTENSIONS_HEADER; exports.A2A_PAYLOAD_KEY = A2A_PAYLOAD_KEY; exports.A2A_RECEIPTS_KEY = A2A_RECEIPTS_KEY; exports.A2A_REQUIRED_KEY = A2A_REQUIRED_KEY; exports.A2A_STATUS_KEY = A2A_STATUS_KEY; exports.A2A_X402_EXTENSION_URI_V01 = A2A_X402_EXTENSION_URI_V01; exports.A2A_X402_EXTENSION_URI_V02 = A2A_X402_EXTENSION_URI_V02; exports.BRAND = BRAND; exports.BUILTIN_DENOMS = BUILTIN_DENOMS; exports.CHAINS = CHAINS; exports.ConfirmationTimeoutError = _chunkGYM46G5Lcjs.ConfirmationTimeoutError; exports.DENOM_PRECISION = DENOM_PRECISION; exports.DIRECTORY_INFO = DIRECTORY_INFO; exports.EIP3009_TYPES = EIP3009_TYPES; exports.EXACT_NETWORK_SLUGS = EXACT_NETWORK_SLUGS; exports.EXT_OFFER_RECEIPT = EXT_OFFER_RECEIPT; exports.EXT_PAYMENT_IDENTIFIER = EXT_PAYMENT_IDENTIFIER; exports.GENERATOR = GENERATOR; exports.HEADER_REQUIRED = HEADER_REQUIRED; exports.HEADER_RESPONSE = HEADER_RESPONSE; exports.HEADER_RESPONSE_V1 = HEADER_RESPONSE_V1; exports.HEADER_SIGNATURE = HEADER_SIGNATURE; exports.HEADER_SIGNATURE_V1 = HEADER_SIGNATURE_V1; exports.InsufficientFundsError = _chunkGYM46G5Lcjs.InsufficientFundsError; exports.InvalidEnvelopeError = _chunkGYM46G5Lcjs.InvalidEnvelopeError; exports.KNOWN_FACILITATORS = KNOWN_FACILITATORS; exports.MCP_PAYMENT_META_KEY = MCP_PAYMENT_META_KEY; exports.MCP_PAYMENT_RESPONSE_META_KEY = MCP_PAYMENT_RESPONSE_META_KEY; exports.MaxRetriesExceededError = _chunkGYM46G5Lcjs.MaxRetriesExceededError; exports.MissingDriverError = _chunkGYM46G5Lcjs.MissingDriverError; exports.MultiChainPayer = MultiChainPayer; exports.NoCompatibleAcceptError = _chunkGYM46G5Lcjs.NoCompatibleAcceptError; exports.NonReplayableBodyError = _chunkGYM46G5Lcjs.NonReplayableBodyError; exports.PERMIT2_ADDRESS = PERMIT2_ADDRESS; exports.PERMIT2_PROXY_CHAIN_IDS = PERMIT2_PROXY_CHAIN_IDS; exports.PERMIT2_UPTO_WITNESS_TYPES = PERMIT2_UPTO_WITNESS_TYPES; exports.PERMIT2_WITNESS_TYPES = PERMIT2_WITNESS_TYPES; exports.PIPRAIL_AGENT_GUIDE = PIPRAIL_AGENT_GUIDE; exports.POWERED_BY = POWERED_BY; exports.PaymentDeclinedError = _chunkGYM46G5Lcjs.PaymentDeclinedError; exports.PaymentTimeoutError = _chunkGYM46G5Lcjs.PaymentTimeoutError; exports.PipRailClient = PipRailClient; exports.PipRailError = _chunkGYM46G5Lcjs.PipRailError; exports.REGISTER_ATTRIBUTION = REGISTER_ATTRIBUTION; exports.RecipientNotReadyError = _chunkGYM46G5Lcjs.RecipientNotReadyError; exports.SettlementError = _chunkGYM46G5Lcjs.SettlementError; exports.SpendLedger = SpendLedger; exports.UPTO_PROXY_CHAIN_IDS = UPTO_PROXY_CHAIN_IDS; exports.UnknownTokenError = _chunkGYM46G5Lcjs.UnknownTokenError; exports.UnsupportedNetworkError = _chunkGYM46G5Lcjs.UnsupportedNetworkError; exports.UnsupportedSchemeError = _chunkGYM46G5Lcjs.UnsupportedSchemeError; exports.VERIFY_CODE_TO_A2A_ERROR = VERIFY_CODE_TO_A2A_ERROR; exports.WalletRequiredError = _chunkGYM46G5Lcjs.WalletRequiredError; exports.WrongChainError = _chunkGYM46G5Lcjs.WrongChainError; exports.WrongFamilyError = _chunkGYM46G5Lcjs.WrongFamilyError; exports.X402_EXACT_PERMIT2_PROXY = X402_EXACT_PERMIT2_PROXY; exports.X402_UPTO_PERMIT2_PROXY = X402_UPTO_PERMIT2_PROXY; exports.agentGuide = agentGuide; exports.appendAttribution = appendAttribution; exports.appendKeywords = appendKeywords; exports.buildBazaarExtension = buildBazaarExtension; exports.buildChallengeHeader = buildChallengeHeader; exports.buildEndpointInfo = buildEndpointInfo; exports.buildExactAuthorization = buildExactAuthorization; exports.buildExactSignatureHeader = buildExactSignatureHeader; exports.buildMcpPaymentMeta = buildMcpPaymentMeta; exports.buildOpenApi = buildOpenApi; exports.buildPaymentIdentifierAdvertisement = buildPaymentIdentifierAdvertisement; exports.buildReceiptExtension = buildReceiptExtension; exports.buildReceiptHeader = buildReceiptHeader; exports.buildSelfDescription = buildSelfDescription; exports.buildSignatureHeader = buildSignatureHeader; exports.buildUptoSignatureHeader = buildUptoSignatureHeader; exports.buildWellKnownX402 = buildWellKnownX402; exports.buildWellKnownX402Manifest = buildWellKnownX402Manifest; exports.buildX402DnsTxt = buildX402DnsTxt; exports.chainIdForExactNetwork = chainIdForExactNetwork; exports.claim402IndexDomain = claim402IndexDomain; exports.classifyChallenge = classifyChallenge; exports.createA2APaymentHandler = createA2APaymentHandler; exports.createMcpPaymentTool = createMcpPaymentTool; exports.createPaymentGate = createPaymentGate; exports.decodeBase64Json = decodeBase64Json; exports.decorateOutcome = decorateOutcome; exports.deliverReceipt = deliverReceipt; exports.denomOf = denomOf; exports.describeChallenge = describeChallenge; exports.discoveryHeaders = discoveryHeaders; exports.eip3009Abi = eip3009Abi; exports.encodeXPaymentHeader = encodeXPaymentHeader; exports.evaluatePolicy = evaluatePolicy; exports.explainDecline = explainDecline; exports.facilitatorCoverage = facilitatorCoverage; exports.fetchAcross = fetchAcross; exports.firstKeylessFacilitator = firstKeylessFacilitator; exports.formatSpendReport = formatSpendReport; exports.fromA2APaymentPayload = fromA2APaymentPayload; exports.fromA2APaymentRequired = fromA2APaymentRequired; exports.fromMcpPayment = fromMcpPayment; exports.fromMcpPaymentRequired = fromMcpPaymentRequired; exports.fromMcpPaymentResponse = fromMcpPaymentResponse; exports.getDirectoryInfo = getDirectoryInfo; exports.isMcpPaymentRequired = isMcpPaymentRequired; exports.isPermit2ProxyChain = isPermit2ProxyChain; exports.isUptoProxyChain = isUptoProxyChain; exports.knownFacilitatorsFor = knownFacilitatorsFor; exports.memorySpendStore = _chunkO4UQOZ4Zcjs.memorySpendStore; exports.normalizeNetwork = normalizeNetwork; exports.parseChallenge = parseChallenge; exports.parseExactObject = parseExactObject; exports.parseExactPaymentHeader = parseExactPaymentHeader; exports.parseExactRequirements = parseExactRequirements; exports.parseFacilitatorSupported = parseFacilitatorSupported; exports.parseReceipt = parseReceipt; exports.parseReceiptExtension = parseReceiptExtension; exports.parseSettleResponse = parseSettleResponse; exports.parseSignatureHeader = parseSignatureHeader; exports.parseSignatureObject = parseSignatureObject; exports.parseUptoObject = parseUptoObject; exports.parseUptoPaymentHeader = parseUptoPaymentHeader; exports.paymentTools = paymentTools; exports.pickAccept = pickAccept; exports.planAcross = planAcross; exports.rankResources = rankResources; exports.readExactDomain = readExactDomain; exports.readPaymentIdentifier = readPaymentIdentifier; exports.register402Index = register402Index; exports.registerDriver = registerDriver; exports.registerX402Scan = registerX402Scan; exports.renderLandingPage = renderLandingPage; exports.requirePayment = requirePayment; exports.resolveChain = resolveChain; exports.scoreResource = scoreResource; exports.searchOpenIndexes = searchOpenIndexes; exports.settleViaFacilitator = settleViaFacilitator; exports.summarizePlan = summarizePlan; exports.toA2AErrorCode = toA2AErrorCode; exports.toA2APaymentFailed = toA2APaymentFailed; exports.toA2APaymentReceipts = toA2APaymentReceipts; exports.toA2APaymentRequired = toA2APaymentRequired; exports.toInsufficientFundsError = _chunkGYM46G5Lcjs.toInsufficientFundsError; exports.toInvalidBody = toInvalidBody; exports.toMcpPaymentRequired = toMcpPaymentRequired; exports.toMcpPaymentResponse = toMcpPaymentResponse; exports.verify402IndexDomain = verify402IndexDomain;
8125
+
8126
+ exports.A2A_ERROR_KEY = A2A_ERROR_KEY; exports.A2A_EXTENSIONS_HEADER = A2A_EXTENSIONS_HEADER; exports.A2A_PAYLOAD_KEY = A2A_PAYLOAD_KEY; exports.A2A_RECEIPTS_KEY = A2A_RECEIPTS_KEY; exports.A2A_REQUIRED_KEY = A2A_REQUIRED_KEY; exports.A2A_STATUS_KEY = A2A_STATUS_KEY; exports.A2A_X402_EXTENSION_URI_V01 = A2A_X402_EXTENSION_URI_V01; exports.A2A_X402_EXTENSION_URI_V02 = A2A_X402_EXTENSION_URI_V02; exports.BRAND = BRAND; exports.BUILTIN_DENOMS = BUILTIN_DENOMS; exports.CHAINS = CHAINS; exports.ConfirmationTimeoutError = _chunk57V5DNJTcjs.ConfirmationTimeoutError; exports.DENOM_PRECISION = DENOM_PRECISION; exports.DIRECTORY_INFO = DIRECTORY_INFO; exports.EIP3009_TYPES = EIP3009_TYPES; exports.EXACT_NETWORK_SLUGS = EXACT_NETWORK_SLUGS; exports.EXT_OFFER_RECEIPT = EXT_OFFER_RECEIPT; exports.EXT_PAYMENT_IDENTIFIER = EXT_PAYMENT_IDENTIFIER; exports.GENERATOR = GENERATOR; exports.HEADER_REQUIRED = HEADER_REQUIRED; exports.HEADER_RESPONSE = HEADER_RESPONSE; exports.HEADER_RESPONSE_V1 = HEADER_RESPONSE_V1; exports.HEADER_SIGNATURE = HEADER_SIGNATURE; exports.HEADER_SIGNATURE_V1 = HEADER_SIGNATURE_V1; exports.InsufficientFundsError = _chunk57V5DNJTcjs.InsufficientFundsError; exports.InvalidConfigError = _chunk57V5DNJTcjs.InvalidConfigError; exports.InvalidEnvelopeError = _chunk57V5DNJTcjs.InvalidEnvelopeError; exports.KNOWN_FACILITATORS = KNOWN_FACILITATORS; exports.MCP_PAYMENT_META_KEY = MCP_PAYMENT_META_KEY; exports.MCP_PAYMENT_RESPONSE_META_KEY = MCP_PAYMENT_RESPONSE_META_KEY; exports.MaxRetriesExceededError = _chunk57V5DNJTcjs.MaxRetriesExceededError; exports.MissingDriverError = _chunk57V5DNJTcjs.MissingDriverError; exports.MultiChainPayer = MultiChainPayer; exports.NoCompatibleAcceptError = _chunk57V5DNJTcjs.NoCompatibleAcceptError; exports.NonReplayableBodyError = _chunk57V5DNJTcjs.NonReplayableBodyError; exports.PERMIT2_ADDRESS = PERMIT2_ADDRESS; exports.PERMIT2_PROXY_CHAIN_IDS = PERMIT2_PROXY_CHAIN_IDS; exports.PERMIT2_UPTO_WITNESS_TYPES = PERMIT2_UPTO_WITNESS_TYPES; exports.PERMIT2_WITNESS_TYPES = PERMIT2_WITNESS_TYPES; exports.PIPRAIL_AGENT_GUIDE = PIPRAIL_AGENT_GUIDE; exports.POWERED_BY = POWERED_BY; exports.PaymentDeclinedError = _chunk57V5DNJTcjs.PaymentDeclinedError; exports.PaymentTimeoutError = _chunk57V5DNJTcjs.PaymentTimeoutError; exports.PipRailClient = PipRailClient; exports.PipRailError = _chunk57V5DNJTcjs.PipRailError; exports.REGISTER_ATTRIBUTION = REGISTER_ATTRIBUTION; exports.RecipientNotReadyError = _chunk57V5DNJTcjs.RecipientNotReadyError; exports.SettlementError = _chunk57V5DNJTcjs.SettlementError; exports.SpendLedger = SpendLedger; exports.UPTO_PROXY_CHAIN_IDS = UPTO_PROXY_CHAIN_IDS; exports.UnknownTokenError = _chunk57V5DNJTcjs.UnknownTokenError; exports.UnsupportedNetworkError = _chunk57V5DNJTcjs.UnsupportedNetworkError; exports.UnsupportedSchemeError = _chunk57V5DNJTcjs.UnsupportedSchemeError; exports.VERIFY_CODE_TO_A2A_ERROR = VERIFY_CODE_TO_A2A_ERROR; exports.WalletRequiredError = _chunk57V5DNJTcjs.WalletRequiredError; exports.WrongChainError = _chunk57V5DNJTcjs.WrongChainError; exports.WrongFamilyError = _chunk57V5DNJTcjs.WrongFamilyError; exports.X402_EXACT_PERMIT2_PROXY = X402_EXACT_PERMIT2_PROXY; exports.X402_UPTO_PERMIT2_PROXY = X402_UPTO_PERMIT2_PROXY; exports.agentGuide = agentGuide; exports.appendAttribution = appendAttribution; exports.appendKeywords = appendKeywords; exports.buildBazaarExtension = buildBazaarExtension; exports.buildChallengeHeader = buildChallengeHeader; exports.buildEndpointInfo = buildEndpointInfo; exports.buildExactAuthorization = buildExactAuthorization; exports.buildExactSignatureHeader = buildExactSignatureHeader; exports.buildMcpPaymentMeta = buildMcpPaymentMeta; exports.buildOpenApi = buildOpenApi; exports.buildPaymentIdentifierAdvertisement = buildPaymentIdentifierAdvertisement; exports.buildReceiptExtension = buildReceiptExtension; exports.buildReceiptHeader = buildReceiptHeader; exports.buildSelfDescription = buildSelfDescription; exports.buildSignatureHeader = buildSignatureHeader; exports.buildUptoSignatureHeader = buildUptoSignatureHeader; exports.buildWellKnownX402 = buildWellKnownX402; exports.buildWellKnownX402Manifest = buildWellKnownX402Manifest; exports.buildX402DnsTxt = buildX402DnsTxt; exports.chainIdForExactNetwork = chainIdForExactNetwork; exports.claim402IndexDomain = claim402IndexDomain; exports.classifyChallenge = classifyChallenge; exports.createA2APaymentHandler = createA2APaymentHandler; exports.createMcpPaymentTool = createMcpPaymentTool; exports.createPaymentGate = createPaymentGate; exports.decodeBase64Json = decodeBase64Json; exports.decorateOutcome = decorateOutcome; exports.deliverReceipt = deliverReceipt; exports.denomOf = denomOf; exports.describeChallenge = describeChallenge; exports.discoveryHeaders = discoveryHeaders; exports.eip3009Abi = eip3009Abi; exports.encodeXPaymentHeader = encodeXPaymentHeader; exports.evaluatePolicy = evaluatePolicy; exports.explainDecline = explainDecline; exports.facilitatorCoverage = facilitatorCoverage; exports.fetchAcross = fetchAcross; exports.firstKeylessFacilitator = firstKeylessFacilitator; exports.formatSpendReport = formatSpendReport; exports.fromA2APaymentPayload = fromA2APaymentPayload; exports.fromA2APaymentRequired = fromA2APaymentRequired; exports.fromMcpPayment = fromMcpPayment; exports.fromMcpPaymentRequired = fromMcpPaymentRequired; exports.fromMcpPaymentResponse = fromMcpPaymentResponse; exports.getDirectoryInfo = getDirectoryInfo; exports.isMcpPaymentRequired = isMcpPaymentRequired; exports.isPermit2ProxyChain = isPermit2ProxyChain; exports.isUptoProxyChain = isUptoProxyChain; exports.knownFacilitatorsFor = knownFacilitatorsFor; exports.memorySpendStore = _chunkO4UQOZ4Zcjs.memorySpendStore; exports.normalizeNetwork = normalizeNetwork; exports.parseChallenge = parseChallenge; exports.parseExactObject = parseExactObject; exports.parseExactPaymentHeader = parseExactPaymentHeader; exports.parseExactRequirements = parseExactRequirements; exports.parseFacilitatorSupported = parseFacilitatorSupported; exports.parseReceipt = parseReceipt; exports.parseReceiptExtension = parseReceiptExtension; exports.parseSettleResponse = parseSettleResponse; exports.parseSignatureHeader = parseSignatureHeader; exports.parseSignatureObject = parseSignatureObject; exports.parseUptoObject = parseUptoObject; exports.parseUptoPaymentHeader = parseUptoPaymentHeader; exports.paymentTools = paymentTools; exports.pickAccept = pickAccept; exports.planAcross = planAcross; exports.rankResources = rankResources; exports.readExactDomain = readExactDomain; exports.readPaymentIdentifier = readPaymentIdentifier; exports.register402Index = register402Index; exports.registerDriver = registerDriver; exports.registerX402Scan = registerX402Scan; exports.renderLandingPage = renderLandingPage; exports.requirePayment = requirePayment; exports.resolveChain = resolveChain; exports.scoreResource = scoreResource; exports.searchOpenIndexes = searchOpenIndexes; exports.settleViaFacilitator = settleViaFacilitator; exports.summarizePlan = summarizePlan; exports.toA2AErrorCode = toA2AErrorCode; exports.toA2APaymentFailed = toA2APaymentFailed; exports.toA2APaymentReceipts = toA2APaymentReceipts; exports.toA2APaymentRequired = toA2APaymentRequired; exports.toInsufficientFundsError = _chunk57V5DNJTcjs.toInsufficientFundsError; exports.toInvalidBody = toInvalidBody; exports.toMcpPaymentRequired = toMcpPaymentRequired; exports.toMcpPaymentResponse = toMcpPaymentResponse; exports.verify402IndexDomain = verify402IndexDomain;