@usdctofiat/offramp 3.0.2 → 3.1.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/CHANGELOG.md +21 -0
- package/README.md +129 -24
- package/dist/{chunk-F7DVUBMT.js → chunk-XQ7HOLLB.js} +390 -445
- package/dist/chunk-XQ7HOLLB.js.map +1 -0
- package/dist/errors-DzTiflBh.d.cts +409 -0
- package/dist/errors-DzTiflBh.d.ts +409 -0
- package/dist/index.cjs +408 -441
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -5
- package/dist/index.d.ts +9 -5
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +481 -460
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +23 -13
- package/dist/react.d.ts +23 -13
- package/dist/react.js +106 -27
- package/dist/react.js.map +1 -1
- package/package.json +5 -3
- package/dist/chunk-F7DVUBMT.js.map +0 -1
- package/dist/errors-DKQ2N_ih.d.cts +0 -217
- package/dist/errors-DKQ2N_ih.d.ts +0 -217
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { PeerOnrampPreparedTransactionCallback, PeerOnrampPreparedTransactionResult, PeerExtensionOnrampParams, CuratorSellerCredentialUploadResponse, currencyInfo } from '@zkp2p/sdk';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Peer browser-extension surface for PayPal + Wise makers. Drive the
|
|
5
|
+
* headless metadata bridge via `usePeerExtensionRegistration` in
|
|
6
|
+
* `@usdctofiat/offramp/react`, or manually:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import {
|
|
10
|
+
* completePeerExtensionRegistration,
|
|
11
|
+
* isPeerExtensionMetadataBridgeAvailable,
|
|
12
|
+
* peerExtensionSdk,
|
|
13
|
+
* } from "@usdctofiat/offramp";
|
|
14
|
+
*
|
|
15
|
+
* const state = await peerExtensionSdk.getState();
|
|
16
|
+
* if (state === "needs_install" || !isPeerExtensionMetadataBridgeAvailable()) {
|
|
17
|
+
* peerExtensionSdk.openInstallPage();
|
|
18
|
+
* } else if (state === "needs_connection") {
|
|
19
|
+
* await peerExtensionSdk.requestConnection();
|
|
20
|
+
* } else {
|
|
21
|
+
* peerExtensionSdk.authenticate({
|
|
22
|
+
* actionType: "transfer_paypal",
|
|
23
|
+
* captureMode: "sellerCredential",
|
|
24
|
+
* platform: "paypal",
|
|
25
|
+
* });
|
|
26
|
+
* // Pass the captured metadata to completePeerExtensionRegistration(...), then retry.
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
type PeerConnectionStatus = "connected" | "disconnected" | "pending";
|
|
32
|
+
type PeerMetadataCaptureMode = "buyerTee" | "sellerCredential";
|
|
33
|
+
type PeerMetadataProviderConfig = Record<string, unknown>;
|
|
34
|
+
type PeerAuthenticateParams = {
|
|
35
|
+
actionType: string;
|
|
36
|
+
attestationActionType?: string | null;
|
|
37
|
+
attestationServiceUrl?: string | null;
|
|
38
|
+
captureMode?: PeerMetadataCaptureMode;
|
|
39
|
+
platform: string;
|
|
40
|
+
providerConfig?: PeerMetadataProviderConfig;
|
|
41
|
+
};
|
|
42
|
+
type PeerBuyerTeePaymentParams = Record<string, string | number | boolean>;
|
|
43
|
+
type PeerBuyerTeePaymentCapture = {
|
|
44
|
+
encryptedSessionMaterial: string;
|
|
45
|
+
params?: PeerBuyerTeePaymentParams[];
|
|
46
|
+
};
|
|
47
|
+
type PeerSarCredentialBundle = {
|
|
48
|
+
bundleSignature: string;
|
|
49
|
+
credentialExpiresAt: string | null;
|
|
50
|
+
credentialType: string;
|
|
51
|
+
credentialValidatedAt: string;
|
|
52
|
+
encryptedBlob: string;
|
|
53
|
+
encryptedDataKey: string;
|
|
54
|
+
nonce: string;
|
|
55
|
+
payeeIdHash: `0x${string}`;
|
|
56
|
+
platform: string;
|
|
57
|
+
};
|
|
58
|
+
type PeerSarCredentialCapture = {
|
|
59
|
+
credentialBundle: PeerSarCredentialBundle;
|
|
60
|
+
offchainId: string;
|
|
61
|
+
};
|
|
62
|
+
type PeerMetadataRow = {
|
|
63
|
+
amount?: string;
|
|
64
|
+
currency?: string;
|
|
65
|
+
date?: string;
|
|
66
|
+
hidden: boolean;
|
|
67
|
+
originalIndex: number;
|
|
68
|
+
params?: PeerBuyerTeePaymentParams;
|
|
69
|
+
paymentId?: string;
|
|
70
|
+
recipient?: string;
|
|
71
|
+
[key: string]: unknown;
|
|
72
|
+
};
|
|
73
|
+
type PeerMetadataMessage = {
|
|
74
|
+
buyerTeeCapture?: PeerBuyerTeePaymentCapture | null;
|
|
75
|
+
errorMessage?: string;
|
|
76
|
+
expiresAt: number;
|
|
77
|
+
metadata: PeerMetadataRow[];
|
|
78
|
+
platform: string;
|
|
79
|
+
requestId: string;
|
|
80
|
+
sarCredentialCapture?: PeerSarCredentialCapture | null;
|
|
81
|
+
};
|
|
82
|
+
type PeerMetadataMessageCallback = (message: PeerMetadataMessage) => void;
|
|
83
|
+
type PeerExtensionApi = {
|
|
84
|
+
requestConnection(): Promise<boolean>;
|
|
85
|
+
checkConnectionStatus(): Promise<PeerConnectionStatus>;
|
|
86
|
+
getVersion(): Promise<string>;
|
|
87
|
+
authenticate?: (params: PeerAuthenticateParams) => void;
|
|
88
|
+
onMetadataMessage?: (callback: PeerMetadataMessageCallback) => () => void;
|
|
89
|
+
openSidebar?: (route: string) => void;
|
|
90
|
+
onramp?: (queryString: string, callback: PeerOnrampPreparedTransactionCallback) => void;
|
|
91
|
+
getOnrampTransaction?: (intentHash: string) => Promise<PeerOnrampPreparedTransactionResult | null>;
|
|
92
|
+
};
|
|
93
|
+
type PeerExtensionWindow = Window & {
|
|
94
|
+
peer?: PeerExtensionApi;
|
|
95
|
+
};
|
|
96
|
+
type PeerExtensionSdkOptions = {
|
|
97
|
+
window?: PeerExtensionWindow;
|
|
98
|
+
};
|
|
99
|
+
type PeerExtensionSdk = {
|
|
100
|
+
requestConnection(): Promise<boolean>;
|
|
101
|
+
checkConnectionStatus(): Promise<PeerConnectionStatus>;
|
|
102
|
+
getVersion(): Promise<string>;
|
|
103
|
+
authenticate(params: PeerAuthenticateParams): void;
|
|
104
|
+
onMetadataMessage(callback: PeerMetadataMessageCallback): () => void;
|
|
105
|
+
openSidebar(route: string): void;
|
|
106
|
+
onramp(params: PeerExtensionOnrampParams, callback: PeerOnrampPreparedTransactionCallback): void;
|
|
107
|
+
getOnrampTransaction(intentHash: string): Promise<PeerOnrampPreparedTransactionResult | null>;
|
|
108
|
+
isAvailable(): boolean;
|
|
109
|
+
openInstallPage(): void;
|
|
110
|
+
getState(): Promise<PeerExtensionState>;
|
|
111
|
+
};
|
|
112
|
+
type PeerExtensionState = "needs_install" | "needs_connection" | "ready";
|
|
113
|
+
declare const isPeerExtensionAvailable: (options?: PeerExtensionSdkOptions) => boolean;
|
|
114
|
+
declare const isPeerExtensionMetadataBridgeAvailable: (options?: PeerExtensionSdkOptions) => boolean;
|
|
115
|
+
declare const openPeerExtensionInstallPage: (options?: PeerExtensionSdkOptions) => void;
|
|
116
|
+
declare const getPeerExtensionState: (options?: PeerExtensionSdkOptions) => Promise<PeerExtensionState>;
|
|
117
|
+
declare const createPeerExtensionSdk: (options?: PeerExtensionSdkOptions) => PeerExtensionSdk;
|
|
118
|
+
declare const peerExtensionSdk: PeerExtensionSdk;
|
|
119
|
+
|
|
120
|
+
type PlatformId = "venmo" | "cashapp" | "chime" | "revolut" | "wise" | "mercadopago" | "zelle" | "paypal" | "monzo" | "n26" | "luxon";
|
|
121
|
+
/**
|
|
122
|
+
* Extension pre-registration requirement for a platform. When present,
|
|
123
|
+
* curator's `/v2/makers/create` rejects the maker until the user has
|
|
124
|
+
* registered their handle with PeerAuth.
|
|
125
|
+
*/
|
|
126
|
+
interface PeerExtensionRegistrationInfo {
|
|
127
|
+
/** Peer extension provider id. */
|
|
128
|
+
readonly providerId: string;
|
|
129
|
+
/** Message shown to the user when curator rejects the maker. */
|
|
130
|
+
readonly requiredPrompt: string;
|
|
131
|
+
/** Label for the registration CTA. */
|
|
132
|
+
readonly ctaLabel: string;
|
|
133
|
+
/** Optional subtext (e.g. PayPal Business disclaimer). */
|
|
134
|
+
readonly ctaSubtext?: string;
|
|
135
|
+
/** Minimum Peer extension version required. */
|
|
136
|
+
readonly minExtensionVersion: string;
|
|
137
|
+
}
|
|
138
|
+
interface PlatformEntry {
|
|
139
|
+
readonly id: PlatformId;
|
|
140
|
+
readonly name: string;
|
|
141
|
+
readonly currencies: readonly string[];
|
|
142
|
+
readonly identifier: {
|
|
143
|
+
readonly label: string;
|
|
144
|
+
readonly placeholder: string;
|
|
145
|
+
readonly help: string;
|
|
146
|
+
};
|
|
147
|
+
/** Set for platforms that require Peer extension registration (PayPal, Wise). */
|
|
148
|
+
readonly extensionRegistration?: PeerExtensionRegistrationInfo;
|
|
149
|
+
validate(input: string): {
|
|
150
|
+
valid: boolean;
|
|
151
|
+
normalized: string;
|
|
152
|
+
error?: string;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Extracts the bare PayPal.me username from any accepted input shape
|
|
157
|
+
* (`paypal.me/user`, `https://paypal.me/user`, `@user`, `user`). Mirrors the
|
|
158
|
+
* upstream zkp2p-clients normalizer so our offchainId hashes identically.
|
|
159
|
+
*/
|
|
160
|
+
declare function normalizePaypalMeUsername(value: string): string;
|
|
161
|
+
/**
|
|
162
|
+
* Validates an IBAN using the MOD-97 algorithm (ISO 13616), mirroring
|
|
163
|
+
* curator's N26 processor so a malformed-but-well-formed IBAN is rejected
|
|
164
|
+
* client-side before the maker approves USDC + pays gas. Expects no spaces
|
|
165
|
+
* (the n26 transform strips them and uppercases first).
|
|
166
|
+
*/
|
|
167
|
+
declare function isValidIBAN(iban: string): boolean;
|
|
168
|
+
/** All supported payment platforms. Access via `PLATFORMS.REVOLUT`, `PLATFORMS.WISE`, etc. */
|
|
169
|
+
declare const PLATFORMS: {
|
|
170
|
+
readonly VENMO: PlatformEntry;
|
|
171
|
+
readonly CASHAPP: PlatformEntry;
|
|
172
|
+
readonly CHIME: PlatformEntry;
|
|
173
|
+
readonly REVOLUT: PlatformEntry;
|
|
174
|
+
readonly WISE: PlatformEntry;
|
|
175
|
+
readonly MERCADO_PAGO: PlatformEntry;
|
|
176
|
+
readonly ZELLE: PlatformEntry;
|
|
177
|
+
readonly PAYPAL: PlatformEntry;
|
|
178
|
+
readonly MONZO: PlatformEntry;
|
|
179
|
+
readonly N26: PlatformEntry;
|
|
180
|
+
readonly LUXON: PlatformEntry;
|
|
181
|
+
};
|
|
182
|
+
/** Platform key type for PLATFORMS constant. */
|
|
183
|
+
type PlatformKey = keyof typeof PLATFORMS;
|
|
184
|
+
/** Taker account tiers curator gates fills behind, lowest → highest. */
|
|
185
|
+
type PlatformTier = "PEASANT" | "PEER" | "PLUS" | "PRO" | "PLATINUM";
|
|
186
|
+
interface PlatformLimits {
|
|
187
|
+
/**
|
|
188
|
+
* Hard per-platform max fill (USD) curator enforces regardless of taker
|
|
189
|
+
* tier. Omitted when a platform has no absolute cap — its effective limit is
|
|
190
|
+
* `capMultiplier × tierCap`, which depends on the taker's tier and so can't
|
|
191
|
+
* be known when a maker creates a deposit.
|
|
192
|
+
*/
|
|
193
|
+
readonly platformCapUsd?: number;
|
|
194
|
+
/**
|
|
195
|
+
* Minimum taker account tier curator requires to fill on this platform.
|
|
196
|
+
* Omitted when any tier may fill.
|
|
197
|
+
*/
|
|
198
|
+
readonly minTier?: PlatformTier;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Per-platform constraints mirrored from curator's `PLATFORM_RISK_CONFIG`
|
|
202
|
+
* (curator `platformRisk.ts`). ONLY the absolute, tier-independent rules are
|
|
203
|
+
* mirrored: PayPal's PLUS-tier gate and the hard Venmo / N26 caps. Per-tier
|
|
204
|
+
* effective caps are intentionally excluded — they're `capMultiplier × tierCap`
|
|
205
|
+
* and depend on the taker, not the maker. Curator exposes no public "list
|
|
206
|
+
* limits" endpoint, so this static mirror can drift if a PeerHQ admin changes
|
|
207
|
+
* a value; treat as an advisory hint, never as enforcement — curator remains
|
|
208
|
+
* the source of truth at intent-signing time.
|
|
209
|
+
*/
|
|
210
|
+
declare const PLATFORM_LIMITS: Partial<Record<PlatformId, PlatformLimits>>;
|
|
211
|
+
/** Returns curator's constraints for a platform id, or null if unconstrained. */
|
|
212
|
+
declare function getPlatformLimits(platform: string): PlatformLimits | null;
|
|
213
|
+
/** Flat payload accepted by `POST /v2/makers/create`. */
|
|
214
|
+
interface PayeeDepositData {
|
|
215
|
+
offchainId: string;
|
|
216
|
+
telegramUsername?: string;
|
|
217
|
+
metadata?: Record<string, unknown>;
|
|
218
|
+
}
|
|
219
|
+
interface CompletePeerExtensionRegistrationInput {
|
|
220
|
+
readonly platform: PlatformEntry;
|
|
221
|
+
readonly identifier: string;
|
|
222
|
+
readonly capturedMetadata: PeerMetadataMessage;
|
|
223
|
+
}
|
|
224
|
+
interface CompletePeerExtensionRegistrationResult {
|
|
225
|
+
readonly processorName: "paypal" | "wise";
|
|
226
|
+
readonly offchainId: string;
|
|
227
|
+
readonly hashedOnchainId: string;
|
|
228
|
+
readonly sellerCredentialResponse: CuratorSellerCredentialUploadResponse;
|
|
229
|
+
readonly sellerCredentialStatus: CuratorSellerCredentialUploadResponse["responseObject"];
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Returns the extension-registration metadata for a platform, or `null` if
|
|
233
|
+
* the platform does not require Peer-extension pre-registration. Use this to
|
|
234
|
+
* decide whether to surface an "Install / Connect Peer Extension" CTA in
|
|
235
|
+
* your UI before calling `offramp()` for PayPal or Wise.
|
|
236
|
+
*/
|
|
237
|
+
declare function getPeerExtensionRegistrationInfo(platform: string): PeerExtensionRegistrationInfo | null;
|
|
238
|
+
declare function getPeerExtensionRegistrationAuthParams(platform: string, options?: {
|
|
239
|
+
attestationServiceUrl?: string | null;
|
|
240
|
+
}): PeerAuthenticateParams | null;
|
|
241
|
+
declare function completePeerExtensionRegistration(input: CompletePeerExtensionRegistrationInput): Promise<CompletePeerExtensionRegistrationResult>;
|
|
242
|
+
/**
|
|
243
|
+
* True when a failed `/v2/makers/create` response should be treated as
|
|
244
|
+
* "maker needs to register in the Peer extension first". Platforms without
|
|
245
|
+
* an `extensionRegistration` config always return false. A 400 on a
|
|
246
|
+
* registration-required platform is treated as registration required, and
|
|
247
|
+
* so is any response whose message contains curator's phrasing.
|
|
248
|
+
*/
|
|
249
|
+
declare function isPeerExtensionRegistrationError(platform: string, message?: string | null, statusCode?: number | null): boolean;
|
|
250
|
+
|
|
251
|
+
interface CurrencyEntry {
|
|
252
|
+
readonly code: string;
|
|
253
|
+
readonly name: string;
|
|
254
|
+
readonly symbol: string;
|
|
255
|
+
readonly countryCode: string;
|
|
256
|
+
}
|
|
257
|
+
type CurrencyMap = {
|
|
258
|
+
readonly [K in keyof typeof currencyInfo]: CurrencyEntry;
|
|
259
|
+
};
|
|
260
|
+
/** All supported currencies with metadata. Access via `CURRENCIES.EUR.symbol` etc. */
|
|
261
|
+
declare const CURRENCIES: CurrencyMap;
|
|
262
|
+
|
|
263
|
+
declare const OFFRAMP_ERROR_CODES: {
|
|
264
|
+
readonly VALIDATION: "VALIDATION";
|
|
265
|
+
readonly APPROVAL_FAILED: "APPROVAL_FAILED";
|
|
266
|
+
readonly REGISTRATION_FAILED: "REGISTRATION_FAILED";
|
|
267
|
+
/**
|
|
268
|
+
* Curator rejected the maker because the user has not registered this
|
|
269
|
+
* handle in the Peer extension yet. Thrown from `offramp()` for PayPal
|
|
270
|
+
* and Wise when `/v2/makers/create` returns 400 or a "creating the maker"
|
|
271
|
+
* message. Recover by prompting the user through the Peer extension via
|
|
272
|
+
* `usePeerExtensionRegistration(platform)` (React) or
|
|
273
|
+
* `completePeerExtensionRegistration(...)`, then retrying `offramp()`.
|
|
274
|
+
*/
|
|
275
|
+
readonly EXTENSION_REGISTRATION_REQUIRED: "EXTENSION_REGISTRATION_REQUIRED";
|
|
276
|
+
readonly DEPOSIT_FAILED: "DEPOSIT_FAILED";
|
|
277
|
+
readonly CONFIRMATION_FAILED: "CONFIRMATION_FAILED";
|
|
278
|
+
readonly DELEGATION_FAILED: "DELEGATION_FAILED";
|
|
279
|
+
readonly USER_CANCELLED: "USER_CANCELLED";
|
|
280
|
+
readonly UNSUPPORTED: "UNSUPPORTED";
|
|
281
|
+
};
|
|
282
|
+
type OfframpErrorCode = (typeof OFFRAMP_ERROR_CODES)[keyof typeof OFFRAMP_ERROR_CODES];
|
|
283
|
+
interface OfframpParams {
|
|
284
|
+
/** USDC amount as decimal string, min 1. */
|
|
285
|
+
amount: string;
|
|
286
|
+
/** Payment platform — use `PLATFORMS.REVOLUT` etc. */
|
|
287
|
+
platform: PlatformEntry;
|
|
288
|
+
/** Fiat currency — use `CURRENCIES.EUR` etc. */
|
|
289
|
+
currency: CurrencyEntry;
|
|
290
|
+
/** Platform-specific identifier (username, email, IBAN). */
|
|
291
|
+
identifier: string;
|
|
292
|
+
/** Optional: restrict the deposit to this taker wallet (OTC private order). */
|
|
293
|
+
otcTaker?: string;
|
|
294
|
+
/** Optional SDK-only referral metadata for telemetry attribution. */
|
|
295
|
+
referralId?: string;
|
|
296
|
+
/** Optional SDK-only integrator metadata for telemetry attribution. */
|
|
297
|
+
integratorId?: string;
|
|
298
|
+
/**
|
|
299
|
+
* Optional per-wallet key to replay the first successful result for 10 minutes.
|
|
300
|
+
*
|
|
301
|
+
* Browser-only: the replay cache is backed by `sessionStorage` and is a no-op
|
|
302
|
+
* in Node/worker runtimes (no duplicate protection there). It is honored only
|
|
303
|
+
* by the `Offramp` class (`createDeposit`) / the `useOfframp` hook — the
|
|
304
|
+
* standalone `offramp()` function ignores it. For server-side dedup, call
|
|
305
|
+
* `deposits(walletAddress)` and reuse an existing open deposit before creating
|
|
306
|
+
* a new one (the SDK's own resume behavior does this for the delegation step).
|
|
307
|
+
*/
|
|
308
|
+
idempotencyKey?: string;
|
|
309
|
+
}
|
|
310
|
+
interface OfframpResult {
|
|
311
|
+
depositId: string;
|
|
312
|
+
txHash: string;
|
|
313
|
+
/** Whether an existing undelegated deposit was resumed. */
|
|
314
|
+
resumed: boolean;
|
|
315
|
+
/** OTC link for the taker, present when `otcTaker` was provided. */
|
|
316
|
+
otcLink?: string;
|
|
317
|
+
}
|
|
318
|
+
type OfframpStep = "approving" | "registering" | "depositing" | "confirming" | "delegating" | "restricting" | "resuming" | "done";
|
|
319
|
+
type OfframpState = "idle" | "approving" | "registering" | "depositing" | "confirming" | "delegating" | "done" | "error";
|
|
320
|
+
interface OfframpProgress {
|
|
321
|
+
step: OfframpStep;
|
|
322
|
+
txHash?: string;
|
|
323
|
+
depositId?: string;
|
|
324
|
+
}
|
|
325
|
+
type OnProgress = (progress: OfframpProgress) => void;
|
|
326
|
+
type DepositStatus = "active" | "empty" | "closed";
|
|
327
|
+
interface OfframpQuoteInput {
|
|
328
|
+
amount: string;
|
|
329
|
+
currency: CurrencyEntry;
|
|
330
|
+
platform: PlatformEntry;
|
|
331
|
+
}
|
|
332
|
+
interface OfframpQuote {
|
|
333
|
+
amountUsdc: number;
|
|
334
|
+
expectedFiat: number;
|
|
335
|
+
effectiveRate: number;
|
|
336
|
+
vaultSpreadBps: number;
|
|
337
|
+
}
|
|
338
|
+
interface OfframpVaultStatus {
|
|
339
|
+
rateManagerId: string;
|
|
340
|
+
rateManagerAddress: string;
|
|
341
|
+
/**
|
|
342
|
+
* Delegate vault manager fee in basis points (currently 10 = 0.10%). Charged
|
|
343
|
+
* by the vault's rate manager on each fill and deducted from the USDC released
|
|
344
|
+
* to the buyer; not added to the maker's deposit cost. See the README "Fees".
|
|
345
|
+
*/
|
|
346
|
+
feeRateBps: number;
|
|
347
|
+
escrow: string;
|
|
348
|
+
isActive: boolean;
|
|
349
|
+
}
|
|
350
|
+
interface OfframpCreateOptions {
|
|
351
|
+
integratorId?: string;
|
|
352
|
+
referralId?: string;
|
|
353
|
+
telemetry?: boolean;
|
|
354
|
+
/**
|
|
355
|
+
* Override the curator REST base URL (default `https://api.zkp2p.xyz`) used
|
|
356
|
+
* for maker registration/validation and the SDK's REST calls. For
|
|
357
|
+
* testing/proxying/mocking only — the indexer and Base RPC always target
|
|
358
|
+
* mainnet. Honored by the `Offramp` class (`createDeposit`); absent ⇒ default
|
|
359
|
+
* behavior is unchanged.
|
|
360
|
+
*/
|
|
361
|
+
apiBaseUrl?: string;
|
|
362
|
+
}
|
|
363
|
+
interface DepositInfo {
|
|
364
|
+
/** Numeric deposit ID. Pass this to `close()`. */
|
|
365
|
+
depositId: string;
|
|
366
|
+
/** Composite ID (escrowAddress_depositId). */
|
|
367
|
+
compositeId: string;
|
|
368
|
+
/** Creation transaction hash. */
|
|
369
|
+
txHash?: string;
|
|
370
|
+
status: DepositStatus;
|
|
371
|
+
remainingUsdc: number;
|
|
372
|
+
outstandingUsdc: number;
|
|
373
|
+
totalTakenUsdc: number;
|
|
374
|
+
fulfilledIntents: number;
|
|
375
|
+
paymentMethods: string[];
|
|
376
|
+
currencies: string[];
|
|
377
|
+
rateSource: string;
|
|
378
|
+
delegated: boolean;
|
|
379
|
+
escrowAddress: string;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Error thrown when curator's `/v2/makers/create` returns a non-success
|
|
384
|
+
* response. Preserves the HTTP status so callers can distinguish a
|
|
385
|
+
* "needs Peer-extension registration" 400 from a transient server error.
|
|
386
|
+
*
|
|
387
|
+
* `offramp()` re-raises this as an {@link OfframpError} with code
|
|
388
|
+
* `EXTENSION_REGISTRATION_REQUIRED` (for PayPal/Wise 400s) or
|
|
389
|
+
* `REGISTRATION_FAILED` (for any other curator error); `MakersCreateError`
|
|
390
|
+
* is attached as the `cause`.
|
|
391
|
+
*/
|
|
392
|
+
declare class MakersCreateError extends Error {
|
|
393
|
+
readonly status: number | null;
|
|
394
|
+
readonly body: string;
|
|
395
|
+
constructor(message: string, status: number | null, body: string);
|
|
396
|
+
}
|
|
397
|
+
declare class OfframpError extends Error {
|
|
398
|
+
readonly code: OfframpErrorCode;
|
|
399
|
+
readonly step?: OfframpStep;
|
|
400
|
+
readonly cause?: unknown;
|
|
401
|
+
readonly txHash?: string;
|
|
402
|
+
readonly depositId?: string;
|
|
403
|
+
constructor(message: string, code: OfframpErrorCode, step?: OfframpStep, cause?: unknown, details?: {
|
|
404
|
+
txHash?: string;
|
|
405
|
+
depositId?: string;
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export { isValidIBAN as $, type PeerExtensionState as A, type PeerExtensionWindow as B, CURRENCIES as C, type DepositInfo as D, type PeerMetadataCaptureMode as E, type PeerMetadataMessage as F, type PeerMetadataMessageCallback as G, type PeerMetadataProviderConfig as H, type PeerMetadataRow as I, type PeerSarCredentialBundle as J, type PeerSarCredentialCapture as K, type PlatformEntry as L, MakersCreateError as M, type PlatformKey as N, OFFRAMP_ERROR_CODES as O, PLATFORMS as P, type PlatformLimits as Q, type PlatformTier as R, completePeerExtensionRegistration as S, createPeerExtensionSdk as T, getPeerExtensionRegistrationAuthParams as U, getPeerExtensionRegistrationInfo as V, getPeerExtensionState as W, getPlatformLimits as X, isPeerExtensionAvailable as Y, isPeerExtensionMetadataBridgeAvailable as Z, isPeerExtensionRegistrationError as _, type CompletePeerExtensionRegistrationInput as a, normalizePaypalMeUsername as a0, openPeerExtensionInstallPage as a1, peerExtensionSdk as a2, type CompletePeerExtensionRegistrationResult as b, type CurrencyEntry as c, type DepositStatus as d, type OfframpCreateOptions as e, OfframpError as f, type OfframpErrorCode as g, type OfframpParams as h, type OfframpProgress as i, type OfframpQuote as j, type OfframpQuoteInput as k, type OfframpResult as l, type OfframpState as m, type OfframpStep as n, type OfframpVaultStatus as o, type OnProgress as p, PLATFORM_LIMITS as q, type PayeeDepositData as r, type PeerAuthenticateParams as s, type PeerBuyerTeePaymentCapture as t, type PeerBuyerTeePaymentParams as u, type PeerConnectionStatus as v, type PeerExtensionApi as w, type PeerExtensionRegistrationInfo as x, type PeerExtensionSdk as y, type PeerExtensionSdkOptions as z };
|