@opensea/sdk 10.3.1 → 10.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/lib/api/accounts.d.ts +29 -1
  2. package/lib/api/accounts.js +63 -0
  3. package/lib/api/accounts.js.map +1 -1
  4. package/lib/api/api.d.ts +129 -41
  5. package/lib/api/api.js +180 -48
  6. package/lib/api/api.js.map +1 -1
  7. package/lib/api/apiPaths.d.ts +29 -2
  8. package/lib/api/apiPaths.js +121 -6
  9. package/lib/api/apiPaths.js.map +1 -1
  10. package/lib/api/assets.d.ts +18 -0
  11. package/lib/api/assets.js +26 -0
  12. package/lib/api/assets.js.map +1 -0
  13. package/lib/api/collections.d.ts +19 -1
  14. package/lib/api/collections.js +26 -0
  15. package/lib/api/collections.js.map +1 -1
  16. package/lib/api/drops.d.ts +12 -1
  17. package/lib/api/drops.js +14 -0
  18. package/lib/api/drops.js.map +1 -1
  19. package/lib/api/listings.d.ts +16 -14
  20. package/lib/api/listings.js +21 -30
  21. package/lib/api/listings.js.map +1 -1
  22. package/lib/api/nfts.d.ts +14 -1
  23. package/lib/api/nfts.js +19 -0
  24. package/lib/api/nfts.js.map +1 -1
  25. package/lib/api/offers.d.ts +2 -2
  26. package/lib/api/offers.js +2 -9
  27. package/lib/api/offers.js.map +1 -1
  28. package/lib/api/orders.d.ts +4 -21
  29. package/lib/api/orders.js +15 -96
  30. package/lib/api/orders.js.map +1 -1
  31. package/lib/api/tokens.d.ts +27 -1
  32. package/lib/api/tokens.js +33 -0
  33. package/lib/api/tokens.js.map +1 -1
  34. package/lib/api/transactions.d.ts +16 -0
  35. package/lib/api/transactions.js +24 -0
  36. package/lib/api/transactions.js.map +1 -0
  37. package/lib/api/types.d.ts +147 -10
  38. package/lib/api/types.js.map +1 -1
  39. package/lib/orders/types.d.ts +0 -67
  40. package/lib/orders/types.js.map +1 -1
  41. package/lib/orders/utils.d.ts +1 -19
  42. package/lib/orders/utils.js +1 -62
  43. package/lib/orders/utils.js.map +1 -1
  44. package/lib/sdk/base.d.ts +6 -6
  45. package/lib/sdk/base.js +2 -2
  46. package/lib/sdk/orders.d.ts +13 -10
  47. package/lib/sdk/orders.js +6 -22
  48. package/lib/sdk/orders.js.map +1 -1
  49. package/lib/types.d.ts +0 -6
  50. package/package.json +2 -2
  51. package/src/api/accounts.ts +130 -0
  52. package/src/api/api.ts +324 -86
  53. package/src/api/apiPaths.ts +138 -8
  54. package/src/api/assets.ts +22 -0
  55. package/src/api/collections.ts +65 -0
  56. package/src/api/drops.ts +34 -1
  57. package/src/api/listings.ts +37 -41
  58. package/src/api/nfts.ts +44 -0
  59. package/src/api/offers.ts +8 -16
  60. package/src/api/orders.ts +40 -177
  61. package/src/api/tokens.ts +76 -0
  62. package/src/api/transactions.ts +28 -0
  63. package/src/api/types.ts +205 -15
  64. package/src/orders/types.ts +0 -74
  65. package/src/orders/utils.ts +2 -73
  66. package/src/sdk/base.ts +6 -6
  67. package/src/sdk/orders.ts +31 -32
  68. package/src/types.ts +0 -6
@@ -1,6 +1,6 @@
1
- import type { AssetMetadataResponse, InstantApiKeyResponse, TokenGroupPaginatedResponse, TokenGroupResponse } from "@opensea/api-types";
1
+ import type { SwapExecuteRequest as ApiSwapExecuteRequest, SwapExecuteResponse as ApiSwapExecuteResponse, SweepCollectionRequest as ApiSweepCollectionRequest, SweepCollectionResponse as ApiSweepCollectionResponse, TransactionReceiptRequest as ApiTransactionReceiptRequest, TransactionReceiptResponse as ApiTransactionReceiptResponse, AssetMetadataResponse, InstantApiKeyResponse, ListingsResponse, NftListResponse, OffersResponse, TokenGroupPaginatedResponse, TokenGroupResponse } from "@opensea/api-types";
2
2
  import type { ConsiderationItem } from "@opensea/seaport-js/lib/types";
