getTokenAmountString function

String getTokenAmountString(
  1. String amountBigInt,
  2. int decimals
)

Converts an amount in BigInt and decimals to a String with correct decimal point placement

@param {String} amountBigInt - String representing the amount as a BigInt with no decimals @param {Number} decimals - Number of decimal points the amount actually has

@returns {String}

Implementation

String getTokenAmountString(String amountBigInt, int decimals) {
  return (BigInt.parse(amountBigInt) / BigInt.from(10).pow(decimals))
      .toStringAsFixed(decimals);
  //return ethers.utils.formatUnits(amountBigInt, decimals);
}