pub struct TypedData {
pub domain: EIP712Domain,
pub types: BTreeMap<String, Vec<Eip712DomainType, Global>, Global>,
pub primary_type: String,
pub message: BTreeMap<String, Value, Global>,
}
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: EIP712Domain
Signing 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: BTreeMap<String, Vec<Eip712DomainType, Global>, Global>
The custom types used by this message.
primary_type: String
The type of the message.
message: BTreeMap<String, Value, Global>
The message to be signed.
Trait Implementations§
source§impl<'de> Deserialize<'de> for TypedData
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<TypedData, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<TypedData, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl Eip712 for TypedData
impl Eip712 for TypedData
source§fn encode_eip712(&self) -> Result<[u8; 32], <TypedData as Eip712>::Error>
fn encode_eip712(&self) -> Result<[u8; 32], <TypedData as Eip712>::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.
§type Error = Eip712Error
type Error = Eip712Error
source§fn domain(&self) -> Result<EIP712Domain, <TypedData as Eip712>::Error>
fn domain(&self) -> Result<EIP712Domain, <TypedData as Eip712>::Error>
source§fn type_hash() -> Result<[u8; 32], <TypedData as Eip712>::Error>
fn type_hash() -> Result<[u8; 32], <TypedData as Eip712>::Error>
source§impl PartialEq<TypedData> for TypedData
impl PartialEq<TypedData> for TypedData
source§impl Serialize for TypedData
impl Serialize for TypedData
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for TypedData
impl StructuralEq for TypedData
impl StructuralPartialEq for TypedData
Auto Trait Implementations§
impl RefUnwindSafe for TypedData
impl Send for TypedData
impl Sync for TypedData
impl Unpin for TypedData
impl UnwindSafe for TypedData
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.