Skip to main content
Sign a Permit2 or ERC-2612 permit using EIP-712 typed data
This is a fully executable example. View the complete source with test assertions at examples/signing/eip712-permit.ts.

EIP-712 Structure

EIP-712 defines a standard for typed structured data hashing and signing:
  1. Domain Separator - Uniquely identifies the application (contract name, version, chain, address)
  2. Type Hash - keccak256 of the type string (e.g., "Permit(address owner,...)")
  3. Struct Hash - keccak256 of the encoded struct data with type hash
  4. Digest - keccak256("\x19\x01" || domainSeparator || structHash)
The \x19\x01 prefix prevents collision with eth_sign messages.