@zkp2p/cash 0.1.0-dev.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.
@@ -0,0 +1,1367 @@
1
+ import { I as IntentStatus, C as CashPayoutInfo, a as IntentEntity, b as CashBuyerProfile, c as CashDepositInput, d as CreateDepositParamsArg, e as CashOrder, f as CashFill, g as CashCapabilities, h as CashoutResult, i as CashEstimate, P as PrepareResult, j as CashPreparedStep, T as TopUpResult, W as WithdrawResult } from './createCashClient-DpAx9A1A.cjs';
2
+ export { k as CASH_ATTRIBUTION_CODE, l as CashClient, m as CashClientOptions, n as CashLeg, o as CashNextAction, p as CashOrderState, q as CashPayout, r as CashPayoutPricing, s as CashPlatformCapability, t as CashPreparedStepKind, u as CashoutInput, v as CuratorPayeeDataInput, E as EstimateInput, M as MIN_CASHOUT_AMOUNT, O as OrdersOptions, R as RECOMMENDED_MIN_CASHOUT_AMOUNT, S as SignerOptions, w as WatchOptions, x as WithdrawOptions, y as buildCapabilities, z as createCashClient } from './createCashClient-DpAx9A1A.cjs';
3
+ import { PaymentMethodCatalog, CurrencyType, OracleAdapterOverrides, OnchainCurrency, Zkp2pClient, PreparedTransaction } from '@zkp2p/sdk';
4
+ export { CurrencyType, PreparedTransaction, RuntimeEnv } from '@zkp2p/sdk';
5
+ import { Log, Abi } from 'viem';
6
+ import { z } from 'zod';
7
+
8
+ /**
9
+ * Typed errors - every failure carries a `code`, whether it is `retryable`,
10
+ * and a `remediation` sentence so agents can self-drive recovery.
11
+ */
12
+ type CashErrorCode = 'ORACLE_UNSUPPORTED_CURRENCY' | 'UNSUPPORTED_PLATFORM' | 'AMOUNT_BELOW_MINIMUM' | 'ACTIVE_INTENT_BLOCKS_WITHDRAWAL' | 'NOTHING_TO_WITHDRAW' | 'INSUFFICIENT_AVAILABLE_FUNDS' | 'ORDER_NOT_ACTIVE' | 'ESCROW_PAUSED' | 'INDEXER_LAG' | 'ORDER_NOT_FOUND' | 'PAYEE_REGISTRATION_FAILED' | 'PAYEE_VERIFICATION_REQUIRED' | 'DEPOSIT_RESOLUTION_FAILED' | 'ALLOWANCE_NOT_VISIBLE' | 'SIGNER_REQUIRED' | 'WATCH_TIMEOUT' | 'TRANSACTION_FAILED';
13
+ interface CashErrorShape {
14
+ code: CashErrorCode;
15
+ message: string;
16
+ retryable: boolean;
17
+ remediation: string;
18
+ }
19
+ declare class CashError extends Error implements CashErrorShape {
20
+ readonly code: CashErrorCode;
21
+ readonly retryable: boolean;
22
+ readonly remediation: string;
23
+ constructor(shape: CashErrorShape, options?: {
24
+ cause?: unknown;
25
+ });
26
+ /** Serializable view (for tool results and logs). */
27
+ toJSON(): CashErrorShape;
28
+ }
29
+ declare function isCashError(value: unknown): value is CashError;
30
+ /** Factory helpers keep call sites one-liners and remediation copy consistent. */
31
+ declare const errors: {
32
+ oracleUnsupportedCurrency: (currency: string) => CashError;
33
+ unsupportedPlatform: (platform: string) => CashError;
34
+ amountBelowMinimum: (amount: bigint, min: bigint) => CashError;
35
+ activeIntentBlocksWithdrawal: (depositId: string) => CashError;
36
+ insufficientAvailableFunds: (depositId: string, requested: bigint, available: bigint) => CashError;
37
+ orderNotActive: (depositId: string) => CashError;
38
+ nothingToWithdraw: (depositId: string) => CashError;
39
+ indexerLag: (depositId: string) => CashError;
40
+ orderNotFound: (depositId: string) => CashError;
41
+ payeeRegistrationFailed: (cause: unknown) => CashError;
42
+ payeeVerificationRequired: (platform: string, cause?: unknown) => CashError;
43
+ allowanceNotVisible: (amount: bigint) => CashError;
44
+ depositResolutionFailed: (txHash: string) => CashError;
45
+ signerRequired: (verb: string) => CashError;
46
+ watchTimeout: (depositId: string, timeoutMs: number) => CashError;
47
+ transactionFailed: (txHash: string, cause?: unknown) => CashError;
48
+ escrowPaused: () => CashError;
49
+ /** Generic fallback for an on-chain call that failed for an unrecognized reason. */
50
+ chainCallFailed: (verb: string, cause?: unknown) => CashError;
51
+ };
52
+
53
+ /**
54
+ * Convert a human USDC amount to base units (6 decimals).
55
+ *
56
+ * @example
57
+ * usdc(1000) // 1_000_000_000n
58
+ * usdc('12.34') // 12_340_000n
59
+ */
60
+ declare function usdc(amount: number | string): bigint;
61
+ /** Format USDC base units back to a decimal string (no trailing zeros). */
62
+ declare function formatUsdc(amount: bigint): string;
63
+ /** Protocol rate precision - conversion rates are fiat-per-USDC scaled by 1e18. */
64
+ declare const RATE_PRECISION: bigint;
65
+ /**
66
+ * Fiat owed for a USDC amount at a locked 1e18 conversion rate, in fiat base
67
+ * units (6 decimals), rounded UP to the nearest cent - the same math the
68
+ * protocol clients use, so the number matches what the buyer is told to pay.
69
+ */
70
+ declare function fiatFromUsdc(amount: bigint, conversionRate: bigint): bigint;
71
+ /** Decode a 1e18 conversion rate to a plain number (fiat per USDC). */
72
+ declare function rateToNumber(conversionRate: bigint): number;
73
+ /** Decode fiat base units (6 decimals) to a plain number. */
74
+ declare function fiatToNumber(fiat: bigint): number;
75
+ /** Decode fiat cents (verified `paymentAmount` precision) to a plain number. */
76
+ declare function centsToNumber(cents: bigint): number;
77
+
78
+ /**
79
+ * Peer Cash - engine constants.
80
+ *
81
+ * Peer Cash is an async crypto→fiat offramp built on the maker/deposit side of
82
+ * the protocol: the cashing-out user IS the maker. They create a deposit at the
83
+ * live oracle/market rate (0% spread); a buyer (a standard taker) signals an
84
+ * intent, pays fiat, and proves it via the standard TEE-TLS flow, releasing the
85
+ * user's crypto. The protocol is reused in its existing direction - no proof
86
+ * inversion, no sell-side quote.
87
+ */
88
+
89
+ /** Base chain id - Peer Cash settles in Base USDC. */
90
+ declare const BASE_CHAIN_ID = 8453;
91
+ /** Canonical USDC on Base (6 decimals). The deposit asset for every cash-out. */
92
+ declare const BASE_USDC_ADDRESS: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";
93
+ /** USDC has 6 decimals. */
94
+ declare const USDC_DECIMALS = 6;
95
+ /**
96
+ * Market rate = the live Chainlink oracle with **zero spread**. The user sets no
97
+ * rate; selling at market is the fast-fill incentive (the deposit is the best
98
+ * deal on the book, so buyers have reason to take it quickly).
99
+ */
100
+ declare const MARKET_SPREAD_BPS = 0;
101
+ /**
102
+ * EscrowV2 rejects a zero `minConversionRate` even when an oracle-backed rate
103
+ * config is attached. Use the smallest non-zero sentinel so the oracle rate
104
+ * still fully determines pricing while satisfying the on-chain invariant.
105
+ */
106
+ declare const ORACLE_MIN_CONVERSION_RATE_SENTINEL = 1n;
107
+ /**
108
+ * The full intent-status set a cash-out order can pass through. The indexer's
109
+ * `getIntentsForDeposits` defaults to `['SIGNALED']` only - passing this
110
+ * explicit set is REQUIRED, otherwise `delivered`/`returned` states are
111
+ * silently filtered out.
112
+ */
113
+ declare const CASH_ORDER_STATUSES: IntentStatus[];
114
+ /** Default polling cadence for an in-flight order (ms). Matches the protocol's active-intent polling. */
115
+ declare const CASH_ORDER_POLL_INTERVAL_MS = 5000;
116
+ /**
117
+ * Default deposit config for every Peer Cash deposit: a one-shot cash-out
118
+ * cleans up when fully filled rather than lingering empty.
119
+ */
120
+ declare const CASH_RETAIN_ON_EMPTY = false;
121
+
122
+ /** The raw indexed shape of a deposit's payment method (relation row). */
123
+ interface PaymentMethodLike {
124
+ paymentMethodHash?: string | null;
125
+ payeeDetailsHash?: string | null;
126
+ active?: boolean | null;
127
+ }
128
+ /** The raw indexed shape of a per-method currency tuple (relation row). */
129
+ interface MethodCurrencyLike {
130
+ paymentMethodHash?: string | null;
131
+ currencyCode?: string | null;
132
+ spreadBps?: number | string | null;
133
+ kind?: string | null;
134
+ rateSource?: string | null;
135
+ oracleRate?: string | number | bigint | null;
136
+ lastOracleUpdatedAt?: string | number | null;
137
+ }
138
+ /**
139
+ * Decode a deposit's payment methods + currency tuples into payout legs.
140
+ * Pure - the environment arrives via the catalog. One leg per
141
+ * (method, currency) pair; cash orders create exactly one in v1.
142
+ */
143
+ declare function derivePayouts(paymentMethods: ReadonlyArray<PaymentMethodLike>, currencies: ReadonlyArray<MethodCurrencyLike>, catalog: PaymentMethodCatalog): CashPayoutInfo[];
144
+
145
+ /**
146
+ * Peer Cash - buyer reputation, derived purely from the buyer's own intent
147
+ * history. The anxious moment in a cash-out is `matched`: a stranger's
148
+ * address is holding your order. This turns that address into a track record.
149
+ */
150
+
151
+ /** Aggregate a buyer's full intent history into a profile. Pure and deterministic. */
152
+ declare function deriveBuyerProfile(address: string, intents: ReadonlyArray<IntentEntity>): CashBuyerProfile;
153
+
154
+ /**
155
+ * Whether a currency can be priced at the live market rate. Only currencies with
156
+ * a Chainlink feed (`supportsSpreadOracle`) get oracle pricing; others would fall
157
+ * back to a fixed rate, which Peer Cash does not offer.
158
+ */
159
+ declare function isMarketRateSupported(currency: CurrencyType, adapters?: OracleAdapterOverrides): boolean;
160
+ /**
161
+ * Build a single oracle-backed currency tuple priced at market (0% spread).
162
+ * Returns `null` for currencies without a Chainlink feed.
163
+ */
164
+ declare function buildMarketRateCurrencyOverride(currency: CurrencyType, adapters?: OracleAdapterOverrides): OnchainCurrency | null;
165
+ declare function buildIntentAmountRange(amount: bigint): {
166
+ min: bigint;
167
+ max: bigint;
168
+ };
169
+ /**
170
+ * Prepare the full `createDeposit` params for a market-rate cash-out.
171
+ *
172
+ * Registers payee details with the curator (no auth), resolves payment-method
173
+ * hashes + the gating service from the catalog, and assembles the override
174
+ * arrays with `spreadBps: 0` oracle configs. Throws if any payout currency lacks
175
+ * a live oracle feed (Peer Cash is market-rate only).
176
+ */
177
+ declare function prepareCashDepositParams(client: Zkp2pClient, input: CashDepositInput, adapters?: OracleAdapterOverrides): Promise<CreateDepositParamsArg>;
178
+
179
+ /**
180
+ * Whether a signaled fill can still be completed by its buyer. Uses the
181
+ * indexer's reconciler flag when present, belt-and-braces with the local
182
+ * clock (the reconciler can lag; the clock can skew - either signal counts).
183
+ */
184
+ declare function isFillLive(fill: CashFill, nowSeconds: number): boolean;
185
+ interface DeriveCashOrderOptions {
186
+ /** Original deposit amount, when already computed (else derived from the parts below). */
187
+ totalAmount?: bigint;
188
+ /** `remainingDeposits` - currently available, unlocked balance. */
189
+ remainingAmount?: bigint;
190
+ /** `outstandingIntentAmount` - currently locked by an active (SIGNALED) intent. */
191
+ outstandingAmount?: bigint;
192
+ /** `totalAmountTaken` - cumulative amount delivered to buyers (cashed out). */
193
+ takenAmount?: bigint;
194
+ /** `totalWithdrawn` - cumulative amount returned to the maker. */
195
+ withdrawnAmount?: bigint;
196
+ /** Deposit status from the indexer: `ACTIVE` | `CLOSED`. */
197
+ status?: string;
198
+ /** Total intent count from the indexer aggregate. */
199
+ intentCount?: number;
200
+ /** Unix seconds of the deposit's last on-chain change. */
201
+ updatedAt?: number;
202
+ /** Payout legs reconstructed from the deposit relations (see `derivePayouts`). */
203
+ payouts?: CashPayoutInfo[];
204
+ /** Deposit quality signal (basis points) from the indexer aggregate. */
205
+ successRateBps?: number;
206
+ /**
207
+ * Whether per-fill intent detail is present. Defaults to `intents.length > 0`.
208
+ * Pass `false` on list rows (deposits fetched without their intents) so
209
+ * `nextActions` treats a positive outstanding amount as a live lock rather
210
+ * than offering a withdraw that would revert.
211
+ */
212
+ fillsIncluded?: boolean;
213
+ /** Unix seconds "now" for expiry-sensitive `nextActions` (defaults to wall clock). */
214
+ nowSeconds?: number;
215
+ }
216
+ /** Plain-data view of {@link CashOrder} (everything except the `explain` method). */
217
+ type CashOrderData = Omit<CashOrder, 'explain'>;
218
+ /**
219
+ * One honest sentence from live data - never a fake countdown. The binding
220
+ * rate resolves at the oracle when a buyer fills, and buyer arrival time is
221
+ * unknowable, so the sentence only ever states what the chain actually shows.
222
+ */
223
+ declare function explainOrder(order: CashOrderData): string;
224
+ /** Attach the `explain()` method to plain order data (used by codecs on parse). */
225
+ declare function withExplain(data: CashOrderData): CashOrder;
226
+ /**
227
+ * Derive the resumable {@link CashOrder} view for one deposit. Pure and
228
+ * deterministic - safe on every poll, list render, or cold page load.
229
+ */
230
+ declare function deriveCashOrder(depositId: string, intents: ReadonlyArray<IntentEntity>, options?: DeriveCashOrderOptions): CashOrder;
231
+
232
+ /**
233
+ * Peer Cash - resolve the composite deposit id from a `createDeposit` receipt.
234
+ *
235
+ * `createDeposit` returns only a tx hash; the on-chain `depositId` is assigned by
236
+ * the contract and emitted in `DepositReceived` (indexed). We decode it from the
237
+ * receipt logs using the real escrow ABI so the order can be keyed on the
238
+ * composite id (`escrow_onchainId`) the indexer uses.
239
+ */
240
+
241
+ interface ResolvedCashDeposit {
242
+ onchainDepositId: bigint;
243
+ escrowAddress: string;
244
+ compositeId: string;
245
+ }
246
+ declare function resolveCashDepositId(params: {
247
+ logs: Log[];
248
+ abi: Abi;
249
+ }): ResolvedCashDeposit | null;
250
+ /** Split a composite deposit id (`escrow_onchainId`) back into its parts. */
251
+ declare function parseCompositeDepositId(compositeId: string): {
252
+ escrowAddress: string;
253
+ onchainDepositId: bigint;
254
+ };
255
+
256
+ /**
257
+ * zod schemas for every wire type. The wire format encodes bigints as decimal
258
+ * strings so orders, estimates, and prepared txs cross tool-call and process
259
+ * boundaries losslessly.
260
+ */
261
+
262
+ declare const bigintString: z.ZodString;
263
+ declare const cashOrderStateSchema: z.ZodEnum<["awaiting-buyer", "matched", "delivering", "delivered", "returned"]>;
264
+ declare const cashNextActionSchema: z.ZodEnum<["wait", "withdraw"]>;
265
+ declare const intentStatusSchema: z.ZodEnum<["SIGNALED", "FULFILLED", "PRUNED", "MANUALLY_RELEASED"]>;
266
+ declare const cashFillJsonSchema: z.ZodObject<{
267
+ intentHash: z.ZodString;
268
+ status: z.ZodEnum<["SIGNALED", "FULFILLED", "PRUNED", "MANUALLY_RELEASED"]>;
269
+ amount: z.ZodString;
270
+ buyer: z.ZodString;
271
+ currency: z.ZodOptional<z.ZodString>;
272
+ currencyHash: z.ZodOptional<z.ZodString>;
273
+ rate: z.ZodOptional<z.ZodNumber>;
274
+ conversionRate: z.ZodOptional<z.ZodString>;
275
+ fiatOwed: z.ZodOptional<z.ZodNumber>;
276
+ fiatPaid: z.ZodOptional<z.ZodNumber>;
277
+ paidCurrency: z.ZodOptional<z.ZodString>;
278
+ paymentId: z.ZodOptional<z.ZodString>;
279
+ paidAt: z.ZodOptional<z.ZodNumber>;
280
+ releasedAmount: z.ZodOptional<z.ZodString>;
281
+ fillLatencySeconds: z.ZodOptional<z.ZodNumber>;
282
+ isExpired: z.ZodOptional<z.ZodBoolean>;
283
+ signaledAt: z.ZodOptional<z.ZodNumber>;
284
+ expiresAt: z.ZodOptional<z.ZodNumber>;
285
+ fulfilledAt: z.ZodOptional<z.ZodNumber>;
286
+ prunedAt: z.ZodOptional<z.ZodNumber>;
287
+ }, "strip", z.ZodTypeAny, {
288
+ intentHash: string;
289
+ amount: string;
290
+ status: "SIGNALED" | "FULFILLED" | "PRUNED" | "MANUALLY_RELEASED";
291
+ buyer: string;
292
+ conversionRate?: string | undefined;
293
+ isExpired?: boolean | undefined;
294
+ fillLatencySeconds?: number | undefined;
295
+ paymentId?: string | undefined;
296
+ releasedAmount?: string | undefined;
297
+ currency?: string | undefined;
298
+ currencyHash?: string | undefined;
299
+ fiatPaid?: number | undefined;
300
+ paidCurrency?: string | undefined;
301
+ paidAt?: number | undefined;
302
+ signaledAt?: number | undefined;
303
+ expiresAt?: number | undefined;
304
+ fulfilledAt?: number | undefined;
305
+ prunedAt?: number | undefined;
306
+ rate?: number | undefined;
307
+ fiatOwed?: number | undefined;
308
+ }, {
309
+ intentHash: string;
310
+ amount: string;
311
+ status: "SIGNALED" | "FULFILLED" | "PRUNED" | "MANUALLY_RELEASED";
312
+ buyer: string;
313
+ conversionRate?: string | undefined;
314
+ isExpired?: boolean | undefined;
315
+ fillLatencySeconds?: number | undefined;
316
+ paymentId?: string | undefined;
317
+ releasedAmount?: string | undefined;
318
+ currency?: string | undefined;
319
+ currencyHash?: string | undefined;
320
+ fiatPaid?: number | undefined;
321
+ paidCurrency?: string | undefined;
322
+ paidAt?: number | undefined;
323
+ signaledAt?: number | undefined;
324
+ expiresAt?: number | undefined;
325
+ fulfilledAt?: number | undefined;
326
+ prunedAt?: number | undefined;
327
+ rate?: number | undefined;
328
+ fiatOwed?: number | undefined;
329
+ }>;
330
+ declare const cashPayoutPricingJsonSchema: z.ZodObject<{
331
+ spreadBps: z.ZodOptional<z.ZodNumber>;
332
+ kind: z.ZodOptional<z.ZodString>;
333
+ rateSource: z.ZodOptional<z.ZodString>;
334
+ oracleRate: z.ZodOptional<z.ZodNumber>;
335
+ lastOracleUpdatedAt: z.ZodOptional<z.ZodNumber>;
336
+ marketRate: z.ZodBoolean;
337
+ }, "strip", z.ZodTypeAny, {
338
+ marketRate: boolean;
339
+ spreadBps?: number | undefined;
340
+ lastOracleUpdatedAt?: number | undefined;
341
+ kind?: string | undefined;
342
+ rateSource?: string | undefined;
343
+ oracleRate?: number | undefined;
344
+ }, {
345
+ marketRate: boolean;
346
+ spreadBps?: number | undefined;
347
+ lastOracleUpdatedAt?: number | undefined;
348
+ kind?: string | undefined;
349
+ rateSource?: string | undefined;
350
+ oracleRate?: number | undefined;
351
+ }>;
352
+ declare const cashPayoutInfoJsonSchema: z.ZodObject<{
353
+ platform: z.ZodOptional<z.ZodString>;
354
+ platformHash: z.ZodString;
355
+ currency: z.ZodOptional<z.ZodString>;
356
+ currencyHash: z.ZodOptional<z.ZodString>;
357
+ payeeHash: z.ZodString;
358
+ active: z.ZodBoolean;
359
+ pricing: z.ZodObject<{
360
+ spreadBps: z.ZodOptional<z.ZodNumber>;
361
+ kind: z.ZodOptional<z.ZodString>;
362
+ rateSource: z.ZodOptional<z.ZodString>;
363
+ oracleRate: z.ZodOptional<z.ZodNumber>;
364
+ lastOracleUpdatedAt: z.ZodOptional<z.ZodNumber>;
365
+ marketRate: z.ZodBoolean;
366
+ }, "strip", z.ZodTypeAny, {
367
+ marketRate: boolean;
368
+ spreadBps?: number | undefined;
369
+ lastOracleUpdatedAt?: number | undefined;
370
+ kind?: string | undefined;
371
+ rateSource?: string | undefined;
372
+ oracleRate?: number | undefined;
373
+ }, {
374
+ marketRate: boolean;
375
+ spreadBps?: number | undefined;
376
+ lastOracleUpdatedAt?: number | undefined;
377
+ kind?: string | undefined;
378
+ rateSource?: string | undefined;
379
+ oracleRate?: number | undefined;
380
+ }>;
381
+ }, "strip", z.ZodTypeAny, {
382
+ platformHash: string;
383
+ payeeHash: string;
384
+ active: boolean;
385
+ pricing: {
386
+ marketRate: boolean;
387
+ spreadBps?: number | undefined;
388
+ lastOracleUpdatedAt?: number | undefined;
389
+ kind?: string | undefined;
390
+ rateSource?: string | undefined;
391
+ oracleRate?: number | undefined;
392
+ };
393
+ currency?: string | undefined;
394
+ currencyHash?: string | undefined;
395
+ platform?: string | undefined;
396
+ }, {
397
+ platformHash: string;
398
+ payeeHash: string;
399
+ active: boolean;
400
+ pricing: {
401
+ marketRate: boolean;
402
+ spreadBps?: number | undefined;
403
+ lastOracleUpdatedAt?: number | undefined;
404
+ kind?: string | undefined;
405
+ rateSource?: string | undefined;
406
+ oracleRate?: number | undefined;
407
+ };
408
+ currency?: string | undefined;
409
+ currencyHash?: string | undefined;
410
+ platform?: string | undefined;
411
+ }>;
412
+ declare const cashBuyerProfileJsonSchema: z.ZodObject<{
413
+ address: z.ZodString;
414
+ totalIntents: z.ZodNumber;
415
+ fulfilled: z.ZodNumber;
416
+ pruned: z.ZodNumber;
417
+ signaled: z.ZodNumber;
418
+ successRateBps: z.ZodOptional<z.ZodNumber>;
419
+ firstSeenAt: z.ZodOptional<z.ZodNumber>;
420
+ lastSeenAt: z.ZodOptional<z.ZodNumber>;
421
+ }, "strip", z.ZodTypeAny, {
422
+ totalIntents: number;
423
+ address: string;
424
+ fulfilled: number;
425
+ pruned: number;
426
+ signaled: number;
427
+ successRateBps?: number | undefined;
428
+ firstSeenAt?: number | undefined;
429
+ lastSeenAt?: number | undefined;
430
+ }, {
431
+ totalIntents: number;
432
+ address: string;
433
+ fulfilled: number;
434
+ pruned: number;
435
+ signaled: number;
436
+ successRateBps?: number | undefined;
437
+ firstSeenAt?: number | undefined;
438
+ lastSeenAt?: number | undefined;
439
+ }>;
440
+ declare const cashOrderJsonSchema: z.ZodObject<{
441
+ depositId: z.ZodString;
442
+ state: z.ZodEnum<["awaiting-buyer", "matched", "delivering", "delivered", "returned"]>;
443
+ fills: z.ZodArray<z.ZodObject<{
444
+ intentHash: z.ZodString;
445
+ status: z.ZodEnum<["SIGNALED", "FULFILLED", "PRUNED", "MANUALLY_RELEASED"]>;
446
+ amount: z.ZodString;
447
+ buyer: z.ZodString;
448
+ currency: z.ZodOptional<z.ZodString>;
449
+ currencyHash: z.ZodOptional<z.ZodString>;
450
+ rate: z.ZodOptional<z.ZodNumber>;
451
+ conversionRate: z.ZodOptional<z.ZodString>;
452
+ fiatOwed: z.ZodOptional<z.ZodNumber>;
453
+ fiatPaid: z.ZodOptional<z.ZodNumber>;
454
+ paidCurrency: z.ZodOptional<z.ZodString>;
455
+ paymentId: z.ZodOptional<z.ZodString>;
456
+ paidAt: z.ZodOptional<z.ZodNumber>;
457
+ releasedAmount: z.ZodOptional<z.ZodString>;
458
+ fillLatencySeconds: z.ZodOptional<z.ZodNumber>;
459
+ isExpired: z.ZodOptional<z.ZodBoolean>;
460
+ signaledAt: z.ZodOptional<z.ZodNumber>;
461
+ expiresAt: z.ZodOptional<z.ZodNumber>;
462
+ fulfilledAt: z.ZodOptional<z.ZodNumber>;
463
+ prunedAt: z.ZodOptional<z.ZodNumber>;
464
+ }, "strip", z.ZodTypeAny, {
465
+ intentHash: string;
466
+ amount: string;
467
+ status: "SIGNALED" | "FULFILLED" | "PRUNED" | "MANUALLY_RELEASED";
468
+ buyer: string;
469
+ conversionRate?: string | undefined;
470
+ isExpired?: boolean | undefined;
471
+ fillLatencySeconds?: number | undefined;
472
+ paymentId?: string | undefined;
473
+ releasedAmount?: string | undefined;
474
+ currency?: string | undefined;
475
+ currencyHash?: string | undefined;
476
+ fiatPaid?: number | undefined;
477
+ paidCurrency?: string | undefined;
478
+ paidAt?: number | undefined;
479
+ signaledAt?: number | undefined;
480
+ expiresAt?: number | undefined;
481
+ fulfilledAt?: number | undefined;
482
+ prunedAt?: number | undefined;
483
+ rate?: number | undefined;
484
+ fiatOwed?: number | undefined;
485
+ }, {
486
+ intentHash: string;
487
+ amount: string;
488
+ status: "SIGNALED" | "FULFILLED" | "PRUNED" | "MANUALLY_RELEASED";
489
+ buyer: string;
490
+ conversionRate?: string | undefined;
491
+ isExpired?: boolean | undefined;
492
+ fillLatencySeconds?: number | undefined;
493
+ paymentId?: string | undefined;
494
+ releasedAmount?: string | undefined;
495
+ currency?: string | undefined;
496
+ currencyHash?: string | undefined;
497
+ fiatPaid?: number | undefined;
498
+ paidCurrency?: string | undefined;
499
+ paidAt?: number | undefined;
500
+ signaledAt?: number | undefined;
501
+ expiresAt?: number | undefined;
502
+ fulfilledAt?: number | undefined;
503
+ prunedAt?: number | undefined;
504
+ rate?: number | undefined;
505
+ fiatOwed?: number | undefined;
506
+ }>, "many">;
507
+ totalAmount: z.ZodString;
508
+ filledAmount: z.ZodString;
509
+ pendingAmount: z.ZodString;
510
+ returnedAmount: z.ZodString;
511
+ nextActions: z.ZodArray<z.ZodEnum<["wait", "withdraw"]>, "many">;
512
+ primaryIntentHash: z.ZodOptional<z.ZodString>;
513
+ matchedAt: z.ZodOptional<z.ZodNumber>;
514
+ deliveredAt: z.ZodOptional<z.ZodNumber>;
515
+ updatedAt: z.ZodOptional<z.ZodNumber>;
516
+ intentCount: z.ZodOptional<z.ZodNumber>;
517
+ payouts: z.ZodOptional<z.ZodArray<z.ZodObject<{
518
+ platform: z.ZodOptional<z.ZodString>;
519
+ platformHash: z.ZodString;
520
+ currency: z.ZodOptional<z.ZodString>;
521
+ currencyHash: z.ZodOptional<z.ZodString>;
522
+ payeeHash: z.ZodString;
523
+ active: z.ZodBoolean;
524
+ pricing: z.ZodObject<{
525
+ spreadBps: z.ZodOptional<z.ZodNumber>;
526
+ kind: z.ZodOptional<z.ZodString>;
527
+ rateSource: z.ZodOptional<z.ZodString>;
528
+ oracleRate: z.ZodOptional<z.ZodNumber>;
529
+ lastOracleUpdatedAt: z.ZodOptional<z.ZodNumber>;
530
+ marketRate: z.ZodBoolean;
531
+ }, "strip", z.ZodTypeAny, {
532
+ marketRate: boolean;
533
+ spreadBps?: number | undefined;
534
+ lastOracleUpdatedAt?: number | undefined;
535
+ kind?: string | undefined;
536
+ rateSource?: string | undefined;
537
+ oracleRate?: number | undefined;
538
+ }, {
539
+ marketRate: boolean;
540
+ spreadBps?: number | undefined;
541
+ lastOracleUpdatedAt?: number | undefined;
542
+ kind?: string | undefined;
543
+ rateSource?: string | undefined;
544
+ oracleRate?: number | undefined;
545
+ }>;
546
+ }, "strip", z.ZodTypeAny, {
547
+ platformHash: string;
548
+ payeeHash: string;
549
+ active: boolean;
550
+ pricing: {
551
+ marketRate: boolean;
552
+ spreadBps?: number | undefined;
553
+ lastOracleUpdatedAt?: number | undefined;
554
+ kind?: string | undefined;
555
+ rateSource?: string | undefined;
556
+ oracleRate?: number | undefined;
557
+ };
558
+ currency?: string | undefined;
559
+ currencyHash?: string | undefined;
560
+ platform?: string | undefined;
561
+ }, {
562
+ platformHash: string;
563
+ payeeHash: string;
564
+ active: boolean;
565
+ pricing: {
566
+ marketRate: boolean;
567
+ spreadBps?: number | undefined;
568
+ lastOracleUpdatedAt?: number | undefined;
569
+ kind?: string | undefined;
570
+ rateSource?: string | undefined;
571
+ oracleRate?: number | undefined;
572
+ };
573
+ currency?: string | undefined;
574
+ currencyHash?: string | undefined;
575
+ platform?: string | undefined;
576
+ }>, "many">>;
577
+ successRateBps: z.ZodOptional<z.ZodNumber>;
578
+ isInFlight: z.ZodBoolean;
579
+ withdrawn: z.ZodOptional<z.ZodBoolean>;
580
+ }, "strip", z.ZodTypeAny, {
581
+ depositId: string;
582
+ state: "awaiting-buyer" | "matched" | "delivering" | "delivered" | "returned";
583
+ fills: {
584
+ intentHash: string;
585
+ amount: string;
586
+ status: "SIGNALED" | "FULFILLED" | "PRUNED" | "MANUALLY_RELEASED";
587
+ buyer: string;
588
+ conversionRate?: string | undefined;
589
+ isExpired?: boolean | undefined;
590
+ fillLatencySeconds?: number | undefined;
591
+ paymentId?: string | undefined;
592
+ releasedAmount?: string | undefined;
593
+ currency?: string | undefined;
594
+ currencyHash?: string | undefined;
595
+ fiatPaid?: number | undefined;
596
+ paidCurrency?: string | undefined;
597
+ paidAt?: number | undefined;
598
+ signaledAt?: number | undefined;
599
+ expiresAt?: number | undefined;
600
+ fulfilledAt?: number | undefined;
601
+ prunedAt?: number | undefined;
602
+ rate?: number | undefined;
603
+ fiatOwed?: number | undefined;
604
+ }[];
605
+ totalAmount: string;
606
+ filledAmount: string;
607
+ pendingAmount: string;
608
+ returnedAmount: string;
609
+ nextActions: ("wait" | "withdraw")[];
610
+ isInFlight: boolean;
611
+ updatedAt?: number | undefined;
612
+ successRateBps?: number | undefined;
613
+ payouts?: {
614
+ platformHash: string;
615
+ payeeHash: string;
616
+ active: boolean;
617
+ pricing: {
618
+ marketRate: boolean;
619
+ spreadBps?: number | undefined;
620
+ lastOracleUpdatedAt?: number | undefined;
621
+ kind?: string | undefined;
622
+ rateSource?: string | undefined;
623
+ oracleRate?: number | undefined;
624
+ };
625
+ currency?: string | undefined;
626
+ currencyHash?: string | undefined;
627
+ platform?: string | undefined;
628
+ }[] | undefined;
629
+ primaryIntentHash?: string | undefined;
630
+ matchedAt?: number | undefined;
631
+ deliveredAt?: number | undefined;
632
+ intentCount?: number | undefined;
633
+ withdrawn?: boolean | undefined;
634
+ }, {
635
+ depositId: string;
636
+ state: "awaiting-buyer" | "matched" | "delivering" | "delivered" | "returned";
637
+ fills: {
638
+ intentHash: string;
639
+ amount: string;
640
+ status: "SIGNALED" | "FULFILLED" | "PRUNED" | "MANUALLY_RELEASED";
641
+ buyer: string;
642
+ conversionRate?: string | undefined;
643
+ isExpired?: boolean | undefined;
644
+ fillLatencySeconds?: number | undefined;
645
+ paymentId?: string | undefined;
646
+ releasedAmount?: string | undefined;
647
+ currency?: string | undefined;
648
+ currencyHash?: string | undefined;
649
+ fiatPaid?: number | undefined;
650
+ paidCurrency?: string | undefined;
651
+ paidAt?: number | undefined;
652
+ signaledAt?: number | undefined;
653
+ expiresAt?: number | undefined;
654
+ fulfilledAt?: number | undefined;
655
+ prunedAt?: number | undefined;
656
+ rate?: number | undefined;
657
+ fiatOwed?: number | undefined;
658
+ }[];
659
+ totalAmount: string;
660
+ filledAmount: string;
661
+ pendingAmount: string;
662
+ returnedAmount: string;
663
+ nextActions: ("wait" | "withdraw")[];
664
+ isInFlight: boolean;
665
+ updatedAt?: number | undefined;
666
+ successRateBps?: number | undefined;
667
+ payouts?: {
668
+ platformHash: string;
669
+ payeeHash: string;
670
+ active: boolean;
671
+ pricing: {
672
+ marketRate: boolean;
673
+ spreadBps?: number | undefined;
674
+ lastOracleUpdatedAt?: number | undefined;
675
+ kind?: string | undefined;
676
+ rateSource?: string | undefined;
677
+ oracleRate?: number | undefined;
678
+ };
679
+ currency?: string | undefined;
680
+ currencyHash?: string | undefined;
681
+ platform?: string | undefined;
682
+ }[] | undefined;
683
+ primaryIntentHash?: string | undefined;
684
+ matchedAt?: number | undefined;
685
+ deliveredAt?: number | undefined;
686
+ intentCount?: number | undefined;
687
+ withdrawn?: boolean | undefined;
688
+ }>;
689
+ declare const cashEstimateJsonSchema: z.ZodObject<{
690
+ kind: z.ZodLiteral<"oracle-estimate">;
691
+ currency: z.ZodString;
692
+ amount: z.ZodString;
693
+ rate: z.ZodNumber;
694
+ receiveAmount: z.ZodNumber;
695
+ asOf: z.ZodNumber;
696
+ oracleUpdatedAt: z.ZodOptional<z.ZodNumber>;
697
+ stale: z.ZodOptional<z.ZodBoolean>;
698
+ }, "strip", z.ZodTypeAny, {
699
+ amount: string;
700
+ currency: string;
701
+ kind: "oracle-estimate";
702
+ rate: number;
703
+ asOf: number;
704
+ receiveAmount: number;
705
+ oracleUpdatedAt?: number | undefined;
706
+ stale?: boolean | undefined;
707
+ }, {
708
+ amount: string;
709
+ currency: string;
710
+ kind: "oracle-estimate";
711
+ rate: number;
712
+ asOf: number;
713
+ receiveAmount: number;
714
+ oracleUpdatedAt?: number | undefined;
715
+ stale?: boolean | undefined;
716
+ }>;
717
+ declare const preparedTransactionJsonSchema: z.ZodObject<{
718
+ to: z.ZodString;
719
+ data: z.ZodString;
720
+ value: z.ZodString;
721
+ chainId: z.ZodNumber;
722
+ }, "strip", z.ZodTypeAny, {
723
+ chainId: number;
724
+ data: string;
725
+ to: string;
726
+ value: string;
727
+ }, {
728
+ chainId: number;
729
+ data: string;
730
+ to: string;
731
+ value: string;
732
+ }>;
733
+ declare const cashPreparedStepJsonSchema: z.ZodObject<{
734
+ kind: z.ZodEnum<["approve", "createDeposit", "pruneExpiredIntents", "withdrawDeposit", "removeFunds", "addFunds"]>;
735
+ description: z.ZodString;
736
+ }, "strip", z.ZodTypeAny, {
737
+ kind: "createDeposit" | "approve" | "pruneExpiredIntents" | "withdrawDeposit" | "removeFunds" | "addFunds";
738
+ description: string;
739
+ }, {
740
+ kind: "createDeposit" | "approve" | "pruneExpiredIntents" | "withdrawDeposit" | "removeFunds" | "addFunds";
741
+ description: string;
742
+ }>;
743
+ declare const cashoutResultJsonSchema: z.ZodObject<{
744
+ depositId: z.ZodString;
745
+ txHash: z.ZodString;
746
+ escrowAddress: z.ZodString;
747
+ onchainDepositId: z.ZodString;
748
+ order: z.ZodObject<{
749
+ depositId: z.ZodString;
750
+ state: z.ZodEnum<["awaiting-buyer", "matched", "delivering", "delivered", "returned"]>;
751
+ fills: z.ZodArray<z.ZodObject<{
752
+ intentHash: z.ZodString;
753
+ status: z.ZodEnum<["SIGNALED", "FULFILLED", "PRUNED", "MANUALLY_RELEASED"]>;
754
+ amount: z.ZodString;
755
+ buyer: z.ZodString;
756
+ currency: z.ZodOptional<z.ZodString>;
757
+ currencyHash: z.ZodOptional<z.ZodString>;
758
+ rate: z.ZodOptional<z.ZodNumber>;
759
+ conversionRate: z.ZodOptional<z.ZodString>;
760
+ fiatOwed: z.ZodOptional<z.ZodNumber>;
761
+ fiatPaid: z.ZodOptional<z.ZodNumber>;
762
+ paidCurrency: z.ZodOptional<z.ZodString>;
763
+ paymentId: z.ZodOptional<z.ZodString>;
764
+ paidAt: z.ZodOptional<z.ZodNumber>;
765
+ releasedAmount: z.ZodOptional<z.ZodString>;
766
+ fillLatencySeconds: z.ZodOptional<z.ZodNumber>;
767
+ isExpired: z.ZodOptional<z.ZodBoolean>;
768
+ signaledAt: z.ZodOptional<z.ZodNumber>;
769
+ expiresAt: z.ZodOptional<z.ZodNumber>;
770
+ fulfilledAt: z.ZodOptional<z.ZodNumber>;
771
+ prunedAt: z.ZodOptional<z.ZodNumber>;
772
+ }, "strip", z.ZodTypeAny, {
773
+ intentHash: string;
774
+ amount: string;
775
+ status: "SIGNALED" | "FULFILLED" | "PRUNED" | "MANUALLY_RELEASED";
776
+ buyer: string;
777
+ conversionRate?: string | undefined;
778
+ isExpired?: boolean | undefined;
779
+ fillLatencySeconds?: number | undefined;
780
+ paymentId?: string | undefined;
781
+ releasedAmount?: string | undefined;
782
+ currency?: string | undefined;
783
+ currencyHash?: string | undefined;
784
+ fiatPaid?: number | undefined;
785
+ paidCurrency?: string | undefined;
786
+ paidAt?: number | undefined;
787
+ signaledAt?: number | undefined;
788
+ expiresAt?: number | undefined;
789
+ fulfilledAt?: number | undefined;
790
+ prunedAt?: number | undefined;
791
+ rate?: number | undefined;
792
+ fiatOwed?: number | undefined;
793
+ }, {
794
+ intentHash: string;
795
+ amount: string;
796
+ status: "SIGNALED" | "FULFILLED" | "PRUNED" | "MANUALLY_RELEASED";
797
+ buyer: string;
798
+ conversionRate?: string | undefined;
799
+ isExpired?: boolean | undefined;
800
+ fillLatencySeconds?: number | undefined;
801
+ paymentId?: string | undefined;
802
+ releasedAmount?: string | undefined;
803
+ currency?: string | undefined;
804
+ currencyHash?: string | undefined;
805
+ fiatPaid?: number | undefined;
806
+ paidCurrency?: string | undefined;
807
+ paidAt?: number | undefined;
808
+ signaledAt?: number | undefined;
809
+ expiresAt?: number | undefined;
810
+ fulfilledAt?: number | undefined;
811
+ prunedAt?: number | undefined;
812
+ rate?: number | undefined;
813
+ fiatOwed?: number | undefined;
814
+ }>, "many">;
815
+ totalAmount: z.ZodString;
816
+ filledAmount: z.ZodString;
817
+ pendingAmount: z.ZodString;
818
+ returnedAmount: z.ZodString;
819
+ nextActions: z.ZodArray<z.ZodEnum<["wait", "withdraw"]>, "many">;
820
+ primaryIntentHash: z.ZodOptional<z.ZodString>;
821
+ matchedAt: z.ZodOptional<z.ZodNumber>;
822
+ deliveredAt: z.ZodOptional<z.ZodNumber>;
823
+ updatedAt: z.ZodOptional<z.ZodNumber>;
824
+ intentCount: z.ZodOptional<z.ZodNumber>;
825
+ payouts: z.ZodOptional<z.ZodArray<z.ZodObject<{
826
+ platform: z.ZodOptional<z.ZodString>;
827
+ platformHash: z.ZodString;
828
+ currency: z.ZodOptional<z.ZodString>;
829
+ currencyHash: z.ZodOptional<z.ZodString>;
830
+ payeeHash: z.ZodString;
831
+ active: z.ZodBoolean;
832
+ pricing: z.ZodObject<{
833
+ spreadBps: z.ZodOptional<z.ZodNumber>;
834
+ kind: z.ZodOptional<z.ZodString>;
835
+ rateSource: z.ZodOptional<z.ZodString>;
836
+ oracleRate: z.ZodOptional<z.ZodNumber>;
837
+ lastOracleUpdatedAt: z.ZodOptional<z.ZodNumber>;
838
+ marketRate: z.ZodBoolean;
839
+ }, "strip", z.ZodTypeAny, {
840
+ marketRate: boolean;
841
+ spreadBps?: number | undefined;
842
+ lastOracleUpdatedAt?: number | undefined;
843
+ kind?: string | undefined;
844
+ rateSource?: string | undefined;
845
+ oracleRate?: number | undefined;
846
+ }, {
847
+ marketRate: boolean;
848
+ spreadBps?: number | undefined;
849
+ lastOracleUpdatedAt?: number | undefined;
850
+ kind?: string | undefined;
851
+ rateSource?: string | undefined;
852
+ oracleRate?: number | undefined;
853
+ }>;
854
+ }, "strip", z.ZodTypeAny, {
855
+ platformHash: string;
856
+ payeeHash: string;
857
+ active: boolean;
858
+ pricing: {
859
+ marketRate: boolean;
860
+ spreadBps?: number | undefined;
861
+ lastOracleUpdatedAt?: number | undefined;
862
+ kind?: string | undefined;
863
+ rateSource?: string | undefined;
864
+ oracleRate?: number | undefined;
865
+ };
866
+ currency?: string | undefined;
867
+ currencyHash?: string | undefined;
868
+ platform?: string | undefined;
869
+ }, {
870
+ platformHash: string;
871
+ payeeHash: string;
872
+ active: boolean;
873
+ pricing: {
874
+ marketRate: boolean;
875
+ spreadBps?: number | undefined;
876
+ lastOracleUpdatedAt?: number | undefined;
877
+ kind?: string | undefined;
878
+ rateSource?: string | undefined;
879
+ oracleRate?: number | undefined;
880
+ };
881
+ currency?: string | undefined;
882
+ currencyHash?: string | undefined;
883
+ platform?: string | undefined;
884
+ }>, "many">>;
885
+ successRateBps: z.ZodOptional<z.ZodNumber>;
886
+ isInFlight: z.ZodBoolean;
887
+ withdrawn: z.ZodOptional<z.ZodBoolean>;
888
+ }, "strip", z.ZodTypeAny, {
889
+ depositId: string;
890
+ state: "awaiting-buyer" | "matched" | "delivering" | "delivered" | "returned";
891
+ fills: {
892
+ intentHash: string;
893
+ amount: string;
894
+ status: "SIGNALED" | "FULFILLED" | "PRUNED" | "MANUALLY_RELEASED";
895
+ buyer: string;
896
+ conversionRate?: string | undefined;
897
+ isExpired?: boolean | undefined;
898
+ fillLatencySeconds?: number | undefined;
899
+ paymentId?: string | undefined;
900
+ releasedAmount?: string | undefined;
901
+ currency?: string | undefined;
902
+ currencyHash?: string | undefined;
903
+ fiatPaid?: number | undefined;
904
+ paidCurrency?: string | undefined;
905
+ paidAt?: number | undefined;
906
+ signaledAt?: number | undefined;
907
+ expiresAt?: number | undefined;
908
+ fulfilledAt?: number | undefined;
909
+ prunedAt?: number | undefined;
910
+ rate?: number | undefined;
911
+ fiatOwed?: number | undefined;
912
+ }[];
913
+ totalAmount: string;
914
+ filledAmount: string;
915
+ pendingAmount: string;
916
+ returnedAmount: string;
917
+ nextActions: ("wait" | "withdraw")[];
918
+ isInFlight: boolean;
919
+ updatedAt?: number | undefined;
920
+ successRateBps?: number | undefined;
921
+ payouts?: {
922
+ platformHash: string;
923
+ payeeHash: string;
924
+ active: boolean;
925
+ pricing: {
926
+ marketRate: boolean;
927
+ spreadBps?: number | undefined;
928
+ lastOracleUpdatedAt?: number | undefined;
929
+ kind?: string | undefined;
930
+ rateSource?: string | undefined;
931
+ oracleRate?: number | undefined;
932
+ };
933
+ currency?: string | undefined;
934
+ currencyHash?: string | undefined;
935
+ platform?: string | undefined;
936
+ }[] | undefined;
937
+ primaryIntentHash?: string | undefined;
938
+ matchedAt?: number | undefined;
939
+ deliveredAt?: number | undefined;
940
+ intentCount?: number | undefined;
941
+ withdrawn?: boolean | undefined;
942
+ }, {
943
+ depositId: string;
944
+ state: "awaiting-buyer" | "matched" | "delivering" | "delivered" | "returned";
945
+ fills: {
946
+ intentHash: string;
947
+ amount: string;
948
+ status: "SIGNALED" | "FULFILLED" | "PRUNED" | "MANUALLY_RELEASED";
949
+ buyer: string;
950
+ conversionRate?: string | undefined;
951
+ isExpired?: boolean | undefined;
952
+ fillLatencySeconds?: number | undefined;
953
+ paymentId?: string | undefined;
954
+ releasedAmount?: string | undefined;
955
+ currency?: string | undefined;
956
+ currencyHash?: string | undefined;
957
+ fiatPaid?: number | undefined;
958
+ paidCurrency?: string | undefined;
959
+ paidAt?: number | undefined;
960
+ signaledAt?: number | undefined;
961
+ expiresAt?: number | undefined;
962
+ fulfilledAt?: number | undefined;
963
+ prunedAt?: number | undefined;
964
+ rate?: number | undefined;
965
+ fiatOwed?: number | undefined;
966
+ }[];
967
+ totalAmount: string;
968
+ filledAmount: string;
969
+ pendingAmount: string;
970
+ returnedAmount: string;
971
+ nextActions: ("wait" | "withdraw")[];
972
+ isInFlight: boolean;
973
+ updatedAt?: number | undefined;
974
+ successRateBps?: number | undefined;
975
+ payouts?: {
976
+ platformHash: string;
977
+ payeeHash: string;
978
+ active: boolean;
979
+ pricing: {
980
+ marketRate: boolean;
981
+ spreadBps?: number | undefined;
982
+ lastOracleUpdatedAt?: number | undefined;
983
+ kind?: string | undefined;
984
+ rateSource?: string | undefined;
985
+ oracleRate?: number | undefined;
986
+ };
987
+ currency?: string | undefined;
988
+ currencyHash?: string | undefined;
989
+ platform?: string | undefined;
990
+ }[] | undefined;
991
+ primaryIntentHash?: string | undefined;
992
+ matchedAt?: number | undefined;
993
+ deliveredAt?: number | undefined;
994
+ intentCount?: number | undefined;
995
+ withdrawn?: boolean | undefined;
996
+ }>;
997
+ }, "strip", z.ZodTypeAny, {
998
+ depositId: string;
999
+ escrowAddress: string;
1000
+ txHash: string;
1001
+ onchainDepositId: string;
1002
+ order: {
1003
+ depositId: string;
1004
+ state: "awaiting-buyer" | "matched" | "delivering" | "delivered" | "returned";
1005
+ fills: {
1006
+ intentHash: string;
1007
+ amount: string;
1008
+ status: "SIGNALED" | "FULFILLED" | "PRUNED" | "MANUALLY_RELEASED";
1009
+ buyer: string;
1010
+ conversionRate?: string | undefined;
1011
+ isExpired?: boolean | undefined;
1012
+ fillLatencySeconds?: number | undefined;
1013
+ paymentId?: string | undefined;
1014
+ releasedAmount?: string | undefined;
1015
+ currency?: string | undefined;
1016
+ currencyHash?: string | undefined;
1017
+ fiatPaid?: number | undefined;
1018
+ paidCurrency?: string | undefined;
1019
+ paidAt?: number | undefined;
1020
+ signaledAt?: number | undefined;
1021
+ expiresAt?: number | undefined;
1022
+ fulfilledAt?: number | undefined;
1023
+ prunedAt?: number | undefined;
1024
+ rate?: number | undefined;
1025
+ fiatOwed?: number | undefined;
1026
+ }[];
1027
+ totalAmount: string;
1028
+ filledAmount: string;
1029
+ pendingAmount: string;
1030
+ returnedAmount: string;
1031
+ nextActions: ("wait" | "withdraw")[];
1032
+ isInFlight: boolean;
1033
+ updatedAt?: number | undefined;
1034
+ successRateBps?: number | undefined;
1035
+ payouts?: {
1036
+ platformHash: string;
1037
+ payeeHash: string;
1038
+ active: boolean;
1039
+ pricing: {
1040
+ marketRate: boolean;
1041
+ spreadBps?: number | undefined;
1042
+ lastOracleUpdatedAt?: number | undefined;
1043
+ kind?: string | undefined;
1044
+ rateSource?: string | undefined;
1045
+ oracleRate?: number | undefined;
1046
+ };
1047
+ currency?: string | undefined;
1048
+ currencyHash?: string | undefined;
1049
+ platform?: string | undefined;
1050
+ }[] | undefined;
1051
+ primaryIntentHash?: string | undefined;
1052
+ matchedAt?: number | undefined;
1053
+ deliveredAt?: number | undefined;
1054
+ intentCount?: number | undefined;
1055
+ withdrawn?: boolean | undefined;
1056
+ };
1057
+ }, {
1058
+ depositId: string;
1059
+ escrowAddress: string;
1060
+ txHash: string;
1061
+ onchainDepositId: string;
1062
+ order: {
1063
+ depositId: string;
1064
+ state: "awaiting-buyer" | "matched" | "delivering" | "delivered" | "returned";
1065
+ fills: {
1066
+ intentHash: string;
1067
+ amount: string;
1068
+ status: "SIGNALED" | "FULFILLED" | "PRUNED" | "MANUALLY_RELEASED";
1069
+ buyer: string;
1070
+ conversionRate?: string | undefined;
1071
+ isExpired?: boolean | undefined;
1072
+ fillLatencySeconds?: number | undefined;
1073
+ paymentId?: string | undefined;
1074
+ releasedAmount?: string | undefined;
1075
+ currency?: string | undefined;
1076
+ currencyHash?: string | undefined;
1077
+ fiatPaid?: number | undefined;
1078
+ paidCurrency?: string | undefined;
1079
+ paidAt?: number | undefined;
1080
+ signaledAt?: number | undefined;
1081
+ expiresAt?: number | undefined;
1082
+ fulfilledAt?: number | undefined;
1083
+ prunedAt?: number | undefined;
1084
+ rate?: number | undefined;
1085
+ fiatOwed?: number | undefined;
1086
+ }[];
1087
+ totalAmount: string;
1088
+ filledAmount: string;
1089
+ pendingAmount: string;
1090
+ returnedAmount: string;
1091
+ nextActions: ("wait" | "withdraw")[];
1092
+ isInFlight: boolean;
1093
+ updatedAt?: number | undefined;
1094
+ successRateBps?: number | undefined;
1095
+ payouts?: {
1096
+ platformHash: string;
1097
+ payeeHash: string;
1098
+ active: boolean;
1099
+ pricing: {
1100
+ marketRate: boolean;
1101
+ spreadBps?: number | undefined;
1102
+ lastOracleUpdatedAt?: number | undefined;
1103
+ kind?: string | undefined;
1104
+ rateSource?: string | undefined;
1105
+ oracleRate?: number | undefined;
1106
+ };
1107
+ currency?: string | undefined;
1108
+ currencyHash?: string | undefined;
1109
+ platform?: string | undefined;
1110
+ }[] | undefined;
1111
+ primaryIntentHash?: string | undefined;
1112
+ matchedAt?: number | undefined;
1113
+ deliveredAt?: number | undefined;
1114
+ intentCount?: number | undefined;
1115
+ withdrawn?: boolean | undefined;
1116
+ };
1117
+ }>;
1118
+ declare const prepareResultJsonSchema: z.ZodObject<{
1119
+ txs: z.ZodArray<z.ZodObject<{
1120
+ to: z.ZodString;
1121
+ data: z.ZodString;
1122
+ value: z.ZodString;
1123
+ chainId: z.ZodNumber;
1124
+ }, "strip", z.ZodTypeAny, {
1125
+ chainId: number;
1126
+ data: string;
1127
+ to: string;
1128
+ value: string;
1129
+ }, {
1130
+ chainId: number;
1131
+ data: string;
1132
+ to: string;
1133
+ value: string;
1134
+ }>, "many">;
1135
+ steps: z.ZodArray<z.ZodObject<{
1136
+ kind: z.ZodEnum<["approve", "createDeposit", "pruneExpiredIntents", "withdrawDeposit", "removeFunds", "addFunds"]>;
1137
+ description: z.ZodString;
1138
+ }, "strip", z.ZodTypeAny, {
1139
+ kind: "createDeposit" | "approve" | "pruneExpiredIntents" | "withdrawDeposit" | "removeFunds" | "addFunds";
1140
+ description: string;
1141
+ }, {
1142
+ kind: "createDeposit" | "approve" | "pruneExpiredIntents" | "withdrawDeposit" | "removeFunds" | "addFunds";
1143
+ description: string;
1144
+ }>, "many">;
1145
+ register: z.ZodObject<{
1146
+ hashedOnchainIds: z.ZodArray<z.ZodString, "many">;
1147
+ }, "strip", z.ZodTypeAny, {
1148
+ hashedOnchainIds: string[];
1149
+ }, {
1150
+ hashedOnchainIds: string[];
1151
+ }>;
1152
+ }, "strip", z.ZodTypeAny, {
1153
+ txs: {
1154
+ chainId: number;
1155
+ data: string;
1156
+ to: string;
1157
+ value: string;
1158
+ }[];
1159
+ steps: {
1160
+ kind: "createDeposit" | "approve" | "pruneExpiredIntents" | "withdrawDeposit" | "removeFunds" | "addFunds";
1161
+ description: string;
1162
+ }[];
1163
+ register: {
1164
+ hashedOnchainIds: string[];
1165
+ };
1166
+ }, {
1167
+ txs: {
1168
+ chainId: number;
1169
+ data: string;
1170
+ to: string;
1171
+ value: string;
1172
+ }[];
1173
+ steps: {
1174
+ kind: "createDeposit" | "approve" | "pruneExpiredIntents" | "withdrawDeposit" | "removeFunds" | "addFunds";
1175
+ description: string;
1176
+ }[];
1177
+ register: {
1178
+ hashedOnchainIds: string[];
1179
+ };
1180
+ }>;
1181
+ declare const withdrawResultJsonSchema: z.ZodObject<{
1182
+ depositId: z.ZodString;
1183
+ pruneTxHash: z.ZodOptional<z.ZodString>;
1184
+ withdrawTxHash: z.ZodString;
1185
+ }, "strip", z.ZodTypeAny, {
1186
+ depositId: string;
1187
+ withdrawTxHash: string;
1188
+ pruneTxHash?: string | undefined;
1189
+ }, {
1190
+ depositId: string;
1191
+ withdrawTxHash: string;
1192
+ pruneTxHash?: string | undefined;
1193
+ }>;
1194
+ declare const topUpResultJsonSchema: z.ZodObject<{
1195
+ depositId: z.ZodString;
1196
+ txHash: z.ZodString;
1197
+ }, "strip", z.ZodTypeAny, {
1198
+ depositId: string;
1199
+ txHash: string;
1200
+ }, {
1201
+ depositId: string;
1202
+ txHash: string;
1203
+ }>;
1204
+ declare const cashCapabilitiesJsonSchema: z.ZodObject<{
1205
+ chainId: z.ZodNumber;
1206
+ token: z.ZodObject<{
1207
+ address: z.ZodString;
1208
+ symbol: z.ZodLiteral<"USDC">;
1209
+ decimals: z.ZodNumber;
1210
+ }, "strip", z.ZodTypeAny, {
1211
+ symbol: "USDC";
1212
+ address: string;
1213
+ decimals: number;
1214
+ }, {
1215
+ symbol: "USDC";
1216
+ address: string;
1217
+ decimals: number;
1218
+ }>;
1219
+ environment: z.ZodEnum<["production", "preproduction", "staging"]>;
1220
+ platforms: z.ZodArray<z.ZodObject<{
1221
+ platform: z.ZodString;
1222
+ currencies: z.ZodArray<z.ZodString, "many">;
1223
+ payeeHint: z.ZodString;
1224
+ requiresIdentityAttestation: z.ZodBoolean;
1225
+ }, "strip", z.ZodTypeAny, {
1226
+ platform: string;
1227
+ currencies: string[];
1228
+ payeeHint: string;
1229
+ requiresIdentityAttestation: boolean;
1230
+ }, {
1231
+ platform: string;
1232
+ currencies: string[];
1233
+ payeeHint: string;
1234
+ requiresIdentityAttestation: boolean;
1235
+ }>, "many">;
1236
+ currencies: z.ZodArray<z.ZodString, "many">;
1237
+ amount: z.ZodObject<{
1238
+ min: z.ZodString;
1239
+ recommendedMin: z.ZodString;
1240
+ max: z.ZodNull;
1241
+ }, "strip", z.ZodTypeAny, {
1242
+ min: string;
1243
+ recommendedMin: string;
1244
+ max: null;
1245
+ }, {
1246
+ min: string;
1247
+ recommendedMin: string;
1248
+ max: null;
1249
+ }>;
1250
+ pricing: z.ZodObject<{
1251
+ kind: z.ZodLiteral<"oracle-market-rate">;
1252
+ spreadBps: z.ZodLiteral<0>;
1253
+ }, "strip", z.ZodTypeAny, {
1254
+ spreadBps: 0;
1255
+ kind: "oracle-market-rate";
1256
+ }, {
1257
+ spreadBps: 0;
1258
+ kind: "oracle-market-rate";
1259
+ }>;
1260
+ }, "strip", z.ZodTypeAny, {
1261
+ amount: {
1262
+ min: string;
1263
+ recommendedMin: string;
1264
+ max: null;
1265
+ };
1266
+ chainId: number;
1267
+ token: {
1268
+ symbol: "USDC";
1269
+ address: string;
1270
+ decimals: number;
1271
+ };
1272
+ environment: "production" | "preproduction" | "staging";
1273
+ currencies: string[];
1274
+ pricing: {
1275
+ spreadBps: 0;
1276
+ kind: "oracle-market-rate";
1277
+ };
1278
+ platforms: {
1279
+ platform: string;
1280
+ currencies: string[];
1281
+ payeeHint: string;
1282
+ requiresIdentityAttestation: boolean;
1283
+ }[];
1284
+ }, {
1285
+ amount: {
1286
+ min: string;
1287
+ recommendedMin: string;
1288
+ max: null;
1289
+ };
1290
+ chainId: number;
1291
+ token: {
1292
+ symbol: "USDC";
1293
+ address: string;
1294
+ decimals: number;
1295
+ };
1296
+ environment: "production" | "preproduction" | "staging";
1297
+ currencies: string[];
1298
+ pricing: {
1299
+ spreadBps: 0;
1300
+ kind: "oracle-market-rate";
1301
+ };
1302
+ platforms: {
1303
+ platform: string;
1304
+ currencies: string[];
1305
+ payeeHint: string;
1306
+ requiresIdentityAttestation: boolean;
1307
+ }[];
1308
+ }>;
1309
+ declare const cashErrorJsonSchema: z.ZodObject<{
1310
+ code: z.ZodString;
1311
+ message: z.ZodString;
1312
+ retryable: z.ZodBoolean;
1313
+ remediation: z.ZodString;
1314
+ }, "strip", z.ZodTypeAny, {
1315
+ code: string;
1316
+ message: string;
1317
+ retryable: boolean;
1318
+ remediation: string;
1319
+ }, {
1320
+ code: string;
1321
+ message: string;
1322
+ retryable: boolean;
1323
+ remediation: string;
1324
+ }>;
1325
+ type CashOrderJson = z.infer<typeof cashOrderJsonSchema>;
1326
+ type CashFillJson = z.infer<typeof cashFillJsonSchema>;
1327
+ type CashEstimateJson = z.infer<typeof cashEstimateJsonSchema>;
1328
+ type PreparedTransactionJson = z.infer<typeof preparedTransactionJsonSchema>;
1329
+ type CashoutResultJson = z.infer<typeof cashoutResultJsonSchema>;
1330
+ type PrepareResultJson = z.infer<typeof prepareResultJsonSchema>;
1331
+ type WithdrawResultJson = z.infer<typeof withdrawResultJsonSchema>;
1332
+ type TopUpResultJson = z.infer<typeof topUpResultJsonSchema>;
1333
+ type CashPreparedStepJson = z.infer<typeof cashPreparedStepJsonSchema>;
1334
+ type CashPayoutInfoJson = z.infer<typeof cashPayoutInfoJsonSchema>;
1335
+ type CashBuyerProfileJson = z.infer<typeof cashBuyerProfileJsonSchema>;
1336
+ type CashCapabilitiesJson = z.infer<typeof cashCapabilitiesJsonSchema>;
1337
+
1338
+ /**
1339
+ * JSON codecs - lossless (de)serialization for every wire type. bigints encode
1340
+ * as decimal strings; `parse*` validates with the zod schema and re-attaches
1341
+ * derived behavior (`order.explain()`).
1342
+ */
1343
+
1344
+ declare function fillToJson(fill: CashFill): CashFillJson;
1345
+ declare function fillFromJson(json: CashFillJson): CashFill;
1346
+ declare function orderToJson(order: CashOrder): CashOrderJson;
1347
+ declare function orderFromJson(json: unknown): CashOrder;
1348
+ declare function estimateToJson(estimate: CashEstimate): CashEstimateJson;
1349
+ declare function estimateFromJson(json: unknown): CashEstimate;
1350
+ declare function preparedTxToJson(tx: PreparedTransaction): PreparedTransactionJson;
1351
+ declare function preparedTxFromJson(json: unknown): PreparedTransaction;
1352
+ declare function preparedStepToJson(step: CashPreparedStep): CashPreparedStepJson;
1353
+ declare function preparedStepFromJson(json: unknown): CashPreparedStep;
1354
+ declare function cashoutResultToJson(result: CashoutResult): CashoutResultJson;
1355
+ declare function cashoutResultFromJson(json: unknown): CashoutResult;
1356
+ declare function prepareResultToJson(result: PrepareResult): PrepareResultJson;
1357
+ declare function prepareResultFromJson(json: unknown): PrepareResult;
1358
+ declare function withdrawResultToJson(result: WithdrawResult): WithdrawResultJson;
1359
+ declare function withdrawResultFromJson(json: unknown): WithdrawResult;
1360
+ declare function buyerProfileToJson(profile: CashBuyerProfile): CashBuyerProfileJson;
1361
+ declare function buyerProfileFromJson(json: unknown): CashBuyerProfile;
1362
+ declare function topUpResultToJson(result: TopUpResult): TopUpResultJson;
1363
+ declare function topUpResultFromJson(json: unknown): TopUpResult;
1364
+ declare function capabilitiesToJson(caps: CashCapabilities): CashCapabilitiesJson;
1365
+ declare function capabilitiesFromJson(json: unknown): CashCapabilities;
1366
+
1367
+ export { BASE_CHAIN_ID, BASE_USDC_ADDRESS, CASH_ORDER_POLL_INTERVAL_MS, CASH_ORDER_STATUSES, CASH_RETAIN_ON_EMPTY, CashBuyerProfile, type CashBuyerProfileJson, CashCapabilities, type CashCapabilitiesJson, CashDepositInput, CashError, type CashErrorCode, type CashErrorShape, CashEstimate, type CashEstimateJson, CashFill, type CashFillJson, CashOrder, type CashOrderData, type CashOrderJson, CashPayoutInfo, type CashPayoutInfoJson, CashPreparedStep, type CashPreparedStepJson, CashoutResult, type CashoutResultJson, type DeriveCashOrderOptions, MARKET_SPREAD_BPS, type MethodCurrencyLike, ORACLE_MIN_CONVERSION_RATE_SENTINEL, type PaymentMethodLike, PrepareResult, type PrepareResultJson, type PreparedTransactionJson, RATE_PRECISION, type ResolvedCashDeposit, TopUpResult, type TopUpResultJson, USDC_DECIMALS, WithdrawResult, type WithdrawResultJson, bigintString, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashErrorJsonSchema, cashEstimateJsonSchema, cashFillJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, deriveBuyerProfile, deriveCashOrder, derivePayouts, errors, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillToJson, formatUsdc, intentStatusSchema, isCashError, isFillLive, isMarketRateSupported, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, rateToNumber, resolveCashDepositId, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };