nftdatascrapers

package
v1.4.44 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: GPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TopshotAddress = "0x0b2a3299cc857e29"
)

Variables

This section is empty.

Functions

func GetCreationTime

func GetCreationTime(playerResp []byte) (time.Time, error)

GetCreationTime returns the creation time from Opensea

func GetCreatorAddress

func GetCreatorAddress(playerResp []byte) (common.Address, error)

GetCreatorAddress returns the creator address from Opensea

func GetCryptokittiesAddress

func GetCryptokittiesAddress(kittyResp []byte) (common.Address, error)

GetCryptokittiesAddress returns the creator address from Opensea

func GetCryptopunkAddress

func GetCryptopunkAddress(punkResp []byte) (common.Address, error)

GetCryptopunkAddress returns the creator address from Opensea

func GetMintedMoments

func GetMintedMoments(startheight, endheight uint64, flowClient *client.Client) (mintedMoments []cadence.Event, timestamps []time.Time, blockNumbers []uint64, err error)

GetMintedMoments 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 Club

type Club struct {
	NameClub    string
	CountryClub string
	CityClub    string
	YearFounded uint16
}

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

func (scraper *CryptoKittiesScraper) FetchData() error

func (*CryptoKittiesScraper) GetCryptokittiesCreationTime

func (scraper *CryptoKittiesScraper) GetCryptokittiesCreationTime() (map[uint64]time.Time, error)

GetCryptokittiesCreationTime returns a map[uint64]uint64 mapping a

func (*CryptoKittiesScraper) GetDataChannel

func (scraper *CryptoKittiesScraper) GetDataChannel() chan dia.NFT

GetDataChannel returns the scrapers data channel.

func (*CryptoKittiesScraper) GetKitty

func (scraper *CryptoKittiesScraper) GetKitty(kittyId *big.Int) (Kitty, error)

GetKitty returns the kitty attributes of the NFT from on-chain.

func (*CryptoKittiesScraper) GetOpenSeaKitty

func (scraper *CryptoKittiesScraper) GetOpenSeaKitty(index *big.Int) ([]CryptokittiesTraits, common.Address, error)

GetOpenSeaKitty returns the scraped data from Opensea for a given kitty

func (*CryptoKittiesScraper) GetTotalSupply

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

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

type CryptoPunksScraper

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

func NewCryptoPunksScraper

func NewCryptoPunksScraper(rdb *models.RelDB) *CryptoPunksScraper

func (*CryptoPunksScraper) Close

func (scraper *CryptoPunksScraper) Close() error

Close closes any existing API connections

func (*CryptoPunksScraper) FetchData

func (scraper *CryptoPunksScraper) FetchData() (err error)

func (*CryptoPunksScraper) GetCreationEvents

func (scraper *CryptoPunksScraper) GetCreationEvents() (map[uint64]time.Time, map[uint64]common.Address, error)

GetCreationEvents returns maps for creation time and creator address by filtering 'assign punk' events.

func (*CryptoPunksScraper) GetDataChannel

func (scraper *CryptoPunksScraper) GetDataChannel() chan dia.NFT

GetDataChannel returns the scrapers data channel.

func (*CryptoPunksScraper) GetOpenSeaPunk

func (scraper *CryptoPunksScraper) GetOpenSeaPunk(index *big.Int) ([]CryptopunkTraits, error)

func (*CryptoPunksScraper) GetOpenSeaPunkOld

func (scraper *CryptoPunksScraper) GetOpenSeaPunkOld(index *big.Int) ([]CryptopunkTraits, error)

GetOpenSeaPunk returns the scraped data from Opensea for a given punk

func (*CryptoPunksScraper) GetTotalSupply

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

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

func (*CryptoPunksScraper) TokenByIndex

func (scraper *CryptoPunksScraper) TokenByIndex(index *big.Int) (common.Address, error)

TokenByIndex returns the address of a punk whose id is passed as a parameter from on-chain.

type CryptokittiesOutput

type CryptokittiesOutput struct {
	Traits []CryptokittiesTraits `structs:",flatten"`
	Kitty  Kitty                 `structs:",flatten"`
}

type CryptokittiesTraits

type CryptokittiesTraits struct {
	TraitType   string      `json:"trait_type"`
	Value       interface{} `json:"value"`
	DisplayType interface{} `json:"display_type"`
	MaxValue    interface{} `json:"max_value"`
	TraitCount  int         `json:"trait_count"`
	Order       interface{} `json:"order"`
}

func GetCryptokittiesTraits

func GetCryptokittiesTraits(kittyResp []byte) ([]CryptokittiesTraits, error)

GetCryptokittiesTraits returns the traits data from Opensea for a given kitty

type CryptopunkOutput

type CryptopunkOutput struct {
	Traits []CryptopunkTraits `structs:",flatten"`
}

type CryptopunkTraits

type CryptopunkTraits struct {
	TraitType   string      `json:"trait_type"`
	Value       string      `json:"value"`
	DisplayType interface{} `json:"display_type"`
	MaxValue    interface{} `json:"max_value"`
	TraitCount  int         `json:"trait_count"`
	Order       interface{} `json:"order"`
}

func GetCryptopunkTraits

