-
Hi, I have a smart contract that has some custom errors :
I'm using ethers 5.6.9 umd. I'm aware of this article : https://blog.ricmoo.com/highlights-ethers-js-may-2021-2826e858277d The problem is that whenever a transaction fails in pre-check, it gives me an error like this :
It doesn't look like I can discern the actual reason it's failing from this. If instead of using custom errors I switch to using string-based revert statement, I do get the correct error messages. Anything I'm doing wrong? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
That is a gas estimation error, which means the transaction is not calling a constant method. Only methods called using Let me know if that works. :) |
Beta Was this translation helpful? Give feedback.
-
@Mudloop
|
Beta Was this translation helpful? Give feedback.
That is a gas estimation error, which means the transaction is not calling a constant method. Only methods called using
call
can receive custom errors. If you would like to preflight a state-mutating method, you can use thecontract.callStatic.METHOD_NAME(params)
which will force using call, which on error will throw the custom error.Let me know if that works. :)