Create a new instance of OpenSeaSDK.
Signer or provider to use for transactions. For example:
new ethers.providers.JsonRpcProvider('https://mainnet.infura.io')
or
new ethers.Wallet(privKey, provider)
configuration options, including chain
Optional
logger: ((arg) => void)optional function for logging debug strings. defaults to no logging
Readonly
apiAPI instance
Readonly
chainThe configured chain
Logger function to use when debugging
Provider to use for transactions.
Seaport v1.5 client
Seaport v1.6 client
Instead of signing an off-chain order, this methods allows you to approve an order with on on-chain transaction.
Order to approve
Optional
domain: stringAn optional domain to be hashed and included at the end of fulfillment calldata. This can be used for on-chain order attribution to assist with analytics.
Transaction hash of the approval transaction
Error if the accountAddress is not available through wallet or provider.
Error if the order's protocol address is not supported by OpenSea. See isValidProtocol.
Cancel an order onchain, preventing it from ever being fulfilled.
The account address that will be cancelling the order.
Optional
domain?: stringAn optional domain to be hashed and included at the end of fulfillment calldata. This can be used for on-chain order attribution to assist with analytics.
The order to cancel
Error if the accountAddress is not available through wallet or provider.
Error if the order's protocol address is not supported by OpenSea. See isValidProtocol.
Create and submit a collection offer.
Address of the wallet making the offer.
Value of the offer in units, not base units e.g. not wei, of the payment token (or WETH if no payment token address specified).
Identifier for the collection.
Optional
domain?: stringAn optional domain to be hashed and included in the first four bytes of the random salt. This can be used for on-chain order attribution to assist with analytics.
Optional
excludeIf true, optional creator fees will be excluded from the offer. Default: false.
Optional
expirationExpiration time for the order, in UTC seconds.
Optional
offerBuild the offer on OpenSea's signed zone to provide offer protections from receiving an item which is disabled from trading.
ERC20 address for the payment token in the order. If unspecified, defaults to WETH.
The number of assets to bid for (if fungible or semi-fungible).
Optional
salt?: BigNumberishArbitrary salt. If not passed in, a random salt will be generated with the first four bytes being the domain hash or empty.
Optional
traitIf defined, the trait name to create the collection offer for.
Optional
traitIf defined, the trait value to create the collection offer for.
The CollectionOffer that was created.
Create and submit a listing for an asset.
Address of the wallet making the listing
The asset to trade. tokenAddress and tokenId must be defined.
Optional
buyerOptional 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.
Optional
domain?: stringAn optional domain to be hashed and included in the first four bytes of the random salt. This can be used for on-chain order attribution to assist with analytics.
Optional
endValue of the listing at the end of the auction. If specified, price will change linearly between startAmount and endAmount as time progresses.
Optional
englishIf true, the order will be listed as an English auction.
Optional
excludeIf true, optional creator fees will be excluded from the listing. Default: false.
Optional
expirationExpiration time for the order, in UTC seconds.
Optional
listingOptional time when the order will become fulfillable, in UTC seconds. Undefined means it will start now.
Optional
paymentERC20 address for the payment token in the order. If unspecified, defaults to ETH
Optional
quantity?: BigNumberishThe number of assets to list (if fungible or semi-fungible). Defaults to 1.
Optional
salt?: BigNumberishArbitrary 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 listing at the start of the auction in units, not base units e.g. not wei, of the payment token (or WETH if no payment token address specified)
Optional
zone?: stringThe zone to use for the order. For order protection, pass SIGNED_ZONE. If unspecified, defaults to no zone.
The OrderV2 that was created.
Error if the asset does not contain a token id.
Error if the accountAddress is not available through wallet or provider.
Error if the startAmount is not greater than 0.
Error if paymentTokenAddress is not WETH on anything other than Ethereum mainnet.
Create and submit an offer on an asset.
Address of the wallet making the offer.
The asset to trade. tokenAddress and tokenId must be defined.
Optional
domain?: stringAn optional domain to be hashed and included in the first four bytes of the random salt.
Optional
excludeIf true, optional creator fees will be excluded from the offer. Default: false.
Optional
expirationExpiration time for the order, in UTC seconds
Optional
paymentERC20 address for the payment token in the order. If unspecified, defaults to WETH
Optional
quantity?: BigNumberishThe number of assets to bid for (if fungible or semi-fungible). Defaults to 1.
Optional
salt?: BigNumberishArbitrary 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, not base units e.g. not wei, of the payment token (or WETH if no payment token address specified)
Optional
zone?: stringThe zone to use for the order. For order protection, pass SIGNED_ZONE. If unspecified, defaults to no zone.
The OrderV2 that was created.
Error if the asset does not contain a token id.
Error if the accountAddress is not available through wallet or provider.
Error if the startAmount is not greater than 0.
Error if paymentTokenAddress is not WETH on anything other than Ethereum mainnet.
Fulfill an order for an asset. The order can be either a listing or an offer.
Address of the wallet taking the offer.
Optional
domain?: stringAn optional domain to be hashed and included at the end of fulfillment calldata. This can be used for on-chain order attribution to assist with analytics.
The order to fulfill, a.k.a. "take"
Optional
overrides?: OverridesTransaction overrides, ignored if not set.
Optional
recipientThe optional address to receive the order's item(s) or currencies. If not specified, defaults to accountAddress.
Transaction hash of the order.
Error if the accountAddress is not available through wallet or provider.
Error if the order's protocol address is not supported by OpenSea. See isValidProtocol.
Error if attempting to fulfill the order with a recipient address which does not match a private listing.
Get an account's balance of any Asset. This asset can be an ERC20, ERC1155, or ERC721.
Account address to check
The Asset to check balance for. tokenStandard must be set.
The balance of the asset for the account.
Error if the token standard does not support balanceOf.
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.
True if the order is fulfillable, else False.
Error if the order's protocol address is not supported by OpenSea. See isValidProtocol.
Offchain cancel an order, offer or listing, by its order hash when protected by the SignedZone. Protocol and Chain are required to prevent hash collisions. Please note cancellation is only assured if a fulfillment signature was not vended prior to cancellation.
The Seaport address for the order.
The order hash, or external identifier, of the order.
The chain where the order is located.
Optional
offererSignature: stringAn EIP-712 signature from the offerer of the order.
If this is not provided, the user associated with the API Key will be checked instead.
The signature must be a EIP-712 signature consisting of the order's Seaport contract's
name, version, address, and chain. The struct to sign is OrderHash
containing a
single bytes32 field.
Optional
useSignerToDeriveOffererSignature: booleanDerive the offererSignature from the Ethers signer passed into this sdk.
The response from the API.
Remove all event listeners. This should be called when you're unmounting a component that listens to events to make UI updates.
Optional
event: EventTypeOptional EventType to remove listeners for
Transfer an asset. This asset can be an ERC20, ERC1155, or ERC721.
Optional
amount?: BigNumberishAmount of asset to transfer. Not used for ERC721.
The Asset to transfer. tokenStandard must be set.
The address to transfer from
Optional
overrides?: OverridesTransaction overrides, ignored if not set.
The address to transfer to
Unwrap WETH into ETH.
Emits the UnwrapWeth
event when the transaction is prompted.
Address of the user's wallet containing the WETH
How much WETH to unwrap
Wrap ETH into WETH. W-ETH is needed for making offers.
Address of the user's wallet containing the ether
Amount of ether to wrap
The OpenSea SDK main class.