Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

eth_signTypedData_v4

Sign structured typed data via EIP-712.

Authentication Required: Yes

Request

await jaw.provider.request({
  method: 'eth_signTypedData_v4',
  params: [
    '0x1234...',
    JSON.stringify(typedData),
  ],
});

Parameters

NameTypeRequiredDescription
address0x${string}YesAddress to sign with
typedDatastringYesJSON stringified EIP-712 typed data

TypedData Structure

The typed data must follow EIP-712 format:

{
  types: {
    EIP712Domain: [...],
    [primaryType]: [...],
  },
  primaryType: string,
  domain: {
    name: string,
    version: string,
    chainId: number,
    verifyingContract?: string,
  },
  message: object,
}

Example

[
  "0x1234567890123456789012345678901234567890",
  "..."
]

Response

Returns the signature as a hexadecimal string.

Type: 0x${string}

Example

"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab"

Behavior

  • Opens popup showing structured data in human-readable format
  • Validates EIP-712 format before signing
  • Shows domain, message types, and values to user

Errors

CodeDescription
4001User rejected the request
4100Unauthorized (not authenticated)
-32602Invalid params (malformed EIP-712 data)

Example

const typedData = {
  types: {
    EIP712Domain: [
      { name: 'name', type: 'string' },
      { name: 'version', type: 'string' },
      { name: 'chainId', type: 'uint256' },
    ],
    Mail: [
      { name: 'from', type: 'Person' },
      { name: 'to', type: 'Person' },
      { name: 'contents', type: 'string' },
    ],
    Person: [
      { name: 'name', type: 'string' },
      { name: 'wallet', type: 'address' },
    ],
  },
  primaryType: 'Mail',
  domain: {
    name: 'My DApp',
    version: '1',
    chainId: 1,
  },
  message: {
    from: {
      name: 'Alice',
      wallet: '0x1234...',
    },
    to: {
      name: 'Bob',
      wallet: '0x5678...',
    },
    contents: 'Hello Bob!',
  },
};
 
const signature = await jaw.provider.request({
  method: 'eth_signTypedData_v4',
  params: [account, JSON.stringify(typedData)],
});

Related Methods