@usdctofiat/offramp 4.4.6 → 4.4.7
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 +15 -1
- package/README.md +7 -17
- package/dist/{chunk-UM4EZUIC.js → chunk-4DUIEYWQ.js} +8 -2
- package/dist/chunk-4DUIEYWQ.js.map +1 -0
- package/dist/{errors-CPxG5V2r.d.cts → errors-DyGBQpGY.d.cts} +1 -0
- package/dist/{errors-CPxG5V2r.d.ts → errors-DyGBQpGY.d.ts} +1 -0
- package/dist/index.cjs +14 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +8 -57
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +19 -8
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +5 -2
- package/dist/react.d.ts +5 -2
- package/dist/react.js +13 -8
- package/dist/react.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-UM4EZUIC.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WalletClient } from 'viem';
|
|
2
|
-
import { O as OfframpParams, a as OnProgress, b as OfframpResult, c as OfframpCreateOptions, d as OfframpQuoteInput, e as OfframpQuote, f as OfframpVaultStatus, P as PlatformEntry, C as CurrencyEntry, D as DepositInfo } from './errors-
|
|
3
|
-
export { g as CURRENCIES, h as CompletePeerExtensionRegistrationInput, i as CompletePeerExtensionRegistrationResult, j as DepositStatus, M as MakersCreateError, k as OFFRAMP_ERROR_CODES, l as OfframpError, m as OfframpErrorCode, n as OfframpProgress, o as OfframpState, p as OfframpStep, q as PLATFORMS, r as PLATFORM_LIMITS, s as PayeeDepositData, t 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-
|
|
2
|
+
import { O as OfframpParams, a as OnProgress, b as OfframpResult, c as OfframpCreateOptions, d as OfframpQuoteInput, e as OfframpQuote, f as OfframpVaultStatus, P as PlatformEntry, C as CurrencyEntry, D as DepositInfo } from './errors-DyGBQpGY.cjs';
|
|
3
|
+
export { g as CURRENCIES, h as CompletePeerExtensionRegistrationInput, i as CompletePeerExtensionRegistrationResult, j as DepositStatus, M as MakersCreateError, k as OFFRAMP_ERROR_CODES, l as OfframpError, m as OfframpErrorCode, n as OfframpProgress, o as OfframpState, p as OfframpStep, q as PLATFORMS, r as PLATFORM_LIMITS, s as PayeeDepositData, t 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-DyGBQpGY.cjs';
|
|
4
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
|
|
|
@@ -208,7 +208,7 @@ declare function getTakerTier({ owner, chainId, apiBaseUrl, timeoutMs, }: GetTak
|
|
|
208
208
|
declare function findTakerPlatformLimit(tier: TakerTier | null | undefined, lookup: TakerPlatformLimitLookup): TakerPlatformLimit | null;
|
|
209
209
|
declare function resolveTakerPlatformLimit(tier: TakerTier | null | undefined, lookup: TakerPlatformLimitLookup): ResolvedTakerPlatformLimit | null;
|
|
210
210
|
|
|
211
|
-
type OfframpIntegratorProfile = "app" | "bot" | "agent" | "private-otc" | "
|
|
211
|
+
type OfframpIntegratorProfile = "app" | "bot" | "agent" | "private-otc" | "peerlytics";
|
|
212
212
|
interface OfframpResourceLink {
|
|
213
213
|
label: string;
|
|
214
214
|
href: string;
|
|
@@ -249,7 +249,6 @@ interface OfframpDeveloperResources {
|
|
|
249
249
|
appGuide: string;
|
|
250
250
|
botGuide: string;
|
|
251
251
|
agentGuide: string;
|
|
252
|
-
webhooksGuide: string;
|
|
253
252
|
privateOtcGuide: string;
|
|
254
253
|
peerlyticsGuide: string;
|
|
255
254
|
agentSkill: string;
|
|
@@ -270,7 +269,6 @@ declare const OFFRAMP_RESOURCE_LINKS: {
|
|
|
270
269
|
readonly appGuide: "https://usdctofiat.xyz/developers/apps/";
|
|
271
270
|
readonly botGuide: "https://usdctofiat.xyz/developers/bots/";
|
|
272
271
|
readonly agentGuide: "https://usdctofiat.xyz/developers/agents/";
|
|
273
|
-
readonly webhooksGuide: "https://usdctofiat.xyz/developers/webhooks/";
|
|
274
272
|
readonly privateOtcGuide: "https://usdctofiat.xyz/developers/private-otc/";
|
|
275
273
|
readonly peerlyticsGuide: "https://usdctofiat.xyz/developers/peerlytics/";
|
|
276
274
|
readonly agentSkill: "https://usdctofiat.xyz/skills/usdctofiat.md";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WalletClient } from 'viem';
|
|
2
|
-
import { O as OfframpParams, a as OnProgress, b as OfframpResult, c as OfframpCreateOptions, d as OfframpQuoteInput, e as OfframpQuote, f as OfframpVaultStatus, P as PlatformEntry, C as CurrencyEntry, D as DepositInfo } from './errors-
|
|
3
|
-
export { g as CURRENCIES, h as CompletePeerExtensionRegistrationInput, i as CompletePeerExtensionRegistrationResult, j as DepositStatus, M as MakersCreateError, k as OFFRAMP_ERROR_CODES, l as OfframpError, m as OfframpErrorCode, n as OfframpProgress, o as OfframpState, p as OfframpStep, q as PLATFORMS, r as PLATFORM_LIMITS, s as PayeeDepositData, t 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-
|
|
2
|
+
import { O as OfframpParams, a as OnProgress, b as OfframpResult, c as OfframpCreateOptions, d as OfframpQuoteInput, e as OfframpQuote, f as OfframpVaultStatus, P as PlatformEntry, C as CurrencyEntry, D as DepositInfo } from './errors-DyGBQpGY.js';
|
|
3
|
+
export { g as CURRENCIES, h as CompletePeerExtensionRegistrationInput, i as CompletePeerExtensionRegistrationResult, j as DepositStatus, M as MakersCreateError, k as OFFRAMP_ERROR_CODES, l as OfframpError, m as OfframpErrorCode, n as OfframpProgress, o as OfframpState, p as OfframpStep, q as PLATFORMS, r as PLATFORM_LIMITS, s as PayeeDepositData, t 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-DyGBQpGY.js';
|
|
4
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
|
|
|
@@ -208,7 +208,7 @@ declare function getTakerTier({ owner, chainId, apiBaseUrl, timeoutMs, }: GetTak
|
|
|
208
208
|
declare function findTakerPlatformLimit(tier: TakerTier | null | undefined, lookup: TakerPlatformLimitLookup): TakerPlatformLimit | null;
|
|
209
209
|
declare function resolveTakerPlatformLimit(tier: TakerTier | null | undefined, lookup: TakerPlatformLimitLookup): ResolvedTakerPlatformLimit | null;
|
|
210
210
|
|
|
211
|
-
type OfframpIntegratorProfile = "app" | "bot" | "agent" | "private-otc" | "
|
|
211
|
+
type OfframpIntegratorProfile = "app" | "bot" | "agent" | "private-otc" | "peerlytics";
|
|
212
212
|
interface OfframpResourceLink {
|
|
213
213
|
label: string;
|
|
214
214
|
href: string;
|
|
@@ -249,7 +249,6 @@ interface OfframpDeveloperResources {
|
|
|
249
249
|
appGuide: string;
|
|
250
250
|
botGuide: string;
|
|
251
251
|
agentGuide: string;
|
|
252
|
-
webhooksGuide: string;
|
|
253
252
|
privateOtcGuide: string;
|
|
254
253
|
peerlyticsGuide: string;
|
|
255
254
|
agentSkill: string;
|
|
@@ -270,7 +269,6 @@ declare const OFFRAMP_RESOURCE_LINKS: {
|
|
|
270
269
|
readonly appGuide: "https://usdctofiat.xyz/developers/apps/";
|
|
271
270
|
readonly botGuide: "https://usdctofiat.xyz/developers/bots/";
|
|
272
271
|
readonly agentGuide: "https://usdctofiat.xyz/developers/agents/";
|
|
273
|
-
readonly webhooksGuide: "https://usdctofiat.xyz/developers/webhooks/";
|
|
274
272
|
readonly privateOtcGuide: "https://usdctofiat.xyz/developers/private-otc/";
|
|
275
273
|
readonly peerlyticsGuide: "https://usdctofiat.xyz/developers/peerlytics/";
|
|
276
274
|
readonly agentSkill: "https://usdctofiat.xyz/skills/usdctofiat.md";
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
sanitizeAttributionId,
|
|
42
42
|
sendTelemetryEvent,
|
|
43
43
|
undelegate
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-4DUIEYWQ.js";
|
|
45
45
|
|
|
46
46
|
// src/taker-tier.ts
|
|
47
47
|
import { apiGetTakerTier } from "@zkp2p/sdk";
|
|
@@ -107,7 +107,6 @@ var OFFRAMP_RESOURCE_LINKS = {
|
|
|
107
107
|
appGuide: "https://usdctofiat.xyz/developers/apps/",
|
|
108
108
|
botGuide: "https://usdctofiat.xyz/developers/bots/",
|
|
109
109
|
agentGuide: "https://usdctofiat.xyz/developers/agents/",
|
|
110
|
-
webhooksGuide: "https://usdctofiat.xyz/developers/webhooks/",
|
|
111
110
|
privateOtcGuide: "https://usdctofiat.xyz/developers/private-otc/",
|
|
112
111
|
peerlyticsGuide: "https://usdctofiat.xyz/developers/peerlytics/",
|
|
113
112
|
agentSkill: "https://usdctofiat.xyz/skills/usdctofiat.md",
|
|
@@ -120,7 +119,7 @@ var OFFRAMP_RESOURCE_LINKS = {
|
|
|
120
119
|
};
|
|
121
120
|
var OFFRAMP_UPSTREAM_SOURCE_TRUTHS = [
|
|
122
121
|
{
|
|
123
|
-
label: "@zkp2p/sdk 0.
|
|
122
|
+
label: "@zkp2p/sdk 0.8.0",
|
|
124
123
|
href: "https://github.com/zkp2p/zkp2p-clients/tree/main/packages/sdk",
|
|
125
124
|
description: "Primary upstream TypeScript SDK for contracts, Curator clients, payment-method catalogs, and the Peer extension bridge."
|
|
126
125
|
},
|
|
@@ -144,12 +143,12 @@ var sharedResources = [
|
|
|
144
143
|
{
|
|
145
144
|
label: "Developer portal",
|
|
146
145
|
href: OFFRAMP_RESOURCE_LINKS.developerPortal,
|
|
147
|
-
description: "Human-readable hub for SDK,
|
|
146
|
+
description: "Human-readable hub for SDK, OTC, bots, agents, and Peerlytics."
|
|
148
147
|
},
|
|
149
148
|
{
|
|
150
149
|
label: "Starter templates",
|
|
151
150
|
href: OFFRAMP_RESOURCE_LINKS.starters,
|
|
152
|
-
description: "Next.js, Vite, Telegram-bot, scripts, and
|
|
151
|
+
description: "Next.js, Vite, Telegram-bot, scripts, and agent examples."
|
|
153
152
|
},
|
|
154
153
|
{
|
|
155
154
|
label: "Agent skill",
|
|
@@ -177,7 +176,7 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
|
|
|
177
176
|
},
|
|
178
177
|
{
|
|
179
178
|
title: "Reconcile state",
|
|
180
|
-
detail: "Use deposits(address)
|
|
179
|
+
detail: "Use deposits(address) or Peerlytics deposit reads rather than assuming the browser stayed open."
|
|
181
180
|
}
|
|
182
181
|
],
|
|
183
182
|
resources: [
|
|
@@ -213,7 +212,7 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
|
|
|
213
212
|
},
|
|
214
213
|
{
|
|
215
214
|
title: "Subscribe to lifecycle state",
|
|
216
|
-
detail: "
|
|
215
|
+
detail: "Poll deposits(address) or Peerlytics deposit reads so fills and closes survive process restarts."
|
|
217
216
|
}
|
|
218
217
|
],
|
|
219
218
|
resources: [
|
|
@@ -222,11 +221,6 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
|
|
|
222
221
|
label: "Bot guide",
|
|
223
222
|
href: OFFRAMP_RESOURCE_LINKS.botGuide,
|
|
224
223
|
description: "Server-wallet, retry, idempotency, and OTC patterns."
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
label: "Webhooks guide",
|
|
228
|
-
href: OFFRAMP_RESOURCE_LINKS.webhooksGuide,
|
|
229
|
-
description: "HMAC verification and lifecycle event names."
|
|
230
224
|
}
|
|
231
225
|
]
|
|
232
226
|
},
|
|
@@ -293,42 +287,6 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
|
|
|
293
287
|
}
|
|
294
288
|
]
|
|
295
289
|
},
|
|
296
|
-
{
|
|
297
|
-
profile: "webhooks",
|
|
298
|
-
title: "Lifecycle webhooks",
|
|
299
|
-
summary: "Receive deposit and OTC lifecycle state with HMAC verification.",
|
|
300
|
-
steps: [
|
|
301
|
-
{
|
|
302
|
-
title: "Create a Peerlytics API key",
|
|
303
|
-
detail: "One key authenticates both Peerlytics and USDCtoFiat developer surfaces."
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
title: "Register an endpoint",
|
|
307
|
-
detail: "Point the console at an HTTPS endpoint that can read the raw request body."
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
title: "Verify before parsing",
|
|
311
|
-
detail: "Compute HMAC-SHA256 over timestamp.rawBody and compare to v1 in constant time."
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
title: "Reconcile important state",
|
|
315
|
-
detail: "Treat events as hints and call deposits(address) or your indexer for hard state."
|
|
316
|
-
}
|
|
317
|
-
],
|
|
318
|
-
resources: [
|
|
319
|
-
...sharedResources,
|
|
320
|
-
{
|
|
321
|
-
label: "Webhooks guide",
|
|
322
|
-
href: OFFRAMP_RESOURCE_LINKS.webhooksGuide,
|
|
323
|
-
description: "Event names, headers, and replay-window guidance."
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
label: "Peerlytics console",
|
|
327
|
-
href: OFFRAMP_RESOURCE_LINKS.peerlyticsDevelopers,
|
|
328
|
-
description: "API keys, credits, and endpoint management."
|
|
329
|
-
}
|
|
330
|
-
]
|
|
331
|
-
},
|
|
332
290
|
{
|
|
333
291
|
profile: "peerlytics",
|
|
334
292
|
title: "Peerlytics API",
|
|
@@ -340,11 +298,11 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
|
|
|
340
298
|
},
|
|
341
299
|
{
|
|
342
300
|
title: "Add the Peerlytics API",
|
|
343
|
-
detail: "Use @peerlytics/sdk when the product needs orderbook, analytics,
|
|
301
|
+
detail: "Use @peerlytics/sdk when the product needs orderbook, analytics, deposits, or intents."
|
|
344
302
|
},
|
|
345
303
|
{
|
|
346
304
|
title: "Buy credits as usage grows",
|
|
347
|
-
detail: "Peerlytics credits back deeper API calls and
|
|
305
|
+
detail: "Peerlytics credits back deeper API calls and historical analytics."
|
|
348
306
|
}
|
|
349
307
|
],
|
|
350
308
|
resources: [
|
|
@@ -382,11 +340,6 @@ var OFFRAMP_INTEGRATION_CHECKLIST = [
|
|
|
382
340
|
title: "Server-side duplicate prevention",
|
|
383
341
|
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.",
|
|
384
342
|
required: true
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
title: "Raw-body webhook verification",
|
|
388
|
-
detail: "Verify timestamp.rawBody with HMAC-SHA256 before parsing JSON.",
|
|
389
|
-
required: true
|
|
390
343
|
}
|
|
391
344
|
];
|
|
392
345
|
var OFFRAMP_DEVELOPER_RESOURCES = {
|
|
@@ -408,7 +361,6 @@ var OFFRAMP_DEVELOPER_RESOURCES = {
|
|
|
408
361
|
appGuide: OFFRAMP_RESOURCE_LINKS.appGuide,
|
|
409
362
|
botGuide: OFFRAMP_RESOURCE_LINKS.botGuide,
|
|
410
363
|
agentGuide: OFFRAMP_RESOURCE_LINKS.agentGuide,
|
|
411
|
-
webhooksGuide: OFFRAMP_RESOURCE_LINKS.webhooksGuide,
|
|
412
364
|
privateOtcGuide: OFFRAMP_RESOURCE_LINKS.privateOtcGuide,
|
|
413
365
|
peerlyticsGuide: OFFRAMP_RESOURCE_LINKS.peerlyticsGuide,
|
|
414
366
|
agentSkill: OFFRAMP_RESOURCE_LINKS.agentSkill,
|
|
@@ -442,7 +394,6 @@ function getOfframpAgentPrompt(profile = "app") {
|
|
|
442
394
|
"Do not add manual rate controls; SDK-created deposits must delegate to the Delegate vault.",
|
|
443
395
|
"For PayPal, Wise, Venmo, and Cash App, recover EXTENSION_REGISTRATION_REQUIRED through the Peer extension registration flow.",
|
|
444
396
|
"For bots/workers, deduplicate with deposits(address) plus your own order database; do not rely on idempotencyKey.",
|
|
445
|
-
"For webhooks, verify the raw request body before parsing JSON.",
|
|
446
397
|
...steps ?? []
|
|
447
398
|
].join("\n");
|
|
448
399
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 upstreamSourceTruths: readonly OfframpResourceLink[];\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\nexport const OFFRAMP_UPSTREAM_SOURCE_TRUTHS: readonly OfframpResourceLink[] = [\n {\n label: \"@zkp2p/sdk 0.7.2\",\n href: \"https://github.com/zkp2p/zkp2p-clients/tree/main/packages/sdk\",\n description:\n \"Primary upstream TypeScript SDK for contracts, Curator clients, payment-method catalogs, and the Peer extension bridge.\",\n },\n {\n label: \"Curator API\",\n href: \"https://api.zkp2p.xyz\",\n description:\n \"Live maker registration, taker tier, quote, and signing REST surface. Key routes include /v2/makers/create and /v2/taker/tier.\",\n },\n {\n label: \"Attestation service\",\n href: \"https://attestation-service.zkp2p.xyz\",\n description:\n \"Seller credential bundle upload and recovery path for SAR-capable payment rails. Do not invent credential fields.\",\n },\n {\n label: \"@zkp2p/contracts-v2 0.2.4\",\n href: \"https://github.com/zkp2p/zkp2p-v2-contracts\",\n description: \"EscrowV2, Orchestrator, whitelist hook, and Base mainnet ABI source.\",\n },\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 upstreamSourceTruths: OFFRAMP_UPSTREAM_SOURCE_TRUTHS,\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 \"When protocol fields, addresses, proof payloads, or extension behavior are unclear, check OFFRAMP_DEVELOPER_RESOURCES.upstreamSourceTruths before guessing.\",\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,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,O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UAAU,uBAAuB;AAAA,IACjC,UAAU,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,sBAAsB;AAAA,EACtB,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;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 = \"app\" | \"bot\" | \"agent\" | \"private-otc\" | \"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 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 upstreamSourceTruths: readonly OfframpResourceLink[];\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 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\nexport const OFFRAMP_UPSTREAM_SOURCE_TRUTHS: readonly OfframpResourceLink[] = [\n {\n label: \"@zkp2p/sdk 0.8.0\",\n href: \"https://github.com/zkp2p/zkp2p-clients/tree/main/packages/sdk\",\n description:\n \"Primary upstream TypeScript SDK for contracts, Curator clients, payment-method catalogs, and the Peer extension bridge.\",\n },\n {\n label: \"Curator API\",\n href: \"https://api.zkp2p.xyz\",\n description:\n \"Live maker registration, taker tier, quote, and signing REST surface. Key routes include /v2/makers/create and /v2/taker/tier.\",\n },\n {\n label: \"Attestation service\",\n href: \"https://attestation-service.zkp2p.xyz\",\n description:\n \"Seller credential bundle upload and recovery path for SAR-capable payment rails. Do not invent credential fields.\",\n },\n {\n label: \"@zkp2p/contracts-v2 0.2.4\",\n href: \"https://github.com/zkp2p/zkp2p-v2-contracts\",\n description: \"EscrowV2, Orchestrator, whitelist hook, and Base mainnet ABI source.\",\n },\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, 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 agent examples.\",\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:\n \"Use deposits(address) or Peerlytics deposit reads 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:\n \"Poll deposits(address) or Peerlytics deposit reads 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 },\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: \"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:\n \"Use @peerlytics/sdk when the product needs orderbook, analytics, deposits, or intents.\",\n },\n {\n title: \"Buy credits as usage grows\",\n detail: \"Peerlytics credits back deeper API calls and historical analytics.\",\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\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 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 upstreamSourceTruths: OFFRAMP_UPSTREAM_SOURCE_TRUTHS,\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 \"When protocol fields, addresses, proof payloads, or extension behavior are unclear, check OFFRAMP_DEVELOPER_RESOURCES.upstreamSourceTruths before guessing.\",\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 ...(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,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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.4.
|
|
43
|
+
var SDK_VERSION = "4.4.7";
|
|
44
44
|
var BASE_CHAIN_ID = 8453;
|
|
45
45
|
var RUNTIME_ENV = "production";
|
|
46
46
|
var API_BASE_URL = "https://api.zkp2p.xyz";
|
|
@@ -452,6 +452,7 @@ function getPeerExtensionRegistrationInfo(platform) {
|
|
|
452
452
|
function getPeerExtensionRegistrationAuthParams(platform, options = {}) {
|
|
453
453
|
const info = getPeerExtensionRegistrationInfo(platform);
|
|
454
454
|
if (!info) return null;
|
|
455
|
+
const callerAddress = options.callerAddress?.trim();
|
|
455
456
|
const params = {
|
|
456
457
|
actionType: `transfer_${info.providerId}`,
|
|
457
458
|
captureMode: "sellerCredential",
|
|
@@ -460,6 +461,9 @@ function getPeerExtensionRegistrationAuthParams(platform, options = {}) {
|
|
|
460
461
|
if (options.attestationServiceUrl) {
|
|
461
462
|
params.attestationServiceUrl = options.attestationServiceUrl;
|
|
462
463
|
}
|
|
464
|
+
if (callerAddress) {
|
|
465
|
+
params.callerAddress = callerAddress;
|
|
466
|
+
}
|
|
463
467
|
return params;
|
|
464
468
|
}
|
|
465
469
|
function resolveRegistrationProcessor(platform) {
|
|
@@ -561,12 +565,14 @@ async function completePeerExtensionRegistration(input) {
|
|
|
561
565
|
};
|
|
562
566
|
}
|
|
563
567
|
var EXTENSION_REGISTRATION_ERROR_PATTERNS = ["creating the maker", "create the maker"];
|
|
568
|
+
var isWiseIdentityAttestationRequiredError = (message) => message.toLowerCase().includes("identityattestation is required");
|
|
564
569
|
function isPeerExtensionRegistrationError(platform, message, statusCode) {
|
|
565
570
|
const info = getPeerExtensionRegistrationInfo(platform);
|
|
566
571
|
if (!info) return false;
|
|
567
572
|
if (statusCode === 400) return true;
|
|
568
573
|
const normalized = (message ?? "").trim();
|
|
569
574
|
if (!normalized) return false;
|
|
575
|
+
if (platform === "wise" && isWiseIdentityAttestationRequiredError(normalized)) return true;
|
|
570
576
|
const lower = normalized.toLowerCase();
|
|
571
577
|
return EXTENSION_REGISTRATION_ERROR_PATTERNS.some((p) => lower.includes(p));
|
|
572
578
|
}
|
|
@@ -1644,12 +1650,17 @@ var createPeerExtensionSdk = (options = {}) => {
|
|
|
1644
1650
|
var peerExtensionSdk = createPeerExtensionSdk();
|
|
1645
1651
|
|
|
1646
1652
|
// src/hooks/usePeerExtensionRegistration.ts
|
|
1647
|
-
function usePeerExtensionRegistration(platform) {
|
|
1653
|
+
function usePeerExtensionRegistration(platform, options = {}) {
|
|
1648
1654
|
const platformId = platform?.id ?? null;
|
|
1649
1655
|
const info = platformId ? getPeerExtensionRegistrationInfo(platformId) : null;
|
|
1656
|
+
const callerAddress = options.callerAddress?.trim() || null;
|
|
1657
|
+
const attestationServiceUrl = options.attestationServiceUrl ?? null;
|
|
1650
1658
|
const authParams = (0, import_react2.useMemo)(
|
|
1651
|
-
() => platformId ? getPeerExtensionRegistrationAuthParams(platformId
|
|
1652
|
-
|
|
1659
|
+
() => platformId ? getPeerExtensionRegistrationAuthParams(platformId, {
|
|
1660
|
+
attestationServiceUrl,
|
|
1661
|
+
callerAddress
|
|
1662
|
+
}) : null,
|
|
1663
|
+
[attestationServiceUrl, callerAddress, platformId]
|
|
1653
1664
|
);
|
|
1654
1665
|
const [phase, setPhase] = (0, import_react2.useState)(
|
|
1655
1666
|
info ? "checking" : "unsupported"
|
|
@@ -1785,8 +1796,8 @@ function usePeerExtensionRegistration(platform) {
|
|
|
1785
1796
|
[startRegistrationCapture]
|
|
1786
1797
|
);
|
|
1787
1798
|
const completeRegistration = (0, import_react2.useCallback)(
|
|
1788
|
-
async (walletClient, params,
|
|
1789
|
-
const metadata =
|
|
1799
|
+
async (walletClient, params, options2 = {}) => {
|
|
1800
|
+
const metadata = options2.capturedMetadata ?? capturedMetadata;
|
|
1790
1801
|
if (!metadata) {
|
|
1791
1802
|
const message = "No Peer metadata captured yet. Start registration first.";
|
|
1792
1803
|
setError(message);
|
|
@@ -1800,7 +1811,7 @@ function usePeerExtensionRegistration(platform) {
|
|
|
1800
1811
|
identifier: params.identifier,
|
|
1801
1812
|
capturedMetadata: metadata
|
|
1802
1813
|
});
|
|
1803
|
-
return await offramp(walletClient, params,
|
|
1814
|
+
return await offramp(walletClient, params, options2.onProgress);
|
|
1804
1815
|
} catch (err) {
|
|
1805
1816
|
setError(
|
|
1806
1817
|
err instanceof Error ? err.message : "Couldn't complete Peer extension registration. Try capturing metadata again."
|
|
@@ -1810,7 +1821,7 @@ function usePeerExtensionRegistration(platform) {
|
|
|
1810
1821
|
if (mountedRef.current) setBusy(false);
|
|
1811
1822
|
}
|
|
1812
1823
|
},
|
|
1813
|
-
[capturedMetadata]
|
|
1824
|
+
[callerAddress, capturedMetadata]
|
|
1814
1825
|
);
|
|
1815
1826
|
return {
|
|
1816
1827
|
phase,
|