Expand description
Module with utility functions. Includes helpers for encoding, decoding, and other common tasks.
Functionsยง
- eth_
to_ wei - Converts an ETH amount to wei as a
U256. Accepts aBigDecimalETH value and returns the equivalent amount in wei as aU256. This is useful for preparing values for smart contract calls or transactions. Returns an error if the value is too large to fit in au128. - wei_
to_ eth - Converts a wei amount (
U256) to ETH as aBigDecimal. Useful for displaying human-readable ETH values from raw wei amounts, such as for UI or logs. Panics if theU256value cannot be parsed as a string (should not happen for valid values).