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
Parse privkey
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
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")
Checks if the address is a valid checksummed address.
examples
Examples
iex> Web3.is_checksum_address("0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d")
true
Returns a 0x prepended 32 byte hash of the input string
examples
Examples
iex> Web3.keccak256("123") "0x64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107"
Parse privkey
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
Converts the value to whatever unit key is provided. See unit map for details.