Smart Contract Wallet - Zerodev
Bundler and Paymaster config
bundlerAPI: 'https://polynomial-mainnet.g.alchemy.com/v2/nUkjX-R-WfZwctQu_TLm0xQ7KI8TVXaD',
paymasterAPI: 'https://polynomial-mainnet.g.alchemy.com/v2/nUkjX-R-WfZwctQu_TLm0xQ7KI8TVXaD',
policy: '14119bab-6c62-4fed-8fe7-27ad5fcc5754'
Sample Code Snippets
AA client Setup (Typescript)
import { getWalletClient } from '@wagmi/core';
import { signerToEcdsaValidator, getKernelAddressFromECDSA } from '@zerodev/ecdsa-validator';
import {createPublicClient} from 'viem';
import {
addressToEmptyAccount,
createKernelAccount,
createKernelAccountClient
} from '@zerodev/sdk';
const client = await getWalletClient(wagmiConfig);
const publicClient = createPublicClient({
transport: http(getZeroDevBundlerRPC(chain.id, true, ZERODEV_PROVIDER)),
chain: chain
});
const ecdsaValidator = await signerToEcdsaValidator(publicClient, {
signer: client,
entryPoint,
kernelVersion: KERNEL_V3_1
});
const account = await createKernelAccount(publicClient, {
plugins: {
sudo: ecdsaValidator
},
entryPoint,
index: 8008n,
kernelVersion: "0.3.1"
});
const aaClient = createKernelAccountClient({
account,
chain,
pollingInterval: 500,
bundlerTransport: http(getZeroDevBundlerRPC(chain.id, false, ZERODEV_PROVIDER)),
paymaster: {
getPaymasterData(userOperation) {
return sponsorUserOperationPolynomial({
userOperation,
entryPoint,
chain
});
}
},
userOperation: {
estimateFeesPerGas() {
return {
maxFeePerGas: 0n,
maxPriorityFeePerGas: 0n
};
}
}
});
SponsorUserOperation function
Transaction Execution through Zerodev
Last updated