SDK Guide
Get started with @zerc20/client-sdk to send private zERC20 transfers from your TypeScript application.
Prerequisites
Node.js
>= 18
EVM Wallet
Any wallet that can sign messages (e.g., MetaMask, Rabby)
Supported Chain
Ethereum, Arbitrum, Base, BNB Chain, Polygon, Kaia, and their configured testnets
Installation
npm install @zerc20/client-sdkInitialize the SDK
Call createSdk() to obtain a Zerc20Sdk instance. All options are optional and fall back to sensible defaults.
import { createSdk } from "@zerc20/client-sdk";
const sdk = createSdk();Zerc20SdkOptions accepts the following optional fields:
wasm
WasmRuntime
Custom WASM runtime (auto-detected if omitted)
teleportProofs
TeleportProofClient
Custom teleport proof client or proof client options
decider
HttpDeciderClient
Decider prover endpoint
stealth
StealthClientFactory
Custom stealth client factory
The returned Zerc20Sdk exposes the same fields for direct access:
Connect to ICP
Create a StealthCanisterClient to interact with the ICP storage and key-manager canisters:
The agent, storageCanisterId, and keyManagerCanisterId fields are required. If any are missing (and no factory defaults have been set), createStealthClient() will throw an error.
EVM Providers
The SDK uses library-agnostic provider interfaces instead of depending directly on viem. This means you can use viem, ethers.js, or any other EVM library:
EvmReadProvider
Contract reads, balance queries, fee estimation
PublicClient
EvmWriteProvider
Signing and submitting transactions
WalletClient
viem's PublicClient and WalletClient satisfy these interfaces structurally -- no adapter is needed. For other libraries, provide a thin adapter that implements the required methods.
Load Tokens
The SDK provides several ways to load token configuration:
Option A: From compressed data with TokensCacheManager
TokensCacheManager.load(compressed) accepts a Base64-encoded gzip string containing token configuration JSON. This is the format used by the production frontend.
Option B: From raw JSON with normalizeTokens
If you have a tokens.json file (e.g., from your own deployment), use normalizeTokens():
Local-only tokens, such as zJPYC, intentionally omit hub. Their private receive flow uses local Verifier roots instead of the cross-chain Hub aggregation root.
Option C: With RPC URL overrides
Use normalizeTokensWithOverrides() to replace default RPC URLs at runtime:
Finding tokens
See Token Registry for the full token API.
Type signatures
First Private Send
Below is a compact end-to-end example. Each helper is covered in detail on the Private Send page.
Next Steps
Private Send -- detailed walkthrough of each step
Receiving -- scanning and claiming incoming transfers
API Reference -- relay-node helpers for gasless redeem and native-gas swaps
Token Registry -- loading and querying token configuration
Integration Guide -- on-chain oracle and self-hosted indexer
Contract Addresses -- deployed addresses per chain
Last updated
Was this helpful?