func GetCryptopunkTraits(punkResp []byte) ([]CryptopunkTraits, error)

GetCryptopunkTraits returns the parsed traits data from Opensea for a given punk

type Kitty

type Kitty struct {
	IsGestating   bool
	IsReady       bool
	CooldownIndex *big.Int
	NextActionAt  *big.Int
	SiringWithId  *big.Int
	BirthTime     *big.Int
	MatronId      *big.Int
	SireId        *big.Int
	Generation    *big.Int
	Genes         *big.Int
}

type Moment

type Moment struct {
	ID           uint64
	SetID        uint32
	PlayID       uint32
	SerialNumber uint32
}

type MomentMintedEvent

type MomentMintedEvent cadence.Event

func (MomentMintedEvent) ID

func (mme MomentMintedEvent) ID() uint64

func (MomentMintedEvent) PlayID

func (mme MomentMintedEvent) PlayID() uint32

func (MomentMintedEvent) SerialNumber

func (mme MomentMintedEvent) SerialNumber() uint32

func (MomentMintedEvent) SetID

func (mme MomentMintedEvent) SetID() uint32

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

func (scraper *NBATopshotScraper) FetchData() error

func (*NBATopshotScraper) GetAttributeMap

func (scraper *NBATopshotScraper) GetAttributeMap() error

GetAttributesMap returns a map that uniquely maps an identifier consisting of setID and playID onto the corresponding attributes.

func (*NBATopshotScraper) GetDataChannel

func (scraper *NBATopshotScraper) GetDataChannel() chan dia.NFT

GetDataChannel returns the scrapers data channel.

func (*NBATopshotScraper) GetMetadata

func (scraper *NBATopshotScraper) GetMetadata(setid uint32, playid uint32) (map[string]interface{}, error)

GetMetadata returns the metadata associated to the play with @playid in the set with @setid.

func (*NBATopshotScraper) GetNumSets

func (scraper *NBATopshotScraper) GetNumSets() (uint32, error)

GetNumSets returns the number of available sets.

func (*NBATopshotScraper) GetPlaysBySet

func (scraper *NBATopshotScraper) GetPlaysBySet(setid uint32) ([]cadence.Value, error)

GetPlaysBySet returns all plays contained in a set.

type NFTDataScraper

type NFTDataScraper interface {
	// NFT data should be streamed through dia.NFT channel.
	GetDataChannel() chan dia.NFT
	// Should fetch nft data and send it to the channel.
	FetchData() error
}

type NFTScraper

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

type OpenSeaCryptokittiesResponse

