Defined in: aa-sdk/ethers/src/provider-adapter.ts:20
Lightweight Adapter for SmtAccountProvider to enable Signer Creation
JsonRpcProvider
new EthersProviderAdapter(opts): EthersProviderAdapter;Defined in: aa-sdk/ethers/src/provider-adapter.ts:48
Configures and initializes the account provider based on the given options.
Example
import { AccountSigner, EthersProviderAdapter } from "@aa-sdk/ethers";
import { LocalAccountSigner } from "@aa-sdk/core";
import { sepolia } from "@account-kit/infra";
import { createLightAccount } from "@account-kit/smart-contracts";
const account = await createLightAccount({
transport: http("https://rpc.testnet.aepps.com"),
chain: sepolia,
signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
});
const provider = new EthersProviderAdapter({
account,
chain: sepolia,
rpcProvider: "https://eth-sepolia.g.alchemy.com/v2/your-api-key",
});Parameters
| Parameter | Type | Description |
|---|---|---|
|
| The options for setting up the ethers provider adapter |
Returns
EthersProviderAdapter
Overrides
JsonRpcProvider.constructor;connectToAccount<TAccount>(account): AccountSigner<TAccount>;Defined in: aa-sdk/ethers/src/provider-adapter.ts:90
Connects the Provider to an Account and returns a Signer
Type Parameters
| Type Parameter |
|---|
|
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| the account to connect to |
Returns
AccountSigner<TAccount>
an AccountSigner that can be used to sign and send user operations
getBundlerClient(): BundlerClient<Transport>;Defined in: aa-sdk/ethers/src/provider-adapter.ts:123
Creates and returns a BundlerClient using the existing account provider's transport and chain.
Example
import { AccountSigner, EthersProviderAdapter } from "@aa-sdk/ethers";
import { LocalAccountSigner } from "@aa-sdk/core";
import { sepolia } from "@account-kit/infra";
import { createLightAccount } from "@account-kit/smart-contracts";
const account = await createLightAccount({
transport: http("https://rpc.testnet.aepps.com"),
chain: sepolia,
signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
});
const provider = new EthersProviderAdapter({
account,
chain: sepolia,
rpcProvider: "https://eth-sepolia.g.alchemy.com/v2/your-api-key",
});
const bundlerClient = provider.getBundlerClient();Returns
BundlerClient<Transport>
A bundler client configured with the existing account provider.
send(method, params): Promise<any>;Defined in: aa-sdk/ethers/src/provider-adapter.ts:79
Rewrites the send method to use the account provider's EIP-1193 compliant request method
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| the RPC method to call |
|
| the params required by the RPC method |
Returns
Promise<any>
the result of the RPC call
Overrides
JsonRpcProvider.send;static fromEthersProvider(provider, chain): EthersProviderAdapter;Defined in: aa-sdk/ethers/src/provider-adapter.ts:139
Creates an instance of EthersProviderAdapter from an ethers.js JsonRpcProvider.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| the ethers JSON RPC provider to convert |
| the chain to connect to |
Returns
EthersProviderAdapter
an instance of EthersProviderAdapter