generate

package
v0.0.0-...-10dc1f5 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_RETRIES     = 10000
	MAX_NFT_RETRIES = 100
	METADATA_DIR    = "metadata"
	IMAGE_DIR       = "images"
	RARITIES_FILE   = "rarities.json"
)

Variables

View Source
var ErrNftFailed = fmt.Errorf("failed to produce valid NFT")

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name  string `json:"trait_type"`
	Value string `json:"value"`
}

type AttributeRarity

type AttributeRarity struct {
	PercentTotal float64
	Percent      float64
	Count        int
}

type Generate

type Generate struct {
	AttrMax   map[Attribute]int
	AttrCount map[Attribute]int
	// contains filtered or unexported fields
}

func NewGenerate

func NewGenerate(c config.Config, debug bool) (*Generate, error)

func (*Generate) Exists

func (g *Generate) Exists(n NFT) bool

func (*Generate) GenerateN

func (g *Generate) GenerateN(n uint) error

func (*Generate) Image

func (g *Generate) Image(n *NFT) error

func (*Generate) ImagesDir

func (g *Generate) ImagesDir() string

func (*Generate) Init

func (g *Generate) Init() error

func (*Generate) Max

func (g *Generate) Max() int

func (*Generate) MaxAttribute

func (g *Generate) MaxAttribute(a Attribute) int

func (*Generate) Metadata

func (g *Generate) Metadata(n *NFT) error

func (*Generate) MetadataDir

func (g *Generate) MetadataDir() string

func (*Generate) NewNFT

func (g *Generate) NewNFT() (*NFT, error)

func (*Generate) NftCount

func (g *Generate) NftCount() int

func (*Generate) Progress

func (g *Generate) Progress(ctx context.Context, n uint)

func (*Generate) Rarities

func (g *Generate) Rarities() map[string]map[string]AttributeRarity

func (*Generate) RaritiesFile

func (g *Generate) RaritiesFile() string

func (*Generate) Save

func (g *Generate) Save(ctx context.Context)

func (*Generate) SetImagePath

func (g *Generate) SetImagePath(n *NFT, image string) error

func (*Generate) Upload

func (g *Generate) Upload(path string) (string, error)

func (*Generate) WriteRarities

func (g *Generate) WriteRarities() error

type NFT

type NFT struct {
	Image       string      `json:"image"`
	Attributes  []Attribute `json:"attributes"`
	Name        string      `json:"name"`
	Description string      `json:"description,omitempty"`
	ExternalURL string      `json:"external_url,omitempty"`
	// contains filtered or unexported fields
}

func NewNFT

func NewNFT() NFT

func (*NFT) Hash

func (n *NFT) Hash() string

func (*NFT) SetImagePath

func (n *NFT) SetImagePath(image string)

Jump to

Keyboard shortcuts

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