type OpenSeaCryptokittiesResponse struct {
	ID                   int         `json:"id"`
	TokenID              string      `json:"token_id"`
	NumSales             int         `json:"num_sales"`
	BackgroundColor      interface{} `json:"background_color"`
	ImageURL             string      `json:"image_url"`
	ImagePreviewURL      string      `json:"image_preview_url"`
	ImageThumbnailURL    string      `json:"image_thumbnail_url"`
	ImageOriginalURL     string      `json:"image_original_url"`
	AnimationURL         interface{} `json:"animation_url"`
	AnimationOriginalURL interface{} `json:"animation_original_url"`
	Name                 string      `json:"name"`
	Description          interface{} `json:"description"`
	ExternalLink         string      `json:"external_link"`
	AssetContract        struct {
		Address                     string      `json:"address"`
		AssetContractType           string      `json:"asset_contract_type"`
		CreatedDate                 string      `json:"created_date"`
		Name                        string      `json:"name"`
		NftVersion                  string      `json:"nft_version"`
		OpenseaVersion              interface{} `json:"opensea_version"`
		Owner                       interface{} `json:"owner"`
		SchemaName                  string      `json:"schema_name"`
		Symbol                      string      `json:"symbol"`
		TotalSupply                 interface{} `json:"total_supply"`
		Description                 string      `json:"description"`
		ExternalLink                string      `json:"external_link"`
		ImageURL                    string      `json:"image_url"`
		DefaultToFiat               bool        `json:"default_to_fiat"`
		DevBuyerFeeBasisPoints      int         `json:"dev_buyer_fee_basis_points"`
		DevSellerFeeBasisPoints     int         `json:"dev_seller_fee_basis_points"`
		OnlyProxiedTransfers        bool        `json:"only_proxied_transfers"`
		OpenseaBuyerFeeBasisPoints  int         `json:"opensea_buyer_fee_basis_points"`
		OpenseaSellerFeeBasisPoints int         `json:"opensea_seller_fee_basis_points"`
		BuyerFeeBasisPoints         int         `json:"buyer_fee_basis_points"`
		SellerFeeBasisPoints        int         `json:"seller_fee_basis_points"`
		PayoutAddress               interface{} `json:"payout_address"`
	} `json:"asset_contract"`
	Owner struct {
		User          interface{} `json:"user"`
		ProfileImgURL string      `json:"profile_img_url"`
		Address       string      `json:"address"`
		Config        string      `json:"config"`
		DiscordID     string      `json:"discord_id"`
	} `json:"owner"`
	Permalink  string `json:"permalink"`
	Collection struct {
		PaymentTokens []struct {
			ID       int     `json:"id"`
			Symbol   string  `json:"symbol"`
			Address  string  `json:"address"`
			ImageURL string  `json:"image_url"`
			Name     string  `json:"name"`
			Decimals int     `json:"decimals"`
			EthPrice float64 `json:"eth_price"`
			UsdPrice float64 `json:"usd_price"`
		} `json:"payment_tokens"`
		PrimaryAssetContracts []struct {
			Address                     string      `json:"address"`
			AssetContractType           string      `json:"asset_contract_type"`
			CreatedDate                 string      `json:"created_date"`
			Name                        string      `json:"name"`
			NftVersion                  string      `json:"nft_version"`
			OpenseaVersion              interface{} `json:"opensea_version"`
			Owner                       interface{} `json:"owner"`
			SchemaName                  string      `json:"schema_name"`
			Symbol                      string      `json:"symbol"`
			TotalSupply                 interface{} `json:"total_supply"`
			Description                 string      `json:"description"`
			ExternalLink                string      `json:"external_link"`
			ImageURL                    string      `json:"image_url"`
			DefaultToFiat               bool        `json:"default_to_fiat"`
			DevBuyerFeeBasisPoints      int         `json:"dev_buyer_fee_basis_points"`
			DevSellerFeeBasisPoints     int         `json:"dev_seller_fee_basis_points"`
			OnlyProxiedTransfers        bool        `json:"only_proxied_transfers"`
			OpenseaBuyerFeeBasisPoints  int         `json:"opensea_buyer_fee_basis_points"`
			OpenseaSellerFeeBasisPoints int         `json:"opensea_seller_fee_basis_points"`
			BuyerFeeBasisPoints         int         `json:"buyer_fee_basis_points"`
			SellerFeeBasisPoints        int         `json:"seller_fee_basis_points"`
			PayoutAddress               interface{} `json:"payout_address"`
		} `json:"primary_asset_contracts"`
		Traits struct {
		} `json:"traits"`
		Stats struct {
			OneDayVolume          float64 `json:"one_day_volume"`
			OneDayChange          float64 `json:"one_day_change"`
			OneDaySales           float64 `json:"one_day_sales"`
			OneDayAveragePrice    float64 `json:"one_day_average_price"`
			SevenDayVolume        float64 `json:"seven_day_volume"`
			SevenDayChange        float64 `json:"seven_day_change"`
			SevenDaySales         float64 `json:"seven_day_sales"`
			SevenDayAveragePrice  float64 `json:"seven_day_average_price"`
			ThirtyDayVolume       float64 `json:"thirty_day_volume"`
			ThirtyDayChange       float64 `json:"thirty_day_change"`
			ThirtyDaySales        float64 `json:"thirty_day_sales"`
			ThirtyDayAveragePrice float64 `json:"thirty_day_average_price"`
			TotalVolume           float64 `json:"total_volume"`
			TotalSales            float64 `json:"total_sales"`
			TotalSupply           float64 `json:"total_supply"`
			Count                 float64 `json:"count"`
			NumOwners             int     `json:"num_owners"`
			AveragePrice          float64 `json:"average_price"`
			NumReports            int     `json:"num_reports"`
			MarketCap             float64 `json:"market_cap"`
		} `json:"stats"`
		BannerImageURL          string      `json:"banner_image_url"`
		ChatURL                 interface{} `json:"chat_url"`
		CreatedDate             string      `json:"created_date"`
		DefaultToFiat           bool        `json:"default_to_fiat"`
		Description             string      `json:"description"`
		DevBuyerFeeBasisPoints  string      `json:"dev_buyer_fee_basis_points"`
		DevSellerFeeBasisPoints string      `json:"dev_seller_fee_basis_points"`
		DiscordURL              string      `json:"discord_url"`
		DisplayData             struct {
			CardDisplayStyle string `json:"card_display_style"`
		} `json:"display_data"`
		ExternalURL                 string      `json:"external_url"`
		Featured                    bool        `json:"featured"`
		FeaturedImageURL            string      `json:"featured_image_url"`
		Hidden                      bool        `json:"hidden"`
		SafelistRequestStatus       string      `json:"safelist_request_status"`
		ImageURL                    string      `json:"image_url"`
		IsSubjectToWhitelist        bool        `json:"is_subject_to_whitelist"`
		LargeImageURL               string      `json:"large_image_url"`
		MediumUsername              interface{} `json:"medium_username"`
		Name                        string      `json:"name"`
		OnlyProxiedTransfers        bool        `json:"only_proxied_transfers"`
		OpenseaBuyerFeeBasisPoints  string      `json:"opensea_buyer_fee_basis_points"`
		OpenseaSellerFeeBasisPoints string      `json:"opensea_seller_fee_basis_points"`
		PayoutAddress               interface{} `json:"payout_address"`
		RequireEmail                bool        `json:"require_email"`
		ShortDescription            interface{} `json:"short_description"`
		Slug                        string      `json:"slug"`
		TelegramURL                 interface{} `json:"telegram_url"`
		TwitterUsername             string      `json:"twitter_username"`
		InstagramUsername           interface{} `json:"instagram_username"`
		WikiURL                     interface{} `json:"wiki_url"`
	} `json:"collection"`
	Decimals      interface{} `json:"decimals"`
	TokenMetadata string      `json:"token_metadata"`
	SellOrders    interface{} `json:"sell_orders"`
	Creator       struct {
		User          interface{}
		ProfileImgUrl string `json:"profile_img_url"`
		Address       string `json:"address"`
		Config        string `json:"config"`
		DiscordID     string `json:"discord_id"`
	} `json:"creator"`
	Traits   []CryptokittiesTraits `json:"traits"`
	LastSale struct {
		Asset struct {
			TokenID  string      `json:"token_id"`
			Decimals interface{} `json:"decimals"`
		} `json:"asset"`
		AssetBundle    interface{} `json:"asset_bundle"`
		EventType      string      `json:"event_type"`
		EventTimestamp string      `json:"event_timestamp"`
		AuctionType    interface{} `json:"auction_type"`
		TotalPrice     string      `json:"total_price"`
		PaymentToken   struct {
			ID       int    `json:"id"`
			Symbol   string `json:"symbol"`
			Address  string `json:"address"`
			ImageURL string `json:"image_url"`
			Name     string `json:"name"`
			Decimals int    `json:"decimals"`
			EthPrice string `json:"eth_price"`
			UsdPrice string `json:"usd_price"`
		} `json:"payment_token"`
		Transaction struct {
			BlockHash   string `json:"block_hash"`
			BlockNumber string `json:"block_number"`
			FromAccount struct {
				User          interface{} `json:"user"`
				ProfileImgURL string      `json:"profile_img_url"`
				Address       string      `json:"address"`
				Config        string      `json:"config"`
				DiscordID     string      `json:"discord_id"`
			} `json:"from_account"`
			ID        int    `json:"id"`
			Timestamp string `json:"timestamp"`
			ToAccount struct {
				User          interface{} `json:"user"`
				ProfileImgURL string      `json:"profile_img_url"`
				Address       string      `json:"address"`
				Config        string      `json:"config"`
				DiscordID     string      `json:"discord_id"`
			} `json:"to_account"`
			TransactionHash  string `json:"transaction_hash"`
			TransactionIndex string `json:"transaction_index"`
		} `json:"transaction"`
		CreatedDate string `json:"created_date"`
		Quantity    string `json:"quantity"`
	} `json:"last_sale"`
	TopBid                  interface{}   `json:"top_bid"`
	ListingDate             interface{}   `json:"listing_date"`
	IsPresale               bool          `json:"is_presale"`
	TransferFeePaymentToken interface{}   `json:"transfer_fee_payment_token"`
	TransferFee             interface{}   `json:"transfer_fee"`
	RelatedAssets           []interface{} `json:"related_assets"`
	Orders                  []interface{} `json:"orders"`
	Auctions                []interface{} `json:"auctions"`
	SupportsWyvern          bool          `json:"supports_wyvern"`
	TopOwnerships           []struct {
		Owner struct {
			User          interface{} `json:"user"`
			ProfileImgURL string      `json:"profile_img_url"`
			Address       string      `json:"address"`
			Config        string      `json:"config"`
			DiscordID     string      `json:"discord_id"`
		} `json:"owner"`
		Quantity string `json:"quantity"`
	} `json:"top_ownerships"`
	Ownership              interface{} `json:"ownership"`
	HighestBuyerCommitment interface{} `json:"highest_buyer_commitment"`
}

