Conversions between Ethereum denominations and wei.
Supports bare non-negative integer inputs (treated as wei), integer :wei,
integer :gwei, and integer or Decimal :eth inputs. :eth is the only
ETH-denomination atom accepted; :ether is not supported so callers use the
same short form as :wei and :gwei.
Summary
Functions
Converts a number to wei, possibly from gwei or eth.
Functions
@spec to_wei( non_neg_integer() | {non_neg_integer(), :wei | :gwei | :eth} | {Decimal.t(), :eth} ) :: non_neg_integer()
Converts a number to wei, possibly from gwei or eth.
Examples
iex> Cartouche.Wei.to_wei(100)
100
iex> Cartouche.Wei.to_wei({100, :gwei})
100000000000
iex> Cartouche.Wei.to_wei({1, :eth})
1000000000000000000