0

I was trying to use eth_estimateGas but It throws execution reverted, The error doesn't indicate anything. This is my code :

    final gas = await _web3Client.estimateGas(
      sender: sender,
      to: toAddress,
      data: data,
      maxFeePerGas: maxFeePerGas,
      maxPriorityFeePerGas: maxPriorityFeePerGas,
      value: value,
    );

1 Answer 1

1

After googling for a while, I solved the error by removing the value property, I don't know why It threw an error, but I think, Since my case was a erc20 token transfer and has value in data, That might be the reason. So the final code would look like this :

      final transaction = Transaction(
        to: toAddress,
        from: fromAddress,
        maxFeePerGas: maxFeePerGas,
        maxPriorityFeePerGas: Config.maxPriorityFeePerGas,
        data: data,
      );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.