0

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});
1
  • 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

0

https://blog.emn178.cc/en/post/using-web3-js-to-parse-custom-error/

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.