estimateGasForTx method

Future<double> estimateGasForTx(
  1. double txAmount,
  2. List messages, {
  3. double gasAdjustment = 3,
  4. String coinTypeForGas = CoinDenoms.ULUNA,
})

Implementation

Future<double> estimateGasForTx(double txAmount, List<dynamic> messages,
    {double gasAdjustment = 3,
    String coinTypeForGas = CoinDenoms.ULUNA}) async {
  var walletOptions = await getWalletOptions();

  var gasLimit = await _lcd.treasury.getGasPriceForDenom(coinTypeForGas);

  var signedTx = await key.signTx(
      Core.Tx(
          TxBody(null, "Running Gas Estimation", 0),
          AuthInfo(
              [],
              Fee(gasLimit, [Coin(coinTypeForGas, txAmount)],
                  granter: accAddress)),
          []),
      walletOptions,
      messages);

  return await broadcastTx.estimateGas(signedTx, gasAdjustment, messages);
}