I trying to connect my dApp with MetaMask and WalletConnect using Moralis and i have some problem with WalletConnect. There are no problems with the connection itself but, i cant do anything with smart Contract.
In some reason i get this error:
Returned values aren’t valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced. The method doesn’t need Gas, because it’s call method and i double checked that ABI is correct for the contract.
const connectionHandler = async str => {
if(str === "MetaMask"){
dispatch(toggleConnection("MetaMask"))
await authenticate()
}
else{
dispatch(toggleConnection("WalletConnect"))
await authenticate({ provider: "walletconnect" })
}
}
export const checkBalance = async (address, Moralis, connection) => {
// debugger
if(address){
try{
const Contract = await giveMeContract(Moralis, connection)
const weiBalance = await Contract.methods.balanceOf(address).call()
const balance = parseInt(Web3.utils.fromWei(weiBalance, 'ether'));
store.dispatch(updateBalance(balance))
return balance
}
catch(error){
console.log(error)
}
}
}