@piprail/sdk 2.14.1 → 2.14.2

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
@@ -32,7 +32,7 @@ var _chunkCQQI5IJXcjs = require('./chunk-CQQI5IJX.cjs');
32
32
 
33
33
 
34
34
 
35
- var _chunk57V5DNJTcjs = require('./chunk-57V5DNJT.cjs');
35
+ var _chunk3FR22M3Ocjs = require('./chunk-3FR22M3O.cjs');
36
36
 
37
37
  // src/drivers/registry.ts
38
38
  var byFamily = /* @__PURE__ */ new Map();
@@ -61,13 +61,13 @@ function resolveNetwork(opts) {
61
61
  const family = familyForChain(opts.chain);
62
62
  const driver = byFamily.get(family);
63
63
  if (!driver) {
64
- throw new (0, _chunk57V5DNJTcjs.UnsupportedNetworkError)(
64
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedNetworkError)(
65
65
  `No driver registered for the "${family}" family \u2014 it may not be mounted yet (use the async resolveNetwork()).`
66
66
  );
67
67
  }
68
68
  const net = driver.resolve(opts);
69
69
  if (!net) {
70
- throw new (0, _chunk57V5DNJTcjs.UnsupportedNetworkError)(
70
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedNetworkError)(
71
71
  `The ${family} driver didn't recognise this chain input.`
72
72
  );
73
73
  }
@@ -332,12 +332,12 @@ function resolveChain(input, rpcUrlOverride) {
332
332
 
333
333
  var _accounts = require('viem/accounts');
334
334
  function createWalletAdapter(config, resolved) {
335
- _chunk57V5DNJTcjs.assertNoLegacyWalletKey.call(void 0, config, "EVM");
335
+ _chunk3FR22M3Ocjs.assertNoLegacyWalletKey.call(void 0, config, "EVM");
336
336
  if ("key" in config) {
337
337
  const key = config.key;
338
338
  if (typeof key !== "string" || !/^0x[0-9a-fA-F]{64}$/.test(key)) {
339
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).";
340
- throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
340
+ throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
341
341
  `chain is EVM; the wallet { key } is not a valid 0x\u2026 32-byte hex private key${hint}`
342
342
  );
343
343
  }
@@ -345,7 +345,7 @@ function createWalletAdapter(config, resolved) {
345
345
  try {
346
346
  account = _accounts.privateKeyToAccount.call(void 0, key);
347
347
  } catch (err) {
348
- throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
348
+ throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
349
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)}.`
350
350
  );
351
351
  }
@@ -355,12 +355,12 @@ function createWalletAdapter(config, resolved) {
355
355
  }
356
356
  const wc = config.walletClient;
357
357
  if (!wc.account) {
358
- throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
358
+ throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
359
359
  "chain is EVM; the provided walletClient has no attached account. Use `createWalletClient({ account, chain, transport })`, or pass { key }."
360
360
  );
361
361
  }
362
362
  if (wc.chain && wc.chain.id !== resolved.chainId) {
363
- throw new (0, _chunk57V5DNJTcjs.WrongChainError)(
363
+ throw new (0, _chunk3FR22M3Ocjs.WrongChainError)(
364
364
  `PipRailClient: walletClient is on chain ${wc.chain.id} but the SDK was configured with chain ${resolved.chainId}. They must match.`
365
365
  );
366
366
  }
@@ -690,7 +690,7 @@ async function payExactEvm(input) {
690
690
  code = void 0;
691
691
  }
692
692
  if (code && code !== "0x") {
693
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
693
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
694
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.`
695
695
  );
696
696
  }
@@ -700,13 +700,13 @@ async function payExactEvm(input) {
700
700
  domain = await readExactDomain(publicClient, accept.asset);
701
701
  }
702
702
  if (!domain) {
703
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
703
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
704
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.`
705
705
  );
706
706
  }
707
707
  const g = globalThis.crypto;
708
708
  if (!_optionalChain([g, 'optionalAccess', _5 => _5.getRandomValues])) {
709
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
709
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
710
710
  "this runtime lacks Web Crypto (globalThis.crypto.getRandomValues); the exact rail needs a CSPRNG nonce."
711
711
  );
712
712
  }
@@ -963,7 +963,7 @@ async function verifyAndSettleExactEvm(input) {
963
963
  args: writeArgs
964
964
  });
965
965
  } catch (err) {
966
- throw new (0, _chunk57V5DNJTcjs.SettlementError)(
966
+ throw new (0, _chunk3FR22M3Ocjs.SettlementError)(
967
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.`,
968
968
  { cause: err }
969
969
  );
@@ -975,7 +975,7 @@ async function verifyAndSettleExactEvm(input) {
975
975
  return { ok: false, error: "tx_reverted", detail: `Settlement tx ${txHash} reverted on-chain.` };
976
976
  }
977
977
  } catch (err) {
978
- throw new (0, _chunk57V5DNJTcjs.SettlementError)(
978
+ throw new (0, _chunk3FR22M3Ocjs.SettlementError)(
979
979
  `exact settle: broadcast ${txHash} but couldn't confirm it (${shorten(err instanceof Error ? err.message : String(err))}).`,
980
980
  { cause: err }
981
981
  );
@@ -1106,7 +1106,7 @@ function shorten2(msg) {
1106
1106
  function randomPermit2Nonce() {
1107
1107
  const g = globalThis.crypto;
1108
1108
  if (!_optionalChain([g, 'optionalAccess', _8 => _8.getRandomValues])) {
1109
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
1109
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
1110
1110
  "this runtime lacks Web Crypto (globalThis.crypto.getRandomValues); the permit2 rail needs a CSPRNG nonce."
1111
1111
  );
1112
1112
  }
@@ -1125,7 +1125,7 @@ async function ensurePermit2Allowance(input) {
1125
1125
  args: [account.address, PERMIT2_ADDRESS]
1126
1126
  });
1127
1127
  } catch (err) {
1128
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
1128
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
1129
1129
  `permit2: couldn't read the Permit2 allowance for ${token} (${shorten2(err instanceof Error ? err.message : String(err))}).`
1130
1130
  );
1131
1131
  }
@@ -1142,7 +1142,7 @@ async function ensurePermit2Allowance(input) {
1142
1142
  await publicClient.waitForTransactionReceipt({ hash, confirmations: 1 });
1143
1143
  return hash;
1144
1144
  } catch (err) {
1145
- throw _nullishCoalesce(_chunk57V5DNJTcjs.toInsufficientFundsError.call(void 0, err), () => ( new (0, _chunk57V5DNJTcjs.SettlementError)(
1145
+ throw _nullishCoalesce(_chunk3FR22M3Ocjs.toInsufficientFundsError.call(void 0, err), () => ( new (0, _chunk3FR22M3Ocjs.SettlementError)(
1146
1146
  `permit2: the one-time Permit2 approval for ${token} failed to broadcast (${shorten2(err instanceof Error ? err.message : String(err))}).`,
1147
1147
  { cause: err }
1148
1148
  )));
@@ -1157,7 +1157,7 @@ async function payPermit2Evm(input) {
1157
1157
  code = void 0;
1158
1158
  }
1159
1159
  if (code && code !== "0x") {
1160
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
1160
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
1161
1161
  `permit2 buyer rail requires an EOA signer; ${account.address} is a contract / EIP-1271 / EIP-7702-delegated account. Pay via onchain-proof.`
1162
1162
  );
1163
1163
  }
@@ -1332,7 +1332,7 @@ async function verifyAndSettlePermit2Evm(input) {
1332
1332
  args: settleArgs
1333
1333
  });
1334
1334
  } catch (err) {
1335
- throw new (0, _chunk57V5DNJTcjs.SettlementError)(
1335
+ throw new (0, _chunk3FR22M3Ocjs.SettlementError)(
1336
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.`,
1337
1337
  { cause: err }
1338
1338
  );
@@ -1344,7 +1344,7 @@ async function verifyAndSettlePermit2Evm(input) {
1344
1344
  return { ok: false, error: "tx_reverted", detail: `Settlement tx ${txHash} reverted on-chain.` };
1345
1345
  }
1346
1346
  } catch (err) {
1347
- throw new (0, _chunk57V5DNJTcjs.SettlementError)(
1347
+ throw new (0, _chunk3FR22M3Ocjs.SettlementError)(
1348
1348
  `permit2 settle: broadcast ${txHash} but couldn't confirm it (${shorten2(err instanceof Error ? err.message : String(err))}).`,
1349
1349
  { cause: err }
1350
1350
  );
@@ -1442,7 +1442,7 @@ function shorten3(msg) {
1442
1442
  function randomPermit2Nonce2() {
1443
1443
  const g = globalThis.crypto;
1444
1444
  if (!_optionalChain([g, 'optionalAccess', _9 => _9.getRandomValues])) {
1445
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
1445
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
1446
1446
  "this runtime lacks Web Crypto (globalThis.crypto.getRandomValues); the upto rail needs a CSPRNG nonce."
1447
1447
  );
1448
1448
  }
@@ -1459,13 +1459,13 @@ async function payUptoEvm(input) {
1459
1459
  code = void 0;
1460
1460
  }
1461
1461
  if (code && code !== "0x") {
1462
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
1462
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
1463
1463
  `upto buyer rail requires an EOA signer; ${account.address} is a contract / EIP-1271 / EIP-7702-delegated account. Pay via onchain-proof.`
1464
1464
  );
1465
1465
  }
1466
1466
  const facilitatorAddress = _optionalChain([accept, 'access', _10 => _10.extra, 'optionalAccess', _11 => _11.facilitatorAddress]);
1467
1467
  if (typeof facilitatorAddress !== "string" || facilitatorAddress.length === 0) {
1468
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
1468
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
1469
1469
  `upto: the rail carries no extra.facilitatorAddress to bind into witness.facilitator \u2014 refusing to sign.`
1470
1470
  );
1471
1471
  }
@@ -1686,7 +1686,7 @@ async function verifyAndSettleUptoEvm(input) {
1686
1686
  args: settleArgs
1687
1687
  });
1688
1688
  } catch (err) {
1689
- throw new (0, _chunk57V5DNJTcjs.SettlementError)(
1689
+ throw new (0, _chunk3FR22M3Ocjs.SettlementError)(
1690
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.`,
1691
1691
  { cause: err }
1692
1692
  );
@@ -1698,7 +1698,7 @@ async function verifyAndSettleUptoEvm(input) {
1698
1698
  return { ok: false, error: "tx_reverted", detail: `Settlement tx ${txHash} reverted on-chain.` };
1699
1699
  }
1700
1700
  } catch (err) {
1701
- throw new (0, _chunk57V5DNJTcjs.SettlementError)(
1701
+ throw new (0, _chunk3FR22M3Ocjs.SettlementError)(
1702
1702
  `upto settle: broadcast ${txHash} but couldn't confirm it (${shorten3(err instanceof Error ? err.message : String(err))}).`,
1703
1703
  { cause: err }
1704
1704
  );
@@ -2041,7 +2041,7 @@ var evmDriver = {
2041
2041
  try {
2042
2042
  return makeEvmNetwork(resolveChain(opts.chain, opts.rpcUrl));
2043
2043
  } catch (err) {
2044
- throw new (0, _chunk57V5DNJTcjs.UnsupportedNetworkError)(err instanceof Error ? err.message : String(err), { cause: err });
2044
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedNetworkError)(err instanceof Error ? err.message : String(err), { cause: err });
2045
2045
  }
2046
2046
  }
2047
2047
  let resolved;
@@ -2075,20 +2075,20 @@ function makeEvmNetwork(resolved) {
2075
2075
  const info = resolved.tokens[token.toUpperCase()];
2076
2076
  if (!info) {
2077
2077
  const known = Object.keys(resolved.tokens).join(", ") || "(none built in)";
2078
- throw new (0, _chunk57V5DNJTcjs.UnknownTokenError)(
2078
+ throw new (0, _chunk3FR22M3Ocjs.UnknownTokenError)(
2079
2079
  `token "${token}" isn't built in for ${resolved.chain.name} (known: ${known}). Pass { address, decimals } instead, or use 'native'.`
2080
2080
  );
2081
2081
  }
2082
2082
  return { asset: info.address, decimals: info.decimals, symbol: info.symbol };
2083
2083
  }
2084
- _chunk57V5DNJTcjs.rejectForeignToken.call(void 0, token, "evm", network);
2084
+ _chunk3FR22M3Ocjs.rejectForeignToken.call(void 0, token, "evm", network);
2085
2085
  if (!("address" in token)) {
2086
- throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
2086
+ throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
2087
2087
  `chain ${network} is EVM; a custom token must be { address, decimals }.`
2088
2088
  );
2089
2089
  }
2090
2090
  if (!_viem.isAddress.call(void 0, token.address)) {
2091
- throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
2091
+ throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
2092
2092
  `chain ${network} is EVM, but token address "${token.address}" is not a valid 0x address.`
2093
2093
  );
2094
2094
  }
