You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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))!
The text was updated successfully, but these errors were encountered:
nvdtf
changed the title
Invalid character in dictionary key leads to broken scripts
Invalid character in catalog's main dictionary keys leads to broken scripts
Jan 2, 2023
nvdtf
changed the title
Invalid character in catalog's main dictionary keys leads to broken scripts
Invalid character in catalog's dictionary key leads to broken scripts
Jan 2, 2023
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:
The text was updated successfully, but these errors were encountered: