pub struct TypedData {
pub domain: EIP712Domain,
pub types: Types,
pub primary_type: String,
pub message: BTreeMap<String, Value>,
}Expand description
Typed data is a JSON object containing type information, domain separator parameters and the message object which has the following schema
{Fields§
§domain: EIP712DomainSigning domain metadata. The signing domain is the intended context for the signature (e.g. the dapp, protocol, etc. that it’s intended for). This data is used to construct the domain seperator of the message.
types: TypesThe custom types used by this message.
primary_type: StringThe type of the message.
message: BTreeMap<String, Value>The message to be signed.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TypedData
According to the MetaMask implementation,
the message parameter may be JSON stringified in versions later than V1
See https://github.com/MetaMask/metamask-extension/blob/0dfdd44ae7728ed02cbf32c564c75b74f37acf77/app/scripts/metamask-controller.js#L1736
In fact, ethers.js JSON stringifies the message at the time of writing.
impl<'de> Deserialize<'de> for TypedData
According to the MetaMask implementation, the message parameter may be JSON stringified in versions later than V1 See https://github.com/MetaMask/metamask-extension/blob/0dfdd44ae7728ed02cbf32c564c75b74f37acf77/app/scripts/metamask-controller.js#L1736 In fact, ethers.js JSON stringifies the message at the time of writing.
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Eip712 for TypedData
impl Eip712 for TypedData
Source§fn encode_eip712(&self) -> Result<[u8; 32], Self::Error>
fn encode_eip712(&self) -> Result<[u8; 32], Self::Error>
Hash a typed message according to EIP-712. The returned message starts with the EIP-712 prefix, which is “1901”, followed by the hash of the domain separator, then the data (if any). The result is hashed again and returned.