Display

How should platforms show this NFT?

The Display metadata view tells Flowty how to show an NFT. Display provides specifications for NFT cards, asset detail pages, and activity pages.

NFT cards make use of name and thumbnail from the Display view:

pub resource NFT: NonFungibleToken.INFT, MetadataViews.Resolver {
    // ...

    pub fun resolveView(_ view: Type): AnyStruct? {
        switch view {
            case Type<MetadataViews.Display>():
                return MetadataViews.Display(
                    name: "Avataaars #".concat(self.id.toString()),
                    description: "This is a procedurally generated avatar! You can learn more about it here: https://avataaars.com/",
                    thumbnail: MetadataViews.HTTPFile(
                        url: Avataaars.imageBaseURL.concat(self.id.toString())
                    )
                )
            // truncated other metadata views...
    
        }
        return nil
    }
    
    // ...
}

Last updated