I made a basic NFT mint contract with OpenZeppelin imports. Once an NFT is minted, I want as contract owner a method to change the IPFS URI per individual NFT, so I can change the Image link and metadata for that specific NFT.
I can do it for all NFTs, just by changing baseUri (override function tokenURI), but don't know how to do it for individual NFTs.
Related code from my contract:
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0
? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension))
: "";
}
function _baseURI() internal view virtual override returns (string memory) {
return baseUri;
}