in this code when i want call the function from contract i get this error: Cannot read properties of undefined (reading 'getDefaultChain') i use walletConnect V2 for connecting wallet and use etherjs for connecting to contract
useEffect(() => {
const fetchPrecardId = async () => {
if (contract) {
try {
const preCardId = await contract.functions.functionName();
setPreCardId(preCardId);
} catch (error) {
console.log(`error: ${error}`);
}
} else {
console.log("Contract object is undefined or null");
}
};
fetchPrecardId();
}, []);