3
- import type { OrderType, OrderV2, ProtocolData, QueryCursors } from "../orders/types";
3
+ import type { OrderType, ProtocolData } from "../orders/types";
4
4
  import type { OpenSeaCollection } from "../types";
5
5
  /**
6
6
  * A single trait filter used by collection-scoped read endpoints (NFTs by
@@ -222,14 +222,6 @@ export type GetNFTResponse = {
222
222
  /** See {@link NFT} */
223
223
  nft: NFT;
224
224
  };
225
- /**
226
- * Response from OpenSea API for fetching Orders.
227
- * @category API Response Types
228
- */
229
- export type GetOrdersResponse = QueryCursors & {
230
- /** List of {@link OrderV2} */
231
- orders: OrderV2[];
232
- };
233
225
  /**
234
226
  * Base query cursors response from OpenSea API.
235
227
  * @category API Response Types
@@ -274,6 +266,36 @@ export type GetOrderByHashResponse = Offer | Listing;
274
266
  export type CancelOrderResponse = {
275
267
  last_signature_issued_valid_until: string | null;
276
268
  };
269
+ /**
270
+ * Request body for sweeping (bulk-buying) items from a collection.
271
+ * @category API Query Args
272
+ */
273
+ export type SweepCollectionRequest = ApiSweepCollectionRequest;
274
+ /**
275
+ * Response from sweeping a collection.
276
+ * @category API Response Types
277
+ */
278
+ export type SweepCollectionResponse = ApiSweepCollectionResponse;
279
+ /**
280
+ * Request body for executing a token swap.
281
+ * @category API Query Args
282
+ */
283
+ export type SwapExecuteRequest = ApiSwapExecuteRequest;
284
+ /**
285
+ * Response from executing a token swap.
286
+ * @category API Response Types
287
+ */
288
+ export type SwapExecuteResponse = ApiSwapExecuteResponse;
289
+ /**
290
+ * Request body for fetching a transaction receipt.
291
+ * @category API Query Args
292
+ */
293
+ export type TransactionReceiptRequest = ApiTransactionReceiptRequest;
294
+ /**
295
+ * Response from fetching a transaction receipt.
296
+ * @category API Response Types
297
+ */
298
+ export type TransactionReceiptResponse = ApiTransactionReceiptResponse;
277
299
  /**
278
300
  * NFT type returned by OpenSea API.
279
301
  * @category API Models
@@ -1182,3 +1204,118 @@ export type ValidateMetadataResponse = {
1182
1204
  */
1183
1205
  export type GetNFTMetadataResponse = AssetMetadataResponse;
1184
1206
  export type { CrossChainFulfillmentRequest, CrossChainFulfillmentResponse, CrossChainPaymentToken, FulfillerObject, ListingObject, SwapTransactionResponse, } from "@opensea/api-types";