type OpenSeaCryptopunkResponse

type OpenSeaCryptopunkResponse struct {
	ID                   int         `json:"id"`
	TokenID              string      `json:"token_id"`
	NumSales             int         `json:"num_sales"`
	BackgroundColor      interface{} `json:"background_color"`
	ImageURL             string      `json:"image_url"`
	ImagePreviewURL      string      `json:"image_preview_url"`
	ImageThumbnailURL    string      `json:"image_thumbnail_url"`
	ImageOriginalURL     string      `json:"image_original_url"`
	AnimationURL         interface{} `json:"animation_url"`
	AnimationOriginalURL interface{} `json:"animation_original_url"`
	Name                 string      `json:"name"`
	Description          interface{} `json:"description"`
	ExternalLink         string      `json:"external_link"`
	AssetContract        struct {
		Address                     string      `json:"address"`
		AssetContractType           string      `json:"asset_contract_type"`
		CreatedDate                 string      `json:"created_date"`
		Name                        string      `json:"name"`
		NftVersion                  string      `json:"nft_version"`
		OpenseaVersion              interface{} `json:"opensea_version"`
		Owner                       interface{} `json:"owner"`
		SchemaName                  string      `json:"schema_name"`
		Symbol                      string      `json:"symbol"`
		TotalSupply                 interface{} `json:"total_supply"`
		Description                 string      `json:"description"`
		ExternalLink                string      `json:"external_link"`
		ImageURL                    string      `json:"image_url"`
		DefaultToFiat               bool        `json:"default_to_fiat"`
		DevBuyerFeeBasisPoints      int         `json:"dev_buyer_fee_basis_points"`
		DevSellerFeeBasisPoints     int         `json:"dev_seller_fee_basis_points"`
		OnlyProxiedTransfers        bool        `json:"only_proxied_transfers"`
		OpenseaBuyerFeeBasisPoints  int         `json:"opensea_buyer_fee_basis_points"`
		OpenseaSellerFeeBasisPoints int         `json:"opensea_seller_fee_basis_points"`
		BuyerFeeBasisPoints         int         `json:"buyer_fee_basis_points"`
		SellerFeeBasisPoints        int         `json:"seller_fee_basis_points"`
		PayoutAddress               interface{} `json:"payout_address"`
	} `json:"asset_contract"`
	Owner struct {
		User          interface{} `json:"user"`
		ProfileImgURL string      `json:"profile_img_url"`
		Address       string      `json:"address"`
		Config        string      `json:"config"`
		DiscordID     string      `json:"discord_id"`
	} `json:"owner"`
	Permalink  string `json:"permalink"`
	Collection struct {
		PaymentTokens []struct {
			ID       int     `json:"id"`
			Symbol   string  `json:"symbol"`
			Address  string  `json:"address"`
			ImageURL string  `json:"image_url"`
			Name     string  `json:"name"`
			Decimals int     `json:"decimals"`
			EthPrice float64 `json:"eth_price"`
			UsdPrice float64 `json:"usd_price"`
		} `json:"payment_tokens"`
		PrimaryAssetContracts []struct {
			Address                     string      `json:"address"`
			AssetContractType           string      `json:"asset_contract_type"`
			CreatedDate                 string      `json:"created_date"`
			Name                        string      `json:"name"`
			NftVersion                  string      `json:"nft_version"`
			OpenseaVersion              interface{} `json:"opensea_version"`
			Owner                       interface{} `json:"owner"`
			SchemaName                  string      `json:"schema_name"`
			Symbol                      string      `json:"symbol"`
			TotalSupply                 interface{} `json:"total_supply"`
			Description                 string      `json:"description"`
			ExternalLink                string      `json:"external_link"`
			ImageURL                    string      `json:"image_url"`
			DefaultToFiat               bool        `json:"default_to_fiat"`
			DevBuyerFeeBasisPoints      int         `json:"dev_buyer_fee_basis_points"`
			DevSellerFeeBasisPoints     int         `json:"dev_seller_fee_basis_points"`
			OnlyProxiedTransfers        bool        `json:"only_proxied_transfers"`
			OpenseaBuyerFeeBasisPoints  int         `json:"opensea_buyer_fee_basis_points"`
			OpenseaSellerFeeBasisPoints int         `json:"opensea_seller_fee_basis_points"`
			BuyerFeeBasisPoints         int         `json:"buyer_fee_basis_points"`
			SellerFeeBasisPoints        int         `json:"seller_fee_basis_points"`
			PayoutAddress               interface{} `json:"payout_address"`
		} `json:"primary_asset_contracts"`
		Traits struct {
		} `json:"traits"`
		Stats struct {
			SevenDayVolume       float64 `json:"seven_day_volume"`
			TotalVolume          float64 `json:"total_volume"`
			SevenDayChange       float64 `json:"seven_day_change"`
			SevenDaySales        float64 `json:"seven_day_sales"`
			TotalSales           float64 `json:"total_sales"`
			TotalSupply          float64 `json:"total_supply"`
			Count                float64 `json:"count"`
			NumOwners            int     `json:"num_owners"`
			SevenDayAveragePrice float64 `json:"seven_day_average_price"`
			AveragePrice         float64 `json:"average_price"`
			NumReports           int     `json:"num_reports"`
			MarketCap            float64 `json:"market_cap"`
		} `json:"stats"`
		BannerImageURL          string      `json:"banner_image_url"`
		ChatURL                 interface{} `json:"chat_url"`
		CreatedDate             string      `json:"created_date"`
		DefaultToFiat           bool        `json:"default_to_fiat"`
		Description             string      `json:"description"`
		DevBuyerFeeBasisPoints  string      `json:"dev_buyer_fee_basis_points"`
		DevSellerFeeBasisPoints string      `json:"dev_seller_fee_basis_points"`
		DiscordURL              string      `json:"discord_url"`
		DisplayData             struct {
			CardDisplayStyle string `json:"card_display_style"`
		} `json:"display_data"`
		ExternalURL                 string      `json:"external_url"`
		Featured                    bool        `json:"featured"`
		FeaturedImageURL            string      `json:"featured_image_url"`
		Hidden                      bool        `json:"hidden"`
		SafelistRequestStatus       string      `json:"safelist_request_status"`
		ImageURL                    string      `json:"image_url"`
		IsSubjectToWhitelist        bool        `json:"is_subject_to_whitelist"`
		LargeImageURL               string      `json:"large_image_url"`
		MediumUsername              interface{} `json:"medium_username"`
		Name                        string      `json:"name"`
		OnlyProxiedTransfers        bool        `json:"only_proxied_transfers"`
		OpenseaBuyerFeeBasisPoints  string      `json:"opensea_buyer_fee_basis_points"`
		OpenseaSellerFeeBasisPoints string      `json:"opensea_seller_fee_basis_points"`
		PayoutAddress               interface{} `json:"payout_address"`
		RequireEmail                bool        `json:"require_email"`
		ShortDescription            interface{} `json:"short_description"`
		Slug                        string      `json:"slug"`
		TelegramURL                 interface{} `json:"telegram_url"`
		TwitterUsername             string      `json:"twitter_username"`
		InstagramUsername           interface{} `json:"instagram_username"`
		WikiURL                     interface{} `json:"wiki_url"`
	} `json:"collection"`
	Decimals      interface{}        `json:"decimals"`
	TokenMetadata string             `json:"token_metadata"`
	SellOrders    interface{}        `json:"sell_orders"`
	Creator       interface{}        `json:"creator"`
	Traits        []CryptopunkTraits `json:"traits"`
	LastSale      struct {
		Asset struct {
			TokenID  string      `json:"token_id"`
			Decimals interface{} `json:"decimals"`
		} `json:"asset"`
		AssetBundle    interface{} `json:"asset_bundle"`
		EventType      string      `json:"event_type"`
		EventTimestamp string      `json:"event_timestamp"`
		AuctionType    interface{} `json:"auction_type"`
		TotalPrice     string      `json:"total_price"`
		PaymentToken   struct {
			ID       int    `json:"id"`
			Symbol   string `json:"symbol"`
			Address  string `json:"address"`
			ImageURL string `json:"image_url"`
			Name     string `json:"name"`
			Decimals int    `json:"decimals"`
			EthPrice string `json:"eth_price"`
			UsdPrice string `json:"usd_price"`
		} `json:"payment_token"`
		Transaction struct {
			BlockHash   string `json:"block_hash"`
			BlockNumber string `json:"block_number"`
			FromAccount struct {
				User          interface{} `json:"user"`
				ProfileImgURL string      `json:"profile_img_url"`
				Address       string      `json:"address"`
				Config        string      `json:"config"`
				DiscordID     string      `json:"discord_id"`
			} `json:"from_account"`
			ID        int    `json:"id"`
			Timestamp string `json:"timestamp"`
			ToAccount struct {
				User          interface{} `json:"user"`
				ProfileImgURL string      `json:"profile_img_url"`
				Address       string      `json:"address"`
				Config        string      `json:"config"`
				DiscordID     string      `json:"discord_id"`
			} `json:"to_account"`
			TransactionHash  string `json:"transaction_hash"`
			TransactionIndex string `json:"transaction_index"`
		} `json:"transaction"`
		CreatedDate string `json:"created_date"`
		Quantity    string `json:"quantity"`
	} `json:"last_sale"`
	TopBid                  interface{}   `json:"top_bid"`
	ListingDate             interface{}   `json:"listing_date"`
	IsPresale               bool          `json:"is_presale"`
	TransferFeePaymentToken interface{}   `json:"transfer_fee_payment_token"`
	TransferFee             interface{}   `json:"transfer_fee"`
	RelatedAssets           []interface{} `json:"related_assets"`
	Orders                  []interface{} `json:"orders"`
	Auctions                []interface{} `json:"auctions"`
	SupportsWyvern          bool          `json:"supports_wyvern"`
	TopOwnerships           []struct {
		Owner struct {
			User          interface{} `json:"user"`
			ProfileImgURL string      `json:"profile_img_url"`
			Address       string      `json:"address"`
			Config        string      `json:"config"`
			DiscordID     string      `json:"discord_id"`
		} `json:"owner"`
		Quantity string `json:"quantity"`
	} `json:"top_ownerships"`
	Ownership              interface{} `json:"ownership"`
	HighestBuyerCommitment interface{} `json:"highest_buyer_commitment"`
}

