Introduction
The accounts
package provides abstractions that wrap operations that interact with an account. An account typically
contains a private key, allowing it to sign various types of payloads. There are the following interfaces that
provide account operations for different purposes:
- Signer: Provides support for signing EIP-712 transactions as well as other types of transactions supported by
types.Signer
. - AdapterL1: Associated with an account and provides common operations on the L1 network for the associated account.
- AdapterL2: Associated with an account and provides common operations on the L2 network for the associated account.
- Deployer: Associated with an account and provides deployment of smart contracts and smart accounts on the L2 network for the associated account.
- Adapter: Consists of
AdapterL1
,AdapterL2
, andDeployer
interfaces.
There are the following objects that provide account operations:
BaseSigner
Implements the Signer
interface. The BaseSigner
is responsible for signing various types of transactions, including
EIP-712 transactions. It abstracts the complexities involved in signing transactions, making it easier for developers
to handle secure and authenticated interactions with the blockchain.
WalletL1
Implements the AdapterL1
interface. WalletL1
is designed to manage and perform common operations on the Layer 1
(L1) network. This includes sending transactions, checking balances, and interacting with smart contracts deployed on
the Ethereum mainnet.
WalletL2
Implements the AdapterL2
interface. WalletL2
facilitates operations on the Layer 2 (L2) network, specifically
tailored for ZKsync Era. It handles transactions that benefit from the scalability and low fees of L2 solutions,
providing a seamless way to interact with the L2 environment.
BaseDeployer
Implements the Deployer
interface. The BaseDeployer
provides functionalities for deploying smart contracts and
smart accounts on the L2 network. It simplifies the deployment process, ensuring that developers can easily and
efficiently deploy their applications on ZKsync Era.
Wallet
Implements the Adapter
interface. The Wallet
object combines the functionalities of AdapterL1
, AdapterL2
,
and Deployer
, offering a comprehensive tool for managing accounts and performing operations across both L1 and L2
networks. It is the recommended object for most use cases as it provides all necessary operations in one place.
SmartAccount
Provides enhanced support for account abstraction. The SmartAccount
is designed to offer advanced account
management capabilities, supporting complex account structures and operations.
NewECDSASmartAccount
Uses a single ECDSA key for signing payloads. This factory method creates a SmartAccount
that leverages a single
ECDSA key, ensuring simple yet secure transaction signing.
NewMultisigECDSASmartAccount
Uses multiple ECDSA keys for signing payloads. This method creates a SmartAccount
that supports multisig
functionality, enhancing security by requiring multiple signatures for transaction approval.