Sorry if this is hella n00b, but I was wondering when overriding tokenURI you can just return a string containing all the metadata which is calculated dynamically on-chain, eliminating the need for hosted JSON files.
e.g.
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory newstring = string(abi.encodePacked("{ \"name\" :" , getname(tokenId), "}"));
return newstring;
}
Will marketplaces like Opensea only expect a URL which LINKS to the metadata? Why wouldn't they take the entirety of the data straight from output of the function?
This would eliminate the need for manually (or automatically) updating things like the stats of your NFT, etc. and everything would stay on chain. I'm sorry for the maybe n00b question, but I can't find any other posts that have tried this.
Any light on this subject would be much appreciated.