connect
connect
is a method on AccountSigner
that you can call to connect an EthersProviderAdapter
to this Signer. This lets the returned AccountSigner
leverage the provider when signing messages, sending user operations and transactions for the smart account using the signer.
Usage
example.ts
import { accountSigner } from "./ethers-signer";
// changing the ethers provider for the account signer
const alchemy = new Alchemy({
apiKey: process.env.API_KEY!,
network: Network.SEPOLIA, // new chain -> new provider
});
const ethersProvider = await alchemy.config.getProvider();
const newProvider = EthersProviderAdapter.fromEthersProvider(ethersProvider);
// connecting the account signer to ethers
const newAccountSigner = accountSigner.connect(newProvider);
Returns
AccountSigner
A new instance of a connected AccountSigner
Parameters
provider: EthersProviderAdapter
the EthersProviderAdapter
to connect with this AccountSigner