@gala-chain/chaincode ∙ API
API > roundTokenAmount
Function: roundTokenAmount()
roundTokenAmount(
amount,decimals,roundUp):BigNumber
Rounds a raw token amount to the token class's decimal precision.
Parameters
▪ amount: string | BigNumber
The token amount as a string or BigNumber.
▪ decimals: number
The number of decimals to round to (from token class).
▪ roundUp: boolean
Returns
A BigNumber rounded down to the specified decimals.