Skip to main content

index/functions/formatGalaForDTO.md

formatGalaForDTO(num): string

Format a GALA amount for DTO validation (8 decimal limit)

GALA tokens use 8 decimal places on GalaChain. Transactions with more than 8 decimals will fail, so this function enforces the limit.

Parameters​

ParameterTypeDescription
numstringGALA amount as string

Returns​

string

Formatted string with maximum 8 decimal places

Example​

formatGalaForDTO('100.123456789') // '100.12345679'
formatGalaForDTO('0.00000001') // '0.00000001'