From ec9fa3aea733fbf25bd139769aea412552ee77fb Mon Sep 17 00:00:00 2001 From: Giovanni Sanchez <108043524+sisyphusSmiling@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:58:01 -0600 Subject: [PATCH] update displayType trait serialization --- cadence/contracts/utils/SerializeMetadata.cdc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cadence/contracts/utils/SerializeMetadata.cdc b/cadence/contracts/utils/SerializeMetadata.cdc index 3f3911df..f2013ea0 100644 --- a/cadence/contracts/utils/SerializeMetadata.cdc +++ b/cadence/contracts/utils/SerializeMetadata.cdc @@ -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(",") }