Module utils
Expand description
Common Ethereum utilities.
Structs§
- Keccak256
- Simple Keccak-256hasher.
- Unit
- Ethereum unit. Always less than 77.
Enums§
- DecimalSeparator 
- Decimal separator for number formatting
- ParseUnits 
- This enum holds the numeric types that a possible to be returned by parse_unitsand that are taken byformat_units.
- UnitsError 
- Error type for Unit-related operations.
Constants§
- EIP191_PREFIX 
- The prefix used for hashing messages according to EIP-191.
- KECCAK256_ EMPTY 
- The Keccak-256 hash of the empty string "".
Functions§
- box_try_ new 
- Allocates memory on the heap then places xinto it, returning an error if the allocation fails.
- box_try_ new_ uninit 
- Constructs a new box with uninitialized contents on the heap, returning an error if the allocation fails.
- eip191_hash_ message 
- Hash a message according to EIP-191 (version 0x01).
- eip191_message 
- Constructs a message according to EIP-191 (version 0x01).
- format_ether 
- Formats the given number of Wei as an Ether amount.
- format_units 
- Formats the given number of Wei as the given unit.
- format_units_ with 
- Formats the given number of Wei as the given unit with a custom decimal separator.
- keccak256
- Simple interface to the Keccak-256hash function.
- parse_ether 
- Converts the input to a U256 and converts from Ether to Wei.
- parse_units 
- Parses a decimal number and multiplies it with 10^units.
- try_collect_ vec 
- Tries to collect the elements of an iterator into a Vec.
- vec_try_ with_ capacity 
- Tries to create a Vecwith the given capacity.