1207
+ export type { BatchCollectionsRequest, BatchNftsRequest, BatchTokensRequest, CollectionBatchResponse, CollectionHoldersPaginatedResponse, CollectionOfferAggregatesPaginatedResponse, CreateListingActionsRequest, CreateListingActionsResponse, DropDeployReceiptResponse, DropDeployRequest, DropDeployResponse, FloorPriceHistoryResponse, NftAnalyticsResponse, NftBatchResponse, OhlcvResponse, OwnersPaginatedResponse, PortfolioHistoryResponse, PortfolioStatsResponse, PriceHistoryResponse, ProfileCollectionsResponse, TokenBatchResponse, TokenSwapActivityPaginatedResponse, TransferRequest, TransferResponse, } from "@opensea/api-types";
1208
+ /**
1209
+ * Query args for paginated collection-analytics endpoints (offer aggregates,
1210
+ * holders). All fields are optional; `cursor` paginates forward.
1211
+ * @category API Query Args
1212
+ */
1213
+ export interface PaginatedAnalyticsArgs {
1214
+ limit?: number;
1215
+ cursor?: string;
1216
+ sort_direction?: "asc" | "desc";
1217
+ }
1218
+ /**
1219
+ * Query args for the collection holders endpoint — adds optional `owned_by`
1220
+ * filter on top of {@link PaginatedAnalyticsArgs}.
1221
+ * @category API Query Args
1222
+ */
1223
+ export interface CollectionHoldersArgs extends PaginatedAnalyticsArgs {
1224
+ owned_by?: string;
1225
+ }
1226
+ /**
1227
+ * Query args for the collection floor-price history endpoint.
1228
+ * @category API Query Args
1229
+ */
1230
+ export interface CollectionFloorPricesArgs {
1231
+ /** Time window: one_minute, five_minutes, fifteen_minutes, one_hour, one_day, seven_days, thirty_days, one_year, all_time */
1232
+ timeframe?: string;
1233
+ /** Number of data points to return */
1234
+ resolution?: number;
1235
+ }
1236
+ /**
1237
+ * Query args for token price-history and OHLCV endpoints.
1238
+ * @category API Query Args
1239
+ */
1240
+ export interface TokenTimeSeriesArgs {
1241
+ /** Start time (ISO 8601, required by the API). */
1242
+ start_time: string;
1243
+ /** End time (ISO 8601, defaults to now). */
1244
+ end_time?: string;
1245
+ /** Candle bucket size: 1s, 1m, 5m, 15m, 1h, 4h, 1d. */
1246
+ bucket_size?: string;
1247
+ /** Whether to fill empty time windows with zero-volume candles (OHLCV only). */
1248
+ fill_time_window?: boolean;
1249
+ }
1250
+ /**
1251
+ * Query args for the token swap-activity endpoint.
1252
+ * @category API Query Args
1253
+ */
1254
+ export interface TokenActivityArgs {
1255
+ limit?: number;
1256
+ cursor?: string;
1257
+ }
1258
+ /**
1259
+ * Query args for the NFT owners endpoint (paginated with `next` cursor).
1260
+ * @category API Query Args
1261
+ */
1262
+ export interface NFTOwnersArgs {
1263
+ limit?: number;
1264
+ next?: string;
1265
+ }
1266
+ /**
1267
+ * Query args for the account portfolio and portfolio history endpoints.
1268
+ * @category API Query Args
1269
+ */
1270
+ export interface PortfolioArgs {
1271
+ /** Timeframe for P&L / net-worth history calculation. */
1272
+ timeframe?: "HOUR" | "DAY" | "WEEK" | "MONTH";
1273
+ }
1274
+ /**
1275
+ * Query args shared by the account profile listing-and-offer endpoints
1276
+ * (offers, offers_received, listings).
1277
+ * @category API Query Args
1278
+ */
1279
+ export interface ProfileOrdersArgs {
1280
+ after?: string;
1281
+ limit?: number;
1282
+ collection_slugs?: string[];
1283
+ chains?: string[];
1284
+ sort_by?: string;
1285
+ sort_direction?: "asc" | "desc";
1286
+ }
1287
+ /**
1288
+ * Query args for the account profile favorites endpoint.
1289
+ * @category API Query Args
1290
+ */
1291
+ export interface ProfileFavoritesArgs {
1292
+ after?: string;
1293
+ limit?: number;
1294
+ sort_by?: string;
1295
+ sort_direction?: "asc" | "desc";
1296
+ chains?: string[];
1297
+ }
1298
+ /**
1299
+ * Query args for the account profile collections endpoint.
1300
+ * @category API Query Args
1301
+ */
1302
+ export interface ProfileCollectionsArgs {
1303
+ after?: string;
1304
+ limit?: number;
1305
+ chains?: string[];
1306
+ }
1307
+ /**
1308
+ * Response from the account favorites endpoint — favorited NFTs.
1309
+ * @category API Response Types
1310
+ */
1311
+ export type ProfileFavoritesResponse = NftListResponse;
1312
+ /**
1313
+ * Response from the account profile listings endpoint.
1314
+ * @category API Response Types
1315
+ */
1316
+ export type ProfileListingsResponse = ListingsResponse;
1317
+ /**
1318
+ * Response from the account profile offers / offers_received endpoints.
1319
+ * @category API Response Types
1320
+ */
1321
+ export type ProfileOffersResponse = OffersResponse;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":";;;AAuCA,8CAIC;AAVD;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,MAAiC;IAEjC,OAAO,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACzE,CAAC;AA4GD,IAAY,uBAOX;AAPD,WAAY,uBAAuB;IACjC,wDAA6B,CAAA;IAC7B,4DAAiC,CAAA;IACjC,gEAAqC,CAAA;IACrC,gEAAqC,CAAA;IACrC,oDAAyB,CAAA;IACzB,oDAAyB,CAAA;AAC3B,CAAC,EAPW,uBAAuB,uCAAvB,uBAAuB,QAOlC;AAED;;;GAGG;AACH,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;IACrB,sCAAuB,CAAA;IACvB,kCAAmB,CAAA;IACnB,sCAAuB,CAAA;AACzB,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AA4ND;;;GAGG;AACH,IAAY,gBAQX;AARD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,yDAAqC,CAAA;IACrC,iDAA6B,CAAA;IAC7B,qCAAiB,CAAA;IACjB,iCAAa,CAAA;IACb,uCAAuC;IACvC,iCAAa,CAAA;AACf,CAAC,EARW,gBAAgB,gCAAhB,gBAAgB,QAQ3B;AAED;;;GAGG;AACH,IAAY,cASX;AATD,WAAY,cAAc;IACxB,+BAAa,CAAA;IACb,uCAAqB,CAAA;IACrB,+BAAa,CAAA;IACb,qCAAmB,CAAA;IACnB,iCAAe,CAAA;IACf,iCAAe,CAAA;IACf,6CAA2B,CAAA;IAC3B,uDAAq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AqB,CAAA;IACrB,+BAAa,CAAA;IACb,qCAAmB,CAAA;IACnB,iCAAe,CAAA;IACf,iCAAe,CAAA;IACf,6CAA2B,CAAA;IAC3B,uDAAqC,CAAA;AACvC,CAAC,EATW,cAAc,8BAAd,cAAc,QASzB;AAED;;;GAGG;AACH,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,2CAAyB,CAAA;IACzB,uDAAqC,CAAA;IACrC,6CAA2B,CAAA;AAC7B,CAAC,EALW,cAAc,8BAAd,cAAc,QAKzB"}
@@ -1,6 +1,5 @@
1
1
  import type { BasicOrderParametersStruct } from "@opensea/seaport-js/lib/typechain-types/seaport/contracts/Seaport";
