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 { createWeb3AuthSigner } from "./web3auth";
const web3AuthSigner = await createWeb3AuthSigner();
const address = await web3AuthSigner.getAddress();
ts
import { Web3AuthSigner } from "@alchemy/aa-signers/web3auth";
export const createWeb3AuthSigner = async () => {
const web3AuthSigner = new Web3AuthSigner({
clientId: "test",
chainConfig: {
chainNamespace: "eip155",
},
});
await web3AuthSigner.authenticate({
init: async () => {
await web3AuthSigner.inner.initModal();
},
connect: async () => {
await web3AuthSigner.inner.connect();
},
});
return web3AuthSigner;
};
Returns
Promise<Address>
A Promise
containing the address of the Signer.