View Source Web3 (web3ex v0.1.0)

TODO [ ] add web3 moduledoc

Link to this section Summary

Functions

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

Validates a hexadecimal encoded string to see if it conforms to an address.

Checks if the address is a valid checksummed address.

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

Converts a integer to hex.

Converts a hex string to a integer.

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

Link to this section Functions

Link to this function

compile_config(module_name, default_config, opts)

View Source
Link to this macro

contract(contract_name, opts)

View Source (macro)
Link to this macro

dispatch(method, opts)

View Source (macro)
@spec from_wei(integer(), atom()) :: integer() | float() | no_return()

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

@spec is_address(String.t()) ::
  {:ok, String.t()}
  | {:error, :invalid_length | :invalid_characters | :invalid_checksum}

Validates a hexadecimal encoded string to see if it conforms to an address.

examples

Examples

iex> Web3.is_address("0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d")

iex> Web3.is_address("0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232H")

Link to this function

is_checksum_address(arg)

View Source

Checks if the address is a valid checksummed address.

examples

Examples

iex> Web3.is_checksum_address("0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d")
true
Link to this function

json_rpc(payload, json_rpc_arguments)

View Source
@spec keccak256(String.t()) :: String.t()

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

examples

Examples

iex> Web3.keccak256("123") "0x64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107"

Link to this macro

middleware(middleware_module)

View Source (macro)
Link to this function

parse_privkey(private_key)

View Source
@spec parse_privkey(String.t()) :: {:ok, binary()} | :errork

Parse privkey

@spec to_hex(any()) :: String.t()

Converts a integer to hex.

examples

Examples

iex> Web3.to_hex(10)
"0xA"

iex> Web3.to_hex("0xa")
"0xa"

iex> Web3.to_hex(true)
"0x1"
@spec to_integer(String.t() | non_neg_integer()) :: non_neg_integer() | :error

Converts a hex string to a integer.

examples

Examples

iex> Web3.to_integer(10)
10

iex> Web3.to_integer("0xa")
10
@spec to_wei(integer(), atom()) :: integer()

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