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 { createLightAccountClient } from "@account-kit/smart-contracts";
import { LocalAccountSigner } from "@aa-sdk/core";
import { sepolia } from "viem/chains";
import { http, generatePrivateKey } from "viem";
const account = await createLightAccountClient({
chain: sepolia,
transport: http("RPC_URL"),
signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
});import { createLightAccountClient } from "@account-kit/smart-contracts";
import { sepolia, alchemy } from "@account-kit/infra";
import { LocalAccountSigner } from "@aa-sdk/core";
import { generatePrivateKey } from "viem";
const lightAlchemyAccountClient = await createLightAccountClient({
transport: alchemy({ apiKey: "your-api-key" }),
chain: sepolia,
signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
});The parameters for creating a light account client
function createLightAccountClient<TSigner>(
params,
): Promise<
AlchemySmartAccountClient<
undefined | Chain,
LightAccount<TSigner>,
LightAccountClientActions<TSigner>
>
>;Defined in: account-kit/smart-contracts/src/light-account/clients/client.ts:41
| Type Parameter | Default type |
|---|---|
|
|
| Parameter | Type |
|---|---|
|
|
Promise<AlchemySmartAccountClient<undefined | Chain, LightAccount<TSigner>, LightAccountClientActions<TSigner>>>
function createLightAccountClient<TChain, TSigner, TTransport>(
args,
): Promise<
SmartAccountClient<
CustomTransport,
TChain,
LightAccount<TSigner>,
SmartAccountClientActions<Chain, SmartContractAccount> &
LightAccountClientActions<TSigner, LightAccount<TSigner>>
>
>;Defined in: account-kit/smart-contracts/src/light-account/clients/client.ts:54
| Type Parameter | Default type |
|---|---|
|
|
|
|
|
| Parameter | Type |
|---|---|
|
|
Promise<SmartAccountClient<CustomTransport, TChain, LightAccount<TSigner>, SmartAccountClientActions<Chain, SmartContractAccount> & LightAccountClientActions<TSigner, LightAccount<TSigner>>>>