@usdctofiat/offramp 4.1.0 → 4.2.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.cjs CHANGED
@@ -34,7 +34,10 @@ __export(index_exports, {
34
34
  DEFAULT_EXTENSION_INSTALL_URL: () => DEFAULT_EXTENSION_INSTALL_URL,
35
35
  ESCROW_ADDRESS: () => ESCROW_ADDRESS,
36
36
  MakersCreateError: () => MakersCreateError,
37
+ OFFRAMP_DEVELOPER_RESOURCES: () => OFFRAMP_DEVELOPER_RESOURCES,
37
38
  OFFRAMP_ERROR_CODES: () => OFFRAMP_ERROR_CODES,
39
+ OFFRAMP_INTEGRATION_PLAYBOOKS: () => OFFRAMP_INTEGRATION_PLAYBOOKS,
40
+ OFFRAMP_RESOURCE_LINKS: () => OFFRAMP_RESOURCE_LINKS,
38
41
  Offramp: () => Offramp,
39
42
  OfframpError: () => OfframpError,
40
43
  PEER_EXTENSION_CHROME_URL: () => import_sdk7.PEER_EXTENSION_CHROME_URL,
@@ -50,6 +53,7 @@ __export(index_exports, {
50
53
  disableOtc: () => disableOtc,
51
54
  emitEvent: () => emitEvent,
52
55
  enableOtc: () => enableOtc,
56
+ getOfframpDeveloperResources: () => getOfframpDeveloperResources,
53
57
  getOtcLink: () => getOtcLink,
54
58
  getPeerExtensionRegistrationAuthParams: () => getPeerExtensionRegistrationAuthParams,
55
59
  getPeerExtensionRegistrationInfo: () => getPeerExtensionRegistrationInfo,
@@ -76,7 +80,7 @@ var import_sdk5 = require("@zkp2p/sdk");
76
80
 
77
81
  // src/config.ts
78
82
  var import_sdk = require("@zkp2p/sdk");
79
- var SDK_VERSION = "4.1.0";
83
+ var SDK_VERSION = "4.2.1";
80
84
  var BASE_CHAIN_ID = 8453;
81
85
  var RUNTIME_ENV = "production";
82
86
  var API_BASE_URL = "https://api.zkp2p.xyz";
@@ -323,8 +327,7 @@ var BLUEPRINTS = {
323
327
  extensionRegistration: {
324
328
  providerId: "wise",
325
329
  requiredPrompt: "This Wisetag is not registered yet. Register it with PeerAuth, then retry with the same Wisetag.",
326
- ctaLabel: "Register Wisetag",
327
- minExtensionVersion: "0.5.0"
330
+ ctaLabel: "Register Wisetag"
328
331
  }
329
332
  },
330
333
  mercadopago: {
@@ -362,8 +365,7 @@ var BLUEPRINTS = {
362
365
  providerId: "paypal",
363
366
  requiredPrompt: "This PayPal username is not registered yet. Register it with PeerAuth, then retry with the same PayPal username.",
364
367
  ctaLabel: "Register PayPal Username",
365
- ctaSubtext: "PayPal Business accounts are not supported at this time.",
366
- minExtensionVersion: "0.5.0"
368
+ ctaSubtext: "PayPal Business accounts are not supported at this time."
367
369
  }
368
370
  },
369
371
  monzo: {
@@ -576,7 +578,11 @@ function requireSarCredentialCapture(capturedMetadata) {
576
578
  }
577
579
  async function uploadSellerCredentialBundle(processorName, offchainId, bundle) {
578
580
  const params = processorName === "wise" ? { platform: "wise", bundle } : { platform: processorName, offchainId, bundle };
579
- return (0, import_sdk2.apiUploadSellerCredentialBundle)(params, API_BASE_URL, PAYEE_REGISTRATION_TIMEOUT_MS);
581
+ return (0, import_sdk2.apiUploadSellerCredentialBundle)(
582
+ params,
583
+ API_BASE_URL,
584
+ PAYEE_REGISTRATION_TIMEOUT_MS
585
+ );
580
586
  }
581
587
  async function completePeerExtensionRegistration(input) {
582
588
  const processorName = resolveRegistrationProcessor(input.platform);
@@ -1736,13 +1742,295 @@ var createPeerExtensionSdk = (options = {}) => {
1736
1742
  };
1737
1743
  };
1738
1744
  var peerExtensionSdk = createPeerExtensionSdk();
1745
+
1746
+ // src/resources.ts
1747
+ var OFFRAMP_RESOURCE_LINKS = {
1748
+ developerPortal: "https://usdctofiat.xyz/developers/",
1749
+ sdkGuide: "https://usdctofiat.xyz/developers/offramp-sdk/",
1750
+ appGuide: "https://usdctofiat.xyz/developers/apps/",
1751
+ botGuide: "https://usdctofiat.xyz/developers/bots/",
1752
+ agentGuide: "https://usdctofiat.xyz/developers/agents/",
1753
+ webhooksGuide: "https://usdctofiat.xyz/developers/webhooks/",
1754
+ privateOtcGuide: "https://usdctofiat.xyz/developers/private-otc/",
1755
+ peerlyticsGuide: "https://usdctofiat.xyz/developers/peerlytics/",
1756
+ agentSkill: "https://usdctofiat.xyz/skills/usdctofiat.md",
1757
+ shortMachineReference: "https://usdctofiat.xyz/llms.txt",
1758
+ fullMachineReference: "https://usdctofiat.xyz/llms-full.txt",
1759
+ starters: "https://github.com/ADWilkinson/usdctofiat-peerlytics-starters",
1760
+ peerlyticsDevelopers: "https://peerlytics.xyz/developers",
1761
+ peerlyticsPricing: "https://peerlytics.xyz/pricing",
1762
+ npm: "https://www.npmjs.com/package/@usdctofiat/offramp"
1763
+ };
1764
+ var sharedResources = [
1765
+ {
1766
+ label: "Developer portal",
1767
+ href: OFFRAMP_RESOURCE_LINKS.developerPortal,
1768
+ description: "Human-readable hub for SDK, webhooks, OTC, bots, agents, and Peerlytics."
1769
+ },
1770
+ {
1771
+ label: "Starter templates",
1772
+ href: OFFRAMP_RESOURCE_LINKS.starters,
1773
+ description: "Next.js, Vite, Telegram-bot, scripts, and HMAC webhook receivers."
1774
+ },
1775
+ {
1776
+ label: "Agent skill",
1777
+ href: OFFRAMP_RESOURCE_LINKS.agentSkill,
1778
+ description: "Drop-in skill file for coding agents integrating the off-ramp."
1779
+ }
1780
+ ];
1781
+ var OFFRAMP_INTEGRATION_PLAYBOOKS = [
1782
+ {
1783
+ profile: "app",
1784
+ title: "Wallet app",
1785
+ summary: "Add a sell-USDC button to a user-facing web app.",
1786
+ steps: [
1787
+ {
1788
+ title: "Collect route inputs",
1789
+ detail: "Ask for amount, platform, currency, and the platform-specific payout identifier."
1790
+ },
1791
+ {
1792
+ title: "Call useOfframp or createOfframp",
1793
+ detail: "Pass the user's viem WalletClient so the user signs approval, deposit, and delegation."
1794
+ },
1795
+ {
1796
+ title: "Handle PayPal and Wise registration",
1797
+ detail: "Catch EXTENSION_REGISTRATION_REQUIRED and drive usePeerExtensionRegistration."
1798
+ },
1799
+ {
1800
+ title: "Reconcile state",
1801
+ detail: "Use deposits(address) and webhooks rather than assuming the browser stayed open."
1802
+ }
1803
+ ],
1804
+ resources: [
1805
+ ...sharedResources,
1806
+ {
1807
+ label: "App integration guide",
1808
+ href: OFFRAMP_RESOURCE_LINKS.appGuide,
1809
+ description: "User-facing app flow, React hooks, and wallet-state guidance."
1810
+ },
1811
+ {
1812
+ label: "SDK guide",
1813
+ href: OFFRAMP_RESOURCE_LINKS.sdkGuide,
1814
+ description: "Core SDK exports, resumability, errors, and examples."
1815
+ }
1816
+ ]
1817
+ },
1818
+ {
1819
+ profile: "bot",
1820
+ title: "Bot or backend worker",
1821
+ summary: "Create delegated deposits from a server wallet or automation wallet.",
1822
+ steps: [
1823
+ {
1824
+ title: "Own duplicate prevention",
1825
+ detail: "Before creating, call deposits(address) and reuse open inventory when possible."
1826
+ },
1827
+ {
1828
+ title: "Pass stable attribution",
1829
+ detail: "Use integratorId and referralId so telemetry can separate automated flows."
1830
+ },
1831
+ {
1832
+ title: "Use OTC when a buyer is known",
1833
+ detail: "Pass otcTaker to avoid exposing known-counterparty liquidity publicly."
1834
+ },
1835
+ {
1836
+ title: "Subscribe to lifecycle state",
1837
+ detail: "Register HMAC webhooks so fills and closes survive process restarts."
1838
+ }
1839
+ ],
1840
+ resources: [
1841
+ ...sharedResources,
1842
+ {
1843
+ label: "Bot guide",
1844
+ href: OFFRAMP_RESOURCE_LINKS.botGuide,
1845
+ description: "Server-wallet, retry, idempotency, and OTC patterns."
1846
+ },
1847
+ {
1848
+ label: "Webhooks guide",
1849
+ href: OFFRAMP_RESOURCE_LINKS.webhooksGuide,
1850
+ description: "HMAC verification and lifecycle event names."
1851
+ }
1852
+ ]
1853
+ },
1854
+ {
1855
+ profile: "agent",
1856
+ title: "Coding agent",
1857
+ summary: "Give an agent enough canonical context to build without guessing protocol details.",
1858
+ steps: [
1859
+ {
1860
+ title: "Load the skill",
1861
+ detail: "Point the agent at /skills/usdctofiat.md before it writes integration code."
1862
+ },
1863
+ {
1864
+ title: "Use the machine references",
1865
+ detail: "Feed llms.txt or llms-full.txt when the agent needs routes, contracts, and rules."
1866
+ },
1867
+ {
1868
+ title: "Scaffold first",
1869
+ detail: "Use create-offramp-app or starters before asking the agent to invent wiring."
1870
+ },
1871
+ {
1872
+ title: "Verify delegation",
1873
+ detail: "Check getVaultStatus() and the returned deposit state; SDK deposits must delegate."
1874
+ }
1875
+ ],
1876
+ resources: [
1877
+ ...sharedResources,
1878
+ {
1879
+ label: "Agent guide",
1880
+ href: OFFRAMP_RESOURCE_LINKS.agentGuide,
1881
+ description: "Context-pack and prompt sequence for AI-assisted integration."
1882
+ },
1883
+ {
1884
+ label: "Full machine reference",
1885
+ href: OFFRAMP_RESOURCE_LINKS.fullMachineReference,
1886
+ description: "Canonical routes, contracts, fees, and extractable answers."
1887
+ }
1888
+ ]
1889
+ },
1890
+ {
1891
+ profile: "private-otc",
1892
+ title: "Private OTC flow",
1893
+ summary: "Restrict a delegated deposit to one approved taker wallet.",
1894
+ steps: [
1895
+ {
1896
+ title: "Create with otcTaker",
1897
+ detail: "Pass the buyer wallet in the original offramp() call when the counterparty is known."
1898
+ },
1899
+ {
1900
+ title: "Share the returned otcLink",
1901
+ detail: "The link is convenience; the whitelist hook is the onchain enforcement."
1902
+ },
1903
+ {
1904
+ title: "Rotate when needed",
1905
+ detail: "Use enableOtc, disableOtc, and getOtcLink on existing deposits."
1906
+ }
1907
+ ],
1908
+ resources: [
1909
+ ...sharedResources,
1910
+ {
1911
+ label: "Private OTC guide",
1912
+ href: OFFRAMP_RESOURCE_LINKS.privateOtcGuide,
1913
+ description: "Whitelist hook model and helper exports."
1914
+ }
1915
+ ]
1916
+ },
1917
+ {
1918
+ profile: "webhooks",
1919
+ title: "Lifecycle webhooks",
1920
+ summary: "Receive deposit and OTC lifecycle state with HMAC verification.",
1921
+ steps: [
1922
+ {
1923
+ title: "Create a Peerlytics API key",
1924
+ detail: "One key authenticates both Peerlytics and USDCtoFiat developer surfaces."
1925
+ },
1926
+ {
1927
+ title: "Register an endpoint",
1928
+ detail: "Point the console at an HTTPS endpoint that can read the raw request body."
1929
+ },
1930
+ {
1931
+ title: "Verify before parsing",
1932
+ detail: "Compute HMAC-SHA256 over timestamp.rawBody and compare to v1 in constant time."
1933
+ },
1934
+ {
1935
+ title: "Reconcile important state",
1936
+ detail: "Treat events as hints and call deposits(address) or your indexer for hard state."
1937
+ }
1938
+ ],
1939
+ resources: [
1940
+ ...sharedResources,
1941
+ {
1942
+ label: "Webhooks guide",
1943
+ href: OFFRAMP_RESOURCE_LINKS.webhooksGuide,
1944
+ description: "Event names, headers, and replay-window guidance."
1945
+ },
1946
+ {
1947
+ label: "Peerlytics console",
1948
+ href: OFFRAMP_RESOURCE_LINKS.peerlyticsDevelopers,
1949
+ description: "API keys, credits, and endpoint management."
1950
+ }
1951
+ ]
1952
+ },
1953
+ {
1954
+ profile: "peerlytics",
1955
+ title: "Peerlytics expansion",
1956
+ summary: "Add market data, explorer reads, analytics, and credit-backed API access.",
1957
+ steps: [
1958
+ {
1959
+ title: "Start with deposits",
1960
+ detail: "@usdctofiat/offramp creates delegated seller inventory without an API key."
1961
+ },
1962
+ {
1963
+ title: "Add the paid API",
1964
+ detail: "Use @peerlytics/sdk when the product needs orderbook, analytics, and webhooks."
1965
+ },
1966
+ {
1967
+ title: "Buy credits as usage grows",
1968
+ detail: "Peerlytics credits back deeper API calls and Pro webhook access."
1969
+ }
1970
+ ],
1971
+ resources: [
1972
+ ...sharedResources,
1973
+ {
1974
+ label: "Peerlytics expansion guide",
1975
+ href: OFFRAMP_RESOURCE_LINKS.peerlyticsGuide,
1976
+ description: "When to add the paid protocol API alongside the free deposit SDK."
1977
+ },
1978
+ {
1979
+ label: "Peerlytics pricing",
1980
+ href: OFFRAMP_RESOURCE_LINKS.peerlyticsPricing,
1981
+ description: "Credit packs, Free and Pro plans, and API limits."
1982
+ }
1983
+ ]
1984
+ }
1985
+ ];
1986
+ var OFFRAMP_DEVELOPER_RESOURCES = {
1987
+ packageName: "@usdctofiat/offramp",
1988
+ sdkVersion: SDK_VERSION,
1989
+ chain: "base-mainnet",
1990
+ chainId: 8453,
1991
+ referrer: REFERRER,
1992
+ delegation: {
1993
+ required: true,
1994
+ rateManagerId: DELEGATE_RATE_MANAGER_ID,
1995
+ rateManagerAddress: RATE_MANAGER_REGISTRY_ADDRESS,
1996
+ feeRateBps: DELEGATE_MANAGER_FEE_BPS,
1997
+ escrow: ESCROW_ADDRESS
1998
+ },
1999
+ links: {
2000
+ developerPortal: OFFRAMP_RESOURCE_LINKS.developerPortal,
2001
+ sdkGuide: OFFRAMP_RESOURCE_LINKS.sdkGuide,
2002
+ appGuide: OFFRAMP_RESOURCE_LINKS.appGuide,
2003
+ botGuide: OFFRAMP_RESOURCE_LINKS.botGuide,
2004
+ agentGuide: OFFRAMP_RESOURCE_LINKS.agentGuide,
2005
+ webhooksGuide: OFFRAMP_RESOURCE_LINKS.webhooksGuide,
2006
+ privateOtcGuide: OFFRAMP_RESOURCE_LINKS.privateOtcGuide,
2007
+ peerlyticsGuide: OFFRAMP_RESOURCE_LINKS.peerlyticsGuide,
2008
+ agentSkill: OFFRAMP_RESOURCE_LINKS.agentSkill,
2009
+ shortMachineReference: OFFRAMP_RESOURCE_LINKS.shortMachineReference,
2010
+ fullMachineReference: OFFRAMP_RESOURCE_LINKS.fullMachineReference,
2011
+ starters: OFFRAMP_RESOURCE_LINKS.starters,
2012
+ peerlyticsDevelopers: OFFRAMP_RESOURCE_LINKS.peerlyticsDevelopers,
2013
+ peerlyticsPricing: OFFRAMP_RESOURCE_LINKS.peerlyticsPricing,
2014
+ npm: OFFRAMP_RESOURCE_LINKS.npm
2015
+ },
2016
+ playbooks: OFFRAMP_INTEGRATION_PLAYBOOKS
2017
+ };
2018
+ function getOfframpDeveloperResources(profile) {
2019
+ if (!profile) return OFFRAMP_DEVELOPER_RESOURCES;
2020
+ const playbook = OFFRAMP_INTEGRATION_PLAYBOOKS.find((entry) => entry.profile === profile);
2021
+ if (!playbook) return OFFRAMP_DEVELOPER_RESOURCES;
2022
+ return playbook;
2023
+ }
1739
2024
  // Annotate the CommonJS export names for ESM import in node:
1740
2025
  0 && (module.exports = {
1741
2026
  CURRENCIES,
1742
2027
  DEFAULT_EXTENSION_INSTALL_URL,
1743
2028
  ESCROW_ADDRESS,
1744
2029
  MakersCreateError,
2030
+ OFFRAMP_DEVELOPER_RESOURCES,
1745
2031
  OFFRAMP_ERROR_CODES,
2032
+ OFFRAMP_INTEGRATION_PLAYBOOKS,
2033
+ OFFRAMP_RESOURCE_LINKS,
1746
2034
  Offramp,
1747
2035
  OfframpError,
1748
2036
  PEER_EXTENSION_CHROME_URL,
@@ -1758,6 +2046,7 @@ var peerExtensionSdk = createPeerExtensionSdk();
1758
2046
  disableOtc,
1759
2047
  emitEvent,
1760
2048
  enableOtc,
2049
+ getOfframpDeveloperResources,
1761
2050
  getOtcLink,
1762
2051
  getPeerExtensionRegistrationAuthParams,
1763
2052
  getPeerExtensionRegistrationInfo,