getBundlerClient

Creates and returns a BundlerClient using the existing account provider’s transport and chain.

Import

1import { EthersProviderAdapter } from "@aa-sdk/ethers";

Usage

1import { AccountSigner, EthersProviderAdapter } from "@aa-sdk/ethers";
2import { LocalAccountSigner } from "@aa-sdk/core";
3import { sepolia } from "@account-kit/infra";
4import { createLightAccount } from "@account-kit/smart-contracts";
5
6const account = await createLightAccount({
7 transport: http("https://rpc.testnet.aepps.com"),
8 chain: sepolia,
9 signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
10});
11
12const provider = new EthersProviderAdapter({
13 account,
14 chain: sepolia,
15 rpcProvider: "https://eth-sepolia.g.alchemy.com/v2/your-api-key",
16});
17
18const bundlerClient = provider.getBundlerClient();

Returns

BundlerClient<Transport> A bundler client configured with the existing account provider.