type OpenSeaResponse

type OpenSeaResponse struct {
	ID                   int         `json:"id"`
	TokenID              string      `json:"token_id"`
	NumSales             int         `json:"num_sales"`
	BackgroundColor      string      `json:"background_color"`
	ImageURL             string      `json:"image_url"`
	ImagePreviewURL      string      `json:"image_preview_url"`
	ImageThumbnailURL    string      `json:"image_thumbnail_url"`
	ImageOriginalURL     string      `json:"image_original_url"`
	AnimationURL         interface{} `json:"animation_url"`
	AnimationOriginalURL interface{} `json:"animation_original_url"`
	Name                 string      `json:"name"`
	Description          string      `json:"description"`
	ExternalLink         string      `json:"external_link"`
	AssetContract        struct {
		Address                     string      `json:"address"`
		AssetContractType           string      `json:"asset_contract_type"`
		CreatedDate                 string      `json:"created_date"`
		Name                        string      `json:"name"`
		NftVersion                  string      `json:"nft_version"`
		OpenseaVersion              interface{} `json:"opensea_version"`
		Owner                       int         `json:"owner"`
		SchemaName                  string      `json:"schema_name"`
		Symbol                      string      `json:"symbol"`
		TotalSupply                 interface{} `json:"total_supply"`
		Description                 string      `json:"description"`
		ExternalLink                string      `json:"external_link"`
		ImageURL                    string      `json:"image_url"`
		DefaultToFiat               bool        `json:"default_to_fiat"`
		DevBuyerFeeBasisPoints      int         `json:"dev_buyer_fee_basis_points"`
		DevSellerFeeBasisPoints     int         `json:"dev_seller_fee_basis_points"`
		OnlyProxiedTransfers        bool        `json:"only_proxied_transfers"`
		OpenseaBuyerFeeBasisPoints  int         `json:"opensea_buyer_fee_basis_points"`
		OpenseaSellerFeeBasisPoints int         `json:"opensea_seller_fee_basis_points"`
		BuyerFeeBasisPoints         int         `json:"buyer_fee_basis_points"`
		SellerFeeBasisPoints        int         `json:"seller_fee_basis_points"`
		PayoutAddress               string      `json:"payout_address"`
	} `json:"asset_contract"`
	Owner struct {
		User          interface{} `json:"user"`
		ProfileImgURL string      `json:"profile_img_url"`
		Address       string      `json:"address"`
		Config        string      `json:"config"`
		DiscordID     string      `json:"discord_id"`
	} `json:"owner"`
	Permalink  string `json:"permalink"`
	Collection struct {
		PaymentTokens []struct {
			ID       int     `json:"id"`
			Symbol   string  `json:"symbol"`
			Address  string  `json:"address"`
			ImageURL string  `json:"image_url"`
			Name     string  `json:"name"`
			Decimals int     `json:"decimals"`
			EthPrice float64 `json:"eth_price"`
			UsdPrice float64 `json:"usd_price"`
		} `json:"payment_tokens"`
		PrimaryAssetContracts []struct {
			Address                     string      `json:"address"`
			AssetContractType           string      `json:"asset_contract_type"`
			CreatedDate                 string      `json:"created_date"`
			Name                        string      `json:"name"`
			NftVersion                  string      `json:"nft_version"`
			OpenseaVersion              interface{} `json:"opensea_version"`
			Owner                       int         `json:"owner"`
			SchemaName                  string      `json:"schema_name"`
			Symbol                      string      `json:"symbol"`
			TotalSupply                 interface{} `json:"total_supply"`
			Description                 string      `json:"description"`
			ExternalLink                string      `json:"external_link"`
			ImageURL                    string      `json:"image_url"`
			DefaultToFiat               bool        `json:"default_to_fiat"`
			DevBuyerFeeBasisPoints      int         `json:"dev_buyer_fee_basis_points"`
			DevSellerFeeBasisPoints     int         `json:"dev_seller_fee_basis_points"`
			OnlyProxiedTransfers        bool        `json:"only_proxied_transfers"`
			OpenseaBuyerFeeBasisPoints  int         `json:"opensea_buyer_fee_basis_points"`
			OpenseaSellerFeeBasisPoints int         `json:"opensea_seller_fee_basis_points"`
			BuyerFeeBasisPoints         int         `json:"buyer_fee_basis_points"`
			SellerFeeBasisPoints        int         `json:"seller_fee_basis_points"`
			PayoutAddress               string      `json:"payout_address"`
		} `json:"primary_asset_contracts"`
		Traits struct {
			XP struct {
				Min int `json:"min"`
				Max int `json:"max"`
			} `json:"XP"`
			PrintDate struct {
				Min float64 `json:"min"`
				Max float64 `json:"max"`
			} `json:"print_date"`
			Power struct {
				Min float64 `json:"min"`
				Max float64 `json:"max"`
			} `json:"power"`
			SerialNumber struct {
				Min int `json:"min"`
				Max int `json:"max"`
			} `json:"serial_number"`
			Level struct {
				Min int `json:"min"`
				Max int `json:"max"`
			} `json:"level"`
		} `json:"traits"`
		Stats struct {
			SevenDayVolume       float64 `json:"seven_day_volume"`
			TotalVolume          float64 `json:"total_volume"`
			SevenDayChange       float64 `json:"seven_day_change"`
			SevenDaySales        float64 `json:"seven_day_sales"`
			TotalSales           float64 `json:"total_sales"`
			TotalSupply          float64 `json:"total_supply"`
			Count                float64 `json:"count"`
			NumOwners            int     `json:"num_owners"`
			SevenDayAveragePrice float64 `json:"seven_day_average_price"`
			AveragePrice         float64 `json:"average_price"`
			NumReports           int     `json:"num_reports"`
			MarketCap            float64 `json:"market_cap"`
		} `json:"stats"`
		BannerImageURL string `json:"banner_image_url"`
		ChatURL        string `json:"chat_url"`
		CreatedDate    string `json:"created_date"`
		DefaultToFiat  bool   `json:"default_to_fiat"`
		Description    string `json:"description"`
		DisplayData    struct {
			CardDisplayStyle string `json:"card_display_style"`
		} `json:"display_data"`
		ExternalURL                 string      `json:"external_url"`
		Featured                    bool        `json:"featured"`
		FeaturedImageURL            interface{} `json:"featured_image_url"`
		Hidden                      bool        `json:"hidden"`
		SafelistRequestStatus       string      `json:"safelist_request_status"`
		ImageURL                    string      `json:"image_url"`
		IsSubjectToWhitelist        bool        `json:"is_subject_to_whitelist"`
		LargeImageURL               string      `json:"large_image_url"`
		MediumUsername              interface{} `json:"medium_username"`
		Name                        string      `json:"name"`
		OnlyProxiedTransfers        bool        `json:"only_proxied_transfers"`
		OpenseaBuyerFeeBasisPoints  string      `json:"opensea_buyer_fee_basis_points"`
		OpenseaSellerFeeBasisPoints string      `json:"opensea_seller_fee_basis_points"`
		PayoutAddress               string      `json:"payout_address"`
		RequireEmail                bool        `json:"require_email"`
		ShortDescription            interface{} `json:"short_description"`
		Slug                        string      `json:"slug"`
		TelegramURL                 string      `json:"telegram_url"`
		TwitterUsername             string      `json:"twitter_username"`
		InstagramUsername           interface{} `json:"instagram_username"`
		WikiURL                     interface{} `json:"wiki_url"`
	} `json:"collection"`
	Decimals   int         `json:"decimals"`
	SellOrders interface{} `json:"sell_orders"`
	Creator    struct {
		User struct {
			Username string `json:"username"`
		} `json:"user"`
		ProfileImgURL string `json:"profile_img_url"`
		Address       string `json:"address"`
		Config        string `json:"config"`
		DiscordID     string `json:"discord_id"`
	} `json:"creator"`
	Traits                  []SorareTrait `json:"traits"`
	LastSale                interface{}   `json:"last_sale"`
	TopBid                  interface{}   `json:"top_bid"`
	ListingDate             interface{}   `json:"listing_date"`
	IsPresale               bool          `json:"is_presale"`
	TransferFeePaymentToken interface{}   `json:"transfer_fee_payment_token"`
	TransferFee             interface{}   `json:"transfer_fee"`
	RelatedAssets           []interface{} `json:"related_assets"`
	Orders                  []interface{} `json:"orders"`
	Auctions                []interface{} `json:"auctions"`
	SupportsWyvern          bool          `json:"supports_wyvern"`
	TopOwnerships           []struct {
		Owner struct {
			User          interface{} `json:"user"`
			ProfileImgURL string      `json:"profile_img_url"`
			Address       string      `json:"address"`
			Config        string      `json:"config"`
			DiscordID     string      `json:"discord_id"`
		} `json:"owner"`
		Quantity string `json:"quantity"`
	} `json:"top_ownerships"`
	Ownership              interface{} `json:"ownership"`
	HighestBuyerCommitment interface{} `json:"highest_buyer_commitment"`
}

