igrc721_metadata.gno
1.66 Kb · 38 lines
1package grc721
2
3// IGRC721CollectionMetadata describes basic information about an NFT collection.
4type IGRC721CollectionMetadata interface {
5 Name() string // Name returns the name of the collection.
6 Symbol() string // Symbol returns the symbol of the collection.
7}
8
9// IGRC721Metadata follows the Ethereum standard
10type IGRC721Metadata interface {
11 IGRC721CollectionMetadata
12 TokenURI(tid TokenID) (string, error) // TokenURI returns the URI of a specific token.
13}
14
15// IGRC721MetadataOnchain follows the OpenSea metadata standard
16type IGRC721MetadataOnchain interface {
17 IGRC721CollectionMetadata
18 TokenMetadata(tid TokenID) (Metadata, error)
19}
20
21type Trait struct {
22 DisplayType string
23 TraitType string
24 Value string
25}
26
27// Metadata is stored fully on-chain; see: https://docs.opensea.io/docs/metadata-standards
28type Metadata struct {
29 Image string // URL, IPFS/Arweave path, or (commonly here) a data: URI holding the image itself.
30 ImageData string // Raw SVG image data, if generating images on the fly. Only used if Image is empty.
31 ExternalURL string // URL shown alongside the asset on marketplaces, linking back to the collection's own site.
32 Description string // Human-readable description of the item. Markdown is supported.
33 Name string // Name of the item.
34 Attributes []Trait // Attributes for the item, shown on marketplace pages for the item.
35 BackgroundColor string // Background color of the item on marketplaces. Six-character hex, no leading #.
36 AnimationURL string // URL/data URI to a multimedia attachment for the item.
37 YoutubeURL string // URL to a YouTube video (only used if AnimationURL is not provided).
38}