Getting started with Light Account
It is easy to get started with Light Account! We will show you how to create and send user operations for both LightAccount
and MultiOwnerLightAccount
using @alchemy/aa-alchemy
.
Install packages
Prerequisites- minimum Typescript version of 5
- pin viem to 2.20.0 (
yarn add [email protected]
)
npm
npm i @account-kit/smart-contracts
Create a client and send a user operation
The code snippets below demonstrate how to use LightAccount
and MultiOwnerLightAccount
with Account Kit. They create the account and send a UserOperation
from it.
light-account.ts
import { createLightAccountAlchemyClient } from "@account-kit/smart-contracts";
import { sepolia } from "@account-kit/infra";
import { LocalAccountSigner } from "@aa-sdk/core";
import { generatePrivateKey } from "viem";
const lightAccountClient = await createLightAccountAlchemyClient({
apiKey: "your-api-key",
chain: sepolia,
signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
});