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 client
Instead of signing an off-chain order, this methods allows you to approve an order with an 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.
Batch approve multiple assets for transfer to the OpenSea conduit. This method checks which assets need approval and batches them efficiently:
Array of assets to approve for transfer
The address that owns the assets
Optional overrides?: OverridesTransaction overrides, ignored if not set.
Transaction hash of the approval transaction, or undefined if no approvals needed
Error if the fromAddress is not available through wallet or provider.
Bulk transfer multiple assets using OpenSea's TransferHelper contract. This method is more gas-efficient than calling transfer() multiple times. Note: All assets must be approved for transfer to the OpenSea conduit before calling this method.
Array of assets to transfer. Each asset must have tokenStandard set.
The address to transfer from
Optional overrides?: OverridesTransaction overrides, ignored if not set.
Transaction hash of the bulk transfer
Error if any asset is missing required fields (tokenId for NFTs, amount for ERC20/ERC1155).
Error if any asset is not approved for transfer to the OpenSea conduit.
Error if the fromAddress is not available through wallet or provider.
Cancel an order onchain, preventing it from ever being fulfilled. This method accepts either a full OrderV2 object or an order hash with protocol address.
The account address that will be cancelling the order.
Optional domain?: stringOptional domain for on-chain attribution. Hashed and included in calldata.
Optional order?: OrderV2The order to cancel (OrderV2 object)
Optional orderOptional order hash to cancel. Must provide protocolAddress if using this.
Optional protocolRequired when using orderHash. The Seaport protocol address for the order.
Error if neither order nor orderHash is provided.
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 using OrderV2 object
await sdk.cancelOrder({
order: orderV2Object,
accountAddress: "0x..."
});
// Cancel using order hash
await sdk.cancelOrder({
orderHash: "0x123...",
protocolAddress: "0xabc...",
accountAddress: "0x..."
});
Cancel multiple orders onchain, preventing them from being fulfilled. This method accepts either full OrderV2 objects, OrderComponents, or order hashes with protocol address.
Event Behavior: For backwards compatibility with the singular cancelOrder method,
this method dispatches a CancelOrder event for the first order only, and only when
an OrderV2 object is available (either provided directly or fetched via orderHashes).
No event is dispatched when using OrderComponents directly, as they lack the full order data.
The account address cancelling the orders.
Optional domain?: stringOptional domain for on-chain attribution. Hashed and included in calldata.
Optional orderOptional array of order hashes to cancel. Must provide protocolAddress if using this.
Optional orders?: (OrderV2 | OrderComponents)[]Array of orders to cancel. Can be OrderV2 objects or OrderComponents.
Optional overrides?: OverridesTransaction overrides, ignored if not set.
Optional protocolRequired when using orderHashes. The Seaport protocol address for the orders.
Transaction hash of the cancellation.
Error if orderHashes is provided without protocolAddress.
Error if neither orders nor orderHashes is provided.
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 multiple listings using Seaport's bulk order creation. This method uses a single signature for all listings and submits them individually to the OpenSea API with rate limit handling. All listings must be from the same account address.
Note: If only one listing is provided, this method will use a normal order signature instead of a bulk signature, as bulk signatures are more expensive to decode on-chain due to the merkle proof verification.
Address of the wallet making the listings
Optional continueIf true, continue submitting remaining listings even if some fail. Default: false (throw on first error).
Array of listing parameters. Each listing requires asset, amount, and optionally other listing parameters.
Optional onOptional callback for progress updates. Called after each listing is submitted (successfully or not).
BulkOrderResult containing successful orders and any failures.
Error if listings array is empty
Error if the accountAddress is not available through wallet or provider.
Error if any asset does not contain a token id.
Error if continueOnError is false and any submission fails.
Create and submit multiple offers using Seaport's bulk order creation. This method uses a single signature for all offers and submits them individually to the OpenSea API with rate limit handling. All offers must be from the same account address.
Note: If only one offer is provided, this method will use a normal order signature instead of a bulk signature, as bulk signatures are more expensive to decode on-chain due to the merkle proof verification.
Address of the wallet making the offers
Optional continueIf true, continue submitting remaining offers even if some fail. Default: false (throw on first error).
Array of offer parameters. Each offer requires asset, amount, and optionally other offer parameters.
Optional onOptional callback for progress updates. Called after each offer is submitted (successfully or not).
BulkOrderResult containing successful orders and any failures.
Error if offers array is empty
Error if the accountAddress is not available through wallet or provider.
Error if any asset does not contain a token id.
Error if continueOnError is false and any submission fails.
Create and submit a collection offer.
Address of the wallet making the offer.
Amount in decimal format (e.g., "1.5" for 1.5 ETH, not wei). Automatically converted to base units.
Identifier for the collection.
Optional domain?: stringOptional domain for on-chain attribution. Hashed and included in salt.
Optional expirationExpiration time (UTC seconds).
Optional offerUse signed zone for protection against disabled items. Default: true.
Payment token address. Defaults to WETH.
Number of assets to bid for.
Optional salt?: BigNumberishArbitrary salt. Auto-generated if not provided.
Optional traitIf defined, the trait name to create the collection offer for.
Optional traitIf defined, the trait value to create the collection offer for.
Optional traits?: { If defined, an array of traits to create the multi-trait collection offer for.
The CollectionOffer that was created.
Create and submit a listing for an asset.
Address of the wallet making the listing
Amount in decimal format (e.g., "1.5" for 1.5 ETH, not wei). Automatically converted to base units.
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?: stringOptional domain for on-chain attribution. Hashed and included in salt.
Optional expirationExpiration time for the order, in UTC seconds.
Optional includeIf true, optional creator fees will be included in the listing. Default: false.
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?: BigNumberishNumber of assets to list. Defaults to 1.
Optional salt?: BigNumberishArbitrary salt. Auto-generated if not provided.
Optional zone?: stringZone for order protection. 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 amount is not greater than 0.
Error if paymentTokenAddress is not WETH on anything other than Ethereum mainnet.
Create and validate a listing onchain. Combines order building with onchain validation. Validation costs gas upfront but makes fulfillment cheaper (no signature verification needed).
Address of the wallet making the listing
Amount in decimal format (e.g., "1.5" for 1.5 ETH, not wei). Automatically converted to base units.
The asset to trade. tokenAddress and tokenId must be defined.
Optional buyerOptional buyer restriction. Only this address can purchase.
Optional domain?: stringOptional domain for on-chain attribution. Hashed and included in salt.
Optional expirationExpiration time (UTC seconds).
Optional includeInclude optional creator fees. Default: false.
Optional listingWhen order becomes fulfillable (UTC seconds). Defaults to now.
Optional paymentPayment token address. Defaults to ETH.
Optional quantity?: BigNumberishNumber of assets to list. Defaults to 1.
Optional salt?: BigNumberishArbitrary salt. Auto-generated if not provided.
Optional zone?: stringZone for order protection. Defaults to no zone.
Transaction hash
Error if asset missing token id or accountAddress unavailable.
Create and submit an offer on an asset.
Address of the wallet making the offer.
Amount in decimal format (e.g., "1.5" for 1.5 ETH, not wei). Automatically converted to base units.
The asset to trade. tokenAddress and tokenId must be defined.
Optional domain?: stringOptional domain for on-chain attribution. Hashed and included in salt.
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?: BigNumberishNumber of assets to bid for. Defaults to 1.
Optional salt?: BigNumberishArbitrary salt. Auto-generated if not provided.
Optional zone?: stringZone for order protection. Defaults to chain's signed 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 amount is not greater than 0.
Error if paymentTokenAddress is not WETH on anything other than Ethereum mainnet.
Create and validate an offer onchain. Combines order building with onchain validation. Validation costs gas upfront but makes fulfillment cheaper (no signature verification needed).
Address of the wallet making the offer.
Amount in decimal format (e.g., "1.5" for 1.5 ETH, not wei). Automatically converted to base units.
The asset to trade. tokenAddress and tokenId must be defined.
Optional domain?: stringOptional domain for on-chain attribution. Hashed and included in salt.
Optional expirationExpiration time (UTC seconds).
Optional paymentPayment token address. Defaults to WETH.
Optional quantity?: BigNumberishNumber of assets to bid for. Defaults to 1.
Optional salt?: BigNumberishArbitrary salt. Auto-generated if not provided.
Optional zone?: stringZone for order protection. Defaults to chain's signed zone.
Transaction hash
Error if asset missing token id or accountAddress unavailable.
Fulfill an order for an asset. The order can be either a listing or an offer. Uses the OpenSea API to generate fulfillment transaction data and executes it directly.
Address of the wallet taking the offer.
Optional assetOptional address of the NFT contract for criteria offers (e.g., collection offers). Required when fulfilling collection offers.
The order to fulfill, a.k.a. "take"
Optional overrides?: OverridesTransaction overrides, ignored if not set.
Optional recipientOptional recipient address for the NFT when fulfilling a listing. Not applicable for offers.
Optional tokenOptional token ID for criteria offers (e.g., collection offers). Required when fulfilling collection offers.
Optional unitsOptional number of units to fill. Defaults to 1 for both listings and offers.
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 a signer is not provided (read-only providers cannot fulfill orders).
Error if the order hash is not available.
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 API key used to initialize the SDK must belong to the order's offerer.
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 wrapped native asset into native asset (e.g. WETH into ETH, WPOL into POL).
Emits the UnwrapWeth event when the transaction is prompted.
Address of the user's wallet containing the wrapped native asset
How much wrapped native asset to unwrap
Validates an order onchain using Seaport's validate() method. This submits the order onchain and pre-validates the order using Seaport, which makes it cheaper to fulfill since a signature is not needed to be verified during fulfillment for the order, but is not strictly required and the alternative is orders can be submitted to the API for free instead of sent onchain.
Order components to validate onchain
Address of the wallet that will pay the gas to validate the order
Transaction hash of the validation transaction
Error if the accountAddress is not available through wallet or provider.
Wrap native asset into wrapped native asset (e.g. ETH into WETH, POL into WPOL). Wrapped native assets are needed for making offers.
Address of the user's wallet containing the native asset
Amount of native asset to wrap
The OpenSea SDK main class.