View Source Signet.Typed.Domain (Signet v1.0.0-beta7)
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
Deserializes a domain from JSON or JavaScript encoding to a struct.
Examples
iex> %{
...> "name" => "Ether Mail",
...> "version" => "1",
...> "chainId" => 1,
...> "verifyingContract" => "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
...> }
...> |> Signet.Typed.Domain.deserialize()
%Signet.Typed.Domain{
name: "Ether Mail",
version: "1",
chain_id: 1,
verifying_contract: Base.decode16!("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC")
}
Serializes a domain, such that it can be JSON-encoded or passed to JavaScript.
Examples
iex> %Signet.Typed.Domain{
...> name: "Ether Mail",
...> version: "1",
...> chain_id: 1,
...> verifying_contract: Base.decode16!("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC")
...> }
...> |> Signet.Typed.Domain.serialize()
%{
"name" => "Ether Mail",
"version" => "1",
"chainId" => 1,
"verifyingContract" => "0xCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC",
}
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> %Signet.Typed.Domain{
...> name: "Ether Mail",
...> version: "1",
...> chain_id: 1,
...> verifying_contract: Base.decode16!("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC")
...> }
...> |> Signet.Typed.Domain.serialize_keys()
%{
"name" => "Ether Mail",
"version" => "1",
"chainId" => 1,
"verifyingContract" => Base.decode16!("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC")
}