Skip to content

getAddress

getAddress returns the EOA address of the Signer.

This method must be called after authenticate. Otherwise, this method will throw an error with the message Not Authenticated.

Usage

ts
import { createPortalSigner } from "./portal";

const portalSigner = await createPortalSigner();

const address = await portalSigner.getAddress();
ts
import { sepolia } from "@alchemy/aa-core";
import { PortalSigner } from "@alchemy/aa-signers/portal";

export const createPortalSigner = async () => {
  const portalSigner = new PortalSigner({
    autoApprove: true,
    gatewayConfig: `${sepolia.rpcUrls.alchemy.http}/${process.env.ALCHEMY_API_KEY}`,
    chainId: sepolia.id,
  });

  await portalSigner.authenticate();

  return portalSigner;
};

Returns

Promise<Address>

A Promise containing the address of the Signer.