next.jsthirdweb

Error: call revert exception Thirdweb NFT Drop


I am using Next.js, Thirdweb, VS Code, Sanity Studio

Snippet of my code:

const [claimedSupply, setClaimedSupply] = useState<number>(0)
const [totalSupply, setTotalSupply] = useState<BigNumber>()

const nftDrop = useNFTDrop(collection.address) < collection.address is correct
    
    
useEffect(() => {
   if(!nftDrop) return
    
   const fetchNFTDropData = async () => {
      const claimed = await nftDrop.getAllClaimed()
      const total = await nftDrop.totalSupply()
    
      setClaimedSupply(claimed.length)
      setTotalSupply(total)
   }
    
   fetchNFTDropData()
}, [nftDrop])

Full error: Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="nextTokenIdToClaim()", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.6.3)


Solution

  • That usually means that you're connected to the wrong network. Double check the RPC url / desiredChainId / connected wallet is pointing to the right network.