@zkp2p/cash 0.2.0 → 0.3.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -23,6 +23,12 @@ var CASH_ORDER_STATUSES = [
23
23
  ];
24
24
  var CASH_ORDER_POLL_INTERVAL_MS = 5e3;
25
25
  var CASH_RETAIN_ON_EMPTY = false;
26
+ function payoutCurrencies(payout) {
27
+ if (payout.currency === void 0 === (payout.currencies === void 0)) {
28
+ throw new Error("Pass exactly one of payout currency or currencies");
29
+ }
30
+ return payout.currencies ?? [payout.currency];
31
+ }
26
32
  function isMarketRateSupported(currency, adapters) {
27
33
  return sdk.getSpreadOracleConfig(currency, adapters) != null;
28
34
  }
@@ -54,14 +60,32 @@ async function prepareCashDepositParams(client, input, adapters) {
54
60
  const runtimeEnv = client.runtimeEnv;
55
61
  const catalog = sdk.getPaymentMethodsCatalog(chainId, runtimeEnv);
56
62
  const intentGatingService = sdk.getGatingServiceAddress(chainId, runtimeEnv);
63
+ const processorNames = payouts.map((p) => p.processorName);
64
+ const paymentMethodsOverride = processorNames.map(
65
+ (name) => sdk.resolvePaymentMethodHashFromCatalog(name, catalog)
66
+ );
57
67
  for (const payout of payouts) {
58
- if (!isMarketRateSupported(payout.currency, adapters)) {
59
- throw new Error(
60
- `${payout.currency} has no live market-rate oracle feed; Peer Cash supports market-rate currencies only.`
61
- );
68
+ const currencies = payoutCurrencies(payout);
69
+ if (currencies.length === 0 || new Set(currencies).size !== currencies.length) {
70
+ throw new Error("Payout currencies must be non-empty and unique");
71
+ }
72
+ const supportedCurrencyHashes = new Set(
73
+ (catalog[payout.processorName.toLowerCase()]?.currencies ?? []).map(
74
+ (hash) => hash.toLowerCase()
75
+ )
76
+ );
77
+ for (const currency of currencies) {
78
+ if (!isMarketRateSupported(currency, adapters)) {
79
+ throw new Error(
80
+ `${currency} has no live market-rate oracle feed; Peer Cash supports market-rate currencies only.`
81
+ );
82
+ }
83
+ const currencyHash = sdk.currencyInfo[currency]?.currencyCodeHash;
84
+ if (!currencyHash || !supportedCurrencyHashes.has(currencyHash.toLowerCase())) {
85
+ throw new Error(`${payout.processorName} does not support ${currency}`);
86
+ }
62
87
  }
63
88
  }
64
- const processorNames = payouts.map((p) => p.processorName);
65
89
  const { hashedOnchainIds } = await client.registerPayeeDetails({
66
90
  processorNames,
67
91
  payeeData: payouts.map((p) => p.payeeData)
@@ -69,22 +93,24 @@ async function prepareCashDepositParams(client, input, adapters) {
69
93
  if (hashedOnchainIds.length !== payouts.length) {
70
94
  throw new Error("Payee registration returned an unexpected number of hashes");
71
95
  }
72
- const paymentMethodsOverride = processorNames.map(
73
- (name) => sdk.resolvePaymentMethodHashFromCatalog(name, catalog)
74
- );
75
96
  const paymentMethodDataOverride = hashedOnchainIds.map((hid) => ({
76
97
  intentGatingService,
77
98
  payeeDetails: hid,
78
99
  data: "0x"
79
100
  }));
80
- const currenciesOverride = payouts.map((p) => {
81
- const tuple = buildMarketRateCurrencyOverride(p.currency, adapters);
82
- if (!tuple) throw new Error(`Failed to build market-rate config for ${p.currency}`);
83
- return [tuple];
84
- });
85
- const conversionRates = payouts.map((p) => [
86
- { currency: p.currency, conversionRate: ORACLE_MIN_CONVERSION_RATE_SENTINEL.toString() }
87
- ]);
101
+ const currenciesOverride = payouts.map(
102
+ (payout) => payoutCurrencies(payout).map((currency) => {
103
+ const tuple = buildMarketRateCurrencyOverride(currency, adapters);
104
+ if (!tuple) throw new Error(`Failed to build market-rate config for ${currency}`);
105
+ return tuple;
106
+ })
107
+ );
108
+ const conversionRates = payouts.map(
109
+ (payout) => payoutCurrencies(payout).map((currency) => ({
110
+ currency,
111
+ conversionRate: ORACLE_MIN_CONVERSION_RATE_SENTINEL.toString()
112
+ }))
113
+ );
88
114
  const intentAmountRange = input.intentAmountRange ?? buildIntentAmountRange(input.amount);
89
115
  return {
90
116
  token: input.token ?? BASE_USDC_ADDRESS,
@@ -381,21 +407,33 @@ function resolveCashDepositId(params) {
381
407
  events = viem.parseEventLogs({
382
408
  abi: params.abi,
383
409
  eventName: "DepositReceived",
384
- logs: params.logs
410
+ logs: [...params.logs]
385
411
  });
386
412
  } catch {
387
413
  return null;
388
414
  }
389
- const event = events[0];
390
- if (!event) return null;
415
+ const matchingEvents = events.filter((event2) => {
416
+ if (params.expectedEscrowAddress !== void 0 && event2.address.toLowerCase() !== params.expectedEscrowAddress.toLowerCase()) {
417
+ return false;
418
+ }
419
+ if (params.expectedToken !== void 0 && String(event2.args.token ?? "").toLowerCase() !== params.expectedToken.toLowerCase()) {
420
+ return false;
421
+ }
422
+ return true;
423
+ });
424
+ if (matchingEvents.length !== 1) return null;
425
+ const event = matchingEvents[0];
391
426
  const rawId = event.args.depositId;
392
427
  if (rawId === void 0 || rawId === null) return null;
393
428
  const onchainDepositId = BigInt(rawId);
429
+ const rawAmount = event.args.amount;
430
+ const amount = rawAmount === void 0 || rawAmount === null ? void 0 : BigInt(rawAmount);
394
431
  const escrowAddress = event.address.toLowerCase();
395
432
  return {
396
433
  onchainDepositId,
397
434
  escrowAddress,
398
- compositeId: sdk.createCompositeDepositId(escrowAddress, onchainDepositId)
435
+ compositeId: sdk.createCompositeDepositId(escrowAddress, onchainDepositId),
436
+ ...amount === void 0 ? {} : { amount }
399
437
  };
400
438
  }
401
439
  function parseCompositeDepositId(compositeId) {
@@ -521,6 +559,12 @@ var errors = {
521
559
  retryable: false,
522
560
  remediation: `Use a positive minimum no greater than the maximum, and a maximum no greater than the cash-out amount.`
523
561
  }),
562
+ invalidPayoutCurrencies: (platform, reason) => new CashError({
563
+ code: "INVALID_PAYOUT_CURRENCIES",
564
+ message: `The ${platform} payout currency set is invalid: ${reason}.`,
565
+ retryable: false,
566
+ remediation: `Pass one or more unique currencies listed for ${platform} by capabilities().`
567
+ }),
524
568
  activeIntentBlocksWithdrawal: (depositId) => new CashError({
525
569
  code: "ACTIVE_INTENT_BLOCKS_WITHDRAWAL",
526
570
  message: `Order ${depositId} has a live buyer intent; escrow blocks withdrawal while a buyer may still deliver.`,
@@ -724,7 +768,12 @@ var errors = {
724
768
  code: "DEPOSIT_RESOLUTION_FAILED",
725
769
  message: `Deposit transaction ${txHash} succeeded but no DepositReceived event was found in the receipt.`,
726
770
  retryable: false,
727
- remediation: `Inspect the transaction on Basescan; recover the depositId from the DepositReceived log manually, then resume with order(depositId).`
771
+ remediation: `Inspect the transaction on Basescan; recover the depositId from the DepositReceived log manually, then resume with order(depositId).`,
772
+ recovery: {
773
+ kind: "inspect-base-transaction",
774
+ transactionHash: txHash,
775
+ operation: "cashout"
776
+ }
728
777
  }),
729
778
  signerRequired: (verb) => new CashError({
730
779
  code: "SIGNER_REQUIRED",
@@ -762,6 +811,15 @@ var errors = {
762
811
  },
763
812
  { cause }
764
813
  ),
814
+ transactionRejected: (verb, cause) => new CashError(
815
+ {
816
+ code: "TRANSACTION_REJECTED",
817
+ message: `The ${verb} wallet request was cancelled.`,
818
+ retryable: true,
819
+ remediation: `Retry the original Peer Cash action and approve the wallet request when you are ready.`
820
+ },
821
+ { cause }
822
+ ),
765
823
  transactionSubmissionUnknown: (operation, cause, recovery) => new CashError(
766
824
  {
767
825
  code: "TRANSACTION_SUBMISSION_UNKNOWN",
@@ -805,6 +863,7 @@ var errors = {
805
863
  };
806
864
  function mapChainError(verb, err, context = {}) {
807
865
  if (isCashError(err)) return err;
866
+ if (isUserRejectedError(err)) return errors.transactionRejected(verb, err);
808
867
  const message = err instanceof Error ? err.message : String(err);
809
868
  if (/\bpaused\b/i.test(message)) return errors.escrowPaused();
810
869
  if (/exceeds balance|insufficient token balance/i.test(message)) {
@@ -815,6 +874,42 @@ function mapChainError(verb, err, context = {}) {
815
874
  }
816
875
  return errors.chainCallFailed(verb, err);
817
876
  }
877
+ function hasUserRejectionText(value) {
878
+ const normalized = value.toLowerCase().replace(/[^a-z0-9]+/g, "");
879
+ return normalized.includes("userrejected") || normalized.includes("userdenied") || normalized.includes("requestrejected") || normalized.includes("rejectedrequest") || /(^|[^a-z0-9])action[_ -]?rejected(?:error)?($|[^a-z0-9])/i.test(value) || normalized === "actionrejected" || normalized === "actionrejectederror";
880
+ }
881
+ function isUserRejectedError(value) {
882
+ const seen = /* @__PURE__ */ new Set();
883
+ const text = [];
884
+ let current = value;
885
+ while (current !== null && !seen.has(current)) {
886
+ seen.add(current);
887
+ if (current === -32003 || current === "-32003") return false;
888
+ if (current === 4001 || current === "4001" || current === 5e3 || current === "5000") {
889
+ return true;
890
+ }
891
+ if (typeof current === "string") {
892
+ text.push(current);
893
+ break;
894
+ }
895
+ if (typeof current !== "object" && typeof current !== "function") break;
896
+ const detail = current;
897
+ if (detail.code === -32003 || detail.code === "-32003" || detail.name === "TransactionRejectedRpcError") {
898
+ return false;
899
+ }
900
+ if (detail.code === 4001 || detail.code === "4001" || detail.code === 5e3 || detail.code === "5000" || detail.code === "ACTION_REJECTED" || detail.name === "UserRejectedRequestError") {
901
+ return true;
902
+ }
903
+ text.push(
904
+ ...[detail.name, detail.message, detail.code].filter(
905
+ (part) => typeof part === "string"
906
+ )
907
+ );
908
+ if (detail.cause === void 0) break;
909
+ current = detail.cause;
910
+ }
911
+ return text.some(hasUserRejectionText);
912
+ }
818
913
  var FILL_STATS_WINDOW_SECONDS = 30 * 24 * 60 * 60;
819
914
  var FILL_STATS_PAGE_LIMIT = 250;
820
915
  function toUnixSeconds2(value) {
@@ -864,6 +959,26 @@ function computeFillStatsSample(deposits, nowSeconds, environment) {
864
959
  const createdAt = toUnixSeconds2(deposit.createdAt ?? deposit.timestamp);
865
960
  const firstFillByPair = /* @__PURE__ */ new Map();
866
961
  const firstFillByCurrency = /* @__PURE__ */ new Map();
962
+ const offeredCurrenciesByMethod = /* @__PURE__ */ new Map();
963
+ for (const offered of deposit.currencies ?? []) {
964
+ let method;
965
+ try {
966
+ method = offered.paymentMethodHash ? sdk.resolvePaymentMethodNameFromHash(offered.paymentMethodHash, catalog) : void 0;
967
+ } catch {
968
+ method = void 0;
969
+ }
970
+ const currency = normalizeCurrencyCode(offered.currencyCode);
971
+ if (!method || !currency) continue;
972
+ const currencies = offeredCurrenciesByMethod.get(method) ?? /* @__PURE__ */ new Set();
973
+ currencies.add(currency);
974
+ offeredCurrenciesByMethod.set(method, currencies);
975
+ }
976
+ const multiCurrencyKeyByMethod = /* @__PURE__ */ new Map();
977
+ for (const [method, currencies] of offeredCurrenciesByMethod) {
978
+ if (currencies.size > 1) {
979
+ multiCurrencyKeyByMethod.set(method, `${method}:${[...currencies].sort().join("+")}`);
980
+ }
981
+ }
867
982
  for (const intent of deposit.intents ?? []) {
868
983
  const fulfilledAt = toUnixSeconds2(intent.fulfillTimestamp);
869
984
  if (fulfilledAt === void 0 || fulfilledAt < windowStart) continue;
@@ -877,11 +992,25 @@ function computeFillStatsSample(deposits, nowSeconds, environment) {
877
992
  if (!method || !currency) continue;
878
993
  const pair = `${method}:${currency}`;
879
994
  fillCounts.set(pair, (fillCounts.get(pair) ?? 0) + 1);
995
+ const multiCurrencyKey = multiCurrencyKeyByMethod.get(method);
996
+ const matchingMultiCurrencyKey = multiCurrencyKey && offeredCurrenciesByMethod.get(method)?.has(currency) ? multiCurrencyKey : void 0;
997
+ if (matchingMultiCurrencyKey) {
998
+ fillCounts.set(
999
+ matchingMultiCurrencyKey,
1000
+ (fillCounts.get(matchingMultiCurrencyKey) ?? 0) + 1
1001
+ );
1002
+ }
880
1003
  if (createdAt === void 0 || createdAt < windowStart || fulfilledAt < createdAt) continue;
881
1004
  const previousPairFill = firstFillByPair.get(pair);
882
1005
  if (previousPairFill === void 0 || fulfilledAt < previousPairFill) {
883
1006
  firstFillByPair.set(pair, fulfilledAt);
884
1007
  }
1008
+ if (matchingMultiCurrencyKey) {
1009
+ const previousMultiCurrencyFill = firstFillByPair.get(matchingMultiCurrencyKey);
1010
+ if (previousMultiCurrencyFill === void 0 || fulfilledAt < previousMultiCurrencyFill) {
1011
+ firstFillByPair.set(matchingMultiCurrencyKey, fulfilledAt);
1012
+ }
1013
+ }
885
1014
  const previousCurrencyFill = firstFillByCurrency.get(currency);
886
1015
  if (previousCurrencyFill === void 0 || fulfilledAt < previousCurrencyFill) {
887
1016
  firstFillByCurrency.set(currency, fulfilledAt);
@@ -1503,6 +1632,36 @@ async function readEstimate(publicClient, input, context = {}) {
1503
1632
  return estimate;
1504
1633
  }
1505
1634
 
1635
+ // src/client/payee.ts
1636
+ function normalizePaypalHandle(value) {
1637
+ const withoutProtocol = value.replace(/^https?:\/\//i, "").replace(/^www\./i, "");
1638
+ if (/^paypal\.me(?:[?#].*)?$/i.test(withoutProtocol)) return "";
1639
+ const withoutDomain = withoutProtocol.replace(/^paypal\.me\//i, "");
1640
+ const [pathWithoutQuery = ""] = withoutDomain.split(/[?#]/, 1);
1641
+ const [username = ""] = pathWithoutQuery.replace(/^\/+/, "").split("/", 1);
1642
+ return username.replace(/^@+/, "").trim().toLowerCase();
1643
+ }
1644
+ function normalizeCashPayee(platform, payee) {
1645
+ if (typeof payee !== "string") return payee;
1646
+ const trimmed = payee.trim();
1647
+ switch (platform) {
1648
+ case "venmo":
1649
+ return { offchainId: trimmed.replace(/^@+/, "") };
1650
+ case "cashapp":
1651
+ return { offchainId: trimmed.replace(/^\$+/, "") };
1652
+ case "chime":
1653
+ return { offchainId: trimmed.toLowerCase() };
1654
+ case "n26":
1655
+ return { offchainId: trimmed.replace(/\s/g, "") };
1656
+ case "paypal":
1657
+ return { offchainId: normalizePaypalHandle(trimmed) };
1658
+ case "zelle":
1659
+ return { offchainId: trimmed.toLowerCase() };
1660
+ default:
1661
+ return { offchainId: trimmed };
1662
+ }
1663
+ }
1664
+
1506
1665
  // src/client/createCashClient.ts
1507
1666
  var DEFAULT_RPC_URL = "https://mainnet.base.org";
1508
1667
  var FILL_STATS_CACHE_MS = 15 * 60 * 1e3;
@@ -1544,7 +1703,7 @@ async function submitAndConfirm(client, verb, send) {
1544
1703
  hash = await send();
1545
1704
  } catch (err) {
1546
1705
  const mapped = mapChainError(verb, err);
1547
- if (isKnownPreBroadcastFailure(err, mapped)) throw mapped;
1706
+ if (isKnownPreBroadcastFailure(mapped)) throw mapped;
1548
1707
  throw errors.transactionSubmissionUnknown(verb, err, {
1549
1708
  kind: "inspect-base-operation-submission",
1550
1709
  operation: verb
@@ -1559,12 +1718,8 @@ async function submitAndConfirm(client, verb, send) {
1559
1718
  if (receipt.status === "reverted") throw errors.transactionFailed(hash);
1560
1719
  return hash;
1561
1720
  }
1562
- function isKnownPreBroadcastFailure(err, mapped) {
1563
- if (mapped.code === "INSUFFICIENT_TOKEN_BALANCE" || mapped.code === "ALLOWANCE_NOT_VISIBLE" || mapped.code === "ESCROW_PAUSED") {
1564
- return true;
1565
- }
1566
- const message = err instanceof Error ? err.message : String(err);
1567
- return /user rejected|user denied|rejected request|action_rejected/i.test(message);
1721
+ function isKnownPreBroadcastFailure(mapped) {
1722
+ return mapped.code === "TRANSACTION_REJECTED" || mapped.code === "INSUFFICIENT_TOKEN_BALANCE" || mapped.code === "ALLOWANCE_NOT_VISIBLE" || mapped.code === "ESCROW_PAUSED";
1568
1723
  }
1569
1724
  function depositOrderOptions(deposit) {
1570
1725
  const remaining = toBigIntOrUndefined(deposit.remainingDeposits);
@@ -1641,18 +1796,33 @@ function createCashClient(options) {
1641
1796
  (capability) => capability.platform === receive.platform
1642
1797
  );
1643
1798
  if (!platform) throw errors.unsupportedPlatform(receive.platform);
1644
- if (!isMarketRateSupported(receive.currency)) {
1645
- throw errors.oracleUnsupportedCurrency(receive.currency);
1799
+ if (receive.currency === void 0 === (receive.currencies === void 0)) {
1800
+ throw errors.invalidPayoutCurrencies(
1801
+ receive.platform,
1802
+ "pass exactly one of currency or currencies"
1803
+ );
1804
+ }
1805
+ const currencies = receive.currencies !== void 0 ? [...receive.currencies] : [receive.currency];
1806
+ if (currencies.length === 0) {
1807
+ throw errors.invalidPayoutCurrencies(receive.platform, "at least one currency is required");
1808
+ }
1809
+ if (new Set(currencies).size !== currencies.length) {
1810
+ throw errors.invalidPayoutCurrencies(receive.platform, "currencies must be unique");
1646
1811
  }
1647
- if (!platform.currencies.includes(receive.currency)) {
1648
- throw errors.unsupportedPlatformCurrency(receive.platform, receive.currency);
1812
+ for (const currency of currencies) {
1813
+ if (!isMarketRateSupported(currency)) {
1814
+ throw errors.oracleUnsupportedCurrency(currency);
1815
+ }
1816
+ if (!platform.currencies.includes(currency)) {
1817
+ throw errors.unsupportedPlatformCurrency(receive.platform, currency);
1818
+ }
1649
1819
  }
1650
1820
  return {
1651
1821
  payouts: [
1652
1822
  {
1653
1823
  processorName: receive.platform,
1654
- currency: receive.currency,
1655
- payeeData: receive.payee
1824
+ ...currencies.length === 1 ? { currency: currencies[0] } : { currencies },
1825
+ payeeData: normalizeCashPayee(receive.platform, receive.payee)
1656
1826
  }
1657
1827
  ]
1658
1828
  };
@@ -1672,7 +1842,12 @@ function createCashClient(options) {
1672
1842
  };
1673
1843
  }
1674
1844
  function isCashPayoutSet(payouts) {
1675
- return payouts.length === 1 && payouts.every((payout) => payout.pricing.marketRate && payout.pricing.spreadBps === 0);
1845
+ const first = payouts[0];
1846
+ return Boolean(
1847
+ first && payouts.every(
1848
+ (payout) => payout.platformHash.toLowerCase() === first.platformHash.toLowerCase() && payout.payeeHash.toLowerCase() === first.payeeHash.toLowerCase() && payout.pricing.marketRate && payout.pricing.spreadBps === 0
1849
+ )
1850
+ );
1676
1851
  }
1677
1852
  async function buildDepositParams(client, depositInput) {
1678
1853
  try {
@@ -1945,9 +2120,9 @@ function createCashClient(options) {
1945
2120
  }
1946
2121
  },
1947
2122
  async cashout(input, opts) {
2123
+ const payoutInput = validatePayout(input);
1948
2124
  const client = await signingClient("cashout", opts);
1949
2125
  const owner = opts.signer.account.address;
1950
- const payoutInput = validatePayout(input);
1951
2126
  let sourceResult;
1952
2127
  let cashoutAmount = input.amount;
1953
2128
  if (input.source) {
@@ -2023,7 +2198,7 @@ function createCashClient(options) {
2023
2198
  const mapped = mapChainError("createDeposit", err, {
2024
2199
  requiredAmount: depositInput2.amount
2025
2200
  });
2026
- if (isKnownPreBroadcastFailure(err, mapped)) {
2201
+ if (isKnownPreBroadcastFailure(mapped)) {
2027
2202
  throw errors.sourceRouteCompletedCashoutFailed(routedSource, mapped);
2028
2203
  }
2029
2204
  throw errors.sourceCashoutSubmissionUnknown(routedSource, owner, mapped);
@@ -2079,7 +2254,7 @@ function createCashClient(options) {
2079
2254
  const mapped = mapChainError("createDeposit", err, {
2080
2255
  requiredAmount: depositInput.amount
2081
2256
  });
2082
- if (isKnownPreBroadcastFailure(err, mapped)) throw mapped;
2257
+ if (isKnownPreBroadcastFailure(mapped)) throw mapped;
2083
2258
  throw errors.transactionSubmissionUnknown("cashout", err, {
2084
2259
  kind: "inspect-base-cashout-submission",
2085
2260
  amount: depositInput.amount.toString(),
@@ -2147,6 +2322,32 @@ function createCashClient(options) {
2147
2322
  register: { hashedOnchainIds }
2148
2323
  };
2149
2324
  },
2325
+ finalizePreparedCashout(receipt) {
2326
+ if (receipt.status === "reverted") {
2327
+ throw errors.transactionFailed(receipt.transactionHash);
2328
+ }
2329
+ const abi = readClient.escrowV2Abi ?? readClient.escrowAbi;
2330
+ const expectedEscrowAddress = readClient.escrowV2Address ?? readClient.escrowAddress;
2331
+ const resolved = resolveCashDepositId({
2332
+ logs: receipt.logs,
2333
+ abi,
2334
+ expectedEscrowAddress,
2335
+ expectedToken: BASE_USDC_ADDRESS
2336
+ });
2337
+ if (!resolved || resolved.amount === void 0) {
2338
+ throw errors.depositResolutionFailed(receipt.transactionHash);
2339
+ }
2340
+ return {
2341
+ depositId: resolved.compositeId,
2342
+ txHash: receipt.transactionHash,
2343
+ escrowAddress: resolved.escrowAddress,
2344
+ onchainDepositId: resolved.onchainDepositId,
2345
+ order: deriveCashOrder(resolved.compositeId, [], {
2346
+ remainingAmount: resolved.amount,
2347
+ status: "ACTIVE"
2348
+ })
2349
+ };
2350
+ },
2150
2351
  async order(depositId) {
2151
2352
  return fetchOrder(depositId);
2152
2353
  },
@@ -2663,6 +2864,7 @@ var CASH_ERROR_CODES = defineCashErrorCodes([
2663
2864
  "UNSUPPORTED_PLATFORM_CURRENCY",
2664
2865
  "AMOUNT_BELOW_MINIMUM",
2665
2866
  "INVALID_INTENT_AMOUNT_RANGE",
2867
+ "INVALID_PAYOUT_CURRENCIES",
2666
2868
  "ACTIVE_INTENT_BLOCKS_WITHDRAWAL",
2667
2869
  "NOTHING_TO_WITHDRAW",
2668
2870
  "INSUFFICIENT_AVAILABLE_FUNDS",
@@ -2691,6 +2893,7 @@ var CASH_ERROR_CODES = defineCashErrorCodes([
2691
2893
  "SIGNER_CHAIN_MISMATCH",
2692
2894
  "SIGNER_CHAIN_UNAVAILABLE",
2693
2895
  "WATCH_TIMEOUT",
2896
+ "TRANSACTION_REJECTED",
2694
2897
  "TRANSACTION_FAILED",
2695
2898
  "TRANSACTION_SUBMISSION_UNKNOWN",
2696
2899
  "TRANSACTION_STATUS_UNKNOWN"
@@ -3207,7 +3410,9 @@ exports.intentStatusSchema = intentStatusSchema;
3207
3410
  exports.isCashError = isCashError;
3208
3411
  exports.isFillLive = isFillLive;
3209
3412
  exports.isMarketRateSupported = isMarketRateSupported;
3413
+ exports.isUserRejectedError = isUserRejectedError;
3210
3414
  exports.nonNegativeBigintString = nonNegativeBigintString;
3415
+ exports.normalizeCashPayee = normalizeCashPayee;
3211
3416
  exports.orderFromJson = orderFromJson;
3212
3417
  exports.orderToJson = orderToJson;
3213
3418
  exports.parseCompositeDepositId = parseCompositeDepositId;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IntentStatus, C as CashPayoutInfo, a as IntentEntity, b as CashBuyerProfile, c as CashDepositInput, d as CreateDepositParamsArg, e as CashOrder, f as CashFill, g as CashCapabilities, h as CashoutResult, i as CashEstimate, j as CashFillStats, P as PrepareResult, k as CashPreparedStep, R as RelayExecutionResult, l as RelayQuote, m as RelayStatus, n as CashSourceCapabilities, T as TopUpResult, W as WithdrawResult } from './createCashClient-CTEXn9FF.cjs';
2
- export { o as CASH_ATTRIBUTION_CODE, p as CashAsset, q as CashChain, r as CashClient, s as CashClientOptions, t as CashFillEta, u as CashLeg, v as CashNextAction, w as CashOrderState, x as CashPairFillStats, y as CashPayout, z as CashPayoutPricing, A as CashPlatformCapability, B as CashPreparedStepKind, D as CashoutInput, E as CashoutOptions, F as CuratorPayeeDataInput, G as EstimateInput, H as EstimateOptions, M as MIN_CASHOUT_AMOUNT, O as OrdersOptions, J as RECOMMENDED_MIN_CASHOUT_AMOUNT, K as RelayOptions, L as RelayQuoteInput, N as RelaySourceInput, Q as RelayTransaction, S as SignerOptions, U as WatchOptions, V as WithdrawOptions, X as buildCapabilities, Y as createCashClient } from './createCashClient-CTEXn9FF.cjs';
1
+ import { I as IntentStatus, C as CashPayoutInfo, a as IntentEntity, b as CashBuyerProfile, c as CashDepositInput, d as CreateDepositParamsArg, e as CashOrder, f as CashFill, g as CashCapabilities, h as CashoutResult, i as CashEstimate, j as CashFillStats, P as PrepareResult, k as CashPreparedStep, R as RelayExecutionResult, l as RelayQuote, m as RelayStatus, n as CashSourceCapabilities, T as TopUpResult, W as WithdrawResult } from './createCashClient-DGMd8Swr.cjs';
2
+ export { o as CASH_ATTRIBUTION_CODE, p as CashAsset, q as CashChain, r as CashClient, s as CashClientOptions, t as CashFillEta, u as CashLeg, v as CashMultiCurrencyLeg, w as CashNextAction, x as CashOrderState, y as CashPairFillStats, z as CashPayeeInput, A as CashPayout, B as CashPayoutPricing, D as CashPlatformCapability, E as CashPreparedStepKind, F as CashoutInput, G as CashoutOptions, H as CuratorPayeeDataInput, J as EstimateInput, K as EstimateOptions, M as MIN_CASHOUT_AMOUNT, O as OrdersOptions, L as PreparedCashoutReceipt, N as RECOMMENDED_MIN_CASHOUT_AMOUNT, Q as RelayOptions, S as RelayQuoteInput, U as RelaySourceInput, V as RelayTransaction, X as SignerOptions, Y as WatchOptions, Z as WithdrawOptions, _ as buildCapabilities, $ as createCashClient, a0 as normalizeCashPayee } from './createCashClient-DGMd8Swr.cjs';
3
3
  import { PaymentMethodCatalog, CurrencyType, OracleAdapterOverrides, OnchainCurrency, Zkp2pClient, PreparedTransaction } from '@zkp2p/sdk';
4
4
  export { CurrencyType, PreparedTransaction, RuntimeEnv } from '@zkp2p/sdk';
5
5
  import { Log, Abi } from 'viem';
@@ -10,7 +10,7 @@ import '@relayprotocol/relay-sdk';
10
10
  * Typed errors - every failure carries a `code`, whether it is `retryable`,
11
11
  * and a `remediation` sentence so agents can self-drive recovery.
12
12
  */
13
- type CashErrorCode = 'ORACLE_UNSUPPORTED_CURRENCY' | 'ORACLE_READ_FAILED' | 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_PLATFORM_CURRENCY' | 'AMOUNT_BELOW_MINIMUM' | 'INVALID_INTENT_AMOUNT_RANGE' | 'ACTIVE_INTENT_BLOCKS_WITHDRAWAL' | 'NOTHING_TO_WITHDRAW' | 'INSUFFICIENT_AVAILABLE_FUNDS' | 'INSUFFICIENT_TOKEN_BALANCE' | 'ORDER_NOT_ACTIVE' | 'INVALID_DEPOSIT_ID' | 'ESCROW_PAUSED' | 'INDEXER_LAG' | 'INDEXER_UNAVAILABLE' | 'ORDER_NOT_FOUND' | 'PAYEE_REGISTRATION_FAILED' | 'PAYEE_VERIFICATION_REQUIRED' | 'SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE' | 'SOURCE_RECIPIENT_MISMATCH' | 'SOURCE_CAPABILITIES_FAILED' | 'SOURCE_QUOTE_FAILED' | 'SOURCE_NONCE_MANAGER_REQUIRED' | 'SOURCE_EXECUTION_FAILED' | 'SOURCE_STATUS_FAILED' | 'SOURCE_ROUTE_COMPLETED_CASHOUT_FAILED' | 'SOURCE_CASHOUT_SUBMISSION_UNKNOWN' | 'SOURCE_CASHOUT_STATUS_UNKNOWN' | 'DEPOSIT_RESOLUTION_FAILED' | 'ALLOWANCE_NOT_VISIBLE' | 'SIGNER_REQUIRED' | 'SIGNER_CHAIN_MISMATCH' | 'SIGNER_CHAIN_UNAVAILABLE' | 'WATCH_TIMEOUT' | 'TRANSACTION_FAILED' | 'TRANSACTION_SUBMISSION_UNKNOWN' | 'TRANSACTION_STATUS_UNKNOWN';
13
+ type CashErrorCode = 'ORACLE_UNSUPPORTED_CURRENCY' | 'ORACLE_READ_FAILED' | 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_PLATFORM_CURRENCY' | 'AMOUNT_BELOW_MINIMUM' | 'INVALID_INTENT_AMOUNT_RANGE' | 'INVALID_PAYOUT_CURRENCIES' | 'ACTIVE_INTENT_BLOCKS_WITHDRAWAL' | 'NOTHING_TO_WITHDRAW' | 'INSUFFICIENT_AVAILABLE_FUNDS' | 'INSUFFICIENT_TOKEN_BALANCE' | 'ORDER_NOT_ACTIVE' | 'INVALID_DEPOSIT_ID' | 'ESCROW_PAUSED' | 'INDEXER_LAG' | 'INDEXER_UNAVAILABLE' | 'ORDER_NOT_FOUND' | 'PAYEE_REGISTRATION_FAILED' | 'PAYEE_VERIFICATION_REQUIRED' | 'SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE' | 'SOURCE_RECIPIENT_MISMATCH' | 'SOURCE_CAPABILITIES_FAILED' | 'SOURCE_QUOTE_FAILED' | 'SOURCE_NONCE_MANAGER_REQUIRED' | 'SOURCE_EXECUTION_FAILED' | 'SOURCE_STATUS_FAILED' | 'SOURCE_ROUTE_COMPLETED_CASHOUT_FAILED' | 'SOURCE_CASHOUT_SUBMISSION_UNKNOWN' | 'SOURCE_CASHOUT_STATUS_UNKNOWN' | 'DEPOSIT_RESOLUTION_FAILED' | 'ALLOWANCE_NOT_VISIBLE' | 'SIGNER_REQUIRED' | 'SIGNER_CHAIN_MISMATCH' | 'SIGNER_CHAIN_UNAVAILABLE' | 'WATCH_TIMEOUT' | 'TRANSACTION_REJECTED' | 'TRANSACTION_FAILED' | 'TRANSACTION_SUBMISSION_UNKNOWN' | 'TRANSACTION_STATUS_UNKNOWN';
14
14
  interface CashErrorShape {
15
15
  code: CashErrorCode;
16
16
  message: string;
@@ -77,6 +77,7 @@ declare const errors: {
77
77
  unsupportedPlatformCurrency: (platform: string, currency: string) => CashError;
78
78
  amountBelowMinimum: (amount: bigint, min: bigint) => CashError;
79
79
  invalidIntentAmountRange: (amount: bigint, min: bigint, max: bigint) => CashError;
80
+ invalidPayoutCurrencies: (platform: string, reason: string) => CashError;
80
81
  activeIntentBlocksWithdrawal: (depositId: string) => CashError;
81
82
  insufficientAvailableFunds: (depositId: string, requested: bigint, available: bigint) => CashError;
82
83
  insufficientTokenBalance: (requiredAmount?: bigint) => CashError;
@@ -124,12 +125,15 @@ declare const errors: {
124
125
  signerChainUnavailable: (verb: string, expectedChainId: number, cause?: unknown) => CashError;
125
126
  watchTimeout: (depositId: string, timeoutMs: number) => CashError;
126
127
  transactionFailed: (txHash: string, cause?: unknown) => CashError;
128
+ transactionRejected: (verb: string, cause?: unknown) => CashError;
127
129
  transactionSubmissionUnknown: (operation: string, cause?: unknown, recovery?: CashErrorRecovery) => CashError;
128
130
  transactionStatusUnknown: (txHash: string, cause?: unknown, operation?: string) => CashError;
129
131
  escrowPaused: () => CashError;
130
132
  /** Generic fallback for an on-chain call that failed for an unrecognized reason. */
131
133
  chainCallFailed: (verb: string, cause?: unknown) => CashError;
132
134
  };
135
+ /** Detect EIP-1193 and viem wallet cancellations, including nested provider causes. */
136
+ declare function isUserRejectedError(value: unknown): boolean;
133
137
 
134
138
  /**
135
139
  * Convert a human USDC amount to base units (6 decimals).
@@ -325,10 +329,14 @@ interface ResolvedCashDeposit {
325
329
  onchainDepositId: bigint;
326
330
  escrowAddress: string;
327
331
  compositeId: string;
332
+ /** Base-unit amount emitted by the canonical DepositReceived event. */
333
+ amount?: bigint;
328
334
  }
329
335
  declare function resolveCashDepositId(params: {
330
- logs: Log[];
336
+ logs: readonly Log[];
331
337
  abi: Abi;
338
+ expectedEscrowAddress?: string;
339
+ expectedToken?: string;
332
340
  }): ResolvedCashDeposit | null;
333
341
  /** Split a composite deposit id (`escrow_onchainId`) back into its parts. */
334
342
  declare function parseCompositeDepositId(compositeId: string): {
@@ -2710,8 +2718,8 @@ declare const cashCapabilitiesJsonSchema: z.ZodObject<{
2710
2718
  decimals: number;
2711
2719
  };
2712
2720
  };
2713
- environment: "production" | "preproduction" | "staging";
2714
2721
  currencies: string[];
2722
+ environment: "production" | "preproduction" | "staging";
2715
2723
  platforms: {
2716
2724
  platform: string;
2717
2725
  currencies: string[];
@@ -2781,8 +2789,8 @@ declare const cashCapabilitiesJsonSchema: z.ZodObject<{
2781
2789
  decimals: number;
2782
2790
  };
2783
2791
  };
2784
- environment: "production" | "preproduction" | "staging";
2785
2792
  currencies: string[];
2793
+ environment: "production" | "preproduction" | "staging";
2786
2794
  platforms: {
2787
2795
  platform: string;
2788
2796
  currencies: string[];
@@ -3176,7 +3184,7 @@ declare const cashErrorRecoveryJsonSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
3176
3184
  operation: string;
3177
3185
  }>]>;
3178
3186
  declare const cashErrorJsonSchema: z.ZodObject<{
3179
- code: z.ZodEnum<["ORACLE_UNSUPPORTED_CURRENCY", "ORACLE_READ_FAILED", "UNSUPPORTED_PLATFORM", "UNSUPPORTED_PLATFORM_CURRENCY", "AMOUNT_BELOW_MINIMUM", "INVALID_INTENT_AMOUNT_RANGE", "ACTIVE_INTENT_BLOCKS_WITHDRAWAL", "NOTHING_TO_WITHDRAW", "INSUFFICIENT_AVAILABLE_FUNDS", "INSUFFICIENT_TOKEN_BALANCE", "ORDER_NOT_ACTIVE", "INVALID_DEPOSIT_ID", "ESCROW_PAUSED", "INDEXER_LAG", "INDEXER_UNAVAILABLE", "ORDER_NOT_FOUND", "PAYEE_REGISTRATION_FAILED", "PAYEE_VERIFICATION_REQUIRED", "SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE", "SOURCE_RECIPIENT_MISMATCH", "SOURCE_CAPABILITIES_FAILED", "SOURCE_QUOTE_FAILED", "SOURCE_NONCE_MANAGER_REQUIRED", "SOURCE_EXECUTION_FAILED", "SOURCE_STATUS_FAILED", "SOURCE_ROUTE_COMPLETED_CASHOUT_FAILED", "SOURCE_CASHOUT_SUBMISSION_UNKNOWN", "SOURCE_CASHOUT_STATUS_UNKNOWN", "DEPOSIT_RESOLUTION_FAILED", "ALLOWANCE_NOT_VISIBLE", "SIGNER_REQUIRED", "SIGNER_CHAIN_MISMATCH", "SIGNER_CHAIN_UNAVAILABLE", "WATCH_TIMEOUT", "TRANSACTION_FAILED", "TRANSACTION_SUBMISSION_UNKNOWN", "TRANSACTION_STATUS_UNKNOWN"]>;
3187
+ code: z.ZodEnum<["ORACLE_UNSUPPORTED_CURRENCY", "ORACLE_READ_FAILED", "UNSUPPORTED_PLATFORM", "UNSUPPORTED_PLATFORM_CURRENCY", "AMOUNT_BELOW_MINIMUM", "INVALID_INTENT_AMOUNT_RANGE", "INVALID_PAYOUT_CURRENCIES", "ACTIVE_INTENT_BLOCKS_WITHDRAWAL", "NOTHING_TO_WITHDRAW", "INSUFFICIENT_AVAILABLE_FUNDS", "INSUFFICIENT_TOKEN_BALANCE", "ORDER_NOT_ACTIVE", "INVALID_DEPOSIT_ID", "ESCROW_PAUSED", "INDEXER_LAG", "INDEXER_UNAVAILABLE", "ORDER_NOT_FOUND", "PAYEE_REGISTRATION_FAILED", "PAYEE_VERIFICATION_REQUIRED", "SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE", "SOURCE_RECIPIENT_MISMATCH", "SOURCE_CAPABILITIES_FAILED", "SOURCE_QUOTE_FAILED", "SOURCE_NONCE_MANAGER_REQUIRED", "SOURCE_EXECUTION_FAILED", "SOURCE_STATUS_FAILED", "SOURCE_ROUTE_COMPLETED_CASHOUT_FAILED", "SOURCE_CASHOUT_SUBMISSION_UNKNOWN", "SOURCE_CASHOUT_STATUS_UNKNOWN", "DEPOSIT_RESOLUTION_FAILED", "ALLOWANCE_NOT_VISIBLE", "SIGNER_REQUIRED", "SIGNER_CHAIN_MISMATCH", "SIGNER_CHAIN_UNAVAILABLE", "WATCH_TIMEOUT", "TRANSACTION_REJECTED", "TRANSACTION_FAILED", "TRANSACTION_SUBMISSION_UNKNOWN", "TRANSACTION_STATUS_UNKNOWN"]>;
3180
3188
  message: z.ZodString;
3181
3189
  retryable: z.ZodBoolean;
3182
3190
  remediation: z.ZodString;
@@ -3563,7 +3571,7 @@ declare const cashErrorJsonSchema: z.ZodObject<{
3563
3571
  }>]>>;
3564
3572
  }, "strict", z.ZodTypeAny, {
3565
3573
  message: string;
3566
- code: "ORACLE_UNSUPPORTED_CURRENCY" | "ORACLE_READ_FAILED" | "UNSUPPORTED_PLATFORM" | "UNSUPPORTED_PLATFORM_CURRENCY" | "AMOUNT_BELOW_MINIMUM" | "INVALID_INTENT_AMOUNT_RANGE" | "ACTIVE_INTENT_BLOCKS_WITHDRAWAL" | "NOTHING_TO_WITHDRAW" | "INSUFFICIENT_AVAILABLE_FUNDS" | "INSUFFICIENT_TOKEN_BALANCE" | "ORDER_NOT_ACTIVE" | "INVALID_DEPOSIT_ID" | "ESCROW_PAUSED" | "INDEXER_LAG" | "INDEXER_UNAVAILABLE" | "ORDER_NOT_FOUND" | "PAYEE_REGISTRATION_FAILED" | "PAYEE_VERIFICATION_REQUIRED" | "SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE" | "SOURCE_RECIPIENT_MISMATCH" | "SOURCE_CAPABILITIES_FAILED" | "SOURCE_QUOTE_FAILED" | "SOURCE_NONCE_MANAGER_REQUIRED" | "SOURCE_EXECUTION_FAILED" | "SOURCE_STATUS_FAILED" | "SOURCE_ROUTE_COMPLETED_CASHOUT_FAILED" | "SOURCE_CASHOUT_SUBMISSION_UNKNOWN" | "SOURCE_CASHOUT_STATUS_UNKNOWN" | "DEPOSIT_RESOLUTION_FAILED" | "ALLOWANCE_NOT_VISIBLE" | "SIGNER_REQUIRED" | "SIGNER_CHAIN_MISMATCH" | "SIGNER_CHAIN_UNAVAILABLE" | "WATCH_TIMEOUT" | "TRANSACTION_FAILED" | "TRANSACTION_SUBMISSION_UNKNOWN" | "TRANSACTION_STATUS_UNKNOWN";
3574
+ code: "ORACLE_UNSUPPORTED_CURRENCY" | "ORACLE_READ_FAILED" | "UNSUPPORTED_PLATFORM" | "UNSUPPORTED_PLATFORM_CURRENCY" | "AMOUNT_BELOW_MINIMUM" | "INVALID_INTENT_AMOUNT_RANGE" | "INVALID_PAYOUT_CURRENCIES" | "ACTIVE_INTENT_BLOCKS_WITHDRAWAL" | "NOTHING_TO_WITHDRAW" | "INSUFFICIENT_AVAILABLE_FUNDS" | "INSUFFICIENT_TOKEN_BALANCE" | "ORDER_NOT_ACTIVE" | "INVALID_DEPOSIT_ID" | "ESCROW_PAUSED" | "INDEXER_LAG" | "INDEXER_UNAVAILABLE" | "ORDER_NOT_FOUND" | "PAYEE_REGISTRATION_FAILED" | "PAYEE_VERIFICATION_REQUIRED" | "SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE" | "SOURCE_RECIPIENT_MISMATCH" | "SOURCE_CAPABILITIES_FAILED" | "SOURCE_QUOTE_FAILED" | "SOURCE_NONCE_MANAGER_REQUIRED" | "SOURCE_EXECUTION_FAILED" | "SOURCE_STATUS_FAILED" | "SOURCE_ROUTE_COMPLETED_CASHOUT_FAILED" | "SOURCE_CASHOUT_SUBMISSION_UNKNOWN" | "SOURCE_CASHOUT_STATUS_UNKNOWN" | "DEPOSIT_RESOLUTION_FAILED" | "ALLOWANCE_NOT_VISIBLE" | "SIGNER_REQUIRED" | "SIGNER_CHAIN_MISMATCH" | "SIGNER_CHAIN_UNAVAILABLE" | "WATCH_TIMEOUT" | "TRANSACTION_REJECTED" | "TRANSACTION_FAILED" | "TRANSACTION_SUBMISSION_UNKNOWN" | "TRANSACTION_STATUS_UNKNOWN";
3567
3575
  retryable: boolean;
3568
3576
  remediation: string;
3569
3577
  recovery?: {
@@ -3645,7 +3653,7 @@ declare const cashErrorJsonSchema: z.ZodObject<{
3645
3653
  } | undefined;
3646
3654
  }, {
3647
3655
  message: string;
3648
- code: "ORACLE_UNSUPPORTED_CURRENCY" | "ORACLE_READ_FAILED" | "UNSUPPORTED_PLATFORM" | "UNSUPPORTED_PLATFORM_CURRENCY" | "AMOUNT_BELOW_MINIMUM" | "INVALID_INTENT_AMOUNT_RANGE" | "ACTIVE_INTENT_BLOCKS_WITHDRAWAL" | "NOTHING_TO_WITHDRAW" | "INSUFFICIENT_AVAILABLE_FUNDS" | "INSUFFICIENT_TOKEN_BALANCE" | "ORDER_NOT_ACTIVE" | "INVALID_DEPOSIT_ID" | "ESCROW_PAUSED" | "INDEXER_LAG" | "INDEXER_UNAVAILABLE" | "ORDER_NOT_FOUND" | "PAYEE_REGISTRATION_FAILED" | "PAYEE_VERIFICATION_REQUIRED" | "SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE" | "SOURCE_RECIPIENT_MISMATCH" | "SOURCE_CAPABILITIES_FAILED" | "SOURCE_QUOTE_FAILED" | "SOURCE_NONCE_MANAGER_REQUIRED" | "SOURCE_EXECUTION_FAILED" | "SOURCE_STATUS_FAILED" | "SOURCE_ROUTE_COMPLETED_CASHOUT_FAILED" | "SOURCE_CASHOUT_SUBMISSION_UNKNOWN" | "SOURCE_CASHOUT_STATUS_UNKNOWN" | "DEPOSIT_RESOLUTION_FAILED" | "ALLOWANCE_NOT_VISIBLE" | "SIGNER_REQUIRED" | "SIGNER_CHAIN_MISMATCH" | "SIGNER_CHAIN_UNAVAILABLE" | "WATCH_TIMEOUT" | "TRANSACTION_FAILED" | "TRANSACTION_SUBMISSION_UNKNOWN" | "TRANSACTION_STATUS_UNKNOWN";
3656
+ code: "ORACLE_UNSUPPORTED_CURRENCY" | "ORACLE_READ_FAILED" | "UNSUPPORTED_PLATFORM" | "UNSUPPORTED_PLATFORM_CURRENCY" | "AMOUNT_BELOW_MINIMUM" | "INVALID_INTENT_AMOUNT_RANGE" | "INVALID_PAYOUT_CURRENCIES" | "ACTIVE_INTENT_BLOCKS_WITHDRAWAL" | "NOTHING_TO_WITHDRAW" | "INSUFFICIENT_AVAILABLE_FUNDS" | "INSUFFICIENT_TOKEN_BALANCE" | "ORDER_NOT_ACTIVE" | "INVALID_DEPOSIT_ID" | "ESCROW_PAUSED" | "INDEXER_LAG" | "INDEXER_UNAVAILABLE" | "ORDER_NOT_FOUND" | "PAYEE_REGISTRATION_FAILED" | "PAYEE_VERIFICATION_REQUIRED" | "SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE" | "SOURCE_RECIPIENT_MISMATCH" | "SOURCE_CAPABILITIES_FAILED" | "SOURCE_QUOTE_FAILED" | "SOURCE_NONCE_MANAGER_REQUIRED" | "SOURCE_EXECUTION_FAILED" | "SOURCE_STATUS_FAILED" | "SOURCE_ROUTE_COMPLETED_CASHOUT_FAILED" | "SOURCE_CASHOUT_SUBMISSION_UNKNOWN" | "SOURCE_CASHOUT_STATUS_UNKNOWN" | "DEPOSIT_RESOLUTION_FAILED" | "ALLOWANCE_NOT_VISIBLE" | "SIGNER_REQUIRED" | "SIGNER_CHAIN_MISMATCH" | "SIGNER_CHAIN_UNAVAILABLE" | "WATCH_TIMEOUT" | "TRANSACTION_REJECTED" | "TRANSACTION_FAILED" | "TRANSACTION_SUBMISSION_UNKNOWN" | "TRANSACTION_STATUS_UNKNOWN";
3649
3657
  retryable: boolean;
3650
3658
  remediation: string;
3651
3659
  recovery?: {
@@ -3791,4 +3799,4 @@ declare function capabilitiesFromJson(json: unknown): CashCapabilities;
3791
3799
  declare function cashErrorToJson(error: CashErrorShape): CashErrorJson;
3792
3800
  declare function cashErrorFromJson(json: unknown): CashError;
3793
3801
 
3794
- export { BASE_CHAIN_ID, BASE_USDC_ADDRESS, CASH_ORDER_POLL_INTERVAL_MS, CASH_ORDER_STATUSES, CASH_RETAIN_ON_EMPTY, type CashAssetJson, CashBuyerProfile, type CashBuyerProfileJson, CashCapabilities, type CashCapabilitiesJson, type CashChainJson, CashDepositInput, CashError, type CashErrorCode, type CashErrorJson, type CashErrorRecovery, type CashErrorRecoveryJson, type CashErrorShape, CashEstimate, type CashEstimateJson, CashFill, type CashFillJson, CashFillStats, type CashFillStatsJson, CashOrder, type CashOrderData, type CashOrderJson, CashPayoutInfo, type CashPayoutInfoJson, CashPreparedStep, type CashPreparedStepJson, CashSourceCapabilities, type CashSourceCapabilitiesJson, CashoutResult, type CashoutResultJson, type DeriveCashOrderOptions, MARKET_SPREAD_BPS, type MethodCurrencyLike, ORACLE_MIN_CONVERSION_RATE_SENTINEL, type PaymentMethodLike, PrepareResult, type PrepareResultJson, type PreparedTransactionJson, RATE_PRECISION, RelayExecutionResult, type RelayExecutionResultJson, RelayQuote, type RelayQuoteJson, RelayStatus, type RelayStatusJson, type RelayTransactionJson, type RelayTransactionsJson, type ResolvedCashDeposit, TopUpResult, type TopUpResultJson, USDC_DECIMALS, WithdrawResult, type WithdrawResultJson, bigintString, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashFillStatsJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPairFillStatsJsonSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, deriveBuyerProfile, deriveCashOrder, derivePayouts, errors, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillStatsFromJson, fillStatsToJson, fillToJson, formatUsdc, intentStatusSchema, isCashError, isFillLive, isMarketRateSupported, nonNegativeBigintString, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, rateToNumber, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
3802
+ export { BASE_CHAIN_ID, BASE_USDC_ADDRESS, CASH_ORDER_POLL_INTERVAL_MS, CASH_ORDER_STATUSES, CASH_RETAIN_ON_EMPTY, type CashAssetJson, CashBuyerProfile, type CashBuyerProfileJson, CashCapabilities, type CashCapabilitiesJson, type CashChainJson, CashDepositInput, CashError, type CashErrorCode, type CashErrorJson, type CashErrorRecovery, type CashErrorRecoveryJson, type CashErrorShape, CashEstimate, type CashEstimateJson, CashFill, type CashFillJson, CashFillStats, type CashFillStatsJson, CashOrder, type CashOrderData, type CashOrderJson, CashPayoutInfo, type CashPayoutInfoJson, CashPreparedStep, type CashPreparedStepJson, CashSourceCapabilities, type CashSourceCapabilitiesJson, CashoutResult, type CashoutResultJson, type DeriveCashOrderOptions, MARKET_SPREAD_BPS, type MethodCurrencyLike, ORACLE_MIN_CONVERSION_RATE_SENTINEL, type PaymentMethodLike, PrepareResult, type PrepareResultJson, type PreparedTransactionJson, RATE_PRECISION, RelayExecutionResult, type RelayExecutionResultJson, RelayQuote, type RelayQuoteJson, RelayStatus, type RelayStatusJson, type RelayTransactionJson, type RelayTransactionsJson, type ResolvedCashDeposit, TopUpResult, type TopUpResultJson, USDC_DECIMALS, WithdrawResult, type WithdrawResultJson, bigintString, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashFillStatsJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPairFillStatsJsonSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, deriveBuyerProfile, deriveCashOrder, derivePayouts, errors, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillStatsFromJson, fillStatsToJson, fillToJson, formatUsdc, intentStatusSchema, isCashError, isFillLive, isMarketRateSupported, isUserRejectedError, nonNegativeBigintString, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, rateToNumber, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };