openseaapi

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

README

openseaapi

An SDK for OpenSea API.

Supported API

NFT Endpoints
Analytics Endpoints
OpenSea Marketplace Endpoints

Getting Started

Get it
go get -u github.com/reedchan7/openseaapi
Examples
cli := NewClient(
	WithApiKey(os.Getenv("OPENSEA_API_KEY")),
)

// Get account on mainnet by wallet address
resp, err := cli.GetAccount(ctx, addr)

// Get account on goerli testnet by wallet address
resp, err := cli.GetAccount(ctx, addr,UseTestnets())

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OptionFn

type OptionFn func(*options)

func EnableVerbose

func EnableVerbose() OptionFn

func WithApiKey

func WithApiKey(key string) OptionFn

func WithHost added in v0.9.4

func WithHost(host map[string]string) OptionFn

func WithTimeout

func WithTimeout(timeout time.Duration) OptionFn

type Payloader added in v0.9.5

type Payloader interface {
	Validate() error
	ToQuery() url.Values
}

type RequestOptionFn

type RequestOptionFn func(*requestOptions)

func UseTestnets

func UseTestnets() RequestOptionFn

type Servicer

type Servicer interface {

	// GetAccount gets an OpenSea Account Profile including details such as bio, social media usernames, and profile image.
	GetAccount(ctx context.Context, address common.Address,
		opts ...RequestOptionFn) (resp *openseamodels.Account, err error)
	// ListNftsByAccount gets NFTs owned by a given account address.
	ListNftsByAccount(ctx context.Context, ch chain.Chain,
		payload *openseamodels.GetNftsByAccountPayload) (resp *openseamodels.NftsResponse, err error)
	// GetContract gets a smart contract for a given chain and address.
	GetContract(ctx context.Context, ch chain.Chain, address common.Address) (
		resp *openseamodels.Contract, err error)
	// ListNftsByContract gets multiple NFTs for a smart contract.
	ListNftsByContract(ctx context.Context, ch chain.Chain,
		payload *openseamodels.GetNftsByContractPayload) (resp *openseamodels.NftsResponse, err error)
	// GetNft gets metadata, traits, ownership information, and rarity for a single NFT.
	GetNft(ctx context.Context, ch chain.Chain,
		payload *openseamodels.GetNftPayload) (resp *openseamodels.NftResponse, err error)
	// RefreshNftMetadata refreshes metadata for a single NFT.
	RefreshNftMetadata(ctx context.Context,
		ch chain.Chain, address common.Address, identifier string) error
	// ListNftsByCollection gets multiple NFTs for a collection.
	ListNftsByCollection(ctx context.Context, payload *openseamodels.CollectionPayload,
		opts ...RequestOptionFn) (resp *openseamodels.NftsResponse, err error)
	// ListCollections gets a list of OpenSea collections.
	ListCollections(ctx context.Context, payload *openseamodels.ListCollectionsPayload) (
		resp *openseamodels.CollectionsResponse, err error)
	// GetCollection gets a single collection including details such as fees, traits, and links.
	GetCollection(ctx context.Context, collectionSlug string, opts ...RequestOptionFn) (
		resp *openseamodels.SingleCollection, err error)
	// GetTraits gets the traits in a collection.
	GetTraits(ctx context.Context, collectionSlug string, opts ...RequestOptionFn) (
		resp *openseamodels.Trait, err error)

	// GetCollectionStats gets stats for a single collection.
	GetCollectionStats(ctx context.Context, collectionSlug string, opts ...RequestOptionFn) (
		resp *openseamodels.CollectionStats, err error)
	// ListEventsByAccount gets a list of events for an account. The list will be paginated and include up to 100 events per page.
	ListEventsByAccount(ctx context.Context, payload *openseamodels.GetEventsByAccountPayload,
		opts ...RequestOptionFn) (resp *openseamodels.AssetEventResponse, err error)
	// ListEventsByNft gets a list of events for a single NFT. The list will be paginated and include up to 100 events per page.
	ListEventsByNft(ctx context.Context,
		payload *openseamodels.GetEventsByNftPayload) (resp *openseamodels.AssetEventResponse, err error)
	// ListEventsByCollection gets a list of events for a collection.
	// The list will be paginated and include up to 100 events per page.
	ListEventsByCollection(ctx context.Context, payload *openseamodels.GetEventsByCollectionPayload,
		opts ...RequestOptionFn) (resp *openseamodels.AssetEventResponse, err error)

	// BuildOffer builds a portion of a criteria offer including the merkle tree needed to post an offer.
	BuildOffer(ctx context.Context, payload *openseamodels.BuildOfferPayload,
		opts ...RequestOptionFn) (resp *openseamodels.BuildOfferResponse, err error)
	// GetCollectionOffers gets the active, valid collection offers for the specified collection.
	GetCollectionOffers(ctx context.Context, collectionSlug string,
		opts ...RequestOptionFn) (resp *openseamodels.Offers, err error)
	// CreateCriteriaOffer creates a criteria offer to purchase any NFT in a collection or which matches the specified trait.
	CreateCriteriaOffer(ctx context.Context, payload *openseamodels.CreateCriteriaOfferPayload,
		opts ...RequestOptionFn) (resp *openseamodels.OfferResponse, err error)
	// CreateIndividualOffer creates an offer to purchase a single NFT (ERC721 or ERC1155).
	CreateIndividualOffer(ctx context.Context, ch chain.Chain,
		payload *openseamodels.CreateOrderPayload) (resp *openseamodels.OrderResponse, err error)
	// CreateListing lists a single NFT (ERC721 or ERC1155) for sale on the OpenSea marketplace.
	CreateListing(ctx context.Context, ch chain.Chain,
		payload *openseamodels.CreateOrderPayload) (resp *openseamodels.CreateListingResponse, err error)
	// FulfillListing retrieves all the information, including signatures, needed to fulfill a listing directly onchain.
	FulfillListing(ctx context.Context, ch chain.Chain,
		orderHash, fulfiller string) (resp *openseamodels.FulfillmentDataResponse, err error)
	// FulfillOffer retrieves all the information, including signatures, needed to fulfill an offer directly onchain.
	FulfillOffer(ctx context.Context, payload *openseamodels.FulfillOfferPayload,
		opts ...RequestOptionFn) (resp *openseamodels.FulfillmentDataResponse, err error)
	// GetAllListingsByCollection gets all active, valid listings for a single collection.
	GetAllListingsByCollection(ctx context.Context, payload *openseamodels.GetAllListingsByCollectionPayload,
		opts ...RequestOptionFn) (resp *openseamodels.ListingsByCollectionResponse, err error)
	// GetAllCollectionOffers gets all active, valid offers for the specified collection.
	// This includes individual and criteria offers.
	GetAllCollectionOffers(ctx context.Context, payload *openseamodels.CollectionPayload,
		opts ...RequestOptionFn) (resp *openseamodels.PageableOffers, err error)
	// GetIndividualOffers gets the active, valid individual offers. This does not include criteria offers.
	GetIndividualOffers(ctx context.Context, ch chain.Chain,
		payload *openseamodels.OrderPayload) (resp *openseamodels.OrdersResponse, err error)
	// GetListings gets the complete set of active, valid listings.
	GetListings(ctx context.Context, ch chain.Chain,
		payload *openseamodels.OrderPayload) (resp *openseamodels.OrdersResponse, err error)
	// GetOrder gets a single order, offer or listing, by its order hash.
	// Protocol and Chain are required to prevent hash collisions.
	GetOrder(ctx context.Context, payload *openseamodels.GetOrderPayload) (
		resp *openseamodels.GetOrderResponse, err error)
	// GetTraitOffers gets the active, valid trait offers for the specified collection.
	GetTraitOffers(ctx context.Context, payload *openseamodels.GetTraitOffersPayload,
		opts ...RequestOptionFn) (resp *openseamodels.Offers, err error)
}

func NewClient

func NewClient(opts ...OptionFn) Servicer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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