Skip to content

toViemAccount

This method lets you adapt your AlchemySigner to a viem LocalAccount, which will let you use the signer as an EOA directly.

Import

import { BaseAlchemySigner } from "@account-kit/signer";

Usage

import { AlchemyWebSigner } from "@account-kit/signer";
 
const signer = new AlchemyWebSigner({
  client: {
    connection: {
      rpcUrl: "/api/rpc",
    },
    iframeConfig: {
      iframeContainerId: "alchemy-signer-iframe-container",
    },
  },
});
 
const account = signer.toViemAccount();

Returns

LocalAccount a LocalAccount object that can be used with viem's wallet client