thirdparty

package
v0.180.29 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const FetchFromAnyProvider = ""
View Source
const FetchFromStartCursor = ""
View Source
const FetchNoLimit = 0

Variables

View Source
var (
	ErrChainIDNotSupported  = errors.New("chainID not supported")
	ErrEndpointNotSupported = errors.New("endpoint not supported")
)

Functions

func GenerateTestCommunityInfo added in v0.171.37

func GenerateTestCommunityInfo(count int) map[string]CommunityInfo

func GroupCollectibleUIDsByChainID added in v0.162.13

func GroupCollectibleUIDsByChainID(uids []CollectibleUniqueID) map[w_common.ChainID][]CollectibleUniqueID

func GroupCollectiblesByChainID added in v0.176.5

func GroupCollectiblesByChainID(collectibles []*FullCollectibleData) map[w_common.ChainID][]*FullCollectibleData

func GroupCollectiblesByChainIDAndContractAddress added in v0.176.5

func GroupCollectiblesByChainIDAndContractAddress(collectibles []*FullCollectibleData) map[w_common.ChainID]map[common.Address][]*FullCollectibleData

func GroupCollectiblesByContractAddress added in v0.176.5

func GroupCollectiblesByContractAddress(collectibles []*FullCollectibleData) map[common.Address][]*FullCollectibleData

func GroupContractIDsByChainID added in v0.162.15

func GroupContractIDsByChainID(ids []ContractID) map[w_common.ChainID][]ContractID

Types

type AccountBalance added in v0.171.35

type AccountBalance struct {
	Address     common.Address `json:"address"`
	Balance     *bigint.BigInt `json:"balance"`
	TxTimestamp int64          `json:"txTimestamp"`
}

func GenerateTestCollectiblesOwnership added in v0.171.37

func GenerateTestCollectiblesOwnership(count int) []AccountBalance

type CollectibleAccountOwnershipProvider added in v0.162.15

type CollectibleAccountOwnershipProvider interface {
	CollectibleProvider
	FetchAllAssetsByOwner(ctx context.Context, chainID w_common.ChainID, owner common.Address, cursor string, limit int) (*FullCollectibleDataContainer, error)
	FetchAllAssetsByOwnerAndContractAddress(ctx context.Context, chainID w_common.ChainID, owner common.Address, contractAddresses []common.Address, cursor string, limit int) (*FullCollectibleDataContainer, error)
}

type CollectibleCommunityInfo added in v0.171.8

type CollectibleCommunityInfo struct {
	PrivilegesLevel token.PrivilegesLevel `json:"privileges_level"`
}

Community-related collectible info. Present only for collectibles minted in a community.

func GenerateTestCollectiblesCommunityData added in v0.171.37

func GenerateTestCollectiblesCommunityData(count int) []CollectibleCommunityInfo

type CollectibleContractOwnership added in v0.162.13

type CollectibleContractOwnership struct {
	ContractAddress common.Address     `json:"contractAddress"`
	Owners          []CollectibleOwner `json:"owners"`
}

type CollectibleContractOwnershipProvider added in v0.162.13

type CollectibleContractOwnershipProvider interface {
	CollectibleProvider
	FetchCollectibleOwnersByContractAddress(ctx context.Context, chainID w_common.ChainID, contractAddress common.Address) (*CollectibleContractOwnership, error)
}

type CollectibleData added in v0.162.13

type CollectibleData struct {
	ID                 CollectibleUniqueID   `json:"id"`
	ContractType       w_common.ContractType `json:"contract_type"`
	CommunityID        string                `json:"community_id"`
	Provider           string                `json:"provider"`
	Name               string                `json:"name"`
	Description        string                `json:"description"`
	Permalink          string                `json:"permalink"`
	ImageURL           string                `json:"image_url"`
	ImagePayload       []byte
	AnimationURL       string             `json:"animation_url"`
	AnimationMediaType string             `json:"animation_media_type"`
	Traits             []CollectibleTrait `json:"traits"`
	BackgroundColor    string             `json:"background_color"`
	TokenURI           string             `json:"token_uri"`
	IsFirst            bool               `json:"is_first"`
	Soulbound          bool               `json:"soulbound"`
}

Collectible info

func GenerateTestCollectiblesData added in v0.171.37

func GenerateTestCollectiblesData(count int) (result []CollectibleData)

type CollectibleDataContainer added in v0.162.13

type CollectibleDataContainer CollectiblesContainer[CollectibleData]

type CollectibleDataProvider added in v0.162.15

type CollectibleDataProvider interface {
	CollectibleProvider
	FetchAssetsByCollectibleUniqueID(ctx context.Context, uniqueIDs []CollectibleUniqueID) ([]FullCollectibleData, error)
	FetchCollectionSocials(ctx context.Context, contractID ContractID) (*CollectionSocials, error)
}