type Play

type Play struct {
	SeriesID   uint32
	SetID      uint32
	PlayID     uint32
	SetName    string
	Attributes map[string]interface{}
}

type SorareCard

type SorareCard struct {
	PlayerId     *big.Int
	Season       uint16
	Scarcity     *big.Int
	SerialNumber uint16
	Metadata     []byte
	ClubId       uint16
}

type SorareClub

type SorareClub struct {
	Name        string
	Country     string
	City        string
	YearFounded uint16
}

type SorareOutput

type SorareOutput struct {
	Card   SorareCard    `structs:",flatten"`
	Player SorarePlayer  `structs:",flatten"`
	Club   Club          `structs:",flatten"`
	Traits []SorareTrait `structs:",flatten"`
}

type SorarePlayer

type SorarePlayer struct {
	Name         string
	YearOfBirth  uint16
	MonthOfBirth uint8
	DayOfBirth   uint8
}

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

func (scraper *SorareScraper) FetchData() error

func (*SorareScraper) GetCard

func (scraper *SorareScraper) GetCard(index *big.Int) (SorareCard, error)

GetCard returns data for a given card from on-chain.

func (*SorareScraper) GetClub

func (scraper *SorareScraper) GetClub(index uint16) (SorareClub, error)

GetClub returns data for a given club from on-chain.

