SmartAccount Factories
ECDSASmartAccount and MultisigECDSASmartAccount for SmartAccount.
ECDSASmartAccount
A ECDSASmartAccount
is a factory which creates a SmartAccount
instance
that uses single ECDSA key for signing payload.
create
Creates a SmartAccount
instance that uses a single ECDSA key for signing payload.
Inputs
Parameter | Type | Description |
---|---|---|
address | string | The account address. |
secret | string or ethers.utils.SigningKey | The ECDSA private key. |
provider | Provider | The provider to connect to. |
static create(address: string, secret: string | utils.SigningKey, provider: Provider): SmartAccount
Example
import { ECDSASmartAccount, Provider, types } from "zksync-ethers";
const ADDRESS = "<ADDRESS>";
const PRIVATE_KEY = "<PRIVATE_KEY>";
const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const account = ECDSASmartAccount.create(ADDRESS, PRIVATE_KEY, provider);
MultisigECDSASmartAccount
A MultisigECDSASmartAccount
is a factory which creates a SmartAccount
instance
that uses multiple ECDSA keys for signing payloads.
The signature is generated by concatenating signatures created by signing with each key individually.
create
Creates a SmartAccount
instance that uses multiple ECDSA keys for signing payloads.
Inputs
Parameter | Type | Description |
---|---|---|
address | string | The account address. |
secret | string[] or ethers.utils.SigningKeyp[] | The list of the ECDSA private keys. |
provider | Provider | The provider to connect to. |
static create(address: string, secret: string[] | utils.SigningKey[], provider: Provider): SmartAccount
Example
import { MultisigECDSASmartAccount, Provider, types } from "zksync-ethers";
const ADDRESS = "<ADDRESS>";
const PRIVATE_KEY1 = "<PRIVATE_KEY1>";
const PRIVATE_KEY2 = "<PRIVATE_KEY2>";
const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const account = MultisigECDSASmartAccount.create(multisigAddress, [PRIVATE_KEY1, PRIVATE_KEY2], provider);