Smart contract calling is not working with BrowserProvider #4067
-
Dear everybody!
When I am calling smart contract, if I use BrowserProvider, it's not working. ethers: 6.4.0 Please help me in this. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
This often happens when the injected provider is not on the same network. If the contract is deployed on mainnet and MetaMask is connected to Görli, then when using the BrowserProvider, you are communicating with Görli, which will return Your error indicates the result from sending the request to the contract was |
Beta Was this translation helpful? Give feedback.
-
` const USDTAbi = [ const getBalance = async () => {
};`. This is my error. Error: could not decode result data (value="0x", info={ "method": "balanceOf", "signature": "balanceOf(address)" }, code=BAD_DATA, version=6.11.1) |
Beta Was this translation helpful? Give feedback.
This often happens when the injected provider is not on the same network. If the contract is deployed on mainnet and MetaMask is connected to Görli, then when using the BrowserProvider, you are communicating with Görli, which will return
0x
as the contract doesn’t live there.Your error indicates the result from sending the request to the contract was
0x
, so that’s my first guess…