0

I'm running into some issues with metamask estimating the wrong amount of gas for a specific transaction for my Dapp. It needs around 130k gas to execute, but metamask (around 5% of the time) will set the gas limit to 50k, and I'll get the out of gas revert because of it.

Is there a way for me, in my web3.js code, to tell metamask 'you need 130k gas for this transaction', so i never get the revert?

I try this but metamask ignores it, seemingly.

await contract.methods.functionThatReverts(web3.utils.toWei((100000).toString(), 'ether')).send({from: accounts[0], gas:130000})
2
  • Please note that there's some confusion in the gas limit parameter: some libraries uses the gas label, others use the gasLimit label (the same label you can find for blocks). Have you tried gasLimit instead of gas? Commented Feb 2, 2022 at 23:30
  • @GiuseppeBertone I have tried gasLimit as well yeah, but it didn't work either unfortunately
    – Oblivion
    Commented Feb 3, 2022 at 0:22

0

Your Answer

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