getAddress

Returns the account address if the account exists.

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
16const address = await signer.getAddress();

Returns

Promise<string> a promise that resolves to the account address