Skip to main content

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 @zkp2p/cash instead. Its overview compares the two SDKs.

Start here​

You are buildingStart withIt covers
A liquidity provider or off-ramp dashboardOfframp IntegrationCreating, funding, and managing deposits
A web onramp that captures payments with the Peer extensionOnramp IntegrationpeerExtensionSdk and Buyer TEE payment proofs
A custom taker flow, backend, or toolClient ReferenceZkp2pClient, intents, quotes, vaults, and helpers
A React appReact HooksTransaction hooks in @zkp2p/sdk/react
A React Native appReact Native SDKWebView 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.

SDK 0.15.0-rc.11 supports OrchestratorV4 and deferred payouts. It can still prepare OrchestratorV3 transactions and discover the historical draining stack; O3 retirement does not add a client-side rejection guard to this published version. Use OrchestratorV4 for current writes.

Peer Cash 0.8.0 is the current stable @zkp2p/cash release. It pins SDK 0.15.0-rc.2 and adds Cash App and PayPal account connection. An app that installs both packages resolves two SDK copies unless it also uses 0.15.0-rc.2. See Peer Cash and account connection.

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.

PackageStable versionProtocol dependencies
@zkp2p/sdk0.14.10contracts 0.4.4-rc.2, indexer schema 0.22.0, attestation 4.0.0-rc.0
@zkp2p/cash0.7.3SDK 0.14.10; superseded by 0.8.0
@zkp2p/zkp2p-react-native-sdk0.5.1SDK 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/sdk@0.14.10 viem

Cash 0.7.3 pins SDK 0.14.10 and adds X Money receipt linking. See X Money cash-outs 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 walletClient = createWalletClient({
account: privateKeyToAccount("0x..."),
chain: base,
transport: http(),
});

const client = new Zkp2pClient({
walletClient,
chainId: base.id,
baseApiUrl: "https://api.zkp2p.xyz",
});

const deposits = await client.getDeposits();
console.log(deposits.length);

You don't need an API key. Set baseApiUrl so signalIntent() can fetch gating signatures from Peer's API. The SDK targets Base mainnet (chain ID 8453).

Architecture​

  • Reads such as getDeposits(), getDeposit(), getIntents(), and getIntent() go to the chain through ProtocolViewer, so they don't wait for the indexer.
  • Use EscrowV2 and OrchestratorV4 for new intents. O3 intent owner routing, public ABI exports and historical reads remain available.
  • client.indexer serves 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 as OfframpClient) 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 support@peer.xyz.