collections

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseCollection added in v0.2.0

type BaseCollection struct{}

type Collection added in v0.4.0

type Collection struct {
	ContractAddress common.Address `mapstructure:"address"`
	Name            string         `mapstructure:"name"`
	OpenseaSlug     string         `mapstructure:"slug"`

	FetchListings  bool `mapstructure:"fetchListings"`
	IgnorePrinting bool `mapstructure:"ignore"`

	Show struct {
		Sales     bool `mapstructure:"sales"`
		Mints     bool `mapstructure:"mints"`
		Transfers bool `mapstructure:"transfers"`
		Listings  bool `mapstructure:"listings"`
		History   bool `mapstructure:"history"`
	} `mapstructure:"show"`

	Highlight struct {
		Color              lipgloss.Color `mapstructure:"color"`
		Sales              lipgloss.Color `mapstructure:"show.sales"`
		Mints              lipgloss.Color `mapstructure:"mints"`
		Transfers          lipgloss.Color `mapstructure:"transfers"`
		Listings           lipgloss.Color `mapstructure:"listings"`
		ListingsBelowPrice float64        `mapstructure:"listings_below_price"`
	} `mapstructure:"highlight"`

	//
	// calculated/generated fields
	Metadata *nemo.CollectionMetadata `mapstructure:"metadata"`

	Source collectionsource.CollectionSource `mapstructure:"source"`

	Colors struct {
		Primary   lipgloss.Color `mapstructure:"primary"`
		Secondary lipgloss.Color `mapstructure:"secondary"`
	} `mapstructure:"colors"`

	Counters struct {
		Sales       uint64
		Mints       uint64
		Transfers   uint64
		Listings    uint64
		SalesVolume *big.Int
	} `mapstructure:"counters"`

	SaLiRa             ewma.MovingAverage  `mapstructure:"salira"`
	FloorPrice         *ewma.MovingAverage `mapstructure:"floorPrice"`
	PreviousFloorPrice float64             `mapstructure:"previousFloorPrice"`
}

Collection represents the collections configured by the user.

func NewCollection

func NewCollection(contractAddress common.Address, name string, nodes *provider.Pool, source collectionsource.CollectionSource) *Collection

func (*Collection) AddListing added in v0.4.0

func (uc *Collection) AddListing(numItems uint64)

func (*Collection) AddMint added in v0.4.0

func (uc *Collection) AddMint()

func (*Collection) AddSale added in v0.4.0

func (uc *Collection) AddSale(value *big.Int, numItems uint64) float64

func (*Collection) CalculateFloorPrice added in v0.4.0

func (uc *Collection) CalculateFloorPrice(tokenPrice float64) (float64, float64)

CalculateFloorPrice updates the moving average of a given collection.

func (*Collection) CalculateSaLiRa added in v0.4.0

func (uc *Collection) CalculateSaLiRa(address common.Address) (float64, float64)

CalculateSaLiRa updates the salira moving average of a given collection.

func (*Collection) Render added in v0.4.0

func (uc *Collection) Render(text string) string

func (*Collection) ResetStats added in v0.4.0

func (uc *Collection) ResetStats()

func (*Collection) Style added in v0.4.0

func (uc *Collection) Style() lipgloss.Style

func (*Collection) StyleSecondary added in v0.4.0

func (uc *Collection) StyleSecondary() lipgloss.Style

type CollectionDB added in v0.2.0

type CollectionDB struct {
	Collections map[common.Address]*Collection

	// 'queue' to store collections to be processed
	// ListingAddresses chan common.Address
	RWMu *sync.RWMutex
}

func New

func New() *CollectionDB

func (*CollectionDB) Addresses added in v0.2.0

func (cs *CollectionDB) Addresses() []common.Address

func (*CollectionDB) ListingsAddresses added in v0.2.0

func (cs *CollectionDB) ListingsAddresses() []common.Address

ListingsAddresses returns a slice of addresses.

func (*CollectionDB) OpenseaSlugAddresses added in v0.4.0

func (cs *CollectionDB) OpenseaSlugAddresses() []common.Address

func (*CollectionDB) OpenseaSlugs added in v0.2.0

func (cs *CollectionDB) OpenseaSlugs() []string

OpenseaSlugs returns a slice of slugs for collections with enabled listings.

func (*CollectionDB) OpenseaSlugsAndAddresses added in v0.4.0

func (cs *CollectionDB) OpenseaSlugsAndAddresses() map[string]common.Address

OpenseaSlugs returns a slice of slugs for collections with enabled listings.

func (*CollectionDB) SortedAndColoredNames added in v0.2.0

func (cs *CollectionDB) SortedAndColoredNames() []string

func (*CollectionDB) UserCollectionsAddresses added in v0.2.0

func (cs *CollectionDB) UserCollectionsAddresses() []common.Address

Jump to

Keyboard shortcuts

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