Your very own seaport. Create a new instance of OpenSeaJS.
Web3 Provider to use for transactions. For example:
const provider = new Web3.providers.HttpProvider('https://mainnet.infura.io')
configuration options, including networkName
logger, optional, a function that will be called with debugging
optional, if you'd like to use an ethers wallet for order posting information
DEPRECATED: ERC-1559 https://eips.ethereum.org/EIPS/eip-1559 Compute the gas price for sending a txn, in wei Will be slightly above the mean to make it faster
Compute the gas amount for sending a txn Will be slightly above the result of estimateGas to make it more reliable
The result of estimateGas for a transaction
Estimate the gas needed to match two orders. Returns undefined if tx errors
Number of times to retry if false
For a fungible token to use in trades (like W-ETH), get the amount approved for use by the Wyvern transfer proxy. Internal method exposed for dev flexibility.
Get the clients to use for a read call
Compute the basePrice
and extra
parameters to be used to price an order.
Also validates the expiration time and auction type.
Address of the ERC-20 token to use for trading. Use the null address for ETH
When the auction expires, or 0 if never.
The base value for the order, in the token's main units (e.g. ETH instead of wei)
The end value for the order, in the token's main units (e.g. ETH instead of wei). If unspecified, the order's extra
attribute will be 0
Get the proxy address for a user's wallet. Internal method exposed for dev flexibility.
The user's wallet address
Optional number of retries to do
Get the listing and expiration time parameters for a new order
Initialize the proxy for a user's wallet. Proxies are used to make trades on behalf of the order's maker so that trades can happen when the maker isn't online. Internal method exposed for dev flexibility.
The user's wallet address
Check if an account, or its proxy, owns an asset on-chain
Validate fee parameters
Total buyer fees
Total seller fees
Validate against Wyvern that a buy and sell order can match
How many times to retry if validation fails
Add a listener to a marketplace event
An event to listen for
A callback that will accept an object with event data
Whether the listener should only be called once
Approve a fungible token (e.g. W-ETH) for use in trades. Called internally, but exposed for dev flexibility. Checks to see if the minimum amount is already approved, first.
Transaction hash if a new transaction occurred, otherwise null
Instead of signing an off-chain order, you can approve an order with on on-chain transaction using this method
Order to approve
An optional domain to be hashed and included at the end of fulfillment calldata
Transaction hash of the approval transaction
Instead of signing an off-chain order, you can approve an order with on on-chain transaction using this method
Order to approve
Transaction hash of the approval transaction
Approve a non-fungible token for use in trades. Requires an account to be initialized first. Called internally, but exposed for dev flexibility. Checks to see if already approved, first. Then tries different approval methods from best to worst.
Transaction hash if a new transaction was created, otherwise null
Generate the signature for authorizing an order
Unsigned wyvern order
order signature in the form of v, r, s, also an optional nonce
Cancel all existing orders with a lower nonce on-chain, preventing them from ever being fulfilled.
Cancel an order on-chain, preventing it from ever being fulfilled.
Cancel an order on-chain, preventing it from ever being fulfilled.
Compute the fees for an order
Create a buy order to make an offer on an asset.
Options for creating the buy order
Address of the maker's wallet
The asset to trade
An optional domain to be hashed and included in the first four bytes of the random salt.
Expiration time for the order, in seconds
Optional address for using an ERC-20 token in the order. If unspecified, defaults to WETH
The number of assets to bid for (if fungible or semi-fungible). Defaults to 1. In units, not base units, e.g. not wei
Arbitrary salt. If not passed in, a random salt will be generated with the first four bytes being the domain hash or empty.
Value of the offer, in units of the payment token (or wrapped ETH if no payment token address specified)
Create a collection offer
Create a sell order to auction an asset.
Options for creating the sell order
Address of the maker's wallet
The asset to trade
Optional address that's allowed to purchase this item. If specified, no other address will be able to take the order, unless its value is the null address.
An optional domain to be hashed and included in the first four bytes of the random salt.
Optional price of the asset at the end of its expiration time. Units are in the amount of a token above the token's decimal places (integer part). For example, for ether, expected units are in ETH, not wei.
Expiration time for the order, in UTC seconds.
Optional time when the order will become fulfillable, in UTC seconds. Undefined means it will start now.
Address of the ERC-20 token to accept in return. If undefined or null, uses Ether.
The number of assets to sell (if fungible or semi-fungible). Defaults to 1. In units, not base units, e.g. not wei.
Arbitrary salt. If not passed in, a random salt will be generated with the first four bytes being the domain hash or empty.
Price of the asset at the start of the auction. Units are in the amount of a token above the token's decimal places (integer part). For example, for ether, expected units are in ETH, not wei.
Fullfill or "take" an order for an asset, either a buy or sell order
fullfillment options
The taker's wallet address
An optional domain to be hashed and included at the end of fulfillment calldata
The order to fulfill, a.k.a. "take"
The optional address to receive the order's item(s) or curriencies. If not specified, defaults to accountAddress
Transaction hash for fulfilling the order
Fullfill or "take" an order for an asset, either a buy or sell order
Transaction hash for fulfilling the order
Get an account's balance of any Asset.
How many times to retry if balance is 0
Gets the current price for the order.
Gets the price for the order using the contract
The order to calculate the price for
Get the domain for a specific tag at a given index.
The tag to look up.
The index of the domain to return.
Domain
Get the full array of domains for a specific tag.
The tag to look up.
Array of domains
Get known payment tokens (ERC-20) that match your filters.
Gets the current order nonce for an account
account to check the nonce for
nonce
Get the number of registered domains for a specific tag.
The tag to look up.
Number of registered domains for input tag.
Gets the estimated cost or payout of either buying or selling NFTs to Uniswap using either purchaseAssts() or liquidateAssets()
Get the balance of a fungible token. Convenience method for getAssetBalance for fungibles
Number of times to retry if balance is undefined
Returns whether an asset is transferrable. An asset may not be transferrable if its transfer function is locked for some reason, e.g. an item is being rented within a game or trading has been locked for an item type.
How many times to retry if false
Returns whether or not an authenticated proxy is revoked for a specific account address
Returns whether an order is fulfillable. An order may not be fulfillable if a target item's transfer function is locked for some reason, e.g. an item is being rented within a game or trading has been locked for an item type.
Returns whether an order is fulfillable. An order may not be fulfillable if a target item's transfer function is locked for some reason, e.g. an item is being rented within a game or trading has been locked for an item type.
Liquidates an arbitrary group of NFTs by atomically wrapping them into their
corresponding WrappedNFT ERC20 tokens, and then immediately selling those
ERC20 tokens on their corresponding Uniswap exchange.
Emits the LiquidateAssets
event when the transaction is prompted.
Purchases a bundle of WrappedNFT tokens from Uniswap and then unwraps them into ERC721 tokens.
Emits the PurchaseAssets
event when the transaction is prompted.
Remove all event listeners. Good idea to call this when you're unmounting a component that listens to events to make UI updates
Optional EventType to remove listeners for
Remove an event listener, included here for completeness.
Simply calls .remove()
on a subscription
The event subscription returned from addListener
Revokes an authenticated proxy's access i.e. for freezing listings
transaction hash
Register a domain on the Domain Registry contract.
The string domain to be hashed and registered on the Registry.
Transaction hash
Transfer a fungible or non-fungible asset to another address
Transaction hash
Transfer one or more assets to another address. ERC-721 and ERC-1155 assets are supported
Transaction hash
Un-approve a fungible token (e.g. W-ETH) for use in trades. Called internally, but exposed for dev flexibility. Useful for old ERC20s that require a 0 approval count before changing the count
Transaction hash
Unrevokes an authenticated proxy's access i.e. for unfreezing listings
transaction hash
Unwraps an arbitrary group of NFTs from their corresponding WrappedNFT ERC20 tokens back into ERC721 tokens.
Emits the UnwrapAssets
event when the transaction is prompted.
Unwrap W-ETH into ETH.
Emits the UnwrapWeth
event when the transaction is prompted.
Wraps an arbitrary group of NFTs into their corresponding WrappedNFT ERC20 tokens.
Emits the WrapAssets
event when the transaction is prompted.
Wrap ETH into W-ETH.
W-ETH is needed for placing buy orders (making offers).
Emits the WrapEth
event when the transaction is prompted.
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 })