Attempting to create an NFT that derives it's image fully on-chain from tokens that it holds in a 6551 TBA.
Current state of the art for showing the contents of a 6551 is to use animation_url
to return an iframe that is responsible for polling the contents of the TBA. An example can be found here. Perhaps a more elegant solution would be for the base NFT to derive it's image entirely on-chain depending on the NFTs that are in the TBA associated with the base NFT.
This repo is an attempt at doing just that. It takes inspiration from Loot
The base NFT contract. This is the primary NFT that renders it's children. It is originally blank, but as sub NFTs are sent to the TBA for the base NFT, each sub NFT renders on the base NFT. Since this is inspired by Loot, we can image the base NFT as an empty character, and the sub NFTs are traits that the character collects. As the character collects the traits, they render on the character (in the form of white text on a black background)
The sub NFT contract. Following the Loot example, these are the traits that render on the base NFT. These NFTs have their own image property so they render on their own. These NFTs must exist in the TBA of a given base NFT to show up on the base NFT.
Storage for the trait details.
Storage for SVG details.
Storage for "empty" SVG