EthersProviderAdapter

Configures and initializes the account provider based on the given options.

EthersProviderAdapter extends JsonRpcProvider, see the docs for JsonRpcProvider for all supported methods.

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});

Parameters

opts

EthersProviderAdapterOpts The options for setting up the ethers provider adapter