@zkp2p/cash 0.4.11-rc.2 → 0.4.11-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 +58 -62
- package/README.md +25 -38
- package/dist/{chunk-AAWRU4JK.js → chunk-JRJLMQS4.js} +0 -32
- package/dist/{createCashClient-G8ksaisL.d.cts → createCashClient-BD8YNt-E.d.cts} +2 -10
- package/dist/{createCashClient-G8ksaisL.d.ts → createCashClient-BD8YNt-E.d.ts} +2 -10
- package/dist/index.cjs +12 -174
- package/dist/index.d.cts +3 -70
- package/dist/index.d.ts +3 -70
- package/dist/index.js +14 -144
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/tools.cjs +2 -2
- package/dist/tools.d.cts +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +2 -2
- package/docs/lifecycle-and-recovery.md +57 -59
- package/examples/agent-tool-use.ts +4 -4
- package/examples/mpp-merchant-cashout/README.md +5 -5
- package/examples/mpp-merchant-cashout/app.ts +3 -6
- package/examples/node-cashout.ts +0 -3
- package/llms.txt +8 -6
- package/package.json +1 -1
- package/skills/peer-cash-integration/SKILL.md +6 -13
package/AGENTS.md
CHANGED
|
@@ -26,8 +26,7 @@ can withdraw an unmatched deposit.
|
|
|
26
26
|
persist the returned `depositId`. If the original plan set
|
|
27
27
|
a non-empty `accessPolicyPaymentMethods`, submit and confirm
|
|
28
28
|
`prepareAccessPolicy(depositId, paymentMethod)` with the depositor for each
|
|
29
|
-
returned method.
|
|
30
|
-
`prepareDisputeProtection(depositId, paymentMethod)`.
|
|
29
|
+
returned method.
|
|
31
30
|
3. **You are a tool-use host** (MCP server, CLI) → import the manifest from
|
|
32
31
|
`@zkp2p/cash/tools` and map the tool names to the verbs above. Base-USDC
|
|
33
32
|
mutating tools return unsigned transactions. `cash_source_quote` is a quote,
|
|
@@ -46,13 +45,17 @@ deposit-level integration share instead of applying maker L1/L2.
|
|
|
46
45
|
|
|
47
46
|
**Platform caveats:**
|
|
48
47
|
|
|
49
|
-
- **Venmo, Cash App, and PayPal
|
|
50
|
-
`cashout()`
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
- **Venmo, Cash App, and PayPal restrict who can signal intents by default.**
|
|
49
|
+
Signed `cashout()` confirms `createDeposit`, then submits and confirms a
|
|
50
|
+
method-scoped Peer Pay merchant policy for every restricted payout leg using
|
|
51
|
+
the same viem wallet. This is a deliberate non-atomic follow-up with a brief
|
|
52
|
+
open-to-all-takers interval. Method-scoped dispute protection is already
|
|
53
|
+
default-on for these rails; do not readiness-gate deposit creation or submit
|
|
54
|
+
a redundant `setDisputeProtectionEnabled(true)` transaction. For `prepare()`,
|
|
55
|
+
read `accessPolicyPaymentMethods`; after `createDeposit` confirms, finalize
|
|
56
|
+
its receipt and submit
|
|
57
|
+
`prepareAccessPolicy(depositId, paymentMethod)` for every returned method.
|
|
58
|
+
Any viem EOA works; Privy is not required.
|
|
56
59
|
|
|
57
60
|
- **Wise and PayPal** carry `requiresIdentityAttestation: true`. A new curator
|
|
58
61
|
registration needs a signed maker identity attestation this SDK cannot mint
|
|
@@ -234,10 +237,6 @@ const route = await cash.nearIntentsStatus({
|
|
|
234
237
|
already exists. If `recovery.transactionHash` is present, inspect that policy
|
|
235
238
|
transaction first; prepare another policy transaction only when the previous
|
|
236
239
|
one is absent or confirmed reverted.
|
|
237
|
-
- **Fail closed on dispute protection.** `DISPUTE_PROTECTION_UNAVAILABLE`
|
|
238
|
-
occurs before deposit creation. `DISPUTE_PROTECTION_CONFIGURATION_FAILED`
|
|
239
|
-
means the deposit exists; inspect its recovery hash and use
|
|
240
|
-
`prepareDisputeProtection` only when resubmission is safe.
|
|
241
240
|
- **`ORDER_NOT_FOUND` seconds after `cashout()` is indexer lag**, not a lost
|
|
242
241
|
deposit. The tx receipt you hold is the truth. Retry; `watch()` absorbs
|
|
243
242
|
this automatically.
|
|
@@ -262,53 +261,51 @@ const route = await cash.nearIntentsStatus({
|
|
|
262
261
|
|
|
263
262
|
Every `CashError` carries `code`, `retryable`, `remediation`. Behavior:
|
|
264
263
|
|
|
265
|
-
| Code
|
|
266
|
-
|
|
|
267
|
-
| `ORACLE_UNSUPPORTED_CURRENCY`
|
|
268
|
-
| `ORACLE_READ_FAILED`
|
|
269
|
-
| `UNSUPPORTED_PLATFORM`
|
|
270
|
-
| `UNSUPPORTED_PLATFORM_CURRENCY`
|
|
271
|
-
| `AMOUNT_BELOW_MINIMUM`
|
|
272
|
-
| `INVALID_INTENT_AMOUNT_RANGE`
|
|
273
|
-
| `INVALID_PAYOUT_CURRENCIES`
|
|
274
|
-
| `INVALID_PAYOUT_PLATFORMS`
|
|
275
|
-
| `PAYEE_VERIFICATION_REQUIRED`
|
|
276
|
-
| `PAYEE_REGISTRATION_FAILED`
|
|
277
|
-
| `ATOMIC_ACCESS_POLICY_REQUIRED`
|
|
278
|
-
| `ACCESS_POLICY_CONFIGURATION_FAILED`
|
|
279
|
-
| `
|
|
280
|
-
| `
|
|
281
|
-
| `
|
|
282
|
-
| `
|
|
283
|
-
| `
|
|
284
|
-
| `
|
|
285
|
-
| `
|
|
286
|
-
| `
|
|
287
|
-
| `
|
|
288
|
-
| `
|
|
289
|
-
| `
|
|
290
|
-
| `
|
|
291
|
-
| `
|
|
292
|
-
| `
|
|
293
|
-
| `
|
|
294
|
-
| `
|
|
295
|
-
| `
|
|
296
|
-
| `
|
|
297
|
-
| `
|
|
298
|
-
| `
|
|
299
|
-
| `
|
|
300
|
-
| `
|
|
301
|
-
| `
|
|
302
|
-
| `
|
|
303
|
-
| `
|
|
304
|
-
| `
|
|
305
|
-
| `
|
|
306
|
-
| `
|
|
307
|
-
| `
|
|
308
|
-
| `
|
|
309
|
-
| `
|
|
310
|
-
| `WATCH_TIMEOUT` | yes | Resume `watch(depositId)` later |
|
|
311
|
-
| `ESCROW_PAUSED` | yes | Back off; existing funds remain withdrawable |
|
|
264
|
+
| Code | Retryable | Agent action |
|
|
265
|
+
| --------------------------------------- | --------- | ------------------------------------------------------------------------------------------ |
|
|
266
|
+
| `ORACLE_UNSUPPORTED_CURRENCY` | no | Re-pick currency from `capabilities()` |
|
|
267
|
+
| `ORACLE_READ_FAILED` | yes | Retry the read through a healthy Base RPC; do not present a cached value as live |
|
|
268
|
+
| `UNSUPPORTED_PLATFORM` | no | Re-pick platform from `capabilities()` |
|
|
269
|
+
| `UNSUPPORTED_PLATFORM_CURRENCY` | no | Use a currency listed for that platform |
|
|
270
|
+
| `AMOUNT_BELOW_MINIMUM` | no | Raise amount (hard floor $0.01, recommended at least 1 USDC) |
|
|
271
|
+
| `INVALID_INTENT_AMOUNT_RANGE` | no | Use a positive min, max at least min, and max no greater than amount |
|
|
272
|
+
| `INVALID_PAYOUT_CURRENCIES` | no | Pass one or more unique currencies listed for the platform |
|
|
273
|
+
| `INVALID_PAYOUT_PLATFORMS` | no | Pass one leg or an array of legs, using each platform at most once |
|
|
274
|
+
| `PAYEE_VERIFICATION_REQUIRED` | no | Use Peer web + TEE extension for new Wise/PayPal; reuse registered handles |
|
|
275
|
+
| `PAYEE_REGISTRATION_FAILED` | yes | Validate against `payeeHint`, then retry |
|
|
276
|
+
| `ATOMIC_ACCESS_POLICY_REQUIRED` | no | Deprecated compatibility code; current SDK flows never emit it |
|
|
277
|
+
| `ACCESS_POLICY_CONFIGURATION_FAILED` | no | Deposit exists; inspect policy tx first, attach only if needed; never repeat the cash-out. |
|
|
278
|
+
| `SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE` | no | Execute Relay with a signer first, then prepare a Base-USDC cashout |
|
|
279
|
+
| `SOURCE_RECIPIENT_MISMATCH` | no | Route Base USDC to the cashout depositor |
|
|
280
|
+
| `SOURCE_CAPABILITIES_FAILED` | yes | Retry discovery or fall back to Base USDC |
|
|
281
|
+
| `SOURCE_QUOTE_FAILED` | yes | Refresh capabilities and request a new canonical Base-USDC quote |
|
|
282
|
+
| `SOURCE_NONCE_MANAGER_REQUIRED` | no | Preflight; recreate the source signer with viem's `nonceManager`, then quote again |
|
|
283
|
+
| `SOURCE_EXECUTION_FAILED` | no | Inspect source transactions and Relay status before any retry |
|
|
284
|
+
| `SOURCE_DEPOSIT_SUBMISSION_FAILED` | yes | Retry only the 1Click notification; never resend source funds |
|
|
285
|
+
| `SOURCE_STATUS_FAILED` | yes | Retry only the status read |
|
|
286
|
+
| `SOURCE_ROUTE_COMPLETED_CASHOUT_FAILED` | no | Do not route again; retry Base-only with `recovery.amount` |
|
|
287
|
+
| `SOURCE_CASHOUT_SUBMISSION_UNKNOWN` | no | Inspect Base activity and orders; prove no deposit exists before retrying |
|
|
288
|
+
| `SOURCE_CASHOUT_STATUS_UNKNOWN` | no | Inspect `recovery.depositTxHash`; do not resubmit while its receipt is unknown |
|
|
289
|
+
| `INSUFFICIENT_TOKEN_BALANCE` | no | Fund the required token amount, then retry |
|
|
290
|
+
| `ALLOWANCE_NOT_VISIBLE` | yes | Approval mined but a stale RPC hid it; retry after it becomes visible |
|
|
291
|
+
| `TRANSACTION_REJECTED` | yes | Retry when ready and approve the wallet request |
|
|
292
|
+
| `TRANSACTION_FAILED` | no | Inspect the failed/reverted call before another action |
|
|
293
|
+
| `TRANSACTION_SUBMISSION_UNKNOWN` | no | Inspect Base wallet/protocol state and the recovery action before any resubmission |
|
|
294
|
+
| `TRANSACTION_STATUS_UNKNOWN` | no | Inspect `recovery.transactionHash` before resubmitting |
|
|
295
|
+
| `DEPOSIT_RESOLUTION_FAILED` | no | Inspect the confirmed Base receipt and recover the id from `DepositReceived` |
|
|
296
|
+
| `INVALID_DEPOSIT_ID` | no | Use the exact id returned by `cashout()` |
|
|
297
|
+
| `ORDER_NOT_FOUND` | yes | Retry through immediate indexer lag; otherwise verify the id |
|
|
298
|
+
| `INDEXER_LAG` | yes | Retry after a few seconds |
|
|
299
|
+
| `INDEXER_UNAVAILABLE` | yes | Retry only the failed read; keep the id/owner and never repeat a transaction |
|
|
300
|
+
| `ACTIVE_INTENT_BLOCKS_WITHDRAWAL` | yes | Wait for fill/expiry, or withdraw only the unlocked amount |
|
|
301
|
+
| `INSUFFICIENT_AVAILABLE_FUNDS` | yes | Lower the partial withdrawal amount |
|
|
302
|
+
| `NOTHING_TO_WITHDRAW` | no | Order is terminal; reconcile records |
|
|
303
|
+
| `ORDER_NOT_ACTIVE` | no | Start a new cashout instead of topping up |
|
|
304
|
+
| `SIGNER_REQUIRED` | no | Provide a signer or use a Base-USDC prepare path |
|
|
305
|
+
| `SIGNER_CHAIN_MISMATCH` | no | Switch to the required chain and refresh any Relay quote before retrying |
|
|
306
|
+
| `SIGNER_CHAIN_UNAVAILABLE` | yes | Reconnect the wallet and prove its chain before retrying |
|
|
307
|
+
| `WATCH_TIMEOUT` | yes | Resume `watch(depositId)` later |
|
|
308
|
+
| `ESCROW_PAUSED` | yes | Back off; existing funds remain withdrawable |
|
|
312
309
|
|
|
313
310
|
`isCashError(err)` narrows unknown errors; `err.toJSON()` is safe for logs
|
|
314
311
|
and tool results.
|
|
@@ -319,8 +316,7 @@ Prove your integration against `environment: 'staging'` with a funded test
|
|
|
319
316
|
wallet. Never wait on a buyer - buyer-side is out of your scope:
|
|
320
317
|
|
|
321
318
|
1. `cashout()` a small amount (1–2 USDC) → capture `depositId` and, for a
|
|
322
|
-
restricted payout, every entry in `accessPolicyTxHashes
|
|
323
|
-
`disputeProtectionTxHashes`.
|
|
319
|
+
restricted payout, every entry in `accessPolicyTxHashes`.
|
|
324
320
|
2. `order(depositId)` shows `awaiting-buyer` (retry through indexer lag).
|
|
325
321
|
3. `orders(owner)` includes the deposit.
|
|
326
322
|
4. `withdraw(depositId)` → transaction succeeds.
|
package/README.md
CHANGED
|
@@ -39,15 +39,15 @@ const fillStats = await cash.fillStats();
|
|
|
39
39
|
const pairStats = fillStats['venmo:USD'];
|
|
40
40
|
const multiCurrencyStats = fillStats['revolut:EUR+GBP+USD'];
|
|
41
41
|
|
|
42
|
-
const { depositId, accessPolicyTxHashes
|
|
42
|
+
const { depositId, accessPolicyTxHashes } = await cash.cashout(
|
|
43
43
|
{
|
|
44
44
|
amount: usdc(1000),
|
|
45
45
|
receive: { platform: 'venmo', currency: 'USD', payee: '@you' },
|
|
46
46
|
},
|
|
47
47
|
{ signer }, // any viem WalletClient on Base, including an EOA
|
|
48
48
|
);
|
|
49
|
-
//
|
|
50
|
-
console.log(depositId, accessPolicyTxHashes
|
|
49
|
+
// Venmo, Cash App, and PayPal return only after their access policy confirms.
|
|
50
|
+
console.log(depositId, accessPolicyTxHashes);
|
|
51
51
|
|
|
52
52
|
// One method can offer several currencies. The buyer chooses the fill
|
|
53
53
|
// currency, and each option resolves at its own live oracle rate.
|
|
@@ -92,9 +92,8 @@ Peer Cash and the general ZKP2P SDK serve different integration depths:
|
|
|
92
92
|
| `@zkp2p/sdk` | You are composing directly with the Peer protocol | General maker and taker operations, deposits, intents, proofs, quotes, vaults, rate managers, referrals, hooks, and API helpers. Your application owns the workflow and protocol choices. |
|
|
93
93
|
|
|
94
94
|
Peer Cash is a narrow facade over `@zkp2p/sdk`, not a replacement for it. It
|
|
95
|
-
cannot express custom spreads, buyer-side proof flows, vaults,
|
|
96
|
-
|
|
97
|
-
default is fixed rather than a configurable dispute surface.
|
|
95
|
+
cannot express custom spreads, buyer-side proof flows, vaults, disputes, or
|
|
96
|
+
arbitrary protocol operations.
|
|
98
97
|
|
|
99
98
|
## The core verbs
|
|
100
99
|
|
|
@@ -109,10 +108,9 @@ default is fixed rather than a configurable dispute surface.
|
|
|
109
108
|
| `quoteNearIntentsSource(input)` | Signed 1Click quote with an origin-chain deposit address and optional memo |
|
|
110
109
|
| `submitNearIntentsDeposit(input)` / `nearIntentsStatus(input)` | Optionally register an origin tx, then track 1Click delivery/refund evidence |
|
|
111
110
|
| `estimate({ amount, currency }, { includeEta? })` | Base USDC oracle estimate; optionally skip the historical ETA for progressive rendering |
|
|
112
|
-
| `cashout(input, { signer })` | Creates the order; restricted methods then attach the Peer Pay merchant policy
|
|
113
|
-
| `prepare(input)` / `finalizePreparedCashout(receipt)` | Prepare external signing, resolve the deposit, then iterate
|
|
111
|
+
| `cashout(input, { signer })` | Creates the order with any viem wallet; restricted methods then attach the Peer Pay merchant policy |
|
|
112
|
+
| `prepare(input)` / `finalizePreparedCashout(receipt)` | Prepare external signing, resolve the deposit, then iterate `accessPolicyPaymentMethods` for follow-ups |
|
|
114
113
|
| `prepareAccessPolicy(depositId, paymentMethod)` | Prepare one post-deposit, method-scoped Peer Pay merchant policy transaction |
|
|
115
|
-
| `prepareDisputeProtection(depositId, paymentMethod)` | Prepare one post-deposit, method-scoped dispute-protection transaction |
|
|
116
114
|
| `order(depositId)` / `orders(owner)` | Resume any order from its id alone; list all orders for a wallet |
|
|
117
115
|
| `watch(depositId)` | Async iterator: yields on every state change until terminal, abort, or timeout |
|
|
118
116
|
| `withdraw(depositId, { signer, amount? })` | The ONE unwind verb - partial with an `amount` (live intents don't block it), full close without (prunes expired intents first) |
|
|
@@ -141,12 +139,12 @@ mixed historical deposit.
|
|
|
141
139
|
|
|
142
140
|
## Payout rails and access policies
|
|
143
141
|
|
|
144
|
-
| Payout rail |
|
|
145
|
-
| --------------------- |
|
|
146
|
-
| Venmo / Cash App |
|
|
147
|
-
| PayPal | Same method-scoped
|
|
148
|
-
| Wise | No
|
|
149
|
-
| Other supported rails | No
|
|
142
|
+
| Payout rail | Access-policy behavior | New payee registration |
|
|
143
|
+
| --------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
144
|
+
| Venmo / Cash App | Peer Pay merchant policy attaches for that payment method | Curator validates the live handle |
|
|
145
|
+
| PayPal | Same method-scoped Peer Pay follow-up | Requires a Peer TEE browser-extension identity attestation |
|
|
146
|
+
| Wise | No access-policy follow-up | Requires a Peer TEE browser-extension identity attestation |
|
|
147
|
+
| Other supported rails | No access-policy follow-up; use `capabilities()` for currencies and format | Follow the `payeeHint`; live-validation behavior is described in the integration guide |
|
|
150
148
|
|
|
151
149
|
No platform requires an atomic access-policy flow. `cashout()` and `prepare()`
|
|
152
150
|
work with any viem `WalletClient`, including a local or externally connected
|
|
@@ -155,15 +153,17 @@ EOA; no Privy wallet or signer API is required. The deprecated
|
|
|
155
153
|
always `false`.
|
|
156
154
|
|
|
157
155
|
Venmo, Cash App, and PayPal cash-outs restrict intent signaling to the Peer Pay
|
|
158
|
-
merchant group
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
`
|
|
165
|
-
`
|
|
166
|
-
|
|
156
|
+
merchant group by default. Each restricted payout method gets its own policy.
|
|
157
|
+
Signed `cashout()` creates the deposit first, then uses the same wallet to
|
|
158
|
+
submit and confirm every required policy transaction; this intentionally
|
|
159
|
+
leaves a brief interval where any taker can signal. Method-scoped dispute
|
|
160
|
+
protection is already default-on for these rails, so Cash neither
|
|
161
|
+
readiness-gates deposit creation nor submits
|
|
162
|
+
`setDisputeProtectionEnabled(true)`. Prepared integrations receive
|
|
163
|
+
`accessPolicyPaymentMethods`; after confirming `createDeposit`, call
|
|
164
|
+
`finalizePreparedCashout(receipt)`, then submit
|
|
165
|
+
`prepareAccessPolicy(depositId, paymentMethod)` once for every returned method.
|
|
166
|
+
Other platforms do not need the follow-up.
|
|
167
167
|
|
|
168
168
|
If policy attachment fails, `ACCESS_POLICY_CONFIGURATION_FAILED.recovery`
|
|
169
169
|
identifies the existing deposit and any submitted policy transaction. Never
|
|
@@ -171,12 +171,6 @@ create another cash-out. When `recovery.transactionHash` is present, inspect
|
|
|
171
171
|
that transaction before resubmitting; otherwise prepare the policy again with
|
|
172
172
|
the same depositor wallet.
|
|
173
173
|
|
|
174
|
-
If protection is not ready, `DISPUTE_PROTECTION_UNAVAILABLE` fails before the
|
|
175
|
-
deposit is created. If its post-deposit transaction fails,
|
|
176
|
-
`DISPUTE_PROTECTION_CONFIGURATION_FAILED.recovery` identifies the existing
|
|
177
|
-
deposit and submitted hash, if any; inspect it before using
|
|
178
|
-
`prepareDisputeProtection` for recovery and never repeat the cash-out.
|
|
179
|
-
|
|
180
174
|
`capabilities()` presents Zelle as one platform. A cashout with
|
|
181
175
|
`receive.platform: 'zelle'` attaches only the generic Zelle payment method to
|
|
182
176
|
the deposit. Bank-specific capture routing is outside this maker-side SDK and
|
|
@@ -318,11 +312,6 @@ they are available. A source-routed result includes both a flat
|
|
|
318
312
|
`prepareAccessPolicy(error.recovery.depositId, error.recovery.paymentMethod)`
|
|
319
313
|
only if the prior policy
|
|
320
314
|
transaction did not succeed.
|
|
321
|
-
- `DISPUTE_PROTECTION_UNAVAILABLE`: the protected contract stack is not ready;
|
|
322
|
-
no deposit was created. Retry later or use an unrestricted payout platform.
|
|
323
|
-
- `DISPUTE_PROTECTION_CONFIGURATION_FAILED`: the deposit exists, but one
|
|
324
|
-
required protection transaction was not confirmed. Inspect its recovery hash
|
|
325
|
-
before calling `prepareDisputeProtection`; never create another cash-out.
|
|
326
315
|
|
|
327
316
|
Wallet clients pinned to the wrong chain fail with `SIGNER_CHAIN_MISMATCH`
|
|
328
317
|
before a quote or transaction is submitted. Chainless wallets are checked
|
|
@@ -404,9 +393,7 @@ analytics-only ERC-8021 codes such as `acme-app`.
|
|
|
404
393
|
- After a prepared restricted cash-out confirms, the host adapter must call
|
|
405
394
|
`finalizePreparedCashout(receipt)` and submit
|
|
406
395
|
`prepareAccessPolicy(depositId, paymentMethod)` for every value in
|
|
407
|
-
`accessPolicyPaymentMethods
|
|
408
|
-
`prepareDisputeProtection(depositId, paymentMethod)` for every value in
|
|
409
|
-
`disputeProtectionPaymentMethods`; these receipt/signing operations are
|
|
396
|
+
`accessPolicyPaymentMethods`; these receipt/signing operations are
|
|
410
397
|
`CashClient` methods, not built-in tool calls.
|
|
411
398
|
- Every error carries `code`, `retryable`, and a `remediation` sentence.
|
|
412
399
|
- Every order carries `nextActions: ('wait' | 'withdraw')[]` - no heuristics.
|
|
@@ -424,38 +424,6 @@ var errors = {
|
|
|
424
424
|
},
|
|
425
425
|
{ cause: context.cause }
|
|
426
426
|
),
|
|
427
|
-
disputeProtectionUnavailable: (state, cause) => new CashError(
|
|
428
|
-
{
|
|
429
|
-
code: "DISPUTE_PROTECTION_UNAVAILABLE",
|
|
430
|
-
message: `Dispute protection is not ready for restricted Peer Cash payouts${state ? ` (${state})` : ""}.`,
|
|
431
|
-
retryable: true,
|
|
432
|
-
remediation: `Retry after the dispute-protection contracts are active and accepting protected deposits, or choose an unrestricted payout platform. No cash-out deposit was created.`
|
|
433
|
-
},
|
|
434
|
-
{ cause }
|
|
435
|
-
),
|
|
436
|
-
disputeProtectionConfigurationFailed: (depositId, paymentMethod, context = {}) => new CashError(
|
|
437
|
-
{
|
|
438
|
-
code: "DISPUTE_PROTECTION_CONFIGURATION_FAILED",
|
|
439
|
-
message: `Cash-out deposit ${depositId} was created, but dispute protection could not be confirmed for ${paymentMethod}.`,
|
|
440
|
-
retryable: false,
|
|
441
|
-
remediation: `Do not create another cash-out. If recovery.transactionHash is present, inspect that dispute-protection transaction first. Otherwise, or if it is confirmed reverted, submit and confirm prepareDisputeProtection(recovery.depositId, recovery.paymentMethod) with the same depositor wallet.`,
|
|
442
|
-
recovery: {
|
|
443
|
-
kind: "configure-cashout-dispute-protection",
|
|
444
|
-
depositId,
|
|
445
|
-
paymentMethod,
|
|
446
|
-
...context.transactionHash ? { transactionHash: context.transactionHash } : {},
|
|
447
|
-
...context.source ? {
|
|
448
|
-
source: {
|
|
449
|
-
amount: context.source.amount.toString(),
|
|
450
|
-
...context.source.requestId ? { requestId: context.source.requestId } : {},
|
|
451
|
-
txHashes: context.source.txHashes,
|
|
452
|
-
...context.source.transactions ? { transactions: context.source.transactions } : {}
|
|
453
|
-
}
|
|
454
|
-
} : {}
|
|
455
|
-
}
|
|
456
|
-
},
|
|
457
|
-
{ cause: context.cause }
|
|
458
|
-
),
|
|
459
427
|
escrowPaused: () => new CashError({
|
|
460
428
|
code: "ESCROW_PAUSED",
|
|
461
429
|
message: `The escrow contract is paused; deposits are temporarily disabled.`,
|
|
@@ -486,8 +486,8 @@ interface CashPlatformCapability {
|
|
|
486
486
|
requiresIdentityAttestation: boolean;
|
|
487
487
|
/**
|
|
488
488
|
* @deprecated Always false. This does not report the sequential restricted-
|
|
489
|
-
* platform
|
|
490
|
-
* `PrepareResult`.
|
|
489
|
+
* platform policy; prepared hosts must inspect
|
|
490
|
+
* `PrepareResult.accessPolicyPaymentMethods`.
|
|
491
491
|
*/
|
|
492
492
|
requiresAtomicAccessPolicy: boolean;
|
|
493
493
|
}
|
|
@@ -769,8 +769,6 @@ interface CashoutResult {
|
|
|
769
769
|
accessPolicyTxHash?: Hash;
|
|
770
770
|
/** Confirmed method-scoped policy transactions for restricted payout legs. */
|
|
771
771
|
accessPolicyTxHashes?: Hash[];
|
|
772
|
-
/** Confirmed method-scoped dispute-protection transactions for restricted payout legs. */
|
|
773
|
-
disputeProtectionTxHashes?: Hash[];
|
|
774
772
|
/** Present when `cashout()` first routed a source asset through Relay. */
|
|
775
773
|
source?: {
|
|
776
774
|
/** Conservative Base USDC amount deposited (Relay's guaranteed minimum output). */
|
|
@@ -801,10 +799,6 @@ interface PrepareResult {
|
|
|
801
799
|
accessPolicyRequired: boolean;
|
|
802
800
|
/** Method hashes that each require a post-deposit Peer Pay policy transaction. */
|
|
803
801
|
accessPolicyPaymentMethods: Hex[];
|
|
804
|
-
/** Whether the host must enable dispute protection after `createDeposit` confirms. */
|
|
805
|
-
disputeProtectionRequired: boolean;
|
|
806
|
-
/** Method hashes that each require a post-deposit dispute-protection transaction. */
|
|
807
|
-
disputeProtectionPaymentMethods: Hex[];
|
|
808
802
|
}
|
|
809
803
|
/** Confirmed createDeposit receipt from an externally executed prepare() plan. */
|
|
810
804
|
interface PreparedCashoutReceipt {
|
|
@@ -883,8 +877,6 @@ interface CashClient {
|
|
|
883
877
|
finalizePreparedCashout(receipt: PreparedCashoutReceipt): CashoutResult;
|
|
884
878
|
/** Prepare one method-scoped Peer Pay follow-up for a restricted cash-out. */
|
|
885
879
|
prepareAccessPolicy(depositId: string, paymentMethod: Hex): PreparedTransaction;
|
|
886
|
-
/** Prepare one method-scoped dispute-protection follow-up for a restricted cash-out. */
|
|
887
|
-
prepareDisputeProtection(depositId: string, paymentMethod: Hex): Promise<PreparedTransaction>;
|
|
888
880
|
/** 3 - Observe: resumable from `depositId` alone; no session state anywhere. */
|
|
889
881
|
order(depositId: string): Promise<CashOrder>;
|
|
890
882
|
/**
|
|
@@ -486,8 +486,8 @@ interface CashPlatformCapability {
|
|
|
486
486
|
requiresIdentityAttestation: boolean;
|
|
487
487
|
/**
|
|
488
488
|
* @deprecated Always false. This does not report the sequential restricted-
|
|
489
|
-
* platform
|
|
490
|
-
* `PrepareResult`.
|
|
489
|
+
* platform policy; prepared hosts must inspect
|
|
490
|
+
* `PrepareResult.accessPolicyPaymentMethods`.
|
|
491
491
|
*/
|
|
492
492
|
requiresAtomicAccessPolicy: boolean;
|
|
493
493
|
}
|
|
@@ -769,8 +769,6 @@ interface CashoutResult {
|
|
|
769
769
|
accessPolicyTxHash?: Hash;
|
|
770
770
|
/** Confirmed method-scoped policy transactions for restricted payout legs. */
|
|
771
771
|
accessPolicyTxHashes?: Hash[];
|
|
772
|
-
/** Confirmed method-scoped dispute-protection transactions for restricted payout legs. */
|
|
773
|
-
disputeProtectionTxHashes?: Hash[];
|
|
774
772
|
/** Present when `cashout()` first routed a source asset through Relay. */
|
|
775
773
|
source?: {
|
|
776
774
|
/** Conservative Base USDC amount deposited (Relay's guaranteed minimum output). */
|
|
@@ -801,10 +799,6 @@ interface PrepareResult {
|
|
|
801
799
|
accessPolicyRequired: boolean;
|
|
802
800
|
/** Method hashes that each require a post-deposit Peer Pay policy transaction. */
|
|
803
801
|
accessPolicyPaymentMethods: Hex[];
|
|
804
|
-
/** Whether the host must enable dispute protection after `createDeposit` confirms. */
|
|
805
|
-
disputeProtectionRequired: boolean;
|
|
806
|
-
/** Method hashes that each require a post-deposit dispute-protection transaction. */
|
|
807
|
-
disputeProtectionPaymentMethods: Hex[];
|
|
808
802
|
}
|
|
809
803
|
/** Confirmed createDeposit receipt from an externally executed prepare() plan. */
|
|
810
804
|
interface PreparedCashoutReceipt {
|
|
@@ -883,8 +877,6 @@ interface CashClient {
|
|
|
883
877
|
finalizePreparedCashout(receipt: PreparedCashoutReceipt): CashoutResult;
|
|
884
878
|
/** Prepare one method-scoped Peer Pay follow-up for a restricted cash-out. */
|
|
885
879
|
prepareAccessPolicy(depositId: string, paymentMethod: Hex): PreparedTransaction;
|
|
886
|
-
/** Prepare one method-scoped dispute-protection follow-up for a restricted cash-out. */
|
|
887
|
-
prepareDisputeProtection(depositId: string, paymentMethod: Hex): Promise<PreparedTransaction>;
|
|
888
880
|
/** 3 - Observe: resumable from `depositId` alone; no session state anywhere. */
|
|
889
881
|
order(depositId: string): Promise<CashOrder>;
|
|
890
882
|
/**
|