I'm trying to understand smart contract development by developing a nft minting contract.
It's going pretty well. I've made a contract that can mint nft's, and a test frontend where users can press a mint button, which calls a mint function in the contract. That all works well.
The trouble is that I want each token to link to a different json uri, and I need to create them (and upload them to ipfs) before the minting starts. The software I'm using is not capable of producing the images on-chain.
My question is this: What would be the best way to connect each token with each json file? It's not difficult for me to make a json file with an array of all the ipfs CID's, but I have a hard time figuring out how to get them "into the contract". If I send one of them (selected by mint total count) together with the mint() call from the frontend, I risk sending two identical CID's, before the token gets minted and mint count is updated. I don't think I should keep a list of all the CID's in the contract, that would take a lot of space. So what then? How do people normally solve this?
Thanks in advance