-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support data URLs #2
Comments
I really appreciate you checking this out @fulldecent In regards to the data URLs - although generating metadata for ERC-721 was the driving use-case behind this library, it was made as a general-purpose library. Part of the reasoning for this is:
For these reasons, I have left it up to the client to decide how they will use the resulting JSON. I would love to hear your thoughts, though. |
Great, it's really nice to have general support. Perhaps something that might be in-scope for this project then is just to add an implementation note for people wanting to use this for ERC-721 metadata.
Here is a basic example NFT contract that implements Because I want to recommend this project and just don't want to see people make rookie mistakes on production contracts. |
That's a great idea. I can probably get something in there about that within the next week or so. Otherwise I'm happy to accept a PR as well. |
@fulldecent I've gone ahead and created a PR for this issue. If you have time to check it out, I would really appreciate your thoughts on it before merging in. |
For number 2:
P.S. if you have a preferred base64 approach you can mention that here. P.S. OnChain Monkey uses this approach for ERC-721 JSON unchain with Base64 encoding. |
Thanks for the feedback. I've gone ahead and pushed a change to the PR recommending the use of base64 encoding instead. I'm currently holding off on mentioning a recommended library for the time being as I am waiting on the base64 library to get added to the official OpenZeppelin utils library. Once that is in place, I'll be adding a note regarding it, though. |
Cool thank you |
As written, ERC-721 expects the tokenURI to return:
And it IS possible to encode a JSON file in a RFC 3986 URI using Data URLs (RFC 2397).
All you need to do is prepend this string to the JSON:
The text was updated successfully, but these errors were encountered: