@usdctofiat/offramp 4.4.6 → 4.4.8

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.cjs CHANGED
@@ -85,7 +85,7 @@ var import_sdk5 = require("@zkp2p/sdk");
85
85
 
86
86
  // src/config.ts
87
87
  var import_sdk = require("@zkp2p/sdk");
88
- var SDK_VERSION = "4.4.6";
88
+ var SDK_VERSION = "4.4.8";
89
89
  var BASE_CHAIN_ID = 8453;
90
90
  var RUNTIME_ENV = "production";
91
91
  var API_BASE_URL = "https://api.zkp2p.xyz";
@@ -482,6 +482,7 @@ function getPeerExtensionRegistrationInfo(platform) {
482
482
  function getPeerExtensionRegistrationAuthParams(platform, options = {}) {
483
483
  const info = getPeerExtensionRegistrationInfo(platform);
484
484
  if (!info) return null;
485
+ const callerAddress = options.callerAddress?.trim();
485
486
  const params = {
486
487
  actionType: `transfer_${info.providerId}`,
487
488
  captureMode: "sellerCredential",
@@ -490,6 +491,9 @@ function getPeerExtensionRegistrationAuthParams(platform, options = {}) {
490
491
  if (options.attestationServiceUrl) {
491
492
  params.attestationServiceUrl = options.attestationServiceUrl;
492
493
  }
494
+ if (callerAddress) {
495
+ params.callerAddress = callerAddress;
496
+ }
493
497
  return params;
494
498
  }
495
499
  function resolveRegistrationProcessor(platform) {
@@ -591,12 +595,14 @@ async function completePeerExtensionRegistration(input) {
591
595
  };
592
596
  }
593
597
  var EXTENSION_REGISTRATION_ERROR_PATTERNS = ["creating the maker", "create the maker"];
598
+ var isWiseIdentityAttestationRequiredError = (message) => message.toLowerCase().includes("identityattestation is required");
594
599
  function isPeerExtensionRegistrationError(platform, message, statusCode) {
595
600
  const info = getPeerExtensionRegistrationInfo(platform);
596
601
  if (!info) return false;
597
602
  if (statusCode === 400) return true;
598
603
  const normalized = (message ?? "").trim();
599
604
  if (!normalized) return false;
605
+ if (platform === "wise" && isWiseIdentityAttestationRequiredError(normalized)) return true;
600
606
  const lower = normalized.toLowerCase();
601
607
  return EXTENSION_REGISTRATION_ERROR_PATTERNS.some((p) => lower.includes(p));
602
608
  }
@@ -1759,7 +1765,6 @@ var OFFRAMP_RESOURCE_LINKS = {
1759
1765
  appGuide: "https://usdctofiat.xyz/developers/apps/",
1760
1766
  botGuide: "https://usdctofiat.xyz/developers/bots/",
1761
1767
  agentGuide: "https://usdctofiat.xyz/developers/agents/",
1762
- webhooksGuide: "https://usdctofiat.xyz/developers/webhooks/",
1763
1768
  privateOtcGuide: "https://usdctofiat.xyz/developers/private-otc/",
1764
1769
  peerlyticsGuide: "https://usdctofiat.xyz/developers/peerlytics/",
1765
1770
  agentSkill: "https://usdctofiat.xyz/skills/usdctofiat.md",
@@ -1772,7 +1777,7 @@ var OFFRAMP_RESOURCE_LINKS = {
1772
1777
  };
1773
1778
  var OFFRAMP_UPSTREAM_SOURCE_TRUTHS = [
1774
1779
  {
1775
- label: "@zkp2p/sdk 0.7.2",
1780
+ label: "@zkp2p/sdk 0.8.0",
1776
1781
  href: "https://github.com/zkp2p/zkp2p-clients/tree/main/packages/sdk",
1777
1782
  description: "Primary upstream TypeScript SDK for contracts, Curator clients, payment-method catalogs, and the Peer extension bridge."
1778
1783
  },
@@ -1796,12 +1801,12 @@ var sharedResources = [
1796
1801
  {
1797
1802
  label: "Developer portal",
1798
1803
  href: OFFRAMP_RESOURCE_LINKS.developerPortal,
1799
- description: "Human-readable hub for SDK, webhooks, OTC, bots, agents, and Peerlytics."
1804
+ description: "Human-readable hub for SDK, OTC, bots, agents, and Peerlytics."
1800
1805
  },
1801
1806
  {
1802
1807
  label: "Starter templates",
1803
1808
  href: OFFRAMP_RESOURCE_LINKS.starters,
1804
- description: "Next.js, Vite, Telegram-bot, scripts, and HMAC webhook receivers."
1809
+ description: "Next.js, Vite, Telegram-bot, scripts, and agent examples."
1805
1810
  },
1806
1811
  {
1807
1812
  label: "Agent skill",
@@ -1829,7 +1834,7 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
1829
1834
  },
1830
1835
  {
1831
1836
  title: "Reconcile state",
1832
- detail: "Use deposits(address) and webhooks rather than assuming the browser stayed open."
1837
+ detail: "Use deposits(address) or Peerlytics deposit reads rather than assuming the browser stayed open."
1833
1838
  }
1834
1839
  ],
1835
1840
  resources: [
@@ -1865,7 +1870,7 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
1865
1870
  },
1866
1871
  {
1867
1872
  title: "Subscribe to lifecycle state",
1868
- detail: "Register HMAC webhooks so fills and closes survive process restarts."
1873
+ detail: "Poll deposits(address) or Peerlytics deposit reads so fills and closes survive process restarts."
1869
1874
  }
1870
1875
  ],
1871
1876
  resources: [
@@ -1874,11 +1879,6 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
1874
1879
  label: "Bot guide",
1875
1880
  href: OFFRAMP_RESOURCE_LINKS.botGuide,
1876
1881
  description: "Server-wallet, retry, idempotency, and OTC patterns."
1877
- },
1878
- {
1879
- label: "Webhooks guide",
1880
- href: OFFRAMP_RESOURCE_LINKS.webhooksGuide,
1881
- description: "HMAC verification and lifecycle event names."
1882
1882
  }
1883
1883
  ]
1884
1884
  },
@@ -1945,42 +1945,6 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
1945
1945
  }
1946
1946
  ]
