nfttradescrapers

package
v1.4.1-rc-336 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: GPL-2.0 Imports: 39 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 (
	LooksRare = "LooksRare"
)
View Source
const (
	OpenSeaBAYC = "OpenSeaBayc"
)
View Source
const (
	TopshotAddress = "0x0b2a3299cc857e29"
)

Variables

View Source
var (

	// This string is the identifier of the scraper in conf and state fields in postgres.
	OpenSea = ""
)
View Source
var (

	// This string is the identifier of the scraper in conf and state fields in postgres.
	OpenSeaSeaport = "openseaSeaport"
)
View Source
var (

	// This string is the identifier of the scraper in conf and state fields in postgres.
	TofuNFT = ""
)
View Source
var (

	// This string is the identifier of the scraper in conf and state fields in postgres.
	X2Y2 = "X2Y2"
)
View Source
var ZeroAddress = common.HexToAddress("0x0000000000000000000000000000000000000000")

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 LooksRareScraper added in v1.4.2

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

func NewLooksRareScraper added in v1.4.2

func NewLooksRareScraper(rdb *models.RelDB) *LooksRareScraper

func (*LooksRareScraper) Close added in v1.4.2

func (s *LooksRareScraper) Close() error

func (*LooksRareScraper) FetchTrades added in v1.4.2

func (s *LooksRareScraper) FetchTrades() error

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

func (*LooksRareScraper) GetTradeChannel added in v1.4.2

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

GetDataChannel returns the scrapers data channel.

type LooksRareScraperConfig added in v1.4.2

type LooksRareScraperConfig struct {
	// looksrare'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 LooksRareScraperState added in v1.4.2

type LooksRareScraperState 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 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 OpenSeaBAYCScraper added in v1.4.2

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

func NewOpenSeaBAYCScraper added in v1.4.2

func NewOpenSeaBAYCScraper(rdb *models.RelDB) *OpenSeaBAYCScraper

func (*OpenSeaBAYCScraper) Close added in v1.4.2

func (s *OpenSeaBAYCScraper) Close() error

func (*OpenSeaBAYCScraper) FetchTrades added in v1.4.2

func (s *OpenSeaBAYCScraper) FetchTrades() error

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

func (*OpenSeaBAYCScraper) GetTradeChannel added in v1.4.2

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

GetDataChannel returns the scrapers data channel.

type OpenSeaBAYCScraperConfig added in v1.4.2

type OpenSeaBAYCScraperConfig 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 OpenSeaBAYCScraperState added in v1.4.2

type OpenSeaBAYCScraperState 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 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 OpenSeaSeaportScraper added in v1.4.2

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

func NewOpenSeaSeaportScraper added in v1.4.2

func NewOpenSeaSeaportScraper(rdb *models.RelDB) *OpenSeaSeaportScraper

func (*OpenSeaSeaportScraper) Close added in v1.4.2

func (s *OpenSeaSeaportScraper) Close() error

func (*OpenSeaSeaportScraper) FetchTrades added in v1.4.2

func (s *OpenSeaSeaportScraper) FetchTrades() error

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

func (*OpenSeaSeaportScraper) GetTradeChannel added in v1.4.2

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

GetTradeChannel returns the scrapers data channel.

type OpenSeaSeaportScraperConfig added in v1.4.2

type OpenSeaSeaportScraperConfig 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 OpenSeaSeaportScraperState added in v1.4.2

type OpenSeaSeaportScraperState 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 TofuNFTScraper added in v1.4.2

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

func NewTofuNFTScraper added in v1.4.2

func NewTofuNFTScraper(blockchain string, rdb *models.RelDB) (scraper *TofuNFTScraper)

func (*TofuNFTScraper) Close added in v1.4.2

func (s *TofuNFTScraper) Close() error

func (*TofuNFTScraper) FetchTrades added in v1.4.2

func (s *TofuNFTScraper) FetchTrades() error

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

func (*TofuNFTScraper) GetTradeChannel added in v1.4.2

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

GetDataChannel returns the scrapers data channel.

type TofuNFTScraperConfig added in v1.4.2

type TofuNFTScraperConfig struct {
	// tofunft'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 TofuNFTScraperState added in v1.4.2

type TofuNFTScraperState 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
}

type X2Y2Scraper added in v1.4.2

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

func NewX2Y2Scraper added in v1.4.2

func NewX2Y2Scraper(rdb *models.RelDB) *X2Y2Scraper

func (*X2Y2Scraper) Close added in v1.4.2

func (s *X2Y2Scraper) Close() error

func (*X2Y2Scraper) FetchTrades added in v1.4.2

func (s *X2Y2Scraper) FetchTrades() error

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

func (*X2Y2Scraper) GetTradeChannel added in v1.4.2

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

GetDataChannel returns the scrapers data channel.

type X2Y2ScraperConfig added in v1.4.2

type X2Y2ScraperConfig struct {
	// x2y2'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 X2Y2ScraperState added in v1.4.2

type X2Y2ScraperState 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"`
}

Jump to

Keyboard shortcuts

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