@zkp2p/cash 0.4.0-rc.1 → 0.4.0-rc.3

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/AGENTS.md CHANGED
@@ -27,8 +27,10 @@ can withdraw an unmatched deposit.
27
27
  Base-USDC `cash_cashout` tool. Never pass `source` into `prepare()`.
28
28
 
29
29
  Every transaction (including approves) carries ERC-8021 attribution:
30
- `peer-cash`, then any `referrer` codes from `createCashClient` options, then
31
- the Base builder code.
30
+ `peer-cash`, then optional `peer-ref-XXXXXX` from the six-character
31
+ `referralCode`, then any analytics-only `referrer` codes, then the Base builder
32
+ code. The namespaced referral marker gives its Peer Privy wallet the direct
33
+ deposit-level integration share instead of applying maker L1/L2.
32
34
 
33
35
  **Two platform caveats, both surfaced in `capabilities()`:**
34
36
 
@@ -85,6 +87,19 @@ const multiCurrency = await cash.cashout(
85
87
  { signer },
86
88
  );
87
89
 
90
+ // Widest reach: several platforms on one order (each platform at most once);
91
+ // the buyer picks the leg they can pay, every leg at the live oracle rate.
92
+ const multiPlatform = await cash.cashout(
93
+ {
94
+ amount: usdc(500),
95
+ receive: [
96
+ { platform: 'venmo', currency: 'USD', payee: '@handle' },
97
+ { platform: 'revolut', currencies: ['EUR', 'GBP'], payee: { offchainId: 'revtag' } },
98
+ ],
99
+ },
100
+ { signer },
101
+ );
102
+
88
103
  // 4. Persist depositId ↔ your user. That row is the entire integration state.
89
104
 
90
105
  // 5. Drive the lifecycle from nextActions - no heuristics.
package/README.md CHANGED
@@ -65,12 +65,50 @@ const fastFill = await cash.cashout(
65
65
  { signer },
66
66
  );
67
67
 
68
+ // One order can also offer several platforms (each at most once). The buyer
69
+ // picks the leg they can pay; every leg fills at the live oracle market rate.
70
+ const widestReach = await cash.cashout(
71
+ {
72
+ amount: usdc(1000),
73
+ receive: [
74
+ { platform: 'venmo', currency: 'USD', payee: '@you' },
75
+ { platform: 'revolut', currencies: ['EUR', 'GBP'], payee: { offchainId: 'revtag' } },
76
+ ],
77
+ },
78
+ { signer },
79
+ );
80
+
68
81
  for await (const order of cash.watch(depositId)) {
69
82
  console.log(order.state, order.explain());
70
83
  if (order.state === 'delivered') break;
71
84
  }
72
85
  ```
73
86
 
87
+ ## Earn the integration share
88
+
89
+ Use the same six-character referral code shown in your Peer mobile or web app.
90
+ No API key, registration transaction, or separate receiving address is needed:
91
+ the referral code already belongs to your Peer Privy wallet.
92
+
93
+ ```ts
94
+ const cash = createCashClient({
95
+ environment: 'production',
96
+ referralCode: 'ABC123',
97
+ });
98
+ ```
99
+
100
+ The SDK normalizes the value and stamps `peer-ref-ABC123` into ERC-8021
101
+ attribution on the deposit transaction. When that liquidity is filled, Curator
102
+ pays the code owner 50 bps, capped by the configured Peer service fee. This is
103
+ the deposit-level integration path: it replaces the maker L1/L2 referral split
104
+ for that deposit instead of enrolling the cashing-out user as your referee.
105
+
106
+ The mapping is permanent. If you later customize your displayed Peer referral
107
+ code, open deposits carrying the old code still pay the same wallet. Include at
108
+ most one `peer-ref-XXXXXX` marker; an unknown or conflicting marker receives no
109
+ integration share. The existing `referrer` option remains available for
110
+ analytics-only ERC-8021 codes such as `acme-app`.
111
+
74
112
  Source asset path:
75
113
 
76
114
  ```ts
@@ -122,8 +160,9 @@ must execute and confirm its Relay route before preparing the Base-USDC
122
160
  cashout. After externally executing a prepared `createDeposit`, pass its
123
161
  confirmed receipt to `finalizePreparedCashout()` to recover the same
124
162
  `CashoutResult` shape as `cashout()` without importing protocol ABIs. Every
125
- Peer Cash transaction, including approves, carries ERC-8021
126
- attribution: `peer-cash` first, your own `referrer` code(s) after it.
163
+ Peer Cash transaction, including approves, carries ERC-8021 attribution:
164
+ `peer-cash` first, optional `peer-ref-XXXXXX` from `referralCode` next, and your
165
+ analytics-only `referrer` code(s) after it.
127
166
 
