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

erc721metadata

package module
v0.0.0-...-5dde77c Latest Latest
Warning

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

Go to latest
Published: May 8, 2019 License: MIT Imports: 2 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
  • 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"`

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

	// 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"`
	Timestamp int64                  `json:"timestamp"`
}

ERC721Metadata is ERC721 Metadata JSON

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) SetRawAttributes

func (e *ERC721Metadata) SetRawAttributes(attributes map[string]interface{}) error

SetRawAttributes 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