estimateGas method

Future<(BigInt, BigInt)> estimateGas(
  1. TransactionRequest transaction
)

Implementation

Future<(BigInt, BigInt)> estimateGas(TransactionRequest transaction) async {
  final txData = await simulateTransaction(
    transaction,
    estimateGasUnitPrice: true,
    estimateMaxGasAmount: true
  );
  final txInfo = txData[0];
  final gasUnitPrice = txInfo["gas_unit_price"].toString();
  final gasUsed = txInfo["gas_used"].toString();
  return (BigInt.parse(gasUnitPrice), BigInt.parse(gasUsed));
}