Thirdweb - react - mumbai - contract connection not working

50 Views Asked by At

I am using thirdweb react component. Everything worked just fine a month ago. I uploaded a new contract and imported it to the thirdweb dashboard and now I cant fetch any contract details using thirdweb on the new contract - the old is still working (It is basically the same contract). I am using mumbai, paris evm version, 200 runs optimalisation for them both.

I uploaded the old contract again as a test, and it did not fetch any data. What has changed? I think the thirdweb connection interface is wrong or has changed?

It is the same jsx code. The first contract 0xcA8dEbE74E7c0630D61a08c913b795622Fa89daF is still working, the new contract is not 0xEa7aca3183629F5fa5d754Ac12777e67Bec08540.

There is no problems with the contract it self.

CODE:

`import { ThirdwebProvider } from "@thirdweb-dev/react";

ReactDOM.createRoot(document.getElementById("root")).render(
  <React.StrictMode>
    <ThirdwebProvider activeChain="mumbai"> 
      <App />
    </ThirdwebProvider>
  </React.StrictMode>
);



import { useContract } from "@thirdweb-dev/react";

import { useAddress } from "@thirdweb-dev/react";
import { Web3Button } from "@thirdweb-dev/react";

const App = () => {
  const contractAddress = '0xEa7aca3183629F5fa5d754Ac12777e67Bec08540'
  //Create contract
  const { contract } = useContract(contractAddress);

  //User address and signer
  const address = useAddress();


  const fetchData = async () => {
    try {
  
      //Fetch address info
      if (address) {
        const addrBalance = await contract.call("balanceOf", [address]);
        const addrBalanceOnChain = await contract.call("myBankBalance", [address]);

        setAddressBalance(addrBalance / 10**18);
        setAddressBalanceOnChain(addrBalanceOnChain / 10**18)
      }

.....`
0

There are 0 best solutions below