Skip to content

Commit

Permalink
update displayType trait serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Oct 22, 2024
1 parent b441888 commit ec9fa3a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cadence/contracts/utils/SerializeMetadata.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,13 @@ access(all) contract SerializeMetadata {
continue
}
serializedResult = serializedResult.concat("{")
.concat("\"trait_type\": ").concat(Serialize.tryToJSONString(trait.name)!)
.concat(", \"display_type\": ").concat(Serialize.tryToJSONString(trait.displayType)!)
.concat(", \"value\": ").concat(value!)
.concat("}")
.concat("\"trait_type\": ").concat(Serialize.tryToJSONString(trait.name)!)
if trait.displayType != nil {
serializedResult = serializedResult.concat(", \"display_type\": ")
.concat(Serialize.tryToJSONString(trait.displayType)!)
}
serializedResult = serializedResult.concat(", \"value\": ").concat(value!)
.concat("}")
if i < traits!.traits.length - 1 {
serializedResult = serializedResult.concat(",")
}
Expand Down

0 comments on commit ec9fa3a

Please sign in to comment.