Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v0 source pure

Package metadata is a stackable GRC721 extension for EIP-721 tokenURI and OpenSea on-chain metadata. Writes are issue...

Overview

Package metadata is a stackable GRC721 extension for EIP-721 tokenURI and OpenSea on-chain metadata. Writes are issuer-only so a holder cannot rewrite metadata after acquisition.

Constants 2

Variables 1

Functions 1

func NewMetadata

1func NewMetadata(coreLedger *grc721.PrivateLedger) (*Metadata, *Ledger)
source

NewMetadata attaches a metadata extension and registers it as a core Extension. Attach it before the first mint so every token is indexed.

Types 4

type Data

struct
 1type Data struct {
 2	Image           string
 3	ImageData       string
 4	ExternalURL     string
 5	Description     string
 6	Name            string
 7	Attributes      []Trait
 8	BackgroundColor string
 9	AnimationURL    string
10	YoutubeURL      string
11}
source

Data is the OpenSea on-chain metadata for a single token.

type Ledger

struct
1type Ledger struct {
2	core *grc721.Token
3	st   *storage
4}
source

Methods on Ledger

func OnBurn

method on Ledger
1func (led *Ledger) OnBurn(tid grc721.TokenID)
source

OnBurn clears per-token state so it cannot resurface on re-mint.

func OnMint

method on Ledger
1func (led *Ledger) OnMint(to address, tid grc721.TokenID)
source

func OnTransfer

method on Ledger
1func (led *Ledger) OnTransfer(from, to address, tid grc721.TokenID)
source

func SetTokenMetadata

method on Ledger
1func (led *Ledger) SetTokenMetadata(tid grc721.TokenID, data Data) error
source

SetTokenMetadata sets the OpenSea on-chain metadata of tid; issuer-only.

func SetTokenURI

method on Ledger
1func (led *Ledger) SetTokenURI(tid grc721.TokenID, uri string) error
source

SetTokenURI sets the EIP-721 tokenURI of tid; issuer-only so a holder cannot rewrite the URI after acquisition.

type Metadata

struct
1type Metadata struct {
2	core *grc721.Token
3	st   *storage
4}
source

Methods on Metadata

func HasMetadata

method on Metadata
1func (m *Metadata) HasMetadata(tid grc721.TokenID) bool
source

func HasTokenURI

method on Metadata
1func (m *Metadata) HasTokenURI(tid grc721.TokenID) bool
source

func TokenID

method on Metadata
1func (m *Metadata) TokenID() string
source

func TokenMetadata

method on Metadata
1func (m *Metadata) TokenMetadata(tid grc721.TokenID) (Data, error)
source

func TokenURI

method on Metadata
1func (m *Metadata) TokenURI(tid grc721.TokenID) (string, error)
source

type Trait

struct
1type Trait struct {
2	DisplayType string
3	TraitType   string
4	Value       string
5}
source

Imports 4

Source Files 4