@usdctofiat/offramp 4.3.0 → 4.4.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 +28 -8
- package/README.md +37 -10
- package/dist/{chunk-XKWPLBG3.js → chunk-CPTVCTLU.js} +36 -55
- package/dist/chunk-CPTVCTLU.js.map +1 -0
- package/dist/{errors-Dva4Wriq.d.cts → errors-B-Gaf0US.d.cts} +5 -13
- package/dist/{errors-Dva4Wriq.d.ts → errors-B-Gaf0US.d.ts} +5 -13
- package/dist/index.cjs +127 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -5
- package/dist/index.d.ts +33 -5
- package/dist/index.js +93 -5
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +32 -52
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-XKWPLBG3.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WalletClient } from 'viem';
|
|
2
|
-
import { h as OfframpParams, p as OnProgress, l as OfframpResult, e as OfframpCreateOptions, k as OfframpQuoteInput, j as OfframpQuote, o as OfframpVaultStatus, t as PlatformEntry, c as CurrencyEntry, D as DepositInfo } from './errors-
|
|
3
|
-
export { C as CURRENCIES, a as CompletePeerExtensionRegistrationInput, b as CompletePeerExtensionRegistrationResult, d as DepositStatus, M as MakersCreateError, O as OFFRAMP_ERROR_CODES, f as OfframpError, g as OfframpErrorCode, i as OfframpProgress, m as OfframpState, n as OfframpStep, P as PLATFORMS, q as PLATFORM_LIMITS, r as PayeeDepositData, s as PeerExtensionRegistrationInfo, u as PlatformKey, v as PlatformLimits, w as PlatformTier, x as completePeerExtensionRegistration, y as getPeerExtensionRegistrationAuthParams, z as getPeerExtensionRegistrationInfo, A as getPlatformLimits, B as isPeerExtensionRegistrationError, E as
|
|
4
|
-
import { PeerConnectionStatus, PeerAuthenticateParams, PeerMetadataMessageCallback, SellerCredentialBundle } from '@zkp2p/sdk';
|
|
2
|
+
import { h as OfframpParams, p as OnProgress, l as OfframpResult, e as OfframpCreateOptions, k as OfframpQuoteInput, j as OfframpQuote, o as OfframpVaultStatus, t as PlatformEntry, c as CurrencyEntry, D as DepositInfo } from './errors-B-Gaf0US.cjs';
|
|
3
|
+
export { C as CURRENCIES, a as CompletePeerExtensionRegistrationInput, b as CompletePeerExtensionRegistrationResult, d as DepositStatus, M as MakersCreateError, O as OFFRAMP_ERROR_CODES, f as OfframpError, g as OfframpErrorCode, i as OfframpProgress, m as OfframpState, n as OfframpStep, P as PLATFORMS, q as PLATFORM_LIMITS, r as PayeeDepositData, s as PeerExtensionRegistrationInfo, u as PlatformKey, v as PlatformLimits, w as PlatformTier, x as completePeerExtensionRegistration, y as getPeerExtensionRegistrationAuthParams, z as getPeerExtensionRegistrationInfo, A as getPlatformLimits, B as isPeerExtensionRegistrationError, E as normalizePaypalMeUsername } from './errors-B-Gaf0US.cjs';
|
|
4
|
+
import { PeerConnectionStatus, PeerAuthenticateParams, PeerMetadataMessageCallback, SellerCredentialBundle, TakerTierLevel, GetTakerTierResponse } from '@zkp2p/sdk';
|
|
5
5
|
export { PEER_EXTENSION_CHROME_URL, PeerAuthenticateParams, PeerBuyerTeePaymentCapture, PeerBuyerTeePaymentParams, PeerConnectionStatus, PeerMetadataCaptureMode, PeerMetadataMessage, PeerMetadataMessageCallback, PeerMetadataProviderConfig, PeerMetadataRow, PeerSarCredentialCapture } from '@zkp2p/sdk';
|
|
6
6
|
|
|
7
7
|
type TelemetryEventName = "sdk.init" | "sdk.createDeposit.start" | "sdk.createDeposit.progress" | "sdk.createDeposit.success" | "sdk.createDeposit.error";
|
|
@@ -24,7 +24,7 @@ declare function sendTelemetryEvent(name: TelemetryEventName, payload?: Record<s
|
|
|
24
24
|
declare function createTelemetryContext(options: CreateTelemetryContextOptions): TelemetryContext;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Peer browser-extension surface for
|
|
27
|
+
* Peer browser-extension surface for SAR-capable makers. Drive the
|
|
28
28
|
* headless metadata bridge via `usePeerExtensionRegistration` in
|
|
29
29
|
* `@usdctofiat/offramp/react`, or manually:
|
|
30
30
|
*
|
|
@@ -187,6 +187,26 @@ declare function disableOtc(walletClient: WalletClient, depositId: string, escro
|
|
|
187
187
|
*/
|
|
188
188
|
declare function getOtcLink(depositId: string, escrowAddress?: string): string;
|
|
189
189
|
|
|
190
|
+
type TakerTier = GetTakerTierResponse["responseObject"];
|
|
191
|
+
type TakerPlatformLimit = NonNullable<TakerTier["platformLimits"]>[number];
|
|
192
|
+
interface GetTakerTierInput {
|
|
193
|
+
readonly owner: string;
|
|
194
|
+
readonly chainId?: number;
|
|
195
|
+
readonly apiBaseUrl?: string;
|
|
196
|
+
readonly timeoutMs?: number;
|
|
197
|
+
}
|
|
198
|
+
interface TakerPlatformLimitLookup {
|
|
199
|
+
readonly platform?: string | null;
|
|
200
|
+
readonly paymentMethodHash?: string | null;
|
|
201
|
+
}
|
|
202
|
+
interface ResolvedTakerPlatformLimit {
|
|
203
|
+
readonly tier: TakerTierLevel;
|
|
204
|
+
readonly limit: TakerPlatformLimit | null;
|
|
205
|
+
}
|
|
206
|
+
declare function getTakerTier({ owner, chainId, apiBaseUrl, timeoutMs, }: GetTakerTierInput): Promise<TakerTier>;
|
|
207
|
+
declare function findTakerPlatformLimit(tier: TakerTier | null | undefined, lookup: TakerPlatformLimitLookup): TakerPlatformLimit | null;
|
|
208
|
+
declare function resolveTakerPlatformLimit(tier: TakerTier | null | undefined, lookup: TakerPlatformLimitLookup): ResolvedTakerPlatformLimit | null;
|
|
209
|
+
|
|
190
210
|
type OfframpIntegratorProfile = "app" | "bot" | "agent" | "private-otc" | "webhooks" | "peerlytics";
|
|
191
211
|
interface OfframpResourceLink {
|
|
192
212
|
label: string;
|
|
@@ -197,6 +217,11 @@ interface OfframpIntegrationStep {
|
|
|
197
217
|
title: string;
|
|
198
218
|
detail: string;
|
|
199
219
|
}
|
|
220
|
+
interface OfframpIntegrationCheck {
|
|
221
|
+
title: string;
|
|
222
|
+
detail: string;
|
|
223
|
+
required: true;
|
|
224
|
+
}
|
|
200
225
|
interface OfframpIntegrationPlaybook {
|
|
201
226
|
profile: OfframpIntegratorProfile;
|
|
202
227
|
title: string;
|
|
@@ -235,6 +260,7 @@ interface OfframpDeveloperResources {
|
|
|
235
260
|
npm: string;
|
|
236
261
|
};
|
|
237
262
|
playbooks: OfframpIntegrationPlaybook[];
|
|
263
|
+
checklist: OfframpIntegrationCheck[];
|
|
238
264
|
}
|
|
239
265
|
declare const OFFRAMP_RESOURCE_LINKS: {
|
|
240
266
|
readonly developerPortal: "https://usdctofiat.xyz/developers/";
|
|
@@ -254,7 +280,9 @@ declare const OFFRAMP_RESOURCE_LINKS: {
|
|
|
254
280
|
readonly npm: "https://www.npmjs.com/package/@usdctofiat/offramp";
|
|
255
281
|
};
|
|
256
282
|
declare const OFFRAMP_INTEGRATION_PLAYBOOKS: OfframpIntegrationPlaybook[];
|
|
283
|
+
declare const OFFRAMP_INTEGRATION_CHECKLIST: OfframpIntegrationCheck[];
|
|
257
284
|
declare const OFFRAMP_DEVELOPER_RESOURCES: OfframpDeveloperResources;
|
|
258
285
|
declare function getOfframpDeveloperResources(profile?: OfframpIntegratorProfile): OfframpDeveloperResources | OfframpIntegrationPlaybook;
|
|
286
|
+
declare function getOfframpAgentPrompt(profile?: OfframpIntegratorProfile): string;
|
|
259
287
|
|
|
260
|
-
export { CurrencyEntry, DEFAULT_EXTENSION_INSTALL_URL, DepositInfo, ESCROW_ADDRESS, type EnableOtcResult, OFFRAMP_DEVELOPER_RESOURCES, OFFRAMP_INTEGRATION_PLAYBOOKS, OFFRAMP_RESOURCE_LINKS, Offramp, OfframpCreateOptions, type OfframpDeveloperResources, type OfframpIntegrationPlaybook, type OfframpIntegrationStep, type OfframpIntegratorProfile, OfframpParams, OfframpQuote, OfframpQuoteInput, type OfframpResourceLink, OfframpResult, OfframpVaultStatus, OnProgress, type PeerExtensionApi, type PeerExtensionSdk, type PeerExtensionSdkOptions, type PeerExtensionState, type PeerExtensionWindow, type PeerSarCredentialBundle, PlatformEntry, close, createOfframp, createPeerExtensionSdk, createTelemetryContext, delegate, deposits, disableOtc, emitEvent, enableOtc, getOfframpDeveloperResources, getOtcLink, getPeerExtensionState, isPeerExtensionAvailable, isPeerExtensionMetadataBridgeAvailable, offramp, openPeerExtensionInstallPage, peerExtensionSdk, sanitizeAttributionId, sendTelemetryEvent, undelegate };
|
|
288
|
+
export { CurrencyEntry, DEFAULT_EXTENSION_INSTALL_URL, DepositInfo, ESCROW_ADDRESS, type EnableOtcResult, type GetTakerTierInput, OFFRAMP_DEVELOPER_RESOURCES, OFFRAMP_INTEGRATION_CHECKLIST, OFFRAMP_INTEGRATION_PLAYBOOKS, OFFRAMP_RESOURCE_LINKS, Offramp, OfframpCreateOptions, type OfframpDeveloperResources, type OfframpIntegrationCheck, type OfframpIntegrationPlaybook, type OfframpIntegrationStep, type OfframpIntegratorProfile, OfframpParams, OfframpQuote, OfframpQuoteInput, type OfframpResourceLink, OfframpResult, OfframpVaultStatus, OnProgress, type PeerExtensionApi, type PeerExtensionSdk, type PeerExtensionSdkOptions, type PeerExtensionState, type PeerExtensionWindow, type PeerSarCredentialBundle, PlatformEntry, type ResolvedTakerPlatformLimit, type TakerPlatformLimit, type TakerPlatformLimitLookup, type TakerTier, close, createOfframp, createPeerExtensionSdk, createTelemetryContext, delegate, deposits, disableOtc, emitEvent, enableOtc, findTakerPlatformLimit, getOfframpAgentPrompt, getOfframpDeveloperResources, getOtcLink, getPeerExtensionState, getTakerTier, isPeerExtensionAvailable, isPeerExtensionMetadataBridgeAvailable, offramp, openPeerExtensionInstallPage, peerExtensionSdk, resolveTakerPlatformLimit, sanitizeAttributionId, sendTelemetryEvent, undelegate };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WalletClient } from 'viem';
|
|
2
|
-
import { h as OfframpParams, p as OnProgress, l as OfframpResult, e as OfframpCreateOptions, k as OfframpQuoteInput, j as OfframpQuote, o as OfframpVaultStatus, t as PlatformEntry, c as CurrencyEntry, D as DepositInfo } from './errors-
|
|
3
|
-
export { C as CURRENCIES, a as CompletePeerExtensionRegistrationInput, b as CompletePeerExtensionRegistrationResult, d as DepositStatus, M as MakersCreateError, O as OFFRAMP_ERROR_CODES, f as OfframpError, g as OfframpErrorCode, i as OfframpProgress, m as OfframpState, n as OfframpStep, P as PLATFORMS, q as PLATFORM_LIMITS, r as PayeeDepositData, s as PeerExtensionRegistrationInfo, u as PlatformKey, v as PlatformLimits, w as PlatformTier, x as completePeerExtensionRegistration, y as getPeerExtensionRegistrationAuthParams, z as getPeerExtensionRegistrationInfo, A as getPlatformLimits, B as isPeerExtensionRegistrationError, E as
|
|
4
|
-
import { PeerConnectionStatus, PeerAuthenticateParams, PeerMetadataMessageCallback, SellerCredentialBundle } from '@zkp2p/sdk';
|
|
2
|
+
import { h as OfframpParams, p as OnProgress, l as OfframpResult, e as OfframpCreateOptions, k as OfframpQuoteInput, j as OfframpQuote, o as OfframpVaultStatus, t as PlatformEntry, c as CurrencyEntry, D as DepositInfo } from './errors-B-Gaf0US.js';
|
|
3
|
+
export { C as CURRENCIES, a as CompletePeerExtensionRegistrationInput, b as CompletePeerExtensionRegistrationResult, d as DepositStatus, M as MakersCreateError, O as OFFRAMP_ERROR_CODES, f as OfframpError, g as OfframpErrorCode, i as OfframpProgress, m as OfframpState, n as OfframpStep, P as PLATFORMS, q as PLATFORM_LIMITS, r as PayeeDepositData, s as PeerExtensionRegistrationInfo, u as PlatformKey, v as PlatformLimits, w as PlatformTier, x as completePeerExtensionRegistration, y as getPeerExtensionRegistrationAuthParams, z as getPeerExtensionRegistrationInfo, A as getPlatformLimits, B as isPeerExtensionRegistrationError, E as normalizePaypalMeUsername } from './errors-B-Gaf0US.js';
|
|
4
|
+
import { PeerConnectionStatus, PeerAuthenticateParams, PeerMetadataMessageCallback, SellerCredentialBundle, TakerTierLevel, GetTakerTierResponse } from '@zkp2p/sdk';
|
|
5
5
|
export { PEER_EXTENSION_CHROME_URL, PeerAuthenticateParams, PeerBuyerTeePaymentCapture, PeerBuyerTeePaymentParams, PeerConnectionStatus, PeerMetadataCaptureMode, PeerMetadataMessage, PeerMetadataMessageCallback, PeerMetadataProviderConfig, PeerMetadataRow, PeerSarCredentialCapture } from '@zkp2p/sdk';
|
|
6
6
|
|
|
7
7
|
type TelemetryEventName = "sdk.init" | "sdk.createDeposit.start" | "sdk.createDeposit.progress" | "sdk.createDeposit.success" | "sdk.createDeposit.error";
|
|
@@ -24,7 +24,7 @@ declare function sendTelemetryEvent(name: TelemetryEventName, payload?: Record<s
|
|
|
24
24
|
declare function createTelemetryContext(options: CreateTelemetryContextOptions): TelemetryContext;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Peer browser-extension surface for
|
|
27
|
+
* Peer browser-extension surface for SAR-capable makers. Drive the
|
|
28
28
|
* headless metadata bridge via `usePeerExtensionRegistration` in
|
|
29
29
|
* `@usdctofiat/offramp/react`, or manually:
|
|
30
30
|
*
|
|
@@ -187,6 +187,26 @@ declare function disableOtc(walletClient: WalletClient, depositId: string, escro
|
|
|
187
187
|
*/
|
|
188
188
|
declare function getOtcLink(depositId: string, escrowAddress?: string): string;
|
|
189
189
|
|
|
190
|
+
type TakerTier = GetTakerTierResponse["responseObject"];
|
|
191
|
+
type TakerPlatformLimit = NonNullable<TakerTier["platformLimits"]>[number];
|
|
192
|
+
interface GetTakerTierInput {
|
|
193
|
+
readonly owner: string;
|
|
194
|
+
readonly chainId?: number;
|
|
195
|
+
readonly apiBaseUrl?: string;
|
|
196
|
+
readonly timeoutMs?: number;
|
|
197
|
+
}
|
|
198
|
+
interface TakerPlatformLimitLookup {
|
|
199
|
+
readonly platform?: string | null;
|
|
200
|
+
readonly paymentMethodHash?: string | null;
|
|
201
|
+
}
|
|
202
|
+
interface ResolvedTakerPlatformLimit {
|
|
203
|
+
readonly tier: TakerTierLevel;
|
|
204
|
+
readonly limit: TakerPlatformLimit | null;
|
|
205
|
+
}
|
|
206
|
+
declare function getTakerTier({ owner, chainId, apiBaseUrl, timeoutMs, }: GetTakerTierInput): Promise<TakerTier>;
|
|
207
|
+
declare function findTakerPlatformLimit(tier: TakerTier | null | undefined, lookup: TakerPlatformLimitLookup): TakerPlatformLimit | null;
|
|
208
|
+
declare function resolveTakerPlatformLimit(tier: TakerTier | null | undefined, lookup: TakerPlatformLimitLookup): ResolvedTakerPlatformLimit | null;
|
|
209
|
+
|
|
190
210
|
type OfframpIntegratorProfile = "app" | "bot" | "agent" | "private-otc" | "webhooks" | "peerlytics";
|
|
191
211
|
interface OfframpResourceLink {
|
|
192
212
|
label: string;
|
|
@@ -197,6 +217,11 @@ interface OfframpIntegrationStep {
|
|
|
197
217
|
title: string;
|
|
198
218
|
detail: string;
|
|
199
219
|
}
|
|
220
|
+
interface OfframpIntegrationCheck {
|
|
221
|
+
title: string;
|
|
222
|
+
detail: string;
|
|
223
|
+
required: true;
|
|
224
|
+
}
|
|
200
225
|
interface OfframpIntegrationPlaybook {
|
|
201
226
|
profile: OfframpIntegratorProfile;
|
|
202
227
|
title: string;
|
|
@@ -235,6 +260,7 @@ interface OfframpDeveloperResources {
|
|
|
235
260
|
npm: string;
|
|
236
261
|
};
|
|
237
262
|
playbooks: OfframpIntegrationPlaybook[];
|
|
263
|
+
checklist: OfframpIntegrationCheck[];
|
|
238
264
|
}
|
|
239
265
|
declare const OFFRAMP_RESOURCE_LINKS: {
|
|
240
266
|
readonly developerPortal: "https://usdctofiat.xyz/developers/";
|
|
@@ -254,7 +280,9 @@ declare const OFFRAMP_RESOURCE_LINKS: {
|
|
|
254
280
|
readonly npm: "https://www.npmjs.com/package/@usdctofiat/offramp";
|
|
255
281
|
};
|
|
256
282
|
declare const OFFRAMP_INTEGRATION_PLAYBOOKS: OfframpIntegrationPlaybook[];
|
|
283
|
+
declare const OFFRAMP_INTEGRATION_CHECKLIST: OfframpIntegrationCheck[];
|
|
257
284
|
declare const OFFRAMP_DEVELOPER_RESOURCES: OfframpDeveloperResources;
|
|
258
285
|
declare function getOfframpDeveloperResources(profile?: OfframpIntegratorProfile): OfframpDeveloperResources | OfframpIntegrationPlaybook;
|
|
286
|
+
declare function getOfframpAgentPrompt(profile?: OfframpIntegratorProfile): string;
|
|
259
287
|
|
|
260
|
-
export { CurrencyEntry, DEFAULT_EXTENSION_INSTALL_URL, DepositInfo, ESCROW_ADDRESS, type EnableOtcResult, OFFRAMP_DEVELOPER_RESOURCES, OFFRAMP_INTEGRATION_PLAYBOOKS, OFFRAMP_RESOURCE_LINKS, Offramp, OfframpCreateOptions, type OfframpDeveloperResources, type OfframpIntegrationPlaybook, type OfframpIntegrationStep, type OfframpIntegratorProfile, OfframpParams, OfframpQuote, OfframpQuoteInput, type OfframpResourceLink, OfframpResult, OfframpVaultStatus, OnProgress, type PeerExtensionApi, type PeerExtensionSdk, type PeerExtensionSdkOptions, type PeerExtensionState, type PeerExtensionWindow, type PeerSarCredentialBundle, PlatformEntry, close, createOfframp, createPeerExtensionSdk, createTelemetryContext, delegate, deposits, disableOtc, emitEvent, enableOtc, getOfframpDeveloperResources, getOtcLink, getPeerExtensionState, isPeerExtensionAvailable, isPeerExtensionMetadataBridgeAvailable, offramp, openPeerExtensionInstallPage, peerExtensionSdk, sanitizeAttributionId, sendTelemetryEvent, undelegate };
|
|
288
|
+
export { CurrencyEntry, DEFAULT_EXTENSION_INSTALL_URL, DepositInfo, ESCROW_ADDRESS, type EnableOtcResult, type GetTakerTierInput, OFFRAMP_DEVELOPER_RESOURCES, OFFRAMP_INTEGRATION_CHECKLIST, OFFRAMP_INTEGRATION_PLAYBOOKS, OFFRAMP_RESOURCE_LINKS, Offramp, OfframpCreateOptions, type OfframpDeveloperResources, type OfframpIntegrationCheck, type OfframpIntegrationPlaybook, type OfframpIntegrationStep, type OfframpIntegratorProfile, OfframpParams, OfframpQuote, OfframpQuoteInput, type OfframpResourceLink, OfframpResult, OfframpVaultStatus, OnProgress, type PeerExtensionApi, type PeerExtensionSdk, type PeerExtensionSdkOptions, type PeerExtensionState, type PeerExtensionWindow, type PeerSarCredentialBundle, PlatformEntry, type ResolvedTakerPlatformLimit, type TakerPlatformLimit, type TakerPlatformLimitLookup, type TakerTier, close, createOfframp, createPeerExtensionSdk, createTelemetryContext, delegate, deposits, disableOtc, emitEvent, enableOtc, findTakerPlatformLimit, getOfframpAgentPrompt, getOfframpDeveloperResources, getOtcLink, getPeerExtensionState, getTakerTier, isPeerExtensionAvailable, isPeerExtensionMetadataBridgeAvailable, offramp, openPeerExtensionInstallPage, peerExtensionSdk, resolveTakerPlatformLimit, sanitizeAttributionId, sendTelemetryEvent, undelegate };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
+
API_BASE_URL,
|
|
3
|
+
BASE_CHAIN_ID,
|
|
2
4
|
CURRENCIES,
|
|
3
5
|
DEFAULT_EXTENSION_INSTALL_URL,
|
|
4
6
|
DELEGATE_MANAGER_FEE_BPS,
|
|
@@ -7,6 +9,7 @@ import {
|
|
|
7
9
|
MakersCreateError,
|
|
8
10
|
Offramp,
|
|
9
11
|
OfframpError,
|
|
12
|
+
PAYEE_REGISTRATION_TIMEOUT_MS,
|
|
10
13
|
PEER_EXTENSION_CHROME_URL,
|
|
11
14
|
PLATFORMS,
|
|
12
15
|
PLATFORM_LIMITS,
|
|
@@ -31,7 +34,6 @@ import {
|
|
|
31
34
|
isPeerExtensionAvailable,
|
|
32
35
|
isPeerExtensionMetadataBridgeAvailable,
|
|
33
36
|
isPeerExtensionRegistrationError,
|
|
34
|
-
isValidIBAN,
|
|
35
37
|
normalizePaypalMeUsername,
|
|
36
38
|
offramp,
|
|
37
39
|
openPeerExtensionInstallPage,
|
|
@@ -39,7 +41,45 @@ import {
|
|
|
39
41
|
sanitizeAttributionId,
|
|
40
42
|
sendTelemetryEvent,
|
|
41
43
|
undelegate
|
|
42
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-CPTVCTLU.js";
|
|
45
|
+
|
|
46
|
+
// src/taker-tier.ts
|
|
47
|
+
import {
|
|
48
|
+
apiGetTakerTier
|
|
49
|
+
} from "@zkp2p/sdk";
|
|
50
|
+
async function getTakerTier({
|
|
51
|
+
owner,
|
|
52
|
+
chainId = BASE_CHAIN_ID,
|
|
53
|
+
apiBaseUrl = API_BASE_URL,
|
|
54
|
+
timeoutMs = PAYEE_REGISTRATION_TIMEOUT_MS
|
|
55
|
+
}) {
|
|
56
|
+
const response = await apiGetTakerTier({ owner, chainId }, apiBaseUrl, timeoutMs);
|
|
57
|
+
if (!response.success || !response.responseObject) {
|
|
58
|
+
throw new Error(response.message || "Failed to load taker tier.");
|
|
59
|
+
}
|
|
60
|
+
return response.responseObject;
|
|
61
|
+
}
|
|
62
|
+
function findTakerPlatformLimit(tier, lookup) {
|
|
63
|
+
const limits = tier?.platformLimits ?? [];
|
|
64
|
+
const platform = lookup.platform?.trim().toLowerCase() || null;
|
|
65
|
+
const paymentMethodHash = lookup.paymentMethodHash?.trim().toLowerCase() || null;
|
|
66
|
+
if (!platform && !paymentMethodHash) return null;
|
|
67
|
+
return limits.find((limit) => {
|
|
68
|
+
const limitHash = limit.paymentMethodHash?.trim().toLowerCase();
|
|
69
|
+
if (paymentMethodHash && limitHash === paymentMethodHash) return true;
|
|
70
|
+
const limitPlatform = limit.platformName?.trim().toLowerCase();
|
|
71
|
+
if (!platform || !limitPlatform) return false;
|
|
72
|
+
if (limitPlatform === platform) return true;
|
|
73
|
+
return platform.startsWith("zelle") && limitPlatform.startsWith("zelle");
|
|
74
|
+
}) ?? null;
|
|
75
|
+
}
|
|
76
|
+
function resolveTakerPlatformLimit(tier, lookup) {
|
|
77
|
+
if (!tier) return null;
|
|
78
|
+
return {
|
|
79
|
+
tier: tier.tier,
|
|
80
|
+
limit: findTakerPlatformLimit(tier, lookup)
|
|
81
|
+
};
|
|
82
|
+
}
|
|
43
83
|
|
|
44
84
|
// src/types.ts
|
|
45
85
|
var OFFRAMP_ERROR_CODES = {
|
|
@@ -112,7 +152,7 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
|
|
|
112
152
|
detail: "Pass the user's viem WalletClient so the user signs approval, deposit, and delegation."
|
|
113
153
|
},
|
|
114
154
|
{
|
|
115
|
-
title: "Handle
|
|
155
|
+
title: "Handle SAR registration",
|
|
116
156
|
detail: "Catch EXTENSION_REGISTRATION_REQUIRED and drive usePeerExtensionRegistration."
|
|
117
157
|
},
|
|
118
158
|
{
|
|
@@ -302,6 +342,33 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
|
|
|
302
342
|
]
|
|
303
343
|
}
|
|
304
344
|
];
|
|
345
|
+
var OFFRAMP_INTEGRATION_CHECKLIST = [
|
|
346
|
+
{
|
|
347
|
+
title: "Base mainnet wallet client",
|
|
348
|
+
detail: "Use a viem WalletClient on chain 8453. The SDK has no public sandbox mode.",
|
|
349
|
+
required: true
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
title: "Delegate-vault pricing",
|
|
353
|
+
detail: "Every SDK-created deposit must delegate pricing to the managed Delegate vault.",
|
|
354
|
+
required: true
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
title: "PayPal/Wise recovery path",
|
|
358
|
+
detail: "Catch EXTENSION_REGISTRATION_REQUIRED and drive Peer extension seller registration.",
|
|
359
|
+
required: true
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
title: "Server-side duplicate prevention",
|
|
363
|
+
detail: "Bots and workers must call deposits(address) and use their own order database; idempotencyKey is browser-session scoped and the standalone offramp() helper ignores it.",
|
|
364
|
+
required: true
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
title: "Raw-body webhook verification",
|
|
368
|
+
detail: "Verify timestamp.rawBody with HMAC-SHA256 before parsing JSON.",
|
|
369
|
+
required: true
|
|
370
|
+
}
|
|
371
|
+
];
|
|
305
372
|
var OFFRAMP_DEVELOPER_RESOURCES = {
|
|
306
373
|
packageName: "@usdctofiat/offramp",
|
|
307
374
|
sdkVersion: SDK_VERSION,
|
|
@@ -332,7 +399,8 @@ var OFFRAMP_DEVELOPER_RESOURCES = {
|
|
|
332
399
|
peerlyticsPricing: OFFRAMP_RESOURCE_LINKS.peerlyticsPricing,
|
|
333
400
|
npm: OFFRAMP_RESOURCE_LINKS.npm
|
|
334
401
|
},
|
|
335
|
-
playbooks: OFFRAMP_INTEGRATION_PLAYBOOKS
|
|
402
|
+
playbooks: OFFRAMP_INTEGRATION_PLAYBOOKS,
|
|
403
|
+
checklist: OFFRAMP_INTEGRATION_CHECKLIST
|
|
336
404
|
};
|
|
337
405
|
function getOfframpDeveloperResources(profile) {
|
|
338
406
|
if (!profile) return OFFRAMP_DEVELOPER_RESOURCES;
|
|
@@ -340,6 +408,22 @@ function getOfframpDeveloperResources(profile) {
|
|
|
340
408
|
if (!playbook) return OFFRAMP_DEVELOPER_RESOURCES;
|
|
341
409
|
return playbook;
|
|
342
410
|
}
|
|
411
|
+
function getOfframpAgentPrompt(profile = "app") {
|
|
412
|
+
const playbook = getOfframpDeveloperResources(profile);
|
|
413
|
+
const resource = "profile" in playbook ? playbook : OFFRAMP_INTEGRATION_PLAYBOOKS.find((entry) => entry.profile === "app");
|
|
414
|
+
const steps = resource?.steps.map((step, index) => `${index + 1}. ${step.title}: ${step.detail}`);
|
|
415
|
+
return [
|
|
416
|
+
"Build a USDC-to-fiat integration with @usdctofiat/offramp.",
|
|
417
|
+
`Profile: ${profile}.`,
|
|
418
|
+
"Before coding, read https://usdctofiat.xyz/skills/usdctofiat.md and https://usdctofiat.xyz/llms.txt.",
|
|
419
|
+
"Use Base mainnet chainId 8453 and a viem WalletClient; do not invent a sandbox.",
|
|
420
|
+
"Do not add manual rate controls; SDK-created deposits must delegate to the Delegate vault.",
|
|
421
|
+
"For PayPal, Wise, Venmo, and Cash App, recover EXTENSION_REGISTRATION_REQUIRED through the Peer extension registration flow.",
|
|
422
|
+
"For bots/workers, deduplicate with deposits(address) plus your own order database; do not rely on idempotencyKey.",
|
|
423
|
+
"For webhooks, verify the raw request body before parsing JSON.",
|
|
424
|
+
...steps ?? []
|
|
425
|
+
].join("\n");
|
|
426
|
+
}
|
|
343
427
|
export {
|
|
344
428
|
CURRENCIES,
|
|
345
429
|
DEFAULT_EXTENSION_INSTALL_URL,
|
|
@@ -347,6 +431,7 @@ export {
|
|
|
347
431
|
MakersCreateError,
|
|
348
432
|
OFFRAMP_DEVELOPER_RESOURCES,
|
|
349
433
|
OFFRAMP_ERROR_CODES,
|
|
434
|
+
OFFRAMP_INTEGRATION_CHECKLIST,
|
|
350
435
|
OFFRAMP_INTEGRATION_PLAYBOOKS,
|
|
351
436
|
OFFRAMP_RESOURCE_LINKS,
|
|
352
437
|
Offramp,
|
|
@@ -364,20 +449,23 @@ export {
|
|
|
364
449
|
disableOtc,
|
|
365
450
|
emitEvent,
|
|
366
451
|
enableOtc,
|
|
452
|
+
findTakerPlatformLimit,
|
|
453
|
+
getOfframpAgentPrompt,
|
|
367
454
|
getOfframpDeveloperResources,
|
|
368
455
|
getOtcLink,
|
|
369
456
|
getPeerExtensionRegistrationAuthParams,
|
|
370
457
|
getPeerExtensionRegistrationInfo,
|
|
371
458
|
getPeerExtensionState,
|
|
372
459
|
getPlatformLimits,
|
|
460
|
+
getTakerTier,
|
|
373
461
|
isPeerExtensionAvailable,
|
|
374
462
|
isPeerExtensionMetadataBridgeAvailable,
|
|
375
463
|
isPeerExtensionRegistrationError,
|
|
376
|
-
isValidIBAN,
|
|
377
464
|
normalizePaypalMeUsername,
|
|
378
465
|
offramp,
|
|
379
466
|
openPeerExtensionInstallPage,
|
|
380
467
|
peerExtensionSdk,
|
|
468
|
+
resolveTakerPlatformLimit,
|
|
381
469
|
sanitizeAttributionId,
|
|
382
470
|
sendTelemetryEvent,
|
|
383
471
|
undelegate
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts","../src/resources.ts"],"sourcesContent":["import type { PlatformEntry } from \"./platforms\";\nimport type { CurrencyEntry } from \"./currencies\";\n\nexport const OFFRAMP_ERROR_CODES = {\n VALIDATION: \"VALIDATION\",\n APPROVAL_FAILED: \"APPROVAL_FAILED\",\n REGISTRATION_FAILED: \"REGISTRATION_FAILED\",\n /**\n * Curator rejected the maker because the user has not registered this\n * handle in the Peer extension yet. Thrown from `offramp()` for PayPal\n * and Wise when `/v2/makers/create` returns 400 or a \"creating the maker\"\n * message. Recover by prompting the user through the Peer extension via\n * `usePeerExtensionRegistration(platform)` (React) or\n * `completePeerExtensionRegistration(...)`, then retrying `offramp()`.\n */\n EXTENSION_REGISTRATION_REQUIRED: \"EXTENSION_REGISTRATION_REQUIRED\",\n DEPOSIT_FAILED: \"DEPOSIT_FAILED\",\n CONFIRMATION_FAILED: \"CONFIRMATION_FAILED\",\n DELEGATION_FAILED: \"DELEGATION_FAILED\",\n USER_CANCELLED: \"USER_CANCELLED\",\n UNSUPPORTED: \"UNSUPPORTED\",\n} as const;\n\nexport type OfframpErrorCode = (typeof OFFRAMP_ERROR_CODES)[keyof typeof OFFRAMP_ERROR_CODES];\n\nexport interface OfframpParams {\n /** USDC amount as decimal string, min 1. */\n amount: string;\n /** Payment platform — use `PLATFORMS.REVOLUT` etc. */\n platform: PlatformEntry;\n /** Fiat currency — use `CURRENCIES.EUR` etc. */\n currency: CurrencyEntry;\n /** Platform-specific identifier (username, email, IBAN). */\n identifier: string;\n /** Optional: restrict the deposit to this taker wallet (OTC private order). */\n otcTaker?: string;\n /** Optional SDK-only referral metadata for telemetry attribution. */\n referralId?: string;\n /** Optional SDK-only integrator metadata for telemetry attribution. */\n integratorId?: string;\n /**\n * Optional per-wallet key to replay the first successful result for 10 minutes.\n *\n * Browser-only: the replay cache is backed by `sessionStorage` and is a no-op\n * in Node/worker runtimes (no duplicate protection there). It is honored only\n * by the `Offramp` class (`createDeposit`) / the `useOfframp` hook — the\n * standalone `offramp()` function ignores it. For server-side dedup, call\n * `deposits(walletAddress)` and reuse an existing open deposit before creating\n * a new one (the SDK's own resume behavior does this for the delegation step).\n */\n idempotencyKey?: string;\n}\n\nexport interface OfframpResult {\n depositId: string;\n txHash: string;\n /** Whether an existing undelegated deposit was resumed. */\n resumed: boolean;\n /** OTC link for the taker, present when `otcTaker` was provided. */\n otcLink?: string;\n}\n\nexport type OfframpStep =\n | \"approving\"\n | \"registering\"\n | \"depositing\"\n | \"confirming\"\n | \"delegating\"\n | \"restricting\"\n | \"resuming\"\n | \"done\";\n\nexport type OfframpState =\n | \"idle\"\n | \"approving\"\n | \"registering\"\n | \"depositing\"\n | \"confirming\"\n | \"delegating\"\n | \"done\"\n | \"error\";\n\nexport interface OfframpProgress {\n step: OfframpStep;\n txHash?: string;\n depositId?: string;\n}\n\nexport type OnProgress = (progress: OfframpProgress) => void;\n\nexport type DepositStatus = \"active\" | \"empty\" | \"closed\";\n\nexport interface OfframpQuoteInput {\n amount: string;\n currency: CurrencyEntry;\n platform: PlatformEntry;\n}\n\nexport interface OfframpQuote {\n amountUsdc: number;\n expectedFiat: number;\n effectiveRate: number;\n vaultSpreadBps: number;\n}\n\nexport interface OfframpVaultStatus {\n rateManagerId: string;\n rateManagerAddress: string;\n /**\n * Delegate vault manager fee in basis points (currently 10 = 0.10%). Charged\n * by the vault's rate manager on each fill and deducted from the USDC released\n * to the buyer; not added to the maker's deposit cost. See the README \"Fees\".\n */\n feeRateBps: number;\n escrow: string;\n isActive: boolean;\n}\n\nexport interface OfframpCreateOptions {\n integratorId?: string;\n referralId?: string;\n telemetry?: boolean;\n /**\n * Override the curator REST base URL (default `https://api.zkp2p.xyz`) used\n * for maker registration/validation and the SDK's REST calls. For\n * testing/proxying/mocking only — the indexer and Base RPC always target\n * mainnet. Honored by the `Offramp` class (`createDeposit`); absent ⇒ default\n * behavior is unchanged.\n */\n apiBaseUrl?: string;\n}\n\nexport interface DepositInfo {\n /** Numeric deposit ID. Pass this to `close()`. */\n depositId: string;\n /** Composite ID (escrowAddress_depositId). */\n compositeId: string;\n /** Creation transaction hash. */\n txHash?: string;\n status: DepositStatus;\n remainingUsdc: number;\n outstandingUsdc: number;\n totalTakenUsdc: number;\n fulfilledIntents: number;\n paymentMethods: string[];\n currencies: string[];\n rateSource: string;\n delegated: boolean;\n escrowAddress: string;\n}\n","import {\n DELEGATE_MANAGER_FEE_BPS,\n DELEGATE_RATE_MANAGER_ID,\n ESCROW_ADDRESS,\n RATE_MANAGER_REGISTRY_ADDRESS,\n REFERRER,\n SDK_VERSION,\n} from \"./config\";\n\nexport type OfframpIntegratorProfile =\n | \"app\"\n | \"bot\"\n | \"agent\"\n | \"private-otc\"\n | \"webhooks\"\n | \"peerlytics\";\n\nexport interface OfframpResourceLink {\n label: string;\n href: string;\n description: string;\n}\n\nexport interface OfframpIntegrationStep {\n title: string;\n detail: string;\n}\n\nexport interface OfframpIntegrationPlaybook {\n profile: OfframpIntegratorProfile;\n title: string;\n summary: string;\n steps: OfframpIntegrationStep[];\n resources: OfframpResourceLink[];\n}\n\nexport interface OfframpDeveloperResources {\n packageName: \"@usdctofiat/offramp\";\n sdkVersion: string;\n chain: \"base-mainnet\";\n chainId: 8453;\n referrer: typeof REFERRER;\n delegation: {\n required: true;\n rateManagerId: typeof DELEGATE_RATE_MANAGER_ID;\n rateManagerAddress: typeof RATE_MANAGER_REGISTRY_ADDRESS;\n feeRateBps: typeof DELEGATE_MANAGER_FEE_BPS;\n escrow: typeof ESCROW_ADDRESS;\n };\n links: {\n developerPortal: string;\n sdkGuide: string;\n appGuide: string;\n botGuide: string;\n agentGuide: string;\n webhooksGuide: string;\n privateOtcGuide: string;\n peerlyticsGuide: string;\n agentSkill: string;\n shortMachineReference: string;\n fullMachineReference: string;\n starters: string;\n peerlyticsDevelopers: string;\n peerlyticsPricing: string;\n npm: string;\n };\n playbooks: OfframpIntegrationPlaybook[];\n}\n\nexport const OFFRAMP_RESOURCE_LINKS = {\n developerPortal: \"https://usdctofiat.xyz/developers/\",\n sdkGuide: \"https://usdctofiat.xyz/developers/offramp-sdk/\",\n appGuide: \"https://usdctofiat.xyz/developers/apps/\",\n botGuide: \"https://usdctofiat.xyz/developers/bots/\",\n agentGuide: \"https://usdctofiat.xyz/developers/agents/\",\n webhooksGuide: \"https://usdctofiat.xyz/developers/webhooks/\",\n privateOtcGuide: \"https://usdctofiat.xyz/developers/private-otc/\",\n peerlyticsGuide: \"https://usdctofiat.xyz/developers/peerlytics/\",\n agentSkill: \"https://usdctofiat.xyz/skills/usdctofiat.md\",\n shortMachineReference: \"https://usdctofiat.xyz/llms.txt\",\n fullMachineReference: \"https://usdctofiat.xyz/llms-full.txt\",\n starters: \"https://github.com/ADWilkinson/usdctofiat-peerlytics-starters\",\n peerlyticsDevelopers: \"https://peerlytics.xyz/developers\",\n peerlyticsPricing: \"https://peerlytics.xyz/pricing\",\n npm: \"https://www.npmjs.com/package/@usdctofiat/offramp\",\n} as const;\n\nconst sharedResources: OfframpResourceLink[] = [\n {\n label: \"Developer portal\",\n href: OFFRAMP_RESOURCE_LINKS.developerPortal,\n description: \"Human-readable hub for SDK, webhooks, OTC, bots, agents, and Peerlytics.\",\n },\n {\n label: \"Starter templates\",\n href: OFFRAMP_RESOURCE_LINKS.starters,\n description: \"Next.js, Vite, Telegram-bot, scripts, and HMAC webhook receivers.\",\n },\n {\n label: \"Agent skill\",\n href: OFFRAMP_RESOURCE_LINKS.agentSkill,\n description: \"Drop-in skill file for coding agents integrating the off-ramp.\",\n },\n];\n\nexport const OFFRAMP_INTEGRATION_PLAYBOOKS: OfframpIntegrationPlaybook[] = [\n {\n profile: \"app\",\n title: \"Wallet app\",\n summary: \"Add a sell-USDC button to a user-facing web app.\",\n steps: [\n {\n title: \"Collect route inputs\",\n detail: \"Ask for amount, platform, currency, and the platform-specific payout identifier.\",\n },\n {\n title: \"Call useOfframp or createOfframp\",\n detail:\n \"Pass the user's viem WalletClient so the user signs approval, deposit, and delegation.\",\n },\n {\n title: \"Handle PayPal and Wise registration\",\n detail: \"Catch EXTENSION_REGISTRATION_REQUIRED and drive usePeerExtensionRegistration.\",\n },\n {\n title: \"Reconcile state\",\n detail: \"Use deposits(address) and webhooks rather than assuming the browser stayed open.\",\n },\n ],\n resources: [\n ...sharedResources,\n {\n label: \"App integration guide\",\n href: OFFRAMP_RESOURCE_LINKS.appGuide,\n description: \"User-facing app flow, React hooks, and wallet-state guidance.\",\n },\n {\n label: \"SDK guide\",\n href: OFFRAMP_RESOURCE_LINKS.sdkGuide,\n description: \"Core SDK exports, resumability, errors, and examples.\",\n },\n ],\n },\n {\n profile: \"bot\",\n title: \"Bot or backend worker\",\n summary: \"Create delegated deposits from a server wallet or automation wallet.\",\n steps: [\n {\n title: \"Own duplicate prevention\",\n detail: \"Before creating, call deposits(address) and reuse open inventory when possible.\",\n },\n {\n title: \"Pass stable attribution\",\n detail: \"Use integratorId and referralId so telemetry can separate automated flows.\",\n },\n {\n title: \"Use OTC when a buyer is known\",\n detail: \"Pass otcTaker to avoid exposing known-counterparty liquidity publicly.\",\n },\n {\n title: \"Subscribe to lifecycle state\",\n detail: \"Register HMAC webhooks so fills and closes survive process restarts.\",\n },\n ],\n resources: [\n ...sharedResources,\n {\n label: \"Bot guide\",\n href: OFFRAMP_RESOURCE_LINKS.botGuide,\n description: \"Server-wallet, retry, idempotency, and OTC patterns.\",\n },\n {\n label: \"Webhooks guide\",\n href: OFFRAMP_RESOURCE_LINKS.webhooksGuide,\n description: \"HMAC verification and lifecycle event names.\",\n },\n ],\n },\n {\n profile: \"agent\",\n title: \"Coding agent\",\n summary: \"Give an agent enough canonical context to build without guessing protocol details.\",\n steps: [\n {\n title: \"Load the skill\",\n detail: \"Point the agent at /skills/usdctofiat.md before it writes integration code.\",\n },\n {\n title: \"Use the machine references\",\n detail: \"Feed llms.txt or llms-full.txt when the agent needs routes, contracts, and rules.\",\n },\n {\n title: \"Scaffold first\",\n detail: \"Use create-offramp-app or starters before asking the agent to invent wiring.\",\n },\n {\n title: \"Verify delegation\",\n detail:\n \"Check getVaultStatus() and the returned deposit state; SDK deposits must delegate.\",\n },\n ],\n resources: [\n ...sharedResources,\n {\n label: \"Agent guide\",\n href: OFFRAMP_RESOURCE_LINKS.agentGuide,\n description: \"Context-pack and prompt sequence for AI-assisted integration.\",\n },\n {\n label: \"Full machine reference\",\n href: OFFRAMP_RESOURCE_LINKS.fullMachineReference,\n description: \"Canonical routes, contracts, fees, and extractable answers.\",\n },\n ],\n },\n {\n profile: \"private-otc\",\n title: \"Private OTC flow\",\n summary: \"Restrict a delegated deposit to one approved taker wallet.\",\n steps: [\n {\n title: \"Create with otcTaker\",\n detail:\n \"Pass the buyer wallet in the original offramp() call when the counterparty is known.\",\n },\n {\n title: \"Share the returned otcLink\",\n detail: \"The link is convenience; the whitelist hook is the onchain enforcement.\",\n },\n {\n title: \"Rotate when needed\",\n detail: \"Use enableOtc, disableOtc, and getOtcLink on existing deposits.\",\n },\n ],\n resources: [\n ...sharedResources,\n {\n label: \"Private OTC guide\",\n href: OFFRAMP_RESOURCE_LINKS.privateOtcGuide,\n description: \"Whitelist hook model and helper exports.\",\n },\n ],\n },\n {\n profile: \"webhooks\",\n title: \"Lifecycle webhooks\",\n summary: \"Receive deposit and OTC lifecycle state with HMAC verification.\",\n steps: [\n {\n title: \"Create a Peerlytics API key\",\n detail: \"One key authenticates both Peerlytics and USDCtoFiat developer surfaces.\",\n },\n {\n title: \"Register an endpoint\",\n detail: \"Point the console at an HTTPS endpoint that can read the raw request body.\",\n },\n {\n title: \"Verify before parsing\",\n detail: \"Compute HMAC-SHA256 over timestamp.rawBody and compare to v1 in constant time.\",\n },\n {\n title: \"Reconcile important state\",\n detail: \"Treat events as hints and call deposits(address) or your indexer for hard state.\",\n },\n ],\n resources: [\n ...sharedResources,\n {\n label: \"Webhooks guide\",\n href: OFFRAMP_RESOURCE_LINKS.webhooksGuide,\n description: \"Event names, headers, and replay-window guidance.\",\n },\n {\n label: \"Peerlytics console\",\n href: OFFRAMP_RESOURCE_LINKS.peerlyticsDevelopers,\n description: \"API keys, credits, and endpoint management.\",\n },\n ],\n },\n {\n profile: \"peerlytics\",\n title: \"Peerlytics API\",\n summary: \"Add market data, explorer reads, analytics, and API-credit-backed access.\",\n steps: [\n {\n title: \"Start with deposits\",\n detail: \"@usdctofiat/offramp creates delegated seller inventory without an API key.\",\n },\n {\n title: \"Add the Peerlytics API\",\n detail: \"Use @peerlytics/sdk when the product needs orderbook, analytics, and webhooks.\",\n },\n {\n title: \"Buy credits as usage grows\",\n detail: \"Peerlytics credits back deeper API calls and Pro webhook access.\",\n },\n ],\n resources: [\n ...sharedResources,\n {\n label: \"Peerlytics API guide\",\n href: OFFRAMP_RESOURCE_LINKS.peerlyticsGuide,\n description: \"When to add the paid protocol API alongside the free deposit SDK.\",\n },\n {\n label: \"Peerlytics pricing\",\n href: OFFRAMP_RESOURCE_LINKS.peerlyticsPricing,\n description: \"Credit packs, Free and Pro plans, and API limits.\",\n },\n ],\n },\n];\n\nexport const OFFRAMP_DEVELOPER_RESOURCES: OfframpDeveloperResources = {\n packageName: \"@usdctofiat/offramp\",\n sdkVersion: SDK_VERSION,\n chain: \"base-mainnet\",\n chainId: 8453,\n referrer: REFERRER,\n delegation: {\n required: true,\n rateManagerId: DELEGATE_RATE_MANAGER_ID,\n rateManagerAddress: RATE_MANAGER_REGISTRY_ADDRESS,\n feeRateBps: DELEGATE_MANAGER_FEE_BPS,\n escrow: ESCROW_ADDRESS,\n },\n links: {\n developerPortal: OFFRAMP_RESOURCE_LINKS.developerPortal,\n sdkGuide: OFFRAMP_RESOURCE_LINKS.sdkGuide,\n appGuide: OFFRAMP_RESOURCE_LINKS.appGuide,\n botGuide: OFFRAMP_RESOURCE_LINKS.botGuide,\n agentGuide: OFFRAMP_RESOURCE_LINKS.agentGuide,\n webhooksGuide: OFFRAMP_RESOURCE_LINKS.webhooksGuide,\n privateOtcGuide: OFFRAMP_RESOURCE_LINKS.privateOtcGuide,\n peerlyticsGuide: OFFRAMP_RESOURCE_LINKS.peerlyticsGuide,\n agentSkill: OFFRAMP_RESOURCE_LINKS.agentSkill,\n shortMachineReference: OFFRAMP_RESOURCE_LINKS.shortMachineReference,\n fullMachineReference: OFFRAMP_RESOURCE_LINKS.fullMachineReference,\n starters: OFFRAMP_RESOURCE_LINKS.starters,\n peerlyticsDevelopers: OFFRAMP_RESOURCE_LINKS.peerlyticsDevelopers,\n peerlyticsPricing: OFFRAMP_RESOURCE_LINKS.peerlyticsPricing,\n npm: OFFRAMP_RESOURCE_LINKS.npm,\n },\n playbooks: OFFRAMP_INTEGRATION_PLAYBOOKS,\n};\n\nexport function getOfframpDeveloperResources(\n profile?: OfframpIntegratorProfile,\n): OfframpDeveloperResources | OfframpIntegrationPlaybook {\n if (!profile) return OFFRAMP_DEVELOPER_RESOURCES;\n const playbook = OFFRAMP_INTEGRATION_PLAYBOOKS.find((entry) => entry.profile === profile);\n if (!playbook) return OFFRAMP_DEVELOPER_RESOURCES;\n return playbook;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAM,sBAAsB;AAAA,EACjC,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASrB,iCAAiC;AAAA,EACjC,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,aAAa;AACf;;;ACgDO,IAAM,yBAAyB;AAAA,EACpC,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,uBAAuB;AAAA,EACvB,sBAAsB;AAAA,EACtB,UAAU;AAA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uBAAuB;AAAA,IACjC,UAAU,uBAAuB;AAAA,IACjC,YAAY,uBAAuB;AAAA,IACnC,eAAe,uBAAuB;AAAA,IACtC,iBAAiB,uBAAuB;AAAA,IACxC,iBAAiB,uBAAuB;AAAA,IACxC,YAAY,uBAAuB;AAAA,IACnC,uBAAuB,uBAAuB;AAAA,IAC9C,sBAAsB,uBAAuB;AAAA,IAC7C,UAAU,uBAAuB;AAAA,IACjC,sBAAsB,uBAAuB;AAAA,IAC7C,mBAAmB,uBAAuB;AAAA,IAC1C,KAAK,uBAAuB;AAAA,EAC9B;AAAA,EACA,WAAW;AACb;AAEO,SAAS,6BACd,SACwD;AACxD,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,WAAW,8BAA8B,KAAK,CAAC,UAAU,MAAM,YAAY,OAAO;AACxF,MAAI,CAAC,SAAU,QAAO;AACtB,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/taker-tier.ts","../src/types.ts","../src/resources.ts"],"sourcesContent":["import {\n apiGetTakerTier,\n type GetTakerTierResponse,\n type TakerTierLevel,\n} from \"@zkp2p/sdk\";\nimport { API_BASE_URL, BASE_CHAIN_ID, PAYEE_REGISTRATION_TIMEOUT_MS } from \"./config\";\n\nexport type TakerTier = GetTakerTierResponse[\"responseObject\"];\nexport type TakerPlatformLimit = NonNullable<TakerTier[\"platformLimits\"]>[number];\n\nexport interface GetTakerTierInput {\n readonly owner: string;\n readonly chainId?: number;\n readonly apiBaseUrl?: string;\n readonly timeoutMs?: number;\n}\n\nexport interface TakerPlatformLimitLookup {\n readonly platform?: string | null;\n readonly paymentMethodHash?: string | null;\n}\n\nexport interface ResolvedTakerPlatformLimit {\n readonly tier: TakerTierLevel;\n readonly limit: TakerPlatformLimit | null;\n}\n\nexport async function getTakerTier({\n owner,\n chainId = BASE_CHAIN_ID,\n apiBaseUrl = API_BASE_URL,\n timeoutMs = PAYEE_REGISTRATION_TIMEOUT_MS,\n}: GetTakerTierInput): Promise<TakerTier> {\n const response = await apiGetTakerTier({ owner, chainId }, apiBaseUrl, timeoutMs);\n if (!response.success || !response.responseObject) {\n throw new Error(response.message || \"Failed to load taker tier.\");\n }\n return response.responseObject;\n}\n\nexport function findTakerPlatformLimit(\n tier: TakerTier | null | undefined,\n lookup: TakerPlatformLimitLookup,\n): TakerPlatformLimit | null {\n const limits = tier?.platformLimits ?? [];\n const platform = lookup.platform?.trim().toLowerCase() || null;\n const paymentMethodHash = lookup.paymentMethodHash?.trim().toLowerCase() || null;\n if (!platform && !paymentMethodHash) return null;\n\n return (\n limits.find((limit) => {\n const limitHash = limit.paymentMethodHash?.trim().toLowerCase();\n if (paymentMethodHash && limitHash === paymentMethodHash) return true;\n\n const limitPlatform = limit.platformName?.trim().toLowerCase();\n if (!platform || !limitPlatform) return false;\n if (limitPlatform === platform) return true;\n\n return platform.startsWith(\"zelle\") && limitPlatform.startsWith(\"zelle\");\n }) ?? null\n );\n}\n\nexport function resolveTakerPlatformLimit(\n tier: TakerTier | null | undefined,\n lookup: TakerPlatformLimitLookup,\n): ResolvedTakerPlatformLimit | null {\n if (!tier) return null;\n return {\n tier: tier.tier,\n limit: findTakerPlatformLimit(tier, lookup),\n };\n}\n","import type { PlatformEntry } from \"./platforms\";\nimport type { CurrencyEntry } from \"./currencies\";\n\nexport const OFFRAMP_ERROR_CODES = {\n VALIDATION: \"VALIDATION\",\n APPROVAL_FAILED: \"APPROVAL_FAILED\",\n REGISTRATION_FAILED: \"REGISTRATION_FAILED\",\n /**\n * Curator rejected the maker because the user has not registered this\n * handle in the Peer extension yet. Thrown from `offramp()` for PayPal\n * and Wise when `/v2/makers/create` returns 400 or a \"creating the maker\"\n * message. Recover by prompting the user through the Peer extension via\n * `usePeerExtensionRegistration(platform)` (React) or\n * `completePeerExtensionRegistration(...)`, then retrying `offramp()`.\n */\n EXTENSION_REGISTRATION_REQUIRED: \"EXTENSION_REGISTRATION_REQUIRED\",\n DEPOSIT_FAILED: \"DEPOSIT_FAILED\",\n CONFIRMATION_FAILED: \"CONFIRMATION_FAILED\",\n DELEGATION_FAILED: \"DELEGATION_FAILED\",\n USER_CANCELLED: \"USER_CANCELLED\",\n UNSUPPORTED: \"UNSUPPORTED\",\n} as const;\n\nexport type OfframpErrorCode = (typeof OFFRAMP_ERROR_CODES)[keyof typeof OFFRAMP_ERROR_CODES];\n\nexport interface OfframpParams {\n /** USDC amount as decimal string, min 1. */\n amount: string;\n /** Payment platform — use `PLATFORMS.REVOLUT` etc. */\n platform: PlatformEntry;\n /** Fiat currency — use `CURRENCIES.EUR` etc. */\n currency: CurrencyEntry;\n /** Platform-specific identifier (username, email, IBAN). */\n identifier: string;\n /** Optional: restrict the deposit to this taker wallet (OTC private order). */\n otcTaker?: string;\n /** Optional SDK-only referral metadata for telemetry attribution. */\n referralId?: string;\n /** Optional SDK-only integrator metadata for telemetry attribution. */\n integratorId?: string;\n /**\n * Optional per-wallet key to replay the first successful result for 10 minutes.\n *\n * Browser-only: the replay cache is backed by `sessionStorage` and is a no-op\n * in Node/worker runtimes (no duplicate protection there). It is honored only\n * by the `Offramp` class (`createDeposit`) / the `useOfframp` hook — the\n * standalone `offramp()` function ignores it. For server-side dedup, call\n * `deposits(walletAddress)` and reuse an existing open deposit before creating\n * a new one (the SDK's own resume behavior does this for the delegation step).\n */\n idempotencyKey?: string;\n}\n\nexport interface OfframpResult {\n depositId: string;\n txHash: string;\n /** Whether an existing undelegated deposit was resumed. */\n resumed: boolean;\n /** OTC link for the taker, present when `otcTaker` was provided. */\n otcLink?: string;\n}\n\nexport type OfframpStep =\n | \"approving\"\n | \"registering\"\n | \"depositing\"\n | \"confirming\"\n | \"delegating\"\n | \"restricting\"\n | \"resuming\"\n | \"done\";\n\nexport type OfframpState =\n | \"idle\"\n | \"approving\"\n | \"registering\"\n | \"depositing\"\n | \"confirming\"\n | \"delegating\"\n | \"done\"\n | \"error\";\n\nexport interface OfframpProgress {\n step: OfframpStep;\n txHash?: string;\n depositId?: string;\n}\n\nexport type OnProgress = (progress: OfframpProgress) => void;\n\nexport type DepositStatus = \"active\" | \"empty\" | \"closed\";\n\nexport interface OfframpQuoteInput {\n amount: string;\n currency: CurrencyEntry;\n platform: PlatformEntry;\n}\n\nexport interface OfframpQuote {\n amountUsdc: number;\n expectedFiat: number;\n effectiveRate: number;\n vaultSpreadBps: number;\n}\n\nexport interface OfframpVaultStatus {\n rateManagerId: string;\n rateManagerAddress: string;\n /**\n * Delegate vault manager fee in basis points (currently 10 = 0.10%). Charged\n * by the vault's rate manager on each fill and deducted from the USDC released\n * to the buyer; not added to the maker's deposit cost. See the README \"Fees\".\n */\n feeRateBps: number;\n escrow: string;\n isActive: boolean;\n}\n\nexport interface OfframpCreateOptions {\n integratorId?: string;\n referralId?: string;\n telemetry?: boolean;\n /**\n * Override the curator REST base URL (default `https://api.zkp2p.xyz`) used\n * for maker registration/validation and the SDK's REST calls. For\n * testing/proxying/mocking only — the indexer and Base RPC always target\n * mainnet. Honored by the `Offramp` class (`createDeposit`); absent ⇒ default\n * behavior is unchanged.\n */\n apiBaseUrl?: string;\n}\n\nexport interface DepositInfo {\n /** Numeric deposit ID. Pass this to `close()`. */\n depositId: string;\n /** Composite ID (escrowAddress_depositId). */\n compositeId: string;\n /** Creation transaction hash. */\n txHash?: string;\n status: DepositStatus;\n remainingUsdc: number;\n outstandingUsdc: number;\n totalTakenUsdc: number;\n fulfilledIntents: number;\n paymentMethods: string[];\n currencies: string[];\n rateSource: string;\n delegated: boolean;\n escrowAddress: string;\n}\n","import {\n DELEGATE_MANAGER_FEE_BPS,\n DELEGATE_RATE_MANAGER_ID,\n ESCROW_ADDRESS,\n RATE_MANAGER_REGISTRY_ADDRESS,\n REFERRER,\n SDK_VERSION,\n} from \"./config\";\n\nexport type OfframpIntegratorProfile =\n | \"app\"\n | \"bot\"\n | \"agent\"\n | \"private-otc\"\n | \"webhooks\"\n | \"peerlytics\";\n\nexport interface OfframpResourceLink {\n label: string;\n href: string;\n description: string;\n}\n\nexport interface OfframpIntegrationStep {\n title: string;\n detail: string;\n}\n\nexport interface OfframpIntegrationCheck {\n title: string;\n detail: string;\n required: true;\n}\n\nexport interface OfframpIntegrationPlaybook {\n profile: OfframpIntegratorProfile;\n title: string;\n summary: string;\n steps: OfframpIntegrationStep[];\n resources: OfframpResourceLink[];\n}\n\nexport interface OfframpDeveloperResources {\n packageName: \"@usdctofiat/offramp\";\n sdkVersion: string;\n chain: \"base-mainnet\";\n chainId: 8453;\n referrer: typeof REFERRER;\n delegation: {\n required: true;\n rateManagerId: typeof DELEGATE_RATE_MANAGER_ID;\n rateManagerAddress: typeof RATE_MANAGER_REGISTRY_ADDRESS;\n feeRateBps: typeof DELEGATE_MANAGER_FEE_BPS;\n escrow: typeof ESCROW_ADDRESS;\n };\n links: {\n developerPortal: string;\n sdkGuide: string;\n appGuide: string;\n botGuide: string;\n agentGuide: string;\n webhooksGuide: string;\n privateOtcGuide: string;\n peerlyticsGuide: string;\n agentSkill: string;\n shortMachineReference: string;\n fullMachineReference: string;\n starters: string;\n peerlyticsDevelopers: string;\n peerlyticsPricing: string;\n npm: string;\n };\n playbooks: OfframpIntegrationPlaybook[];\n checklist: OfframpIntegrationCheck[];\n}\n\nexport const OFFRAMP_RESOURCE_LINKS = {\n developerPortal: \"https://usdctofiat.xyz/developers/\",\n sdkGuide: \"https://usdctofiat.xyz/developers/offramp-sdk/\",\n appGuide: \"https://usdctofiat.xyz/developers/apps/\",\n botGuide: \"https://usdctofiat.xyz/developers/bots/\",\n agentGuide: \"https://usdctofiat.xyz/developers/agents/\",\n webhooksGuide: \"https://usdctofiat.xyz/developers/webhooks/\",\n privateOtcGuide: \"https://usdctofiat.xyz/developers/private-otc/\",\n peerlyticsGuide: \"https://usdctofiat.xyz/developers/peerlytics/\",\n agentSkill: \"https://usdctofiat.xyz/skills/usdctofiat.md\",\n shortMachineReference: \"https://usdctofiat.xyz/llms.txt\",\n fullMachineReference: \"https://usdctofiat.xyz/llms-full.txt\",\n starters: \"https://github.com/ADWilkinson/usdctofiat-peerlytics-starters\",\n peerlyticsDevelopers: \"https://peerlytics.xyz/developers\",\n peerlyticsPricing: \"https://peerlytics.xyz/pricing\",\n npm: \"https://www.npmjs.com/package/@usdctofiat/offramp\",\n} as const;\n\nconst sharedResources: OfframpResourceLink[] = [\n {\n label: \"Developer portal\",\n href: OFFRAMP_RESOURCE_LINKS.developerPortal,\n description: \"Human-readable hub for SDK, webhooks, OTC, bots, agents, and Peerlytics.\",\n },\n {\n label: \"Starter templates\",\n href: OFFRAMP_RESOURCE_LINKS.starters,\n description: \"Next.js, Vite, Telegram-bot, scripts, and HMAC webhook receivers.\",\n },\n {\n label: \"Agent skill\",\n href: OFFRAMP_RESOURCE_LINKS.agentSkill,\n description: \"Drop-in skill file for coding agents integrating the off-ramp.\",\n },\n];\n\nexport const OFFRAMP_INTEGRATION_PLAYBOOKS: OfframpIntegrationPlaybook[] = [\n {\n profile: \"app\",\n title: \"Wallet app\",\n summary: \"Add a sell-USDC button to a user-facing web app.\",\n steps: [\n {\n title: \"Collect route inputs\",\n detail: \"Ask for amount, platform, currency, and the platform-specific payout identifier.\",\n },\n {\n title: \"Call useOfframp or createOfframp\",\n detail:\n \"Pass the user's viem WalletClient so the user signs approval, deposit, and delegation.\",\n },\n {\n title: \"Handle SAR registration\",\n detail: \"Catch EXTENSION_REGISTRATION_REQUIRED and drive usePeerExtensionRegistration.\",\n },\n {\n title: \"Reconcile state\",\n detail: \"Use deposits(address) and webhooks rather than assuming the browser stayed open.\",\n },\n ],\n resources: [\n ...sharedResources,\n {\n label: \"App integration guide\",\n href: OFFRAMP_RESOURCE_LINKS.appGuide,\n description: \"User-facing app flow, React hooks, and wallet-state guidance.\",\n },\n {\n label: \"SDK guide\",\n href: OFFRAMP_RESOURCE_LINKS.sdkGuide,\n description: \"Core SDK exports, resumability, errors, and examples.\",\n },\n ],\n },\n {\n profile: \"bot\",\n title: \"Bot or backend worker\",\n summary: \"Create delegated deposits from a server wallet or automation wallet.\",\n steps: [\n {\n title: \"Own duplicate prevention\",\n detail: \"Before creating, call deposits(address) and reuse open inventory when possible.\",\n },\n {\n title: \"Pass stable attribution\",\n detail: \"Use integratorId and referralId so telemetry can separate automated flows.\",\n },\n {\n title: \"Use OTC when a buyer is known\",\n detail: \"Pass otcTaker to avoid exposing known-counterparty liquidity publicly.\",\n },\n {\n title: \"Subscribe to lifecycle state\",\n detail: \"Register HMAC webhooks so fills and closes survive process restarts.\",\n },\n ],\n resources: [\n ...sharedResources,\n {\n label: \"Bot guide\",\n href: OFFRAMP_RESOURCE_LINKS.botGuide,\n description: \"Server-wallet, retry, idempotency, and OTC patterns.\",\n },\n {\n label: \"Webhooks guide\",\n href: OFFRAMP_RESOURCE_LINKS.webhooksGuide,\n description: \"HMAC verification and lifecycle event names.\",\n },\n ],\n },\n {\n profile: \"agent\",\n title: \"Coding agent\",\n summary: \"Give an agent enough canonical context to build without guessing protocol details.\",\n steps: [\n {\n title: \"Load the skill\",\n detail: \"Point the agent at /skills/usdctofiat.md before it writes integration code.\",\n },\n {\n title: \"Use the machine references\",\n detail: \"Feed llms.txt or llms-full.txt when the agent needs routes, contracts, and rules.\",\n },\n {\n title: \"Scaffold first\",\n detail: \"Use create-offramp-app or starters before asking the agent to invent wiring.\",\n },\n {\n title: \"Verify delegation\",\n detail:\n \"Check getVaultStatus() and the returned deposit state; SDK deposits must delegate.\",\n },\n ],\n resources: [\n ...sharedResources,\n {\n label: \"Agent guide\",\n href: OFFRAMP_RESOURCE_LINKS.agentGuide,\n description: \"Context-pack and prompt sequence for AI-assisted integration.\",\n },\n {\n label: \"Full machine reference\",\n href: OFFRAMP_RESOURCE_LINKS.fullMachineReference,\n description: \"Canonical routes, contracts, fees, and extractable answers.\",\n },\n ],\n },\n {\n profile: \"private-otc\",\n title: \"Private OTC flow\",\n summary: \"Restrict a delegated deposit to one approved taker wallet.\",\n steps: [\n {\n title: \"Create with otcTaker\",\n detail:\n \"Pass the buyer wallet in the original offramp() call when the counterparty is known.\",\n },\n {\n title: \"Share the returned otcLink\",\n detail: \"The link is convenience; the whitelist hook is the onchain enforcement.\",\n },\n {\n title: \"Rotate when needed\",\n detail: \"Use enableOtc, disableOtc, and getOtcLink on existing deposits.\",\n },\n ],\n resources: [\n ...sharedResources,\n {\n label: \"Private OTC guide\",\n href: OFFRAMP_RESOURCE_LINKS.privateOtcGuide,\n description: \"Whitelist hook model and helper exports.\",\n },\n ],\n },\n {\n profile: \"webhooks\",\n title: \"Lifecycle webhooks\",\n summary: \"Receive deposit and OTC lifecycle state with HMAC verification.\",\n steps: [\n {\n title: \"Create a Peerlytics API key\",\n detail: \"One key authenticates both Peerlytics and USDCtoFiat developer surfaces.\",\n },\n {\n title: \"Register an endpoint\",\n detail: \"Point the console at an HTTPS endpoint that can read the raw request body.\",\n },\n {\n title: \"Verify before parsing\",\n detail: \"Compute HMAC-SHA256 over timestamp.rawBody and compare to v1 in constant time.\",\n },\n {\n title: \"Reconcile important state\",\n detail: \"Treat events as hints and call deposits(address) or your indexer for hard state.\",\n },\n ],\n resources: [\n ...sharedResources,\n {\n label: \"Webhooks guide\",\n href: OFFRAMP_RESOURCE_LINKS.webhooksGuide,\n description: \"Event names, headers, and replay-window guidance.\",\n },\n {\n label: \"Peerlytics console\",\n href: OFFRAMP_RESOURCE_LINKS.peerlyticsDevelopers,\n description: \"API keys, credits, and endpoint management.\",\n },\n ],\n },\n {\n profile: \"peerlytics\",\n title: \"Peerlytics API\",\n summary: \"Add market data, explorer reads, analytics, and API-credit-backed access.\",\n steps: [\n {\n title: \"Start with deposits\",\n detail: \"@usdctofiat/offramp creates delegated seller inventory without an API key.\",\n },\n {\n title: \"Add the Peerlytics API\",\n detail: \"Use @peerlytics/sdk when the product needs orderbook, analytics, and webhooks.\",\n },\n {\n title: \"Buy credits as usage grows\",\n detail: \"Peerlytics credits back deeper API calls and Pro webhook access.\",\n },\n ],\n resources: [\n ...sharedResources,\n {\n label: \"Peerlytics API guide\",\n href: OFFRAMP_RESOURCE_LINKS.peerlyticsGuide,\n description: \"When to add the paid protocol API alongside the free deposit SDK.\",\n },\n {\n label: \"Peerlytics pricing\",\n href: OFFRAMP_RESOURCE_LINKS.peerlyticsPricing,\n description: \"Credit packs, Free and Pro plans, and API limits.\",\n },\n ],\n },\n];\n\nexport const OFFRAMP_INTEGRATION_CHECKLIST: OfframpIntegrationCheck[] = [\n {\n title: \"Base mainnet wallet client\",\n detail: \"Use a viem WalletClient on chain 8453. The SDK has no public sandbox mode.\",\n required: true,\n },\n {\n title: \"Delegate-vault pricing\",\n detail: \"Every SDK-created deposit must delegate pricing to the managed Delegate vault.\",\n required: true,\n },\n {\n title: \"PayPal/Wise recovery path\",\n detail: \"Catch EXTENSION_REGISTRATION_REQUIRED and drive Peer extension seller registration.\",\n required: true,\n },\n {\n title: \"Server-side duplicate prevention\",\n detail:\n \"Bots and workers must call deposits(address) and use their own order database; idempotencyKey is browser-session scoped and the standalone offramp() helper ignores it.\",\n required: true,\n },\n {\n title: \"Raw-body webhook verification\",\n detail: \"Verify timestamp.rawBody with HMAC-SHA256 before parsing JSON.\",\n required: true,\n },\n];\n\nexport const OFFRAMP_DEVELOPER_RESOURCES: OfframpDeveloperResources = {\n packageName: \"@usdctofiat/offramp\",\n sdkVersion: SDK_VERSION,\n chain: \"base-mainnet\",\n chainId: 8453,\n referrer: REFERRER,\n delegation: {\n required: true,\n rateManagerId: DELEGATE_RATE_MANAGER_ID,\n rateManagerAddress: RATE_MANAGER_REGISTRY_ADDRESS,\n feeRateBps: DELEGATE_MANAGER_FEE_BPS,\n escrow: ESCROW_ADDRESS,\n },\n links: {\n developerPortal: OFFRAMP_RESOURCE_LINKS.developerPortal,\n sdkGuide: OFFRAMP_RESOURCE_LINKS.sdkGuide,\n appGuide: OFFRAMP_RESOURCE_LINKS.appGuide,\n botGuide: OFFRAMP_RESOURCE_LINKS.botGuide,\n agentGuide: OFFRAMP_RESOURCE_LINKS.agentGuide,\n webhooksGuide: OFFRAMP_RESOURCE_LINKS.webhooksGuide,\n privateOtcGuide: OFFRAMP_RESOURCE_LINKS.privateOtcGuide,\n peerlyticsGuide: OFFRAMP_RESOURCE_LINKS.peerlyticsGuide,\n agentSkill: OFFRAMP_RESOURCE_LINKS.agentSkill,\n shortMachineReference: OFFRAMP_RESOURCE_LINKS.shortMachineReference,\n fullMachineReference: OFFRAMP_RESOURCE_LINKS.fullMachineReference,\n starters: OFFRAMP_RESOURCE_LINKS.starters,\n peerlyticsDevelopers: OFFRAMP_RESOURCE_LINKS.peerlyticsDevelopers,\n peerlyticsPricing: OFFRAMP_RESOURCE_LINKS.peerlyticsPricing,\n npm: OFFRAMP_RESOURCE_LINKS.npm,\n },\n playbooks: OFFRAMP_INTEGRATION_PLAYBOOKS,\n checklist: OFFRAMP_INTEGRATION_CHECKLIST,\n};\n\nexport function getOfframpDeveloperResources(\n profile?: OfframpIntegratorProfile,\n): OfframpDeveloperResources | OfframpIntegrationPlaybook {\n if (!profile) return OFFRAMP_DEVELOPER_RESOURCES;\n const playbook = OFFRAMP_INTEGRATION_PLAYBOOKS.find((entry) => entry.profile === profile);\n if (!playbook) return OFFRAMP_DEVELOPER_RESOURCES;\n return playbook;\n}\n\nexport function getOfframpAgentPrompt(profile: OfframpIntegratorProfile = \"app\"): string {\n const playbook = getOfframpDeveloperResources(profile);\n const resource =\n \"profile\" in playbook\n ? playbook\n : OFFRAMP_INTEGRATION_PLAYBOOKS.find((entry) => entry.profile === \"app\");\n const steps = resource?.steps.map((step, index) => `${index + 1}. ${step.title}: ${step.detail}`);\n\n return [\n \"Build a USDC-to-fiat integration with @usdctofiat/offramp.\",\n `Profile: ${profile}.`,\n \"Before coding, read https://usdctofiat.xyz/skills/usdctofiat.md and https://usdctofiat.xyz/llms.txt.\",\n \"Use Base mainnet chainId 8453 and a viem WalletClient; do not invent a sandbox.\",\n \"Do not add manual rate controls; SDK-created deposits must delegate to the Delegate vault.\",\n \"For PayPal, Wise, Venmo, and Cash App, recover EXTENSION_REGISTRATION_REQUIRED through the Peer extension registration flow.\",\n \"For bots/workers, deduplicate with deposits(address) plus your own order database; do not rely on idempotencyKey.\",\n \"For webhooks, verify the raw request body before parsing JSON.\",\n ...(steps ?? []),\n ].join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,OAGK;AAuBP,eAAsB,aAAa;AAAA,EACjC;AAAA,EACA,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AACd,GAA0C;AACxC,QAAM,WAAW,MAAM,gBAAgB,EAAE,OAAO,QAAQ,GAAG,YAAY,SAAS;AAChF,MAAI,CAAC,SAAS,WAAW,CAAC,SAAS,gBAAgB;AACjD,UAAM,IAAI,MAAM,SAAS,WAAW,4BAA4B;AAAA,EAClE;AACA,SAAO,SAAS;AAClB;AAEO,SAAS,uBACd,MACA,QAC2B;AAC3B,QAAM,SAAS,MAAM,kBAAkB,CAAC;AACxC,QAAM,WAAW,OAAO,UAAU,KAAK,EAAE,YAAY,KAAK;AAC1D,QAAM,oBAAoB,OAAO,mBAAmB,KAAK,EAAE,YAAY,KAAK;AAC5E,MAAI,CAAC,YAAY,CAAC,kBAAmB,QAAO;AAE5C,SACE,OAAO,KAAK,CAAC,UAAU;AACrB,UAAM,YAAY,MAAM,mBAAmB,KAAK,EAAE,YAAY;AAC9D,QAAI,qBAAqB,cAAc,kBAAmB,QAAO;AAEjE,UAAM,gBAAgB,MAAM,cAAc,KAAK,EAAE,YAAY;AAC7D,QAAI,CAAC,YAAY,CAAC,cAAe,QAAO;AACxC,QAAI,kBAAkB,SAAU,QAAO;AAEvC,WAAO,SAAS,WAAW,OAAO,KAAK,cAAc,WAAW,OAAO;AAAA,EACzE,CAAC,KAAK;AAEV;AAEO,SAAS,0BACd,MACA,QACmC;AACnC,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO;AAAA,IACL,MAAM,KAAK;AAAA,IACX,OAAO,uBAAuB,MAAM,MAAM;AAAA,EAC5C;AACF;;;ACrEO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,uBAAuB;AAAA,EAC9B;AAAA,EACA,WAAW;AAAA,EACX,WAAW;AACb;AAEO,SAAS,6BACd,SACwD;AACxD,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,WAAW,8BAA8B,KAAK,CAAC,UAAU,MAAM,YAAY,OAAO;AACxF,MAAI,CAAC,SAAU,QAAO;AACtB,SAAO;AACT;AAEO,SAAS,sBAAsB,UAAoC,OAAe;AACvF,QAAM,WAAW,6BAA6B,OAAO;AACrD,QAAM,WACJ,aAAa,WACT,WACA,8BAA8B,KAAK,CAAC,UAAU,MAAM,YAAY,KAAK;AAC3E,QAAM,QAAQ,UAAU,MAAM,IAAI,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,MAAM,EAAE;AAEhG,SAAO;AAAA,IACL;AAAA,IACA,YAAY,OAAO;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,SAAS,CAAC;AAAA,EAChB,EAAE,KAAK,IAAI;AACb;","names":[]}
|
package/dist/react.cjs
CHANGED
|
@@ -40,7 +40,7 @@ var import_react = require("react");
|
|
|
40
40
|
|
|
41
41
|
// src/config.ts
|
|
42
42
|
var import_sdk = require("@zkp2p/sdk");
|
|
43
|
-
var SDK_VERSION = "4.
|
|
43
|
+
var SDK_VERSION = "4.4.0";
|
|
44
44
|
var BASE_CHAIN_ID = 8453;
|
|
45
45
|
var RUNTIME_ENV = "production";
|
|
46
46
|
var API_BASE_URL = "https://api.zkp2p.xyz";
|
|
@@ -199,9 +199,7 @@ var FALLBACK_CURRENCIES = {
|
|
|
199
199
|
mercadopago: ["ARS"],
|
|
200
200
|
zelle: ["USD"],
|
|
201
201
|
paypal: ["USD", "EUR", "GBP", "SGD", "NZD", "AUD", "CAD"],
|
|
202
|
-
monzo: ["GBP"]
|
|
203
|
-
n26: ["EUR"],
|
|
204
|
-
luxon: ["USD", "EUR", "GBP"]
|
|
202
|
+
monzo: ["GBP"]
|
|
205
203
|
};
|
|
206
204
|
function gatherCatalogHashes(platform) {
|
|
207
205
|
if (platform === "zelle") {
|
|
@@ -244,21 +242,6 @@ function normalizePaypalMeUsername(value) {
|
|
|
244
242
|
}
|
|
245
243
|
return trimmed.replace(/^@+/, "").toLowerCase();
|
|
246
244
|
}
|
|
247
|
-
function isValidIBAN(iban) {
|
|
248
|
-
const upper = iban.toUpperCase();
|
|
249
|
-
if (!/^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/.test(upper)) return false;
|
|
250
|
-
const rearranged = upper.slice(4) + upper.slice(0, 4);
|
|
251
|
-
const numeric = rearranged.split("").map((ch) => {
|
|
252
|
-
const code = ch.charCodeAt(0);
|
|
253
|
-
return code >= 65 && code <= 90 ? (code - 55).toString() : ch;
|
|
254
|
-
}).join("");
|
|
255
|
-
let remainder = numeric;
|
|
256
|
-
while (remainder.length > 2) {
|
|
257
|
-
const block = remainder.slice(0, 9);
|
|
258
|
-
remainder = (parseInt(block, 10) % 97).toString() + remainder.slice(block.length);
|
|
259
|
-
}
|
|
260
|
-
return parseInt(remainder, 10) % 97 === 1;
|
|
261
|
-
}
|
|
262
245
|
var BLUEPRINTS = {
|
|
263
246
|
venmo: {
|
|
264
247
|
id: "venmo",
|
|
@@ -267,7 +250,12 @@ var BLUEPRINTS = {
|
|
|
267
250
|
placeholder: "venmo username (no @)",
|
|
268
251
|
helperText: "Username without @ (publicly discoverable)",
|
|
269
252
|
validation: import_zod.z.string().min(1).regex(/^[a-zA-Z0-9_-]+$/),
|
|
270
|
-
transform: (v) => v.replace(/^@+/, "")
|
|
253
|
+
transform: (v) => v.replace(/^@+/, ""),
|
|
254
|
+
extensionRegistration: {
|
|
255
|
+
providerId: "venmo",
|
|
256
|
+
requiredPrompt: "This Venmo username is not registered yet. Register it with PeerAuth, then retry with the same Venmo username.",
|
|
257
|
+
ctaLabel: "Register Venmo Username"
|
|
258
|
+
}
|
|
271
259
|
},
|
|
272
260
|
cashapp: {
|
|
273
261
|
id: "cashapp",
|
|
@@ -276,7 +264,12 @@ var BLUEPRINTS = {
|
|
|
276
264
|
placeholder: "cashtag (no $)",
|
|
277
265
|
helperText: "Cashtag without $ (publicly discoverable)",
|
|
278
266
|
validation: import_zod.z.string().min(1).regex(/^[a-zA-Z0-9]+$/),
|
|
279
|
-
transform: (v) => v.replace(/^\$+/, "")
|
|
267
|
+
transform: (v) => v.replace(/^\$+/, ""),
|
|
268
|
+
extensionRegistration: {
|
|
269
|
+
providerId: "cashapp",
|
|
270
|
+
requiredPrompt: "This Cash App cashtag is not registered yet. Register it with PeerAuth, then retry with the same cashtag.",
|
|
271
|
+
ctaLabel: "Register Cash App Cashtag"
|
|
272
|
+
}
|
|
280
273
|
},
|
|
281
274
|
chime: {
|
|
282
275
|
id: "chime",
|
|
@@ -358,27 +351,6 @@ var BLUEPRINTS = {
|
|
|
358
351
|
placeholder: "monzo.me username",
|
|
359
352
|
helperText: "Your Monzo.me username",
|
|
360
353
|
validation: import_zod.z.string().min(1).regex(/^[a-zA-Z0-9_-]+$/)
|
|
361
|
-
},
|
|
362
|
-
n26: {
|
|
363
|
-
id: "n26",
|
|
364
|
-
name: "N26",
|
|
365
|
-
identifierLabel: "IBAN",
|
|
366
|
-
placeholder: "IBAN (e.g. DE89...)",
|
|
367
|
-
helperText: "Your IBAN (spaces will be removed)",
|
|
368
|
-
// transform runs before validation, so the schema sees a spaceless,
|
|
369
|
-
// uppercased IBAN. The MOD-97 refine mirrors curator's N26Processor so a
|
|
370
|
-
// typo'd-but-well-formed IBAN fails here, not after USDC approval + gas.
|
|
371
|
-
validation: import_zod.z.string().regex(/^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/, "Enter a valid IBAN").refine(isValidIBAN, "That IBAN looks wrong \u2014 its checksum doesn't match"),
|
|
372
|
-
transform: (v) => v.replace(/\s/g, "").toUpperCase()
|
|
373
|
-
},
|
|
374
|
-
luxon: {
|
|
375
|
-
id: "luxon",
|
|
376
|
-
name: "Luxon",
|
|
377
|
-
identifierLabel: "Email",
|
|
378
|
-
placeholder: "your-luxon-email@example.com",
|
|
379
|
-
helperText: "Email address registered with Luxon",
|
|
380
|
-
validation: import_zod.z.string().email(),
|
|
381
|
-
transform: (v) => v.trim()
|
|
382
354
|
}
|
|
383
355
|
};
|
|
384
356
|
function buildPlatformEntry(bp) {
|
|
@@ -416,9 +388,7 @@ var PLATFORMS = {
|
|
|
416
388
|
MERCADO_PAGO: buildPlatformEntry(BLUEPRINTS.mercadopago),
|
|
417
389
|
ZELLE: buildPlatformEntry(BLUEPRINTS.zelle),
|
|
418
390
|
PAYPAL: buildPlatformEntry(BLUEPRINTS.paypal),
|
|
419
|
-
MONZO: buildPlatformEntry(BLUEPRINTS.monzo)
|
|
420
|
-
N26: buildPlatformEntry(BLUEPRINTS.n26),
|
|
421
|
-
LUXON: buildPlatformEntry(BLUEPRINTS.luxon)
|
|
391
|
+
MONZO: buildPlatformEntry(BLUEPRINTS.monzo)
|
|
422
392
|
};
|
|
423
393
|
function getPlatformById(id) {
|
|
424
394
|
return Object.values(PLATFORMS).find((p) => p.id === id) ?? null;
|
|
@@ -432,16 +402,26 @@ function normalizePaymentMethodLookupName(platform) {
|
|
|
432
402
|
const ids = Object.values(PLATFORMS).map((p) => p.id);
|
|
433
403
|
return ids.includes(normalized) ? normalized : null;
|
|
434
404
|
}
|
|
405
|
+
var ZELLE_CREATE_LOOKUP_NAMES = ["zelle-chase", "zelle-bofa", "zelle-citi"];
|
|
435
406
|
var GENERIC_ZELLE_METHOD_HASH = (0, import_sdk3.resolvePaymentMethodHash)("zelle") ?? null;
|
|
436
|
-
function
|
|
407
|
+
function resolveGenericZelleHash() {
|
|
437
408
|
return GENERIC_ZELLE_METHOD_HASH;
|
|
438
409
|
}
|
|
410
|
+
function getZelleCreateEntries() {
|
|
411
|
+
const entries = [];
|
|
412
|
+
for (const name of ZELLE_CREATE_LOOKUP_NAMES) {
|
|
413
|
+
const hash = getPaymentMethodHash(name);
|
|
414
|
+
if (hash) entries.push({ name, hash });
|
|
415
|
+
}
|
|
416
|
+
return entries;
|
|
417
|
+
}
|
|
439
418
|
function getPaymentMethodHash(platform) {
|
|
440
419
|
const name = normalizePaymentMethodLookupName(platform);
|
|
441
420
|
if (!name) return null;
|
|
442
421
|
const catalogEntry = PAYMENT_CATALOG[name];
|
|
443
422
|
if (catalogEntry?.paymentMethodHash) return catalogEntry.paymentMethodHash;
|
|
444
|
-
if (name === "zelle"
|
|
423
|
+
if (name === "zelle") return resolveGenericZelleHash();
|
|
424
|
+
if (name.startsWith("zelle-")) return (0, import_sdk3.resolvePaymentMethodHash)(name);
|
|
445
425
|
const sdkHash = (0, import_sdk3.resolvePaymentMethodHash)(name);
|
|
446
426
|
return sdkHash ? sdkHash : null;
|
|
447
427
|
}
|
|
@@ -450,16 +430,16 @@ function getPaymentMethodHashes(platform) {
|
|
|
450
430
|
const hash = getPaymentMethodHash(platform);
|
|
451
431
|
return hash ? [hash] : [];
|
|
452
432
|
}
|
|
453
|
-
const
|
|
454
|
-
|
|
433
|
+
const hashes = getZelleCreateEntries().map((entry) => entry.hash);
|
|
434
|
+
const generic = resolveGenericZelleHash();
|
|
435
|
+
return generic ? [...hashes, generic] : hashes;
|
|
455
436
|
}
|
|
456
437
|
function getPaymentMethodCreateEntries(platform) {
|
|
457
438
|
if (platform !== "zelle") {
|
|
458
439
|
const hash = getPaymentMethodHash(platform);
|
|
459
440
|
return hash ? [{ name: platform, hash }] : [];
|
|
460
441
|
}
|
|
461
|
-
|
|
462
|
-
return generic ? [{ name: "zelle", hash: generic }] : [];
|
|
442
|
+
return getZelleCreateEntries();
|
|
463
443
|
}
|
|
464
444
|
function buildDepositData(platform, identifier, telegramUsername = "") {
|
|
465
445
|
const offchainId = platform === "chime" ? identifier.toLowerCase() : identifier;
|
|
@@ -484,7 +464,7 @@ function getPeerExtensionRegistrationAuthParams(platform, options = {}) {
|
|
|
484
464
|
}
|
|
485
465
|
function resolveRegistrationProcessor(platform) {
|
|
486
466
|
const info = getPeerExtensionRegistrationInfo(platform.id);
|
|
487
|
-
if (info?.providerId === "paypal" || info?.providerId === "wise") {
|
|
467
|
+
if (info?.providerId === "paypal" || info?.providerId === "wise" || info?.providerId === "venmo" || info?.providerId === "cashapp") {
|
|
488
468
|
return info.providerId;
|
|
489
469
|
}
|
|
490
470
|
throw new Error(`${platform.name} does not require Peer extension registration.`);
|