Skip to content

Commit 97156b9

Browse files
committed
Release v10.4.0
1 parent 4062ebf commit 97156b9

30 files changed

Lines changed: 454 additions & 1397 deletions

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,59 @@
11
# @opensea/sdk
22

3+
## 10.4.0
4+
5+
### Minor Changes
6+
7+
- 94dbf08: Sync downstream packages to the API surface introduced in `@opensea/api-types` 0.3.0 (os2-core#40171 + #40190): drop methods backed by removed endpoints, fix POST shapes, and surface the four new endpoints (`/listings/sweep`, `/offers/collection/{slug}/nfts/{identifier}`, `/swap/execute`, `/transactions/receipt`).
8+
9+
### `@opensea/sdk` — breaking
10+
11+
**Removed methods** (the underlying GET endpoints were deleted; they would return 404 against the new API):
12+
13+
- `OpenSeaAPI.getOrder` / `OrdersAPI.getOrder` — was already `@deprecated`. Use `getBestOffer` / `getBestListing` for "best" or `getAllOffers` / `getAllListings` for collection-wide results.
14+
- `OpenSeaAPI.getOrders` / `OrdersAPI.getOrders` — was already `@deprecated`. Use `getAllOffers` / `getAllListings`.
15+
- `OpenSeaAPI.postOrder` / `OrdersAPI.postOrder` — was already `@deprecated`. Use `postListing` / `postOffer`.
16+
- `OpenSeaAPI.getNFTOffers` / `OffersAPI.getNFTOffers` — replaced by `getOffersByNFT(slug, tokenId)` (new endpoint takes a collection slug, not contract address).
17+
- `OpenSeaAPI.getNFTListings` / `ListingsAPI.getNFTListings` — no per-NFT all-listings endpoint exists. Use `getBestListing(slug, tokenId)` for the best, or `getAllListings(slug)` and filter client-side.
18+
- Helpers `getOrdersAPIPath`, `serializeOrdersQueryOptions`, `deserializeOrder` — orphaned with the methods above.
19+
- Types `OrderAPIOptions`, `OrdersQueryOptions`, `OrdersQueryResponse`, `OrdersPostQueryResponse`, `ListingPostQueryResponse`, `OfferPostQueryResponse`, `SerializedOrderV2`, `GetOrdersResponse` — unused after the deletions.
20+
- Stats fields `IntervalStat.{volume_diff, volume_change, sales_diff, average_price}` and `Stats.{market_cap, average_price}` — server stopped returning them (always `0` previously).
21+
22+
**Behavior changes:**
23+
24+
- `OrdersAPI.postListing` and `OrdersAPI.postOffer` now read the bare `Listing` / `Offer` response (the upstream API dropped the legacy `order` wrapper field).
25+
- `OpenSeaSDK.createOffer` returns `Promise<Offer>` (was `Promise<OrderV2>`).
26+
- `OpenSeaSDK.createListing` returns `Promise<Listing>` (was `Promise<OrderV2>`).
27+
- `OpenSeaSDK.createBulkListings` returns `Promise<BulkOrderResult<Listing>>`; `createBulkOffers` returns `Promise<BulkOrderResult<Offer>>`. `BulkOrderResult` is now generic in the success type.
28+
29+
**New methods:**
30+
31+
- `OpenSeaAPI.getOffersByNFT(slug, identifier, limit?, next?)` — all offers for one NFT.
32+
- `OpenSeaAPI.sweepCollection(request)` — bulk-buy items from a collection, any payment token (incl. cross-chain).
33+
- `OpenSeaAPI.executeSwap(request)` — multi-asset swap; companion to `getSwapQuote`.
34+
- `OpenSeaAPI.getTransactionReceipt(request)` — fetch transaction status (sweep, swap, fulfillment).
35+
- New `TransactionsAPI` sub-client.
36+
37+
### `@opensea/cli` — additive (with one type re-export removed)
38+
39+
- `OrdersResponse`, `SimpleAccount` re-exports removed from `src/types/api.ts` (schemas no longer exist).
40+
- `offers all` and `listings all` now accept `--maker <address>` to filter by order maker.
41+
- New commands:
42+
- `listings sweep` — bulk-buy items from a collection with any payment token.
43+
- `offers by-nft <collection> <token-id>` — all offers for a specific NFT.
44+
- `transactions receipt --request <file>` — fetch transaction receipt/status (request body via JSON file).
45+
- New SDK helpers: `OpenSeaCLI.transactions.receipt`, `SwapsAPI.executeMulti` (POST `/swap/execute`).
46+
47+
### `@opensea/skill` — docs refresh
48+
49+
- `opensea-api/references/rest-api.md` — endpoint tables refreshed: removed deleted GET rows, added `?maker=` annotations, added `listings/sweep`, per-NFT offers, `swap/execute`, and `transactions/receipt` rows.
50+
- `opensea-marketplace/references/marketplace-api.md` — replaced "Get listings/offers for specific NFT" sections (which curled the removed endpoints) with the slug-based replacements.
51+
52+
### Patch Changes
53+
54+
- Updated dependencies [7a51fd0]
55+
- @opensea/api-types@0.3.0
56+
357
## 10.3.1
458

559
### Patch Changes

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opensea/sdk",
3-
"version": "10.3.1",
3+
"version": "10.4.0",
44
"description": "TypeScript SDK for the OpenSea marketplace helps developers build new experiences using NFTs, tokens, and our marketplace data",
55
"license": "MIT",
66
"author": "OpenSea Developers",
@@ -45,7 +45,7 @@
4545
"types": "lib/index.d.ts",
4646
"dependencies": {
4747
"@noble/hashes": "^2.0.1",
48-
"@opensea/api-types": "^0.2.3",
48+
"@opensea/api-types": "^0.3.0",
4949
"@opensea/seaport-js": "^4.1.1",
5050
"ethers": "^6.16.0"
5151
},

src/api/api.ts

Lines changed: 54 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import { API_BASE_MAINNET } from "../constants"
2-
import type {
3-
FulfillmentDataResponse,
4-
OrderAPIOptions,
5-
OrdersQueryOptions,
6-
OrderV2,
7-
ProtocolData,
8-
} from "../orders/types"
2+
import type { FulfillmentDataResponse, ProtocolData } from "../orders/types"
93
import {
104
Chain,
115
type OpenSeaAccount,
@@ -30,6 +24,7 @@ import { OffersAPI } from "./offers"
3024
import { OrdersAPI } from "./orders"
3125
import { SearchAPI } from "./search"
3226
import { TokensAPI } from "./tokens"
27+
import { TransactionsAPI } from "./transactions"
3328
import {
3429
type BuildOfferResponse,
3530
type CancelOrderResponse,
@@ -58,7 +53,6 @@ import {
5853
type GetNFTResponse,
5954
type GetOffersResponse,
6055
type GetOrderByHashResponse,
61-
type GetOrdersResponse,
6256
type GetSwapQuoteArgs,
6357
type GetSwapQuoteResponse,
6458
type GetTokenGroupResponse,
@@ -78,7 +72,13 @@ import {
7872
type ResolveAccountResponse,
7973
type SearchArgs,
8074
type SearchResponse,
75+
type SwapExecuteRequest,
76+
type SwapExecuteResponse,
77+
type SweepCollectionRequest,
78+
type SweepCollectionResponse,
8179
type TraitFilter,
80+
type TransactionReceiptRequest,
81+
type TransactionReceiptResponse,
8282
type ValidateMetadataResponse,
8383
} from "./types"
8484

@@ -115,6 +115,7 @@ export class OpenSeaAPI {
115115
private tokensAPI: TokensAPI
116116
private chainsAPI: ChainsAPI
117117
private dropsAPI: DropsAPI
118+
private transactionsAPI: TransactionsAPI
118119

119120
/**
120121
* Create an instance of the OpenSeaAPI
@@ -143,7 +144,7 @@ export class OpenSeaAPI {
143144
// Initialize specialized API clients
144145
this.ordersAPI = new OrdersAPI(fetcher, this.chain)
145146
this.offersAPI = new OffersAPI(fetcher, this.chain)
146-
this.listingsAPI = new ListingsAPI(fetcher, this.chain)
147+
this.listingsAPI = new ListingsAPI(fetcher)
147148
this.collectionsAPI = new CollectionsAPI(fetcher)
148149
this.nftsAPI = new NFTsAPI(fetcher, this.chain)
149150
this.accountsAPI = new AccountsAPI(fetcher, this.chain)
@@ -152,20 +153,7 @@ export class OpenSeaAPI {
152153
this.tokensAPI = new TokensAPI(fetcher)
153154
this.chainsAPI = new ChainsAPI(fetcher)
154155
this.dropsAPI = new DropsAPI(fetcher)
155-
}
156-
157-
/**
158-
* Gets an order from API based on query options.
159-
* @deprecated Use collection-based endpoints instead: getAllOffers, getAllListings, getBestOffer, getBestListing.
160-
* @param options Query options for fetching an order
161-
* @returns The first {@link OrderV2} returned by the API
162-
*
163-
* @throws An error if there are no matching orders.
164-
*/
165-
public async getOrder(
166-
options: Omit<OrdersQueryOptions, "limit">,
167-
): Promise<OrderV2> {
168-
return this.ordersAPI.getOrder(options)
156+
this.transactionsAPI = new TransactionsAPI(fetcher)
169157
}
170158

171159
/**
@@ -184,18 +172,6 @@ export class OpenSeaAPI {
184172
return this.ordersAPI.getOrderByHash(orderHash, protocolAddress, chain)
185173
}
186174

187-
/**
188-
* Gets a list of orders from API based on query options.
189-
* @deprecated Use collection-based endpoints instead: getAllOffers, getAllListings, getBestOffer, getBestListing.
190-
* @param options Query options for fetching orders
191-
* @returns The {@link GetOrdersResponse} returned by the API.
192-
*/
193-
public async getOrders(
194-
options: Omit<OrdersQueryOptions, "limit">,
195-
): Promise<GetOrdersResponse> {
196-
return this.ordersAPI.getOrders({ ...options, pageSize: this.pageSize })
197-
}
198-
199175
/**
200176
* Gets all offers for a given collection.
201177
* @param collectionSlug The slug of the collection.
@@ -371,20 +347,6 @@ export class OpenSeaAPI {
371347
)
372348
}
373349

374-
/**
375-
* Post an order to OpenSea.
376-
* @deprecated Use postListing or postOffer instead.
377-
* @param order The order to post
378-
* @param apiOptions API options for the order
379-
* @returns The {@link OrderV2} posted to the API.
380-
*/
381-
public async postOrder(
382-
order: ProtocolData,
383-
apiOptions: OrderAPIOptions,
384-
): Promise<OrderV2> {
385-
return this.ordersAPI.postOrder(order, apiOptions)
386-
}
387-
388350
/**
389351
* Post a listing to OpenSea. Returns the new v2 Listing response format.
390352
* @param order The order to post
@@ -864,55 +826,61 @@ export class OpenSeaAPI {
864826

865827
/**
866828
* Gets all active offers for a specific NFT (not just the best offer).
867-
* @param assetContractAddress The NFT contract address.
868-
* @param tokenId The token identifier.
869-
* @param limit The number of offers to return. Must be between 1 and 100.
870-
* @param next The cursor for the next page of results. This is returned from a previous request.
871-
* @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
829+
* @param collectionSlug The collection slug.
830+
* @param identifier The NFT token id.
831+
* @param limit The number of offers to return. Must be between 1 and 200.
832+
* @param next The cursor for the next page of results.
872833
* @returns The {@link GetOffersResponse} returned by the API.
873834
*/
874-
public async getNFTOffers(
875-
assetContractAddress: string,
876-
tokenId: string,
835+
public async getOffersByNFT(
836+
collectionSlug: string,
837+
identifier: string | number,
877838
limit?: number,
878839
next?: string,
879-
chain: Chain = this.chain,
880840
): Promise<GetOffersResponse> {
881-
return this.offersAPI.getNFTOffers(
882-
assetContractAddress,
883-
tokenId,
841+
return this.offersAPI.getOffersByNFT(
842+
collectionSlug,
843+
identifier,
884844
limit,
885845
next,
886-
chain,
887846
)
888847
}
889848

890849
/**
891-
* Gets all active listings for a specific NFT (not just the best listing).
892-
* @param assetContractAddress The NFT contract address.
893-
* @param tokenId The token identifier.
894-
* @param limit The number of listings to return. Must be between 1 and 100.
895-
* @param next The cursor for the next page of results. This is returned from a previous request.
896-
* @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
897-
* @param includePrivateListings Whether to include private listings (default: false)
898-
* @returns The {@link GetListingsResponse} returned by the API.
850+
* Bulk-buy items from a collection using any payment token, including
851+
* cross-chain. Returns an ordered list of transactions to execute.
852+
* @param request The sweep request containing buyer, collection, payment, and item caps.
853+
* @returns The {@link SweepCollectionResponse} returned by the API.
899854
*/
900-
public async getNFTListings(
901-
assetContractAddress: string,
902-
tokenId: string,
903-
limit?: number,
904-
next?: string,
905-
chain: Chain = this.chain,
906-
includePrivateListings?: boolean,
907-
): Promise<GetListingsResponse> {
908-
return this.listingsAPI.getNFTListings(
909-
assetContractAddress,
910-
tokenId,
911-
limit,
912-
next,
913-
chain,
914-
includePrivateListings,
915-
)
855+
public async sweepCollection(
856+
request: SweepCollectionRequest,
857+
): Promise<SweepCollectionResponse> {
858+
return this.listingsAPI.sweepCollection(request)
859+
}
860+
861+
/**
862+
* Get executable transactions for a token swap. Companion to
863+
* {@link OpenSeaAPI.getSwapQuote} — quote first, then execute.
864+
* @param request The swap execution request.
865+
* @returns The {@link SwapExecuteResponse} with transactions and a quote.
866+
*/
867+
public async executeSwap(
868+
request: SwapExecuteRequest,
869+
): Promise<SwapExecuteResponse> {
870+
return this.tokensAPI.executeSwap(request)
871+
}
872+
873+
/**
874+
* Get the receipt/status for a submitted transaction. Works for all transaction
875+
* types: listing fulfillments, cross-chain buys, sweeps, offer fulfillments,
876+
* and token swaps. Poll this endpoint to check completion status.
877+
* @param request The transaction receipt request.
878+
* @returns The {@link TransactionReceiptResponse} returned by the API.
879+
*/
880+
public async getTransactionReceipt(
881+
request: TransactionReceiptRequest,
882+
): Promise<TransactionReceiptResponse> {
883+
return this.transactionsAPI.getTransactionReceipt(request)
916884
}
917885

918886
/**

src/api/apiPaths.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import type { OrderProtocol } from "../orders/types"
2-
import { type Chain, OrderSide } from "../types"
2+
import type { Chain } from "../types"
33

44
/** Base path prefix for all OpenSea API v2 endpoints. */
55
export const API_V2_PREFIX = "/api/v2"
66

7-
export const getOrdersAPIPath = (
8-
chain: Chain,
9-
protocol: OrderProtocol,
10-
side: OrderSide,
11-
) => {
12-
const sidePath = side === OrderSide.LISTING ? "listings" : "offers"
13-
return `${API_V2_PREFIX}/orders/${chain}/${protocol}/${sidePath}`
7+
export const getPostListingPath = (chain: Chain, protocol: OrderProtocol) => {
8+
return `${API_V2_PREFIX}/orders/${chain}/${protocol}/listings`
9+
}
10+
11+
export const getPostOfferPath = (chain: Chain, protocol: OrderProtocol) => {
12+
return `${API_V2_PREFIX}/orders/${chain}/${protocol}/offers`
1413
}
1514

1615
export const getAllOffersAPIPath = (collectionSlug: string) => {
@@ -119,6 +118,25 @@ export const getTraitOffersPath = (collectionSlug: string) => {
119118
return `${API_V2_PREFIX}/offers/collection/${collectionSlug}/traits`
120119
}
121120

121+
export const getOffersByNFTPath = (
122+
collectionSlug: string,
123+
identifier: string | number,
124+
) => {
125+
return `${API_V2_PREFIX}/offers/collection/${collectionSlug}/nfts/${identifier}`
126+
}
127+
128+
export const getSweepListingsPath = () => {
129+
return `${API_V2_PREFIX}/listings/sweep`
130+
}
131+
132+
export const getSwapExecutePath = () => {
133+
return `${API_V2_PREFIX}/swap/execute`
134+
}
135+
136+
export const getTransactionReceiptPath = () => {
137+
return `${API_V2_PREFIX}/transactions/receipt`
138+
}
139+
122140
export const getEventsAPIPath = () => {
123141
return `${API_V2_PREFIX}/events`
124142
}

0 commit comments

Comments
 (0)