JSON structure for EIP-712 messages clear signing
1. Create the JSON file
How-to
- Begin by using this template to create your JSON file. It provides the basic structure required to clear sign EIP-712 messages.
- Under the
"context"
and"EIP712"
key, provide the necessary EIP-712 information:"deployments"
: List the chain IDs and contract addresses where the contract is deployed."domain"
: Define the domain properties such asname
,chainId
, andverifyingContract
."schemas"
: List the primary type and the associated types used in the message.
- Under the
"metadata"
key, specify the metadata such as the owner of the contract. - Under the
"display"
key, define how the message fields should be displayed:"formats"
: Specify the intent and list the fields with their paths, labels, and formats."excluded"
: List any fields that should be excluded from the display.
Example
Below is an example JSON file for OpenSea:
{
"$schema": "../../specs/erc7730-v1.schema.json",
"context": {
"eip712": {
"deployments": [{ "chainId": 1, "address": "0x7f268357a8c2552623316e2562d90e642bb538e5" }],
"domain": { "name": "OpenSea", "chainId": 1, "verifyingContract": "0x7f268357a8c2552623316e2562d90e642bb538e5" },
"schemas": [
{
"primaryType": "Order",
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "version", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{ "name": "verifyingContract", "type": "address" }
],
"Order": [
{ "name": "exchange", "type": "address" },
{ "name": "maker", "type": "address" },
{ "name": "taker", "type": "address" },
{ "name": "makerRelayerFee", "type": "uint256" },
{ "name": "takerRelayerFee", "type": "uint256" },
{ "name": "makerProtocolFee", "type": "uint256" },
{ "name": "takerProtocolFee", "type": "uint256" },
{ "name": "feeRecipient", "type": "address" },
{ "name": "feeMethod", "type": "uint8" },
{ "name": "side", "type": "uint8" },
{ "name": "saleKind", "type": "uint8" },
{ "name": "target", "type": "address" },
{ "name": "howToCall", "type": "uint8" },
{ "name": "calldata", "type": "bytes" },
{ "name": "replacementPattern", "type": "bytes" },
{ "name": "staticTarget", "type": "address" },
{ "name": "staticExtradata", "type": "bytes" },
{ "name": "paymentToken", "type": "address" },
{ "name": "basePrice", "type": "uint256" },
{ "name": "extra", "type": "uint256" },
{ "name": "listingTime", "type": "uint256" },
{ "name": "expirationTime", "type": "uint256" },
{ "name": "salt", "type": "uint256" },
{ "name": "nonce", "type": "uint256" }
]
}
}
]
}
},
"metadata": { "owner": "Wyvern Exchange Contract" },
"display": {
"formats": {
"Order": {
"intent": "OpenSea Listing",
"fields": [
{ "path": "exchange", "label": "Contract address", "format": "raw" },
{ "path": "basePrice", "label": "Price", "format": "raw" },
{ "path": "expirationTime", "label": "Offer expiration", "format": "raw" }
],
"excluded": [
"side",
"extra",
"saleKind",
"staticTarget",
"target",
"howToCall",
"makerRelayerFee",
"feeMethod",
"replacementPattern",
"takerRelayerFee",
"taker",
"listingTime",
"staticExtradata",
"makerProtocolFee",
"takerProtocolFee",
"paymentToken",
"calldata",
"salt",
"feeRecipient",
"maker"
]
}
}
}
}
2. Submit your file
Follow this process to submit your file