From 7fc45d0028685af532e943fea87803502685b38e Mon Sep 17 00:00:00 2001 From: Giovanni Sanchez <108043524+sisyphusSmiling@users.noreply.github.com> Date: Wed, 20 Mar 2024 12:04:58 -0500 Subject: [PATCH] update serialization serialized json data prefix --- cadence/contracts/bridge/FlowEVMBridge.cdc | 2 +- cadence/contracts/utils/SerializeNFT.cdc | 2 +- cadence/tests/serialize_nft_tests.cdc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cadence/contracts/bridge/FlowEVMBridge.cdc b/cadence/contracts/bridge/FlowEVMBridge.cdc index 2b22f681..48608972 100644 --- a/cadence/contracts/bridge/FlowEVMBridge.cdc +++ b/cadence/contracts/bridge/FlowEVMBridge.cdc @@ -434,7 +434,7 @@ contract FlowEVMBridge : IFlowEVMNFTBridge { ) as! MetadataViews.NFTCollectionDisplay? { name = collectionDisplay.name let serializedDisplay = SerializeNFT.serializeFromDisplays(nftDisplay: nil, collectionDisplay: collectionDisplay)! - contractURI = "data:application/json;ascii,{".concat(serializedDisplay).concat("}") + contractURI = "data:application/json;utf8,{".concat(serializedDisplay).concat("}") } } diff --git a/cadence/contracts/utils/SerializeNFT.cdc b/cadence/contracts/utils/SerializeNFT.cdc index c8a97501..42cd631e 100644 --- a/cadence/contracts/utils/SerializeNFT.cdc +++ b/cadence/contracts/utils/SerializeNFT.cdc @@ -41,7 +41,7 @@ access(all) contract SerializeNFT { return "" } // Init the data format prefix & concatenate the serialized display & attributes - var serializedMetadata = "data:application/json;ascii,{" + var serializedMetadata = "data:application/json;utf8,{" if display != nil { serializedMetadata = serializedMetadata.concat(display!) } diff --git a/cadence/tests/serialize_nft_tests.cdc b/cadence/tests/serialize_nft_tests.cdc index efd97991..ef0e1bbc 100644 --- a/cadence/tests/serialize_nft_tests.cdc +++ b/cadence/tests/serialize_nft_tests.cdc @@ -91,7 +91,7 @@ fun testSerializeNFTSucceeds() { mintedBlockHeight = heightResult.returnValue! as! UInt64 let heightString = mintedBlockHeight.toString() - let expectedPrefix = "data:application/json;ascii,{\"name\": \"ExampleNFT\", \"description\": \"Example NFT Collection\", \"image\": \"https://flow.com/examplenft.jpg\", \"external_url\": \"https://example-nft.onflow.org\", " + let expectedPrefix = "data:application/json;utf8,{\"name\": \"ExampleNFT\", \"description\": \"Example NFT Collection\", \"image\": \"https://flow.com/examplenft.jpg\", \"external_url\": \"https://example-nft.onflow.org\", " let altSuffix1 = "\"attributes\": [{\"trait_type\": \"mintedBlock\", \"value\": \"".concat(heightString).concat("\"},{\"trait_type\": \"foo\", \"value\": \"nil\"}]}") let altSuffix2 = "\"attributes\": [{\"trait_type\": \"foo\", \"value\": \"nil\"}]}, {\"trait_type\": \"mintedBlock\", \"value\": \"".concat(heightString).concat("\"}")