PatrickAlphaC / all-on-chain-generated-nft

A repo for generating random NFTs with metadata 100% on chain!
MIT License
356 stars 150 forks source link

how would you add tokenURI attributes to your code here? #19

Closed MiguelBits closed 2 years ago

MiguelBits commented 2 years ago

For example add attribute -> eye : "green"

`function formatTokenURI(string memory imageURI) public pure returns (string memory) {
        return string(
                abi.encodePacked(
                    "data:application/json;base64,",
                    Base64.encode(
                        bytes(
                            abi.encodePacked(
                                '{"name":"',
                                "SVG NFT", // You can add whatever name here
                                '", "description":"An NFT based on SVG!", "attributes":"", "image":"',imageURI,'"}'
                            )
                        )
                    )
                )
            );
    }`
PatrickAlphaC commented 2 years ago

Put them in a list, you can see an example here:

https://github.com/PatrickAlphaC/dungeons-and-dragons-nft/blob/master/metadata/mainnet-chainlink-elf.json