2
2
  import type { AdvancedOrder, OrderWithCounter } from "@opensea/seaport-js/lib/types";
3
- import type { Listing, Offer } from "../api/types";
4
3
  import type { OpenSeaAccount, OrderSide } from "../types";
5
4
  type OrderProtocolToProtocolData = {
6
5
  seaport: OrderWithCounter;
@@ -87,74 +86,8 @@ type Transaction = {
87
86
  orders: OrderWithCounter[] | AdvancedOrder[] | BasicOrderParametersStruct[];
88
87
  };
89
88
  };
90
- type OpenOrderOrderingOption = "created_date" | "eth_price";
91
- type OrderByDirection = "asc" | "desc";
92
- export type OrderAPIOptions = {
93
- protocol?: OrderProtocol;
94
- protocolAddress?: string;
95
- side: OrderSide;
96
- };
97
- export type OrdersQueryOptions = OrderAPIOptions & {
98
- limit?: number;
99
- cursor?: string;
100
- next?: string;
101
- paymentTokenAddress?: string;
102
- maker?: string;
103
- taker?: string;
104
- owner?: string;
105
- listedAfter?: number | string;
106
- listedBefore?: number | string;
107
- tokenId?: string;
108
- tokenIds?: string[];
109
- assetContractAddress?: string;
110
- orderBy?: OpenOrderOrderingOption;
111
- orderDirection?: OrderByDirection;
112
- onlyEnglish?: boolean;
113
- };
114
- export type SerializedOrderV2 = {
115
- created_date: string;
116
- closing_date: string | null;
117
- listing_time: number;
118
- expiration_time: number;
119
- order_hash: string | null;
120
- maker: unknown;
121
- taker: unknown | null;
122
- protocol_data: ProtocolData;
123
- protocol_address: string;
124
- current_price: string;
125
- maker_fees: {
126
- account: unknown;
127
- basis_points: string;
128
- }[];
129
- taker_fees: {
130
- account: unknown;
131
- basis_points: string;
132
- }[];
133
- side: OrderSide;
134
- order_type: OrderType;
135
- cancelled: boolean;
136
- finalized: boolean;
137
- marked_invalid: boolean;
138
- client_signature: string | null;
139
- remaining_quantity: number;
140
- };
141
89
  export type QueryCursors = {
142
90
  next: string | null;
143
91
  previous: string | null;
144
92
  };
145
- export type OrdersQueryResponse = QueryCursors & {
146
- orders: SerializedOrderV2[];
147
- };
148
- /** @deprecated Use ListingPostQueryResponse or OfferPostQueryResponse instead. */
149
- export type OrdersPostQueryResponse = {
150
- order: SerializedOrderV2;
151
- };
152
- export type ListingPostQueryResponse = {
153
- order: SerializedOrderV2;
154
- listing: Listing;
155
- };
156
- export type OfferPostQueryResponse = {
157
- order: SerializedOrderV2;
158
- offer: Offer;
159
- };
160
93
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/orders/types.ts"],"names":[],"mappings":";;;AAgBA,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,gCAAmB,CAAA;IACnB,kCAAqB,CAAA;AACvB,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/orders/types.ts"],"names":[],"mappings":";;;AAeA,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,gCAAmB,CAAA;IACnB,kCAAqB,CAAA;AACvB,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB"}
@@ -1,5 +1,5 @@
1
1
  import { type Chain, OrderSide } from "../types";
