parseUnit static method

BigNumber parseUnit(
  1. String value, [
  2. dynamic unit = 'ether'
])

Returns a BigNumber representation of value, parsed with unit digits (if it is a number) or from the unit specified (if a string).


EthUtils.parseUnits("1.0"); // { BigNumber: "1000000000000000000" }

EthUtils.parseUnits("1.0", "ether"); // { BigNumber: "1000000000000000000" }

EthUtils.parseUnits("1.0", 18); // { BigNumber: "1000000000000000000" }

EthUtils.parseUnits("121.0", "gwei"); // { BigNumber: "121000000000" }

EthUtils.parseUnits("121.0", 9); // { BigNumber: "121000000000" }

Implementation

external static BigNumber parseUnit(String value, [dynamic unit = 'ether']);