Create an instance of the OpenSea API
OpenSeaAPIConfig for setting up the API, including an optional API key, network name, and base URL
Optional function for logging debug strings before and after requests are made
Base url for the API
Logger function to use when debugging
Page size to use for fetching orders
Get from an API Endpoint, sending auth token in headers
Path to URL endpoint under API
RequestInit opts, similar to Fetch API
Get JSON data from API, sending auth token in headers
Path to URL endpoint under API
Data to send. Will be stringified using QueryString
Fetch an asset from the API, throwing if none is found
Number of times to retry if the service is unavailable for any reason
Fetch list of assets from the API, returning the page of assets and the count of total assets
Query to use for getting orders. A subset of parameters on the OpenSeaAssetJSON
type is supported
Fetch a bundle from the API, return null if it isn't found
The bundle's identifier
Fetch list of bundles from the API, returning the page of bundles and the count of total bundles
Query to use for getting orders. A subset of parameters on the OpenSeaAssetBundleJSON
type is supported
Page number, defaults to 1. Can be overridden by
limit
and offset
attributes from OpenSeaAssetBundleQuery
Gets an order from API based on query options. Throws when no order is found.
Get which version of Wyvern exchange to use to create orders Simply return null in case API doesn't give us a good response
Gets a list of orders from API based on query options and returns orders with next and previous cursors.
Fetch list of fungible tokens from the API matching parameters
Query to use for getting orders. A subset of parameters on the OpenSeaAssetJSON
type is supported
Page number, defaults to 1. Can be overridden by
limit
and offset
attributes from OpenSeaFungibleTokenQuery
Number of times to retry if the service is unavailable for any reason
POST JSON data to API, sending auth token in headers
Path to URL endpoint under API
Data to send. Will be JSON.stringified
RequestInit opts, similar to Fetch API. If it contains a body, it won't be stringified.
Create a whitelist entry for an asset to prevent others from buying. Buyers will have to have verified at least one of the emails on an asset in order to buy. This will throw a 403 if the given API key isn't allowed to create whitelist entries for this contract or asset.
Address of the asset's contract
The asset's token ID
The email allowed to buy.
Send an order to be posted. Throws when the order is invalid.
PUT JSON data to API, sending auth token in headers
Path to URL endpoint under API
Data to send
RequestInit opts, similar to Fetch API. If it contains a body, it won't be stringified.
Generated using TypeDoc
Example setup:
import * as Web3 from 'web3' import { OpenSeaPort, Network } from 'opensea-js' const provider = new Web3.providers.HttpProvider('https://mainnet.infura.io') const client = new OpenSeaPort(provider, { networkName: Network.Main })