nfttradescrapers

package
v1.4.1-rc-13 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: GPL-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CryptoKittiesRefreshDelay = time.Second * 60 * 10
)
View Source
const (
	CryptoPunkRefreshDelay = time.Second * 60 * 10
)
View Source
const (
	OpenSea = "OpenSea"
)
View Source
const (
	TopshotAddress = "0x0b2a3299cc857e29"
)

Variables

This section is empty.

Functions

func GetDepositMoments

func GetDepositMoments(startheight, endheight uint64, flowClient *client.Client) (depositMoments []cadence.Event, blockNumbers []uint64, err error)

GetDepositMoments returns all moments minted between blocks @startheight and @endheight. The difference @endheight-@starthight is limited to 250. The range @startheight, @endheight must not be spread over more than the given @flowClient. https://docs.onflow.org/node-operation/past-sporks/

func GetPurchasedMoments

func GetPurchasedMoments(startheight, endheight uint64, flowClient *client.Client) (purchasedMoments []flow.Event, timestamps []time.Time, blockNumbers []uint64, err error)

GetPurchasedMoments returns all moments minted between blocks @startheight and @endheight. The difference @endheight-@starthight is limited to 250. The range @startheight, @endheight must not be spread over more than the given @flowClient. https://docs.onflow.org/node-operation/past-sporks/

Types

type CryptoKittiesScraper

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

func NewCryptoKittiesScraper

func NewCryptoKittiesScraper(rdb *models.RelDB) *CryptoKittiesScraper

func (*CryptoKittiesScraper) Close

func (scraper *CryptoKittiesScraper) Close() error

Close closes any existing API connections

func (*CryptoKittiesScraper) FetchTrades

func (scraper *CryptoKittiesScraper) FetchTrades() error

func (*CryptoKittiesScraper) GetTradeChannel

func (scraper *CryptoKittiesScraper) GetTradeChannel() chan dia.NFTTrade

GetDataChannel returns the scrapers data channel.

type CryptoPunkScraper

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

func NewCryptoPunkScraper

func NewCryptoPunkScraper(rdb *models.RelDB) *CryptoPunkScraper

func (*CryptoPunkScraper) Close

func (scraper *CryptoPunkScraper) Close() error

Close closes any existing API connections

func (*CryptoPunkScraper) FetchTrades

func (scraper *CryptoPunkScraper) FetchTrades() error

func (*CryptoPunkScraper) GetTradeChannel

func (scraper *CryptoPunkScraper) GetTradeChannel() chan dia.NFTTrade

GetDataChannel returns the scrapers data channel.

type DepositEvent

type DepositEvent cadence.Event

pub event Deposit(id: UInt64, to: Address?)

func (DepositEvent) Id

func (evt DepositEvent) Id() uint64

Token Id

func (DepositEvent) Recipient

func (evt DepositEvent) Recipient() *flow.Address

Recipient address

func (DepositEvent) String

func (evt DepositEvent) String() string

type MomentPurchasedEvent

type MomentPurchasedEvent cadence.Event

pub event MomentPurchased(id: UInt64, price: UFix64, seller: Address?)

func (MomentPurchasedEvent) Id

func (evt MomentPurchasedEvent) Id() uint64

func (MomentPurchasedEvent) Price

func (evt MomentPurchasedEvent) Price() float64

func (MomentPurchasedEvent) Seller

func (evt MomentPurchasedEvent) Seller() *flow.Address

func (MomentPurchasedEvent) String

func (evt MomentPurchasedEvent) String() string

type NBATopshotScraper

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

func NewNBATopshotScraper

func NewNBATopshotScraper(rdb *models.RelDB) *NBATopshotScraper

func (*NBATopshotScraper) Close

func (scraper *NBATopshotScraper) Close() error

Close closes any existing API connections

func (*NBATopshotScraper) FetchTrades

func (scraper *NBATopshotScraper) FetchTrades() (err error)

func (*NBATopshotScraper) GetAllDepositMoments

func (scraper *NBATopshotScraper) GetAllDepositMoments(startheight uint64) (depositMoments []cadence.Event, blocknumbers []uint64, err error)

GetAllDepositMoments returns all moments from genesis to the latest block by iterating through blocks and looking for Deposit events.

func (*NBATopshotScraper) GetAllMomentsPurchased

func (scraper *NBATopshotScraper) GetAllMomentsPurchased(startheight uint64) (purchasedMoments []flow.Event, timestamps []time.Time, blocknumbers []uint64, err error)

GetAllMomentsPurchased returns all moments from genesis to the latest block by iterating through blocks and looking for MomentPurchased events.

func (*NBATopshotScraper) GetTradeChannel

func (scraper *NBATopshotScraper) GetTradeChannel() chan dia.NFTTrade

GetDataChannel returns the scrapers data channel.

type NFTTradeScraper

type NFTTradeScraper interface {
	GetTradeChannel() chan dia.NFTTrade
	FetchTrades() error
}

type OpenSeaScraper

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

func NewOpenSeaScraper

func NewOpenSeaScraper(rdb *models.RelDB) *OpenSeaScraper

func (*OpenSeaScraper) Close

func (s *OpenSeaScraper) Close() error

func (*OpenSeaScraper) FetchTrades

func (s *OpenSeaScraper) FetchTrades() error

FetchTrades searches for trades on-chain by the next block range

func (*OpenSeaScraper) GetTradeChannel

func (s *OpenSeaScraper) GetTradeChannel() chan dia.NFTTrade

GetDataChannel returns the scrapers data channel.

type OpenSeaScraperConfig

type OpenSeaScraperConfig struct {
	// opensea's exchange contract address on connected blockchain network
	ContractAddr string `json:"contract_addr"`

	// indicates the batch size during read the filtered events
	BatchSize int `json:"batch_size"`

	// wait for a while between batch retrieval of filtered events
	WaitPeriod time.Duration `json:"wait_per_batch"`

	// it enables read contract data from the event's block
	// height instead of the last state
	FollowDist int `json:"following_distance_blocks"`

	// if set it will read erc721 attributes at the currently
	// processing block
	UseArchiveNode bool `json:"use_archive_node_fetaures"`

	// indicates the number of retries to scrape the target
	// in case of an unexpected error
	MaxRetry int `json:"max_retry"`

	// if true the scraper will skip the currently scraping
	// block when retries reach to the value MaxRetry
	SkipOnErr bool `json:"skip_on_error"`

	// it limits read bytes for NFT's metadata from external url
	MaxMetadataSize int `json:"max_metadata_size"`

	// it limits duration of read for NFT's metadata from external url
	MetadataTimeout time.Duration `json:"metadata_timeout"`
}

type OpenSeaScraperState

type OpenSeaScraperState struct {
	// last block number has been processed
	LastBlockNum uint64 `json:"last_block_num"`

	// last transaction index in the block(curr) has been processed
	LastTxIndex uint `json:"last_tx_index"`

	// holds the latest error message that occurred while scraping
	LastErr string `json:"last_error"`

	// indicates the number of consecutive error, reset on any successful operation
	ErrCounter int `json:"count_of_error"`
}

type TradeScraper

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

Jump to

Keyboard shortcuts

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