formatUnits(value)

Feature

Converts integer string value into a "decimal string", assuming decimal places. The decimal number can be set with setDecimal() and the default value is 9.

Parameters

string value

Return Value

object operation for creating new currency

example

// Example: Convert PAGE to FACT (decimal: 9)
const value = "20000000000"; //PAGE
const result = mitum.utils.formatUnits(value);
console.log(`PAGE to FACT: ${result}`); // "20.0"

//output
PAGE to FACT: 20.0

Last updated