@zkp2p/cash 0.4.10 → 0.4.11-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -4,9 +4,10 @@
4
4
  > contribute to the SDK itself (layout, ground rules, CI, releasing), start at
5
5
  > [CLAUDE.md](https://github.com/zkp2p/peer-cash/blob/main/CLAUDE.md).
6
6
 
7
- You are integrating Peer Cash: an offramp that routes any Relay-supported EVM
8
- source asset into Base USDC, then converts Base USDC to fiat (Venmo, Revolut,
9
- Wise, Zelle, ...) at the live Chainlink market rate. The user whose USDC you
7
+ You are integrating Peer Cash: an offramp that routes Relay-supported EVM
8
+ assets or NEAR Intents 1Click external deposits into Base USDC, then converts
9
+ Base USDC to fiat (Venmo, Revolut, Wise, Zelle, ...) at the live Chainlink
10
+ market rate. The user whose USDC you
10
11
  manage is the **maker**; a buyer pays them fiat and proves it with TEE-TLS; the
11
12
  protocol releases the USDC. Funds are held by the protocol, and only the maker
12
13
  can withdraw an unmatched deposit.
@@ -30,7 +31,10 @@ can withdraw an unmatched deposit.
30
31
  mutating tools return unsigned transactions. `cash_source_quote` is a quote,
31
32
  not an execution tool; the host must execute and confirm Relay through its
32
33
  signer/runtime, use `cash_source_status` to monitor it, then call the
33
- Base-USDC `cash_cashout` tool. Never pass `source` into `prepare()`.
34
+ Base-USDC `cash_cashout` tool. For NEAR Intents, persist
35
+ `cash_near_intents_quote`, fund its deposit address externally exactly once,
36
+ and poll `cash_near_intents_status` to `SUCCESS` before the Base cash-out.
37
+ Never pass `source` into `prepare()`.
34
38
 
35
39
  Every transaction (including approves) carries ERC-8021 attribution:
36
40
  `peer-cash`, then optional `peer-ref-XXXXXX` from the six-character
@@ -70,6 +74,8 @@ const cash = createCashClient({ environment: 'production' });
70
74
  const caps = cash.capabilities();
71
75
  // Optional: live Relay EVM source chains/tokens.
72
76
  const relayCaps = await cash.capabilities({ includeRelaySources: true });
77
+ // Optional: live NEAR Intents 1Click external-deposit assets.
78
+ const nearCaps = await cash.capabilities({ includeNearIntentsSources: true });
73
79
 
74
80
  // 2. Estimate - idempotent, cacheable, no side effects. Includes rolling ETA.
75
81
  const est = await cash.estimate({ amount: usdc(500), currency: 'EUR' });
@@ -148,6 +154,32 @@ console.log(routed.source?.amount);
148
154
  console.log(routed.source?.transactions?.origin, routed.source?.transactions?.destination);
149
155
  ```
150
156
 
157
+ External-deposit source route (NEAR Intents / Zcash example):
158
+
159
+ ```ts
160
+ const quote = await cash.quoteNearIntentsSource({
161
+ sourceAsset: 'nep141:zec.omft.near',
162
+ amount: usdc(1), // EXACT_OUTPUT is denominated in Base USDC units
163
+ recipient: signer.account.address,
164
+ refundTo: transparentZcashAddress,
165
+ tradeType: 'EXACT_OUTPUT',
166
+ deadline: new Date(Date.now() + 3 * 60_000).toISOString(),
167
+ });
168
+ persist(quote); // do this before the origin send
169
+ const txHash = await zcashWallet.send(quote.depositAddress!, quote.inputAmount);
170
+ await cash.submitNearIntentsDeposit({
171
+ depositAddress: quote.depositAddress!,
172
+ ...(quote.depositMemo ? { depositMemo: quote.depositMemo } : {}),
173
+ txHash,
174
+ });
175
+ const route = await cash.nearIntentsStatus({
176
+ depositAddress: quote.depositAddress!,
177
+ ...(quote.depositMemo ? { depositMemo: quote.depositMemo } : {}),
178
+ expectedQuote: quote,
179
+ });
180
+ // Reconcile the Base receipt/output when route.status === 'SUCCESS', then cash out Base-only.
181
+ ```
182
+
151
183
  ## Rules that prevent wrong behavior
152
184
 
153
185
  - **Never promise a rate.** `estimate()` is `kind: 'oracle-estimate'`; the
@@ -165,6 +197,15 @@ console.log(routed.source?.transactions?.origin, routed.source?.transactions?.de
165
197
  `sourceSigner`. Use `EXACT_INPUT` in high-level cash-out flows so `amount`
166
198
  remains source-token base units. `source.amount` is Relay's guaranteed
167
199
  minimum output and the exact Base USDC deposit amount.
200
+ - **Treat NEAR Intents as an external-deposit route.** Discover asset ids with
201
+ `capabilities({ includeNearIntentsSources: true })`. Persist the signed quote,
202
+ deposit address, optional memo, and deadline before sending. Browser code
203
+ uses a same-origin proxy so the 1Click JWT remains server-side. Never reuse
204
+ an expired route or resend after an uncertain wallet submission.
205
+ - **A failed NEAR deposit notification is not a failed send.** Retry only
206
+ `submitNearIntentsDeposit()` with the same address and hash; 1Click also
207
+ detects source deposits on-chain. Wait for `nearIntentsStatus()` `SUCCESS`
208
+ and reconcile its destination evidence before a Base-only cash-out.
168
209
  - **Use a nonce-managed source signer for routed cashouts.** Relay routes
169
210
  with more than one source-chain transaction (approve, then route) are
170
211
  refused preflight with `SOURCE_NONCE_MANAGER_REQUIRED` on plain local
@@ -236,6 +277,7 @@ Every `CashError` carries `code`, `retryable`, `remediation`. Behavior:
236
277
  | `SOURCE_QUOTE_FAILED` | yes | Refresh capabilities and request a new canonical Base-USDC quote |
237
278
  | `SOURCE_NONCE_MANAGER_REQUIRED` | no | Preflight; recreate the source signer with viem's `nonceManager`, then quote again |
238
279
  | `SOURCE_EXECUTION_FAILED` | no | Inspect source transactions and Relay status before any retry |
280
+ | `SOURCE_DEPOSIT_SUBMISSION_FAILED` | yes | Retry only the 1Click notification; never resend source funds |
239
281
  | `SOURCE_STATUS_FAILED` | yes | Retry only the status read |
240
282
  | `SOURCE_ROUTE_COMPLETED_CASHOUT_FAILED` | no | Do not route again; retry Base-only with `recovery.amount` |
241
283
  | `SOURCE_CASHOUT_SUBMISSION_UNKNOWN` | no | Inspect Base activity and orders; prove no deposit exists before retrying |
package/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # @zkp2p/cash
2
2
 
3
- Route any Relay-supported EVM source asset into Base USDC, then cash out to
4
- fiat on Venmo, Revolut, Wise, Zelle, and more at the live Chainlink market
5
- rate, with zero spread and no centralized off-ramp provider.
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 more at the
5
+ live Chainlink market rate, with zero spread and no centralized off-ramp
6
+ provider.
6
7
 
7
8
  Peer Cash is an **offramp-only** SDK for the [ZKP2P](https://peer.xyz)
8
9
  protocol. The cashing-out user is the maker: their USDC becomes a deposit in
@@ -100,9 +101,12 @@ arbitrary protocol operations.
100
101
  | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
101
102
  | `capabilities()` | Sync discovery: Base USDC destination/default source, platforms × currencies × payee hints × amount bounds |
102
103
  | `capabilities({ includeRelaySources: true })` | Async discovery: adds live Relay SDK EVM source chains/tokens |
104
+ | `capabilities({ includeNearIntentsSources: true })` | Async discovery: adds live NEAR Intents 1Click source assets |
103
105
  | `fillStats()` | Cached 30-day fill counts and median first-fill time per exact `platform:currency` pair or sorted multi-currency set |
104
106
  | `quoteSource(input)` / `executeSourceQuote(quote, { signer })` | Relay SDK EVM source routing into Base USDC before cashout |
105
107
  | `relayStatus(requestId)` | Relay request status from the Relay SDK request path |
108
+ | `quoteNearIntentsSource(input)` | Signed 1Click quote with an origin-chain deposit address and optional memo |
109
+ | `submitNearIntentsDeposit(input)` / `nearIntentsStatus(input)` | Optionally register an origin tx, then track 1Click delivery/refund evidence |
106
110
  | `estimate({ amount, currency }, { includeEta? })` | Base USDC oracle estimate; optionally skip the historical ETA for progressive rendering |
107
111
  | `cashout(input, { signer })` | Creates the order with any viem wallet; Venmo, Cash App, and PayPal then attach the canonical access groups |
108
112
  | `prepare(input)` / `finalizePreparedCashout(receipt)` | Prepare external signing, resolve the deposit, then check `accessPolicyRequired` for the follow-up |
@@ -176,7 +180,9 @@ extension. An already-registered Wise or PayPal handle can be reused with bare
176
180
  payee data. A new handle without its signed attestation fails during curator
177
181
  registration with `PAYEE_VERIFICATION_REQUIRED`, before funds move on-chain.
178
182
 
179
- ## Source routing (any EVM asset in)
183
+ ## Source routing
184
+
185
+ ### Relay (signed EVM route)
180
186
 
181
187
  The default/minimal flow is unchanged: pass Base USDC base units to
182
188
  `estimate()` and `cashout()`. For any other source asset, pass `source` to
@@ -216,6 +222,58 @@ refuses the route preflight with `SOURCE_NONCE_MANAGER_REQUIRED` instead of
216
222
  letting the route transaction reuse the approval's nonce and revert
217
223
  mid-route. Browser wallets are unaffected.
218
224
 
225
+ ### NEAR Intents (external-deposit route)
226
+
227
+ NEAR Intents 1Click supports non-EVM origins such as Zcash, so the SDK does
228
+ not pretend a viem wallet can execute the source transfer. It returns a signed
229
+ quote with an origin-chain `depositAddress` and optional `depositMemo`; your
230
+ wallet sends exactly once, then the SDK tracks the provider route into
231
+ canonical Base USDC. Use `EXACT_OUTPUT` when the Peer order amount must be
232
+ known before the origin send.
233
+
234
+ ```ts
235
+ const cash = createCashClient({
236
+ environment: 'production',
237
+ nearIntents: {
238
+ // Browser-safe same-origin proxy; it keeps the 1Click JWT server-side.
239
+ apiUrl: '/api/v1/near',
240
+ transport: 'proxy',
241
+ },
242
+ });
243
+
244
+ const sources = await cash.capabilities({ includeNearIntentsSources: true });
245
+ const zec = sources.source.nearIntents?.assets.find((asset) => asset.symbol === 'ZEC');
246
+ const quote = await cash.quoteNearIntentsSource({
247
+ sourceAsset: zec!.assetId,
248
+ amount: 1_000_000n, // exact 1 Base USDC output
249
+ recipient: baseSigner.account.address,
250
+ refundTo: transparentZcashRefundAddress,
251
+ tradeType: 'EXACT_OUTPUT',
252
+ deadline: new Date(Date.now() + 3 * 60_000).toISOString(),
253
+ });
254
+
255
+ persist(quote); // before sending: address, memo, signed response, deadline
256
+ const originTxHash = await zcashWallet.send(quote.depositAddress!, quote.inputAmount);
257
+ await cash.submitNearIntentsDeposit({
258
+ depositAddress: quote.depositAddress!,
259
+ ...(quote.depositMemo ? { depositMemo: quote.depositMemo } : {}),
260
+ txHash: originTxHash,
261
+ });
262
+ const route = await cash.nearIntentsStatus({
263
+ depositAddress: quote.depositAddress!,
264
+ ...(quote.depositMemo ? { depositMemo: quote.depositMemo } : {}),
265
+ expectedQuote: quote,
266
+ });
267
+ // On SUCCESS, reconcile the Base receipt/balance, then call Base-only cashout().
268
+ ```
269
+
270
+ Direct server integrations may pass `nearIntents: { token }`. Browser code
271
+ must use a same-origin proxy and must never receive the 1Click JWT. Never reuse
272
+ an expired deposit address, resend funds after an uncertain wallet submission,
273
+ or infer success from a wallet-wide balance alone. If optional deposit
274
+ registration fails, retry only `submitNearIntentsDeposit()` with the same hash;
275
+ 1Click can also detect the transfer on-chain.
276
+
219
277
  ## Source-route recovery
220
278
 
221
279
  Persist `depositId`, transaction hashes, and the Relay `requestId` as soon as
@@ -227,6 +285,9 @@ they are available. A source-routed result includes both a flat
227
285
  can stay in `relayStatus` `waiting` indefinitely. Decide from the error's
228
286
  recovery payload and origin transactions, never by waiting for a terminal
229
287
  Relay status.
288
+ - `SOURCE_DEPOSIT_SUBMISSION_FAILED`: the NEAR Intents origin transaction may
289
+ already be final. Retry only the provider notification with the same address
290
+ and hash; never resend source funds.
230
291
  - `SOURCE_ROUTE_COMPLETED_CASHOUT_FAILED`: Relay completed, but the Base
231
292
  cashout was not created. Do not route again. Retry a Base-USDC-only
232
293
  `cashout()` with `BigInt(error.recovery.amount)`.
@@ -363,6 +424,7 @@ Runnable first-party examples in [`examples/`](examples):
363
424
 
364
425
  - [`node-cashout.ts`](examples/node-cashout.ts) - server-side cash-out with a private-key signer, plus order tracking.
365
426
  - [`agent-tool-use.ts`](examples/agent-tool-use.ts) - wiring the verbs into an agent tool-use loop with host-side signing.
427
+ - [`mpp-merchant-cashout`](examples/mpp-merchant-cashout) - turn confirmed MPP merchant revenue into an unsigned Peer Cash plan while the merchant keeps custody and signing.
366
428
 
367
429
  ## Trust model, honestly
368
430
 
@@ -217,21 +217,21 @@ var errors = {
217
217
  retryable: false,
218
218
  remediation: `For one-call source cashout, deliver Relay output to the depositor address. For a different recipient, bridge first and then cash out from that recipient's signer.`
219
219
  }),
