createLightAccount
Creates a light account based on the provided parameters such as transport, chain, signer, init code, and more. Ensures that an account is configured and returned with various capabilities, such as transferring ownership and retrieving the owner's address.
Import
import { createLightAccount } from "@account-kit/smart-contracts";
Usage
import { createLightAccount } from "@account-kit/smart-contracts";
import { LocalAccountSigner } from "@aa-sdk/core";
import { sepolia } from "viem/chains";
import { http, generatePrivateKey } from "viem";
const account = await createLightAccount({
chain: sepolia,
transport: http("RPC_URL"),
signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
});
Parameters
config
CreateLightAccountParams
The parameters for creating a light account
Returns
Promise<LightAccount>
A promise that resolves to a LightAccount
object containing the created account information and methods