1947
1947
  },
1948
- {
1949
- profile: "webhooks",
1950
- title: "Lifecycle webhooks",
1951
- summary: "Receive deposit and OTC lifecycle state with HMAC verification.",
1952
- steps: [
1953
- {
1954
- title: "Create a Peerlytics API key",
1955
- detail: "One key authenticates both Peerlytics and USDCtoFiat developer surfaces."
1956
- },
1957
- {
1958
- title: "Register an endpoint",
1959
- detail: "Point the console at an HTTPS endpoint that can read the raw request body."
1960
- },
1961
- {
1962
- title: "Verify before parsing",
1963
- detail: "Compute HMAC-SHA256 over timestamp.rawBody and compare to v1 in constant time."
1964
- },
1965
- {
1966
- title: "Reconcile important state",
1967
- detail: "Treat events as hints and call deposits(address) or your indexer for hard state."
1968
- }
1969
- ],
1970
- resources: [
1971
- ...sharedResources,
1972
- {
1973
- label: "Webhooks guide",
1974
- href: OFFRAMP_RESOURCE_LINKS.webhooksGuide,
1975
- description: "Event names, headers, and replay-window guidance."
1976
- },
1977
- {
1978
- label: "Peerlytics console",
1979
- href: OFFRAMP_RESOURCE_LINKS.peerlyticsDevelopers,
1980
- description: "API keys, credits, and endpoint management."
1981
- }
1982
- ]
1983
- },
1984
1948
  {
1985
1949
  profile: "peerlytics",
1986
1950
  title: "Peerlytics API",
@@ -1992,11 +1956,11 @@ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
1992
1956
  },
1993
1957
  {
1994
1958
  title: "Add the Peerlytics API",
1995
- detail: "Use @peerlytics/sdk when the product needs orderbook, analytics, and webhooks."
1959
+ detail: "Use @peerlytics/sdk when the product needs orderbook, analytics, deposits, or intents."
1996
1960
  },
1997
1961
  {
1998
1962
  title: "Buy credits as usage grows",
1999
- detail: "Peerlytics credits back deeper API calls and Pro webhook access."
1963
+ detail: "Peerlytics credits back deeper API calls and historical analytics."
2000
1964
  }
2001
1965
  ],
2002
1966
  resources: [
@@ -2034,11 +1998,6 @@ var OFFRAMP_INTEGRATION_CHECKLIST = [
2034
1998
  title: "Server-side duplicate prevention",
2035
1999
  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.",
2036
2000
  required: true
2037
- },
2038
- {
2039
- title: "Raw-body webhook verification",
2040
- detail: "Verify timestamp.rawBody with HMAC-SHA256 before parsing JSON.",
2041
- required: true
2042
2001
  }
2043
2002
  ];
2044
2003
  var OFFRAMP_DEVELOPER_RESOURCES = {
@@ -2060,7 +2019,6 @@ var OFFRAMP_DEVELOPER_RESOURCES = {
2060
2019
  appGuide: OFFRAMP_RESOURCE_LINKS.appGuide,
2061
2020
  botGuide: OFFRAMP_RESOURCE_LINKS.botGuide,
2062
2021
  agentGuide: OFFRAMP_RESOURCE_LINKS.agentGuide,
2063
- webhooksGuide: OFFRAMP_RESOURCE_LINKS.webhooksGuide,
2064
2022
  privateOtcGuide: OFFRAMP_RESOURCE_LINKS.privateOtcGuide,
2065
2023
  peerlyticsGuide: OFFRAMP_RESOURCE_LINKS.peerlyticsGuide,
2066
2024
  agentSkill: OFFRAMP_RESOURCE_LINKS.agentSkill,
@@ -2094,7 +2052,6 @@ function getOfframpAgentPrompt(profile = "app") {
2094
2052
  "Do not add manual rate controls; SDK-created deposits must delegate to the Delegate vault.",
2095
2053
  "For PayPal, Wise, Venmo, and Cash App, recover EXTENSION_REGISTRATION_REQUIRED through the Peer extension registration flow.",
2096
2054
  "For bots/workers, deduplicate with deposits(address) plus your own order database; do not rely on idempotencyKey.",
2097
- "For webhooks, verify the raw request body before parsing JSON.",
2098
2055
  ...steps ?? []
2099
2056
  ].join("\n");
2100
2057
  }