Adapters: viem & ethers
The SDK is designed to work with the tools you already know and love.It’s not a standalone library — it’s an extension that plugs directly into your existing
viem or ethers.js setup.
This design means you can keep your existing provider, signer, and connection logic. The SDK
simply layers ZKsync-specific actions on top.
Why an Adapter Model?
- Bring Your Own Stack: Integrates directly with
viem(PublicClient,WalletClient) orethersproviders and signers. - Familiar Developer Experience: Keep your existing connection and signing flow unchanged.
- Lightweight & Focused: Only adds ZKsync-specific functionality like deposits, withdrawals, and soon interop — nothing more.
Installation
How to Use
The SDK extends your existing client. Configure viem or ethers normally, then wrap them with the SDK’s adapter factory.Key Principles
- No Key Management: The SDK never asks for or stores private keys — signing stays with your
WalletClientorSigner. - API Parity: Both adapters expose the same API. Calling
sdk.deposits.quote()works identically withviemorethers. - Easy Migration: Switch between
ethersandviemby only changing the initialization code.