Ethersv6 API

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

ParameterTypeDescription
addressstringThe account address.
secretstring or ethers.SigningKeyThe ECDSA private key.
providerProviderThe provider to connect to.
static create(address: string, secret: string | 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

ParameterTypeDescription
addressstringThe account address.
secretstring[] or ethers.SigningKeyp[]The list of the ECDSA private keys.
providerProviderThe provider to connect to.
static create(address: string, secret: string[] | 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);

Made with ❤️ by the ZKsync Community