Skip to main content

Function: parseUnits()

function parseUnits(value, decimals): bigint;

Defined in: packages/overcast-core/src/assets/amounts.ts:24

Convert a whole-token (display) decimal string to an exact native integer bigint. e.g. parseUnits("1.5", 9)1_500_000_000n. Throws if the value is malformed or specifies more fractional digits than decimals supports (which would silently truncate).

Parameters

ParameterType
valuestring
decimalsnumber

Returns

bigint