ExWeb3EcRecover.SignedType.Message (ethereum_signatures v0.6.2) View Source

This module represents a message data structure that is used to sign and recover, based on EIP 712.

Domain

For details look at this website.

- string name the user readable name of signing domain, i.e. the name of the DApp or the protocol.
- string version the current major version of the signing domain. Signatures from different versions are not compatible.
- uint256 chainId the EIP-155 chain id. The user-agent should refuse signing if it does not match the currently active chain.
- address verifyingContract the address of the contract that will verify the signature. The user-agent may do contract specific phishing prevention.
- bytes32 salt an disambiguating salt for the protocol. This can be used as a domain separator of last resort.

Source: https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator

Types

This field contains types available to be used by message field.

It should contain a list of maps containing name and type values. For list of available types consult EIP website.

Example

%{
  "Message" => [
    %{"name" => "data", "type" => "Child"},
    %{"name" => "intData", "type" => "int8"},
    %{"name" => "uintData", "type" => "uint8"},
    %{"name" => "bytesData", "type" => "bytes3"},
    %{"name" => "boolData", "type" => "bool"},
    %{"name" => "addressData", "type" => "address"}
  ],
  "Child" => [%{"name" => "data", "type" => "GrandChild"}],
  "GrandChild" => [%{"name" => "data", "type" => "string"}]
}

Primary type

A string designating the root type. The root of the message is expected to be of the primary_type.

Message

Message is map with the data that will be used to build data structure to be encoded.

Link to this section Summary

Functions

This function generates a struct representing a message.

Link to this section Types

Specs

t() :: %ExWeb3EcRecover.SignedType.Message{
  domain: map() | binary(),
  message: map(),
  primary_type: String.t(),
  types: map()
}

Link to this section Functions

Specs

from_map(message :: map()) :: {:ok, t()} | :error

This function generates a struct representing a message.

Check module doc for details.