2

when ever i mint an nft with my frontend dapp and check it on opensea i will just see the name without the nft image. here is my deploy.js file. this is the tutorial i am following https://dev.to/rounakbanik/writing-an-nft-collectible-smart-contract-2nh8


async function main() {
    const baseTokenURI = "ipfs://QmfQHRsTrFN9tHVjsZ3aM2L225aUxk73LX2fFFa2GEPZ9y/";

    // Get owner/deployer's wallet address
    const [owner] = await hre.ethers.getSigners();

    // Get contract that we want to deploy
    const contractFactory = await hre.ethers.getContractFactory("AnezichukwuNFT");

    // Deploy contract with the correct constructor arguments
    const contract = await contractFactory.deploy(baseTokenURI);

    // Wait for this transaction to be mined
    await contract.deployed();

    // Get contract address
    console.log("Contract deployed to:", contract.address);

    // Reserve NFTs
    let txn = await contract.reserveNFTs();
    await txn.wait();
    console.log("5 NFTs have been reserved");

    // Mint 3 NFTs by sending 0.003 ether
    txn = await contract.mintNFTs(3, { value: utils.parseEther('0.003') });
    await txn.wait()

    // Get all token IDs of the owner
    let tokens = await contract.tokensOfOwner(owner.address)
    console.log("Owner has tokens: ", tokens);

}

main()
    .then(() => process.exit(0))
    .catch((error) => {
        console.error(error);
        process.exit(1);
    }); ```
1

1 Answer 1

3

In metadata, you gave image attribute the wrong value (x.png). If you want Opensea to find your image you should provide a public uri to your image as the value.

Usually you first upload the image to ipfs and then add the ipfs uri to the image tag like so "image": "ipfs://QmfQHRsTrFN9tHVjsZ3aM2L225aUxk73LX2xxxxxxxxxx"

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.