getGasPrice function

Future<int> getGasPrice(
  1. num multiplier,
  2. Web3Client web3client
)

Get current average gas price from the last ethereum blocks and multiply it @param {Number} multiplier - multiply the average gas price by this parameter @param {Web3Client} web3Client - Network url (i.e, http://localhost:8545). Optional @returns {Future

Implementation

Future<int> getGasPrice(num multiplier, Web3Client web3client) async {
  EtherAmount strAvgGas = await web3client.getGasPrice();
  BigInt avgGas = strAvgGas.getInWei;
  BigInt res = avgGas * BigInt.from(multiplier);
  int retValue = res.toInt();
  return retValue;
}