@usdctofiat/offramp 4.1.0 → 4.2.0

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