Metadata
Index
Constructors
constructor
Creates a new Metadata instance.
Parameters
params: { banner?: string; description?: string; image: string; name: string; plugins?: MetadataPlugin[] }
The parameters for the metadata, including name, image, description, banner, and plugins.
optionalbanner: string
optionaldescription: string
image: string
name: string
optionalplugins: MetadataPlugin[]
Returns Metadata
Properties
optionalbanner
Optional banner image for the NFT.
optionaldescription
Optional description of the NFT.
image
The image associated with the NFT.
readonlymap
The underlying map storing the metadata key-value pairs.
readonlyname
The name of the NFT.
plugins
Array of metadata plugins used for custom traits.
traits
Object containing the traits of the NFT.
Type declaration
[key string]: { isPrivate: boolean; type: string; value: string | Field | Metadata | MetadataTree | unknown }
Methods
addTrait
Adds a trait to the metadata.
Parameters
params: { isPrivate?: boolean; key: string; type: string; value: unknown }
The parameters including key, type, value, and isPrivate.
optionalisPrivate: boolean
key: string
type: string
value: unknown
Returns { key: Field; value: MetadataValue }
An object containing the key and the metadata value.
key: Field
value: MetadataValue
toJSON
Converts the metadata to a JSON representation.
Parameters
includePrivateTraits: boolean = false
Whether to include private traits.
Returns { banner?: string; description?: string; image: string; metadataRoot: string; name: string; traits: { isPrivate?: boolean; key: string; type: string; value: string | object }[] }
The JSON representation of the metadata.
optionalbanner?: string
optionaldescription?: string
image: string
metadataRoot: string
name: string
traits: { isPrivate?: boolean; key: string; type: string; value: string | object }[]
staticfromJSON
Constructs a Metadata instance from JSON data.
Parameters
params: { checkRoot?: boolean; json: { banner?: string; description?: string; image: string; metadataRoot: string; name: string; traits: { isPrivate?: boolean; key: string; type: string; value: string | object }[] }; plugins?: MetadataPlugin[] }
The parameters including json data, checkRoot flag, and plugins.
optionalcheckRoot: boolean
json: { banner?: string; description?: string; image: string; metadataRoot: string; name: string; traits: { isPrivate?: boolean; key: string; type: string; value: string | object }[] }
optionalplugins: MetadataPlugin[]
Returns Metadata
A new Metadata instance.
Represents the metadata for an NFT, including traits and associated data.