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 { createLitSignerWithAuthMethod } from "./lit";


const litSigner = new createLitSignerWithAuthMethod();

const address = await litSigner.getAddress();
ts
import { polygonMumbai } from "@alchemy/aa-core";
import { LitAuthMethod, LitSigner } from "@alchemy/aa-signers/lit-protocol";

const API_KEY = "<YOUR API KEY>";
const POLYGON_MUMBAI_RPC_URL = `${polygonMumbai.rpcUrls.alchemy.http[0]}/${API_KEY}`;
const PKP_PUBLIC_KEY = "<YOUR PKP PUBLIC KEY>";

export const createLitSignerWithAuthMethod = async () => {
  return new LitSigner<LitAuthMethod>({
    pkpPublicKey: PKP_PUBLIC_KEY,
    rpcUrl: POLYGON_MUMBAI_RPC_URL,
  });
};

Returns

Promise<Address>

A Promise containing the address of the Signer.