@@ -2120,20 +2120,20 @@ function makeEvmNetwork(resolved) {
2120
2120
  },
2121
2121
  assertValidPayTo(payTo) {
2122
2122
  if (!_viem.isAddress.call(void 0, payTo)) {
2123
- throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
2123
+ throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
2124
2124
  `chain ${network} is EVM, but payTo "${payTo}" is not a valid 0x address.`
2125
2125
  );
2126
2126
  }
2127
2127
  },
2128
2128
  bindWallet(wallet) {
2129
2129
  if (typeof wallet !== "object" || wallet === null) {
2130
- throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
2130
+ throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
2131
2131
  `chain ${network} is EVM; wallet must be { key } (0x\u2026 hex) or { walletClient }.`
2132
2132
  );
2133
2133
  }
2134
- _chunk57V5DNJTcjs.assertNoLegacyWalletKey.call(void 0, wallet, "EVM");
2134
+ _chunk3FR22M3Ocjs.assertNoLegacyWalletKey.call(void 0, wallet, "EVM");
2135
2135
  if (!("key" in wallet) && !("walletClient" in wallet)) {
2136
- throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
2136
+ throw new (0, _chunk3FR22M3Ocjs.WrongFamilyError)(
2137
2137
  `chain ${network} is EVM; wallet must be { key } (0x\u2026 hex) or { walletClient }.`
2138
2138
  );
2139
2139
  }
@@ -2150,12 +2150,12 @@ function makeEvmNetwork(resolved) {
2150
2150
  });
