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.