createKernelClientForWalletAccount
Creates a ZeroDev KernelClient instance for a given smart wallet account. The KernelClient allows you to send user operations and interact with the smart account.Usage
Parameters
| Parameter | Type | Description |
|---|---|---|
smartWalletAccount | EvmWalletAccount | The smart wallet account to create the KernelClient for |
withSponsorship | boolean (optional) | Whether to use gas sponsorship. Defaults to true |
networkId | string (optional) | The network ID to use. If not provided, uses the active network |
bundlerProvider | ZerodevBundlerProvider (optional) | A custom bundler provider |
bundlerRpc | string (optional) | A custom bundler RPC URL |
paymasterRpc | string (optional) | A custom paymaster RPC URL |
gasTokenAddress | Hex (optional) | Address of an ERC20 token to use for gas payments |
eip7702Auth | SignAuthorizationReturnType (optional) | A pre-signed EIP-7702 authorization. When provided, the kernel client uses this authorization instead of signing a new one internally. Useful for singleUse MFA flows where you need to separate the authorization signing step from the transaction step. |
client | DynamicClient (optional) | The Dynamic client instance. Only required when using multiple clients. |
Returns
Promise<KernelClient> - A promise that resolves to a ZeroDev KernelClient instance.
Examples
With gas sponsorship (default)
Without gas sponsorship
With custom gas token (ERC20)
With specific network
With pre-signed EIP-7702 authorization
This is useful for singleUse MFA flows where you need to separate the authorization signing step from the transaction step:Related functions
- signEip7702Authorization - Sign an EIP-7702 authorization for ZeroDev kernel delegation
- canSponsorTransaction - Check if a transaction can be sponsored
- estimateTransactionGas - Estimate gas for a transaction
- getSignerForSmartWalletAccount - Get the signer for a smart wallet