2151
2151
  } catch (err) {
2152
2152
  if (isViemInsufficientFunds(err)) {
2153
- throw new (0, _chunk57V5DNJTcjs.InsufficientFundsError)(
2153
+ throw new (0, _chunk3FR22M3Ocjs.InsufficientFundsError)(
2154
2154
  err instanceof Error ? err.message : "Insufficient funds for payment.",
2155
2155
  { cause: err }
2156
2156
  );
2157
2157
  }
2158
- throw _nullishCoalesce(_chunk57V5DNJTcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
2158
+ throw _nullishCoalesce(_chunk3FR22M3Ocjs.toInsufficientFundsError.call(void 0, err), () => ( err));
2159
2159
  }
2160
2160
  },
2161
2161
  async confirm(ref, minConfirmations) {
@@ -2166,7 +2166,7 @@ function makeEvmNetwork(resolved) {
2166
2166
  });
2167
2167
  return { height: receipt.blockNumber.toString() };
2168
2168
  } catch (err) {
2169
- throw new (0, _chunk57V5DNJTcjs.ConfirmationTimeoutError)(
2169
+ throw new (0, _chunk3FR22M3Ocjs.ConfirmationTimeoutError)(
2170
2170
  `EVM tx ${ref} did not reach ${minConfirmations} confirmation(s) in time.`,
2171
2171
  { cause: err }
2172
2172
  );
@@ -2177,7 +2177,7 @@ function makeEvmNetwork(resolved) {
2177
2177
  if (accept.scheme === "exact" || accept.scheme === "upto") {
2178
2178
  const m = _optionalChain([accept, 'access', _19 => _19.extra, 'optionalAccess', _20 => _20.assetTransferMethod]);
2179
2179
  const permit2 = m === "permit2" || m === "permit2-exact" || m === "permit2-upto";
2180
- return _chunk57V5DNJTcjs.nativeCost.call(void 0, {
2180
+ return _chunk3FR22M3Ocjs.nativeCost.call(void 0, {
2181
2181
  symbol,
2182
2182
  decimals,
2183
2183
  fee: 0n,
@@ -2188,7 +2188,7 @@ function makeEvmNetwork(resolved) {
2188
2188
  const gasLimit = accept.asset === "native" ? 21000n : 65000n;
2189
2189
  try {
2190
2190
  const gasPrice = await publicClient.getGasPrice();
2191
- return _chunk57V5DNJTcjs.nativeCost.call(void 0, {
2191
+ return _chunk3FR22M3Ocjs.nativeCost.call(void 0, {
2192
2192
  symbol,
2193
2193
  decimals,
2194
2194
  fee: gasPrice * gasLimit,
@@ -2197,7 +2197,7 @@ function makeEvmNetwork(resolved) {
2197
2197
  });
2198
2198
  } catch (e23) {
2199
2199
  const gasPrice = 5000000000n;
2200
- return _chunk57V5DNJTcjs.nativeCost.call(void 0, {
2200
+ return _chunk3FR22M3Ocjs.nativeCost.call(void 0, {
2201
2201
  symbol,
2202
2202
  decimals,
2203
2203
  fee: gasPrice * gasLimit,
@@ -2382,9 +2382,9 @@ var loaders = {
2382
2382
  solana: async () => {
2383
2383
  let mod;
2384
2384
  try {
2385
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./solana-B424IQ5I.cjs")));
2385
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./solana-OU6IUMQM.cjs")));
2386
2386
  } catch (cause) {
2387
- throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2387
+ throw new (0, _chunk3FR22M3Ocjs.MissingDriverError)(
2388
2388
  `Solana selected, but its packages aren't installed. Run: npm install @solana/web3.js @solana/spl-token bs58`,
2389
2389
  { cause }
2390
2390
  );
@@ -2394,9 +2394,9 @@ var loaders = {
2394
2394
  ton: async () => {
2395
2395
  let mod;
2396
2396
  try {
2397
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./ton-3SHFVDLP.cjs")));
2397
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./ton-MYOI3U3H.cjs")));
2398
2398
  } catch (cause) {
2399
- throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2399
+ throw new (0, _chunk3FR22M3Ocjs.MissingDriverError)(
2400
2400
  `TON selected, but its packages aren't installed. Run: npm install @ton/ton @ton/core @ton/crypto`,
2401
2401
  { cause }
2402
2402
  );
@@ -2406,9 +2406,9 @@ var loaders = {
2406
2406
  stellar: async () => {
2407
2407
  let mod;
2408
2408
  try {
2409
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./stellar-4YR4UZQX.cjs")));
2409
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./stellar-RSNVOIKL.cjs")));
2410
2410
  } catch (cause) {
2411
- throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2411
+ throw new (0, _chunk3FR22M3Ocjs.MissingDriverError)(
2412
2412
  `Stellar selected, but its package isn't installed. Run: npm install @stellar/stellar-sdk`,
2413
2413
  { cause }
2414
2414
  );
@@ -2418,9 +2418,9 @@ var loaders = {
2418
2418
  xrpl: async () => {
2419
2419
  let mod;
2420
2420
  try {
2421
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./xrpl-SUEFOOKW.cjs")));
2421
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./xrpl-MGUBUNSZ.cjs")));
2422
2422
  } catch (cause) {
2423
- throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2423
+ throw new (0, _chunk3FR22M3Ocjs.MissingDriverError)(
2424
2424
  `XRPL selected, but its package isn't installed. Run: npm install xrpl`,
2425
2425
  { cause }
2426
2426
  );
@@ -2430,9 +2430,9 @@ var loaders = {
2430
2430
  tron: async () => {
2431
2431
  let mod;
2432
2432
  try {
2433
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./tron-BS5EID2U.cjs")));
2433
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./tron-42X5N4GQ.cjs")));
2434
2434
  } catch (cause) {
2435
- throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2435
+ throw new (0, _chunk3FR22M3Ocjs.MissingDriverError)(
2436
2436
  `Tron selected, but its package isn't installed. Run: npm install tronweb`,
2437
2437
  { cause }
2438
2438
  );
@@ -2442,9 +2442,9 @@ var loaders = {
2442
2442
  sui: async () => {
2443
2443
  let mod;
2444
2444
  try {
2445
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./sui-F7UW6JXJ.cjs")));
2445
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./sui-MVC46BFJ.cjs")));
2446
2446
  } catch (cause) {
2447
- throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2447
+ throw new (0, _chunk3FR22M3Ocjs.MissingDriverError)(
2448
2448
  `Sui selected, but its package isn't installed. Run: npm install @mysten/sui`,
2449
2449
  { cause }
2450
2450
  );
@@ -2454,9 +2454,9 @@ var loaders = {
2454
2454
  near: async () => {
2455
2455
  let mod;
2456
2456
  try {
2457
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./near-C2IS4RCH.cjs")));
2457
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./near-NDQLGI4U.cjs")));
2458
2458
  } catch (cause) {
2459
- throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2459
+ throw new (0, _chunk3FR22M3Ocjs.MissingDriverError)(
2460
2460
  `NEAR selected, but its package isn't installed. Run: npm install near-api-js`,
2461
2461
  { cause }
2462
2462
  );
@@ -2466,9 +2466,9 @@ var loaders = {
2466
2466
  aptos: async () => {
2467
2467
  let mod;
2468
2468
  try {
2469
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./aptos-MVEG5ZPS.cjs")));
2469
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./aptos-GA5AEYYL.cjs")));
2470
2470
  } catch (cause) {
2471
- throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2471
+ throw new (0, _chunk3FR22M3Ocjs.MissingDriverError)(
2472
2472
  `Aptos selected, but its package isn't installed. Run: npm install @aptos-labs/ts-sdk`,
2473
2473
  { cause }
2474
2474
  );
@@ -2478,9 +2478,9 @@ var loaders = {
2478
2478
  algorand: async () => {
2479
2479
  let mod;
2480
2480
  try {
2481
- mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./algorand-ICJNXO5V.cjs")));
2481
+ mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./algorand-I2O24RSM.cjs")));
2482
2482
  } catch (cause) {
2483
- throw new (0, _chunk57V5DNJTcjs.MissingDriverError)(
2483
+ throw new (0, _chunk3FR22M3Ocjs.MissingDriverError)(
2484
2484
  `Algorand selected, but its package isn't installed. Run: npm install algosdk`,
2485
2485
  { cause }
2486
2486
  );
@@ -3124,7 +3124,7 @@ function encodeBase642(str) {
3124
3124
  }
3125
3125
 
3126
3126
  // src/policy.ts
3127
- var DENOM_PRECISION = _chunk57V5DNJTcjs.MAX_DECIMALS;
3127
+ var DENOM_PRECISION = _chunk3FR22M3Ocjs.MAX_DECIMALS;
3128
3128
  var BUILTIN_DENOMS = {
3129
3129
  USDC: "USD",
3130
3130
  USDT: "USD",
@@ -3239,7 +3239,7 @@ function evaluatePolicy(intent, policy, spentForAssetBase, ctx) {
3239
3239
  }
3240
3240
  }
3241
3241
  if (policy.maxAmount !== void 0) {
3242
- const cap = _chunk57V5DNJTcjs.floorUnits.call(void 0, policy.maxAmount, intent.decimals);
3242
+ const cap = _chunk3FR22M3Ocjs.floorUnits.call(void 0, policy.maxAmount, intent.decimals);
3243
3243
  if (intent.amountBase > cap) {
3244
3244
  return deny(
3245
3245
  "MAX_AMOUNT",
@@ -3248,7 +3248,7 @@ function evaluatePolicy(intent, policy, spentForAssetBase, ctx) {
3248
3248
  }
3249
3249
  }
3250
3250
  if (policy.maxTotal !== void 0) {
3251
- const cap = _chunk57V5DNJTcjs.floorUnits.call(void 0, policy.maxTotal, intent.decimals);
3251
+ const cap = _chunk3FR22M3Ocjs.floorUnits.call(void 0, policy.maxTotal, intent.decimals);
3252
3252
  if (spentForAssetBase + intent.amountBase > cap) {
3253
3253
  return deny(
3254
3254
  "MAX_TOTAL",
@@ -3267,7 +3267,7 @@ function evaluatePolicy(intent, policy, spentForAssetBase, ctx) {
3267
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).`
3268
3268
  );
3269
3269
  }
3270
- const capScaled = _chunk57V5DNJTcjs.floorUnits.call(void 0, capStr, DENOM_PRECISION);
3270
+ const capScaled = _chunk3FR22M3Ocjs.floorUnits.call(void 0, capStr, DENOM_PRECISION);
3271
3271
  if ((_nullishCoalesce(ctx.spentInDenomScaled, () => ( 0n))) + thisScaled > capScaled) {
3272
3272
  return deny(
3273
3273
  "MAX_TOTAL_DENOM",
@@ -3285,7 +3285,7 @@ function evaluatePolicy(intent, policy, spentForAssetBase, ctx) {
3285
3285
  }
3286
3286
  }
3287
3287
  if (ctx && policy.windowTotal !== void 0 && policy.windowSeconds !== void 0) {
3288
- const cap = _chunk57V5DNJTcjs.floorUnits.call(void 0, policy.windowTotal, intent.decimals);
3288
+ const cap = _chunk3FR22M3Ocjs.floorUnits.call(void 0, policy.windowTotal, intent.decimals);
3289
3289
  if (ctx.spentInWindowBase + intent.amountBase > cap) {
3290
3290
  return deny(
3291
3291
  "WINDOW_TOTAL",
@@ -3351,7 +3351,7 @@ var SpendLedger = (_class = class {
3351
3351
  * read or the constructor.
3352
3352
  */
3353
3353
  isTallyable(r, decimals) {
3354
- return !!r && typeof r.amountBase === "string" && /^\d+$/.test(r.amountBase) && Number.isInteger(decimals) && decimals >= 0 && decimals <= _chunk57V5DNJTcjs.MAX_DECIMALS;
3354
+ return !!r && typeof r.amountBase === "string" && /^\d+$/.test(r.amountBase) && Number.isInteger(decimals) && decimals >= 0 && decimals <= _chunk3FR22M3Ocjs.MAX_DECIMALS;
3355
3355
  }
3356
3356
  /** Apply a record to the in-memory tallies (records + per-asset bucket + denom total).
3357
3357
  * Shared by {@link record} and constructor hydration; does NOT persist. Returns the
@@ -3488,13 +3488,13 @@ var SpendLedger = (_class = class {
3488
3488
  symbol: b.symbol,
3489
3489
  decimals: b.decimals,
3490
3490
  totalBase: b.total.toString(),
3491
- totalFormatted: _chunk57V5DNJTcjs.formatUnits.call(void 0, b.total, b.decimals),
3491
+ totalFormatted: _chunk3FR22M3Ocjs.formatUnits.call(void 0, b.total, b.decimals),
3492
3492
  count: b.count
3493
3493
  })),
3494
3494
  byDenom: [...this.denomTotals.entries()].map(([denom, scaled]) => ({
3495
3495
  denom,
3496
3496
  totalScaled: scaled.toString(),
3497
- totalFormatted: _chunk57V5DNJTcjs.formatUnits.call(void 0, scaled, DENOM_PRECISION),
3497
+ totalFormatted: _chunk3FR22M3Ocjs.formatUnits.call(void 0, scaled, DENOM_PRECISION),
3498
3498
  count: this.records.filter((r) => _optionalChain([r, 'access', _34 => _34.denom, 'optionalAccess', _35 => _35.toUpperCase, 'call', _36 => _36()]) === denom).length
3499
3499
  })),
3500
3500
  records: [...this.records]
@@ -3902,7 +3902,7 @@ var PipRailClient = (_class2 = class {
3902
3902
  const cost = await net.estimateCost(accept);
3903
3903
  return { quote, cost };
3904
3904
  } catch (err) {
3905
- if (err instanceof _chunk57V5DNJTcjs.InvalidEnvelopeError) return null;
3905
+ if (err instanceof _chunk3FR22M3Ocjs.InvalidEnvelopeError) return null;
3906
3906
  throw err;
3907
3907
  }
3908
3908
  }
@@ -3954,14 +3954,14 @@ var PipRailClient = (_class2 = class {
3954
3954
  return Object.entries(caps).map(([rawDenom, capStr]) => {
3955
3955
  const denom = rawDenom.toUpperCase();
3956
3956
  const spentScaled = this.ledger.totalForDenom(denom);
3957
- const capScaled = _chunk57V5DNJTcjs.floorUnits.call(void 0, capStr, DENOM_PRECISION);
3957
+ const capScaled = _chunk3FR22M3Ocjs.floorUnits.call(void 0, capStr, DENOM_PRECISION);
3958
3958
  const remainingScaled = capScaled > spentScaled ? capScaled - spentScaled : 0n;
3959
3959
  const fraction = capScaled === 0n ? spentScaled > 0n ? 1 : 0 : Number(spentScaled * 1000000n / capScaled) / 1e6;
3960
3960
  return {
3961
3961
  denom,
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),
3962
+ spentFormatted: _chunk3FR22M3Ocjs.formatUnits.call(void 0, spentScaled, DENOM_PRECISION),
3963
+ capFormatted: _chunk3FR22M3Ocjs.formatUnits.call(void 0, capScaled, DENOM_PRECISION),
3964
+ remainingFormatted: _chunk3FR22M3Ocjs.formatUnits.call(void 0, remainingScaled, DENOM_PRECISION),
3965
3965
  fraction
3966
3966
  };
3967
3967
  });
@@ -4002,13 +4002,13 @@ var PipRailClient = (_class2 = class {
4002
4002
  spentBase: b.totalBase.toString()
4003
4003
  };
4004
4004
  if (maxTotal === void 0) return base2;
4005
- const capBase = _chunk57V5DNJTcjs.floorUnits.call(void 0, maxTotal, b.decimals);
4005
+ const capBase = _chunk3FR22M3Ocjs.floorUnits.call(void 0, maxTotal, b.decimals);
4006
4006
  const remainingBase = capBase > b.totalBase ? capBase - b.totalBase : 0n;
4007
4007
  return {
4008
4008
  ...base2,
4009
4009
  capBase: capBase.toString(),
4010
4010
  remainingBase: remainingBase.toString(),
4011
- remainingFormatted: _chunk57V5DNJTcjs.formatUnits.call(void 0, remainingBase, b.decimals)
4011
+ remainingFormatted: _chunk3FR22M3Ocjs.formatUnits.call(void 0, remainingBase, b.decimals)
4012
4012
  };
4013
4013
  });
4014
4014
  }
@@ -4048,11 +4048,11 @@ var PipRailClient = (_class2 = class {
4048
4048
  if (res.status !== 402) return null;
4049
4049
  const challenge = await parseChallenge(res);
4050
4050
  if (!challenge) {
4051
- throw new (0, _chunk57V5DNJTcjs.InvalidEnvelopeError)("402 response did not include a parseable x402 challenge.");
4051
+ throw new (0, _chunk3FR22M3Ocjs.InvalidEnvelopeError)("402 response did not include a parseable x402 challenge.");
4052
4052
  }
4053
4053
  const { net, wallet } = await this.ensure();
4054
4054
  if (!wallet) {
4055
- throw new (0, _chunk57V5DNJTcjs.WalletRequiredError)(
4055
+ throw new (0, _chunk3FR22M3Ocjs.WalletRequiredError)(
4056
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."
4057
4057
  );
4058
4058
  }
@@ -4228,7 +4228,7 @@ var PipRailClient = (_class2 = class {
4228
4228
  async fetch(url, init) {
4229
4229
  const body = _optionalChain([init, 'optionalAccess', _57 => _57.body]);
4230
4230
  if (body !== void 0 && body !== null && !isReplayableBodyInit(body)) {
4231
- throw new (0, _chunk57V5DNJTcjs.NonReplayableBodyError)(
4231
+ throw new (0, _chunk3FR22M3Ocjs.NonReplayableBodyError)(
4232
4232
  "fetch(): init.body is not replayable. Pass a string, FormData, URLSearchParams, ArrayBuffer, or Blob \u2014 not a ReadableStream."
4233
4233
  );
4234
4234
  }
@@ -4238,7 +4238,7 @@ var PipRailClient = (_class2 = class {
4238
4238
  const resolved = await this.resolveChallenge(url, firstResponse, schemes);
4239
4239
  const { net, wallet, challenge } = resolved;
4240
4240
  if (!wallet) {
4241
- throw new (0, _chunk57V5DNJTcjs.WalletRequiredError)(
4241
+ throw new (0, _chunk3FR22M3Ocjs.WalletRequiredError)(
4242
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)."
4243
4243
  );
4244
4244
  }
@@ -4250,7 +4250,7 @@ var PipRailClient = (_class2 = class {
4250
4250
  if (!plan.best) {
4251
4251
  const reason = _nullishCoalesce(plan.fundingHint, () => ( "No rail is settleable for this payment."));
4252
4252
  this.safeEmit({ kind: "payment-failed", reason });
4253
- throw new (0, _chunk57V5DNJTcjs.PaymentDeclinedError)(reason);
4253
+ throw new (0, _chunk3FR22M3Ocjs.PaymentDeclinedError)(reason);
4254
4254
  }
4255
4255
  accept = plan.best.accept;
4256
4256
  quote = plan.best.quote;
@@ -4264,7 +4264,7 @@ var PipRailClient = (_class2 = class {
4264
4264
  return this.payExactRail(net, wallet, accept, url, init, quote);
4265
4265
  }
4266
4266
  if (accept.scheme !== "onchain-proof") {
4267
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
4267
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
4268
4268
  `internal: unrouted accept scheme '${accept.scheme}' reached the onchain-proof pay path.`
4269
4269
  );
4270
4270
  }
@@ -4282,7 +4282,7 @@ var PipRailClient = (_class2 = class {
4282
4282
  async resolveChallenge(url, response, schemes) {
4283
4283
  const challenge = await parseChallenge(response);
4284
4284
  if (!challenge) {
4285
- throw new (0, _chunk57V5DNJTcjs.InvalidEnvelopeError)(
4285
+ throw new (0, _chunk3FR22M3Ocjs.InvalidEnvelopeError)(
4286
4286
  "402 response did not include a parseable x402 challenge."
4287
4287
  );
4288
4288
  }
@@ -4293,7 +4293,7 @@ var PipRailClient = (_class2 = class {
4293
4293
  (a) => a.scheme === "exact" && this.supportsNetwork(net, a.network)
4294
4294
  );
4295
4295
  if (schemes.includes("exact") && exactOnNet && typeof net.payExact !== "function") {
4296
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
4296
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
4297
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.`
4298
4298
  );
4299
4299
  }
@@ -4302,13 +4302,13 @@ var PipRailClient = (_class2 = class {
4302
4302
  (a) => a.scheme === "exact" && this.supportsNetwork(net, a.network) && net.describeAsset(a.asset) != null
4303
4303
  );
4304
4304
  if (payable) {
4305
- throw new (0, _chunk57V5DNJTcjs.NoCompatibleAcceptError)(
4305
+ throw new (0, _chunk3FR22M3Ocjs.NoCompatibleAcceptError)(
4306
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).`
4307
4307
  );
4308
4308
  }
4309
4309
  }
4310
4310
  const networks = [...new Set(challenge.accepts.map((a) => a.network))].join(", ");
4311
- throw new (0, _chunk57V5DNJTcjs.NoCompatibleAcceptError)(
4311
+ throw new (0, _chunk3FR22M3Ocjs.NoCompatibleAcceptError)(
4312
4312
  `No accepts[] entry payable by this client on ${net.network} (schemes: ${schemes.join(", ")}; challenge offered: ${networks || "none"}).`
4313
4313
  );
4314
4314
  }
@@ -4437,21 +4437,21 @@ var PipRailClient = (_class2 = class {
4437
4437
  if (isExact) {
4438
4438
  if (tokenKnown && bal.token < amount) {
4439
4439
  blockers.push("INSUFFICIENT_TOKEN");
4440
- shortfall.token = _chunk57V5DNJTcjs.formatUnits.call(void 0, amount - bal.token, quote.decimals);
4440
+ shortfall.token = _chunk3FR22M3Ocjs.formatUnits.call(void 0, amount - bal.token, quote.decimals);
4441
4441
  }
4442
4442
  } else if (isNative) {
4443
4443
  if (nativeKnown && bal.native < amount + fee) {
4444
4444
  blockers.push("INSUFFICIENT_TOKEN");
4445
- shortfall.token = _chunk57V5DNJTcjs.formatUnits.call(void 0, amount + fee - bal.native, quote.decimals);
4445
+ shortfall.token = _chunk3FR22M3Ocjs.formatUnits.call(void 0, amount + fee - bal.native, quote.decimals);
4446
4446
  }
4447
4447
  } else {
4448
4448
  if (tokenKnown && bal.token < amount) {
4449
4449
  blockers.push("INSUFFICIENT_TOKEN");
4450
- shortfall.token = _chunk57V5DNJTcjs.formatUnits.call(void 0, amount - bal.token, quote.decimals);
4450
+ shortfall.token = _chunk3FR22M3Ocjs.formatUnits.call(void 0, amount - bal.token, quote.decimals);
4451
4451
  }
4452
4452
  if (nativeKnown && bal.native < fee) {
4453
4453
  blockers.push("INSUFFICIENT_GAS");
4454
- shortfall.native = _chunk57V5DNJTcjs.formatUnits.call(void 0, fee - bal.native, cost.feeDecimals);
4454
+ shortfall.native = _chunk3FR22M3Ocjs.formatUnits.call(void 0, fee - bal.native, cost.feeDecimals);
4455
4455
  } else if (nativeKnown && fee > 0n && bal.native < fee * 3n / 2n) {
4456
4456
  warnings.push("THIN_GAS_MARGIN");
4457
4457
  }
@@ -4476,8 +4476,8 @@ var PipRailClient = (_class2 = class {
4476
4476
  blockers,
4477
4477
  warnings,
4478
4478
  balance: {
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
4479
+ token: bal.token != null ? _chunk3FR22M3Ocjs.formatUnits.call(void 0, bal.token, quote.decimals) : null,
4480
+ native: bal.native != null ? _chunk3FR22M3Ocjs.formatUnits.call(void 0, bal.native, cost.feeDecimals) : null
4481
4481
  },
4482
4482
  need: { token: quote.amountFormatted, native: cost.feeFormatted },
4483
4483
  ...shortfall.token || shortfall.native ? { shortfall } : {},
@@ -4488,12 +4488,12 @@ var PipRailClient = (_class2 = class {
4488
4488
  * driver's describeAsset) + the policy verdict + a symbol-mismatch flag. */
4489
4489
  buildQuote(net, accept, url, description) {
4490
4490
  if (typeof accept.amount !== "string" || !/^\d+$/.test(accept.amount)) {
4491
- throw new (0, _chunk57V5DNJTcjs.InvalidEnvelopeError)(
4491
+ throw new (0, _chunk3FR22M3Ocjs.InvalidEnvelopeError)(
4492
4492
  `challenge amount "${String(accept.amount)}" is not a base-unit integer string.`
4493
4493
  );
4494
4494
  }
4495
4495
  if (typeof accept.asset !== "string" || accept.asset.length === 0) {
4496
- throw new (0, _chunk57V5DNJTcjs.InvalidEnvelopeError)(
4496
+ throw new (0, _chunk3FR22M3Ocjs.InvalidEnvelopeError)(
4497
4497
  `challenge on ${accept.network} states no (string) asset \u2014 refusing to price it.`
4498
4498
  );
4499
4499
  }
@@ -4501,17 +4501,17 @@ var PipRailClient = (_class2 = class {
4501
4501
  const described = net.describeAsset(accept.asset);
4502
4502
  const decimals = _nullishCoalesce(_optionalChain([described, 'optionalAccess', _64 => _64.decimals]), () => ( _optionalChain([accept, 'access', _65 => _65.extra, 'optionalAccess', _66 => _66.decimals])));
4503
4503
  if (typeof decimals !== "number" || !Number.isInteger(decimals) || decimals < 0) {
4504
- throw new (0, _chunk57V5DNJTcjs.InvalidEnvelopeError)(
4504
+ throw new (0, _chunk3FR22M3Ocjs.InvalidEnvelopeError)(
4505
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.`
4506
4506
  );
4507
4507
  }
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).`
4508
+ if (decimals > _chunk3FR22M3Ocjs.MAX_DECIMALS) {
4509
+ throw new (0, _chunk3FR22M3Ocjs.InvalidEnvelopeError)(
4510
+ `challenge for ${accept.asset} on ${accept.network} states ${decimals} decimals (> ${_chunk3FR22M3Ocjs.MAX_DECIMALS}) \u2014 refusing to price it (no real token is that deep).`
4511
4511
  );
4512
4512
  }
4513
4513
  const symbol = _nullishCoalesce(_optionalChain([described, 'optionalAccess', _67 => _67.symbol]), () => ( _optionalChain([accept, 'access', _68 => _68.extra, 'optionalAccess', _69 => _69.symbol])));
4514
- const amountFormatted = _chunk57V5DNJTcjs.formatUnits.call(void 0, amountBase, decimals);
4514
+ const amountFormatted = _chunk3FR22M3Ocjs.formatUnits.call(void 0, amountBase, decimals);
4515
4515
  const intent = {
4516
4516
  host: hostOf2(url),
4517
4517
  chain: this.opts.chain,
@@ -4616,7 +4616,7 @@ var PipRailClient = (_class2 = class {
4616
4616
  ...opts.quote ? { quote: opts.quote } : {},
4617
4617
  budget: this.budget()
4618
4618
  });
4619
- throw new (0, _chunk57V5DNJTcjs.PaymentDeclinedError)(reason, {
4619
+ throw new (0, _chunk3FR22M3Ocjs.PaymentDeclinedError)(reason, {
4620
4620
  ...opts.reasonCode ? { reasonCode: opts.reasonCode } : {},
4621
4621
  ...opts.cause !== void 0 ? { cause: opts.cause } : {}
4622
4622
  });
@@ -4648,7 +4648,7 @@ var PipRailClient = (_class2 = class {
4648
4648
  const max = BigInt(quote.amount);
4649
4649
  const shown = claimed < max ? claimed : max;
4650
4650
  settledBase = shown.toString();
4651
- settledFormatted = _chunk57V5DNJTcjs.formatUnits.call(void 0, shown, quote.decimals);
4651
+ settledFormatted = _chunk3FR22M3Ocjs.formatUnits.call(void 0, shown, quote.decimals);
4652
4652
  } catch (e36) {
4653
4653
  }
4654
4654
  }
@@ -4699,8 +4699,8 @@ var PipRailClient = (_class2 = class {
4699
4699
  fire(
4700
4700
  "asset",
4701
4701
  `${_nullishCoalesce(r.symbol, () => ( r.asset))} on ${r.network}`,
4702
- _chunk57V5DNJTcjs.formatUnits.call(void 0, spent, r.decimals),
4703
- _chunk57V5DNJTcjs.formatUnits.call(void 0, cap, r.decimals),
4702
+ _chunk3FR22M3Ocjs.formatUnits.call(void 0, spent, r.decimals),
4703
+ _chunk3FR22M3Ocjs.formatUnits.call(void 0, cap, r.decimals),
4704
4704
  fraction
4705
4705
  );
4706
4706
  }
@@ -4711,14 +4711,14 @@ var PipRailClient = (_class2 = class {
4711
4711
  if (_optionalChain([policy, 'optionalAccess', _75 => _75.windowTotal]) !== void 0 && policy.windowSeconds !== void 0) {
4712
4712
  const since = Date.now() - policy.windowSeconds * 1e3;
4713
4713
  for (const r of budget.byAsset) {
4714
- const cap = _chunk57V5DNJTcjs.floorUnits.call(void 0, policy.windowTotal, r.decimals);
4714
+ const cap = _chunk3FR22M3Ocjs.floorUnits.call(void 0, policy.windowTotal, r.decimals);
4715
4715
  const spent = this.ledger.totalSince(r.network, r.asset, since);
4716
4716
  const fraction = cap === 0n ? spent > 0n ? 1 : 0 : Number(spent * 1000000n / cap) / 1e6;
4717
4717
  fire(
4718
4718
  "window",
4719
4719
  `${_nullishCoalesce(r.symbol, () => ( r.asset))} on ${r.network}`,
4720
- _chunk57V5DNJTcjs.formatUnits.call(void 0, spent, r.decimals),
4721
- _chunk57V5DNJTcjs.formatUnits.call(void 0, cap, r.decimals),
4720
+ _chunk3FR22M3Ocjs.formatUnits.call(void 0, spent, r.decimals),
4721
+ _chunk3FR22M3Ocjs.formatUnits.call(void 0, cap, r.decimals),
4722
4722
  fraction
4723
4723
  );
4724
4724
  }
@@ -4739,7 +4739,7 @@ var PipRailClient = (_class2 = class {
4739
4739
  }
4740
4740
  async payAndConfirm(net, wallet, accept) {
4741
4741
  if (!this.supportsNetwork(net, accept.network)) {
4742
- throw new (0, _chunk57V5DNJTcjs.WrongChainError)(
4742
+ throw new (0, _chunk3FR22M3Ocjs.WrongChainError)(
4743
4743
  `Challenge expects ${accept.network} but client is on ${net.network}.`
4744
4744
  );
4745
4745
  }
@@ -4792,7 +4792,7 @@ var PipRailClient = (_class2 = class {
4792
4792
  });
4793
4793
  } catch (err) {
4794
4794
  if (timeoutController.signal.aborted) {
4795
- throw new (0, _chunk57V5DNJTcjs.PaymentTimeoutError)(
4795
+ throw new (0, _chunk3FR22M3Ocjs.PaymentTimeoutError)(
4796
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.`,
4797
4797
  { cause: err, ref }
4798
4798
  );
@@ -4816,7 +4816,7 @@ var PipRailClient = (_class2 = class {
4816
4816
  reason: `server returned 402 after broadcasting payment ${ref}${unconfirmedNote} (${why})`,
4817
4817
  ...lastReason ? { code: lastReason.error, detail: lastReason.detail } : {}
4818
4818
  });
4819
- throw new (0, _chunk57V5DNJTcjs.MaxRetriesExceededError)(
4819
+ throw new (0, _chunk3FR22M3Ocjs.MaxRetriesExceededError)(
4820
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).`,
4821
4821
  { ref }
4822
4822
  );
@@ -4840,7 +4840,7 @@ var PipRailClient = (_class2 = class {
4840
4840
  */
4841
4841
  async payExactRail(net, wallet, accept, url, init, quote) {
4842
4842
  if (!net.payExact) {
4843
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
4843
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
4844
4844
  `the ${net.family} family can't pay a standard 'exact' rail (supported on EVM, Solana, Algorand, Aptos + NEAR today).`
4845
4845
  );
4846
4846
  }
@@ -4850,7 +4850,7 @@ var PipRailClient = (_class2 = class {
4850
4850
  headers.set(HEADER_SIGNATURE, buildExactSignatureHeader({ accepted, payload }));
4851
4851
  const rejectDefinitive = (why2) => {
4852
4852
  this.safeEmit({ kind: "payment-failed", reason: `exact: facilitator rejected nonce=${nonce} (${why2})`, code: why2 });
4853
- throw new (0, _chunk57V5DNJTcjs.MaxRetriesExceededError)(
4853
+ throw new (0, _chunk3FR22M3Ocjs.MaxRetriesExceededError)(
4854
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}.`,
4855
4855
  { ref: nonce }
4856
4856
  );
@@ -4873,7 +4873,7 @@ var PipRailClient = (_class2 = class {
4873
4873
  try {
4874
4874
  response = await fetch(url, { ..._nullishCoalesce(init, () => ( {})), headers, signal });
4875
4875
  } catch (err) {
4876
- throw new (0, _chunk57V5DNJTcjs.PaymentTimeoutError)(
4876
+ throw new (0, _chunk3FR22M3Ocjs.PaymentTimeoutError)(
4877
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.`,
4878
4878
  { cause: err, ref: nonce }
4879
4879
  );
@@ -4908,7 +4908,7 @@ var PipRailClient = (_class2 = class {
4908
4908
  reason: `exact: 402 after submitting authorization nonce=${nonce} (${why})`,
4909
4909
  ...lastReason ? { code: lastReason.error, detail: lastReason.detail } : {}
4910
4910
  });
4911
- throw new (0, _chunk57V5DNJTcjs.MaxRetriesExceededError)(
4911
+ throw new (0, _chunk3FR22M3Ocjs.MaxRetriesExceededError)(
4912
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}.`,
4913
4913
  { ref: nonce }
4914
4914
  );
@@ -4924,7 +4924,7 @@ var PipRailClient = (_class2 = class {
4924
4924
  */
4925
4925
  async payUptoRail(net, wallet, accept, url, init, quote) {
4926
4926
  if (!net.payUpto) {
4927
- throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
4927
+ throw new (0, _chunk3FR22M3Ocjs.UnsupportedSchemeError)(
4928
4928
  `the ${net.family} family can't pay a standard 'upto' rail (EVM-Permit2 only today).`
4929
4929
  );
4930
4930
  }
@@ -4934,7 +4934,7 @@ var PipRailClient = (_class2 = class {
4934
4934
  headers.set(HEADER_SIGNATURE, buildUptoSignatureHeader({ accepted, payload }));
4935
4935
  const rejectDefinitive = (why2) => {
4936
4936
  this.safeEmit({ kind: "payment-failed", reason: `upto: facilitator rejected nonce=${nonce} (${why2})`, code: why2 });
4937
- throw new (0, _chunk57V5DNJTcjs.MaxRetriesExceededError)(
4937
+ throw new (0, _chunk3FR22M3Ocjs.MaxRetriesExceededError)(
4938
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}.`,
4939
4939
  { ref: nonce }
4940
4940
  );
@@ -4957,7 +4957,7 @@ var PipRailClient = (_class2 = class {
4957
4957
  try {
4958
4958
  response = await fetch(url, { ..._nullishCoalesce(init, () => ( {})), headers, signal });
4959
4959
  } catch (err) {
4960
- throw new (0, _chunk57V5DNJTcjs.PaymentTimeoutError)(
4960
+ throw new (0, _chunk3FR22M3Ocjs.PaymentTimeoutError)(
4961
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.`,
4962
4962
  { cause: err, ref: nonce }
4963
4963
  );
@@ -4993,7 +4993,7 @@ var PipRailClient = (_class2 = class {
4993
4993
  reason: `upto: 402 after submitting authorization nonce=${nonce} (${why})`,
4994
4994
  ...lastReason ? { code: lastReason.error, detail: lastReason.detail } : {}
4995
4995
  });
4996
- throw new (0, _chunk57V5DNJTcjs.MaxRetriesExceededError)(
4996
+ throw new (0, _chunk3FR22M3Ocjs.MaxRetriesExceededError)(
4997
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}.`,
4998
4998
  { ref: nonce }
4999
4999
  );
@@ -5106,7 +5106,7 @@ async function fetchAcross(clients, url, init) {
5106
5106
  const best = rankAcross(live.map((p) => p.plan)).find((o) => o.state === "payable");
5107
5107
  if (!best) {
5108
5108
  const hint = mergeDeclineHint(live.map((p) => p.plan));
5109
- throw new (0, _chunk57V5DNJTcjs.PaymentDeclinedError)(hint || "No funded chain can settle this payment right now.");
5109
+ throw new (0, _chunk3FR22M3Ocjs.PaymentDeclinedError)(hint || "No funded chain can settle this payment right now.");
5110
5110
  }
5111
5111
  const owner = live.find((p) => p.plan.options.includes(best)).client;
5112
5112
  return owner.fetch(url, { ..._nullishCoalesce(init, () => ( {})), autoRoute: true });
@@ -5506,7 +5506,7 @@ function summarizePlan(plan) {
5506
5506
  return `NOT payable: ${_nullishCoalesce(plan.fundingHint, () => ( `no settleable rail on ${plan.network}`))}`;
5507
5507
  }
5508
5508
  function explainDecline(err) {
5509
- if (!(err instanceof _chunk57V5DNJTcjs.PipRailError)) {
5509
+ if (!(err instanceof _chunk3FR22M3Ocjs.PipRailError)) {
5510
5510
  return `Payment failed: ${err instanceof Error ? err.message : String(err)}`;
5511
5511
  }
5512
5512
  switch (err.code) {
@@ -5537,17 +5537,20 @@ function formatSpendReport(summary) {
5537
5537
  return `${perAsset} \u2014 grand total: ${grand}`;
5538
5538
  }
5539
5539
  function describeChallenge(challenge) {
5540
- const accepts = Array.isArray(_optionalChain([challenge, 'optionalAccess', _113 => _113.accepts])) ? challenge.accepts : [];
5541
- const first = accepts[0];
5542
- if (!first) {
5543
- return `${BRAND.name} x402 payment endpoint. Pay with @piprail/sdk (${BRAND.sdkInstall}). Docs: ${BRAND.home}.`;
5540
+ const generic = `${BRAND.name} x402 payment endpoint. Pay with @piprail/sdk (${BRAND.sdkInstall}). Docs: ${BRAND.home}.`;
5541
+ try {
5542
+ const accepts = Array.isArray(_optionalChain([challenge, 'optionalAccess', _113 => _113.accepts])) ? challenge.accepts : [];
5543
+ const first = accepts[0];
5544
+ if (!first) return generic;
5545
+ const extra = _nullishCoalesce(first.extra, () => ( {}));
5546
+ const amount = _nullishCoalesce(extra.amountFormatted, () => ( first.amount));
5547
+ const token = _nullishCoalesce(extra.symbol, () => ( first.asset));
5548
+ const hasExact = accepts.some((a) => _optionalChain([a, 'optionalAccess', _114 => _114.scheme]) === "exact");
5549
+ const standard = hasExact ? "; or any standard x402 client (an exact rail is offered)" : "";
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}.`;
5551
+ } catch (e41) {
5552
+ return generic;
5544
5553
  }
5545
- const extra = _nullishCoalesce(first.extra, () => ( {}));
5546
- const amount = _nullishCoalesce(extra.amountFormatted, () => ( first.amount));
5547
- const token = _nullishCoalesce(extra.symbol, () => ( first.asset));
5548
- const hasExact = accepts.some((a) => a.scheme === "exact");
5549
- const standard = hasExact ? "; or any standard x402 client (an exact rail is offered)" : "";
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}.`;
5551
5554
  }
5552
5555
 
5553
5556
  // src/agentGuide.ts
@@ -5654,19 +5657,19 @@ async function readBody(res) {
5654
5657
  if (!text) return null;
5655
5658
  try {
5656
5659
  return JSON.parse(text);
5657
- } catch (e41) {
5660
+ } catch (e42) {
5658
5661
  return text;
5659
5662
  }
5660
5663
  }
5661
5664
  function toToolError(err) {
5662
- if (!(err instanceof _chunk57V5DNJTcjs.PipRailError)) throw err;
5665
+ if (!(err instanceof _chunk3FR22M3Ocjs.PipRailError)) throw err;
5663
5666
  const out = {
5664
5667
  ok: false,
5665
5668
  code: err.code,
5666
5669
  reason: err.message,
5667
5670
  explain: explainDecline(err)
5668
5671
  };
5669
- if (err instanceof _chunk57V5DNJTcjs.PaymentDeclinedError) {
5672
+ if (err instanceof _chunk3FR22M3Ocjs.PaymentDeclinedError) {
5670
5673
  out.declined = true;
5671
5674
  if (err.reasonCode) out.reasonCode = err.reasonCode;
5672
5675
  }
@@ -5882,14 +5885,14 @@ function paymentTools(client) {
5882
5885
  ...verifiable ? { verifiableReceipt: { ...verifiable, resource: { url } } } : {}
5883
5886
  };
5884
5887
  } catch (err) {
5885
- if (err instanceof _chunk57V5DNJTcjs.PipRailError) {
5888
+ if (err instanceof _chunk3FR22M3Ocjs.PipRailError) {
5886
5889
  const out = {
5887
5890
  ok: false,
5888
5891
  code: err.code,
5889
5892
  reason: err.message,
5890
5893
  explain: explainDecline(err)
5891
5894
  };
5892
- if (err instanceof _chunk57V5DNJTcjs.PaymentDeclinedError) {
5895
+ if (err instanceof _chunk3FR22M3Ocjs.PaymentDeclinedError) {
5893
5896
  out.declined = true;
5894
5897
  if (err.reasonCode) out.reasonCode = err.reasonCode;
5895
5898
  }
@@ -6037,17 +6040,29 @@ function paymentTools(client) {
6037
6040
 
6038
6041
  // src/classify.ts
6039
6042
  function classifyChallenge(challenge, opts) {
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]), () => ( []));
6043
- const offeredSchemes = [...new Set(accepts.map((a) => a.scheme))];
6044
- const offeredNetworks = [...new Set(accepts.map((a) => a.network))];
6045
- const onClientChain = accepts.some((a) => a.network === network);
6046
- const payableScheme = accepts.some(
6047
- (a) => a.network === network && schemes.includes(a.scheme)
6048
- );
6049
- const verdict = accepts.length === 0 ? "NO_RAIL" : payableScheme ? "PAYABLE_RAIL" : onClientChain ? "UNPAYABLE_SCHEME" : "WRONG_CHAIN";
6050
- return { onClientChain, payableScheme, offeredSchemes, offeredNetworks, verdict };
6043
+ try {
6044
+ const accepts = Array.isArray(_optionalChain([challenge, 'optionalAccess', _115 => _115.accepts])) ? challenge.accepts : [];
6045
+ const network = _optionalChain([opts, 'optionalAccess', _116 => _116.network]);
6046
+ const schemes = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _117 => _117.schemes]), () => ( []));
6047
+ const offeredSchemes = [
6048
+ ...new Set(accepts.map((a) => _optionalChain([a, 'optionalAccess', _118 => _118.scheme])).filter((s) => s != null))
6049
+ ];
6050
+ const offeredNetworks = [...new Set(accepts.map((a) => _optionalChain([a, 'optionalAccess', _119 => _119.network])).filter((n) => n != null))];
6051
+ const onClientChain = accepts.some((a) => _optionalChain([a, 'optionalAccess', _120 => _120.network]) === network);
6052
+ const payableScheme = accepts.some(
6053
+ (a) => _optionalChain([a, 'optionalAccess', _121 => _121.network]) === network && schemes.includes(_optionalChain([a, 'optionalAccess', _122 => _122.scheme]))
6054
+ );
6055
+ const verdict = accepts.length === 0 ? "NO_RAIL" : payableScheme ? "PAYABLE_RAIL" : onClientChain ? "UNPAYABLE_SCHEME" : "WRONG_CHAIN";
6056
+ return { onClientChain, payableScheme, offeredSchemes, offeredNetworks, verdict };
6057
+ } catch (e43) {
6058
+ return {
6059
+ onClientChain: false,
6060
+ payableScheme: false,
6061
+ offeredSchemes: [],
6062
+ offeredNetworks: [],
6063
+ verdict: "NO_RAIL"
6064
+ };
6065
+ }
6051
6066
  }
6052
6067
 
6053
6068
  // src/discovery.ts
@@ -6089,11 +6104,12 @@ function buildBazaarExtension(descriptor = {}) {
6089
6104
  function pathOf(url) {
6090
6105
  try {
6091
6106
  return new URL(url).pathname || "/";
6092
- } catch (e42) {
6107
+ } catch (e44) {
6093
6108
  return url.startsWith("/") ? url : `/${url}`;
6094
6109
  }
6095
6110
  }
6096
6111
  function buildOpenApi(input) {
6112
+ assertResourceList(_optionalChain([input, 'optionalAccess', _123 => _123.resources]), "buildOpenApi");
6097
6113
  const paths = {};
6098
6114
  for (const r of input.resources) {
6099
6115
  const path = pathOf(r.url);
@@ -6123,18 +6139,27 @@ function buildOpenApi(input) {
6123
6139
  };
6124
6140
  }
6125
6141
  function buildWellKnownX402(input) {
6142
+ assertResourceList(_optionalChain([input, 'optionalAccess', _124 => _124.resources]), "buildWellKnownX402");
6126
6143
  return {
6127
6144
  version: 1,
6128
6145
  resources: input.resources.map((r) => r.url),
6129
6146
  ...input.ownershipProofs && input.ownershipProofs.length > 0 ? { ownershipProofs: input.ownershipProofs } : {}
6130
6147
  };
6131
6148
  }
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
- );
6149
+ function assertResourceList(resources, fn) {
6150
+ if (!Array.isArray(resources)) {
6151
+ throw new (0, _chunk3FR22M3Ocjs.InvalidConfigError)(`${fn}: \`resources\` must be an array of ResourceDescription.`);
6137
6152
  }
6153
+ resources.forEach((r, i) => {
6154
+ if (r === null || typeof r !== "object" || typeof r.url !== "string") {
6155
+ throw new (0, _chunk3FR22M3Ocjs.InvalidConfigError)(
6156
+ `${fn}: resources[${i}] must be a ResourceDescription with a string \`url\`.`
6157
+ );
6158
+ }
6159
+ });
6160
+ }
6161
+ function buildWellKnownX402Manifest(input) {
6162
+ assertResourceList(_optionalChain([input, 'optionalAccess', _125 => _125.resources]), "buildWellKnownX402Manifest");
6138
6163
  const lastUpdated = typeof input.lastUpdated === "number" && Number.isFinite(input.lastUpdated) ? input.lastUpdated : Math.floor(Date.now() / 1e3);
6139
6164
  return {
6140
6165
  x402Version: 2,
@@ -6221,28 +6246,28 @@ async function fetchFacilitatorFeePayer(url, network, timeoutMs = 8e3) {
6221
6246
  const res = await fetch(`${base2}/supported`, { signal: ctrl.signal });
6222
6247
  if (!res.ok) return void 0;
6223
6248
  const body = await res.json();
6224
- const kinds = Array.isArray(_optionalChain([body, 'optionalAccess', _118 => _118.kinds])) ? body.kinds : [];
6249
+ const kinds = Array.isArray(_optionalChain([body, 'optionalAccess', _126 => _126.kinds])) ? body.kinds : [];
6225
6250
  const want = normalizeNetwork(network);
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]);
6251
+ const kind = kinds.find((k) => _optionalChain([k, 'optionalAccess', _127 => _127.scheme]) === "exact" && normalizeNetwork(String(_nullishCoalesce(_optionalChain([k, 'optionalAccess', _128 => _128.network]), () => ( "")))) === want);
6252
+ const fp = _optionalChain([kind, 'optionalAccess', _129 => _129.extra, 'optionalAccess', _130 => _130.feePayer]);
6228
6253
  return typeof fp === "string" ? fp : void 0;
6229
- } catch (e43) {
6254
+ } catch (e45) {
6230
6255
  return void 0;
6231
6256
  } finally {
6232
6257
  clearTimeout(timer);
6233
6258
  }
6234
6259
  }
6235
6260
  function parseFacilitatorSupported(body) {
6236
- const kinds = _optionalChain([body, 'optionalAccess', _123 => _123.kinds]);
6261
+ const kinds = _optionalChain([body, 'optionalAccess', _131 => _131.kinds]);
6237
6262
  if (!Array.isArray(kinds)) return [];
6238
6263
  const out = [];
6239
6264
  for (const k of kinds) {
6240
6265
  if (!k || typeof k !== "object") continue;
6241
6266
  const o = k;
6242
6267
  if (typeof o.scheme !== "string" || typeof o.network !== "string") continue;
6243
- const fp = _optionalChain([o, 'access', _124 => _124.extra, 'optionalAccess', _125 => _125.feePayer]);
6268
+ const fp = _optionalChain([o, 'access', _132 => _132.extra, 'optionalAccess', _133 => _133.feePayer]);
6244
6269
  const ver = o.x402Version;
6245
- const method = _optionalChain([o, 'access', _126 => _126.extra, 'optionalAccess', _127 => _127.assetTransferMethod]);
6270
+ const method = _optionalChain([o, 'access', _134 => _134.extra, 'optionalAccess', _135 => _135.assetTransferMethod]);
6246
6271
  out.push({
6247
6272
  scheme: o.scheme,
6248
6273
  network: o.network,
@@ -6261,7 +6286,7 @@ async function facilitatorCoverage(url, timeoutMs = 8e3) {
6261
6286
  const res = await fetch(`${base2}/supported`, { signal: ctrl.signal });
6262
6287
  if (!res.ok) return [];
6263
6288
  return parseFacilitatorSupported(await res.json());
6264
- } catch (e44) {
6289
+ } catch (e46) {
6265
6290
  return [];
6266
6291
  } finally {
6267
6292
  clearTimeout(timer);
@@ -6290,7 +6315,7 @@ async function post(url, body, headers) {
6290
6315
  let json = null;
6291
6316
  try {
6292
6317
  json = await res.json();
6293
- } catch (e45) {
6318
+ } catch (e47) {
6294
6319
  }
6295
6320
  return { status: res.status, json };
6296
6321
  }
@@ -6306,13 +6331,13 @@ async function settleViaFacilitator(input) {
6306
6331
  try {
6307
6332
  verify = await post(`${base2}/verify`, body, auth);
6308
6333
  } catch (err) {
6309
- throw new (0, _chunk57V5DNJTcjs.SettlementError)(
6334
+ throw new (0, _chunk3FR22M3Ocjs.SettlementError)(
6310
6335
  `exact settle (facilitator ${base2}): /verify request failed (${err instanceof Error ? err.message : String(err)}).`,
6311
6336
  { cause: err }
6312
6337
  );
6313
6338
  }
6314
6339
  if (verify.status !== 200) {
6315
- throw new (0, _chunk57V5DNJTcjs.SettlementError)(
6340
+ throw new (0, _chunk3FR22M3Ocjs.SettlementError)(
6316
6341
  `exact settle (facilitator ${base2}): /verify returned HTTP ${verify.status} (transport/auth error).`
6317
6342
  );
6318
6343
  }
@@ -6328,13 +6353,13 @@ async function settleViaFacilitator(input) {
6328
6353
  try {
6329
6354
  settle = await post(`${base2}/settle`, body, auth);
6330
6355
  } catch (err) {
6331
- throw new (0, _chunk57V5DNJTcjs.SettlementError)(
6356
+ throw new (0, _chunk3FR22M3Ocjs.SettlementError)(
6332
6357
  `exact settle (facilitator ${base2}): /settle request failed (${err instanceof Error ? err.message : String(err)}).`,
6333
6358
  { cause: err }
6334
6359
  );
6335
6360
  }
6336
6361
  if (settle.status !== 200) {
6337
- throw new (0, _chunk57V5DNJTcjs.SettlementError)(
6362
+ throw new (0, _chunk3FR22M3Ocjs.SettlementError)(
6338
6363
  `exact settle (facilitator ${base2}): /settle returned HTTP ${settle.status} (transport/auth error).`
6339
6364
  );
6340
6365
  }
@@ -6684,18 +6709,25 @@ function toInvalidBody(result) {
6684
6709
  return { x402Version: 2, status: "invalid", error: result.error, detail: result.detail };
6685
6710
  }
6686
6711
  function normaliseAccepts(options) {
6687
- if (options.accept && options.accept.length > 0) {
6712
+ if (Array.isArray(options.accept) && options.accept.length > 0) {
6688
6713
  if (options.chain !== void 0 || options.token !== void 0 || options.amount !== void 0) {
6689
- throw new Error(
6714
+ throw new (0, _chunk3FR22M3Ocjs.InvalidConfigError)(
6690
6715
  "requirePayment: pass EITHER `accept: [...]` (multi-chain) OR `chain`/`token`/`amount` (single) \u2014 not both."
6691
6716
  );
6692
6717
  }
6718
+ options.accept.forEach((a, i) => {
6719
+ if (a === null || typeof a !== "object") {
6720
+ throw new (0, _chunk3FR22M3Ocjs.InvalidConfigError)(
6721
+ `requirePayment: accept[${i}] must be { chain, token, amount }, got ${a === null ? "null" : typeof a}.`
6722
+ );
6723
+ }
6724
+ });
6693
6725
  return options.accept;
6694
6726
  }
6695
6727
  if (options.chain !== void 0 && options.token !== void 0 && options.amount !== void 0) {
6696
6728
  return [{ chain: options.chain, token: options.token, amount: options.amount }];
6697
6729
  }
6698
- throw new Error(
6730
+ throw new (0, _chunk3FR22M3Ocjs.InvalidConfigError)(
6699
6731
  "requirePayment: provide either { chain, token, amount } or a non-empty `accept: [{ chain, token, amount }, \u2026]`."
6700
6732
  );
6701
6733
  }
@@ -6729,7 +6761,7 @@ function createPaymentGate(options) {
6729
6761
  attestWarned = true;
6730
6762
  try {
6731
6763
  console.warn(`[piprail] receipts.attest ${reason}; emitting an unsigned Tier-1 receipt instead.`);
6732
- } catch (e46) {
6764
+ } catch (e48) {
6733
6765
  }
6734
6766
  }
6735
6767
  let resolved;
@@ -6744,13 +6776,13 @@ function createPaymentGate(options) {
6744
6776
  const net = await resolveNetwork2({ chain: a.chain, rpcUrl: _nullishCoalesce(a.rpcUrl, () => ( options.rpcUrl)) });
6745
6777
  const payTo = _nullishCoalesce(a.payTo, () => ( options.payTo));
6746
6778
  if (!payTo) {
6747
- throw new (0, _chunk57V5DNJTcjs.InvalidConfigError)(
6779
+ throw new (0, _chunk3FR22M3Ocjs.InvalidConfigError)(
6748
6780
  `requirePayment: no payTo for chain ${net.network}. Set it on the accept entry or pass a top-level payTo.`
6749
6781
  );
6750
6782
  }
6751
6783
  net.assertValidPayTo(payTo);
6752
6784
  const { asset, decimals, symbol } = net.resolveToken(a.token);
6753
- const amountBase = _chunk57V5DNJTcjs.parseUnits.call(void 0, a.amount, decimals);
6785
+ const amountBase = _chunk3FR22M3Ocjs.parseUnits.call(void 0, a.amount, decimals);
6754
6786
  const spec = { net, asset, decimals, symbol, amountBase, amountFormatted: a.amount, payTo };
6755
6787
  if (exactOption) {
6756
6788
  const outcome = await resolveExactRail(net, asset);
@@ -6773,7 +6805,7 @@ function createPaymentGate(options) {
6773
6805
  if (exactOption && !specs.some((s) => s.exact)) {
6774
6806
  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.";
6775
6807
  if (exactOption.settle === "keyless") {
6776
- if (typeof process === "undefined" || !_optionalChain([process, 'optionalAccess', _128 => _128.env, 'optionalAccess', _129 => _129.PIPRAIL_NO_HINTS])) {
6808
+ if (typeof process === "undefined" || !_optionalChain([process, 'optionalAccess', _136 => _136.env, 'optionalAccess', _137 => _137.PIPRAIL_NO_HINTS])) {
6777
6809
  console.warn(
6778
6810
  `[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.)`
6779
6811
  );
@@ -6801,7 +6833,7 @@ function createPaymentGate(options) {
6801
6833
  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).`
6802
6834
  };
6803
6835
  }
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])) {
6836
+ if (typeof process === "undefined" || _optionalChain([process, 'optionalAccess', _138 => _138.env, 'optionalAccess', _139 => _139.NODE_ENV]) !== "production" && !_optionalChain([process, 'optionalAccess', _140 => _140.env, 'optionalAccess', _141 => _141.PIPRAIL_NO_HINTS])) {
6805
6837
  console.warn(
6806
6838
  `[piprail] exact: keyless rail on ${net.network} auto-settles via ${picked.url} (zero-config; pin \`exact.settle.facilitator\` in production).`
6807
6839
  );
@@ -6945,7 +6977,7 @@ function createPaymentGate(options) {
6945
6977
  extra: {
6946
6978
  assetTransferMethod: "permit2-upto",
6947
6979
  // facilitatorAddress comes from rail.extra; the spread below carries it (+ name/version).
6948
- facilitatorAddress: _nullishCoalesce(_optionalChain([rail, 'access', _134 => _134.extra, 'optionalAccess', _135 => _135.facilitatorAddress]), () => ( "")),
6980
+ facilitatorAddress: _nullishCoalesce(_optionalChain([rail, 'access', _142 => _142.extra, 'optionalAccess', _143 => _143.facilitatorAddress]), () => ( "")),
6949
6981
  minConfirmations,
6950
6982
  decimals: s.decimals,
6951
6983
  amountFormatted: s.amountFormatted,
@@ -6980,7 +7012,7 @@ function createPaymentGate(options) {
6980
7012
  ...endpointInfo ? { endpoint: endpointInfo } : {},
6981
7013
  ...receiptsOn ? { verifiableReceipts: true } : {}
6982
7014
  });
6983
- const rejectionExt = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _136 => _136.extensions]), () => ( {}));
7015
+ const rejectionExt = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _144 => _144.extensions]), () => ( {}));
6984
7016
  const rejectionPiprail = _nullishCoalesce(rejectionExt.piprail, () => ( {}));
6985
7017
  const bodyPiprail = { ..._nullishCoalesce(selfDescribe, () => ( {})), ...rejectionPiprail };
6986
7018
  const bodyExtensions = {
@@ -7002,7 +7034,7 @@ function createPaymentGate(options) {
7002
7034
  ...options.mimeType ? { mimeType: options.mimeType } : {}
7003
7035
  },
7004
7036
  accepts,
7005
- ..._optionalChain([opts, 'optionalAccess', _137 => _137.error]) ? { error: opts.error } : {},
7037
+ ..._optionalChain([opts, 'optionalAccess', _145 => _145.error]) ? { error: opts.error } : {},
7006
7038
  ...Object.keys(bodyExtensions).length > 0 ? { extensions: bodyExtensions } : {}
7007
7039
  };
7008
7040
  const headerChallenge = {
@@ -7033,8 +7065,8 @@ function createPaymentGate(options) {
7033
7065
  function enrichReceipt(spec, receipt) {
7034
7066
  let amountFormatted = receipt.amount;
7035
7067
  try {
7036
- amountFormatted = _chunk57V5DNJTcjs.formatUnits.call(void 0, BigInt(receipt.amount), spec.decimals);
7037
- } catch (e47) {
7068
+ amountFormatted = _chunk3FR22M3Ocjs.formatUnits.call(void 0, BigInt(receipt.amount), spec.decimals);
7069
+ } catch (e49) {
7038
7070
  }
7039
7071
  return {
7040
7072
  ...receipt,
@@ -7048,7 +7080,7 @@ function createPaymentGate(options) {
7048
7080
  if (!options.onPaidError) return;
7049
7081
  try {
7050
7082
  options.onPaidError(error, receipt);
7051
- } catch (e48) {
7083
+ } catch (e50) {
7052
7084
  }
7053
7085
  }
7054
7086
  function fireOnPaid(receipt) {
@@ -7088,7 +7120,7 @@ function createPaymentGate(options) {
7088
7120
  ...attestation ? { attestation } : {}
7089
7121
  });
7090
7122
  return { kind: "paid", receipt: stamped, receiptHeader: buildReceiptHeader(stamped, extensions) };
7091
- } catch (e49) {
7123
+ } catch (e51) {
7092
7124
  return { kind: "paid", receipt, receiptHeader: buildReceiptHeader(receipt) };
7093
7125
  }
7094
7126
  }
@@ -7113,7 +7145,7 @@ function createPaymentGate(options) {
7113
7145
  // §5.3: the signed message carries the empty string for a suppressed tx, never omitted.
7114
7146
  transaction: receiptIncludeTxHash ? stamped.transaction : ""
7115
7147
  });
7116
- } catch (e50) {
7148
+ } catch (e52) {
7117
7149
  warnAttestDegrade("signing failed");
7118
7150
  return void 0;
7119
7151
  }
@@ -7122,7 +7154,7 @@ function createPaymentGate(options) {
7122
7154
  if (!options.onFailedError) return;
7123
7155
  try {
7124
7156
  options.onFailedError(error, failure);
7125
- } catch (e51) {
7157
+ } catch (e53) {
7126
7158
  }
7127
7159
  }
7128
7160
  function fireOnFailed(failure) {
@@ -7241,28 +7273,28 @@ function createPaymentGate(options) {
7241
7273
  nonce = [exact.payload.transaction, exact.payload.senderAuth].map((t) => {
7242
7274
  try {
7243
7275
  return Buffer.from(t, "base64").toString("base64");
7244
- } catch (e52) {
7276
+ } catch (e54) {
7245
7277
  return t;
7246
7278
  }
7247
7279
  }).join("|");
7248
7280
  } else if ("transaction" in exact.payload) {
7249
7281
  try {
7250
7282
  nonce = Buffer.from(exact.payload.transaction, "base64").toString("base64");
7251
- } catch (e53) {
7283
+ } catch (e55) {
7252
7284
  nonce = exact.payload.transaction;
7253
7285
  }
7254
7286
  } else if ("paymentGroup" in exact.payload) {
7255
7287
  nonce = exact.payload.paymentGroup.map((t) => {
7256
7288
  try {
7257
7289
  return Buffer.from(t, "base64").toString("base64");
7258
- } catch (e54) {
7290
+ } catch (e56) {
7259
7291
  return t;
7260
7292
  }
7261
7293
  }).join("|");
7262
7294
  } else if ("signedDelegateAction" in exact.payload) {
7263
7295
  try {
7264
7296
  nonce = Buffer.from(exact.payload.signedDelegateAction, "base64").toString("base64");
7265
- } catch (e55) {
7297
+ } catch (e57) {
7266
7298
  nonce = exact.payload.signedDelegateAction;
7267
7299
  }
7268
7300
  } else if ("permit2Authorization" in exact.payload) {
@@ -7285,7 +7317,7 @@ function createPaymentGate(options) {
7285
7317
  const ftMethod = accept.extra.assetTransferMethod;
7286
7318
  const needsFeePayer = ftMethod === "svm" || ftMethod === "algorand" || ftMethod === "aptos" || ftMethod === "near";
7287
7319
  if (needsFeePayer && !accept.extra.feePayer) {
7288
- throw new (0, _chunk57V5DNJTcjs.SettlementError)(
7320
+ throw new (0, _chunk3FR22M3Ocjs.SettlementError)(
7289
7321
  `exact settle: the ${ftMethod} facilitator rail is missing extra.feePayer (the gas sponsor) \u2014 cannot settle.`
7290
7322
  );
7291
7323
  }
@@ -7333,16 +7365,16 @@ function createPaymentGate(options) {
7333
7365
  if (s.endsWith("%")) {
7334
7366
  const pct = s.slice(0, -1).trim();
7335
7367
  if (!/^\d+(\.\d+)?$/.test(pct)) return null;
7336
- const pctScaled = _chunk57V5DNJTcjs.floorUnits.call(void 0, pct, 4);
7368
+ const pctScaled = _chunk3FR22M3Ocjs.floorUnits.call(void 0, pct, 4);
7337
7369
  return maxAmount * pctScaled / (100n * 10n ** 4n);
7338
7370
  }
7339
7371
  if (s.startsWith("$")) {
7340
7372
  const amt = s.slice(1).trim();
7341
- return _chunk57V5DNJTcjs.floorUnits.call(void 0, amt, decimals);
7373
+ return _chunk3FR22M3Ocjs.floorUnits.call(void 0, amt, decimals);
7342
7374
  }
7343
7375
  if (/^\d+$/.test(s)) return BigInt(s);
7344
- return _chunk57V5DNJTcjs.floorUnits.call(void 0, s, decimals);
7345
- } catch (e56) {
7376
+ return _chunk3FR22M3Ocjs.floorUnits.call(void 0, s, decimals);
7377
+ } catch (e58) {
7346
7378
  return null;
7347
7379
  }
7348
7380
  }
@@ -7392,7 +7424,7 @@ function createPaymentGate(options) {
7392
7424
  result = await spec.net.settleUptoSelf({ relayer, payload: upto.payload, accept, settleAmount });
7393
7425
  } catch (err) {
7394
7426
  await settleTx(nonce, false);
7395
- if (err instanceof _chunk57V5DNJTcjs.SettlementError) throw err;
7427
+ if (err instanceof _chunk3FR22M3Ocjs.SettlementError) throw err;
7396
7428
  return rejection(
7397
7429
  "tx_reverted",
7398
7430
  `upto: metering/settle failed (${err instanceof Error ? err.message : String(err)}).`
@@ -7439,7 +7471,7 @@ function createPaymentGate(options) {
7439
7471
  [EXT_PAYMENT_IDENTIFIER]: { info: { required: false, id } }
7440
7472
  };
7441
7473
  return { ...result, receiptHeader: buildReceiptHeader(receiptOnly, merged) };
7442
- } catch (e57) {
7474
+ } catch (e59) {
7443
7475
  return result;
7444
7476
  }
7445
7477
  }
@@ -7471,7 +7503,7 @@ function createPaymentGate(options) {
7471
7503
  }
7472
7504
  function requirePayment(options) {
7473
7505
  if (options.upto) {
7474
- throw new (_class3 = class extends _chunk57V5DNJTcjs.PipRailError {constructor(...args2) { super(...args2); _class3.prototype.__init7.call(this); }
7506
+ throw new (_class3 = class extends _chunk3FR22M3Ocjs.PipRailError {constructor(...args2) { super(...args2); _class3.prototype.__init7.call(this); }
7475
7507
  __init7() {this.code = "UNSUPPORTED_SCHEME"}
7476
7508
  }, _class3)(
7477
7509
  "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."
@@ -7483,7 +7515,7 @@ function requirePayment(options) {
7483
7515
  try {
7484
7516
  result = await gate.verify(_nullishCoalesce(req.headers[HEADER_SIGNATURE], () => ( req.headers[HEADER_SIGNATURE_V1])));
7485
7517
  } catch (err) {
7486
- if (err instanceof _chunk57V5DNJTcjs.SettlementError) {
7518
+ if (err instanceof _chunk3FR22M3Ocjs.SettlementError) {
7487
7519
  res.status(502);
7488
7520
  res.json({
7489
7521
  x402Version: 2,
@@ -7531,7 +7563,7 @@ function isRetryableStatus(status) {
7531
7563
  }
7532
7564
  var sleep = (ms) => ms > 0 ? new Promise((resolve) => setTimeout(resolve, ms)) : Promise.resolve();
7533
7565
  async function signBody(secret, body) {
7534
- const subtle = _optionalChain([globalThis, 'access', _138 => _138.crypto, 'optionalAccess', _139 => _139.subtle]);
7566
+ const subtle = _optionalChain([globalThis, 'access', _146 => _146.crypto, 'optionalAccess', _147 => _147.subtle]);
7535
7567
  if (!subtle) return null;
7536
7568
  try {
7537
7569
  const enc = new TextEncoder();
@@ -7541,7 +7573,7 @@ async function signBody(secret, body) {
7541
7573
  const sig = await subtle.sign("HMAC", key, enc.encode(body));
7542
7574
  const hex = Array.from(new Uint8Array(sig)).map((b) => b.toString(16).padStart(2, "0")).join("");
7543
7575
  return `sha256=${hex}`;
7544
- } catch (e58) {
7576
+ } catch (e60) {
7545
7577
  return null;
7546
7578
  }
7547
7579
  }
@@ -7601,8 +7633,8 @@ async function deliverReceipt(receipt, options) {
7601
7633
  const retryable = status === void 0 ? true : isRetryableStatus(status);
7602
7634
  const willRetry = !ok && retryable && attempt < maxAttempts;
7603
7635
  try {
7604
- _optionalChain([onAttempt, 'optionalCall', _140 => _140({ attempt, ok, ...status !== void 0 ? { status } : {}, ...error ? { error } : {}, willRetry })]);
7605
- } catch (e59) {
7636
+ _optionalChain([onAttempt, 'optionalCall', _148 => _148({ attempt, ok, ...status !== void 0 ? { status } : {}, ...error ? { error } : {}, willRetry })]);
7637
+ } catch (e61) {
7606
7638
  }
7607
7639
  if (ok) return { delivered: true, attempts: attempt, status };
7608
7640
  if (!willRetry) {
@@ -7690,13 +7722,13 @@ function toA2APaymentFailed(code, detail, receipts = [], network) {
7690
7722
  };
7691
7723
  }
7692
7724
  function fromA2APaymentRequired(task) {
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]]);
7725
+ const meta = _optionalChain([task, 'access', _149 => _149.status, 'optionalAccess', _150 => _150.message, 'optionalAccess', _151 => _151.metadata]);
7726
+ const required = _optionalChain([meta, 'optionalAccess', _152 => _152[A2A_REQUIRED_KEY]]);
7695
7727
  if (!required || typeof required !== "object") return null;
7696
7728
  return required;
7697
7729
  }
7698
7730
  function fromA2APaymentPayload(message) {
7699
- const raw = _optionalChain([message, 'access', _145 => _145.metadata, 'optionalAccess', _146 => _146[A2A_PAYLOAD_KEY]]);
7731
+ const raw = _optionalChain([message, 'access', _153 => _153.metadata, 'optionalAccess', _154 => _154[A2A_PAYLOAD_KEY]]);
7700
7732
  if (raw === void 0 || raw === null) return null;
7701
7733
  return { raw, taskId: _nullishCoalesce(message.taskId, () => ( "")) };
7702
7734
  }
@@ -7729,7 +7761,7 @@ function createA2APaymentHandler(options) {
7729
7761
  const ttlMs = _nullishCoalesce(options.taskTtlMs, () => ( maxTimeoutSeconds * 1e3));
7730
7762
  const store = _nullishCoalesce(options.taskStore, () => ( defaultTaskStore()));
7731
7763
  function appendReceipt(taskId, entry) {
7732
- const prior = _nullishCoalesce(_optionalChain([store, 'access', _147 => _147.get, 'call', _148 => _148(taskId), 'optionalAccess', _149 => _149.receipts]), () => ( []));
7764
+ const prior = _nullishCoalesce(_optionalChain([store, 'access', _155 => _155.get, 'call', _156 => _156(taskId), 'optionalAccess', _157 => _157.receipts]), () => ( []));
7733
7765
  const isDup = "success" in entry && entry.success === true && entry.transaction !== "" && prior.some((r) => "transaction" in r && r.transaction === entry.transaction);
7734
7766
  const next = isDup ? prior : [...prior, entry];
7735
7767
  const receipts = next.length > MAX_TASK_RECEIPTS ? next.slice(-MAX_TASK_RECEIPTS) : next;
@@ -7805,7 +7837,7 @@ function createA2APaymentHandler(options) {
7805
7837
  try {
7806
7838
  result = await gate.verifyObject(inbound.raw);
7807
7839
  } catch (err) {
7808
- if (err instanceof _chunk57V5DNJTcjs.SettlementError) {
7840
+ if (err instanceof _chunk3FR22M3Ocjs.SettlementError) {
7809
7841
  return failedTask(id, "settlement_failed", err.message, attempted);
7810
7842
  }
7811
7843
  const detail = err instanceof Error ? err.message : String(err);
@@ -7837,11 +7869,11 @@ function createA2APaymentHandler(options) {
7837
7869
  }
7838
7870
  }
7839
7871
  function agentCardExtension(opts) {
7840
- const uri = _optionalChain([opts, 'optionalAccess', _150 => _150.version]) === "v0.2" ? A2A_X402_EXTENSION_URI_V02 : A2A_X402_EXTENSION_URI_V01;
7872
+ const uri = _optionalChain([opts, 'optionalAccess', _158 => _158.version]) === "v0.2" ? A2A_X402_EXTENSION_URI_V02 : A2A_X402_EXTENSION_URI_V01;
7841
7873
  return {
7842
7874
  uri,
7843
7875
  description: "Supports payments using the x402 protocol for on-chain settlement.",
7844
- ..._optionalChain([opts, 'optionalAccess', _151 => _151.required]) ? { required: true } : {}
7876
+ ..._optionalChain([opts, 'optionalAccess', _159 => _159.required]) ? { required: true } : {}
7845
7877
  };
7846
7878
  }
7847
7879
  return { handleMessage, agentCardExtension, gate };
@@ -7852,7 +7884,7 @@ function singleNetworkOf(challenge) {
7852
7884
  }
7853
7885
  function networkFromPayload(raw) {
7854
7886
  const v = raw;
7855
- if (v && typeof _optionalChain([v, 'access', _152 => _152.accepted, 'optionalAccess', _153 => _153.network]) === "string") return v.accepted.network;
7887
+ if (v && typeof _optionalChain([v, 'access', _160 => _160.accepted, 'optionalAccess', _161 => _161.network]) === "string") return v.accepted.network;
7856
7888
  if (v && typeof v.network === "string") return v.network;
7857
7889
  return void 0;
7858
7890
  }
@@ -7894,7 +7926,7 @@ function toMcpPaymentResponse(content, receipt) {
7894
7926
  };
7895
7927
  }
7896
7928
  function fromMcpPayment(params) {
7897
- const meta = _optionalChain([params, 'optionalAccess', _154 => _154._meta, 'optionalAccess', _155 => _155[MCP_PAYMENT_META_KEY]]);
7929
+ const meta = _optionalChain([params, 'optionalAccess', _162 => _162._meta, 'optionalAccess', _163 => _163[MCP_PAYMENT_META_KEY]]);
7898
7930
  return meta == null ? null : meta;
7899
7931
  }
7900
7932
  function fromMcpPaymentRequired(result) {
@@ -7903,14 +7935,14 @@ function fromMcpPaymentRequired(result) {
7903
7935
  if (sc && typeof sc === "object" && typeof sc.x402Version === "number") {
7904
7936
  return sc;
7905
7937
  }
7906
- const text = _optionalChain([result, 'access', _156 => _156.content, 'optionalAccess', _157 => _157[0], 'optionalAccess', _158 => _158.text]);
7938
+ const text = _optionalChain([result, 'access', _164 => _164.content, 'optionalAccess', _165 => _165[0], 'optionalAccess', _166 => _166.text]);
7907
7939
  if (typeof text === "string") {
7908
7940
  try {
7909
7941
  const parsed = JSON.parse(text);
7910
7942
  if (parsed && typeof parsed === "object" && typeof parsed.x402Version === "number") {
7911
7943
  return parsed;
7912
7944
  }
7913
- } catch (e60) {
7945
+ } catch (e62) {
7914
7946
  }
7915
7947
  }
7916
7948
  return null;
@@ -7919,7 +7951,7 @@ function isMcpPaymentRequired(result) {
7919
7951
  return fromMcpPaymentRequired(result) != null;
7920
7952
  }
7921
7953
  function fromMcpPaymentResponse(result) {
7922
- const meta = _optionalChain([result, 'optionalAccess', _159 => _159._meta, 'optionalAccess', _160 => _160[MCP_PAYMENT_RESPONSE_META_KEY]]);
7954
+ const meta = _optionalChain([result, 'optionalAccess', _167 => _167._meta, 'optionalAccess', _168 => _168[MCP_PAYMENT_RESPONSE_META_KEY]]);
7923
7955
  if (!meta || typeof meta !== "object") return null;
7924
7956
  return meta;
7925
7957
  }
@@ -7956,7 +7988,7 @@ function createMcpPaymentTool(options) {
7956
7988
  try {
7957
7989
  result = await gate.verifyObject(raw);
7958
7990
  } catch (err) {
7959
- if (err instanceof _chunk57V5DNJTcjs.SettlementError) return settlementFailed("settlement_failed", err.message);
7991
+ if (err instanceof _chunk3FR22M3Ocjs.SettlementError) return settlementFailed("settlement_failed", err.message);
7960
7992
  throw err;
7961
7993
  }
7962
7994
  if (result.kind === "paid") {
@@ -8123,4 +8155,4 @@ function createMcpPaymentTool(options) {
8123
8155
 
8124
8156
 
8125
8157
 
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;
8158
+ 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 = _chunk3FR22M3Ocjs.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 = _chunk3FR22M3Ocjs.InsufficientFundsError; exports.InvalidConfigError = _chunk3FR22M3Ocjs.InvalidConfigError; exports.InvalidEnvelopeError = _chunk3FR22M3Ocjs.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 = _chunk3FR22M3Ocjs.MaxRetriesExceededError; exports.MissingDriverError = _chunk3FR22M3Ocjs.MissingDriverError; exports.MultiChainPayer = MultiChainPayer; exports.NoCompatibleAcceptError = _chunk3FR22M3Ocjs.NoCompatibleAcceptError; exports.NonReplayableBodyError = _chunk3FR22M3Ocjs.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 = _chunk3FR22M3Ocjs.PaymentDeclinedError; exports.PaymentTimeoutError = _chunk3FR22M3Ocjs.PaymentTimeoutError; exports.PipRailClient = PipRailClient; exports.PipRailError = _chunk3FR22M3Ocjs.PipRailError; exports.REGISTER_ATTRIBUTION = REGISTER_ATTRIBUTION; exports.RecipientNotReadyError = _chunk3FR22M3Ocjs.RecipientNotReadyError; exports.SettlementError = _chunk3FR22M3Ocjs.SettlementError; exports.SpendLedger = SpendLedger; exports.UPTO_PROXY_CHAIN_IDS = UPTO_PROXY_CHAIN_IDS; exports.UnknownTokenError = _chunk3FR22M3Ocjs.UnknownTokenError; exports.UnsupportedNetworkError = _chunk3FR22M3Ocjs.UnsupportedNetworkError; exports.UnsupportedSchemeError = _chunk3FR22M3Ocjs.UnsupportedSchemeError; exports.VERIFY_CODE_TO_A2A_ERROR = VERIFY_CODE_TO_A2A_ERROR; exports.WalletRequiredError = _chunk3FR22M3Ocjs.WalletRequiredError; exports.WrongChainError = _chunk3FR22M3Ocjs.WrongChainError; exports.WrongFamilyError = _chunk3FR22M3Ocjs.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 = _chunk3FR22M3Ocjs.toInsufficientFundsError; exports.toInvalidBody = toInvalidBody; exports.toMcpPaymentRequired = toMcpPaymentRequired; exports.toMcpPaymentResponse = toMcpPaymentResponse; exports.verify402IndexDomain = verify402IndexDomain;