func (*SorareScraper) GetDataChannel

func (scraper *SorareScraper) GetDataChannel() chan dia.NFT

GetDataChannel returns the scrapers data channel.

func (*SorareScraper) GetOpenSeaPlayer

func (scraper *SorareScraper) GetOpenSeaPlayer(index *big.Int) ([]SorareTrait, common.Address, time.Time, error)

GetOpenSeaPlayer returns the scraped data from Opensea for a given player

func (*SorareScraper) GetPlayer

func (scraper *SorareScraper) GetPlayer(index *big.Int) (SorarePlayer, error)

GetPlayer returns data for a given player from on-chain.

func (*SorareScraper) GetTokenURI

func (scraper *SorareScraper) GetTokenURI(index *big.Int) (string, error)

GetTokenURI returns the token URI.

func (*SorareScraper) GetTotalSupply

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

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

func (*SorareScraper) TokenByIndex

func (scraper *SorareScraper) TokenByIndex(index *big.Int) (*big.Int, error)

TokenByIndex returns the token address from on-chain.

type SorareTrait

type SorareTrait struct {
	TraitType   string      `json:"trait_type"`
	Value       interface{} `json:"value"`
	DisplayType interface{} `json:"display_type"`
	MaxValue    interface{} `json:"max_value"`
	TraitCount  int         `json:"trait_count"`
	Order       interface{} `json:"order"`
}

func GetPlayerTraits

func GetPlayerTraits(playerResp []byte) ([]SorareTrait, error)

GetPlayerTraits returns the parsed traits data from Opensea for a given player

Jump to

Keyboard shortcuts

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