Ethex.Utils (Ethex v1.1.1)
View SourceUtils
Summary
Functions
From hex
Example
iex> Ethex.Utils.from_hex "0x2766"
10086
@spec from_wei(integer(), pos_integer()) :: float()
Convert wei to eth.
Example
iex> Ethex.Utils.from_wei(4011000000000000, 18)
0.004011
To hex
Example
iex> Ethex.Utils.to_hex 10086
"0x2766"
@spec to_wei(number(), pos_integer()) :: integer()
Convert eth to wei.
Example
iex> Ethex.Utils.to_wei(0.1, 18)
100000000000000000