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 { createCapsuleSigner } from "./capsule";
const capsuleSigner = await createCapsuleSigner();
const address = await capsuleSigner.getAddress();
ts
import { sepolia } from "@alchemy/aa-core";
import { CapsuleSigner } from "@alchemy/aa-signers/capsule";
import { Environment } from "@usecapsule/web-sdk";
import { http } from "viem";
export const createCapsuleSigner = async () => {
// get an API Key by filling out this form: https://form.typeform.com/to/hLaJeYJW
const capsuleSigner = new CapsuleSigner({
env: Environment.DEVELOPMENT,
apiKey: "CAPSULE_API_KEY",
walletConfig: {
chain: sepolia,
// get your own Alchemy API key at: https://dashboard.alchemy.com/
transport: http(`${sepolia.rpcUrls.alchemy.http[0]}/ALCHEMY_API_KEY`),
},
});
await capsuleSigner.authenticate();
return capsuleSigner;
};
Returns
Promise<Address>
A Promise
containing the address of the Signer.