type CollectibleIDBalance added in v0.176.5

type CollectibleIDBalance struct {
	ID      CollectibleUniqueID `json:"id"`
	Balance *bigint.BigInt      `json:"balance"`
}

type CollectibleOwner added in v0.162.13

type CollectibleOwner struct {
	OwnerAddress  common.Address `json:"ownerAddress"`
	TokenBalances []TokenBalance `json:"tokenBalances"`
}

type CollectibleOwnershipContainer added in v0.162.13

type CollectibleOwnershipContainer CollectiblesContainer[CollectibleIDBalance]

type CollectibleProvider added in v0.162.15

type CollectibleProvider interface {
	ID() string
	IsChainSupported(chainID w_common.ChainID) bool
	IsConnected() bool
}

type CollectibleProviders added in v0.177.0

type CollectibleProviders struct {
	ContractOwnershipProviders []CollectibleContractOwnershipProvider
	AccountOwnershipProviders  []CollectibleAccountOwnershipProvider
	CollectibleDataProviders   []CollectibleDataProvider
	CollectionDataProviders    []CollectionDataProvider
	SearchProviders            []CollectibleSearchProvider
}

func (*CollectibleProviders) GetProviderList added in v0.177.0

func (p *CollectibleProviders) GetProviderList() []CollectibleProvider

type CollectibleSearchProvider added in v0.177.0

type CollectibleSearchProvider interface {
	CollectibleProvider
	SearchCollections(ctx context.Context, chainID w_common.ChainID, text string, cursor string, limit int) (*CollectionDataContainer, error)
	SearchCollectibles(ctx context.Context, chainID w_common.ChainID, collections []common.Address, text string, cursor string, limit int) (*FullCollectibleDataContainer, error)
}

type CollectibleTrait added in v0.162.13

type CollectibleTrait struct {
	TraitType   string `json:"trait_type"`
	Value       string `json:"value"`
	DisplayType string `json:"display_type"`
	MaxValue    string `json:"max_value"`
}

type CollectibleUniqueID added in v0.162.13

type CollectibleUniqueID struct {
	ContractID ContractID     `json:"contractID"`
	TokenID    *bigint.BigInt `json:"tokenID"`
}

func RowsToCollectibles added in v0.167.5

func RowsToCollectibles(rows *sql.Rows) ([]CollectibleUniqueID, error)

func (*CollectibleUniqueID) HashKey added in v0.162.13

func (k *CollectibleUniqueID) HashKey() string

func (*CollectibleUniqueID) Same added in v0.166.7

type CollectiblesContainer added in v0.162.15

type CollectiblesContainer[T any] struct {
	Items          []T
	NextCursor     string
	PreviousCursor string
	Provider       string
}

type CollectionData added in v0.162.13

type CollectionData struct {
	ID           ContractID            `json:"id"`
	ContractType w_common.ContractType `json:"contract_type"`
	CommunityID  string                `json:"community_id"`
	Provider     string                `json:"provider"`
	Name         string                `json:"name"`
	Slug         string                `json:"slug"`
	ImageURL     string                `json:"image_url"`
	ImagePayload []byte
	Traits       map[string]CollectionTrait `json:"traits"`
	Socials      *CollectionSocials         `json:"socials"`
}

Collection info

func GenerateTestCollectionsData added in v0.171.37

func GenerateTestCollectionsData(count int) (result []CollectionData)

type CollectionDataContainer added in v0.162.15

type CollectionDataContainer CollectiblesContainer[CollectionData]

type CollectionDataProvider added in v0.163.14

type CollectionDataProvider interface {
	CollectibleProvider
	FetchCollectionsDataByContractID(ctx context.Context, ids []ContractID) ([]CollectionData, error)
}

type CollectionSocials added in v0.179.17

type CollectionSocials struct {
	Website       string `json:"website"`
	TwitterHandle string `json:"twitter_handle"`
	Provider      string `json:"provider"`
}

type CollectionTrait added in v0.162.13

type CollectionTrait struct {
	Min float64 `json:"min"`
	Max float64 `json:"max"`
}

type CommunityInfo added in v0.171.8

type CommunityInfo struct {
	CommunityName         string `json:"community_name"`
	CommunityColor        string `json:"community_color"`
	CommunityImage        string `json:"community_image"`
	CommunityImagePayload []byte
}

Community-related info used by the wallet, cached in the wallet db.

type CommunityInfoProvider added in v0.171.8

type CommunityInfoProvider interface {
	FetchCommunityInfo(communityID string) (*CommunityInfo, error)

	// Collectible-related methods
	GetCommunityID(tokenURI string) string
	FillCollectiblesMetadata(communityID string, cs []*FullCollectibleData) (bool, error)
}

