Skip to main content

Resource NFT


_14
resource NFT {
_14
_14
id: UInt64
_14
_14
name: String
_14
_14
description: String
_14
_14
thumbnail: String
_14
_14
royalties: [MetadataViews.Royalty]
_14
_14
metadata: {String: AnyStruct}
_14
}

The core resource that represents a Non Fungible Token. New instances will be created using the NFTMinter resource and stored in the Collection resource

Implemented Interfaces:

  • NonFungibleToken.INFT
  • MetadataViews.Resolver

Initializer


_10
func init(id UInt64, name String, description String, thumbnail String, royalties [MetadataViews.Royalty], metadata {String: AnyStruct})

Functions

fun getViews()


_10
func getViews(): [Type]

Function that returns all the Metadata Views implemented by a Non Fungible Token

developers to know which parameter to pass to the resolveView() method.

Returns: An array of Types defining the implemented views. This value will be used by


fun resolveView()


_10
func resolveView(_ Type): AnyStruct?

Function that resolves a metadata view for this token.

Parameters:

  • view : The Type of the desired view.

Returns: A structure representing the requested view.