PatrickAlphaC / hardhat-nft-marketplace-fcc

114 stars 97 forks source link

Can't mint on Goerli network #21

Open kadiemq opened 2 years ago

kadiemq commented 2 years ago

Here is MintAndListen script:

import { ethers } from "hardhat";
import { NFTMarketPlace } from "../typechain-types";
import { BasicNft } from "../typechain-types/contracts/test";

async function MintAndList() {
    const NFTMarketplace: NFTMarketPlace = await ethers.getContract(
        "NFTMarketPlace"
    );
    const BasicNFT: BasicNft = await ethers.getContract("BasicNft");
    const price = ethers.utils.parseEther("0.1");

    console.log("minting....");
    const mintTx = await BasicNFT.mintNft();
    const mintReciept = await mintTx.wait(1);

    console.log("approving....");
    const tokenId = mintReciept.events![0].args!.tokenId;
    const approveTx = await BasicNFT.approve(NFTMarketplace.address, tokenId);
    await approveTx.wait(1);

    console.log("listing....");
    const listTx = await NFTMarketplace.listItem(
        BasicNFT.address,
        tokenId,
        price
    );
    await listTx.wait(1);
    console.log("done");
}

MintAndList()
    .then(() => process.exit(0))
    .catch((e) => {
        console.log(e);
        process.exit(1);
    });

I'm stuck at minting.... here is the address for the BasicNFT contract https://goerli.etherscan.io/address/0x77F7dbCf23f8Bb05A22F70615F61FdBF47382017 I've tried using hardhat localhost and it's working fine.