estimateGasLimit method

Future<int> estimateGasLimit({
  1. required String sender,
  2. required String recipient,
  3. Uint8List? data,
  4. BigInt? value,
  5. BigInt? gasPrice,
})

Implementation

Future<int> estimateGasLimit({
  required String sender,
  required String recipient,
  Uint8List? data,
  BigInt? value,
  BigInt? gasPrice,
}) async {
  final dataHex = data != null ? "0x${data.toHex}" : null;

  return await performTask(
    (client) => client
        .estimateGasLimit(
          from: sender,
          to: recipient,
          data: dataHex,
          amount: value,
          gasPrice: gasPrice,
        )
        .then(
          (value) => value.toInt(),
        ),
  );
}