collections

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 22 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 `mapstructure:"source"`

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

	// better "counters"
	RecentEvents mapset.Set[*degendb.RecentEvent] `mapstructure:"recent_events"`
	degendb.SaLiRas

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

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

Collection represents the collections configured by the user.

func NewCollection

func NewCollection(contractAddress common.Address, name string, nodes *provider.Pool, source CollectionSource, rueidi *rueidica.Rueidica) *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) AddMintVolume added in v0.6.0

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

func (*Collection) AddSales added in v0.9.0

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

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) GetPrettySaLiRas added in v0.9.0

func (uc *Collection) GetPrettySaLiRas() []string

GetPrettySaLiRas returns freshly calculated and beautifully formatted SaLiRas for all configured timeframes.

func (*Collection) GetSaLiCount added in v0.9.0

func (uc *Collection) GetSaLiCount() (int, int)

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) GetCollectionForSlug added in v0.7.6

func (cs *CollectionDB) GetCollectionForSlug(slug string) *Collection

GetCollectionForSlug returns a collections for the given slug.

func (*CollectionDB) ListingsAddresses added in v0.2.0

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

ListingsAddresses returns a slice of addresses.

func (*CollectionDB) OpenSeaSlugsAndAddresses added in v0.9.2

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

OpenSeaSlugsAndAddresses returns a slice-to-address map of collections with enabled listings.

func (*CollectionDB) OpenseaAddressToSlug added in v0.7.3

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

OpenseaAddressToSlug returns a collectionAddressto-slug map of collections with enabled listings.

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

type CollectionSource

type CollectionSource int64

CollectionSource represents the source of a collection.

const (
	FromConfiguration CollectionSource = iota // FromConfiguration represents a collection explicitly defined in the configuration.
	FromWallet                                // FromWallet represents a collection from a token in one of our wallets.
	FromStream                                // FromStream represents a collection gathered from stream.
)

func (*CollectionSource) MarshalJSON added in v0.9.2

func (cs *CollectionSource) MarshalJSON() ([]byte, error)

MarshalJSON marshals the CollectionSource to JSON.

func (*CollectionSource) String added in v0.9.2

func (cs *CollectionSource) String() string

String returns the string representation of the CollectionSource.

func (*CollectionSource) UnmarshalJSON added in v0.9.2

func (cs *CollectionSource) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the CollectionSource from JSON.

Jump to

Keyboard shortcuts

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