How to specify a gas limit for web3.js transactions?

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.

contract.methods.functionThatReverts(web3.utils.toWei((100000).toString(), ‘ether’)).send({from: accounts[0], gas:130000})

Hi Hannah, thanks for the reply. Would you mind going into a little more detail about what you mean by ‘upgrading the wallet in layer2’?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.