128
167
  ```ts
129
168
  const prepared = await cash.prepare({
@@ -87,6 +87,18 @@ var errors = {
87
87
  retryable: false,
88
88
  remediation: `Pass one or more unique currencies listed for ${platform} by capabilities().`
89
89
  }),
90
+ invalidPayoutPlatforms: (reason) => new CashError({
91
+ code: "INVALID_PAYOUT_PLATFORMS",
92
+ message: `The payout platform set is invalid: ${reason}.`,
93
+ retryable: false,
94
+ remediation: `Pass one payout leg, or an array of legs using each platform from capabilities() at most once.`
95
+ }),
96
+ invalidReferralCode: () => new CashError({
97
+ code: "INVALID_REFERRAL_CODE",
98
+ message: `The Peer referral code must be exactly six letters or numbers.`,
99
+ retryable: false,
100
+ remediation: `Copy your six-character referral code from the Peer mobile or web app and pass it as referralCode.`
101
+ }),
90
102
  activeIntentBlocksWithdrawal: (depositId) => new CashError({
91
103
  code: "ACTIVE_INTENT_BLOCKS_WITHDRAWAL",
92
104
  message: `Order ${depositId} has a live buyer intent; escrow blocks withdrawal while a buyer may still deliver.`,
@@ -461,11 +461,14 @@ declare function normalizeCashPayee(platform: string, payee: CashPayeeInput): Cu
461
461
 
462
462
  /**
463
463
  * ERC-8021 attribution code stamped on every transaction this package
464
- * produces (signed and prepare paths, including approves). Integrator codes
465
- * from `CashClientOptions.referrer` are appended after it; the SDK always
466
- * appends the Base builder code last.
464
+ * produces (signed and prepare paths, including approves). The optional
465
+ * namespaced `CashClientOptions.referralCode` marker and analytics-only
466
+ * `referrer` codes follow it; the SDK appends the Base builder code last.
467
467
  */
468
468
  declare const CASH_ATTRIBUTION_CODE = "peer-cash";
469
+ declare const CASH_REFERRAL_ATTRIBUTION_PREFIX = "peer-ref-";
470
+ /** Convert a Peer referral code into its financially meaningful ERC-8021 marker. */
471
+ declare function toCashReferralAttributionCode(rawCode: string): string;
469
472
  interface CashClientOptions {
470
473
  /** `'production' | 'preproduction' | 'staging'` - selects contracts, curator, and indexer. */
471
474
  environment: RuntimeEnv;
@@ -482,8 +485,14 @@ interface CashClientOptions {
482
485
  /** Relay API configuration for source assets outside Base USDC. */
483
486
  relay?: RelayOptions;
484
487
  /**
485
- * Your own ERC-8021 attribution code(s), appended after
486
- * {@link CASH_ATTRIBUTION_CODE} on every transaction (e.g. `'acme-app'`).
488
+ * Your six-character referral code from the Peer mobile or web app. The SDK
489
+ * emits `peer-ref-XXXXXX`; when this deposit fills, Curator routes the
490
+ * integration share to the Privy wallet that owns the code.
491
+ */
492
+ referralCode?: string;
493
+ /**
494
+ * Analytics-only ERC-8021 attribution code(s), appended after the Peer Cash
495
+ * and optional integration-referral markers (e.g. `'acme-app'`).
487
496
  */
488
497
  referrer?: string | string[];
489
498
  }
@@ -506,6 +515,8 @@ interface CashMultiCurrencyLeg {
506
515
  payee: CashPayeeInput;
507
516
  currency?: never;
508
517
  }
518
+ /** One payout leg of a cash-out - single-currency or multi-currency. */
519
+ type CashReceiveLeg = CashLeg | CashMultiCurrencyLeg;
509
520
  interface CashoutInput {
510
521
  /**
511
522
  * Amount to cash out. Without `source`, this is Base USDC base units. With
@@ -520,8 +531,12 @@ interface CashoutInput {
520
531
  /** Relay amount mode. Omit for the recommended exact source-input flow. */
521
532
  tradeType?: 'EXACT_INPUT' | 'EXACT_OUTPUT' | 'EXPECTED_OUTPUT';
522
533
  };
523
- /** Where the fiat should arrive. One method may offer multiple currencies. */
524
- receive: CashLeg | CashMultiCurrencyLeg;
534
+ /**
535
+ * Where the fiat should arrive. One leg, or an array of legs to offer the
536
+ * buyer several payout platforms (each platform at most once). One method
537
+ * may offer multiple currencies; every leg fills at the live oracle rate.
538
+ */
539
+ receive: CashReceiveLeg | readonly [CashReceiveLeg, ...CashReceiveLeg[]];
525
540
  /** Per-order min/max override (USDC base units). */
526
541
  intentAmountRange?: {
527
542
  min: bigint;
@@ -693,4 +708,4 @@ interface CashClient {
693
708
  }
694
709
  declare function createCashClient(options: CashClientOptions): CashClient;
695
710
 
696
- export { createCashClient as $, type CashPayout as A, type CashPayoutPricing as B, type CashPayoutInfo as C, type CashPlatformCapability as D, type CashPreparedStepKind as E, type CashoutInput as F, type CashoutOptions as G, type CuratorPayeeDataInput as H, type IntentStatus as I, type EstimateInput as J, type EstimateOptions as K, type PreparedCashoutReceipt as L, MIN_CASHOUT_AMOUNT as M, RECOMMENDED_MIN_CASHOUT_AMOUNT as N, type OrdersOptions as O, type PrepareResult as P, type RelayOptions as Q, type RelayExecutionResult as R, type RelayQuoteInput as S, type TopUpResult as T, type RelaySourceInput as U, type RelayTransaction as V, type WithdrawResult as W, type SignerOptions as X, type WatchOptions as Y, type WithdrawOptions as Z, buildCapabilities as _, type IntentEntity as a, normalizeCashPayee as a0, type CashBuyerProfile as b, type CashDepositInput as c, type CreateDepositParamsArg as d, type CashOrder as e, type CashFill as f, type CashCapabilities as g, type CashoutResult as h, type CashEstimate as i, type CashFillStats as j, type CashPreparedStep as k, type RelayQuote as l, type RelayStatus as m, type CashSourceCapabilities as n, CASH_ATTRIBUTION_CODE as o, type CashAsset as p, type CashChain as q, type CashClient as r, type CashClientOptions as s, type CashFillEta as t, type CashLeg as u, type CashMultiCurrencyLeg as v, type CashNextAction as w, type CashOrderState as x, type CashPairFillStats as y, type CashPayeeInput as z };
711
+ export { type WithdrawOptions as $, type CashPayeeInput as A, type CashPayout as B, type CashPayoutInfo as C, type CashPayoutPricing as D, type CashPlatformCapability as E, type CashPreparedStepKind as F, type CashReceiveLeg as G, type CashoutInput as H, type IntentStatus as I, type CashoutOptions as J, type CuratorPayeeDataInput as K, type EstimateInput as L, type EstimateOptions as M, MIN_CASHOUT_AMOUNT as N, type OrdersOptions as O, type PrepareResult as P, type PreparedCashoutReceipt as Q, type RelayExecutionResult as R, RECOMMENDED_MIN_CASHOUT_AMOUNT as S, type TopUpResult as T, type RelayOptions as U, type RelayQuoteInput as V, type WithdrawResult as W, type RelaySourceInput as X, type RelayTransaction as Y, type SignerOptions as Z, type WatchOptions as _, type IntentEntity as a, buildCapabilities as a0, createCashClient as a1, normalizeCashPayee as a2, toCashReferralAttributionCode as a3, type CashBuyerProfile as b, type CashDepositInput as c, type CreateDepositParamsArg as d, type CashOrder as e, type CashFill as f, type CashCapabilities as g, type CashoutResult as h, type CashEstimate as i, type CashFillStats as j, type CashPreparedStep as k, type RelayQuote as l, type RelayStatus as m, type CashSourceCapabilities as n, CASH_ATTRIBUTION_CODE as o, CASH_REFERRAL_ATTRIBUTION_PREFIX as p, type CashAsset as q, type CashChain as r, type CashClient as s, type CashClientOptions as t, type CashFillEta as u, type CashLeg as v, type CashMultiCurrencyLeg as w, type CashNextAction as x, type CashOrderState as y, type CashPairFillStats as z };
@@ -461,11 +461,14 @@ declare function normalizeCashPayee(platform: string, payee: CashPayeeInput): Cu
461
461
 
462
462
  /**
463
463
  * ERC-8021 attribution code stamped on every transaction this package
464
- * produces (signed and prepare paths, including approves). Integrator codes
465
- * from `CashClientOptions.referrer` are appended after it; the SDK always
466
- * appends the Base builder code last.
464
+ * produces (signed and prepare paths, including approves). The optional
465
+ * namespaced `CashClientOptions.referralCode` marker and analytics-only
466
+ * `referrer` codes follow it; the SDK appends the Base builder code last.
467
467
  */
468
468
  declare const CASH_ATTRIBUTION_CODE = "peer-cash";
469
+ declare const CASH_REFERRAL_ATTRIBUTION_PREFIX = "peer-ref-";
470
+ /** Convert a Peer referral code into its financially meaningful ERC-8021 marker. */
471
+ declare function toCashReferralAttributionCode(rawCode: string): string;
469
472
  interface CashClientOptions {
470
473
  /** `'production' | 'preproduction' | 'staging'` - selects contracts, curator, and indexer. */
471
474
  environment: RuntimeEnv;
@@ -482,8 +485,14 @@ interface CashClientOptions {
482
485
  /** Relay API configuration for source assets outside Base USDC. */
483
486
  relay?: RelayOptions;
484
487
  /**
485
- * Your own ERC-8021 attribution code(s), appended after
486
- * {@link CASH_ATTRIBUTION_CODE} on every transaction (e.g. `'acme-app'`).
488
+ * Your six-character referral code from the Peer mobile or web app. The SDK
489
+ * emits `peer-ref-XXXXXX`; when this deposit fills, Curator routes the
490
+ * integration share to the Privy wallet that owns the code.
491
+ */
492
+ referralCode?: string;
493
+ /**
494
+ * Analytics-only ERC-8021 attribution code(s), appended after the Peer Cash
495
+ * and optional integration-referral markers (e.g. `'acme-app'`).
487
496
  */
488
497
  referrer?: string | string[];
489
498
  }
@@ -506,6 +515,8 @@ interface CashMultiCurrencyLeg {
506
515
  payee: CashPayeeInput;
507
516
  currency?: never;
508
517
  }
518
+ /** One payout leg of a cash-out - single-currency or multi-currency. */
519
+ type CashReceiveLeg = CashLeg | CashMultiCurrencyLeg;
509
520
  interface CashoutInput {
510
521
  /**
511
522
  * Amount to cash out. Without `source`, this is Base USDC base units. With
@@ -520,8 +531,12 @@ interface CashoutInput {
520
531
  /** Relay amount mode. Omit for the recommended exact source-input flow. */
521
532
  tradeType?: 'EXACT_INPUT' | 'EXACT_OUTPUT' | 'EXPECTED_OUTPUT';
522
533
  };
523
- /** Where the fiat should arrive. One method may offer multiple currencies. */
524
- receive: CashLeg | CashMultiCurrencyLeg;
534
+ /**
535
+ * Where the fiat should arrive. One leg, or an array of legs to offer the
536
+ * buyer several payout platforms (each platform at most once). One method
537
+ * may offer multiple currencies; every leg fills at the live oracle rate.
538
+ */
539
+ receive: CashReceiveLeg | readonly [CashReceiveLeg, ...CashReceiveLeg[]];
525
540
  /** Per-order min/max override (USDC base units). */
526
541
  intentAmountRange?: {
527
542
  min: bigint;
@@ -693,4 +708,4 @@ interface CashClient {
693
708
  }
694
709
  declare function createCashClient(options: CashClientOptions): CashClient;
695
710
 
696
- export { createCashClient as $, type CashPayout as A, type CashPayoutPricing as B, type CashPayoutInfo as C, type CashPlatformCapability as D, type CashPreparedStepKind as E, type CashoutInput as F, type CashoutOptions as G, type CuratorPayeeDataInput as H, type IntentStatus as I, type EstimateInput as J, type EstimateOptions as K, type PreparedCashoutReceipt as L, MIN_CASHOUT_AMOUNT as M, RECOMMENDED_MIN_CASHOUT_AMOUNT as N, type OrdersOptions as O, type PrepareResult as P, type RelayOptions as Q, type RelayExecutionResult as R, type RelayQuoteInput as S, type TopUpResult as T, type RelaySourceInput as U, type RelayTransaction as V, type WithdrawResult as W, type SignerOptions as X, type WatchOptions as Y, type WithdrawOptions as Z, buildCapabilities as _, type IntentEntity as a, normalizeCashPayee as a0, type CashBuyerProfile as b, type CashDepositInput as c, type CreateDepositParamsArg as d, type CashOrder as e, type CashFill as f, type CashCapabilities as g, type CashoutResult as h, type CashEstimate as i, type CashFillStats as j, type CashPreparedStep as k, type RelayQuote as l, type RelayStatus as m, type CashSourceCapabilities as n, CASH_ATTRIBUTION_CODE as o, type CashAsset as p, type CashChain as q, type CashClient as r, type CashClientOptions as s, type CashFillEta as t, type CashLeg as u, type CashMultiCurrencyLeg as v, type CashNextAction as w, type CashOrderState as x, type CashPairFillStats as y, type CashPayeeInput as z };
711
+ export { type WithdrawOptions as $, type CashPayeeInput as A, type CashPayout as B, type CashPayoutInfo as C, type CashPayoutPricing as D, type CashPlatformCapability as E, type CashPreparedStepKind as F, type CashReceiveLeg as G, type CashoutInput as H, type IntentStatus as I, type CashoutOptions as J, type CuratorPayeeDataInput as K, type EstimateInput as L, type EstimateOptions as M, MIN_CASHOUT_AMOUNT as N, type OrdersOptions as O, type PrepareResult as P, type PreparedCashoutReceipt as Q, type RelayExecutionResult as R, RECOMMENDED_MIN_CASHOUT_AMOUNT as S, type TopUpResult as T, type RelayOptions as U, type RelayQuoteInput as V, type WithdrawResult as W, type RelaySourceInput as X, type RelayTransaction as Y, type SignerOptions as Z, type WatchOptions as _, type IntentEntity as a, buildCapabilities as a0, createCashClient as a1, normalizeCashPayee as a2, toCashReferralAttributionCode as a3, type CashBuyerProfile as b, type CashDepositInput as c, type CreateDepositParamsArg as d, type CashOrder as e, type CashFill as f, type CashCapabilities as g, type CashoutResult as h, type CashEstimate as i, type CashFillStats as j, type CashPreparedStep as k, type RelayQuote as l, type RelayStatus as m, type CashSourceCapabilities as n, CASH_ATTRIBUTION_CODE as o, CASH_REFERRAL_ATTRIBUTION_PREFIX as p, type CashAsset as q, type CashChain as r, type CashClient as s, type CashClientOptions as t, type CashFillEta as u, type CashLeg as v, type CashMultiCurrencyLeg as w, type CashNextAction as x, type CashOrderState as y, type CashPairFillStats as z };
package/dist/index.cjs CHANGED
@@ -463,6 +463,9 @@ var PAYEE_HINTS = {
463
463
  n26: "MoneyBeam email or phone number"
464
464
  };
465
465
  var IDENTITY_ATTESTATION_PLATFORMS = /* @__PURE__ */ new Set(["wise", "paypal"]);
466
+ function platformRequiresIdentityAttestation(platform) {
467
+ return IDENTITY_ATTESTATION_PLATFORMS.has(platform);
468
+ }
466
469
  function buildCapabilities(environment) {
467
470
  const catalog = sdk.getPaymentMethodsCatalog(BASE_CHAIN_ID, environment);
468
471
  const platforms = Object.entries(catalog).map(([platform, entry]) => {
@@ -565,6 +568,18 @@ var errors = {
565
568
  retryable: false,
566
569
  remediation: `Pass one or more unique currencies listed for ${platform} by capabilities().`
567
570
  }),
571
+ invalidPayoutPlatforms: (reason) => new CashError({
572
+ code: "INVALID_PAYOUT_PLATFORMS",
573
+ message: `The payout platform set is invalid: ${reason}.`,
574
+ retryable: false,
575
+ remediation: `Pass one payout leg, or an array of legs using each platform from capabilities() at most once.`
576
+ }),
577
+ invalidReferralCode: () => new CashError({
578
+ code: "INVALID_REFERRAL_CODE",
579
+ message: `The Peer referral code must be exactly six letters or numbers.`,
580
+ retryable: false,
581
+ remediation: `Copy your six-character referral code from the Peer mobile or web app and pass it as referralCode.`
582
+ }),
568
583
  activeIntentBlocksWithdrawal: (depositId) => new CashError({
569
584
  code: "ACTIVE_INTENT_BLOCKS_WITHDRAWAL",
570
585
  message: `Order ${depositId} has a live buyer intent; escrow blocks withdrawal while a buyer may still deliver.`,
@@ -1666,6 +1681,13 @@ function normalizeCashPayee(platform, payee) {
1666
1681
  var DEFAULT_RPC_URL = "https://mainnet.base.org";
1667
1682
  var FILL_STATS_CACHE_MS = 15 * 60 * 1e3;
1668
1683
  var CASH_ATTRIBUTION_CODE = "peer-cash";
1684
+ var CASH_REFERRAL_ATTRIBUTION_PREFIX = "peer-ref-";
1685
+ var PEER_REFERRAL_CODE_RE = /^[A-Z0-9]{6}$/;
1686
+ function toCashReferralAttributionCode(rawCode) {
1687
+ const code = rawCode.trim().toUpperCase();
1688
+ if (!PEER_REFERRAL_CODE_RE.test(code)) throw errors.invalidReferralCode();
1689
+ return `${CASH_REFERRAL_ATTRIBUTION_PREFIX}${code}`;
1690
+ }
1669
1691
  var DEFAULT_CURATOR_URLS = {
1670
1692
  preproduction: "https://api-preprod.zkp2p.xyz",
1671
1693
  staging: "https://api-staging.zkp2p.xyz"
@@ -1743,6 +1765,7 @@ function createCashClient(options) {
1743
1765
  const transport = options.transport ?? viem.http(options.rpcUrl ?? DEFAULT_RPC_URL);
1744
1766
  const referrerCodes = [
1745
1767
  CASH_ATTRIBUTION_CODE,
1768
+ ...options.referralCode === void 0 ? [] : [toCashReferralAttributionCode(options.referralCode)],
1746
1769
  ...options.referrer === void 0 ? [] : Array.isArray(options.referrer) ? options.referrer : [options.referrer]
1747
1770
  ];
1748
1771
  const attribution = { referrer: referrerCodes };
@@ -1791,41 +1814,51 @@ function createCashClient(options) {
1791
1814
  return client;
1792
1815
  }
1793
1816
  function validatePayout(input) {
1794
- const { receive } = input;
1795
- const platform = buildCapabilities(environment).platforms.find(
1796
- (capability) => capability.platform === receive.platform
1797
- );
1798
- if (!platform) throw errors.unsupportedPlatform(receive.platform);
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");
1817
+ const legs = Array.isArray(input.receive) ? input.receive : [input.receive];
1818
+ if (legs.length === 0) {
1819
+ throw errors.invalidPayoutPlatforms("at least one payout leg is required");
1811
1820
  }
1812
- for (const currency of currencies) {
1813
- if (!isMarketRateSupported(currency)) {
1814
- throw errors.oracleUnsupportedCurrency(currency);
1821
+ const capabilities2 = buildCapabilities(environment);
1822
+ const seenPlatforms = /* @__PURE__ */ new Set();
1823
+ const payouts = legs.map((leg) => {
1824
+ const platform = capabilities2.platforms.find(
1825
+ (capability) => capability.platform === leg.platform
1826
+ );
1827
+ if (!platform) throw errors.unsupportedPlatform(leg.platform);
1828
+ if (seenPlatforms.has(leg.platform)) {
1829
+ throw errors.invalidPayoutPlatforms(
1830
+ `${leg.platform} appears more than once - each platform may carry one leg`
1831
+ );
1815
1832
  }
1816
- if (!platform.currencies.includes(currency)) {
1817
- throw errors.unsupportedPlatformCurrency(receive.platform, currency);
1833
+ seenPlatforms.add(leg.platform);
1834
+ if (leg.currency === void 0 === (leg.currencies === void 0)) {
1835
+ throw errors.invalidPayoutCurrencies(
1836
+ leg.platform,
1837
+ "pass exactly one of currency or currencies"
1838
+ );
1818
1839
  }
1819
- }
1820
- return {
1821
- payouts: [
1822
- {
1823
- processorName: receive.platform,
1824
- ...currencies.length === 1 ? { currency: currencies[0] } : { currencies },
1825
- payeeData: normalizeCashPayee(receive.platform, receive.payee)
1840
+ const currencies = leg.currencies !== void 0 ? [...leg.currencies] : [leg.currency];
1841
+ if (currencies.length === 0) {
1842
+ throw errors.invalidPayoutCurrencies(leg.platform, "at least one currency is required");
1843
+ }
1844
+ if (new Set(currencies).size !== currencies.length) {
1845
+ throw errors.invalidPayoutCurrencies(leg.platform, "currencies must be unique");
1846
+ }
1847
+ for (const currency of currencies) {
1848
+ if (!isMarketRateSupported(currency)) {
1849
+ throw errors.oracleUnsupportedCurrency(currency);
1826
1850
  }
1827
- ]
1828
- };
1851
+ if (!platform.currencies.includes(currency)) {
1852
+ throw errors.unsupportedPlatformCurrency(leg.platform, currency);
1853
+ }
1854
+ }
1855
+ return {
1856
+ processorName: leg.platform,
1857
+ ...currencies.length === 1 ? { currency: currencies[0] } : { currencies },
1858
+ payeeData: normalizeCashPayee(leg.platform, leg.payee)
1859
+ };
1860
+ });
1861
+ return { payouts };
1829
1862
  }
1830
1863
  function validateDepositInput(amount, input, payoutInput = validatePayout(input)) {
1831
1864
  if (amount < MIN_CASHOUT_AMOUNT) {
@@ -1842,12 +1875,7 @@ function createCashClient(options) {
1842
1875
  };
1843
1876
  }
1844
1877
  function isCashPayoutSet(payouts) {
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
- );
1878
+ return payouts.length > 0 && payouts.every((payout) => payout.pricing.marketRate && payout.pricing.spreadBps === 0);
1851
1879
  }
1852
1880
  async function buildDepositParams(client, depositInput) {
1853
1881
  try {
@@ -1856,7 +1884,8 @@ function createCashClient(options) {
1856
1884
  if (isCashError(err)) throw err;
1857
1885
  const message = err instanceof Error ? err.message : String(err);
1858
1886
  if (/identityAttestation is required|identity attestation/i.test(message)) {
1859
- const platform = depositInput.payouts[0]?.processorName ?? "this platform";
1887
+ const platforms = depositInput.payouts.map((payout) => payout.processorName);
1888
+ const platform = platforms.find(platformRequiresIdentityAttestation) ?? platforms[0] ?? "this platform";
1860
1889
  throw errors.payeeVerificationRequired(platform, err);
1861
1890
  }
1862
1891
  throw errors.payeeRegistrationFailed(err);
@@ -2865,6 +2894,8 @@ var CASH_ERROR_CODES = defineCashErrorCodes([
2865
2894
  "AMOUNT_BELOW_MINIMUM",
2866
2895
  "INVALID_INTENT_AMOUNT_RANGE",
2867
2896
  "INVALID_PAYOUT_CURRENCIES",
2897
+ "INVALID_PAYOUT_PLATFORMS",
2898
+ "INVALID_REFERRAL_CODE",
2868
2899
  "ACTIVE_INTENT_BLOCKS_WITHDRAWAL",
2869
2900
  "NOTHING_TO_WITHDRAW",
2870
2901
  "INSUFFICIENT_AVAILABLE_FUNDS",
@@ -3352,6 +3383,7 @@ exports.BASE_USDC_ADDRESS = BASE_USDC_ADDRESS;
3352
3383
  exports.CASH_ATTRIBUTION_CODE = CASH_ATTRIBUTION_CODE;
3353
3384
  exports.CASH_ORDER_POLL_INTERVAL_MS = CASH_ORDER_POLL_INTERVAL_MS;
3354
3385
  exports.CASH_ORDER_STATUSES = CASH_ORDER_STATUSES;
3386
+ exports.CASH_REFERRAL_ATTRIBUTION_PREFIX = CASH_REFERRAL_ATTRIBUTION_PREFIX;
3355
3387
  exports.CASH_RETAIN_ON_EMPTY = CASH_RETAIN_ON_EMPTY;
3356
3388
  exports.CashError = CashError;
3357
3389
  exports.MARKET_SPREAD_BPS = MARKET_SPREAD_BPS;
@@ -3440,6 +3472,7 @@ exports.relayTransactionsJsonSchema = relayTransactionsJsonSchema;
3440
3472
  exports.resolveCashDepositId = resolveCashDepositId;
3441
3473
  exports.sourceCapabilitiesFromJson = sourceCapabilitiesFromJson;
3442
3474
  exports.sourceCapabilitiesToJson = sourceCapabilitiesToJson;
3475
+ exports.toCashReferralAttributionCode = toCashReferralAttributionCode;
3443
3476
  exports.topUpResultFromJson = topUpResultFromJson;
3444
3477
  exports.topUpResultJsonSchema = topUpResultJsonSchema;
3445
3478
  exports.topUpResultToJson = topUpResultToJson;
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-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';
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-CYSM84-K.cjs';
2
+ export { o as CASH_ATTRIBUTION_CODE, p as CASH_REFERRAL_ATTRIBUTION_PREFIX, q as CashAsset, r as CashChain, s as CashClient, t as CashClientOptions, u as CashFillEta, v as CashLeg, w as CashMultiCurrencyLeg, x as CashNextAction, y as CashOrderState, z as CashPairFillStats, A as CashPayeeInput, B as CashPayout, D as CashPayoutPricing, E as CashPlatformCapability, F as CashPreparedStepKind, G as CashReceiveLeg, H as CashoutInput, J as CashoutOptions, K as CuratorPayeeDataInput, L as EstimateInput, M as EstimateOptions, N as MIN_CASHOUT_AMOUNT, O as OrdersOptions, Q as PreparedCashoutReceipt, S as RECOMMENDED_MIN_CASHOUT_AMOUNT, U as RelayOptions, V as RelayQuoteInput, X as RelaySourceInput, Y as RelayTransaction, Z as SignerOptions, _ as WatchOptions, $ as WithdrawOptions, a0 as buildCapabilities, a1 as createCashClient, a2 as normalizeCashPayee, a3 as toCashReferralAttributionCode } from './createCashClient-CYSM84-K.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' | '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';
13
+ type CashErrorCode = 'ORACLE_UNSUPPORTED_CURRENCY' | 'ORACLE_READ_FAILED' | 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_PLATFORM_CURRENCY' | 'AMOUNT_BELOW_MINIMUM' | 'INVALID_INTENT_AMOUNT_RANGE' | 'INVALID_PAYOUT_CURRENCIES' | 'INVALID_PAYOUT_PLATFORMS' | 'INVALID_REFERRAL_CODE' | '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;
@@ -78,6 +78,8 @@ declare const errors: {
78
78
  amountBelowMinimum: (amount: bigint, min: bigint) => CashError;
79
79
  invalidIntentAmountRange: (amount: bigint, min: bigint, max: bigint) => CashError;
80
80
  invalidPayoutCurrencies: (platform: string, reason: string) => CashError;
81
+ invalidPayoutPlatforms: (reason: string) => CashError;
82
+ invalidReferralCode: () => CashError;
81
83
  activeIntentBlocksWithdrawal: (depositId: string) => CashError;
82
84
  insufficientAvailableFunds: (depositId: string, requested: bigint, available: bigint) => CashError;
83
85
  insufficientTokenBalance: (requiredAmount?: bigint) => CashError;
@@ -223,9 +225,9 @@ interface MethodCurrencyLike {
223
225
  /**
224
226
  * Decode a deposit's payment methods + currency tuples into payout legs.
225
227
  * Pure - the environment arrives via the catalog. One leg per
226
- * (method, currency) pair; cash orders create exactly one in v1. If any
227
- * method is absent from the active catalog, reject the whole set instead of
228
- * partially reclassifying a mixed historical deposit.
228
+ * (method, currency) pair; a cash order carries one or several platforms. If
229
+ * any method is absent from the active catalog, reject the whole set instead
230
+ * of partially reclassifying a mixed historical deposit.
229
231
  */
230
232
  declare function derivePayouts(paymentMethods: ReadonlyArray<PaymentMethodLike>, currencies: ReadonlyArray<MethodCurrencyLike>, catalog: PaymentMethodCatalog): CashPayoutInfo[];
231
233
 
@@ -3184,7 +3186,7 @@ declare const cashErrorRecoveryJsonSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
3184
3186
  operation: string;
3185
3187
  }>]>;
3186
3188
  declare const cashErrorJsonSchema: z.ZodObject<{
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"]>;
3189
+ code: z.ZodEnum<["ORACLE_UNSUPPORTED_CURRENCY", "ORACLE_READ_FAILED", "UNSUPPORTED_PLATFORM", "UNSUPPORTED_PLATFORM_CURRENCY", "AMOUNT_BELOW_MINIMUM", "INVALID_INTENT_AMOUNT_RANGE", "INVALID_PAYOUT_CURRENCIES", "INVALID_PAYOUT_PLATFORMS", "INVALID_REFERRAL_CODE", "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"]>;
3188
3190
  message: z.ZodString;
3189
3191
  retryable: z.ZodBoolean;
3190
3192
  remediation: z.ZodString;
@@ -3571,7 +3573,7 @@ declare const cashErrorJsonSchema: z.ZodObject<{
3571
3573
  }>]>>;
3572
3574
  }, "strict", z.ZodTypeAny, {
3573
3575
  message: string;
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";
3576
+ code: "ORACLE_UNSUPPORTED_CURRENCY" | "ORACLE_READ_FAILED" | "UNSUPPORTED_PLATFORM" | "UNSUPPORTED_PLATFORM_CURRENCY" | "AMOUNT_BELOW_MINIMUM" | "INVALID_INTENT_AMOUNT_RANGE" | "INVALID_PAYOUT_CURRENCIES" | "INVALID_PAYOUT_PLATFORMS" | "INVALID_REFERRAL_CODE" | "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";
3575
3577
  retryable: boolean;
3576
3578
  remediation: string;
3577
3579
  recovery?: {
@@ -3653,7 +3655,7 @@ declare const cashErrorJsonSchema: z.ZodObject<{
3653
3655
  } | undefined;
3654
3656
  }, {
3655
3657
  message: string;
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";
3658
+ code: "ORACLE_UNSUPPORTED_CURRENCY" | "ORACLE_READ_FAILED" | "UNSUPPORTED_PLATFORM" | "UNSUPPORTED_PLATFORM_CURRENCY" | "AMOUNT_BELOW_MINIMUM" | "INVALID_INTENT_AMOUNT_RANGE" | "INVALID_PAYOUT_CURRENCIES" | "INVALID_PAYOUT_PLATFORMS" | "INVALID_REFERRAL_CODE" | "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";
3657
3659
  retryable: boolean;
3658
3660
  remediation: string;
3659
3661
  recovery?: {
package/dist/index.d.ts 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-DGMd8Swr.js';
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.js';
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-CYSM84-K.js';
2
+ export { o as CASH_ATTRIBUTION_CODE, p as CASH_REFERRAL_ATTRIBUTION_PREFIX, q as CashAsset, r as CashChain, s as CashClient, t as CashClientOptions, u as CashFillEta, v as CashLeg, w as CashMultiCurrencyLeg, x as CashNextAction, y as CashOrderState, z as CashPairFillStats, A as CashPayeeInput, B as CashPayout, D as CashPayoutPricing, E as CashPlatformCapability, F as CashPreparedStepKind, G as CashReceiveLeg, H as CashoutInput, J as CashoutOptions, K as CuratorPayeeDataInput, L as EstimateInput, M as EstimateOptions, N as MIN_CASHOUT_AMOUNT, O as OrdersOptions, Q as PreparedCashoutReceipt, S as RECOMMENDED_MIN_CASHOUT_AMOUNT, U as RelayOptions, V as RelayQuoteInput, X as RelaySourceInput, Y as RelayTransaction, Z as SignerOptions, _ as WatchOptions, $ as WithdrawOptions, a0 as buildCapabilities, a1 as createCashClient, a2 as normalizeCashPayee, a3 as toCashReferralAttributionCode } from './createCashClient-CYSM84-K.js';
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' | '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';
13
+ type CashErrorCode = 'ORACLE_UNSUPPORTED_CURRENCY' | 'ORACLE_READ_FAILED' | 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_PLATFORM_CURRENCY' | 'AMOUNT_BELOW_MINIMUM' | 'INVALID_INTENT_AMOUNT_RANGE' | 'INVALID_PAYOUT_CURRENCIES' | 'INVALID_PAYOUT_PLATFORMS' | 'INVALID_REFERRAL_CODE' | '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;
@@ -78,6 +78,8 @@ declare const errors: {
78
78
  amountBelowMinimum: (amount: bigint, min: bigint) => CashError;
79
79
  invalidIntentAmountRange: (amount: bigint, min: bigint, max: bigint) => CashError;
80
80
  invalidPayoutCurrencies: (platform: string, reason: string) => CashError;
81
+ invalidPayoutPlatforms: (reason: string) => CashError;
82
+ invalidReferralCode: () => CashError;
81
83
  activeIntentBlocksWithdrawal: (depositId: string) => CashError;
82
84
  insufficientAvailableFunds: (depositId: string, requested: bigint, available: bigint) => CashError;
83
85
  insufficientTokenBalance: (requiredAmount?: bigint) => CashError;
@@ -223,9 +225,9 @@ interface MethodCurrencyLike {
223
225
  /**
224
226
  * Decode a deposit's payment methods + currency tuples into payout legs.
225
227
  * Pure - the environment arrives via the catalog. One leg per
226
- * (method, currency) pair; cash orders create exactly one in v1. If any
227
- * method is absent from the active catalog, reject the whole set instead of
228
- * partially reclassifying a mixed historical deposit.
228
+ * (method, currency) pair; a cash order carries one or several platforms. If
229
+ * any method is absent from the active catalog, reject the whole set instead
230
+ * of partially reclassifying a mixed historical deposit.
229
231
  */
230
232
  declare function derivePayouts(paymentMethods: ReadonlyArray<PaymentMethodLike>, currencies: ReadonlyArray<MethodCurrencyLike>, catalog: PaymentMethodCatalog): CashPayoutInfo[];
231
233
 
@@ -3184,7 +3186,7 @@ declare const cashErrorRecoveryJsonSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
3184
3186
  operation: string;
3185
3187
  }>]>;
3186
3188
  declare const cashErrorJsonSchema: z.ZodObject<{
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"]>;
3189
+ code: z.ZodEnum<["ORACLE_UNSUPPORTED_CURRENCY", "ORACLE_READ_FAILED", "UNSUPPORTED_PLATFORM", "UNSUPPORTED_PLATFORM_CURRENCY", "AMOUNT_BELOW_MINIMUM", "INVALID_INTENT_AMOUNT_RANGE", "INVALID_PAYOUT_CURRENCIES", "INVALID_PAYOUT_PLATFORMS", "INVALID_REFERRAL_CODE", "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"]>;
3188
3190
  message: z.ZodString;
3189
3191
  retryable: z.ZodBoolean;
3190
3192
  remediation: z.ZodString;
@@ -3571,7 +3573,7 @@ declare const cashErrorJsonSchema: z.ZodObject<{
3571
3573
  }>]>>;
3572
3574
  }, "strict", z.ZodTypeAny, {
3573
3575
  message: string;
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";
3576
+ code: "ORACLE_UNSUPPORTED_CURRENCY" | "ORACLE_READ_FAILED" | "UNSUPPORTED_PLATFORM" | "UNSUPPORTED_PLATFORM_CURRENCY" | "AMOUNT_BELOW_MINIMUM" | "INVALID_INTENT_AMOUNT_RANGE" | "INVALID_PAYOUT_CURRENCIES" | "INVALID_PAYOUT_PLATFORMS" | "INVALID_REFERRAL_CODE" | "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";
3575
3577
  retryable: boolean;
3576
3578
  remediation: string;
3577
3579
  recovery?: {
@@ -3653,7 +3655,7 @@ declare const cashErrorJsonSchema: z.ZodObject<{
3653
3655
  } | undefined;
3654
3656
  }, {
3655
3657
  message: string;
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";
3658
+ code: "ORACLE_UNSUPPORTED_CURRENCY" | "ORACLE_READ_FAILED" | "UNSUPPORTED_PLATFORM" | "UNSUPPORTED_PLATFORM_CURRENCY" | "AMOUNT_BELOW_MINIMUM" | "INVALID_INTENT_AMOUNT_RANGE" | "INVALID_PAYOUT_CURRENCIES" | "INVALID_PAYOUT_PLATFORMS" | "INVALID_REFERRAL_CODE" | "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";
3657
3659
  retryable: boolean;
3658
3660
  remediation: string;
3659
3661
  recovery?: {