Coner
Coner

Reputation: 39

Contract is not an nft drop thirdweb

I am trying to use my contracts in my next application via thirdweb . However I am getting the error "Error: Contract is not a nft-drop". When I go to the thirdweb dashboard and copy and paste the exact same code, I still receive the error. How can I fix this?

code

import { useContract } from '@thirdweb-dev/react'

export default function Component() {
  const { contract } = useContract("<My contract address>", "nft-drop")

  // Now you can use the nft drop contract in the rest of the component
}

I an using the useContract hook from thirdweb react docs https://portal.thirdweb.com/sdk/interacting-with-contracts/nft-drop#getting-the-contract-in-your-application

however I still receive the error, how do I solve this?

Upvotes: 0

Views: 629

Answers (2)

Jarrod Watts
Jarrod Watts

Reputation: 465

If your smart contract is an NFT Drop deployed via the thirdweb dashboard, you might have configured the wrong chain ID in your ThirdwebProvider.

Your chain ID needs to be set to the network you deployed your smart contract to.

Upvotes: 0

Aldorax
Aldorax

Reputation: 1

Your error is quite easy to fix. Confirming that you are using NextJs and the nft drop contract.

What you want to do is

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

const Home: NextPage = () => {
  const {
    contract
  } = useContract("Put your nft drop contract here")
// You do not need to specify if it is an Nft drop contact the way you did. All you need to do is just paste in the Contract address and thirdweb does the rest
}

Now you can use Your Nft drop contracts.

Upvotes: 0

Related Questions