createLightAccountClient

Creates a light account client using the provided parameters, including account information, transport mechanism, blockchain chain, and additional client configurations. This function first creates a light account and then uses it to create a smart account client, extending it with light account client actions.

Also, we modified the return type to be the light account alchemy client if the transport is alchemy.

Import

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

Usage

1import { createLightAccountClient } 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 createLightAccountClient({
7 chain: sepolia,
8 transport: http("RPC_URL"),
9 signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
10});

Parameters

params

CreateLightAccountClientParams The parameters for creating a light account client

Returns

Promise<SmartAccountClient> A promise that resolves to a SmartAccountClient object containing the created account information and methods