function parseUnits(value, unit?): bigint

Converts the decimal string value to a BigInt, assuming unit decimal places. The unit may the number of decimal places or the name of a unit (e.g. "gwei" for 9 decimal places).

Parameters

ParameterTypeDescription
valuestringThe value to convert.
unit?string | NumericThe unit to convert from. Default is 18

Returns

bigint

The converted value.

Throws

If the unit is invalid.

Throws

If the value is not a string.

Source

utils/units.ts:57