getTokenAmountBigInt function

BigInt getTokenAmountBigInt(
  1. double amount,
  2. int decimals
)

Converts an amount in double with the appropriate decimals to a BigInt @param {double} amount - representing the amount as a double @param {int} decimals - Number of decimal points the amount has @returns {BigInt}

Implementation

BigInt getTokenAmountBigInt(double amount, int decimals) {
  double tokenAmount = amount * pow(10, decimals);
  return BigInt.from(tokenAmount);
}