Function
convertToRawAmount
convertToRawAmount(num: bigint | SupportedNumber, decimals?: number): RawAmountConvert a SupportedNumber or RawAmount into RawAmount with optional specified decimals. The function throws error under these conditions:
- When the input number is not a base-10 number.
- When the specified decimals is not an integer number between 0 and 78 (inclusive).
- When the decimals argument is incompatible with num.decimals.
- When the calculated value is out of range.
Parameters
- num: bigint | SupportedNumber
The input number to convert.
Optionaldecimals: numberThe optional number of decimals to use for the conversion.
Returns RawAmount
- The converted RawAmount.
Throws
Will throw an error if the input number is not a base-10 number or the specified decimals is invalid.