estimateGasAmount method

Future<BigInt> estimateGasAmount(
  1. TransactionRequest transaction
)

Implementation

Future<BigInt> estimateGasAmount(TransactionRequest transaction) async {
  final txData = await simulateTransaction(transaction, estimateMaxGasAmount: true);
  final txInfo = txData[0];
  bool isSuccess = txInfo["success"];
  if (!isSuccess) throw Exception({txInfo["vm_status"]});
  final gasUsed = txInfo["gas_used"].toString();
  return BigInt.parse(gasUsed);
}