Skip to content

Commit

Permalink
update ExampleNFT Traits for serialization testability
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Mar 18, 2024
1 parent 40fa6ee commit b4ae500
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions cadence/contracts/example-assets/ExampleNFT.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ access(all) contract ExampleNFT: NonFungibleToken {
let excludedTraits = ["mintedTime", "foo"]
let traitsView = MetadataViews.dictToTraits(dict: self.metadata, excludedNames: excludedTraits)

// mintedTime is a unix timestamp, we should mark it with a displayType so platforms know how to show it.
let mintedTimeTrait = MetadataViews.Trait(name: "mintedTime", value: self.metadata["mintedTime"]!, displayType: "Date", rarity: nil)
traitsView.addTrait(mintedTimeTrait)

// foo is a trait with its own rarity
let fooTraitRarity = MetadataViews.Rarity(score: 10.0, max: 100.0, description: "Common")
let fooTrait = MetadataViews.Trait(name: "foo", value: self.metadata["foo"], displayType: nil, rarity: fooTraitRarity)
Expand Down

0 comments on commit b4ae500

Please sign in to comment.