signTypedData

Signs typed data (EIP-712) using the smart account. This method requests the account associated with the signer and uses it to sign the typed data.

Import

1import { signTypedData } from "@account-kit/wallet-client";

Usage

1// Sign typed data
2const signature = await client.signTypedData({
3 domain: {
4 name: "Example DApp",
5 version: "1",
6 chainId: 1,
7 verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
8 },
9 types: {
10 Person: [
11 { name: "name", type: "string" },
12 { name: "wallet", type: "address" },
13 ],
14 },
15 primaryType: "Person",
16 message: {
17 name: "John Doe",
18 wallet: "0xAaAaAaAaAaAaAaAaAaAAAAAAAAaaaAaAaAaaAaAa",
19 },
20});

Parameters

client

InnerWalletApiClient

  • The wallet API client to use for the request

signer

SmartAccountSigner

  • The signer of the smart account

params

TypedDataDefinition

  • The typed data to sign, following EIP-712 format

Returns

Promise<SignTypedDataResult> A Promise that resolves to the signature as a hex string