nfttradescrapers

package
v1.1.1-rc-2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: GPL-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CryptoKittiesRefreshDelay = time.Second * 60
)
View Source
const (
	CryptoPunkRefreshDelay = time.Second * 60
)
View Source
const (
	OpenSea = "OpenSea"
)

Variables

This section is empty.

Functions

This section is empty.

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

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

func NewSorareScraper

func NewSorareScraper(rdb *models.RelDB) *SorareScraper

func (*SorareScraper) Close

func (scraper *SorareScraper) Close() error

Close closes any existing API connections

func (*SorareScraper) FetchTrades

func (scraper *SorareScraper) FetchTrades() (trades []dia.NFTTrade, err error)

func (*SorareScraper) GetTotalSupply

func (scraper *SorareScraper) GetTotalSupply() (*big.Int, error)

GetTotalSupply returns the total supply of the NFT from on-chain.

func (*SorareScraper) GetTradeChannel

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

GetDataChannel returns the scrapers data channel.

func (*SorareScraper) UpdateTrades

func (scraper *SorareScraper) UpdateTrades() 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