Open nvdtf opened 1 year ago
Most catalog scripts rely on temporary linking to return data (like this):
let tempPathStr = "catalog".concat(key) let tempPublicPath = PublicPath(identifier: tempPathStr)! account.link<&{MetadataViews.ResolverCollection}>( tempPublicPath, target: value.collectionData.storagePath )
This leads to errors if the key contains characters like '. This is now true on mainnet catalog.
key
'
As a workaround we can hash the key instead, but the downside is more computation:
pub fun cleanStringForPath(_ input: String): String { return "catalog".concat(String.encodeHex(HashAlgorithm.SHA3_256.hash(input.utf8))) } let tempPublicPath = PublicPath(identifier: cleanStringForPath(key))!
I like this! Something we can implement
Most catalog scripts rely on temporary linking to return data (like this):
This leads to errors if the
key
contains characters like'
. This is now true on mainnet catalog.As a workaround we can hash the key instead, but the downside is more computation: