EIP712.Typed.Domain (eip712 v0.1.0)
Summary
Functions
Deserializes a domain from JSON or JavaScript encoding to a struct.
Serializes a domain, such that it can be JSON-encoded or passed to JavaScript.
Serializes a domain's keys to be JSON-compatible. This is so that it can be used
as a value for hashStruct
, per the EIP-712 spec to build a domain specifier.
Types
Functions
Link to this function
deserialize(map)
Deserializes a domain from JSON or JavaScript encoding to a struct.
Examples
iex> %{
...> "name" => "Ether Mail",
...> "version" => "1",
...> "chainId" => 1,
...> "verifyingContract" => "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
...> }
...> |> EIP712.Typed.Domain.deserialize()
%EIP712.Typed.Domain{
name: "Ether Mail",
version: "1",
chain_id: 1,
verifying_contract: <<204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204>>
}
Link to this function
domain_type()
Link to this function
serialize(domain)
Serializes a domain, such that it can be JSON-encoded or passed to JavaScript.
Examples
iex> %EIP712.Typed.Domain{
...> name: "Ether Mail",
...> version: "1",
...> chain_id: 1,
...> verifying_contract: <<204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204>>
...> }
...> |> EIP712.Typed.Domain.serialize()
%{
"name" => "Ether Mail",
"version" => "1",
"chainId" => 1,
"verifyingContract" => "0xcccccccccccccccccccccccccccccccccccccccc",
}
Link to this function
serialize_keys(domain)
Serializes a domain's keys to be JSON-compatible. This is so that it can be used
as a value for hashStruct
, per the EIP-712 spec to build a domain specifier.
Examples
iex> %EIP712.Typed.Domain{
...> name: "Ether Mail",
...> version: "1",
...> chain_id: 1,
...> verifying_contract: <<204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204>>
...> }
...> |> EIP712.Typed.Domain.serialize_keys()
%{
"name" => "Ether Mail",
"version" => "1",
"chainId" => 1,
"verifyingContract" => <<204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204>>
}