estimatedFeeWithBurnTax method

Future<Fee> estimatedFeeWithBurnTax(
  1. double txAmount,
  2. CreateTxOptions options
)

Implementation

Future<Fee> estimatedFeeWithBurnTax(
    double txAmount, CreateTxOptions options) async {
  var feeDenom = options.feeDenom ?? CoinDenoms.UUSD;

  var gasAdjs = options.gasAdjustment ??
      TerraClientConfiguration.lcdConfig!.gasAdjustment;
  var burnTax = await treasury!.getTaxRate();
  var taxCap = await treasury!.getTaxCap(feeDenom);

  var gasLimit = await treasury!.getGasPriceForDenom(feeDenom);
  var gas = options.gas;

  var estimatedGas = (gas! * gasAdjs!);
  var totalGas = estimatedGas * gasLimit;
  var taxTotal = min((txAmount * burnTax), taxCap);

  var totalFeeWithBurnTax = (taxTotal + totalGas).roundToDouble();

  return Fee(gas, [Coin(feeDenom, totalFeeWithBurnTax)]);
}