connect

Sets the provider for the account signer and returns the updated account signer instance. Note: this is not necessary since the Provider is required by the constructor. This is useful if you want to change the provider after the account signer has been created.

Import

1import { AccountSigner } 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";
5import { http } from "viem";
6
7const account = await createLightAccount({
8 transport: http("https://rpc.testnet.aepps.com"),
9 chain: sepolia,
10 signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
11});
12
13const provider = new EthersProviderAdapter();
14const signer = new AccountSigner(provider, account);
15
16signer.connect(provider);

Parameters

provider

EthersProviderAdapter the provider to be set for the account signer

Returns

AccountSigner<TAccount> the updated account signer instance