Examples and a live demo for the two SDKs covering ZKP2P on Base: server-side protocol data with @peerlytics/sdk and wallet-native USDC off-ramps with @usdctofiat/offramp.
Live demo: offramp-sdk.vercel.app Developer portals: usdctofiat.xyz/developers · peerlytics.xyz/developers
import { CURRENCIES, PLATFORMS, offramp } from "@usdctofiat/offramp";
const { depositId, txHash } = await offramp(walletClient, {
amount: "100",
platform: PLATFORMS.REVOLUT,
currency: CURRENCIES.EUR,
identifier: "alice",
integratorId: "your-app",
});That single call approves USDC, creates the escrow deposit on Base, and delegates pricing to the managed vault. Settlement runs on Revolut, Venmo, Wise, Cash App, Zelle, Monzo, or PayPal — your users never leave your app. Use the integratorId on every call so deposits are attributable.
Need a fresh app skeleton instead of dropping into an existing one?
npx create-offramp-app@latest my-offramp --template=next # next | base-mini-app | vite | telegram-botAgent skills (Claude Code, Cursor): integrate-usdctofiat-offramp · query-peerlytics-data. For other assistants, hand them the canonical llms-full.txt: usdctofiat.xyz/llms-full.txt · peerlytics.xyz/llms-full.txt.
demo/ Vite + React demo app (deployed to Vercel)
src/App.tsx single-page UI: create deposits, live orderbook, withdraw
api/orderbook.ts Vercel serverless orderbook proxy
server/peerlytics.ts shared Peerlytics server helper (dev + prod)
peerlytics/ @peerlytics/sdk examples (run standalone with tsx/bun)
orderbook-snapshot.ts multi-currency orderbook depth
rate-monitor.ts poll rates, alert on threshold
volume-dashboard.ts protocol stats terminal dashboard
maker-report.ts portfolio report for a maker address
integrator-report.ts ERC-8021 integrator stats (deposits, volume, top markets)
timeseries-chart.ts hourly/daily rollups in a terminal sparkbar chart
live-activity.ts real-time protocol event stream (SSE)
x402-agent.ts x402 pay-per-request flow (no API key needed)
llms.txt LLM-friendly SDK reference
usdctofiat/ @usdctofiat/offramp examples
create-deposit.ts create and delegate a USDC deposit
close-deposit.ts withdraw remaining USDC and close a deposit
resume-deposit.ts resume an interrupted deposit flow
otc-deposit.ts create an OTC deposit restricted to a single taker
manage-deposits.ts list and inspect deposits for a wallet
platform-explorer.ts enumerate platforms, currencies, and validation
paypal-deposit.ts PayPal flow — paypal.me username + Peer extension fallback
react-example.tsx useOfframp hook usage in React (Revolut)
paypal-react-example.tsx useOfframp + usePeerExtensionRegistration handshake
developer-resources.ts print SDK links, delegation config, and app/bot/agent playbooks
llms.txt LLM-friendly SDK reference
templates/ Scaffold-ready integrations (used by create-offramp-app)
next/ Next.js 16 App Router + Privy
base-mini-app/ Next.js 16 + Base Account compact cash-out app
vite/ Vite + React 19 + viem
telegram-bot/ Node 22 + grammy + viem (server-side maker bot)
README.md template selection + v1/v2 upgrade notes
skills/ Claude Code skills for AI-assisted development
claude/
query-peerlytics-data/ skill: query protocol data via Peerlytics SDK
integrate-usdctofiat-offramp/ skill: integrate the offramp SDK
Each script under peerlytics/ and usdctofiat/ runs standalone:
# Peerlytics (server-side, free key includes 1,000 requests/month)
export PEERLYTICS_API_KEY=pk_live_...
npx tsx peerlytics/orderbook-snapshot.ts
npx tsx peerlytics/live-activity.ts
# USDCtoFiat (wallet-side, needs a private key for tx examples)
npx tsx usdctofiat/platform-explorer.tsThe deposit scripts default to the public Base RPC. Set RPC_URL to a private
endpoint (Alchemy, QuickNode, etc.) to avoid rate limits on real deposit runs.
Get a free API key at peerlytics.xyz/developers for the Peerlytics paid API. Lifecycle state now lives in the explorer, activity stream, and deposit/intent reads.
cd demo
npm install
cp .env.example .env.local # set PEERLYTICS_API_KEY
npm run devDeploy to Vercel:
cd demo
vercel link # link to your Vercel project
vercel env add PEERLYTICS_API_KEY production
vercel env add PEERLYTICS_API_KEY preview
vercel --prodThe orderbook API key stays server-side and is never exposed to the browser.
Choose the smallest starter that matches where the cash-out flow will live:
| Starter | Use it when | Required env |
|---|---|---|
next |
You want a production web app with Privy wallet auth | NEXT_PUBLIC_PRIVY_APP_ID, NEXT_PUBLIC_INTEGRATOR_ID |
base-mini-app |
You are distributing a compact Base Account cash-out surface | NEXT_PUBLIC_APP_URL, NEXT_PUBLIC_INTEGRATOR_ID, NEXT_PUBLIC_BASE_BUILDER_CODE |
vite |
You want a lean SPA without Next.js conventions | VITE_PRIVY_APP_ID, VITE_INTEGRATOR_ID |
telegram-bot |
You are running a server-side maker bot with a managed wallet | TELEGRAM_BOT_TOKEN, MAKER_PRIVATE_KEY, INTEGRATOR_ID |
TODO_SET_REFERRAL_ID is deliberately inert. The starters only pass
referralId after you set a real referral value, so a generated app cannot
accidentally attribute production deposits to the placeholder.
Server-side data on the ZKP2P protocol — orderbooks, activity feeds, maker portfolios, vault stats.
import { Peerlytics } from "@peerlytics/sdk";
const client = new Peerlytics({ apiKey: "pk_live_..." });
const { orderbooks } = await client.getOrderbook({ currency: "USD", platform: "revolut" });Auth: free API key (1,000 requests/month) or x402 pay-per-request with USDC on Base. SDK ≥ 1.0 can drive x402 directly with auth: { mode: "x402", signer }.
Gotchas worth knowing (SDK ≥ 1.0, Stripe-style v2 wire format):
- List methods (
getActivity,getDeposits,getIntents,getMarketSummary) return paginated envelopes like{ events, count, hasMore, ... }— iterate over.events/.deposits/ etc, not the top-level result. getDeposits()requires at least one ofdepositor,delegate,platform,currency;getIntents()requires at least one ofowner,recipient,verifier,depositId,status. Both throwValidationErrorclient-side if called empty.getOrderbook({ taker })includes private deposits whitelisted for that buyer wallet alongside public liquidity.DepositMarket.currency/deposit.currencies[].currencyare resolved ISO codes (e.g."GBP").currencyCodeis the raw bytes32 hash — usecurrencyfor display.- Key management uses the opaque
idfromlistKeys()(not the raw key):deleteKey(id),rotateKey(idOrKey),createKey(label?). - Some timestamp fields (
ApiKeyInfo.createdAt,lastUsedAt,freeCreditsResetAt) are typednumber | string— v2 emits Unix seconds (integer); convert withNumber(value) * 1000to get a JSDate.
npm · Developer portal · OpenAPI spec · llms.txt
Delegated USDC-to-fiat off-ramp on Base. Revolut, Venmo, Wise, PayPal, Cash App, Zelle, Monzo, and more.
import { useOfframp } from "@usdctofiat/offramp/react";
import { PLATFORMS, CURRENCIES } from "@usdctofiat/offramp";
const { offramp, deposits, close } = useOfframp();
await offramp(walletClient, {
amount: "100",
platform: PLATFORMS.REVOLUT,
currency: CURRENCIES.USD,
identifier: "alice",
});Pass otcTaker to restrict a deposit to one wallet, or use enableOtc / disableOtc / getOtcLink to retrofit a public deposit. Both paths are in usdctofiat/otc-deposit.ts.
PayPal, Wise, Venmo, and Cash App makers may need to register their handle in the PeerAuth browser extension before the first deposit. The SDK throws EXTENSION_REGISTRATION_REQUIRED and ships usePeerExtensionRegistration(platform) to drive the install / connect / verify flow. See usdctofiat/paypal-react-example.tsx and usdctofiat/paypal-deposit.ts for the PayPal-shaped recovery pattern. PayPal uses the paypal.me username, not the account email.
Take-side UIs should ask Curator for live platform caps and locks before presenting a fill amount. @usdctofiat/offramp@4.4 exports getTakerTier, findTakerPlatformLimit, and resolveTakerPlatformLimit for the /v2/taker/tier surface:
import { findTakerPlatformLimit, getTakerTier } from "@usdctofiat/offramp";
const tier = await getTakerTier({ owner: takerAddress });
const paypalLimit = findTakerPlatformLimit(tier, { platform: "paypal" });
if (paypalLimit?.isLocked) {
console.log(`PayPal unlocks at ${paypalLimit.minTierRequired} tier`);
}Supported platforms: Revolut, Venmo, Cash App, Chime, Wise, Mercado Pago, Zelle, PayPal, Monzo, N26.
npm · Developer portal · SDK guide
The SDK also exports the canonical self-serve resource bundle, so apps, bots, CLIs, and coding agents do not need to hardcode docs URLs:
import { OFFRAMP_DEVELOPER_RESOURCES, getOfframpDeveloperResources } from "@usdctofiat/offramp";
console.log(OFFRAMP_DEVELOPER_RESOURCES.links.agentSkill);
console.log(getOfframpDeveloperResources("bot"));Run npx tsx usdctofiat/developer-resources.ts or npx tsx usdctofiat/developer-resources.ts agent to print the full map.
- usdctofiat.xyz/developers — self-serve developer hub
- usdctofiat.xyz/developers/offramp-sdk — SDK guide
- peerlytics.xyz/developers — analytics SDK + API key dashboard
- Peerlytics Explorer — protocol explorer and market intel
- ZKP2P Protocol
- @andrewwilkinson