module Eth::Eip712
def hash(data)
-
(String)
- a Keccak-256 hash of the EIP-712-encoded typed data.
Parameters:
-
data
(Array
) -- all the data in the typed data structure.
def hash(data) data = enforce_typed_data data # EIP-191 prefix byte buffer = Signature::EIP191_PREFIX_BYTE # EIP-712 version byte buffer += Signature::EIP712_VERSION_BYTE # hashed domain data buffer += hash_data "EIP712Domain", data[:domain], data[:types] # hashed message data buffer += hash_data data[:primaryType], data[:message], data[:types] return Util.keccak256 buffer end