Signed transaction fails to send via MetaMask
See original GitHub issueI am able to use ethers to read information from a deployed contract via the MetaMask provider (with a contract object created using the Signer object via provider with new ethers.providers.Web3Provider(window.ethereum)
after connecting Metamask, so it should have write permissions), however for sending eth to that contract (or just sending eth to a regular account) MetaMask does not prompt the user for confirmation – it simply throws the following error:
{
"code": -32016,
"message": "The execution failed due to an exception.",
"data": "Reverted"
}
I am able to successfully send eth to the contract via the web3 provider directly, but it’s nicer to do it from the contract object from ethers.js. What could be the issue? I am certain that web3 and metamask are working correctly, the error only happens when trying to call the contract function directly from the ethers contract object.
Also tried running unit tests on the same code used via Metamask (the contract calling function), but via Hardhat, and it passes – so the issue must be somewhere between ethers and metamask?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
This must have been some error with my MetaMask client. I was able to get it working from a minimal example yesterday, and now the error is gone from the main project. Oh well. Thanks for responding!
This is happening to me! Do you have any idea how you fixed it?