format_amount_with_decimals

Creates a readable string representing the amount of tokens, given the raw representation of its amount and the decimals.

For example, format_amount_with_decimals(11, 2) will return "0.11"

Throws "INVALID DECIMALS" if decimals is negative.

Parameters

amount

the value to be formatted

decimals

the amount of decimals for the given token