220
- sourceCapabilitiesFailed: (cause) => new CashError(
220
+ sourceCapabilitiesFailed: (cause, provider = "Relay", capabilityMethod = "sourceCapabilities") => new CashError(
221
221
  {
222
222
  code: "SOURCE_CAPABILITIES_FAILED",
223
- message: `Relay source-chain discovery failed.`,
223
+ message: `${provider} source discovery failed.`,
224
224
  retryable: true,
225
- remediation: `Retry sourceCapabilities() shortly, or use the default Base USDC path.`
225
+ remediation: `Retry ${capabilityMethod}() shortly, or use the default Base USDC path.`
226
226
  },
227
227
  { cause }
228
228
  ),
229
- sourceQuoteFailed: (cause) => new CashError(
229
+ sourceQuoteFailed: (cause, provider = "Relay", quoteMethod = "quoteSource") => new CashError(
230
230
  {
231
231
  code: "SOURCE_QUOTE_FAILED",
232
- message: `Relay did not return a valid route to canonical Base USDC.`,
232
+ message: `${provider} did not return a valid route to canonical Base USDC.`,
233
233
  retryable: true,
234
- remediation: `Refresh source capabilities and request a new quote. Do not submit transactions from this response.`
234
+ remediation: `Refresh source capabilities and call ${quoteMethod}() again. Do not submit transactions from this response.`
235
235
  },
236
236
  { cause }
237
237
  ),
@@ -258,12 +258,21 @@ var errors = {
258
258
  },
259
259
  { cause }
260
260
  ),
261
- sourceStatusFailed: (requestId, cause) => new CashError(
261
+ sourceDepositSubmissionFailed: (depositAddress, cause) => new CashError(
262
+ {
263
+ code: "SOURCE_DEPOSIT_SUBMISSION_FAILED",
264
+ message: `NEAR Intents could not register the origin transaction for deposit ${depositAddress}.`,
265
+ retryable: true,
266
+ remediation: `Retry only submitNearIntentsDeposit() with the same deposit address and origin transaction hash. Never resend the source funds; 1Click can also detect the deposit on-chain.`
267
+ },
268
+ { cause }
269
+ ),
270
+ sourceStatusFailed: (requestId, cause, provider = "Relay", statusMethod = "relayStatus") => new CashError(
262
271
  {
263
272
  code: "SOURCE_STATUS_FAILED",
264
- message: `Relay status is unavailable for request ${requestId}.`,
273
+ message: `${provider} status is unavailable for route ${requestId}.`,
265
274
  retryable: true,
266
- remediation: `Retry relayStatus(requestId) shortly; keep the request id and transaction hashes for recovery.`
275
+ remediation: `Retry ${statusMethod}() shortly; keep the route identifier and transaction hashes for recovery.`
267
276
  },
268
277
  { cause }
269
278
  ),
@@ -293,6 +293,178 @@ interface RelayStatus {
293
293
  raw: unknown;
294
294
  }
295
295
 
296
+ /**
297
+ * Peer Cash - engine constants.
298
+ *
299
+ * Peer Cash is an async crypto→fiat offramp built on the maker/deposit side of
300
+ * the protocol: the cashing-out user IS the maker. They create a deposit at the
301
+ * live oracle/market rate (0% spread); a buyer (a standard taker) signals an
302
+ * intent, pays fiat, and proves it via the standard TEE-TLS flow, releasing the
303
+ * user's crypto. The protocol is reused in its existing direction - no proof
304
+ * inversion, no sell-side quote.
305
+ */
306
+
307
+ /** Base chain id - Peer Cash settles in Base USDC. */
308
+ declare const BASE_CHAIN_ID = 8453;
309
+ /** Canonical USDC on Base (6 decimals). The deposit asset for every cash-out. */
310
+ declare const BASE_USDC_ADDRESS: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";
311
+ /** USDC has 6 decimals. */
312
+ declare const USDC_DECIMALS = 6;
313
+ /**
314
+ * Market rate = the live Chainlink oracle with **zero spread**. The user sets no
315
+ * rate; selling at market is the fast-fill incentive (the deposit is the best
316
+ * deal on the book, so buyers have reason to take it quickly).
317
+ */
318
+ declare const MARKET_SPREAD_BPS = 0;
319
+ /**
320
+ * EscrowV2 rejects a zero `minConversionRate` even when an oracle-backed rate
321
+ * config is attached. Use the smallest non-zero sentinel so the oracle rate
322
+ * still fully determines pricing while satisfying the on-chain invariant.
323
+ */
324
+ declare const ORACLE_MIN_CONVERSION_RATE_SENTINEL = 1n;
325
+ /**
326
+ * The full intent-status set a cash-out order can pass through. The indexer's
327
+ * `getIntentsForDeposits` defaults to `['SIGNALED']` only - passing this
328
+ * explicit set is REQUIRED, otherwise `delivered`/`returned` states are
329
+ * silently filtered out.
330
+ */
331
+ declare const CASH_ORDER_STATUSES: IntentStatus[];
332
+ /** Default polling cadence for an in-flight order (ms). Matches the protocol's active-intent polling. */
333
+ declare const CASH_ORDER_POLL_INTERVAL_MS = 5000;
334
+ /**
335
+ * Default deposit config for every Peer Cash deposit: a one-shot cash-out
336
+ * cleans up when fully filled rather than lingering empty.
337
+ */
338
+ declare const CASH_RETAIN_ON_EMPTY = false;
339
+
340
+ declare const NEAR_INTENTS_API_URL = "https://1click.chaindefuser.com";
341
+ declare const NEAR_INTENTS_BASE_USDC_ASSET_ID = "nep141:base-0x833589fcd6edb6e08f4c7c32d4f71b54bda02913.omft.near";
342
+ declare const NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS = 100;
343
+ interface NearIntentsToken {
344
+ [key: string]: unknown;
345
+ assetId: string;
346
+ symbol: string;
347
+ decimals: number;
348
+ blockchain: string;
349
+ price?: string | number | null | undefined;
350
+ priceUpdatedAt?: string | undefined;
351
+ contractAddress?: string | null | undefined;
352
+ }
353
+ interface NearIntentsSourceCapabilities {
354
+ destination: {
355
+ assetId: typeof NEAR_INTENTS_BASE_USDC_ASSET_ID;
356
+ chainId: typeof BASE_CHAIN_ID;
357
+ address: typeof BASE_USDC_ADDRESS;
358
+ symbol: 'USDC';
359
+ decimals: typeof USDC_DECIMALS;
360
+ };
361
+ assets: NearIntentsToken[];
362
+ source: 'near-intents';
363
+ asOf: number;
364
+ }
365
+ interface NearIntentsOptions {
366
+ /** 1Click origin. Defaults to the official API, or to the app proxy root in proxy mode. */
367
+ apiUrl?: string;
368
+ /** Server-side 1Click JWT. Never expose this option in browser code. */
369
+ token?: string;
370
+ fetch?: typeof globalThis.fetch;
371
+ /** Direct uses official `/v0/*` endpoints; proxy uses `/tokens|quote|submit|status`. */
372
+ transport?: 'direct' | 'proxy';
373
+ timeoutMs?: number;
374
+ }
375
+ type NearIntentsTradeType = 'EXACT_INPUT' | 'EXACT_OUTPUT';
376
+ interface NearIntentsQuoteInput {
377
+ /** NEAR Intents asset id from `nearIntentsCapabilities()`. */
378
+ sourceAsset: string;
379
+ /** Source units for EXACT_INPUT; Base USDC units for EXACT_OUTPUT. */
380
+ amount: bigint;
381
+ /** Base address that will receive canonical USDC. */
382
+ recipient: string;
383
+ /** Refund address on the source chain. */
384
+ refundTo: string;
385
+ tradeType: NearIntentsTradeType;
386
+ deadline: string;
387
+ slippageTolerance?: number;
388
+ dry?: boolean;
389
+ }
390
+ interface NearIntentsQuoteRequest {
391
+ dry: boolean;
392
+ swapType: NearIntentsTradeType;
393
+ slippageTolerance: number;
394
+ originAsset: string;
395
+ depositType: 'ORIGIN_CHAIN';
396
+ destinationAsset: typeof NEAR_INTENTS_BASE_USDC_ASSET_ID;
397
+ amount: string;
398
+ refundTo: string;
399
+ refundType: 'ORIGIN_CHAIN';
400
+ recipient: string;
401
+ recipientType: 'DESTINATION_CHAIN';
402
+ deadline: string;
403
+ depositMode: 'SIMPLE';
404
+ }
405
+ interface NearIntentsQuote {
406
+ provider: 'near-intents';
407
+ correlationId?: string;
408
+ sourceAsset: string;
409
+ destinationAsset: typeof NEAR_INTENTS_BASE_USDC_ASSET_ID;
410
+ inputAmount: bigint;
411
+ minInputAmount: bigint;
412
+ outputAmount: bigint;
413
+ minOutputAmount: bigint;
414
+ timeEstimateSeconds?: number;
415
+ depositAddress?: string;
416
+ depositMemo?: string;
417
+ deadline?: string;
418
+ signature: string;
419
+ request: NearIntentsQuoteRequest;
420
+ raw: unknown;
421
+ }
422
+ interface NearIntentsDepositInput {
423
+ depositAddress: string;
424
+ txHash: string;
425
+ depositMemo?: string;
426
+ }
427
+ interface NearIntentsStatusInput {
428
+ depositAddress: string;
429
+ depositMemo?: string;
430
+ /** Persisted signed quote used to reject status for a different route identity. */
431
+ expectedQuote?: NearIntentsQuote;
432
+ }
433
+ declare const NEAR_INTENTS_STATUSES: readonly ["PENDING_DEPOSIT", "KNOWN_DEPOSIT_TX", "PROCESSING", "SUCCESS", "INCOMPLETE_DEPOSIT", "REFUNDED", "FAILED"];
434
+ type NearIntentsStatusCode = (typeof NEAR_INTENTS_STATUSES)[number];
435
+ interface NearIntentsTransaction {
436
+ hash: string;
437
+ explorerUrl?: string;
438
+ }
439
+ interface NearIntentsStatus {
440
+ provider: 'near-intents';
441
+ correlationId?: string;
442
+ depositAddress: string;
443
+ depositMemo?: string;
444
+ status: NearIntentsStatusCode;
445
+ updatedAt?: string;
446
+ inputAmount?: bigint;
447
+ outputAmount?: bigint;
448
+ refundedAmount?: bigint;
449
+ refundReason?: string;
450
+ intentHashes: string[];
451
+ nearTransactionHashes: string[];
452
+ originTransactions: NearIntentsTransaction[];
453
+ destinationTransactions: NearIntentsTransaction[];
454
+ raw: unknown;
455
+ }
456
+ interface NearIntentsClient {
457
+ capabilities(): Promise<NearIntentsSourceCapabilities>;
458
+ quoteToBaseUsdc(input: NearIntentsQuoteInput): Promise<NearIntentsQuote>;
459
+ submitDeposit(input: NearIntentsDepositInput): Promise<NearIntentsStatus>;
460
+ status(input: NearIntentsStatusInput): Promise<NearIntentsStatus>;
461
+ }
462
+ declare function createNearIntentsClient(options?: NearIntentsOptions): NearIntentsClient;
463
+ declare function readNearIntentsSourceCapabilities(options?: NearIntentsOptions): Promise<NearIntentsSourceCapabilities>;
464
+ declare function quoteNearIntentsToBaseUsdc(input: NearIntentsQuoteInput, options?: NearIntentsOptions): Promise<NearIntentsQuote>;
465
+ declare function submitNearIntentsDeposit(input: NearIntentsDepositInput, options?: NearIntentsOptions): Promise<NearIntentsStatus>;
466
+ declare function readNearIntentsStatus(input: NearIntentsStatusInput, options?: NearIntentsOptions): Promise<NearIntentsStatus>;
467
+
296
468
  /** Hard floor: below one cent a deposit is dust and can never fill. */
297
469
  declare const MIN_CASHOUT_AMOUNT = 10000n;
298
470
  /** Recommended floor: sub-1-USDC deposits force min==max fills and starve matching. */
@@ -337,7 +509,8 @@ interface CashCapabilities {
337
509
  };
338
510
  /**
339
511
  * Source discovery. The sync default is Base USDC only; pass
340
- * `{ includeRelaySources: true }` to `capabilities()` for live Relay EVM sources.
512
+ * `{ includeRelaySources: true }` or `{ includeNearIntentsSources: true }`
513
+ * to `capabilities()` for live bridge source assets.
341
514
  */
342
515
  source: {
343
516
  default: {
@@ -349,6 +522,7 @@ interface CashCapabilities {
349
522
  };
350
523
  };
351
524
  relay?: CashSourceCapabilities;
525
+ nearIntents?: NearIntentsSourceCapabilities;
352
526
  };
353
527
  /** Every payout corridor: platform × oracle-priced currencies. */
354
528
  platforms: CashPlatformCapability[];
@@ -490,6 +664,8 @@ interface CashClientOptions {
490
664
  apiKey?: string;
491
665
  /** Relay API configuration for source assets outside Base USDC. */
492
666
  relay?: RelayOptions;
667
+ /** NEAR Intents 1Click configuration for externally funded source routes. */
668
+ nearIntents?: NearIntentsOptions;
493
669
  /**
494
670
  * Your six-character referral code from the Peer mobile or web app. The SDK
495
671
  * emits `peer-ref-XXXXXX`; when this deposit fills, Curator routes the
@@ -648,9 +824,15 @@ interface CashClient {
648
824
  /** 0b - Discovery with live Relay-supported EVM source chains/tokens. */
649
825
  capabilities(options: {
650
826
  includeRelaySources: true;
827
+ includeNearIntentsSources?: true;
828
+ }): Promise<CashCapabilities>;
829
+ /** 0c - Discovery with live NEAR Intents 1Click source assets. */
830
+ capabilities(options: {
831
+ includeRelaySources?: true;
832
+ includeNearIntentsSources: true;
651
833
  }): Promise<CashCapabilities>;
652
834
  /**
653
- * 0c - Raw 30-day demand and first-fill speed evidence keyed by an exact
835
+ * 0d - Raw 30-day demand and first-fill speed evidence keyed by an exact
654
836
  * `platform:currency` pair or sorted multi-currency set. A recommended
655
837
  * consumer gate is `fills >= 10 && medianFillSeconds <= 48h`; fail open to
656
838
  * the full capability catalog when stats are unavailable or the gate would
@@ -672,6 +854,14 @@ interface CashClient {
672
854
  }): Promise<RelayExecutionResult>;
673
855
  /** Track Relay execution status by quote/request id. */
674
856
  relayStatus(requestId: string): Promise<RelayStatus>;
857
+ /** Discover live NEAR Intents assets that can route into canonical Base USDC. */
858
+ nearIntentsCapabilities(): Promise<NearIntentsSourceCapabilities>;
859
+ /** Quote a NEAR Intents external-deposit route into canonical Base USDC. */
860
+ quoteNearIntentsSource(input: NearIntentsQuoteInput): Promise<NearIntentsQuote>;
861
+ /** Optionally register an already-broadcast origin transaction with 1Click. */
862
+ submitNearIntentsDeposit(input: NearIntentsDepositInput): Promise<NearIntentsStatus>;
863
+ /** Track a NEAR Intents route by its provider-issued deposit address and memo. */
864
+ nearIntentsStatus(input: NearIntentsStatusInput): Promise<NearIntentsStatus>;
675
865
  /** 1 - Estimate: currency + amount only. No payee, no side effects, no expiry. */
676
866
  estimate(input: EstimateInput, options?: EstimateOptions): Promise<CashEstimate>;
677
867
  /** 2 - Cash out: payee registration + deposit params + submission happen here. */
@@ -720,4 +910,4 @@ interface CashClient {
720
910
  }
721
911
  declare function createCashClient(options: CashClientOptions): CashClient;
722
912
 
723
- export { type WithdrawOptions as $, type CashPayeeInput as A, type CashPayout as B, type CashPayoutInfo as C, type CashPayoutPricing as D, type CashPlatformCapability as E, type CashPreparedStepKind as F, type CashReceiveLeg as G, type CashoutInput as H, type IntentStatus as I, type CashoutOptions as J, type CuratorPayeeDataInput as K, type EstimateInput as L, type EstimateOptions as M, MIN_CASHOUT_AMOUNT as N, type OrdersOptions as O, type PrepareResult as P, type PreparedCashoutReceipt as Q, type RelayExecutionResult as R, RECOMMENDED_MIN_CASHOUT_AMOUNT as S, type TopUpResult as T, type RelayOptions as U, type RelayQuoteInput as V, type WithdrawResult as W, type RelaySourceInput as X, type RelayTransaction as Y, type SignerOptions as Z, type WatchOptions as _, type IntentEntity as a, buildCapabilities as a0, createCashClient as a1, normalizeCashPayee as a2, toCashReferralAttributionCode as a3, type CashBuyerProfile as b, type CashDepositInput as c, type CreateDepositParamsArg as d, type CashOrder as e, type CashFill as f, type CashCapabilities as g, type CashoutResult as h, type CashEstimate as i, type CashFillStats as j, type CashPreparedStep as k, type RelayQuote as l, type RelayStatus as m, type CashSourceCapabilities as n, CASH_ATTRIBUTION_CODE as o, CASH_REFERRAL_ATTRIBUTION_PREFIX as p, type CashAsset as q, type CashChain as r, type CashClient as s, type CashClientOptions as t, type CashFillEta as u, type CashLeg as v, type CashMultiCurrencyLeg as w, type CashNextAction as x, type CashOrderState as y, type CashPairFillStats as z };
913
+ export { MARKET_SPREAD_BPS as $, type CashClient as A, BASE_CHAIN_ID as B, type CashPayoutInfo as C, type CashClientOptions as D, type CashFillEta as E, type CashLeg as F, type CashMultiCurrencyLeg as G, type CashNextAction as H, type IntentEntity as I, type CashOrderState as J, type CashPairFillStats as K, type CashPayeeInput as L, type CashPayout as M, type NearIntentsSourceCapabilities as N, type CashPayoutPricing as O, type PrepareResult as P, type CashPlatformCapability as Q, type RelayExecutionResult as R, type CashPreparedStepKind as S, type TopUpResult as T, type CashReceiveLeg as U, type CashoutInput as V, type WithdrawResult as W, type CashoutOptions as X, type CuratorPayeeDataInput as Y, type EstimateInput as Z, type EstimateOptions as _, type CashBuyerProfile as a, MIN_CASHOUT_AMOUNT as a0, NEAR_INTENTS_API_URL as a1, NEAR_INTENTS_BASE_USDC_ASSET_ID as a2, NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS as a3, NEAR_INTENTS_STATUSES as a4, type NearIntentsClient as a5, type NearIntentsOptions as a6, type NearIntentsQuoteRequest as a7, type NearIntentsStatusCode as a8, type NearIntentsToken as a9, type NearIntentsTradeType as aa, type NearIntentsTransaction as ab, ORACLE_MIN_CONVERSION_RATE_SENTINEL as ac, type OrdersOptions as ad, type PreparedCashoutReceipt as ae, RECOMMENDED_MIN_CASHOUT_AMOUNT as af, type RelayOptions as ag, type RelayQuoteInput as ah, type RelaySourceInput as ai, type RelayTransaction as aj, type SignerOptions as ak, USDC_DECIMALS as al, type WatchOptions as am, type WithdrawOptions as an, buildCapabilities as ao, createCashClient as ap, createNearIntentsClient as aq, normalizeCashPayee as ar, quoteNearIntentsToBaseUsdc as as, readNearIntentsSourceCapabilities as at, readNearIntentsStatus as au, submitNearIntentsDeposit as av, toCashReferralAttributionCode as aw, 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 };