EIP-712 Derive Macro
This crate provides a derive macro Eip712 that is used to encode a rust struct
into a payload hash, according to https://eips.ethereum.org/EIPS/eip-712
The trait used to derive the macro is found in ethers_core::transaction::eip712::Eip712
Both the derive macro and the trait must be in context when using
This derive macro requires the #[eip712] attributes to be included
for specifying the domain separator used in encoding the hash.
NOTE: In addition to deriving Eip712 trait, the EthAbiType trait must also be derived.
This allows the struct to be parsed into ethers_core::abi::Token for encoding.
Optional Eip712 Parameters
The only optional parameter is salt, which accepts a string
that is hashed using keccak256 and stored as bytes.
Example Usage
use EthAbiType;
use *;
use ;
let puzzle = Puzzle ;
let hash = puzzle.encode_eip712?;
Limitations
At the moment, the derive macro does not recursively encode nested Eip712 structs.
There is an Inner helper attribute #[eip712] for fields that will eventually be used to
determine if there is a nested eip712 struct. However, this work is not yet complete.