getFeeValue function

BigInt getFeeValue(
  1. num feeIndex,
  2. num amount
)

Compute fee in token value with an amount and a fee index @param {Number} feeIndex - Fee selected among 0 - 255 @param {Number} amount - The amount of the transaction as a Scalar @returns {BigInt} Resulting fee in token value

Implementation

BigInt getFeeValue(num feeIndex, num amount) {
  if (feeIndex < 192) {
    final fee = BigInt.from(amount * feeFactorsAsBigInts[feeIndex as int]);
    return fee >> bitsShiftPrecision;
  } else {
    return BigInt.from(amount * feeFactorsAsBigInts[feeIndex as int]);
  }
}