For example, I know the code below isn't valid syntax, but would doing something like it be possible to dynamically set metadata content based on the token id? If so, how would that work?
@sp.offchain_view(pure = True)
def token_metadata(self, tok):
sp.result(sp.pair(tok, sp.big_map({
"": sp.utils.bytes_of_string("ipfs://QmTwyN85GfziB5BGhF2ELogeJRt6CwevZY729bahQqKHiD/" + str(tok) + ".json"),
"name": sp.utils.bytes_of_string("TRR Token " + str(tok)),
"symbol": sp.utils.bytes_of_string("TRR"),
"decimals": sp.utils.bytes_of_string("0")
})))
When running the code above without the string concatenation, I'm getting this error for the metadata view:
(ERROR "Cannot compile missing type: a132") × <contract-storage> → (pair (ERROR "Cannot compile missing type: a132") (pair (nat %token_id) (map %token_info string bytes)))