type ContractID added in v0.162.15

type ContractID struct {
	ChainID w_common.ChainID `json:"chainID"`
	Address common.Address   `json:"address"`
}

func (*ContractID) HashKey added in v0.162.15

func (k *ContractID) HashKey() string

type DataParsed added in v0.159.2

type DataParsed struct {
	Name      string            `json:"name"`
	ID        string            `json:"id"`
	Inputs    map[string]string `json:"inputs"`
	Signature string            `json:"signature"`
}

type DecoderProvider added in v0.159.2

type DecoderProvider interface {
	Run(data string) (*DataParsed, error)
}

type FullCollectibleData added in v0.162.15

type FullCollectibleData struct {
	CollectibleData          CollectibleData
	CollectionData           *CollectionData
	CommunityInfo            *CommunityInfo
	CollectibleCommunityInfo *CollectibleCommunityInfo
	Ownership                []AccountBalance // This is a list of all the owners of the collectible
	AccountBalance           *bigint.BigInt   // This is the balance of the collectible for the requested account
}

Combined Collection+Collectible info returned by the CollectibleProvider Some providers may not return the CollectionData in the same API call, so it's optional

func GenerateTestFullCollectiblesData added in v0.171.37

func GenerateTestFullCollectiblesData(count int) []FullCollectibleData

type FullCollectibleDataContainer added in v0.162.15

type FullCollectibleDataContainer CollectiblesContainer[FullCollectibleData]

func (*FullCollectibleDataContainer) ToOwnershipContainer added in v0.162.15

type HTTPClient added in v0.179.22

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

func NewHTTPClient added in v0.179.22

func NewHTTPClient() *HTTPClient

func (*HTTPClient) DoGetRequest added in v0.179.22

func (c *HTTPClient) DoGetRequest(ctx context.Context, url string, params netUrl.Values) ([]byte, error)

func (*HTTPClient) DoPostRequest added in v0.179.22

func (c *HTTPClient) DoPostRequest(ctx context.Context, url string, params map[string]interface{}) ([]byte, error)

type HistoricalPrice added in v0.133.2

type HistoricalPrice struct {
	Timestamp int64   `json:"time"`
	Value     float64 `json:"close"`
}

type MarketDataProvider added in v0.133.2

type MarketDataProvider interface {
	FetchPrices(symbols []string, currencies []string) (map[string]map[string]float64, error)
	FetchHistoricalDailyPrices(symbol string, currency string, limit int, allData bool, aggregate int) ([]HistoricalPrice, error)
	FetchHistoricalHourlyPrices(symbol string, currency string, limit int, aggregate int) ([]HistoricalPrice, error)
	FetchTokenMarketValues(symbols []string, currency string) (map[string]TokenMarketValues, error)
	FetchTokenDetails(symbols []string) (map[string]TokenDetails, error)
}

type TokenBalance added in v0.146.3

type TokenBalance struct {
	TokenID *bigint.BigInt `json:"tokenId"`
	Balance *bigint.BigInt `json:"balance"`
}

type TokenBalancesPerContractAddress added in v0.162.5

type TokenBalancesPerContractAddress = map[common.Address][]TokenBalance

type TokenDetails added in v0.133.2

type TokenDetails struct {
	ID                   string  `json:"Id"`
	Name                 string  `json:"Name"`
	Symbol               string  `json:"Symbol"`
	Description          string  `json:"Description"`
	TotalCoinsMined      float64 `json:"TotalCoinsMined"`
	AssetLaunchDate      string  `json:"AssetLaunchDate"`
	AssetWhitepaperURL   string  `json:"AssetWhitepaperUrl"`
	AssetWebsiteURL      string  `json:"AssetWebsiteUrl"`
	BuiltOn              string  `json:"BuiltOn"`
	SmartContractAddress string  `json:"SmartContractAddress"`
}

type TokenMarketValues added in v0.133.2

type TokenMarketValues struct {
	MKTCAP          float64 `json:"MKTCAP"`
	HIGHDAY         float64 `json:"HIGHDAY"`
	LOWDAY          float64 `json:"LOWDAY"`
	CHANGEPCTHOUR   float64 `json:"CHANGEPCTHOUR"`
	CHANGEPCTDAY    float64 `json:"CHANGEPCTDAY"`
	CHANGEPCT24HOUR float64 `json:"CHANGEPCT24HOUR"`
	CHANGE24HOUR    float64 `json:"CHANGE24HOUR"`
}

Directories

Path Synopsis
nolint: misspell
nolint: misspell

Jump to

Keyboard shortcuts

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