opensea

package
v0.138.2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const AssetLimit = 200
View Source
const ChainIDRequiringAPIKey = 1
View Source
const CollectionLimit = 300
View Source
const RequestRetryMaxCount = 1
View Source
const RequestWaitTime = 300 * time.Millisecond

Variables

View Source
var BaseURLs = map[uint64]string{
	1: "https://api.opensea.io/api/v1",
	4: "https://rinkeby-api.opensea.io/api/v1",
	5: "https://testnets-api.opensea.io/api/v1",
}
View Source
var OpenseaClientInstances = make(map[uint64]*Client)

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID                int            `json:"id"`
	TokenID           *bigint.BigInt `json:"token_id"`
	Name              string         `json:"name"`
	Description       string         `json:"description"`
	Permalink         string         `json:"permalink"`
	ImageThumbnailURL string         `json:"image_thumbnail_url"`
	ImageURL          string         `json:"image_url"`
	Contract          Contract       `json:"asset_contract"`
	Collection        Collection     `json:"collection"`
	Traits            []Trait        `json:"traits"`
	LastSale          LastSale       `json:"last_sale"`
	SellOrders        []SellOrder    `json:"sell_orders"`
	BackgroundColor   string         `json:"background_color"`
}

type AssetContainer

type AssetContainer struct {
	Assets         []Asset `json:"assets"`
	NextCursor     string  `json:"next"`
	PreviousCursor string  `json:"previous"`
}

type Client

type Client struct {
	IsConnected     bool
	LastCheckedAt   int64
	IsConnectedLock sync.RWMutex
	// contains filtered or unexported fields
}

func NewOpenseaClient

func NewOpenseaClient(chainID uint64, apiKey string) (*Client, error)

new opensea client.

func (*Client) FetchAllAssetsByOwner added in v0.138.1

func (o *Client) FetchAllAssetsByOwner(owner common.Address, cursor string, limit int) (*AssetContainer, error)

func (*Client) FetchAllAssetsByOwnerAndCollection

func (o *Client) FetchAllAssetsByOwnerAndCollection(owner common.Address, collectionSlug string, cursor string, limit int) (*AssetContainer, error)

func (*Client) FetchAllCollectionsByOwner

func (o *Client) FetchAllCollectionsByOwner(owner common.Address) ([]OwnedCollection, error)

func (*Client) FetchAssetsByNFTUniqueID added in v0.137.2

func (o *Client) FetchAssetsByNFTUniqueID(uniqueIDs []NFTUniqueID, limit int) (*AssetContainer, error)

type Collection

type Collection struct {
	Name     string                     `json:"name"`
	Slug     string                     `json:"slug"`
	ImageURL string                     `json:"image_url"`
	Traits   map[string]CollectionTrait `json:"traits"`
}

type CollectionTrait

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

type Contract

type Contract struct {
	Address string `json:"address"`
}

type LastSale

type LastSale struct {
	PaymentToken PaymentToken `json:"payment_token"`
}

type NFTUniqueID added in v0.137.2

type NFTUniqueID struct {
	ContractAddress common.Address `json:"contractAddress"`
	TokenID         bigint.BigInt  `json:"tokenID"`
}

type OwnedCollection added in v0.137.2

type OwnedCollection struct {
	Collection
	OwnedAssetCount *bigint.BigInt `json:"owned_asset_count"`
}

type PaymentToken

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

type SellOrder

type SellOrder struct {
	CurrentPrice string `json:"current_price"`
}

type Trait

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

type TraitValue

type TraitValue string

func (*TraitValue) UnmarshalJSON

func (st *TraitValue) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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