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
| Name | Type | Required | Description |
|---|---|---|---|
address | 0x${string} | Yes | Address to sign with |
typedData | string | Yes | JSON 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
| Code | Description |
|---|---|
| 4001 | User rejected the request |
| 4100 | Unauthorized (not authenticated) |
| -32602 | Invalid 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
- personal_sign - Sign plain messages
- wallet_sign - Generic signing method