nftdatascrapers

package
v1.0.1-tekton-ci-beta-4 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCreationTime

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

GetCreatorAddress returns the creation time from Opensea

func GetCreatorAddress

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

GetCreatorAddress returns the creator address from Opensea

Types

type NFTDataScraper

type NFTDataScraper interface {
	GetDataChannel() chan dia.NFT
	FetchData() ([]dia.NFT, error)
}

type NFTScraper

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

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 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
	Player SorarePlayer
	Club   SorareClub
	Traits []SorareTrait
}

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() (nfts []dia.NFT, err 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)

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

func (*SorareScraper) UpdateNFT

func (scraper *SorareScraper) UpdateNFT() error

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