0

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();
  }, []);
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.