Skip to content

signTypedData

The signTypedData method is used to sign typed data with the Alchemy Signer.

WARNING

This method throws if there is no authenticated user.

Usage

ts
import { signer } from "./signer";

const signature = await signer.signTypedData(typedDataParams);
ts
import { AlchemySigner } from "@alchemy/aa-alchemy";

export const signer = new AlchemySigner({
  client: {
    // This is created in your dashboard under `https://dashboard.alchemy.com/settings/access-keys`
    // NOTE: it is not recommended to expose your API key on the client, instead proxy requests to your backend and set the `rpcUrl`
    // here to point to your backend.
    connection: { apiKey: "alcht_<KEY>" },
    iframeConfig: {
      // you will need to render a container with this id in your DOM
      iframeContainerId: "turnkey-iframe-container",
    },
  },
});

Returns

Promise<Hex> -- on success returns the signature of the message.

Parameters

params: TypedDataDefinition -- the typed data definition of the message you want to sign