Skip to main content

bridge/functions/toBaseUnits.md

toBaseUnits(amount, decimals): bigint

Convert a decimal amount to base units (smallest denomination)

Parameters​

ParameterTypeDescription
amountstringThe decimal amount as a string (e.g., "1.5")
decimalsnumberThe number of decimal places

Returns​

bigint

The amount in base units as a bigint

Throws​

GalaSDKError INVALID_BRIDGE_AMOUNT: not_a_number, or too_many_decimals when it cannot be represented with the given decimals (it is never rounded)