to7702KernelSmartAccount
Creates a KernelAccount instance by delegating owner using EIP-7702. Check out this guide for a complete tutorial.
Usage
import { to7702KernelSmartAccount } from "permissionless/accounts"
import { entryPoint07Address } from "viem/account-abstraction"
import { publicClient } from "./publicClient"
import { owner } from "./owner"
const kernelAccount = await to7702KernelSmartAccount({
client: publicClient,
version: "0.3.1"
entryPoint: {
address: entryPoint07Address,
version: "0.7"
},
owner
});import { createPublicClient, http } from "viem"
import { sepolia } from "viem/chains"
export const publicClient = createPublicClient({
chain: sepolia,
transport: http("https://sepolia.rpc.thirdweb.com"),
})import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
const privateKey = generatePrivateKey()
export const owner = privateKeyToAccount(privateKey)Returns
- Type:
SmartAccount<KernelSmartAccountImplementation<entryPointVersion, true>>
The Kernel smart account instance.
Parameters
client
- Type:
Client
A public client as smart account needs access to the Network to query for information about its state (e.g. nonce, address, etc).
owner
- Type:
[LocalAccount | EIP1193Provider | WalletClient]
The owner which will be delegated to kernel smart account.
entryPoint (optional)
- Type:
{ address: Address, version: "0.6" | "0.7" }
The address and the version of the EntryPoint contract. If not provided, entryPoint 0.7 will be used.
accountLogicAddress (optional)
- Type:
Address
The address of the Kernel account logic that will be used while delegating the owner.