eth_signTypedData

Calculates an ethereum signature of the given typed structured data from the selected account.

Important

This method complies with the latest specification of EIP-712.

The document version used is commit 9e393a7.

Parameters

Name
Type
Description

Account

Address

Account to sign from.

Data

MessagePayload | JSONString<MessagePayload>

Structured data to sign.

MessagePayload

// https://eips.ethereum.org/EIPS/eip-712#parameters
type MessagePayload = {
  domain: EIP712Domain;
  types: { EIP712Domain: EIP712Domain } & Record<string, TypedProperty[]>;
  primaryType: string;
  message: any;
};

// https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator
type EIP712Domain = {
  name?: string;
  version?: string;
  chainId?: Number<uint256>;
  verifyingContract?: Address;
  salt?: HexString<bytes32>;
};

// https://eips.ethereum.org/EIPS/eip-712#definition-of-typed-structured-data-%F0%9D%95%8A
type TypedProperty = {
  name: string;
  type: string;
};

Return Type

HexString<Signature> - The ethereum ecdsa signature.

Example

Last updated

Was this helpful?