v2 SDK — @zk-privacy/core, @zk-privacy/web, @zk-privacy/node
TypeScript SDK published as @zk-privacy/core, @zk-privacy/web, and @zk-privacy/node. Not the same line as v1 (@zk-privacy/eb-sdk).
Getting started
- Install —
npmpackages and peer deps (Noir JS + bb.js). createWebClient(@zk-privacy/web) orcreateNodeClient(@zk-privacy/node) — returns aZkpClient(withlazyLoad: false, the factory awaitspreload()first).client.wallet({ spendingKey, account })— or{ spendingKey, walletClient }for injected signers — gives aZkpWallet.
Example with the Node adapter (bundled circuits):
import { createNodeClient } from '@zk-privacy/node';
const client = await createNodeClient({ chainId: 8453 });
const wallet = client.wallet({ spendingKey, account });
await wallet.public.toConcealed({ amount: … });
For createWebClient, follow the same pattern after installing and configuring the client for your environment.
Money flows (wallet)
- Public → concealed:
wallet.public.toConcealed({ amount, … }) - Concealed → public:
wallet.public.toPublic(amount, …)orwallet.toPublic(…) - Concealed → concealed:
wallet.toConcealed({ to, amount, … })
Use wallet.public.getBalance() / getBalances() for visible ERC-20 balances on the token contract(s). swap on the wallet still throws until implemented.
Documentation map
| Topic | Description |
|---|---|
| Installation | Packages and peers |
ZkpClient | Config, lifecycle, wallet(), chain & relayer basics |
ZkpWallet | Balances, public ↔ concealed, transfers, history, stealth accessor |
| Advanced (low-level) | Full exports, relayer details, ZkpClient internals |
v1 remains under v1.