SDK Overview
@zkp2p/sdk is the TypeScript SDK for building directly on the Peer protocol on Base. Use it to create and manage deposits, quote liquidity, signal and fulfill intents, and run vault, staking, referral, and Seller Autopilot flows. Your application owns the workflow. The package is MIT licensed.
If cash-out is your whole product, use createPeer() and peer.sell() from this package instead. Sell USDC with the Peer SDK compares the two paths.
Start here
| You are building | Start with | It covers |
|---|---|---|
| A liquidity provider or off-ramp dashboard | Offramp Integration | Creating, funding, and managing deposits |
| A web onramp that captures payments with the Peer extension | Onramp Integration | peerExtensionSdk and Buyer TEE payment proofs |
| A custom taker flow, backend, or tool | Client Reference | Zkp2pClient, intents, quotes, vaults, and helpers |
| A React app | React Hooks | Transaction hooks in @zkp2p/sdk/react |
| A React Native app | React Native SDK | WebView sign-in, Buyer TEE proofs, identity attestations, and Seller Autopilot |
Installation
npm install @zkp2p/sdk viem
# or
yarn add @zkp2p/sdk viem
# or
pnpm add @zkp2p/sdk viem
# or
bun add @zkp2p/sdk viem
viem ^2.37.3 is a peer dependency. React (>=16.8.0) is optional and needed only for @zkp2p/sdk/react. Node.js runtimes need version 22 or later. For React Native, see React Native SDK.
The SDK uses OrchestratorV4 for new intents and supports deferred payouts. Historical OrchestratorV3 intents remain readable. The SDK rejects attempts to prepare new or existing O3 intent writes.
SDK 0.16.2 on npm’s latest tag includes createPeer(). Its peer.sell() API carries over the @zkp2p/cash sell engine and supports Relay source routing (sourceCapabilities(), quoteSource(), relayStatus()). See Sell USDC with the Peer SDK. @zkp2p/cash stays published for existing installs; to move off it, see Migrate from @zkp2p/cash.
Earlier release compatibility
OrchestratorV3 was retired on 2026-11-05. O3-only SDK versions cannot signal or fulfill intents after registry removal. Use an OrchestratorV4-capable release for current writes; the versions below describe earlier compatibility, not a recommendation for new integrations.
| Package | Stable version | Protocol dependencies |
|---|---|---|
@zkp2p/sdk | 0.14.10 | contracts 0.4.4-rc.2, indexer schema 0.22.0, attestation 4.0.0-rc.0 |
@zkp2p/zkp2p-react-native-sdk | 0.5.1 | SDK 0.14.5, contracts 0.4.3, attestation 3.1.0 |
Keep the dependency versions each package pins. Don't override them.
SDK 0.14.10 uses OrchestratorV3 and UnifiedPaymentVerifierV3. The OrchestratorV4 and deferred-payout APIs in the Client Reference aren't in this release. It includes the Gmail, personal Outlook, iCloud Mail, and X Money receipt-linking helpers. For reproducing historical integrations only:
npm install @zkp2p/[email protected] viem
Cash 0.7.3 pins SDK 0.14.10 and adds X Money receipt linking. See X Money sales and X Money receipt linking.
Quick start
import { Zkp2pClient } from "@zkp2p/sdk";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";
const curatorApiBase = process.env.CURATOR_API_BASE;
if (!curatorApiBase) throw new Error("CURATOR_API_BASE is required");
const rpcUrl = `${curatorApiBase.replace(/\/+$/, "")}/v2/rpc/base`;
const walletClient = createWalletClient({
account: privateKeyToAccount("0x..."),
chain: base,
transport: http(rpcUrl),
});
const client = new Zkp2pClient({
walletClient,
chainId: base.id,
baseApiUrl: curatorApiBase,
rpcUrl,
});
const deposits = await client.getDeposits();
console.log(deposits.length);
The SDK uses Base mainnet (chain ID 8453). To obtain a public gating signature, authenticate with Peer and verify the payer account for the taker’s wallet. A logged-in client can supply getAuthorizationToken for signalIntent(). Servers can obtain the signature using wallet signatures.
Architecture
- Deposit and intent reads use ProtocolViewer where its ABI supports the query. For example,
getDeposits()uses the indexer if the viewer lacksgetAccountDeposits. - Use EscrowV2 and OrchestratorV4 for new intents. O3 intent owner routing, public ABI exports and historical reads remain available.
client.indexerserves history, filtering, and pagination.- Write methods send transactions directly or return them prepared for relayers and smart accounts.
Entry points:
@zkp2p/sdk:Zkp2pClient(also exported asOfframpClient) and standalone helpers@zkp2p/sdk/react: React hooks@zkp2p/zkp2p-react-native-sdk: the React Native provider,useZkp2p(), and client
Help?
For integration questions, join the Peer Telegram community. For order-specific help, email [email protected].