FUNCTION

format_amount_with_decimals

function format_amount_with_decimals(amount: big_integer, decimals: integer): text

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
© 2024 Chromia