Help us shape the future of Go! Take the 2026 Go Developer Survey

erc721metadata

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2020 License: MIT Imports: 6 Imported by: 0

README

CircleCI

erc721metadata

erc721metadata is ERC721 tokenURI metadata JSON library implementation by Go.

Support

  • name, description and image defined by EIP-721 and EIP-1047.
  • Enhancements metadata attributes PR by EIPs#1071.
  • OpenSea metadata external_url and background_color defined by OpenSea metadata.
  • OpenSea type attrubutes. trait_type, value, display_type and max_value OpenSea metadata.
  • Rare Bits metadata image_url, home_url, tags and properties defined by Rare Bits.
  • Some wallet depvelopers require timestamp and language.
  • extra_data NFT's specific data which can't compare with other NFTs defined here.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ERC721Metadata

type ERC721Metadata struct {
	// ERC721 EIP1047
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Image       string `json:"image,omitempty"`

	// Extra
	Timestamp int64  `json:"timestamp,omitempty"`
	Language  string `json:"language,omitempty"`

	// OpenSea
	Attributes      *json.RawMessage `json:"attributes,omitempty"` // EIPs#1071
	ExternalURL     string           `json:"external_url,omitempty"`
	BackgroundColor string           `json:"background_color,omitempty"`
	AnimationURL    string           `json:"animation_url,omitempty"`
	YoutubeURL      string           `json:"youtube_url,omitempty"`

	// Rare Bits
	ImageURL   string              `json:"image_url,omitempty"`
	HomeURL    string              `json:"home_url,omitempty"`
	Tags       []string            `json:"tags,omitempty"`
	Properties []*RareBitsProperty `json:"properties,omitempty"`

	// MCH
	ExtraData map[string]interface{} `json:"extra_data,omitempty"`
}

ERC721Metadata is ERC721 Metadata JSON

func FetchERC721Metadata

func FetchERC721Metadata(tokenURI string) (*ERC721Metadata, error)

FetchERC721Metadata returns *ERC721Metadata fetch Metadata from tokenURI

func FetchERC721MetadataWithContext added in v0.1.2

func FetchERC721MetadataWithContext(ctx context.Context, tokenURI string) (*ERC721Metadata, error)

FetchERC721MetadataWithContext returns *ERC721Metadata fetch Metadata from tokenURI with Context

func NewERC721Metadata

func NewERC721Metadata() (*ERC721Metadata, error)

NewERC721Metadata returns *NewERC721Metadata

func UnmarshalERC721Metadata

func UnmarshalERC721Metadata(data []byte) (*ERC721Metadata, error)

UnmarshalERC721Metadata unmarshals ERC721Metadata

func (*ERC721Metadata) Marshal

func (e *ERC721Metadata) Marshal() ([]byte, error)

Marshal marshals ERC721Metadata

func (*ERC721Metadata) SetAttributes

func (e *ERC721Metadata) SetAttributes(attributes interface{}) error

SetAttributes convert to JSON.RawMessage and set to Attributes

type OpenSeaAttributes

type OpenSeaAttributes struct {
	TraitType   string      `json:"trait_type"`
	Value       interface{} `json:"value"`
	DisplayType string      `json:"display_type,omitempty"`
	MaxValue    int64       `json:"max_value,omitempty"`
}

OpenSeaAttributes is attrebute object defined by OpenSea

type RareBitsProperty

type RareBitsProperty struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
	Type  string      `json:"type"`
}

RareBitsProperty is property object defined by RareBits

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL