SDK Guide

Get started with zerc20-client-sdk to send private zERC20 transfers from your TypeScript application.

Prerequisites

Requirement
Details

Node.js

>= 18

EVM Wallet

Any wallet that can sign messages (e.g., MetaMask, Rabby)

Supported Chain

Ethereum, Arbitrum, or Base

Installation

npm install zerc20-client-sdk

Initialize 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:

Field
Type
Description

wasm

WasmRuntime

Custom WASM runtime (auto-detected if omitted)

teleportProofs

TeleportProofClient

Custom teleport-proof client

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.

Load Tokens

The SDK provides two ways to load token configuration:

Option A: From compressed data with loadTokens

loadTokens(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() instead:

Finding tokens and creating providers

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

Last updated