5

I have a problem with a simple nft program i did in order to learn more about ERC721.

this is the code:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract JonaNFT is ERC721URIStorage {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;
    uint256 private nftLimit = 4;

    constructor() ERC721("JonaNFT", "JNA") {}

    function mintJonaNft(string memory tokenURI) public returns (uint256) {
        require(_tokenIds.current() < 4, "All NFT minted");
        uint256 newItemId = _tokenIds.current();
        _mint(msg.sender, newItemId);
        _setTokenURI(newItemId, tokenURI);
        _tokenIds.increment();
        return newItemId;
    }
}

I have the same problem for all 4 nfts: if i go to opensea i am not able to see the metadata even if i try to refresh it!

In my python testing program

def printNftInfo(tokenId):
    print(JonaNFT[-1].ownerOf(tokenId))
    print(JonaNFT[-1].tokenURI(tokenId))


def main():
    # deploy()
    # createAllNft()
    # createSingeNft(0)
    printNftInfo(0)

I can retrieve the uri of the nft of index 0 which is "https://gateway.pinata.cloud/ipfs/QmSFR5s4Gt8Njp6kLD1ifSjTWgzWSLaruyqdwfkD3x8vBR". Do you see anythging wrong with the formatting?

Thank you and cheers from Italy.

1 Answer 1

0

Your data seems to be valid.

If you are using Opensea's testnet the issue might be with the page not your data at all. Opensea often takes a lot of time to parse your data, even if you refresh it. I would therefore advise you to use Looksrare instead: https://goerli.looksrare.org/

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.