EthUnit class

Ethereum unit conversion utilities.

Provides conversion between wei, gwei, and ether units.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

weiPerEther BigInt
1 ether = 10^18 wei
final
weiPerGwei BigInt
1 gwei = 10^9 wei
final

Static Methods

convert(BigInt value, {required Unit from, required Unit to}) BigInt
Converts between units.
ether(String value) BigInt
Converts an ether string value to wei.
formatEther(BigInt wei) String
Formats wei to a human-readable ether string.
formatGwei(BigInt wei) String
Formats wei to a human-readable gwei string.
formatWei(BigInt wei) String
Formats wei to a human-readable wei string.
gwei(String value) BigInt
Converts a gwei string value to wei.
wei(String value) BigInt
Converts a string value to wei.