nftmeta

package module
v0.0.0-...-8939a77 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 5 Imported by: 0

README

go-nftmeta

Package nftmeta provides tool for working with NFT metadata, for the Go programming language.

Especially creating the NFT metadata JSON.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-nftmeta

GoDoc

Example

Here is an example:

import (
	"encoding/json"

	"github.com/reiver/go-nftmeta"
)

// ...

var metadata nftmeta.MetaData

metadata.SetExternalLink("http://example.com/token/123")
metadata.SetName("peanut-butter-jelly-time")
metadata.SetYouTubeURL("https://youtu.be/eRBOgtp0Hac")

metadata.AppendAttribute(  nftmeta.AttributeString("Bread 1", "Peanut Butter")  )
metadata.AppendAttribute(  nftmeta.AttributeString("Bread 2", "Jelly")  )

// ...

// 'writer' (below) could be http.ResponseWriter
err := json.NewEncoder(writer).Encode(metadata)

Import

To import package nftmeta use import code like the follownig:

import "github.com/reiver/go-nftmeta"

Installation

To install package nftmeta do the following:

GOPROXY=direct go get https://github.com/reiver/go-nftmeta

Author

Package nftmeta was written by Charles Iliya Krempeaux

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	// contains filtered or unexported fields
}

Attribute represents an 'attribute' in the "attributes" array of the NFT metadata JSON.

func AttributeBigFloat

func AttributeBigFloat(traitType string, value *big.Float) Attribute

func AttributeBigInt

func AttributeBigInt(traitType string, value *big.Int) Attribute

func AttributeInt64

func AttributeInt64(traitType string, value int64) Attribute

func AttributeString

func AttributeString(traitType string, value string) Attribute

func AttributeUint64

func AttributeUint64(traitType string, value uint64) Attribute

func TypedAttributeBigFloat

func TypedAttributeBigFloat(traitType string, value *big.Float, displayType string) Attribute

func TypedAttributeBigInt

func TypedAttributeBigInt(traitType string, value *big.Int, displayType string) Attribute

func TypedAttributeInt64

func TypedAttributeInt64(traitType string, value int64, displayType string) Attribute

func TypedAttributeString

func TypedAttributeString(traitType string, value string, displayType string) Attribute

func TypedAttributeUint64

func TypedAttributeUint64(traitType string, value uint64, displayType string) Attribute

func (Attribute) MarshalJSON

func (receiver Attribute) MarshalJSON() ([]byte, error)

type MetaData

type MetaData struct {
	// contains filtered or unexported fields
}

MetaData represents an NFT metadata.

func (*MetaData) AppendAttribute

func (receiver *MetaData) AppendAttribute(attribute Attribute)

func (MetaData) MarshalJSON

func (receiver MetaData) MarshalJSON() ([]byte, error)

func (*MetaData) SetAnimationURL

func (receiver *MetaData) SetAnimationURL(value string)

func (*MetaData) SetBackgroundColor

func (receiver *MetaData) SetBackgroundColor(value string)

func (*MetaData) SetDescription

func (receiver *MetaData) SetDescription(value string)
func (receiver *MetaData) SetExternalLink(value string)

func (*MetaData) SetImage

func (receiver *MetaData) SetImage(value string)

func (*MetaData) SetImageData

func (receiver *MetaData) SetImageData(value string)

func (*MetaData) SetName

func (receiver *MetaData) SetName(value string)

func (*MetaData) SetYouTubeURL

func (receiver *MetaData) SetYouTubeURL(value string)

Jump to

Keyboard shortcuts

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