nfttradescrapers

package
v1.4.207 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: GPL-2.0 Imports: 44 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MagicEdenV2ProgramAddress    = "M2mx93ekt1fmXSVkTrUL9xVFHkmME8HTUi5Cyc5aF7K"
	SolTokenAddress              = "So11111111111111111111111111111111111111112"
	MetadataProgramAddress       = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
	SaleInstructionPrefix        = "f223c68952e1f2b6"
	ExecuteSaleInstructionPrefix = "254ad99d4f312306"
	MetadataFee                  = 0.00561672
	MagicEden                    = "MagicEden"
)
View Source
const (
	CryptoKittiesRefreshDelay = time.Second * 60 * 10
)
View Source
const (
	CryptoPunkRefreshDelay = time.Second * 60 * 2
)
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.
	OpenSeaSeaport = "openseaSeaport"

	ERC1155InterfaceId = [4]byte{}
	ERC721InterfaceId  = [4]byte{}
)
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.
	TofuNFT = ""
)
View Source
var (

	// X2Y2 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, exchange dia.NFTExchange) *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, exchange dia.NFTExchange) *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 MagicEdenScraper added in v1.4.25

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

func NewMagicEdenScraper added in v1.4.25

func NewMagicEdenScraper(rdb *models.RelDB, exchange dia.NFTExchange) *MagicEdenScraper

func (*MagicEdenScraper) FetchHistoricalTrades added in v1.4.25

func (s *MagicEdenScraper) FetchHistoricalTrades() error

func (*MagicEdenScraper) FetchTrades added in v1.4.25

func (s *MagicEdenScraper) FetchTrades() error

func (*MagicEdenScraper) GetTradeChannel added in v1.4.25

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

type MagicEdenScraperConfig added in v1.4.25

type MagicEdenScraperConfig struct {
	SolanaRestUri string `json:"rest_uri"`

	ProgramAddr string `json:"program_addr"`

	BatchSize int `json:"batch_size"`

	WaitPeriod time.Duration `json:"wait_per_batch"`

	MaxRetry int `json:"max_retry"`

	SkipOnErr bool `json:"skip_on_error"`

	ScrapeHistorical bool `json:"scrape_historical"`
}

type MagicEdenScraperState added in v1.4.25

type MagicEdenScraperState struct {
	LastTx string `json:"last_tx"`

	LastTxHistorical string `json:"last_tx_historical"`

	LastErr string `json:"last_error"`

	LastErrHistorical string `json:"last_error_historical"`

	ErrCounter int `json:"count_of_error"`

	ErrCounterHistorical int `json:"count_of_error_historical"`
}

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 NFTCreator added in v1.4.25

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

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, exchange dia.NFTExchange) *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, exchange dia.NFTExchange) *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, exchange dia.NFTExchange) *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 SolanaNFTMetadata added in v1.4.25

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

type TofuNFTScraper added in v1.4.2

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

func NewTofuNFTScraper added in v1.4.2

func NewTofuNFTScraper(rdb *models.RelDB, exchange dia.NFTExchange) (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, exchange dia.NFTExchange) *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

GetTradeChannel 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