ExW3.Utils (exw3 v0.6.1) View Source

Link to this section Summary

Functions

converts Ethereum style bytes to string

Converts an Ethereum address into a form that can be used by the ABI encoder

Converts the value to whatever unit key is provided. See unit map for details.

Convert eth hex string to integer

Convert an integer to eth hex string

Checks if the address is a valid checksummed address

Returns a 0x prepended 32 byte hash of the input string

Converts bytes to Ethereum address

Returns a checksummed address conforming to EIP-55

Converts the value to whatever unit key is provided. See unit map for details.

Link to this section Types

Specs

eth_hex() :: String.t()

Specs

invalid_hex_string() :: :invalid_hex_string

Specs

negative_integer() :: :negative_integer

Specs

non_integer() :: :non_integer

Link to this section Functions

Specs

bytes_to_string(binary()) :: binary()

converts Ethereum style bytes to string

Specs

format_address(binary()) :: integer()

Converts an Ethereum address into a form that can be used by the ABI encoder

Specs

from_wei(integer(), atom()) :: integer() | float() | no_return()

Converts the value to whatever unit key is provided. See unit map for details.

Specs

hex_to_integer(eth_hex()) ::
  {:ok, non_neg_integer()} | {:error, invalid_hex_string()}

Convert eth hex string to integer

Specs

integer_to_hex(non_neg_integer()) ::
  {:ok, eth_hex()} | {:error, negative_integer() | non_integer()}

Convert an integer to eth hex string

Link to this function

is_valid_checksum_address(address)

View Source

Specs

is_valid_checksum_address(String.t()) :: boolean()

Checks if the address is a valid checksummed address

Specs

keccak256(String.t()) :: String.t()

Returns a 0x prepended 32 byte hash of the input string

Specs

to_address(binary()) :: binary()

Converts bytes to Ethereum address

Link to this function

to_checksum_address(address)

View Source

Specs

to_checksum_address(String.t()) :: String.t()

Returns a checksummed address conforming to EIP-55

Specs

to_wei(integer(), atom()) :: integer()

Converts the value to whatever unit key is provided. See unit map for details.