Introduction
zksync-ethers offers classes for signing ZKsync transactions:
Wallet: Extendsethers.Walletwith ZKsync features.EIP712Signer: SignsEIP712-typed ZKsync transactions.Signer: For browser integration.L1Signer: For browser integration.VoidSigner: Uses addresses without signing credentials.L1VoidSigner: Uses addresses without signing credentials.SmartAccount: Supports account abstraction with factory classes:ECDSASmartAccount: Uses a single ECDSA key.MultisigECDSASmartAccount: Uses multiple ECDSA keys.
Why use these classes?
They simplify ZKsync blockchain interactions by providing:
- Security: Securely manage private keys and sign transactions.
- Convenience: Easily create and manage accounts with advanced features.
- Compatibility: Extend
ethers.jsfor seamless project integration.
Classes
Wallet
The Wallet class extends ethers.Wallet, providing additional methods specific to ZKsync. It allows you to create
and manage wallets, sign transactions, and interact with the ZKsync network seamlessly.
EIP712Signer
The EIP712Signer class signs EIP712-typed ZKsync transactions, ensuring transactions comply with the EIP-712
standard for typed data.
Signer
The Signer class enables seamless interaction with web3 wallets like MetaMask, supporting ZKsync-specific operations.
L1Signer
The L1Signer class also supports browser integration for ZKsync-specific operations, similar to Signer.
VoidSigner
The VoidSigner class allows an address to be used in any API that accepts a Signer, without credentials for actual
signing. Useful for representing an account without exposing private keys.
L1VoidSigner
The L1VoidSigner class functions like VoidSigner, allowing address representation without signing credentials.
SmartAccount
The SmartAccount class provides better support for account abstraction, allowing for more advanced account
management features. Factory classes for SmartAccount include:
ECDSASmartAccount: Uses a single ECDSA key for signing payloads.MultisigECDSASmartAccount: Uses multiple ECDSA keys for signing payloads.