2
- import type { OrdersQueryOptions, OrderV2, ProtocolData, SerializedOrderV2 } from "./types";
2
+ import type { ProtocolData } from "./types";
3
3
  export declare const DEFAULT_SEAPORT_CONTRACT_ADDRESS = "0x0000000000000068F116a894984e2DB1123eB395";
4
4
  export declare const getPostCollectionOfferPayload: (collectionSlug: string, protocol_data: ProtocolData, chain: Chain, traitType?: string, traitValue?: string, traits?: Array<{
5
5
  type: string;
@@ -69,21 +69,3 @@ export declare const getFulfillOfferPayload: (fulfillerAddress: string, order_ha
69
69
  units_to_fill: string;
70
70
  include_optional_creator_fees: boolean;
71
71
  };
72
- type OrdersQueryPathOptions = "protocol" | "side";
73
- export declare const serializeOrdersQueryOptions: (options: Omit<OrdersQueryOptions, OrdersQueryPathOptions>) => {
74
- limit: number | undefined;
75
- cursor: string | undefined;
76
- payment_token_address: string | undefined;
77
- maker: string | undefined;
78
- taker: string | undefined;
79
- owner: string | undefined;
80
- listed_after: string | number | undefined;
81
- listed_before: string | number | undefined;
82
- token_ids: string[] | undefined;
83
- asset_contract_address: string | undefined;
84
- order_by: ("created_date" | "eth_price") | undefined;
85
- order_direction: ("asc" | "desc") | undefined;
86
- only_english: boolean | undefined;
87
- };
88
- export declare const deserializeOrder: (order: SerializedOrderV2) => OrderV2;
89
- export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deserializeOrder = exports.serializeOrdersQueryOptions = exports.getFulfillOfferPayload = exports.getFulfillListingPayload = exports.getFulfillmentDataPath = exports.getBuildCollectionOfferPayload = exports.getPostCollectionOfferPayload = exports.DEFAULT_SEAPORT_CONTRACT_ADDRESS = void 0;
3
+ exports.getFulfillOfferPayload = exports.getFulfillListingPayload = exports.getFulfillmentDataPath = exports.getBuildCollectionOfferPayload = exports.getPostCollectionOfferPayload = exports.DEFAULT_SEAPORT_CONTRACT_ADDRESS = void 0;
4
4
  const constants_1 = require("@opensea/seaport-js/lib/constants");
5
5
  const apiPaths_1 = require("../api/apiPaths");
6
6
  const types_1 = require("../types");
@@ -121,65 +121,4 @@ const getFulfillOfferPayload = (fulfillerAddress, order_hash, protocolAddress, c
121
121
  return payload;
122
122
  };
123
123
  exports.getFulfillOfferPayload = getFulfillOfferPayload;
124
- const serializeOrdersQueryOptions = (options) => {
125
- const tokenIds = options.tokenIds && options.tokenIds.length > 0
126
- ? options.tokenIds
127
- : options.tokenId !== undefined
128
- ? [options.tokenId]
129
- : options.tokenIds;
130
- return {
131
- limit: options.limit,
132
- cursor: options.cursor ?? options.next,
133
- payment_token_address: options.paymentTokenAddress,
134
- maker: options.maker,
135
- taker: options.taker,
136
- owner: options.owner,
137
- listed_after: options.listedAfter,
138
- listed_before: options.listedBefore,
139
- token_ids: tokenIds,
140
- asset_contract_address: options.assetContractAddress,
141
- order_by: options.orderBy,
142
- order_direction: options.orderDirection,
143
- only_english: options.onlyEnglish,
144
- };
145
- };
146
- exports.serializeOrdersQueryOptions = serializeOrdersQueryOptions;
147
- /** Map API side values ("ask"/"bid") to SDK OrderSide enum values */
148
- const mapApiSide = (side) => {
149
- if (side === "ask" || side === types_1.OrderSide.LISTING)
150
- return types_1.OrderSide.LISTING;
151
- if (side === "bid" || side === types_1.OrderSide.OFFER)
152
- return types_1.OrderSide.OFFER;
153
- return side;
154
- };
155
- const deserializeOrder = (order) => {
156
- return {
157
- createdDate: order.created_date,
158
- closingDate: order.closing_date,
159
- listingTime: order.listing_time,
160
- expirationTime: order.expiration_time,
161
- orderHash: order.order_hash,
162
- maker: (0, utils_1.accountFromJSON)(order.maker),
163
- taker: order.taker ? (0, utils_1.accountFromJSON)(order.taker) : null,
164
- protocolData: order.protocol_data,
165
- protocolAddress: order.protocol_address,
166
- currentPrice: BigInt(order.current_price),
167
- makerFees: (order.maker_fees ?? []).map(({ account, basis_points }) => ({
168
- account: (0, utils_1.accountFromJSON)(account),
169
- basisPoints: basis_points,
170
- })),
171
- takerFees: (order.taker_fees ?? []).map(({ account, basis_points }) => ({
172
- account: (0, utils_1.accountFromJSON)(account),
173
- basisPoints: basis_points,
174
- })),
175
- side: mapApiSide(order.side),
176
- orderType: order.order_type,
177
- cancelled: order.cancelled,
178
- finalized: order.finalized,
179
- markedInvalid: order.marked_invalid,
180
- clientSignature: order.client_signature,
181
- remainingQuantity: order.remaining_quantity,
182
- };
183
- };
184
- exports.deserializeOrder = deserializeOrder;
185
124
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/orders/utils.ts"],"names":[],"mappings":";;;AAAA,iEAAoF;AACpF,8CAA+C;AAC/C,oCAAgD;AAChD,oCAA6D;AAQhD,QAAA,gCAAgC,GAAG,4CAAgC,CAAA;AAEzE,MAAM,6BAA6B,GAAG,CAC3C,cAAsB,EACtB,aAA2B,EAC3B,KAAY,EACZ,SAAkB,EAClB,UAAmB,EACnB,MAA+C,EAC/C,aAAmE,EACnE,EAAE;IACF,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE;YACR,UAAU,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;SACrC;QACD,aAAa;QACb,gBAAgB,EAAE,IAAA,yBAAiB,EAAC,KAAK,CAAC;KAC3C,CAAA;IAED,sCAAsC;IACtC,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,CAAC;QAAC,OAAO,CAAC,QAAgB,CAAC,MAAM,GAAG,MAAM,CAAA;IAC5C,CAAC;SAAM,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,sDAAsD;QACtD,CAAC;QAAC,OAAO,CAAC,QAAgB,CAAC,KAAK,GAAG;YACjC,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,UAAU;SAClB,CAAA;IACH,CAAC;IACD,IAAI,aAAa,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9C,CAAC;QAAC,OAAO,CAAC,QAAgB,CAAC,aAAa,GAAG,aAAa,CAAA;IAC1D,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AA/BY,QAAA,6BAA6B,iCA+BzC;AAEM,MAAM,8BAA8B,GAAG,CAC5C,cAAsB,EACtB,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OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AA/CY,QAAA,sBAAsB,0BA+ClC"}
package/lib/sdk/base.d.ts CHANGED
@@ -113,7 +113,7 @@ export declare class BaseOpenSeaSDK {
113
113
  * @param options.salt Arbitrary salt. Auto-generated if not provided.
114
114
  * @param options.expirationTime Expiration time for the order, in UTC seconds
115
115
  * @param options.zone Zone for order protection. Defaults to chain's signed zone.
116
- * @returns The {@link OrderV2} that was created.
116
+ * @returns The {@link Offer} that was created.
117
117
  */
118
118
  createOffer(options: {
119
119
  asset: AssetWithTokenId;
@@ -124,7 +124,7 @@ export declare class BaseOpenSeaSDK {
124
124
  salt?: Amount;
125
125
  expirationTime?: Amount;
126
126
  zone?: string;
127
- }): Promise<OrderV2>;
127
+ }): Promise<Offer>;
128
128
  /**
129
129
  * Create and submit a listing for an asset.
130
130
  * @param options
@@ -139,7 +139,7 @@ export declare class BaseOpenSeaSDK {
139
139
  * @param options.buyerAddress Optional address that's allowed to purchase this item.
140
140
  * @param options.includeOptionalCreatorFees If true, optional creator fees will be included. Default: false.
141
141
  * @param options.zone Zone for order protection. Defaults to no zone.
142
- * @returns The {@link OrderV2} that was created.
142
+ * @returns The {@link Listing} that was created.
143
143
  */
144
144
  createListing(options: {
145
145
  asset: AssetWithTokenId;
@@ -153,7 +153,7 @@ export declare class BaseOpenSeaSDK {
153
153
  buyerAddress?: string;
154
154
  includeOptionalCreatorFees?: boolean;
155
155
  zone?: string;
156
- }): Promise<OrderV2>;
156
+ }): Promise<Listing>;
157
157
  /** Create and submit multiple listings using Seaport's bulk order creation. */
158
158
  createBulkListings(options: {
159
159
  listings: Array<{
@@ -171,7 +171,7 @@ export declare class BaseOpenSeaSDK {
171
171
  accountAddress: string;
172
172
  continueOnError?: boolean;
173
173
  onProgress?: (completed: number, total: number) => void;
174
- }): Promise<BulkOrderResult>;
174
+ }): Promise<BulkOrderResult<Listing>>;
175
175
  /** Create and submit multiple offers using Seaport's bulk order creation. */
176
176
  createBulkOffers(options: {
177
177
  offers: Array<{
@@ -186,7 +186,7 @@ export declare class BaseOpenSeaSDK {
186
186
  accountAddress: string;
187
187
  continueOnError?: boolean;
188
188
  onProgress?: (completed: number, total: number) => void;
189
- }): Promise<BulkOrderResult>;
189
+ }): Promise<BulkOrderResult<Offer>>;
190
190
  /** Create and submit a collection offer. */
191
191
  createCollectionOffer(options: {
192
192
  collectionSlug: string;
package/lib/sdk/base.js CHANGED
@@ -143,7 +143,7 @@ class BaseOpenSeaSDK {
143
143
  * @param options.salt Arbitrary salt. Auto-generated if not provided.
144
144
  * @param options.expirationTime Expiration time for the order, in UTC seconds
145
145
  * @param options.zone Zone for order protection. Defaults to chain's signed zone.
146
- * @returns The {@link OrderV2} that was created.
146
+ * @returns The {@link Offer} that was created.
147
147
  */
148
148
  async createOffer(options) {
149
149
  return this._ordersManager.createOffer(options);
@@ -162,7 +162,7 @@ class BaseOpenSeaSDK {
162
162
  * @param options.buyerAddress Optional address that's allowed to purchase this item.
163
163
  * @param options.includeOptionalCreatorFees If true, optional creator fees will be included. Default: false.
164
164
  * @param options.zone Zone for order protection. Defaults to no zone.
165
- * @returns The {@link OrderV2} that was created.
165
+ * @returns The {@link Listing} that was created.
166
166
  */
167
167
  async createListing(options) {
168
168
  return this._ordersManager.createListing(options);
@@ -1,15 +1,18 @@
1
1
  import type { OrderComponents } from "@opensea/seaport-js/lib/types";
2
- import type { CollectionOffer } from "../api/types";
3
- import type { OrderV2, ProtocolData } from "../orders/types";
2
+ import type { CollectionOffer, Listing, Offer } from "../api/types";
3
+ import type { ProtocolData } from "../orders/types";
4
4
  import { type Amount, type AssetWithTokenId, OrderSide } from "../types";
5
5
  import type { SDKContext } from "./context";
6
6
  /**
7
7
  * Result type for bulk operations that may partially succeed.
8
8
  * Contains successfully submitted orders and any failures with error information.
9
+ *
10
+ * Generic in the success type so listing-side callers see {@link Listing}[] and
11
+ * offer-side callers see {@link Offer}[].
9
12
  */
10
- export interface BulkOrderResult {
13
+ export interface BulkOrderResult<T extends Listing | Offer = Listing | Offer> {
11
14
  /** Successfully submitted orders */
12
- successful: OrderV2[];
15
+ successful: T[];
13
16
  /** Failed order submissions with error information */
14
17
  failed: Array<{
15
18
  /** Index of the failed order in the original input array */
@@ -91,7 +94,7 @@ export declare class OrdersManager {
91
94
  * @param options.expirationTime Expiration time for the order, in UTC seconds
92
95
  * @param options.zone Zone for order protection. Defaults to chain's signed zone.
93
96
  *
94
- * @returns The {@link OrderV2} that was created.
97
+ * @returns The {@link Offer} that was created.
95
98
  *
96
99
  * @throws Error if the asset does not contain a token id.
97
100
  * @throws Error if the accountAddress is not available through wallet or provider.
@@ -106,7 +109,7 @@ export declare class OrdersManager {
106
109
  salt?: Amount;
107
110
  expirationTime?: Amount;
108
111
  zone?: string;
109
- }): Promise<OrderV2>;
112
+ }): Promise<Offer>;
110
113
  /**
111
114
  * Create and submit a listing for an asset.
112
115
  * @param options
@@ -121,7 +124,7 @@ export declare class OrdersManager {
121
124
  * @param options.buyerAddress 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.
122
125
  * @param options.includeOptionalCreatorFees If true, optional creator fees will be included in the listing. Default: false.
123
126
  * @param options.zone Zone for order protection. Defaults to no zone.
124
- * @returns The {@link OrderV2} that was created.
127
+ * @returns The {@link Listing} that was created.
125
128
  *
126
129
  * @throws Error if the asset does not contain a token id.
127
130
  * @throws Error if the accountAddress is not available through wallet or provider.
@@ -139,7 +142,7 @@ export declare class OrdersManager {
139
142
  buyerAddress?: string;
140
143
  includeOptionalCreatorFees?: boolean;
141
144
  zone?: string;
142
- }): Promise<OrderV2>;
145
+ }): Promise<Listing>;
143
146
  /**
144
147
  * Create and submit multiple listings using Seaport's bulk order creation.
145
148
  * This method uses a single signature for all listings and submits them individually to the OpenSea API with rate limit handling.
@@ -176,7 +179,7 @@ export declare class OrdersManager {
176
179
  accountAddress: string;
177
180
  continueOnError?: boolean;
178
181
  onProgress?: (completed: number, total: number) => void;
179
- }): Promise<BulkOrderResult>;
182
+ }): Promise<BulkOrderResult<Listing>>;
180
183
  /**
181
184
  * Create and submit multiple offers using Seaport's bulk order creation.
182
185
  * This method uses a single signature for all offers and submits them individually to the OpenSea API with rate limit handling.
@@ -210,7 +213,7 @@ export declare class OrdersManager {
210
213
  accountAddress: string;
211
214
  continueOnError?: boolean;
212
215
  onProgress?: (completed: number, total: number) => void;
213
- }): Promise<BulkOrderResult>;
216
+ }): Promise<BulkOrderResult<Offer>>;
214
217
  /**
215
218
  * Create and submit a collection offer.
216
219
  * @param options
package/lib/sdk/orders.js CHANGED
@@ -224,7 +224,7 @@ class OrdersManager {
224
224
  * @param options.expirationTime Expiration time for the order, in UTC seconds
225
225
  * @param options.zone Zone for order protection. Defaults to chain's signed zone.
226
226
  *
227
- * @returns The {@link OrderV2} that was created.
227
+ * @returns The {@link Offer} that was created.
228
228
  *
229
229
  * @throws Error if the asset does not contain a token id.
230
230
  * @throws Error if the accountAddress is not available through wallet or provider.
@@ -241,11 +241,7 @@ class OrdersManager {
241
241
  expirationTime,
242
242
  zone,
243
243
  });
244
- return this.context.api.postOrder(order, {
245
- protocol: "seaport",
246
- protocolAddress: this.context.seaport.contract.target,
247
- side: types_1.OrderSide.OFFER,
248
- });
244
+ return this.context.api.postOffer(order, this.context.seaport.contract.target);
249
245
  }
250
246
  /**
251
247
  * Create and submit a listing for an asset.
@@ -261,7 +257,7 @@ class OrdersManager {
261
257
  * @param options.buyerAddress 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.
262
258
  * @param options.includeOptionalCreatorFees If true, optional creator fees will be included in the listing. Default: false.
263
259
  * @param options.zone Zone for order protection. Defaults to no zone.
264
- * @returns The {@link OrderV2} that was created.
260
+ * @returns The {@link Listing} that was created.
265
261
  *
266
262
  * @throws Error if the asset does not contain a token id.
267
263
  * @throws Error if the accountAddress is not available through wallet or provider.
@@ -281,11 +277,7 @@ class OrdersManager {
281
277
  includeOptionalCreatorFees,
282
278
  zone,
283
279
  });
284
- return this.context.api.postOrder(order, {
285
- protocol: "seaport",
286
- protocolAddress: this.context.seaport.contract.target,
287
- side: types_1.OrderSide.LISTING,
288
- });
280
+ return this.context.api.postListing(order, this.context.seaport.contract.target);
289
281
  }
290
282
  /**
291
283
  * Create and submit multiple listings using Seaport's bulk order creation.
@@ -423,11 +415,7 @@ class OrdersManager {
423
415
  for (let i = 0; i < orders.length; i++) {
424
416
  this.context.logger(`Submitting listing ${i + 1}/${orders.length}...`);
425
417
  try {
426
- const submittedOrder = await this.context.api.postOrder(orders[i], {
427
- protocol: "seaport",
428
- protocolAddress: this.context.seaport.contract.target,
429
- side: types_1.OrderSide.LISTING,
430
- });
418
+ const submittedOrder = await this.context.api.postListing(orders[i], this.context.seaport.contract.target);
431
419
  submittedOrders.push(submittedOrder);
432
420
  this.context.logger(`Completed listing ${i + 1}/${orders.length}`);
433
421
  }
@@ -578,11 +566,7 @@ class OrdersManager {
578
566
  for (let i = 0; i < orders.length; i++) {
579
567
  this.context.logger(`Submitting offer ${i + 1}/${orders.length}...`);
580
568
  try {
581
- const submittedOrder = await this.context.api.postOrder(orders[i], {
582
- protocol: "seaport",
583
- protocolAddress: this.context.seaport.contract.target,
584
- side: types_1.OrderSide.OFFER,
585
- });
569
+ const submittedOrder = await this.context.api.postOffer(orders[i], this.context.seaport.contract.target);
586
570
  submittedOrders.push(submittedOrder);
587
571
  this.context.logger(`Completed offer ${i + 1}/${orders.length}`);
588
572
  }