XCBAmount class
Utility class to easily convert amounts of Core into different units of quantities.
Constructors
- XCBAmount.fromUnitAndValue(XCBUnit unit, dynamic amount)
-
Constructs an amount of Core by a unit and its amount.
amountcan either be a base10 string, an int, or a BigInt.factory - XCBAmount.inOre(BigInt _value)
-
const
- XCBAmount.zero()
Properties
Methods
-
getValueInUnit(
XCBUnit unit) → double - Gets the value of this amount in the specified unit. WARNING: Due to rounding errors, the return value of this function is not reliable, especially for larger amounts or smaller units. While it can be used to display the amount of ether in a human-readable format, it should not be used for anything else.
-
getValueInUnitBI(
XCBUnit unit) → BigInt - Gets the value of this amount in the specified unit as a whole number. WARNING: For all units except for XCBUnit.ore, this method will discard the remainder occurring in the division, making it unsuitable for calculations or storage. You should store and process amounts of ether by using a BigInt storing the amount in wei.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override