Replies: 3 comments 6 replies
-
Important topic indeed. I'm moving this onto github discussions since I believe this should be implemented at the Cairo level, but keeping the discussion open because I think gathering design input on feature requirements is still valuable. |
Beta Was this translation helpful? Give feedback.
-
Support for short strings was added in the latest cairo version (v0.5.0) - https://www.cairo-lang.org/docs/how_cairo_works/consts.html#short-string-literals A wrapper lib that uses arrays to represent longer strings might work as a near-term solution. @fracek what do you mean by storage not supporting arrays? It is not supported natively as a storage_var, but you can use the lower level storage read/write functions to implement it. |
Beta Was this translation helpful? Give feedback.
-
Longer strings support is coming to Cairo soon. Will the contracts be updated to use it on erc721 |
Beta Was this translation helpful? Give feedback.
-
When discussing #9 we sort of ignored that implementing
tokenUri
requires a way to implement strings in Cairo. Strings are also used in ERC-20 (for the optional but so convenientsymbol
andname
methods) and we have seen projects using them to generate dynamic NFT images (returning the NFT as svg).In discord we mentioned that strings can be implemented by storing bytes in felts (251 bits or 31 bytes per felt). One issue is that, since StarkNet storage cannot store arrays, that's also the maximum string length that can be stored.
Beta Was this translation helpful? Give feedback.
All reactions