Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script to update JSON file with proper IPFS Data for images #7

Closed
stocktonellis opened this issue Nov 8, 2021 · 8 comments
Closed
Labels
issue Something that could be fixed. question Further information is requested

Comments

@stocktonellis
Copy link

Feature Request:

When deploying the NFT images and metadata to IPFS, it is necessary to first upload the images (and get a unique CID).
Then I need to update the JSON files to point at this CID. I can not create the CID in advance of running the generative script (index.py) as I do not have the CID until I upload the images.

Could a script be added to run after the index.py & once I get the CID to go through all files in the metadata folder and update the baseURI to represent the IPFS CID? (Or regenerate them based on all-object.json?) Obviously the data needs to maintain the connection to the image.

@Jon-Becker
Copy link
Owner

Jon-Becker commented Nov 8, 2021

Can you upload the entire folder to IPFS, and your contract URI iterate over the IPFS folder? (I.E: ipfs://folderCID/metadata/1.json && ipfs://folderCID/images/1.png)

If not, ill add this tomorrow.

@Jon-Becker Jon-Becker added issue Something that could be fixed. question Further information is requested labels Nov 8, 2021
@stocktonellis
Copy link
Author

I tried as you suggested and the issue ends up that when ipfs://folderCID/metadata/1.json is called, it looks for the image at ./images/1.png (no actual reference to the containing folder).

I went through some other projects and infact - the CID of the images and of the json are setup to be different (where the smart contract URI only references the JSON and the connection to the image is wholly contained in the JSON file.

@Jon-Becker
Copy link
Owner

Does changing the baseURI in generator config to "" fix it?

Either way, i'll post a patch 1.0.2 tomorrow. Thank you!

@stocktonellis
Copy link
Author

I'm not sure, but as far as I can tell - it's a two step process. Appreciate it!

(and I'm sure this belongs in a separate issue but you might consider adding "description" to the metadata as well. That seems to be a needed/popular attribute that is missing).

Jon-Becker added a commit that referenced this issue Nov 8, 2021
+ Allows for quick metadata updating after obtaining IPFS /images/ CID. (OPTIONAL)
+ Adds support for "description" metadata.
@Jon-Becker
Copy link
Owner

Tomorrow became today, I hope that helps.

Let me know what you think!

@stocktonellis
Copy link
Author

Ok - that works perfectly! One thing that I noticed (not sure if this is new) is that now the .json files have leading zeros (as do the reference to images in the json.

For example:
So when I generate 100 NFTs, I get 001.json which references image 001.png but the actual image is just 1.png. (If I do 1000 nfts, I get 0001.json etc.)

@Jon-Becker
Copy link
Owner

Thanks, i'll fix padding the file names today.

Jon-Becker added a commit that referenced this issue Nov 8, 2021
+ Updated readme & configuration documentation to support v1.0.1 & v1.0.2
- Remove padding from file names, restrict it to token name only.
@sriharsh1104
Copy link

Feature Request:

When deploying the NFT images and metadata to IPFS, it is necessary to first upload the images (and get a unique CID).
Then I need to update the JSON files to point at this CID. I can not create the CID in advance of running the generative script (index.py) as I do not have the CID until I upload the images.

Could a script be added to run after the index.py & once I get the CID to go through all files in the metadata folder and update the baseURI to represent the IPFS CID? (Or regenerate them based on all-object.json?) Obviously the data needs to maintain the connection to the image. is these feature possible if yes than can you share a video reference or doc for the same .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Something that could be fixed. question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants