@zkp2p/cash 0.4.11-rc.3 → 0.4.11-rc.4
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 +15 -9
- package/README.md +35 -18
- package/dist/{chunk-JRJLMQS4.js → chunk-UIELF4TY.js} +4 -4
- package/dist/{createCashClient-BD8YNt-E.d.cts → createCashClient-BIAuk1Qy.d.cts} +41 -19
- package/dist/{createCashClient-BD8YNt-E.d.ts → createCashClient-BIAuk1Qy.d.ts} +41 -19
- package/dist/index.cjs +281 -24
- package/dist/index.d.cts +55 -13
- package/dist/index.d.ts +55 -13
- package/dist/index.js +278 -26
- package/dist/react.d.cts +5 -5
- package/dist/react.d.ts +5 -5
- package/dist/react.js +1 -1
- package/dist/tools.cjs +6 -6
- package/dist/tools.d.cts +5 -5
- package/dist/tools.d.ts +5 -5
- package/dist/tools.js +6 -6
- package/docs/lifecycle-and-recovery.md +28 -21
- package/examples/carpe-diem-provider-cashout/README.md +2 -2
- package/examples/node-cashout.ts +3 -3
- package/examples/onchain-demo/src/shell.html +3 -3
- package/llms.txt +13 -11
- package/package.json +2 -2
- package/skills/peer-cash-integration/SKILL.md +13 -10
package/AGENTS.md
CHANGED
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
You are integrating Peer Cash: an offramp that routes Relay-supported EVM
|
|
8
8
|
assets or NEAR Intents 1Click external deposits into Base USDC, then converts
|
|
9
|
-
Base USDC to fiat (Venmo, Revolut, Wise, Zelle, ...) at
|
|
10
|
-
market rate.
|
|
9
|
+
Base USDC to fiat (Venmo, Revolut, Wise, Alipay, Zelle, ...) at a zero-spread
|
|
10
|
+
Chainlink market rate. Existing corridors bind at intent signal; Alipay/CNY
|
|
11
|
+
fixes a fresh Ethereum Chainlink snapshot during deposit preparation. The user whose USDC you
|
|
11
12
|
manage is the **maker**; a buyer pays them fiat and proves it with TEE-TLS; the
|
|
12
13
|
protocol releases the USDC. Funds are held by the protocol, and only the maker
|
|
13
14
|
can withdraw an unmatched deposit.
|
|
@@ -45,7 +46,7 @@ deposit-level integration share instead of applying maker L1/L2.
|
|
|
45
46
|
|
|
46
47
|
**Platform caveats:**
|
|
47
48
|
|
|
48
|
-
- **Venmo
|
|
49
|
+
- **Venmo and PayPal restrict who can signal intents by default.**
|
|
49
50
|
Signed `cashout()` confirms `createDeposit`, then submits and confirms a
|
|
50
51
|
method-scoped Peer Pay merchant policy for every restricted payout leg using
|
|
51
52
|
the same viem wallet. This is a deliberate non-atomic follow-up with a brief
|
|
@@ -57,7 +58,10 @@ deposit-level integration share instead of applying maker L1/L2.
|
|
|
57
58
|
`prepareAccessPolicy(depositId, paymentMethod)` for every returned method.
|
|
58
59
|
Any viem EOA works; Privy is not required.
|
|
59
60
|
|
|
60
|
-
- **
|
|
61
|
+
- **Cash App is non-chargebackable.** Cash App cash-outs stay public, do not
|
|
62
|
+
attach a Peer Pay merchant policy, and never require dispute-protection stake.
|
|
63
|
+
|
|
64
|
+
- **Wise, PayPal, and Alipay** carry `requiresIdentityAttestation: true`. A new curator
|
|
61
65
|
registration needs a signed maker identity attestation this SDK cannot mint
|
|
62
66
|
(first-party Peer web obtains it through the Peer TEE browser extension).
|
|
63
67
|
An already-registered handle can be reused with bare payee data. A new handle
|
|
@@ -114,7 +118,7 @@ const multiCurrency = await cash.cashout(
|
|
|
114
118
|
);
|
|
115
119
|
|
|
116
120
|
// Widest reach: several platforms on one order (each platform at most once);
|
|
117
|
-
// the buyer picks the leg they can pay
|
|
121
|
+
// the buyer picks the leg they can pay. Read capability pricing per corridor.
|
|
118
122
|
const multiPlatform = await cash.cashout(
|
|
119
123
|
{
|
|
120
124
|
amount: usdc(500),
|
|
@@ -186,9 +190,11 @@ const route = await cash.nearIntentsStatus({
|
|
|
186
190
|
|
|
187
191
|
## Rules that prevent wrong behavior
|
|
188
192
|
|
|
189
|
-
- **
|
|
190
|
-
|
|
191
|
-
|
|
193
|
+
- **Respect the declared binding point.** `estimate()` is
|
|
194
|
+
`kind: 'oracle-estimate'`. Its `binding` is `intent-signal` for existing
|
|
195
|
+
on-chain oracle corridors and `deposit-creation` for Alipay/CNY. Do not call
|
|
196
|
+
an estimate locked before that point. Once Alipay/CNY is prepared, its fresh
|
|
197
|
+
Chainlink snapshot is the on-chain maker floor.
|
|
192
198
|
- **Do not invent an ETA.** Use `estimate().eta`: `{ seconds, label }` backed
|
|
193
199
|
by the same rolling 30-day, intent-attributed pair sample as `fillStats()`,
|
|
194
200
|
measured from deposit creation to first fill. Use `order.explain()` for live
|
|
@@ -271,7 +277,7 @@ Every `CashError` carries `code`, `retryable`, `remediation`. Behavior:
|
|
|
271
277
|
| `INVALID_INTENT_AMOUNT_RANGE` | no | Use a positive min, max at least min, and max no greater than amount |
|
|
272
278
|
| `INVALID_PAYOUT_CURRENCIES` | no | Pass one or more unique currencies listed for the platform |
|
|
273
279
|
| `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
|
|
280
|
+
| `PAYEE_VERIFICATION_REQUIRED` | no | Use Peer web + TEE extension for new Wise/PayPal/Alipay; reuse registered handles |
|
|
275
281
|
| `PAYEE_REGISTRATION_FAILED` | yes | Validate against `payeeHint`, then retry |
|
|
276
282
|
| `ATOMIC_ACCESS_POLICY_REQUIRED` | no | Deprecated compatibility code; current SDK flows never emit it |
|
|
277
283
|
| `ACCESS_POLICY_CONFIGURATION_FAILED` | no | Deposit exists; inspect policy tx first, attach only if needed; never repeat the cash-out. |
|
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# @zkp2p/cash
|
|
2
2
|
|
|
3
3
|
Route Relay-supported EVM assets or NEAR Intents 1Click external deposits into
|
|
4
|
-
Base USDC, then cash out to fiat on Venmo, Revolut, Wise, Zelle, and
|
|
5
|
-
|
|
6
|
-
provider.
|
|
4
|
+
Base USDC, then cash out to fiat on Venmo, Revolut, Wise, Alipay, Zelle, and
|
|
5
|
+
more at a zero-spread Chainlink market rate with no centralized off-ramp
|
|
6
|
+
provider. Existing corridors bind the live oracle when a buyer signals;
|
|
7
|
+
Alipay/CNY fixes a fresh Ethereum Chainlink snapshot when the SDK prepares the
|
|
8
|
+
deposit.
|
|
7
9
|
|
|
8
10
|
Peer Cash is an **offramp-only** SDK for the [ZKP2P](https://peer.xyz)
|
|
9
11
|
protocol. The cashing-out user is the maker: their USDC becomes a deposit in
|
|
@@ -46,7 +48,7 @@ const { depositId, accessPolicyTxHashes } = await cash.cashout(
|
|
|
46
48
|
},
|
|
47
49
|
{ signer }, // any viem WalletClient on Base, including an EOA
|
|
48
50
|
);
|
|
49
|
-
// Venmo
|
|
51
|
+
// Venmo and PayPal return only after their access policy confirms.
|
|
50
52
|
console.log(depositId, accessPolicyTxHashes);
|
|
51
53
|
|
|
52
54
|
// One method can offer several currencies. The buyer chooses the fill
|
|
@@ -64,7 +66,8 @@ const fastFill = await cash.cashout(
|
|
|
64
66
|
);
|
|
65
67
|
|
|
66
68
|
// One order can also offer several platforms (each at most once). The buyer
|
|
67
|
-
// picks the leg they can pay
|
|
69
|
+
// picks the leg they can pay. Inspect capabilities().platforms[].pricing for
|
|
70
|
+
// the exact rate-binding semantics of each corridor.
|
|
68
71
|
const widestReach = await cash.cashout(
|
|
69
72
|
{
|
|
70
73
|
amount: usdc(1000),
|
|
@@ -76,6 +79,15 @@ const widestReach = await cash.cashout(
|
|
|
76
79
|
{ signer },
|
|
77
80
|
);
|
|
78
81
|
|
|
82
|
+
// Alipay/CNY is the explicit creation-time exception. New Alipay payees need
|
|
83
|
+
// the identity attestation prepared by first-party Peer web.
|
|
84
|
+
const alipayEstimate = await cash.estimate({
|
|
85
|
+
amount: usdc(1000),
|
|
86
|
+
platform: 'alipay',
|
|
87
|
+
currency: 'CNY',
|
|
88
|
+
});
|
|
89
|
+
// alipayEstimate.binding === 'deposit-creation'
|
|
90
|
+
|
|
79
91
|
for await (const order of cash.watch(depositId)) {
|
|
80
92
|
console.log(order.state, order.explain());
|
|
81
93
|
if (order.state === 'delivered') break;
|
|
@@ -86,10 +98,10 @@ for await (const order of cash.watch(depositId)) {
|
|
|
86
98
|
|
|
87
99
|
Peer Cash and the general ZKP2P SDK serve different integration depths:
|
|
88
100
|
|
|
89
|
-
| Package | Use it when | Boundary
|
|
90
|
-
| ------------- | ------------------------------------------------- |
|
|
91
|
-
| `@zkp2p/cash` | Cash-out is the product | Offramp only. The user is always the maker, the destination is Base USDC, pricing is
|
|
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.
|
|
101
|
+
| Package | Use it when | Boundary |
|
|
102
|
+
| ------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
103
|
+
| `@zkp2p/cash` | Cash-out is the product | Offramp only. The user is always the maker, the destination is Base USDC, pricing is zero-spread Chainlink (signal-time by default; creation-time for Alipay/CNY), and the SDK owns the resumable order lifecycle. |
|
|
104
|
+
| `@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
105
|
|
|
94
106
|
Peer Cash is a narrow facade over `@zkp2p/sdk`, not a replacement for it. It
|
|
95
107
|
cannot express custom spreads, buyer-side proof flows, vaults, disputes, or
|
|
@@ -107,7 +119,7 @@ arbitrary protocol operations.
|
|
|
107
119
|
| `relayStatus(requestId)` | Relay request status from the Relay SDK request path |
|
|
108
120
|
| `quoteNearIntentsSource(input)` | Signed 1Click quote with an origin-chain deposit address and optional memo |
|
|
109
121
|
| `submitNearIntentsDeposit(input)` / `nearIntentsStatus(input)` | Optionally register an origin tx, then track 1Click delivery/refund evidence |
|
|
110
|
-
| `estimate({ amount, currency }, { includeEta? })`
|
|
122
|
+
| `estimate({ amount, currency, platform? }, { includeEta? })` | Base USDC market-rate estimate with an explicit `binding`; optionally skip historical ETA |
|
|
111
123
|
| `cashout(input, { signer })` | Creates the order with any viem wallet; restricted methods then attach the Peer Pay merchant policy |
|
|
112
124
|
| `prepare(input)` / `finalizePreparedCashout(receipt)` | Prepare external signing, resolve the deposit, then iterate `accessPolicyPaymentMethods` for follow-ups |
|
|
113
125
|
| `prepareAccessPolicy(depositId, paymentMethod)` | Prepare one post-deposit, method-scoped Peer Pay merchant policy transaction |
|
|
@@ -141,8 +153,9 @@ mixed historical deposit.
|
|
|
141
153
|
|
|
142
154
|
| Payout rail | Access-policy behavior | New payee registration |
|
|
143
155
|
| --------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
144
|
-
| Venmo
|
|
156
|
+
| Venmo | Peer Pay merchant policy attaches for that payment method | Curator validates the live handle |
|
|
145
157
|
| PayPal | Same method-scoped Peer Pay follow-up | Requires a Peer TEE browser-extension identity attestation |
|
|
158
|
+
| Cash App | No access-policy follow-up; non-chargebackable and no stake required | Curator validates the live handle |
|
|
146
159
|
| Wise | No access-policy follow-up | Requires a Peer TEE browser-extension identity attestation |
|
|
147
160
|
| 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 |
|
|
148
161
|
|
|
@@ -152,7 +165,7 @@ EOA; no Privy wallet or signer API is required. The deprecated
|
|
|
152
165
|
`requiresAtomicAccessPolicy` capability remains for wire compatibility and is
|
|
153
166
|
always `false`.
|
|
154
167
|
|
|
155
|
-
Venmo
|
|
168
|
+
Venmo and PayPal cash-outs restrict intent signaling to the Peer Pay
|
|
156
169
|
merchant group by default. Each restricted payout method gets its own policy.
|
|
157
170
|
Signed `cashout()` creates the deposit first, then uses the same wallet to
|
|
158
171
|
submit and confirm every required policy transaction; this intentionally
|
|
@@ -307,7 +320,7 @@ they are available. A source-routed result includes both a flat
|
|
|
307
320
|
returned no hash. Treat it as potentially broadcast. Inspect recent Base
|
|
308
321
|
wallet activity and the supplied recovery action before any retry.
|
|
309
322
|
- `ACCESS_POLICY_CONFIGURATION_FAILED`: the deposit exists, but its required
|
|
310
|
-
Venmo
|
|
323
|
+
Venmo or PayPal policy was not confirmed. Do not cash out again;
|
|
311
324
|
inspect `recovery.transactionHash` when present, then retry
|
|
312
325
|
`prepareAccessPolicy(error.recovery.depositId, error.recovery.paymentMethod)`
|
|
313
326
|
only if the prior policy
|
|
@@ -333,11 +346,15 @@ awaiting-buyer ──────────► matched ───────
|
|
|
333
346
|
returned ◄─────────────────┘
|
|
334
347
|
```
|
|
335
348
|
|
|
336
|
-
- **You are the maker.**
|
|
337
|
-
|
|
338
|
-
- **
|
|
339
|
-
|
|
340
|
-
|
|
349
|
+
- **You are the maker.** Pricing is zero-spread. Existing corridors resolve
|
|
350
|
+
from the on-chain Chainlink oracle when a buyer signals an intent.
|
|
351
|
+
- **Alipay/CNY binds earlier.** Base has no CNY oracle adapter, so the SDK reads
|
|
352
|
+
Chainlink CNY/USD on Ethereum, rejects stale or invalid data, and fixes the
|
|
353
|
+
resulting CNY-per-USDC maker floor when it prepares the deposit. A buyer may
|
|
354
|
+
signal at that floor or a better rate for the maker.
|
|
355
|
+
- **Read `binding`.** `estimate().binding` is `intent-signal` by default and
|
|
356
|
+
`deposit-creation` for Alipay/CNY. An estimate remains approximate until its
|
|
357
|
+
stated binding point.
|
|
341
358
|
- **ETA is historical.** `estimate().eta` is just `{ seconds, label }`, backed
|
|
342
359
|
by the same rolling 30-day, intent-attributed pair sampler as `fillStats()`,
|
|
343
360
|
measured from deposit creation to the first fulfilled fill through the pair.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/engine/constants.ts
|
|
2
2
|
var BASE_CHAIN_ID = 8453;
|
|
3
3
|
var BASE_USDC_ADDRESS = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";
|
|
4
|
-
var CASH_RESTRICTED_PLATFORMS = /* @__PURE__ */ new Set(["venmo", "
|
|
4
|
+
var CASH_RESTRICTED_PLATFORMS = /* @__PURE__ */ new Set(["venmo", "paypal"]);
|
|
5
5
|
var CASH_ACCESS_GROUP_IDS = {
|
|
6
6
|
production: ["0x174b8a29536721a3eae290bfd55651b85a53fc334b971d993fa93ed8dde15e48"],
|
|
7
7
|
preproduction: ["0x174b8a29536721a3eae290bfd55651b85a53fc334b971d993fa93ed8dde15e48"],
|
|
@@ -50,16 +50,16 @@ function isCashError(value) {
|
|
|
50
50
|
var errors = {
|
|
51
51
|
oracleUnsupportedCurrency: (currency) => new CashError({
|
|
52
52
|
code: "ORACLE_UNSUPPORTED_CURRENCY",
|
|
53
|
-
message: `${currency}
|
|
53
|
+
message: `${currency} is not available in this Peer Cash payout corridor.`,
|
|
54
54
|
retryable: false,
|
|
55
|
-
remediation: `Pick a currency listed in capabilities()
|
|
55
|
+
remediation: `Pick a platform and currency listed together in capabilities().`
|
|
56
56
|
}),
|
|
57
57
|
oracleReadFailed: (currency, cause) => new CashError(
|
|
58
58
|
{
|
|
59
59
|
code: "ORACLE_READ_FAILED",
|
|
60
60
|
message: `The ${currency} market-rate oracle could not be read.`,
|
|
61
61
|
retryable: true,
|
|
62
|
-
remediation: `Retry
|
|
62
|
+
remediation: `Retry shortly or configure a healthy RPC for this corridor. Do not present a cached value as a fresh market rate.`
|
|
63
63
|
},
|
|
64
64
|
{ cause }
|
|
65
65
|
),
|
|
@@ -80,9 +80,9 @@ interface CashFill {
|
|
|
80
80
|
/** Unix seconds - when the intent expired and was pruned (returned). */
|
|
81
81
|
prunedAt?: number;
|
|
82
82
|
}
|
|
83
|
-
/** Pricing state of one payout tuple
|
|
83
|
+
/** Pricing state of one payout tuple, reconstructed from indexed data. */
|
|
84
84
|
interface CashPayoutPricing {
|
|
85
|
-
/** Depositor-configured spread
|
|
85
|
+
/** Depositor-configured oracle spread in basis points (0 on oracle Cash corridors). */
|
|
86
86
|
spreadBps?: number;
|
|
87
87
|
/** Oracle kind, e.g. `'oracle_chainlink'`. */
|
|
88
88
|
kind?: string;
|
|
@@ -92,8 +92,12 @@ interface CashPayoutPricing {
|
|
|
92
92
|
oracleRate?: number;
|
|
93
93
|
/** Unix seconds of the last accepted oracle snapshot. */
|
|
94
94
|
lastOracleUpdatedAt?: number;
|
|
95
|
-
/** True when the tuple is priced by an oracle at zero spread
|
|
95
|
+
/** True when the tuple is priced by an oracle at zero spread. */
|
|
96
96
|
marketRate: boolean;
|
|
97
|
+
/** True when the maker floor was fixed from a fresh rate snapshot at deposit creation. */
|
|
98
|
+
fixedAtCreation?: boolean;
|
|
99
|
+
/** Fixed maker floor in fiat units per USDC. */
|
|
100
|
+
fixedRate?: number;
|
|
97
101
|
}
|
|
98
102
|
/** One payout leg reconstructed from the chain - platform, currency, payee hash, pricing. */
|
|
99
103
|
interface CashPayoutInfo {
|
|
@@ -298,7 +302,7 @@ interface RelayStatus {
|
|
|
298
302
|
*
|
|
299
303
|
* Peer Cash is an async crypto→fiat offramp built on the maker/deposit side of
|
|
300
304
|
* the protocol: the cashing-out user IS the maker. They create a deposit at the
|
|
301
|
-
*
|
|
305
|
+
* zero-spread market rate; a buyer (a standard taker) signals an
|
|
302
306
|
* intent, pays fiat, and proves it via the standard TEE-TLS flow, releasing the
|
|
303
307
|
* user's crypto. The protocol is reused in its existing direction - no proof
|
|
304
308
|
* inversion, no sell-side quote.
|
|
@@ -311,9 +315,8 @@ declare const BASE_USDC_ADDRESS: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";
|
|
|
311
315
|
/** USDC has 6 decimals. */
|
|
312
316
|
declare const USDC_DECIMALS = 6;
|
|
313
317
|
/**
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* deal on the book, so buyers have reason to take it quickly).
|
|
318
|
+
* Signal-time oracle corridors use zero spread. Alipay/CNY instead fixes a
|
|
319
|
+
* fresh creation-time snapshot because Base has no CNY oracle adapter.
|
|
317
320
|
*/
|
|
318
321
|
declare const MARKET_SPREAD_BPS = 0;
|
|
319
322
|
/**
|
|
@@ -469,11 +472,21 @@ declare function readNearIntentsStatus(input: NearIntentsStatusInput, options?:
|
|
|
469
472
|
declare const MIN_CASHOUT_AMOUNT = 10000n;
|
|
470
473
|
/** Recommended floor: sub-1-USDC deposits force min==max fills and starve matching. */
|
|
471
474
|
declare const RECOMMENDED_MIN_CASHOUT_AMOUNT = 1000000n;
|
|
475
|
+
type CashCorridorPricing = {
|
|
476
|
+
kind: 'oracle-at-intent-signal';
|
|
477
|
+
spreadBps: 0;
|
|
478
|
+
} | {
|
|
479
|
+
kind: 'fixed-at-deposit-creation';
|
|
480
|
+
source: 'chainlink-ethereum';
|
|
481
|
+
spreadBps: 0;
|
|
482
|
+
};
|
|
472
483
|
interface CashPlatformCapability {
|
|
473
484
|
/** Platform id, e.g. `'venmo'` - the value `receive.platform` accepts. */
|
|
474
485
|
platform: string;
|
|
475
|
-
/**
|
|
486
|
+
/** Supported currencies this platform can pay out. */
|
|
476
487
|
currencies: CurrencyType[];
|
|
488
|
+
/** Pricing semantics for each advertised currency. */
|
|
489
|
+
pricing: Partial<Record<CurrencyType, CashCorridorPricing>>;
|
|
477
490
|
/** Human hint for the payee handle format. */
|
|
478
491
|
payeeHint: string;
|
|
479
492
|
/**
|
|
@@ -525,9 +538,9 @@ interface CashCapabilities {
|
|
|
525
538
|
relay?: CashSourceCapabilities;
|
|
526
539
|
nearIntents?: NearIntentsSourceCapabilities;
|
|
527
540
|
};
|
|
528
|
-
/** Every payout corridor
|
|
541
|
+
/** Every payout corridor supported by the Cash product. */
|
|
529
542
|
platforms: CashPlatformCapability[];
|
|
530
|
-
/** All
|
|
543
|
+
/** All supported currencies across platforms. */
|
|
531
544
|
currencies: CurrencyType[];
|
|
532
545
|
/** Amount bounds in USDC base units. */
|
|
533
546
|
amount: {
|
|
@@ -535,7 +548,7 @@ interface CashCapabilities {
|
|
|
535
548
|
recommendedMin: bigint;
|
|
536
549
|
max: null;
|
|
537
550
|
};
|
|
538
|
-
/**
|
|
551
|
+
/** Default pricing for corridors without a platform-level creation-time exception. */
|
|
539
552
|
pricing: {
|
|
540
553
|
kind: 'oracle-market-rate';
|
|
541
554
|
spreadBps: 0;
|
|
@@ -563,11 +576,11 @@ interface CashFillEta {
|
|
|
563
576
|
|
|
564
577
|
/**
|
|
565
578
|
* Estimate - currency + amount only. No payee, no side effects, no expiry,
|
|
566
|
-
* idempotent, cacheable.
|
|
579
|
+
* idempotent, cacheable.
|
|
567
580
|
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
581
|
+
* Existing corridors read the same Chainlink feed the protocol uses when an
|
|
582
|
+
* intent is signaled. Alipay/CNY reads Chainlink's Ethereum feed and the SDK
|
|
583
|
+
* fixes that fresh snapshot as the maker floor when it prepares the deposit.
|
|
571
584
|
*/
|
|
572
585
|
|
|
573
586
|
interface EstimateInput {
|
|
@@ -578,7 +591,7 @@ interface EstimateInput {
|
|
|
578
591
|
amount: bigint;
|
|
579
592
|
/** Target fiat currency. */
|
|
580
593
|
currency: CurrencyType;
|
|
581
|
-
/** Optional payout platform for
|
|
594
|
+
/** Optional payout platform for pricing semantics and pair-specific ETA sampling. */
|
|
582
595
|
platform?: string;
|
|
583
596
|
/** Optional Relay EVM source asset. Omit for the current Base USDC default path. */
|
|
584
597
|
source?: RelaySourceInput & {
|
|
@@ -598,8 +611,10 @@ interface EstimateOptions {
|
|
|
598
611
|
includeEta?: boolean;
|
|
599
612
|
}
|
|
600
613
|
interface CashEstimate {
|
|
601
|
-
/** Always `'oracle-estimate'
|
|
614
|
+
/** Always `'oracle-estimate'`; inspect `binding` for when it becomes a maker floor. */
|
|
602
615
|
kind: 'oracle-estimate';
|
|
616
|
+
/** When this estimate becomes the deposit's binding maker floor. */
|
|
617
|
+
binding?: 'intent-signal' | 'deposit-creation';
|
|
603
618
|
currency: CurrencyType;
|
|
604
619
|
/** Base USDC amount that Peer Cash would deposit after any source routing. */
|
|
605
620
|
amount: bigint;
|
|
@@ -659,10 +674,16 @@ interface CashClientOptions {
|
|
|
659
674
|
rpcUrl?: string;
|
|
660
675
|
/** Indexer URL override. */
|
|
661
676
|
indexerUrl?: string;
|
|
677
|
+
/** Optional indexer API key. */
|
|
678
|
+
indexerApiKey?: string;
|
|
662
679
|
/** Curator (ZKP2P API) URL override. */
|
|
663
680
|
curatorUrl?: string;
|
|
664
681
|
/** Optional ZKP2P API key. */
|
|
665
682
|
apiKey?: string;
|
|
683
|
+
/** Ethereum transport used only to snapshot Alipay/CNY's creation-time rate. */
|
|
684
|
+
creationRateTransport?: Transport;
|
|
685
|
+
/** Convenience alternative to `creationRateTransport`. */
|
|
686
|
+
creationRateRpcUrl?: string;
|
|
666
687
|
/** Relay API configuration for source assets outside Base USDC. */
|
|
667
688
|
relay?: RelayOptions;
|
|
668
689
|
/** NEAR Intents 1Click configuration for externally funded source routes. */
|
|
@@ -717,7 +738,8 @@ interface CashoutInput {
|
|
|
717
738
|
/**
|
|
718
739
|
* Where the fiat should arrive. One leg, or an array of legs to offer the
|
|
719
740
|
* buyer several payout platforms (each platform at most once). One method
|
|
720
|
-
* may offer multiple currencies
|
|
741
|
+
* may offer multiple currencies. Inspect `capabilities().platforms[].pricing`
|
|
742
|
+
* for whether a corridor binds at intent signal or deposit preparation.
|
|
721
743
|
*/
|
|
722
744
|
receive: CashReceiveLeg | readonly [CashReceiveLeg, ...CashReceiveLeg[]];
|
|
723
745
|
/** Per-order min/max override (USDC base units). */
|
|
@@ -915,4 +937,4 @@ interface CashClient {
|
|
|
915
937
|
}
|
|
916
938
|
declare function createCashClient(options: CashClientOptions): CashClient;
|
|
917
939
|
|
|
918
|
-
export {
|
|
940
|
+
export { type EstimateOptions as $, type CashClient as A, BASE_CHAIN_ID as B, type CashPayoutInfo as C, type CashClientOptions as D, type CashCorridorPricing as E, type CashFillEta as F, type CashLeg as G, type CashMultiCurrencyLeg as H, type IntentEntity as I, type CashNextAction as J, type CashOrderState as K, type CashPairFillStats as L, type CashPayeeInput as M, type NearIntentsSourceCapabilities as N, type CashPayout as O, type PrepareResult as P, type CashPayoutPricing as Q, type RelayExecutionResult as R, type CashPlatformCapability as S, type TopUpResult as T, type CashPreparedStepKind as U, type CashReceiveLeg as V, type WithdrawResult as W, type CashoutInput as X, type CashoutOptions as Y, type CuratorPayeeDataInput as Z, type EstimateInput as _, type CashBuyerProfile as a, MARKET_SPREAD_BPS as a0, MIN_CASHOUT_AMOUNT as a1, NEAR_INTENTS_API_URL as a2, NEAR_INTENTS_BASE_USDC_ASSET_ID as a3, NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS as a4, NEAR_INTENTS_STATUSES as a5, type NearIntentsClient as a6, type NearIntentsOptions as a7, type NearIntentsQuoteRequest as a8, type NearIntentsStatusCode as a9, type NearIntentsToken as aa, type NearIntentsTradeType as ab, type NearIntentsTransaction as ac, ORACLE_MIN_CONVERSION_RATE_SENTINEL as ad, type OrdersOptions as ae, type PreparedCashoutReceipt as af, RECOMMENDED_MIN_CASHOUT_AMOUNT as ag, type RelayOptions as ah, type RelayQuoteInput as ai, type RelaySourceInput as aj, type RelayTransaction as ak, type SignerOptions as al, USDC_DECIMALS as am, type WatchOptions as an, type WithdrawOptions as ao, buildCapabilities as ap, createCashClient as aq, createNearIntentsClient as ar, normalizeCashPayee as as, quoteNearIntentsToBaseUsdc as at, readNearIntentsSourceCapabilities as au, readNearIntentsStatus as av, submitNearIntentsDeposit as aw, toCashReferralAttributionCode as ax, type CashDepositInput as b, type CreateDepositParamsArg as c, type CashOrder as d, type CashFill as e, type CashCapabilities as f, type CashoutResult as g, type CashEstimate as h, type CashFillStats as i, type NearIntentsDepositInput as j, type NearIntentsQuote as k, type NearIntentsQuoteInput as l, type NearIntentsStatus as m, type NearIntentsStatusInput as n, type CashPreparedStep as o, type RelayQuote as p, type RelayStatus as q, type CashSourceCapabilities as r, BASE_USDC_ADDRESS as s, CASH_ATTRIBUTION_CODE as t, CASH_ORDER_POLL_INTERVAL_MS as u, CASH_ORDER_STATUSES as v, CASH_REFERRAL_ATTRIBUTION_PREFIX as w, CASH_RETAIN_ON_EMPTY as x, type CashAsset as y, type CashChain as z };
|
|
@@ -80,9 +80,9 @@ interface CashFill {
|
|
|
80
80
|
/** Unix seconds - when the intent expired and was pruned (returned). */
|
|
81
81
|
prunedAt?: number;
|
|
82
82
|
}
|
|
83
|
-
/** Pricing state of one payout tuple
|
|
83
|
+
/** Pricing state of one payout tuple, reconstructed from indexed data. */
|
|
84
84
|
interface CashPayoutPricing {
|
|
85
|
-
/** Depositor-configured spread
|
|
85
|
+
/** Depositor-configured oracle spread in basis points (0 on oracle Cash corridors). */
|
|
86
86
|
spreadBps?: number;
|
|
87
87
|
/** Oracle kind, e.g. `'oracle_chainlink'`. */
|
|
88
88
|
kind?: string;
|
|
@@ -92,8 +92,12 @@ interface CashPayoutPricing {
|
|
|
92
92
|
oracleRate?: number;
|
|
93
93
|
/** Unix seconds of the last accepted oracle snapshot. */
|
|
94
94
|
lastOracleUpdatedAt?: number;
|
|
95
|
-
/** True when the tuple is priced by an oracle at zero spread
|
|
95
|
+
/** True when the tuple is priced by an oracle at zero spread. */
|
|
96
96
|
marketRate: boolean;
|
|
97
|
+
/** True when the maker floor was fixed from a fresh rate snapshot at deposit creation. */
|
|
98
|
+
fixedAtCreation?: boolean;
|
|
99
|
+
/** Fixed maker floor in fiat units per USDC. */
|
|
100
|
+
fixedRate?: number;
|
|
97
101
|
}
|
|
98
102
|
/** One payout leg reconstructed from the chain - platform, currency, payee hash, pricing. */
|
|
99
103
|
interface CashPayoutInfo {
|
|
@@ -298,7 +302,7 @@ interface RelayStatus {
|
|
|
298
302
|
*
|
|
299
303
|
* Peer Cash is an async crypto→fiat offramp built on the maker/deposit side of
|
|
300
304
|
* the protocol: the cashing-out user IS the maker. They create a deposit at the
|
|
301
|
-
*
|
|
305
|
+
* zero-spread market rate; a buyer (a standard taker) signals an
|
|
302
306
|
* intent, pays fiat, and proves it via the standard TEE-TLS flow, releasing the
|
|
303
307
|
* user's crypto. The protocol is reused in its existing direction - no proof
|
|
304
308
|
* inversion, no sell-side quote.
|
|
@@ -311,9 +315,8 @@ declare const BASE_USDC_ADDRESS: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";
|
|
|
311
315
|
/** USDC has 6 decimals. */
|
|
312
316
|
declare const USDC_DECIMALS = 6;
|
|
313
317
|
/**
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* deal on the book, so buyers have reason to take it quickly).
|
|
318
|
+
* Signal-time oracle corridors use zero spread. Alipay/CNY instead fixes a
|
|
319
|
+
* fresh creation-time snapshot because Base has no CNY oracle adapter.
|
|
317
320
|
*/
|
|
318
321
|
declare const MARKET_SPREAD_BPS = 0;
|
|
319
322
|
/**
|
|
@@ -469,11 +472,21 @@ declare function readNearIntentsStatus(input: NearIntentsStatusInput, options?:
|
|
|
469
472
|
declare const MIN_CASHOUT_AMOUNT = 10000n;
|
|
470
473
|
/** Recommended floor: sub-1-USDC deposits force min==max fills and starve matching. */
|
|
471
474
|
declare const RECOMMENDED_MIN_CASHOUT_AMOUNT = 1000000n;
|
|
475
|
+
type CashCorridorPricing = {
|
|
476
|
+
kind: 'oracle-at-intent-signal';
|
|
477
|
+
spreadBps: 0;
|
|
478
|
+
} | {
|
|
479
|
+
kind: 'fixed-at-deposit-creation';
|
|
480
|
+
source: 'chainlink-ethereum';
|
|
481
|
+
spreadBps: 0;
|
|
482
|
+
};
|
|
472
483
|
interface CashPlatformCapability {
|
|
473
484
|
/** Platform id, e.g. `'venmo'` - the value `receive.platform` accepts. */
|
|
474
485
|
platform: string;
|
|
475
|
-
/**
|
|
486
|
+
/** Supported currencies this platform can pay out. */
|
|
476
487
|
currencies: CurrencyType[];
|
|
488
|
+
/** Pricing semantics for each advertised currency. */
|
|
489
|
+
pricing: Partial<Record<CurrencyType, CashCorridorPricing>>;
|
|
477
490
|
/** Human hint for the payee handle format. */
|
|
478
491
|
payeeHint: string;
|
|
479
492
|
/**
|
|
@@ -525,9 +538,9 @@ interface CashCapabilities {
|
|
|
525
538
|
relay?: CashSourceCapabilities;
|
|
526
539
|
nearIntents?: NearIntentsSourceCapabilities;
|
|
527
540
|
};
|
|
528
|
-
/** Every payout corridor
|
|
541
|
+
/** Every payout corridor supported by the Cash product. */
|
|
529
542
|
platforms: CashPlatformCapability[];
|
|
530
|
-
/** All
|
|
543
|
+
/** All supported currencies across platforms. */
|
|
531
544
|
currencies: CurrencyType[];
|
|
532
545
|
/** Amount bounds in USDC base units. */
|
|
533
546
|
amount: {
|
|
@@ -535,7 +548,7 @@ interface CashCapabilities {
|
|
|
535
548
|
recommendedMin: bigint;
|
|
536
549
|
max: null;
|
|
537
550
|
};
|
|
538
|
-
/**
|
|
551
|
+
/** Default pricing for corridors without a platform-level creation-time exception. */
|
|
539
552
|
pricing: {
|
|
540
553
|
kind: 'oracle-market-rate';
|
|
541
554
|
spreadBps: 0;
|
|
@@ -563,11 +576,11 @@ interface CashFillEta {
|
|
|
563
576
|
|
|
564
577
|
/**
|
|
565
578
|
* Estimate - currency + amount only. No payee, no side effects, no expiry,
|
|
566
|
-
* idempotent, cacheable.
|
|
579
|
+
* idempotent, cacheable.
|
|
567
580
|
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
581
|
+
* Existing corridors read the same Chainlink feed the protocol uses when an
|
|
582
|
+
* intent is signaled. Alipay/CNY reads Chainlink's Ethereum feed and the SDK
|
|
583
|
+
* fixes that fresh snapshot as the maker floor when it prepares the deposit.
|
|
571
584
|
*/
|
|
572
585
|
|
|
573
586
|
interface EstimateInput {
|
|
@@ -578,7 +591,7 @@ interface EstimateInput {
|
|
|
578
591
|
amount: bigint;
|
|
579
592
|
/** Target fiat currency. */
|
|
580
593
|
currency: CurrencyType;
|
|
581
|
-
/** Optional payout platform for
|
|
594
|
+
/** Optional payout platform for pricing semantics and pair-specific ETA sampling. */
|
|
582
595
|
platform?: string;
|
|
583
596
|
/** Optional Relay EVM source asset. Omit for the current Base USDC default path. */
|
|
584
597
|
source?: RelaySourceInput & {
|
|
@@ -598,8 +611,10 @@ interface EstimateOptions {
|
|
|
598
611
|
includeEta?: boolean;
|
|
599
612
|
}
|
|
600
613
|
interface CashEstimate {
|
|
601
|
-
/** Always `'oracle-estimate'
|
|
614
|
+
/** Always `'oracle-estimate'`; inspect `binding` for when it becomes a maker floor. */
|
|
602
615
|
kind: 'oracle-estimate';
|
|
616
|
+
/** When this estimate becomes the deposit's binding maker floor. */
|
|
617
|
+
binding?: 'intent-signal' | 'deposit-creation';
|
|
603
618
|
currency: CurrencyType;
|
|
604
619
|
/** Base USDC amount that Peer Cash would deposit after any source routing. */
|
|
605
620
|
amount: bigint;
|
|
@@ -659,10 +674,16 @@ interface CashClientOptions {
|
|
|
659
674
|
rpcUrl?: string;
|
|
660
675
|
/** Indexer URL override. */
|
|
661
676
|
indexerUrl?: string;
|
|
677
|
+
/** Optional indexer API key. */
|
|
678
|
+
indexerApiKey?: string;
|
|
662
679
|
/** Curator (ZKP2P API) URL override. */
|
|
663
680
|
curatorUrl?: string;
|
|
664
681
|
/** Optional ZKP2P API key. */
|
|
665
682
|
apiKey?: string;
|
|
683
|
+
/** Ethereum transport used only to snapshot Alipay/CNY's creation-time rate. */
|
|
684
|
+
creationRateTransport?: Transport;
|
|
685
|
+
/** Convenience alternative to `creationRateTransport`. */
|
|
686
|
+
creationRateRpcUrl?: string;
|
|
666
687
|
/** Relay API configuration for source assets outside Base USDC. */
|
|
667
688
|
relay?: RelayOptions;
|
|
668
689
|
/** NEAR Intents 1Click configuration for externally funded source routes. */
|
|
@@ -717,7 +738,8 @@ interface CashoutInput {
|
|
|
717
738
|
/**
|
|
718
739
|
* Where the fiat should arrive. One leg, or an array of legs to offer the
|
|
719
740
|
* buyer several payout platforms (each platform at most once). One method
|
|
720
|
-
* may offer multiple currencies
|
|
741
|
+
* may offer multiple currencies. Inspect `capabilities().platforms[].pricing`
|
|
742
|
+
* for whether a corridor binds at intent signal or deposit preparation.
|
|
721
743
|
*/
|
|
722
744
|
receive: CashReceiveLeg | readonly [CashReceiveLeg, ...CashReceiveLeg[]];
|
|
723
745
|
/** Per-order min/max override (USDC base units). */
|
|
@@ -915,4 +937,4 @@ interface CashClient {
|
|
|
915
937
|
}
|
|
916
938
|
declare function createCashClient(options: CashClientOptions): CashClient;
|
|
917
939
|
|
|
918
|
-
export {
|
|
940
|
+
export { type EstimateOptions as $, type CashClient as A, BASE_CHAIN_ID as B, type CashPayoutInfo as C, type CashClientOptions as D, type CashCorridorPricing as E, type CashFillEta as F, type CashLeg as G, type CashMultiCurrencyLeg as H, type IntentEntity as I, type CashNextAction as J, type CashOrderState as K, type CashPairFillStats as L, type CashPayeeInput as M, type NearIntentsSourceCapabilities as N, type CashPayout as O, type PrepareResult as P, type CashPayoutPricing as Q, type RelayExecutionResult as R, type CashPlatformCapability as S, type TopUpResult as T, type CashPreparedStepKind as U, type CashReceiveLeg as V, type WithdrawResult as W, type CashoutInput as X, type CashoutOptions as Y, type CuratorPayeeDataInput as Z, type EstimateInput as _, type CashBuyerProfile as a, MARKET_SPREAD_BPS as a0, MIN_CASHOUT_AMOUNT as a1, NEAR_INTENTS_API_URL as a2, NEAR_INTENTS_BASE_USDC_ASSET_ID as a3, NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS as a4, NEAR_INTENTS_STATUSES as a5, type NearIntentsClient as a6, type NearIntentsOptions as a7, type NearIntentsQuoteRequest as a8, type NearIntentsStatusCode as a9, type NearIntentsToken as aa, type NearIntentsTradeType as ab, type NearIntentsTransaction as ac, ORACLE_MIN_CONVERSION_RATE_SENTINEL as ad, type OrdersOptions as ae, type PreparedCashoutReceipt as af, RECOMMENDED_MIN_CASHOUT_AMOUNT as ag, type RelayOptions as ah, type RelayQuoteInput as ai, type RelaySourceInput as aj, type RelayTransaction as ak, type SignerOptions as al, USDC_DECIMALS as am, type WatchOptions as an, type WithdrawOptions as ao, buildCapabilities as ap, createCashClient as aq, createNearIntentsClient as ar, normalizeCashPayee as as, quoteNearIntentsToBaseUsdc as at, readNearIntentsSourceCapabilities as au, readNearIntentsStatus as av, submitNearIntentsDeposit as aw, toCashReferralAttributionCode as ax, type CashDepositInput as b, type CreateDepositParamsArg as c, type CashOrder as d, type CashFill as e, type CashCapabilities as f, type CashoutResult as g, type CashEstimate as h, type CashFillStats as i, type NearIntentsDepositInput as j, type NearIntentsQuote as k, type NearIntentsQuoteInput as l, type NearIntentsStatus as m, type NearIntentsStatusInput as n, type CashPreparedStep as o, type RelayQuote as p, type RelayStatus as q, type CashSourceCapabilities as r, BASE_USDC_ADDRESS as s, CASH_ATTRIBUTION_CODE as t, CASH_ORDER_POLL_INTERVAL_MS as u, CASH_ORDER_STATUSES as v, CASH_REFERRAL_ATTRIBUTION_PREFIX as w, CASH_RETAIN_ON_EMPTY as x, type CashAsset as y, type CashChain as z };
|