How could I detect this error when the metamask modal shows up and user clicks reject? I'm using ether.js and web3Modal.
1 Answer
Could you not use a try catch? Then in the catch you can watch for the 4001 which is specifically used for user requests denied.