SDK Overview
Choose the right SDK
Peer publishes two TypeScript SDKs with deliberately different levels of abstraction. They are complementary, not interchangeable.
| Package | Use it when | Product boundary |
|---|---|---|
@zkp2p/cash | Your product needs one opinionated crypto-to-fiat cash-out flow | Offramp only. The cashing-out user is the maker; every order settles into Base USDC, uses the live Chainlink rate at fill with zero spread, and exposes a small resumable lifecycle. It does not expose buyer operations, custom pricing, vaults, or protocol configuration. |
@zkp2p/sdk | You are building directly on the Peer protocol | General-purpose maker and taker primitives: deposits, intents, fulfillment, quotes, proofs, vaults, rate managers, hooks, referrals, and API-backed flows. Your application owns the workflow and protocol choices. |
If cash-out is the whole job, start with the Peer Cash SDK overview. Use this page when you need the broader protocol surface or want to compose a custom flow.
What this does
@zkp2p/sdk is the TypeScript SDK for building with Peer. Use it to manage deposits, signal and fulfill intents, extend live intents, inspect and unwind historical deposit access policies, attach the fixed Peer Pay merchant policy during atomic sell creation, access quote APIs, work with staking, chargeback risk, vault, and rate-manager flows, run Peer extension headless metadata capture, request identity attestations, manage referral accounts, and integrate Seller Autopilot. Install @zkp2p/sdk@latest for the stable Curator v3, OrchestratorV3, staking, and chargeback-risk surface. The package is published under the MIT license.
Who is this for?
| You are building... | Start here | Why |
|---|---|---|
| A liquidity provider or off-ramp dashboard | Offramp Integration | Covers deposit creation, funding, and deposit management end to end |
| An app that needs Peer extension payment capture | Onramp Integration | Covers peerExtensionSdk and the extension's headless metadata bridge |
| A custom taker flow, backend, or internal tool | Client Reference | Covers Zkp2pClient, intents, quotes, vaults, helpers, and API-backed flows |
| A React app | React Hooks | Covers the @zkp2p/sdk/react hook layer for transaction UX |
| A React Native app | React Native SDK | Covers mobile WebView auth, Buyer TEE proofs, taker registration, Seller Autopilot, and mobile endpoint defaults |
Installation
Install the core SDK with viem. Add react only if you plan to use the hooks package.
npm install @zkp2p/sdk viem
# or
yarn add @zkp2p/sdk viem
# or
pnpm add @zkp2p/sdk viem
# or
bun add @zkp2p/sdk viem
For hooks:
npm install react
# or
yarn add react
# or
pnpm add react
# or
bun add react
viem ^2.37.3 is a peer dependency. react >= 16.8.0 is an optional peer dependency that is only required for @zkp2p/sdk/react. For Node runtimes, the published package declares node >= 22.
For React Native, use the mobile package instead:
yarn add @zkp2p/zkp2p-react-native-sdk@0.5.0 viem@2.43.2 react-native-webview@13.16.1 @react-native-async-storage/async-storage@2.2.0 @preeternal/react-native-cookie-manager@6.3.3
See React Native SDK for the full peer-version matrix, iOS setup, and proof-only startup flow.
Published package compatibility
As of 9 September 2026, @zkp2p/sdk@latest is 0.14.0. Its published dependencies pin @zkp2p/contracts-v2@0.4.1-rc.9, @zkp2p/indexer-schema@0.22.0, and @zkp2p/zkp2p-attestation@3.1.0. Keep those compatible pins; a dependency's separate latest tag is not a reason to override the SDK's version.
@zkp2p/cash@0.6.1 is the stable Cash release with optional hosted Venmo receipt linking and pins SDK 0.14.2. See the Cash linking guide; direct SDK consumers need 0.14.2 for the hosted link helpers. React Native 0.5.0 remains a separate release boundary with SDK 0.8.0 and attestation 1.6.3; use its version-specific guide.
Architecture
The SDK is built around RPC-first reads, version-aware contract routing, and contract-safe write helpers.
- Common reads such as
getDeposits(),getDeposit(),getIntents(), andgetIntent()use ProtocolViewer and on-chain state first, which helps avoid indexer lag for core flows. - The stable SDK signals new intents through EscrowV2/OrchestratorV3. It resolves existing intents to their owning OrchestratorV2 or V3 contract for later lifecycle actions. Legacy V1 fallbacks are not part of the current client routing surface.
- Advanced history and filtering live behind
client.indexer.*, which gives you GraphQL-backed access to richer search, pagination, and fulfillment records. - Write methods are split between deposit management, intent operations, staking, and vault/rate-manager flows, with prepared-transaction support for relayers and smart accounts.
Module map
| Module | What it covers | Start here |
|---|---|---|
Zkp2pClient | The canonical SDK client for reads, writes, and API-backed flows | Client Reference |
| IntentGuardian | Live intent-extension policy, quotes, funding checks, and prepareable extension writes | Client Reference |
client.accessPolicy | Historical policy reads plus prepared disable and removal operations | Client Reference |
| Taker staking | StakeVault ownership, collateral, dispute-protection policy, keepers, and pure risk helpers | Client Reference |
peerExtensionSdk | Peer extension detection, connection, and headless metadata bridge helpers | Onramp Integration |
client.indexer | Advanced deposit, intent, and fulfillment queries | Client Reference |
| Seller Autopilot | Seller credential upload, PayPal forwarding confirmation, OAuth credential upload, status, and payment verification helpers | Client Reference |
| Referral account APIs | Public referral reads, code lookup, bearer writes, and EIP-712 wallet-signature writes | Client Reference |
| API and attestation helpers | Orderbook, deposit bundle, payee validation, Venmo/PayPal/Wise identity attestation, and buyer TEE helpers | Client Reference |
| Contract helpers | getContracts, getRateManagerContracts, getPaymentMethodsCatalog, getGatingServiceAddress | Client Reference |
| Currency and payment helpers | currencyInfo, resolveFiatCurrencyBytes32, payment-method hash helpers | Client Reference |
| Attribution and fee helpers | ERC-8021 helpers and referrer fee validation utilities | Client Reference |
| React hooks | Transaction-oriented hooks for deposits, intents, lifetime extension, and vaults | React Hooks |
| React Native SDK | Mobile provider, useZkp2p(), Buyer TEE proof preparation, taker registration, and Seller Autopilot | React Native SDK |
Entry points
- Import the core SDK from
@zkp2p/sdk - Import hooks from
@zkp2p/sdk/react - Import the mobile provider, hook, and client from
@zkp2p/zkp2p-react-native-sdk
OfframpClient is a re-export alias of Zkp2pClient. Both names work, but Zkp2pClient is the canonical class name used by the published typings and the docs on this page.
Quick start
import { Zkp2pClient } from "@zkp2p/sdk";
import { createWalletClient, custom } from "viem";
import { base } from "viem/chains";
const walletClient = createWalletClient({
chain: base,
transport: custom(window.ethereum),
});
const client = new Zkp2pClient({
walletClient,
chainId: base.id,
});
const deposits = await client.getDeposits();
console.log(deposits.length);
Runtime and network selection
The current SDK docs assume Base. Deployment selection is controlled by chainId plus runtimeEnv.
| Target | chainId | runtimeEnv | Notes |
|---|---|---|---|
| Base production | 8453 | production | Default customer-facing deployment |
| Base preproduction | 8453 | preproduction | Production contracts with preproduction services |
| Base staging | 8453 | staging | Staging contracts and services |
Recommended starting points
If you are new to the SDK, use this order:
- Read Offramp Integration or Onramp Integration for an end-to-end flow.
- Use Client Reference to look up concrete methods, request shapes, and helper exports.
- Use React Hooks if you want component-level loading, error, and transaction state.
- Use React Native SDK for mobile WebView auth, Buyer TEE, identity registration, and Seller Autopilot.
Help?
If you run into issues, join our Discord.