Skip to content

Commit

Permalink
update serialization serialized json data prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Mar 26, 2024
1 parent 8e4dcaf commit 7fc45d0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cadence/contracts/bridge/FlowEVMBridge.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -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("}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion cadence/contracts/utils/SerializeNFT.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -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!)
}
Expand Down
2 changes: 1 addition & 1 deletion cadence/tests/serialize_nft_tests.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -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("\"}")

Expand Down

0 comments on commit 7fc45d0

Please sign in to comment.