@usdctofiat/offramp 4.3.1 → 4.4.1

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/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-BR-B_eCz.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-BR-B_eCz.cjs';
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 PayPal + Wise makers. Drive the
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;
@@ -265,4 +285,4 @@ declare const OFFRAMP_DEVELOPER_RESOURCES: OfframpDeveloperResources;
265
285
  declare function getOfframpDeveloperResources(profile?: OfframpIntegratorProfile): OfframpDeveloperResources | OfframpIntegrationPlaybook;
266
286
  declare function getOfframpAgentPrompt(profile?: OfframpIntegratorProfile): string;
267
287
 
268
- export { CurrencyEntry, DEFAULT_EXTENSION_INSTALL_URL, DepositInfo, ESCROW_ADDRESS, type EnableOtcResult, 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, close, createOfframp, createPeerExtensionSdk, createTelemetryContext, delegate, deposits, disableOtc, emitEvent, enableOtc, getOfframpAgentPrompt, 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-BR-B_eCz.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-BR-B_eCz.js';
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 PayPal + Wise makers. Drive the
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;
@@ -265,4 +285,4 @@ declare const OFFRAMP_DEVELOPER_RESOURCES: OfframpDeveloperResources;
265
285
  declare function getOfframpDeveloperResources(profile?: OfframpIntegratorProfile): OfframpDeveloperResources | OfframpIntegrationPlaybook;
266
286
  declare function getOfframpAgentPrompt(profile?: OfframpIntegratorProfile): string;
267
287
 
268
- export { CurrencyEntry, DEFAULT_EXTENSION_INSTALL_URL, DepositInfo, ESCROW_ADDRESS, type EnableOtcResult, 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, close, createOfframp, createPeerExtensionSdk, createTelemetryContext, delegate, deposits, disableOtc, emitEvent, enableOtc, getOfframpAgentPrompt, 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,
@@ -38,7 +41,43 @@ import {
38
41
  sanitizeAttributionId,
39
42
  sendTelemetryEvent,
40
43
  undelegate
41
- } from "./chunk-KX46LLJW.js";
44
+ } from "./chunk-PWKUFVPJ.js";
45
+
46
+ // src/taker-tier.ts
47
+ import { apiGetTakerTier } from "@zkp2p/sdk";
48
+ async function getTakerTier({
49
+ owner,
50
+ chainId = BASE_CHAIN_ID,
51
+ apiBaseUrl = API_BASE_URL,
52
+ timeoutMs = PAYEE_REGISTRATION_TIMEOUT_MS
53
+ }) {
54
+ const response = await apiGetTakerTier({ owner, chainId }, apiBaseUrl, timeoutMs);
55
+ if (!response.success || !response.responseObject) {
56
+ throw new Error(response.message || "Failed to load taker tier.");
57
+ }
58
+ return response.responseObject;
59
+ }
60
+ function findTakerPlatformLimit(tier, lookup) {
61
+ const limits = tier?.platformLimits ?? [];
62
+ const platform = lookup.platform?.trim().toLowerCase() || null;
63
+ const paymentMethodHash = lookup.paymentMethodHash?.trim().toLowerCase() || null;
64
+ if (!platform && !paymentMethodHash) return null;
65
+ return limits.find((limit) => {
66
+ const limitHash = limit.paymentMethodHash?.trim().toLowerCase();
67
+ if (paymentMethodHash && limitHash === paymentMethodHash) return true;
68
+ const limitPlatform = limit.platformName?.trim().toLowerCase();
69
+ if (!platform || !limitPlatform) return false;
70
+ if (limitPlatform === platform) return true;
71
+ return platform.startsWith("zelle") && limitPlatform.startsWith("zelle");
72
+ }) ?? null;
73
+ }
74
+ function resolveTakerPlatformLimit(tier, lookup) {
75
+ if (!tier) return null;
76
+ return {
77
+ tier: tier.tier,
78
+ limit: findTakerPlatformLimit(tier, lookup)
79
+ };
80
+ }
42
81
 
43
82
  // src/types.ts
44
83
  var OFFRAMP_ERROR_CODES = {
@@ -111,7 +150,7 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
111
150
  detail: "Pass the user's viem WalletClient so the user signs approval, deposit, and delegation."
112
151
  },
113
152
  {
114
- title: "Handle PayPal and Wise registration",
153
+ title: "Handle SAR registration",
115
154
  detail: "Catch EXTENSION_REGISTRATION_REQUIRED and drive usePeerExtensionRegistration."
116
155
  },
117
156
  {
@@ -377,7 +416,7 @@ function getOfframpAgentPrompt(profile = "app") {
377
416
  "Before coding, read https://usdctofiat.xyz/skills/usdctofiat.md and https://usdctofiat.xyz/llms.txt.",
378
417
  "Use Base mainnet chainId 8453 and a viem WalletClient; do not invent a sandbox.",
379
418
  "Do not add manual rate controls; SDK-created deposits must delegate to the Delegate vault.",
380
- "For PayPal and Wise, recover EXTENSION_REGISTRATION_REQUIRED through the Peer extension registration flow.",
419
+ "For PayPal, Wise, Venmo, and Cash App, recover EXTENSION_REGISTRATION_REQUIRED through the Peer extension registration flow.",
381
420
  "For bots/workers, deduplicate with deposits(address) plus your own order database; do not rely on idempotencyKey.",
382
421
  "For webhooks, verify the raw request body before parsing JSON.",
383
422
  ...steps ?? []
@@ -408,6 +447,7 @@ export {
408
447
  disableOtc,
409
448
  emitEvent,
410
449
  enableOtc,
450
+ findTakerPlatformLimit,
411
451
  getOfframpAgentPrompt,
412
452
  getOfframpDeveloperResources,
413
453
  getOtcLink,
@@ -415,6 +455,7 @@ export {
415
455
  getPeerExtensionRegistrationInfo,
416
456
  getPeerExtensionState,
417
457
  getPlatformLimits,
458
+ getTakerTier,
418
459
  isPeerExtensionAvailable,
419
460
  isPeerExtensionMetadataBridgeAvailable,
420
461
  isPeerExtensionRegistrationError,
@@ -422,6 +463,7 @@ export {
422
463
  offramp,
423
464
  openPeerExtensionInstallPage,
424
465
  peerExtensionSdk,
466
+ resolveTakerPlatformLimit,
425
467
  sanitizeAttributionId,
426
468
  sendTelemetryEvent,
427
469
  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 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 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_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 and Wise, 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.\",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A,IAC7C,UAAU,uBAAuB;AAAA,IACjC,sBAAsB,uBAAuB;AAAA,IAC7C,mBAAmB,uBAAuB;AAAA,IAC1C,KAAK,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":[]}
1
+ {"version":3,"sources":["../src/taker-tier.ts","../src/types.ts","../src/resources.ts"],"sourcesContent":["import { apiGetTakerTier, type GetTakerTierResponse, type TakerTierLevel } 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,SAAS,uBAAuE;AAuBhF,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,WAA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AAuB;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;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.3.0";
43
+ var SDK_VERSION = "4.4.1";
44
44
  var BASE_CHAIN_ID = 8453;
45
45
  var RUNTIME_ENV = "production";
46
46
  var API_BASE_URL = "https://api.zkp2p.xyz";
@@ -250,7 +250,12 @@ var BLUEPRINTS = {
250
250
  placeholder: "venmo username (no @)",
251
251
  helperText: "Username without @ (publicly discoverable)",
252
252
  validation: import_zod.z.string().min(1).regex(/^[a-zA-Z0-9_-]+$/),
253
- 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
+ }
254
259
  },
255
260
  cashapp: {
256
261
  id: "cashapp",
@@ -259,7 +264,12 @@ var BLUEPRINTS = {
259
264
  placeholder: "cashtag (no $)",
260
265
  helperText: "Cashtag without $ (publicly discoverable)",
261
266
  validation: import_zod.z.string().min(1).regex(/^[a-zA-Z0-9]+$/),
262
- 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
+ }
263
273
  },
264
274
  chime: {
265
275
  id: "chime",
@@ -454,7 +464,7 @@ function getPeerExtensionRegistrationAuthParams(platform, options = {}) {
454
464
  }
455
465
  function resolveRegistrationProcessor(platform) {
456
466
  const info = getPeerExtensionRegistrationInfo(platform.id);
457
- if (info?.providerId === "paypal" || info?.providerId === "wise") {
467
+ if (info?.providerId === "paypal" || info?.providerId === "wise" || info?.providerId === "venmo" || info?.providerId === "cashapp") {
458
468
  return info.providerId;
459
469
  }
460
470
  throw new Error(`${platform.name} does not require Peer extension registration.`);