getAccountAddress
Retrieves the account address. Uses a provided accountAddress
if available; otherwise, it computes the address using the entry point contract and the initial code.
Import
import { getAccountAddress } from "@aa-sdk/core";
Usage
import { getEntryPoint, getAccountAddress } from "@aa-sdk/core";
const accountAddress = await getAccountAddress({
client,
entryPoint: getEntryPoint(chain),
getAccountInitCode: async () => "0x{factoryAddress}{factoryCallData}",
});
Parameters
params
GetAccountAddressParams
The configuration object
params.client
PublicClient
A public client instance to interact with the blockchain
params.entryPoint
EntryPointDef
The entry point definition which includes the address and ABI
params.accountAddress
Address
Optional existing account address
params.getAccountInitCode
() => Promise<Hex>
A function that returns a Promise resolving to a Hex string representing the initial code of the account
Returns
Promise<Address>
A promise that resolves to the account address