calculateTransactionFee static method

Future<BigInt> calculateTransactionFee(
  1. int transactionSize,
  2. BigInt suggestedFeePerByte
)

Calculate the total fee for a transaction. This value is multiplied by the estimated size of the transaction in bytes to determine the total transaction fee.

If the result is less than the minimum fee, the minimum fee is used instead.

Implementation

static Future<BigInt> calculateTransactionFee(
    int transactionSize, BigInt suggestedFeePerByte) async {
  var transactionFee = suggestedFeePerByte * BigInt.from(transactionSize);

  // Check min fee
  if (transactionFee < RawTransaction.MIN_TX_FEE_UALGOS) {
    transactionFee = RawTransaction.MIN_TX_FEE_UALGOS;
  }

  return transactionFee;
}