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

1import { createLightAccount } from "@account-kit/smart-contracts";

Usage

1import { createLightAccount } from "@account-kit/smart-contracts";
2import { LocalAccountSigner } from "@aa-sdk/core";
3import { sepolia } from "viem/chains";
4import { http, generatePrivateKey } from "viem";
5
6const account = await createLightAccount({
7 chain: sepolia,
8 transport: http("RPC_URL"),
9 signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
10});

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