Can't use `str` storage variable or in StorageMap

Hey everyone
I was developing smart contracts in sway last week and I faced a big blocker because I wanted to declare str storage variable. , the compiler throw this error

str or a type containing str on configurables is not allowed. 

I tried to use str[] and it works.
Also I needed to declare StorageMaps that has str as key or value. The workaround to use str[] is not working in StorageMap as well
example

Someone opened an issue for the same problem in github , check it

1 Like

As you note this is a known issue. We’re currently looking to address this and have planned an overhaul of both strings and the storage API in the near future.

In the meantime, you ought to use StorageString instead of raw strings in storage types.

2 Likes