I found that the result of estimate gas is not accurate when I make cross-contract call in my contract. As a result, transactions alwalys fail due to out of gas.

This is my code to estimate gas:

 const gas = await targetContract.methods[methodName].apply(null, arguments).estimateGas({from: account});
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Apr 27, 2023 at 11:25

1 Answer 1



import { decodeContractErrorData } from 'web3-eth-abi';
decodeContractErrorData(myContract._errorsInterface, e.innerError);

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.