eip712HashStruct
Signature
Section titled “Signature”function eip712HashStruct( string calldata typeName, bytes calldata abiEncodedData) external pure returns (bytes32);Description
Section titled “Description”Returns the EIP-712 struct hash for a registered struct name (e.g. "Mail") and its abi.encode-d value.
This is not the final signable digest. To produce the digest that ecrecover expects, combine the struct hash with a domain separator: keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)). Alternatively, use eip712HashTypedData to compute the complete digest in one call.
Note: Requires the
test.solidity.eip712Typesconfiguration. See the EIP-712 type hashing guide for setup and full signing examples.
Example
Section titled “Example”Mail memory m = Mail({ from: Person({ wallet: address(0xA), name: "Alice" }), to: Person({ wallet: address(0xB), name: "Bob" }), contents: "hello"});
bytes32 hash = cheats.eip712HashStruct("Mail", abi.encode(m));