ZeroDev Presets
ECDSA Validator
To set up a Kernel account using ECDSA for validation (mimicking EOAs):
import { createEcdsaKernelAccountClient } from "@zerodev/presets/zerodev"
import { polygonMumbai } from "viem/chains"
const kernelClient = await createEcdsaKernelAccountClient({
// required
chain: polygonMumbai,
projectId: ZERODEV_PROJECT_ID,
signer: SIGNER,
// optional
provider: "PIMLICO", // defaults to a recommended provider
index: BigInt(1), // defaults to 0
paymaster: 'SPONSOR', // defaults to SPONSOR
})chainis a Viem chain objectprojectIdis a ZeroDev project ID from the ZeroDev dashboard.signeris a Viem account.- (optional)
providercan be any provider that ZeroDev supports. - (optional)
indexcan be any positive integer. Different indexes will yield different accounts. - (optional)
paymastercan be:'NONE': not using any paymaster (the user pays their own gas).'SPONSOR'(default): sponsor gas for users according to gas policies.- A ERC20 token address: use the specified ERC20 token as gas tokens. See the ERC20 gas token docs for details.
is a boolean flag that determines whether ZeroDev will use the sponsoring paymaster.