@zkp2p/cash 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +19 -2
- package/README.md +44 -2
- package/dist/{chunk-TR6JVYYF.js → chunk-5VBP3IWK.js} +59 -2
- package/dist/{createCashClient-CTEXn9FF.d.cts → createCashClient-Clg5Fa1H.d.cts} +39 -12
- package/dist/{createCashClient-CTEXn9FF.d.ts → createCashClient-Clg5Fa1H.d.ts} +39 -12
- package/dist/index.cjs +209 -38
- package/dist/index.d.cts +16 -8
- package/dist/index.d.ts +16 -8
- package/dist/index.js +152 -40
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/tools.cjs +26 -10
- package/dist/tools.d.cts +29 -10
- package/dist/tools.d.ts +29 -10
- package/dist/tools.js +26 -10
- package/docs/lifecycle-and-recovery.md +5 -1
- package/package.json +1 -1
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
|
390
|
-
|
|
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) {
|
|
@@ -1503,6 +1598,36 @@ async function readEstimate(publicClient, input, context = {}) {
|
|
|
1503
1598
|
return estimate;
|
|
1504
1599
|
}
|
|
1505
1600
|
|
|
1601
|
+
// src/client/payee.ts
|
|
1602
|
+
function normalizePaypalHandle(value) {
|
|
1603
|
+
const withoutProtocol = value.replace(/^https?:\/\//i, "").replace(/^www\./i, "");
|
|
1604
|
+
if (/^paypal\.me(?:[?#].*)?$/i.test(withoutProtocol)) return "";
|
|
1605
|
+
const withoutDomain = withoutProtocol.replace(/^paypal\.me\//i, "");
|
|
1606
|
+
const [pathWithoutQuery = ""] = withoutDomain.split(/[?#]/, 1);
|
|
1607
|
+
const [username = ""] = pathWithoutQuery.replace(/^\/+/, "").split("/", 1);
|
|
1608
|
+
return username.replace(/^@+/, "").trim().toLowerCase();
|
|
1609
|
+
}
|
|
1610
|
+
function normalizeCashPayee(platform, payee) {
|
|
1611
|
+
if (typeof payee !== "string") return payee;
|
|
1612
|
+
const trimmed = payee.trim();
|
|
1613
|
+
switch (platform) {
|
|
1614
|
+
case "venmo":
|
|
1615
|
+
return { offchainId: trimmed.replace(/^@+/, "") };
|
|
1616
|
+
case "cashapp":
|
|
1617
|
+
return { offchainId: trimmed.replace(/^\$+/, "") };
|
|
1618
|
+
case "chime":
|
|
1619
|
+
return { offchainId: trimmed.toLowerCase() };
|
|
1620
|
+
case "n26":
|
|
1621
|
+
return { offchainId: trimmed.replace(/\s/g, "") };
|
|
1622
|
+
case "paypal":
|
|
1623
|
+
return { offchainId: normalizePaypalHandle(trimmed) };
|
|
1624
|
+
case "zelle":
|
|
1625
|
+
return { offchainId: trimmed.toLowerCase() };
|
|
1626
|
+
default:
|
|
1627
|
+
return { offchainId: trimmed };
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1506
1631
|
// src/client/createCashClient.ts
|
|
1507
1632
|
var DEFAULT_RPC_URL = "https://mainnet.base.org";
|
|
1508
1633
|
var FILL_STATS_CACHE_MS = 15 * 60 * 1e3;
|
|
@@ -1544,7 +1669,7 @@ async function submitAndConfirm(client, verb, send) {
|
|
|
1544
1669
|
hash = await send();
|
|
1545
1670
|
} catch (err) {
|
|
1546
1671
|
const mapped = mapChainError(verb, err);
|
|
1547
|
-
if (isKnownPreBroadcastFailure(
|
|
1672
|
+
if (isKnownPreBroadcastFailure(mapped)) throw mapped;
|
|
1548
1673
|
throw errors.transactionSubmissionUnknown(verb, err, {
|
|
1549
1674
|
kind: "inspect-base-operation-submission",
|
|
1550
1675
|
operation: verb
|
|
@@ -1559,12 +1684,8 @@ async function submitAndConfirm(client, verb, send) {
|
|
|
1559
1684
|
if (receipt.status === "reverted") throw errors.transactionFailed(hash);
|
|
1560
1685
|
return hash;
|
|
1561
1686
|
}
|
|
1562
|
-
function isKnownPreBroadcastFailure(
|
|
1563
|
-
|
|
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);
|
|
1687
|
+
function isKnownPreBroadcastFailure(mapped) {
|
|
1688
|
+
return mapped.code === "TRANSACTION_REJECTED" || mapped.code === "INSUFFICIENT_TOKEN_BALANCE" || mapped.code === "ALLOWANCE_NOT_VISIBLE" || mapped.code === "ESCROW_PAUSED";
|
|
1568
1689
|
}
|
|
1569
1690
|
function depositOrderOptions(deposit) {
|
|
1570
1691
|
const remaining = toBigIntOrUndefined(deposit.remainingDeposits);
|
|
@@ -1641,18 +1762,33 @@ function createCashClient(options) {
|
|
|
1641
1762
|
(capability) => capability.platform === receive.platform
|
|
1642
1763
|
);
|
|
1643
1764
|
if (!platform) throw errors.unsupportedPlatform(receive.platform);
|
|
1644
|
-
if (
|
|
1645
|
-
throw errors.
|
|
1765
|
+
if (receive.currency === void 0 === (receive.currencies === void 0)) {
|
|
1766
|
+
throw errors.invalidPayoutCurrencies(
|
|
1767
|
+
receive.platform,
|
|
1768
|
+
"pass exactly one of currency or currencies"
|
|
1769
|
+
);
|
|
1770
|
+
}
|
|
1771
|
+
const currencies = receive.currencies !== void 0 ? [...receive.currencies] : [receive.currency];
|
|
1772
|
+
if (currencies.length === 0) {
|
|
1773
|
+
throw errors.invalidPayoutCurrencies(receive.platform, "at least one currency is required");
|
|
1774
|
+
}
|
|
1775
|
+
if (new Set(currencies).size !== currencies.length) {
|
|
1776
|
+
throw errors.invalidPayoutCurrencies(receive.platform, "currencies must be unique");
|
|
1646
1777
|
}
|
|
1647
|
-
|
|
1648
|
-
|
|
1778
|
+
for (const currency of currencies) {
|
|
1779
|
+
if (!isMarketRateSupported(currency)) {
|
|
1780
|
+
throw errors.oracleUnsupportedCurrency(currency);
|
|
1781
|
+
}
|
|
1782
|
+
if (!platform.currencies.includes(currency)) {
|
|
1783
|
+
throw errors.unsupportedPlatformCurrency(receive.platform, currency);
|
|
1784
|
+
}
|
|
1649
1785
|
}
|
|
1650
1786
|
return {
|
|
1651
1787
|
payouts: [
|
|
1652
1788
|
{
|
|
1653
1789
|
processorName: receive.platform,
|
|
1654
|
-
currency:
|
|
1655
|
-
payeeData: receive.payee
|
|
1790
|
+
...currencies.length === 1 ? { currency: currencies[0] } : { currencies },
|
|
1791
|
+
payeeData: normalizeCashPayee(receive.platform, receive.payee)
|
|
1656
1792
|
}
|
|
1657
1793
|
]
|
|
1658
1794
|
};
|
|
@@ -1672,7 +1808,12 @@ function createCashClient(options) {
|
|
|
1672
1808
|
};
|
|
1673
1809
|
}
|
|
1674
1810
|
function isCashPayoutSet(payouts) {
|
|
1675
|
-
|
|
1811
|
+
const first = payouts[0];
|
|
1812
|
+
return Boolean(
|
|
1813
|
+
first && payouts.every(
|
|
1814
|
+
(payout) => payout.platformHash.toLowerCase() === first.platformHash.toLowerCase() && payout.payeeHash.toLowerCase() === first.payeeHash.toLowerCase() && payout.pricing.marketRate && payout.pricing.spreadBps === 0
|
|
1815
|
+
)
|
|
1816
|
+
);
|
|
1676
1817
|
}
|
|
1677
1818
|
async function buildDepositParams(client, depositInput) {
|
|
1678
1819
|
try {
|
|
@@ -1945,9 +2086,9 @@ function createCashClient(options) {
|
|
|
1945
2086
|
}
|
|
1946
2087
|
},
|
|
1947
2088
|
async cashout(input, opts) {
|
|
2089
|
+
const payoutInput = validatePayout(input);
|
|
1948
2090
|
const client = await signingClient("cashout", opts);
|
|
1949
2091
|
const owner = opts.signer.account.address;
|
|
1950
|
-
const payoutInput = validatePayout(input);
|
|
1951
2092
|
let sourceResult;
|
|
1952
2093
|
let cashoutAmount = input.amount;
|
|
1953
2094
|
if (input.source) {
|
|
@@ -2023,7 +2164,7 @@ function createCashClient(options) {
|
|
|
2023
2164
|
const mapped = mapChainError("createDeposit", err, {
|
|
2024
2165
|
requiredAmount: depositInput2.amount
|
|
2025
2166
|
});
|
|
2026
|
-
if (isKnownPreBroadcastFailure(
|
|
2167
|
+
if (isKnownPreBroadcastFailure(mapped)) {
|
|
2027
2168
|
throw errors.sourceRouteCompletedCashoutFailed(routedSource, mapped);
|
|
2028
2169
|
}
|
|
2029
2170
|
throw errors.sourceCashoutSubmissionUnknown(routedSource, owner, mapped);
|
|
@@ -2079,7 +2220,7 @@ function createCashClient(options) {
|
|
|
2079
2220
|
const mapped = mapChainError("createDeposit", err, {
|
|
2080
2221
|
requiredAmount: depositInput.amount
|
|
2081
2222
|
});
|
|
2082
|
-
if (isKnownPreBroadcastFailure(
|
|
2223
|
+
if (isKnownPreBroadcastFailure(mapped)) throw mapped;
|
|
2083
2224
|
throw errors.transactionSubmissionUnknown("cashout", err, {
|
|
2084
2225
|
kind: "inspect-base-cashout-submission",
|
|
2085
2226
|
amount: depositInput.amount.toString(),
|
|
@@ -2147,6 +2288,32 @@ function createCashClient(options) {
|
|
|
2147
2288
|
register: { hashedOnchainIds }
|
|
2148
2289
|
};
|
|
2149
2290
|
},
|
|
2291
|
+
finalizePreparedCashout(receipt) {
|
|
2292
|
+
if (receipt.status === "reverted") {
|
|
2293
|
+
throw errors.transactionFailed(receipt.transactionHash);
|
|
2294
|
+
}
|
|
2295
|
+
const abi = readClient.escrowV2Abi ?? readClient.escrowAbi;
|
|
2296
|
+
const expectedEscrowAddress = readClient.escrowV2Address ?? readClient.escrowAddress;
|
|
2297
|
+
const resolved = resolveCashDepositId({
|
|
2298
|
+
logs: receipt.logs,
|
|
2299
|
+
abi,
|
|
2300
|
+
expectedEscrowAddress,
|
|
2301
|
+
expectedToken: BASE_USDC_ADDRESS
|
|
2302
|
+
});
|
|
2303
|
+
if (!resolved || resolved.amount === void 0) {
|
|
2304
|
+
throw errors.depositResolutionFailed(receipt.transactionHash);
|
|
2305
|
+
}
|
|
2306
|
+
return {
|
|
2307
|
+
depositId: resolved.compositeId,
|
|
2308
|
+
txHash: receipt.transactionHash,
|
|
2309
|
+
escrowAddress: resolved.escrowAddress,
|
|
2310
|
+
onchainDepositId: resolved.onchainDepositId,
|
|
2311
|
+
order: deriveCashOrder(resolved.compositeId, [], {
|
|
2312
|
+
remainingAmount: resolved.amount,
|
|
2313
|
+
status: "ACTIVE"
|
|
2314
|
+
})
|
|
2315
|
+
};
|
|
2316
|
+
},
|
|
2150
2317
|
async order(depositId) {
|
|
2151
2318
|
return fetchOrder(depositId);
|
|
2152
2319
|
},
|
|
@@ -2663,6 +2830,7 @@ var CASH_ERROR_CODES = defineCashErrorCodes([
|
|
|
2663
2830
|
"UNSUPPORTED_PLATFORM_CURRENCY",
|
|
2664
2831
|
"AMOUNT_BELOW_MINIMUM",
|
|
2665
2832
|
"INVALID_INTENT_AMOUNT_RANGE",
|
|
2833
|
+
"INVALID_PAYOUT_CURRENCIES",
|
|
2666
2834
|
"ACTIVE_INTENT_BLOCKS_WITHDRAWAL",
|
|
2667
2835
|
"NOTHING_TO_WITHDRAW",
|
|
2668
2836
|
"INSUFFICIENT_AVAILABLE_FUNDS",
|
|
@@ -2691,6 +2859,7 @@ var CASH_ERROR_CODES = defineCashErrorCodes([
|
|
|
2691
2859
|
"SIGNER_CHAIN_MISMATCH",
|
|
2692
2860
|
"SIGNER_CHAIN_UNAVAILABLE",
|
|
2693
2861
|
"WATCH_TIMEOUT",
|
|
2862
|
+
"TRANSACTION_REJECTED",
|
|
2694
2863
|
"TRANSACTION_FAILED",
|
|
2695
2864
|
"TRANSACTION_SUBMISSION_UNKNOWN",
|
|
2696
2865
|
"TRANSACTION_STATUS_UNKNOWN"
|
|
@@ -3207,7 +3376,9 @@ exports.intentStatusSchema = intentStatusSchema;
|
|
|
3207
3376
|
exports.isCashError = isCashError;
|
|
3208
3377
|
exports.isFillLive = isFillLive;
|
|
3209
3378
|
exports.isMarketRateSupported = isMarketRateSupported;
|
|
3379
|
+
exports.isUserRejectedError = isUserRejectedError;
|
|
3210
3380
|
exports.nonNegativeBigintString = nonNegativeBigintString;
|
|
3381
|
+
exports.normalizeCashPayee = normalizeCashPayee;
|
|
3211
3382
|
exports.orderFromJson = orderFromJson;
|
|
3212
3383
|
exports.orderToJson = orderToJson;
|
|
3213
3384
|
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-
|
|
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
|
|
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-Clg5Fa1H.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-Clg5Fa1H.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): {
|
|
@@ -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 };
|