@opensea/sdk 13.0.5 → 14.0.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 (108) hide show
  1. package/README.md +127 -131
  2. package/lib/api/api.d.ts +7 -711
  3. package/lib/api/api.js +6 -870
  4. package/lib/api/api.js.map +1 -1
  5. package/lib/api/collections.d.ts +3 -3
  6. package/lib/api/collections.js +5 -4
  7. package/lib/api/collections.js.map +1 -1
  8. package/lib/api/drops.d.ts +1 -1
  9. package/lib/api/drops.js +1 -1
  10. package/lib/api/events.js +1 -1
  11. package/lib/api/events.js.map +1 -1
  12. package/lib/api/fetcher.d.ts +1 -1
  13. package/lib/api/listings.d.ts +2 -3
  14. package/lib/api/listings.js +2 -3
  15. package/lib/api/listings.js.map +1 -1
  16. package/lib/api/nfts.d.ts +1 -1
  17. package/lib/api/nfts.js +1 -1
  18. package/lib/api/orders.d.ts +1 -1
  19. package/lib/api/orders.js +1 -1
  20. package/lib/api/tokens.js +2 -23
  21. package/lib/api/tokens.js.map +1 -1
  22. package/lib/api/types.d.ts +11 -20
  23. package/lib/api/walletAuth.d.ts +2 -2
  24. package/lib/api/walletAuth.js +2 -2
  25. package/lib/auth/index.d.ts +2 -2
  26. package/lib/auth/index.js +1 -3
  27. package/lib/auth/index.js.map +1 -1
  28. package/lib/auth/oauth.d.ts +4 -4
  29. package/lib/auth/oauth.js +4 -4
  30. package/lib/auth/siwx.d.ts +1 -8
  31. package/lib/auth/siwx.js +1 -1
  32. package/lib/auth/siwx.js.map +1 -1
  33. package/lib/auth/types.d.ts +0 -12
  34. package/lib/provider/ethers-adapter.d.ts +1 -1
  35. package/lib/provider/ethers-adapter.js +1 -1
  36. package/lib/provider/seaport-bridge.js +1 -1
  37. package/lib/provider/seaport-bridge.js.map +1 -1
  38. package/lib/provider/viem-adapter.d.ts +1 -1
  39. package/lib/provider/viem-adapter.js +1 -1
  40. package/lib/sdk/assets.d.ts +2 -2
  41. package/lib/sdk/assets.js +2 -2
  42. package/lib/sdk/base.js +2 -2
  43. package/lib/sdk/base.js.map +1 -1
  44. package/lib/sdk/cancellation.d.ts +3 -3
  45. package/lib/sdk/cancellation.js +6 -6
  46. package/lib/sdk/cancellation.js.map +1 -1
  47. package/lib/sdk/fulfillment.d.ts +2 -3
  48. package/lib/sdk/fulfillment.js +3 -4
  49. package/lib/sdk/fulfillment.js.map +1 -1
  50. package/lib/sdk/orders.d.ts +6 -6
  51. package/lib/sdk/orders.js +21 -21
  52. package/lib/sdk/orders.js.map +1 -1
  53. package/lib/stream/client.d.ts +2 -14
  54. package/lib/stream/client.js +3 -19
  55. package/lib/stream/client.js.map +1 -1
  56. package/lib/stream/types.d.ts +3 -26
  57. package/lib/stream/types.js +0 -8
  58. package/lib/stream/types.js.map +1 -1
  59. package/lib/types.d.ts +3 -9
  60. package/lib/types.js +1 -1
  61. package/lib/utils/address.d.ts +2 -2
  62. package/lib/utils/address.js +2 -2
  63. package/lib/utils/case.d.ts +9 -4
  64. package/lib/utils/case.js +1 -1
  65. package/lib/utils/fees.js +1 -1
  66. package/lib/utils/fees.js.map +1 -1
  67. package/lib/utils/rateLimit.d.ts +0 -11
  68. package/lib/utils/rateLimit.js +1 -29
  69. package/lib/utils/rateLimit.js.map +1 -1
  70. package/lib/viem.js +1 -1
  71. package/lib/viem.js.map +1 -1
  72. package/package.json +2 -2
  73. package/src/api/api.ts +12 -1447
  74. package/src/api/collections.ts +7 -4
  75. package/src/api/drops.ts +1 -1
  76. package/src/api/events.ts +1 -1
  77. package/src/api/fetcher.ts +1 -1
  78. package/src/api/listings.ts +2 -3
  79. package/src/api/nfts.ts +1 -1
  80. package/src/api/orders.ts +1 -1
  81. package/src/api/tokens.ts +2 -24
  82. package/src/api/types.ts +15 -23
  83. package/src/api/walletAuth.ts +2 -2
  84. package/src/auth/index.ts +4 -7
  85. package/src/auth/oauth.ts +4 -4
  86. package/src/auth/siwx.ts +1 -8
  87. package/src/auth/types.ts +0 -13
  88. package/src/provider/ethers-adapter.ts +1 -1
  89. package/src/provider/seaport-bridge.ts +1 -1
  90. package/src/provider/viem-adapter.ts +1 -1
  91. package/src/sdk/assets.ts +2 -2
  92. package/src/sdk/base.ts +3 -2
  93. package/src/sdk/cancellation.ts +6 -6
  94. package/src/sdk/fulfillment.ts +14 -14
  95. package/src/sdk/orders.ts +30 -21
  96. package/src/stream/client.ts +2 -26
  97. package/src/stream/types.ts +3 -29
  98. package/src/types.ts +4 -11
  99. package/src/utils/address.ts +2 -2
  100. package/src/utils/case.ts +12 -4
  101. package/src/utils/fees.ts +1 -1
  102. package/src/utils/rateLimit.ts +3 -49
  103. package/src/viem.ts +1 -1
  104. package/src/abi/ERC1155.json +0 -314
  105. package/src/abi/ERC20.json +0 -222
  106. package/src/abi/ERC721.json +0 -333
  107. package/src/abi/Multicall3.json +0 -50
  108. package/src/abi/TransferHelper.json +0 -53
package/src/api/api.ts CHANGED
@@ -1,15 +1,8 @@
1
1
  import { API_BASE_MAINNET } from "../constants"
2
- import type { FulfillmentDataResponse, ProtocolData } from "../orders/types"
3
2
  import {
4
3
  Chain,
5
- type OpenSeaAccount,
6
4
  type OpenSeaAPIConfig,
7
5
  type OpenSeaApiError,
8
- type OpenSeaCollection,
9
- type OpenSeaCollectionStats,
10
- type OpenSeaPaymentToken,
11
- type OpenSeaRateLimitError,
12
- type OrderSide,
13
6
  type RawResponseOptions,
14
7
  type RequestOptions,
15
8
  } from "../types"
@@ -37,125 +30,10 @@ import { SignalsAPI } from "./signals"
37
30
  import { TokensAPI } from "./tokens"
38
31
  import { ToolsAPI } from "./tools"
39
32
  import { TransactionsAPI } from "./transactions"
40
- import {
41
- type AgentProfileRelationshipsResponse,
42
- type BatchCollectionsRequest,
43
- type BatchNftsRequest,
44
- type BatchTokensRequest,
45
- type BuildOfferResponse,
46
- type CancelOrderResponse,
47
- type ClosedPositionsResponse,
48
- type CollectionBatchResponse,
49
- type CollectionFloorPricesArgs,
50
- type CollectionHoldersArgs,
51
- type CollectionHoldersPaginatedResponse,
52
- type CollectionOffer,
53
- type CollectionOfferAggregatesPaginatedResponse,
54
- CollectionOrderByOption,
55
- type CreateCancelOrderActionsRequest,
56
- type CreateCancelOrderActionsResponse,
57
- type CreateListingActionsRequest,
58
- type CreateListingActionsResponse,
59
- type CreateListingFulfillmentActionsRequest,
60
- type CreateListingFulfillmentActionsResponse,
61
- type CreateOfferActionsRequest,
62
- type CreateOfferActionsResponse,
63
- type CreateOfferFulfillmentActionsRequest,
64
- type CreateOfferFulfillmentActionsResponse,
65
- type CrossChainDropMintRequest,
66
- type CrossChainDropMintResponse,
67
- type CrossChainFulfillmentRequest,
68
- type CrossChainFulfillmentResponse,
69
- type DropDeployReceiptResponse,
70
- type DropDeployRequest,
71
- type DropDeployResponse,
72
- type DropMintRequest,
73
- type DropMintResponse,
74
- type FloorPriceHistoryResponse,
75
- type GetAccountTokenActivityArgs,
76
- type GetAccountTokenActivityResponse,
77
- type GetAccountTokensArgs,
78
- type GetAccountTokensResponse,
79
- type GetBestListingResponse,
80
- type GetBestOfferResponse,
81
- type GetChainsResponse,
82
- type GetCollectionsPaginatedResponse,
83
- type GetCollectionsResponse,
84
- type GetContractResponse,
85
- type GetDropResponse,
86
- type GetDropsArgs,
87
- type GetDropsResponse,
88
- type GetEventsArgs,
89
- type GetEventsByCollectionArgs,
90
- type GetEventsResponse,
91
- type GetListingsResponse,
92
- type GetNFTMetadataResponse,
93
- type GetNFTResponse,
94
- type GetNFTsByAccountOptions,
95
- type GetOffersResponse,
96
- type GetOrderByHashResponse,
97
- type GetSwapQuoteArgs,
98
- type GetSwapQuoteResponse,
99
- type GetTokenGroupResponse,
100
- type GetTokenGroupsArgs,
101
- type GetTokenGroupsResponse,
102
- type GetTokenResponse,
103
- type GetTokensArgs,
104
- type GetTopCollectionsArgs,
105
- type GetTopTokensResponse,
106
- type GetTraitsResponse,
107
- type GetTrendingCollectionsArgs,
108
- type GetTrendingTokensResponse,
109
- type Listing,
110
- type ListNFTsResponse,
111
- type NFTOwnersArgs,
112
- type NftAnalyticsResponse,
113
- type NftBatchResponse,
114
- type Offer,
115
- type OhlcvResponse,
116
- type OwnersPaginatedResponse,
117
- type PaginatedAnalyticsArgs,
118
- type PortfolioArgs,
119
- type PortfolioHistoryResponse,
120
- type PortfolioStatsResponse,
121
- type PositionTokenTransfersResponse,
122
- type PriceHistoryResponse,
123
- type ProfileCollectionsArgs,
124
- type ProfileCollectionsResponse,
125
- type ProfileFavoritesArgs,
126
- type ProfileFavoritesResponse,
127
- type ProfileListingsResponse,
128
- type ProfileOffersResponse,
129
- type ProfileOrdersArgs,
130
- type RequestInstantApiKeyResponse,
131
- type ResolveAccountResponse,
132
- type SearchArgs,
133
- type SearchResponse,
134
- type SwapExecuteRequest,
135
- type SwapExecuteResponse,
136
- type SweepCollectionRequest,
137
- type SweepCollectionResponse,
138
- type TokenActivityArgs,
139
- type TokenActivityStatsArgs,
140
- type TokenActivityStatsResponse,
141
- type TokenBatchResponse,
142
- type TokenHoldersArgs,
143
- type TokenHoldersResponse,
144
- type TokenLiquidityPoolsArgs,
145
- type TokenLiquidityPoolsResponse,
146
- type TokenSwapActivityPaginatedResponse,
147
- type TokenTimeSeriesArgs,
148
- type TraitFilter,
149
- type TraitFloorsResponse,
150
- type TraitOffersFilters,
151
- type TransactionReceiptRequest,
152
- type TransactionReceiptResponse,
153
- type TransferRequest,
154
- type TransferResponse,
155
- type ValidateMetadataResponse,
156
- type WalletClosedPositionsArgs,
157
- type WalletPnlResponse,
158
- type WalletTokenTransfersArgs,
33
+ import type {
34
+ RequestInstantApiKeyResponse,
35
+ SearchArgs,
36
+ SearchResponse,
159
37
  } from "./types"
160
38
  import { WalletAuthAPI } from "./walletAuth"
161
39
 
@@ -196,8 +74,8 @@ export class OpenSeaAPI {
196
74
  private chain: Chain
197
75
 
198
76
  /**
199
- * Per-domain clients. Prefer these over the flat `getCollection` / `getTraits` style methods on
200
- * this class, which are deprecated and will be removed in the next major.
77
+ * Per-domain clients. Every endpoint is reached through one of these, for example
78
+ * `api.collections.getCollection(slug)`.
201
79
  *
202
80
  * `search` is absent because `SearchAPI` holds a single method also called `search`, so the
203
81
  * property and the existing `search()` method want the same name and only one can be added
@@ -273,715 +151,6 @@ export class OpenSeaAPI {
273
151
  this.walletAuth = new WalletAuthAPI(fetcher)
274
152
  }
275
153
 
276
- /**
277
- * Gets a single order by its order hash.
278
- * @param orderHash The hash of the order to fetch
279
- * @param protocolAddress The address of the seaport contract
280
- * @param chain The chain where the order is located. Defaults to the chain set in the constructor.
281
- * @returns The {@link GetOrderByHashResponse} returned by the API (can be Offer or Listing)
282
- * @throws An error if the order is not found
283
- * @deprecated Use `api.orders.getOrderByHash()`. Removed in the next major.
284
- */
285
- public async getOrderByHash(
286
- orderHash: string,
287
- protocolAddress: string,
288
- chain: Chain = this.chain,
289
- ): Promise<GetOrderByHashResponse> {
290
- return this.orders.getOrderByHash(orderHash, protocolAddress, chain)
291
- }
292
-
293
- /**
294
- * Gets all offers for a given collection.
295
- * @param collectionSlug The slug of the collection.
296
- * @param limit The number of offers to return. Must be between 1 and 100. Default: 100
297
- * @param next The cursor for the next page of results. This is returned from a previous request.
298
- * @param maker Only return offers made by this wallet address.
299
- * @returns The {@link GetOffersResponse} returned by the API.
300
- * @deprecated Use `api.offers.getAllOffers()`. Removed in the next major.
301
- */
302
- public async getAllOffers(
303
- collectionSlug: string,
304
- limit?: number,
305
- next?: string,
306
- maker?: string,
307
- ): Promise<GetOffersResponse> {
308
- return this.offers.getAllOffers(collectionSlug, limit, next, maker)
309
- }
310
-
311
- /**
312
- * Gets all listings for a given collection.
313
- * @param collectionSlug The slug of the collection.
314
- * @param limit The number of listings to return. Must be between 1 and 100. Default: 100
315
- * @param next The cursor for the next page of results. This is returned from a previous request.
316
- * @param includePrivateListings Whether to include private listings (default: false)
317
- * @param maker Only return listings made by this wallet address.
318
- * @returns The {@link GetListingsResponse} returned by the API.
319
- * @deprecated Use `api.listings.getAllListings()`. Removed in the next major.
320
- */
321
- public async getAllListings(
322
- collectionSlug: string,
323
- limit?: number,
324
- next?: string,
325
- includePrivateListings?: boolean,
326
- maker?: string,
327
- ): Promise<GetListingsResponse> {
328
- return this.listings.getAllListings(
329
- collectionSlug,
330
- limit,
331
- next,
332
- includePrivateListings,
333
- maker,
334
- )
335
- }
336
-
337
- /**
338
- * Gets trait offers for a given collection.
339
- * @param collectionSlug The slug of the collection.
340
- * @param type The name of the trait (e.g. 'Background').
341
- * @param value The value of the trait (e.g. 'Red').
342
- * @param limit The number of offers to return. Must be between 1 and 100. Default: 100
343
- * @param next The cursor for the next page of results. This is returned from a previous request.
344
- * @param floatValue The value of the trait for decimal-based numeric traits.
345
- * @param intValue The value of the trait for integer-based numeric traits.
346
- * @param filters Optional {@link TraitOffersFilters}: `mode`, a numeric range, or multi-trait `traits`.
347
- * @returns The {@link GetOffersResponse} returned by the API.
348
- * @deprecated Use `api.offers.getTraitOffers()`. Removed in the next major.
349
- */
350
- public async getTraitOffers(
351
- collectionSlug: string,
352
- type: string | undefined,
353
- value: string | undefined,
354
- limit?: number,
355
- next?: string,
356
- floatValue?: number,
357
- intValue?: number,
358
- filters?: TraitOffersFilters,
359
- ): Promise<GetOffersResponse> {
360
- return this.offers.getTraitOffers(
361
- collectionSlug,
362
- type,
363
- value,
364
- limit,
365
- next,
366
- floatValue,
367
- intValue,
368
- filters,
369
- )
370
- }
371
-
372
- /**
373
- * Gets the best offer for a given token.
374
- * @param collectionSlug The slug of the collection.
375
- * @param tokenId The token identifier.
376
- * @returns The {@link GetBestOfferResponse} returned by the API.
377
- * @deprecated Use `api.offers.getBestOffer()`. Removed in the next major.
378
- */
379
- public async getBestOffer(
380
- collectionSlug: string,
381
- tokenId: string | number,
382
- ): Promise<GetBestOfferResponse> {
383
- return this.offers.getBestOffer(collectionSlug, tokenId)
384
- }
385
-
386
- /**
387
- * Gets the best listing for a given token.
388
- * @param collectionSlug The slug of the collection.
389
- * @param tokenId The token identifier.
390
- * @param includePrivateListings Whether to include private listings (default: false)
391
- * @returns The {@link GetBestListingResponse} returned by the API.
392
- * @deprecated Use `api.listings.getBestListing()`. Removed in the next major.
393
- */
394
- public async getBestListing(
395
- collectionSlug: string,
396
- tokenId: string | number,
397
- includePrivateListings?: boolean,
398
- ): Promise<GetBestListingResponse> {
399
- return this.listings.getBestListing(
400
- collectionSlug,
401
- tokenId,
402
- includePrivateListings,
403
- )
404
- }
405
-
406
- /**
407
- * Gets the best listings for a given collection.
408
- * @param collectionSlug The slug of the collection.
409
- * @param limit The number of listings to return. Must be between 1 and 100. Default: 100
410
- * @param next The cursor for the next page of results. This is returned from a previous request.
411
- * @param includePrivateListings Whether to include private listings (default: false)
412
- * @param traits Optional {@link TraitFilter} array. Returns 400 if a single trait matches more than 1000 items.
413
- * @returns The {@link GetListingsResponse} returned by the API.
414
- * @deprecated Use `api.listings.getBestListings()`. Removed in the next major.
415
- */
416
- public async getBestListings(
417
- collectionSlug: string,
418
- limit?: number,
419
- next?: string,
420
- includePrivateListings?: boolean,
421
- traits?: TraitFilter[],
422
- ): Promise<GetListingsResponse> {
423
- return this.listings.getBestListings(
424
- collectionSlug,
425
- limit,
426
- next,
427
- includePrivateListings,
428
- traits,
429
- )
430
- }
431
-
432
- /**
433
- * Get cross-chain fulfillment data for one or more listings.
434
- * Supports same-chain, cross-token, and cross-chain purchases (up to 50 listings).
435
- * All listings must be EVM (Seaport orders). Payment can be from any chain (EVM or SVM).
436
- * @param request The cross-chain fulfillment request containing listings, fulfiller, payment, and optional recipient
437
- * @returns The {@link CrossChainFulfillmentResponse} with ordered transactions to sign and submit
438
- * @deprecated Use `api.listings.getCrossChainFulfillmentData()`. Removed in the next major.
439
- */
440
- public async getCrossChainFulfillmentData(
441
- request: CrossChainFulfillmentRequest,
442
- ): Promise<CrossChainFulfillmentResponse> {
443
- return this.listings.getCrossChainFulfillmentData(request)
444
- }
445
-
446
- /**
447
- * Generate the data needed to fulfill a listing or an offer onchain.
448
- * @param fulfillerAddress The wallet address which will be used to fulfill the order
449
- * @param orderHash The hash of the order to fulfill
450
- * @param protocolAddress The address of the seaport contract
451
- * @param side The side of the order (buy or sell)
452
- * @param assetContractAddress Optional address of the NFT contract for criteria offers (e.g., collection offers)
453
- * @param tokenId Optional token ID for criteria offers (e.g., collection offers)
454
- * @param unitsToFill Optional number of units to fill. Defaults to 1 for both listings and offers.
455
- * @param recipientAddress Optional recipient address for the NFT when fulfilling a listing. Not applicable for offers.
456
- * @param includeOptionalCreatorFees Whether to include optional creator fees in the fulfillment. If creator fees are already required, this is a no-op. Defaults to false.
457
- * @returns The {@link FulfillmentDataResponse}
458
- * @deprecated Use `api.orders.generateFulfillmentData()`. Removed in the next major.
459
- */
460
- public async generateFulfillmentData(
461
- fulfillerAddress: string,
462
- orderHash: string,
463
- protocolAddress: string,
464
- side: OrderSide,
465
- assetContractAddress?: string,
466
- tokenId?: string,
467
- unitsToFill?: string,
468
- recipientAddress?: string,
469
- includeOptionalCreatorFees: boolean = false,
470
- ): Promise<Camelize<FulfillmentDataResponse>> {
471
- return this.orders.generateFulfillmentData(
472
- fulfillerAddress,
473
- orderHash,
474
- protocolAddress,
475
- side,
476
- assetContractAddress,
477
- tokenId,
478
- unitsToFill,
479
- recipientAddress,
480
- includeOptionalCreatorFees,
481
- )
482
- }
483
-
484
- /**
485
- * Post a listing to OpenSea. Returns the new v2 Listing response format.
486
- * @param order The order to post
487
- * @param protocolAddress The contract address of the seaport protocol
488
- * @returns The {@link Listing} posted to the API.
489
- * @deprecated Use `api.orders.postListing()`. Removed in the next major.
490
- */
491
- public async postListing(
492
- order: ProtocolData,
493
- protocolAddress: string,
494
- ): Promise<Listing> {
495
- return this.orders.postListing(order, protocolAddress)
496
- }
497
-
498
- /**
499
- * Post an offer to OpenSea. Returns the new v2 Offer response format.
500
- * @param order The order to post
501
- * @param protocolAddress The contract address of the seaport protocol
502
- * @returns The {@link Offer} posted to the API.
503
- * @deprecated Use `api.orders.postOffer()`. Removed in the next major.
504
- */
505
- public async postOffer(
506
- order: ProtocolData,
507
- protocolAddress: string,
508
- ): Promise<Offer> {
509
- return this.orders.postOffer(order, protocolAddress)
510
- }
511
-
512
- /**
513
- * Build a OpenSea collection offer.
514
- * @param offererAddress The wallet address which is creating the offer.
515
- * @param quantity The number of NFTs requested in the offer.
516
- * @param collectionSlug The slug (identifier) of the collection to build the offer for.
517
- * @param offerProtectionEnabled Build the offer on OpenSea's signed zone to provide offer protections from receiving an item which is disabled from trading.
518
- * @param traitType If defined, the trait name to create the collection offer for.
519
- * @param traitValue If defined, the trait value to create the collection offer for.
520
- * @param traits If defined, an array of traits to create the multi-trait collection offer for.
521
- * @param numericTraits If defined, an array of numeric trait criteria with min/max ranges.
522
- * @returns The {@link BuildOfferResponse} returned by the API.
523
- * @deprecated Use `api.offers.buildOffer()`. Removed in the next major.
524
- */
525
- public async buildOffer(
526
- offererAddress: string,
527
- quantity: number,
528
- collectionSlug: string,
529
- offerProtectionEnabled = true,
530
- traitType?: string,
531
- traitValue?: string,
532
- traits?: Array<{ type: string; value: string }>,
533
- numericTraits?: Array<{ type: string; min?: number; max?: number }>,
534
- ): Promise<BuildOfferResponse> {
535
- return this.offers.buildOffer(
536
- offererAddress,
537
- quantity,
538
- collectionSlug,
539
- offerProtectionEnabled,
540
- traitType,
541
- traitValue,
542
- traits,
543
- numericTraits,
544
- )
545
- }
546
-
547
- /**
548
- * Get a list collection offers for a given slug.
549
- * @param slug The slug (identifier) of the collection to list offers for
550
- * @param limit Optional limit for number of results.
551
- * @param next Optional cursor for pagination.
552
- * @returns The {@link GetOffersResponse} returned by the API.
553
- * @deprecated Use `api.offers.getCollectionOffers()`. Removed in the next major.
554
- */
555
- public async getCollectionOffers(
556
- slug: string,
557
- limit?: number,
558
- next?: string,
559
- ): Promise<GetOffersResponse> {
560
- return this.offers.getCollectionOffers(slug, limit, next)
561
- }
562
-
563
- /**
564
- * Post a collection offer to OpenSea.
565
- * @param order The collection offer to post.
566
- * @param slug The slug (identifier) of the collection to post the offer for.
567
- * @param traitType If defined, the trait name to create the collection offer for.
568
- * @param traitValue If defined, the trait value to create the collection offer for.
569
- * @param traits If defined, an array of traits to create the multi-trait collection offer for.
570
- * @param numericTraits If defined, an array of numeric trait criteria with min/max ranges.
571
- * @returns The {@link Offer} returned to the API.
572
- * @deprecated Use `api.offers.postCollectionOffer()`. Removed in the next major.
573
- */
574
- public async postCollectionOffer(
575
- order: ProtocolData,
576
- slug: string,
577
- traitType?: string,
578
- traitValue?: string,
579
- traits?: Array<{ type: string; value: string }>,
580
- numericTraits?: Array<{ type: string; min?: number; max?: number }>,
581
- ): Promise<CollectionOffer | null> {
582
- return this.offers.postCollectionOffer(
583
- order,
584
- slug,
585
- traitType,
586
- traitValue,
587
- traits,
588
- numericTraits,
589
- )
590
- }
591
-
592
- /**
593
- * Fetch multiple NFTs for a collection.
594
- * @param slug The slug (identifier) of the collection
595
- * @param limit The number of NFTs to retrieve. Must be greater than 0 and less than 51.
596
- * @param next Cursor to retrieve the next page of NFTs
597
- * @param traits Optional {@link TraitFilter} array. Returns 400 if a single trait matches more than 1000 items.
598
- * @param hasAgentBinding Only return NFTs that do (`true`) or do not (`false`) have an ERC-8217 agent binding.
599
- * @returns The {@link ListNFTsResponse} returned by the API.
600
- * @deprecated Use `api.nfts.getNFTsByCollection()`. Removed in the next major.
601
- */
602
- public async getNFTsByCollection(
603
- slug: string,
604
- limit: number | undefined = undefined,
605
- next: string | undefined = undefined,
606
- traits: TraitFilter[] | undefined = undefined,
607
- hasAgentBinding: boolean | undefined = undefined,
608
- ): Promise<ListNFTsResponse> {
609
- return this.nfts.getNFTsByCollection(
610
- slug,
611
- limit,
612
- next,
613
- traits,
614
- hasAgentBinding,
615
- )
616
- }
617
-
618
- /**
619
- * Fetch multiple NFTs for a contract.
620
- * @param address The NFT's contract address.
621
- * @param limit The number of NFTs to retrieve. Must be greater than 0 and less than 51.
622
- * @param next Cursor to retrieve the next page of NFTs.
623
- * @param chain The NFT's chain.
624
- * @returns The {@link ListNFTsResponse} returned by the API.
625
- * @deprecated Use `api.nfts.getNFTsByContract()`. Removed in the next major.
626
- */
627
- public async getNFTsByContract(
628
- address: string,
629
- limit: number | undefined = undefined,
630
- next: string | undefined = undefined,
631
- chain: Chain = this.chain,
632
- ): Promise<ListNFTsResponse> {
633
- return this.nfts.getNFTsByContract(address, limit, next, chain)
634
- }
635
-
636
- /**
637
- * Fetch NFTs owned by an account.
638
- * @param address The address of the account
639
- * @param limit The number of NFTs to retrieve. Must be greater than 0 and less than 51.
640
- * @param next Cursor to retrieve the next page of NFTs
641
- * @param chain The chain to query. Defaults to the chain set in the constructor.
642
- * @param options Non-pagination filters, currently `includeAutoHidden`.
643
- * @returns The {@link ListNFTsResponse} returned by the API.
644
- * @deprecated Use `api.nfts.getNFTsByAccount()`. Removed in the next major.
645
- */
646
- public async getNFTsByAccount(
647
- address: string,
648
- limit: number | undefined = undefined,
649
- next: string | undefined = undefined,
650
- chain = this.chain,
651
- options?: GetNFTsByAccountOptions,
652
- ): Promise<ListNFTsResponse> {
653
- return this.nfts.getNFTsByAccount(address, limit, next, chain, options)
654
- }
655
-
656
- /**
657
- * Fetch metadata, traits, ownership information, and rarity for a single NFT.
658
- * @param address The NFT's contract address.
659
- * @param identifier the identifier of the NFT (i.e. Token ID)
660
- * @param chain The NFT's chain.
661
- * @returns The {@link GetNFTResponse} returned by the API.
662
- * @deprecated Use `api.nfts.getNFT()`. Removed in the next major.
663
- */
664
- public async getNFT(
665
- address: string,
666
- identifier: string,
667
- chain = this.chain,
668
- ): Promise<GetNFTResponse> {
669
- return this.nfts.getNFT(address, identifier, chain)
670
- }
671
-
672
- /**
673
- * Fetch an OpenSea collection.
674
- * @param slug The slug (identifier) of the collection.
675
- * @returns The {@link OpenSeaCollection} returned by the API.
676
- * @deprecated Use `api.collections.getCollection()`. Removed in the next major.
677
- */
678
- public async getCollection(slug: string): Promise<OpenSeaCollection> {
679
- return this.collections.getCollection(slug)
680
- }
681
-
682
- /**
683
- * Fetch a list of OpenSea collections.
684
- * @param orderBy The order to return the collections in. Default: CREATED_DATE
685
- * @param chain The chain to filter the collections on. Default: all chains
686
- * @param creatorUsername The creator's OpenSea username to filter the collections on.
687
- * @param includeHidden If hidden collections should be returned. Default: false
688
- * @param limit The limit of collections to return.
689
- * @param next The cursor for the next page of results. This is returned from a previous request.
690
- * @returns List of {@link OpenSeaCollection} returned by the API.
691
- * @deprecated Use `api.collections.getCollections()`. Removed in the next major.
692
- */
693
- public async getCollections(
694
- orderBy: CollectionOrderByOption = CollectionOrderByOption.CREATED_DATE,
695
- chain?: Chain,
696
- creatorUsername?: string,
697
- includeHidden: boolean = false,
698
- limit?: number,
699
- next?: string,
700
- ): Promise<GetCollectionsResponse> {
701
- return this.collections.getCollections(
702
- orderBy,
703
- chain,
704
- creatorUsername,
705
- includeHidden,
706
- limit,
707
- next,
708
- )
709
- }
710
-
711
- /**
712
- * Fetch stats for an OpenSea collection.
713
- * @param slug The slug (identifier) of the collection.
714
- * @returns The {@link OpenSeaCollection} returned by the API.
715
- * @deprecated Use `api.collections.getCollectionStats()`. Removed in the next major.
716
- */
717
- public async getCollectionStats(
718
- slug: string,
719
- ): Promise<OpenSeaCollectionStats> {
720
- return this.collections.getCollectionStats(slug)
721
- }
722
-
723
- /**
724
- * Fetch a payment token.
725
- * @param address The address of the payment token
726
- * @param chain The chain of the payment token
727
- * @returns The {@link OpenSeaPaymentToken} returned by the API.
728
- * @deprecated Use `api.accounts.getPaymentToken()`. Removed in the next major.
729
- */
730
- public async getPaymentToken(
731
- address: string,
732
- chain = this.chain,
733
- ): Promise<OpenSeaPaymentToken> {
734
- return this.accounts.getPaymentToken(address, chain)
735
- }
736
-
737
- /**
738
- * Fetch account for an address.
739
- * @param address The address to fetch the account for
740
- * @returns The {@link OpenSeaAccount} returned by the API.
741
- * @deprecated Use `api.accounts.getAccount()`. Removed in the next major.
742
- */
743
- public async getAccount(address: string): Promise<OpenSeaAccount> {
744
- return this.accounts.getAccount(address)
745
- }
746
-
747
- /**
748
- * Force refresh the metadata for an NFT.
749
- * @param address The address of the NFT's contract.
750
- * @param identifier The identifier of the NFT.
751
- * @param chain The chain where the NFT is located.
752
- * @returns The response from the API.
753
- * @deprecated Use `api.nfts.refreshNFTMetadata()`. Removed in the next major.
754
- */
755
- public async refreshNFTMetadata(
756
- address: string,
757
- identifier: string,
758
- chain: Chain = this.chain,
759
- ): Promise<Record<string, unknown>> {
760
- return this.nfts.refreshNFTMetadata(address, identifier, chain)
761
- }
762
-
763
- /**
764
- * Offchain cancel an order, offer or listing, by its order hash when protected by the SignedZone.
765
- *
766
- * The API refuses an offchain cancel for a recently created order ("Orders created recently
767
- * must be cancelled onchain"). Cancel it onchain instead with `sdk.cancelOrder()`, or build the
768
- * steps with `api.orders.createCancelOrderActions()`.
769
- * Protocol and Chain are required to prevent hash collisions.
770
- * Please note cancellation is only assured if a fulfillment signature was not vended prior to cancellation.
771
- * @param protocolAddress The Seaport address for the order.
772
- * @param orderHash The order hash, or external identifier, of the order.
773
- * @param chain The chain where the order is located.
774
- * @param offererSignature An EIP-712 signature from the offerer of the order.
775
- * If this is not provided, the user associated with the API Key will be checked instead.
776
- * The signature must be a EIP-712 signature consisting of the order's Seaport contract's
777
- * name, version, address, and chain. The struct to sign is `OrderHash` containing a
778
- * single bytes32 field.
779
- * @returns The response from the API.
780
- * @deprecated Use `api.orders.offchainCancelOrder()`. Removed in the next major.
781
- */
782
- public async offchainCancelOrder(
783
- protocolAddress: string,
784
- orderHash: string,
785
- chain: Chain = this.chain,
786
- offererSignature?: string,
787
- ): Promise<CancelOrderResponse> {
788
- return this.orders.offchainCancelOrder(
789
- protocolAddress,
790
- orderHash,
791
- chain,
792
- offererSignature,
793
- )
794
- }
795
-
796
- /**
797
- * Get ordered actions to cancel an order onchain.
798
- * @deprecated Use `api.orders.createCancelOrderActions()`. Removed in the next major.
799
- */
800
- public async createCancelOrderActions(
801
- protocolAddress: string,
802
- orderIdentifier: string,
803
- request: CreateCancelOrderActionsRequest,
804
- chain: Chain = this.chain,
805
- ): Promise<CreateCancelOrderActionsResponse> {
806
- return this.orders.createCancelOrderActions(
807
- protocolAddress,
808
- orderIdentifier,
809
- request,
810
- chain,
811
- )
812
- }
813
-
814
- /**
815
- * Gets a list of events based on query parameters.
816
- * @param args Query parameters for filtering events.
817
- * @returns The {@link GetEventsResponse} returned by the API.
818
- * @deprecated Use `api.events.getEvents()`. Removed in the next major.
819
- */
820
- public async getEvents(args?: GetEventsArgs): Promise<GetEventsResponse> {
821
- return this.events.getEvents(args)
822
- }
823
-
824
- /**
825
- * Gets a list of events for a specific account.
826
- * @param address The account address.
827
- * @param args Query parameters for filtering events.
828
- * @returns The {@link GetEventsResponse} returned by the API.
829
- * @deprecated Use `api.events.getEventsByAccount()`. Removed in the next major.
830
- */
831
- public async getEventsByAccount(
832
- address: string,
833
- args?: GetEventsArgs,
834
- ): Promise<GetEventsResponse> {
835
- return this.events.getEventsByAccount(address, args)
836
- }
837
-
838
- /**
839
- * Gets a list of events for a specific collection. Pass `args.traits` to
840
- * filter server-side by item traits (multiple entries are AND-combined).
841
- * @param collectionSlug The slug (identifier) of the collection.
842
- * @param args Query parameters; see {@link GetEventsByCollectionArgs}.
843
- * @returns The {@link GetEventsResponse} returned by the API.
844
- * @deprecated Use `api.events.getEventsByCollection()`. Removed in the next major.
845
- */
846
- public async getEventsByCollection(
847
- collectionSlug: string,
848
- args?: GetEventsByCollectionArgs,
849
- ): Promise<GetEventsResponse> {
850
- return this.events.getEventsByCollection(collectionSlug, args)
851
- }
852
-
853
- /**
854
- * Gets a list of events for a specific NFT.
855
- * @param chain The chain where the NFT is located.
856
- * @param address The contract address of the NFT.
857
- * @param identifier The token identifier.
858
- * @param args Query parameters for filtering events.
859
- * @returns The {@link GetEventsResponse} returned by the API.
860
- * @deprecated Use `api.events.getEventsByNFT()`. Removed in the next major.
861
- */
862
- public async getEventsByNFT(
863
- chain: Chain,
864
- address: string,
865
- identifier: string,
866
- args?: GetEventsArgs,
867
- ): Promise<GetEventsResponse> {
868
- return this.events.getEventsByNFT(chain, address, identifier, args)
869
- }
870
-
871
- /**
872
- * Fetch smart contract information for a given chain and address.
873
- * @param address The contract address.
874
- * @param chain The chain where the contract is deployed. Defaults to the chain set in the constructor.
875
- * @returns The {@link GetContractResponse} returned by the API.
876
- * @deprecated Use `api.nfts.getContract()`. Removed in the next major.
877
- */
878
- public async getContract(
879
- address: string,
880
- chain: Chain = this.chain,
881
- ): Promise<GetContractResponse> {
882
- return this.nfts.getContract(address, chain)
883
- }
884
-
885
- /**
886
- * Fetch all traits for a collection with their possible values and counts.
887
- * @param collectionSlug The slug (identifier) of the collection.
888
- * @returns The {@link GetTraitsResponse} returned by the API.
889
- * @deprecated Use `api.collections.getTraits()`. Removed in the next major.
890
- */
891
- public async getTraits(collectionSlug: string): Promise<GetTraitsResponse> {
892
- return this.collections.getTraits(collectionSlug)
893
- }
894
-
895
- /**
896
- * Fetch floor prices per trait value for a collection.
897
- *
898
- * Covers text traits with at least one active listing, ordered by trait type, then value, then
899
- * price. Numeric traits are not enumerated here; use {@link getTraits} for their min/max range.
900
- * Every floor is denominated on the collection's own chain, identified by `chain` plus each
901
- * entry's `paymentTokenSymbol`.
902
- * @param collectionSlug The slug (identifier) of the collection.
903
- * @returns The {@link TraitFloorsResponse} returned by the API.
904
- * @deprecated Use `api.collections.getCollectionTraitFloors()`. Removed in the next major.
905
- */
906
- public async getCollectionTraitFloors(
907
- collectionSlug: string,
908
- ): Promise<TraitFloorsResponse> {
909
- return this.collections.getCollectionTraitFloors(collectionSlug)
910
- }
911
-
912
- /**
913
- * Gets a list of trending tokens.
914
- * @param args Optional query parameters for pagination.
915
- * @returns The {@link GetTrendingTokensResponse} returned by the API.
916
- * @deprecated Use `api.tokens.getTrendingTokens()`. Removed in the next major.
917
- */
918
- public async getTrendingTokens(
919
- args?: GetTokensArgs,
920
- ): Promise<GetTrendingTokensResponse> {
921
- return this.tokens.getTrendingTokens(args)
922
- }
923
-
924
- /**
925
- * Gets a list of top tokens.
926
- * @param args Optional query parameters for pagination.
927
- * @returns The {@link GetTopTokensResponse} returned by the API.
928
- * @deprecated Use `api.tokens.getTopTokens()`. Removed in the next major.
929
- */
930
- public async getTopTokens(
931
- args?: GetTokensArgs,
932
- ): Promise<GetTopTokensResponse> {
933
- return this.tokens.getTopTokens(args)
934
- }
935
-
936
- /**
937
- * Gets a swap quote for exchanging tokens.
938
- * @param args Query parameters for the swap quote including token addresses, amount, and chain.
939
- * @returns The {@link GetSwapQuoteResponse} returned by the API.
940
- * @deprecated Use `api.tokens.getSwapQuote()`. Removed in the next major.
941
- */
942
- public async getSwapQuote(
943
- args: GetSwapQuoteArgs,
944
- ): Promise<GetSwapQuoteResponse> {
945
- return this.tokens.getSwapQuote(args)
946
- }
947
-
948
- /**
949
- * Gets details for a specific token.
950
- * @param chain The chain the token is on.
951
- * @param address The token contract address.
952
- * @returns The {@link GetTokenResponse} returned by the API.
953
- * @deprecated Use `api.tokens.getToken()`. Removed in the next major.
954
- */
955
- public async getToken(
956
- chain: string,
957
- address: string,
958
- ): Promise<GetTokenResponse> {
959
- return this.tokens.getToken(chain, address)
960
- }
961
-
962
- /**
963
- * Gets a paginated list of token groups — equivalent currencies across
964
- * chains (e.g. ETH on Ethereum, Base, and Arbitrum share the "eth" group).
965
- * @param args Optional query parameters (`limit`, `cursor`).
966
- * @returns The {@link GetTokenGroupsResponse} returned by the API.
967
- * @deprecated Use `api.tokens.getTokenGroups()`. Removed in the next major.
968
- */
969
- public async getTokenGroups(
970
- args?: GetTokenGroupsArgs,
971
- ): Promise<GetTokenGroupsResponse> {
972
- return this.tokens.getTokenGroups(args)
973
- }
974
-
975
- /**
976
- * Gets a single token group by its slug (e.g. "eth").
977
- * @param slug The token group slug.
978
- * @returns The {@link GetTokenGroupResponse} returned by the API.
979
- * @deprecated Use `api.tokens.getTokenGroup()`. Removed in the next major.
980
- */
981
- public async getTokenGroup(slug: string): Promise<GetTokenGroupResponse> {
982
- return this.tokens.getTokenGroup(slug)
983
- }
984
-
985
154
  /**
986
155
  * Search across collections, tokens, NFTs, and accounts.
987
156
  * Results are ranked by relevance.
@@ -992,610 +161,6 @@ export class OpenSeaAPI {
992
161
  return this.searchAPI.search(args)
993
162
  }
994
163
 
995
- /**
996
- * Gets the list of supported blockchains and their capabilities.
997
- * @returns The {@link GetChainsResponse} returned by the API.
998
- * @deprecated Use `api.chains.getChains()`. Removed in the next major.
999
- */
1000
- public async getChains(): Promise<GetChainsResponse> {
1001
- return this.chains.getChains()
1002
- }
1003
-
1004
- /**
1005
- * Gets token balances for a given account.
1006
- * @param address The wallet address to fetch token balances for.
1007
- * @param args Optional query parameters for filtering and pagination.
1008
- * @returns The {@link GetAccountTokensResponse} returned by the API.
1009
- * @deprecated Use `api.accounts.getAccountTokens()`. Removed in the next major.
1010
- */
1011
- public async getAccountTokens(
1012
- address: string,
1013
- args?: GetAccountTokensArgs,
1014
- ): Promise<GetAccountTokensResponse> {
1015
- return this.accounts.getAccountTokens(address, args)
1016
- }
1017
-
1018
- /**
1019
- * Validate NFT metadata by fetching and parsing it.
1020
- * @param address The NFT contract address.
1021
- * @param identifier The token identifier.
1022
- * @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
1023
- * @param ignoreCachedItemUrls Whether to ignore cached item URLs and re-fetch from source.
1024
- * @returns The {@link ValidateMetadataResponse} returned by the API.
1025
- * @deprecated Use `api.nfts.validateMetadata()`. Removed in the next major.
1026
- */
1027
- public async validateNFTMetadata(
1028
- address: string,
1029
- identifier: string,
1030
- chain: Chain = this.chain,
1031
- ignoreCachedItemUrls?: boolean,
1032
- ): Promise<ValidateMetadataResponse> {
1033
- return this.nfts.validateMetadata(
1034
- address,
1035
- identifier,
1036
- chain,
1037
- ignoreCachedItemUrls,
1038
- )
1039
- }
1040
-
1041
- /**
1042
- * Gets all active offers for a specific NFT (not just the best offer).
1043
- * @param collectionSlug The collection slug.
1044
- * @param identifier The NFT token id.
1045
- * @param limit The number of offers to return. Must be between 1 and 200.
1046
- * @param next The cursor for the next page of results.
1047
- * @returns The {@link GetOffersResponse} returned by the API.
1048
- * @deprecated Use `api.offers.getOffersByNFT()`. Removed in the next major.
1049
- */
1050
- public async getOffersByNFT(
1051
- collectionSlug: string,
1052
- identifier: string | number,
1053
- limit?: number,
1054
- next?: string,
1055
- ): Promise<GetOffersResponse> {
1056
- return this.offers.getOffersByNFT(collectionSlug, identifier, limit, next)
1057
- }
1058
-
1059
- /**
1060
- * Bulk-buy items from a collection using any payment token, including
1061
- * cross-chain. Returns an ordered list of transactions to execute.
1062
- * @param request The sweep request containing buyer, collection, payment, and item caps.
1063
- * @returns The {@link SweepCollectionResponse} returned by the API.
1064
- * @deprecated Use `api.listings.sweepCollection()`. Removed in the next major.
1065
- */
1066
- public async sweepCollection(
1067
- request: SweepCollectionRequest,
1068
- ): Promise<SweepCollectionResponse> {
1069
- return this.listings.sweepCollection(request)
1070
- }
1071
-
1072
- /**
1073
- * Get executable transactions for a token swap. Companion to
1074
- * {@link OpenSeaAPI.getSwapQuote} — quote first, then execute.
1075
- * @param request The swap execution request.
1076
- * @returns The {@link SwapExecuteResponse} with transactions and a quote.
1077
- * @deprecated Use `api.tokens.executeSwap()`. Removed in the next major.
1078
- */
1079
- public async executeSwap(
1080
- request: SwapExecuteRequest,
1081
- ): Promise<SwapExecuteResponse> {
1082
- return this.tokens.executeSwap(request)
1083
- }
1084
-
1085
- /**
1086
- * Get the receipt/status for a submitted transaction. Works for all transaction
1087
- * types: listing fulfillments, cross-chain buys and mints, sweeps, offer
1088
- * fulfillments, and token swaps. Poll this endpoint to check completion status.
1089
- * @param request The transaction receipt request.
1090
- * @returns The {@link TransactionReceiptResponse} returned by the API.
1091
- * @deprecated Use `api.transactions.getTransactionReceipt()`. Removed in the next major.
1092
- */
1093
- public async getTransactionReceipt(
1094
- request: TransactionReceiptRequest,
1095
- ): Promise<TransactionReceiptResponse> {
1096
- return this.transactions.getTransactionReceipt(request)
1097
- }
1098
-
1099
- /**
1100
- * Gets a list of drops (mints).
1101
- * @param args Optional query parameters for filtering and pagination.
1102
- * @returns The {@link GetDropsResponse} returned by the API.
1103
- * @deprecated Use `api.drops.getDrops()`. Removed in the next major.
1104
- */
1105
- public async getDrops(args?: GetDropsArgs): Promise<GetDropsResponse> {
1106
- return this.drops.getDrops(args)
1107
- }
1108
-
1109
- /**
1110
- * Gets detailed drop information for a collection.
1111
- * @param slug The collection slug identifying the drop.
1112
- * @returns The {@link GetDropResponse} returned by the API.
1113
- * @deprecated Use `api.drops.getDrop()`. Removed in the next major.
1114
- */
1115
- public async getDrop(slug: string): Promise<GetDropResponse> {
1116
- return this.drops.getDrop(slug)
1117
- }
1118
-
1119
- /**
1120
- * Builds a mint transaction for a drop.
1121
- * @param slug The collection slug identifying the drop.
1122
- * @param request The mint request containing minter address and quantity.
1123
- * @returns The {@link DropMintResponse} with ready-to-sign transaction data.
1124
- * @deprecated Use `api.drops.buildMintTransaction()`. Removed in the next major.
1125
- */
1126
- public async buildDropMintTransaction(
1127
- slug: string,
1128
- request: DropMintRequest,
1129
- ): Promise<DropMintResponse> {
1130
- return this.drops.buildMintTransaction(slug, request)
1131
- }
1132
-
1133
- /**
1134
- * Builds ordered transactions for paying on one chain and minting a drop on
1135
- * another. Submit each transaction in order, then pass the returned
1136
- * `receiptRequest` unchanged to {@link OpenSeaAPI.getTransactionReceipt}
1137
- * until the status is terminal.
1138
- * @param slug The collection slug identifying the drop.
1139
- * @param request The payer, minter, quantity, and source payment asset.
1140
- * @returns Transactions to submit and the request used to poll their receipt.
1141
- * @deprecated Use `api.drops.buildCrossChainMintTransactions()`. Removed in the next major.
1142
- */
1143
- public async buildCrossChainDropMintTransactions(
1144
- slug: string,
1145
- request: CrossChainDropMintRequest,
1146
- ): Promise<CrossChainDropMintResponse> {
1147
- return this.drops.buildCrossChainMintTransactions(slug, request)
1148
- }
1149
-
1150
- /**
1151
- * Gets trending collections sorted by sales activity.
1152
- * @param args Optional query parameters for timeframe, chain, category, and pagination.
1153
- * @returns The {@link GetCollectionsPaginatedResponse} returned by the API.
1154
- * @deprecated Use `api.collections.getTrendingCollections()`. Removed in the next major.
1155
- */
1156
- public async getTrendingCollections(
1157
- args?: GetTrendingCollectionsArgs,
1158
- ): Promise<GetCollectionsPaginatedResponse> {
1159
- return this.collections.getTrendingCollections(args)
1160
- }
1161
-
1162
- /**
1163
- * Gets top collections ranked by various stats.
1164
- * @param args Optional query parameters for sort_by, chain, category, and pagination.
1165
- * @returns The {@link GetCollectionsPaginatedResponse} returned by the API.
1166
- * @deprecated Use `api.collections.getTopCollections()`. Removed in the next major.
1167
- */
1168
- public async getTopCollections(
1169
- args?: GetTopCollectionsArgs,
1170
- ): Promise<GetCollectionsPaginatedResponse> {
1171
- return this.collections.getTopCollections(args)
1172
- }
1173
-
1174
- /**
1175
- * Resolve an ENS name, OpenSea username, or wallet address to canonical account info.
1176
- * @param identifier An ENS name (e.g. vitalik.eth), OpenSea username, or wallet address.
1177
- * @returns The {@link ResolveAccountResponse} returned by the API.
1178
- * @deprecated Use `api.accounts.resolveAccount()`. Removed in the next major.
1179
- */
1180
- public async resolveAccount(
1181
- identifier: string,
1182
- ): Promise<ResolveAccountResponse> {
1183
- return this.accounts.resolveAccount(identifier)
1184
- }
1185
-
1186
- /**
1187
- * Get the public agent ownership relationships for a profile.
1188
- * This is a public read and does not require wallet authentication.
1189
- * @param addressOrUsername An ENS name, OpenSea username, or wallet address.
1190
- * @returns The {@link AgentProfileRelationshipsResponse} returned by the API.
1191
- * @deprecated Use `api.accounts.getAgentProfileRelationships()`. Removed in the next major.
1192
- */
1193
- public async getAgentProfileRelationships(
1194
- addressOrUsername: string,
1195
- ): Promise<AgentProfileRelationshipsResponse> {
1196
- return this.accounts.getAgentProfileRelationships(addressOrUsername)
1197
- }
1198
-
1199
- /**
1200
- * Get the collection that an NFT belongs to.
1201
- * Useful for multi-contract collections where the token ID disambiguates
1202
- * which collection the NFT belongs to.
1203
- * @param address The NFT contract address.
1204
- * @param identifier The token identifier.
1205
- * @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
1206
- * @returns The {@link OpenSeaCollection} returned by the API.
1207
- * @deprecated Use `api.nfts.getNFTCollection()`. Removed in the next major.
1208
- */
1209
- public async getNFTCollection(
1210
- address: string,
1211
- identifier: string,
1212
- chain: Chain = this.chain,
1213
- ): Promise<OpenSeaCollection> {
1214
- return this.nfts.getNFTCollection(address, identifier, chain)
1215
- }
1216
-
1217
- /**
1218
- * Get detailed metadata for an NFT including name, description, image, traits,
1219
- * and external links.
1220
- * @param address The NFT contract address.
1221
- * @param tokenId The token identifier.
1222
- * @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
1223
- * @returns The {@link GetNFTMetadataResponse} returned by the API.
1224
- * @deprecated Use `api.nfts.getNFTMetadata()`. Removed in the next major.
1225
- */
1226
- public async getNFTMetadata(
1227
- address: string,
1228
- tokenId: string,
1229
- chain: Chain = this.chain,
1230
- ): Promise<GetNFTMetadataResponse> {
1231
- return this.nfts.getNFTMetadata(address, tokenId, chain)
1232
- }
1233
-
1234
- /**
1235
- * Fetch multiple tokens in a single request.
1236
- * @param request Batch request listing chain + contract address pairs.
1237
- * @returns The {@link TokenBatchResponse} with detailed token info.
1238
- * @deprecated Use `api.tokens.getTokensBatch()`. Removed in the next major.
1239
- */
1240
- public async getTokensBatch(
1241
- request: BatchTokensRequest,
1242
- ): Promise<TokenBatchResponse> {
1243
- return this.tokens.getTokensBatch(request)
1244
- }
1245
-
1246
- /**
1247
- * Fetch the price history of a token.
1248
- * @param chain Chain the token lives on.
1249
- * @param address Token contract address.
1250
- * @param args Time-series window — `start_time` required, `end_time` defaults to now.
1251
- * @returns The {@link PriceHistoryResponse} returned by the API.
1252
- * @deprecated Use `api.tokens.getTokenPriceHistory()`. Removed in the next major.
1253
- */
1254
- public async getTokenPriceHistory(
1255
- chain: Chain,
1256
- address: string,
1257
- args: TokenTimeSeriesArgs,
1258
- ): Promise<PriceHistoryResponse> {
1259
- return this.tokens.getTokenPriceHistory(chain, address, args)
1260
- }
1261
-
1262
- /**
1263
- * Fetch OHLCV candles for a token.
1264
- * @param chain Chain the token lives on.
1265
- * @param address Token contract address.
1266
- * @param args Time-series window plus candle `bucketSize` (required).
1267
- * @returns The {@link OhlcvResponse} returned by the API.
1268
- * @deprecated Use `api.tokens.getTokenOhlcv()`. Removed in the next major.
1269
- */
1270
- public async getTokenOhlcv(
1271
- chain: Chain,
1272
- address: string,
1273
- args: TokenTimeSeriesArgs & { bucketSize: string },
1274
- ): Promise<OhlcvResponse> {
1275
- return this.tokens.getTokenOhlcv(chain, address, args)
1276
- }
1277
-
1278
- /**
1279
- * Fetch recent swap activity for a token.
1280
- * @deprecated Use `api.tokens.getTokenActivity()`. Removed in the next major.
1281
- */
1282
- public async getTokenActivity(
1283
- chain: Chain,
1284
- address: string,
1285
- args?: TokenActivityArgs,
1286
- ): Promise<TokenSwapActivityPaginatedResponse> {
1287
- return this.tokens.getTokenActivity(chain, address, args)
1288
- }
1289
-
1290
- /**
1291
- * Fetch materialized trade count, USD volume, and average trade size for a
1292
- * token across the requested windows.
1293
- * @deprecated Use `api.tokens.getTokenActivityStats()`. Removed in the next major.
1294
- */
1295
- public async getTokenActivityStats(
1296
- chain: Chain,
1297
- address: string,
1298
- args?: TokenActivityStatsArgs,
1299
- ): Promise<TokenActivityStatsResponse> {
1300
- return this.tokens.getTokenActivityStats(chain, address, args)
1301
- }
1302
-
1303
- /**
1304
- * Fetch paginated fungible token activity (transfers, swaps, wraps, and
1305
- * unwraps) for an account across all chains.
1306
- * @deprecated Use `api.tokens.getAccountTokenActivity()`. Removed in the next major.
1307
- */
1308
- public async getAccountTokenActivity(
1309
- address: string,
1310
- args?: GetAccountTokenActivityArgs,
1311
- ): Promise<GetAccountTokenActivityResponse> {
1312
- return this.tokens.getAccountTokenActivity(address, args)
1313
- }
1314
-
1315
- /**
1316
- * Fetch paginated holders for a token, including quantity held, USD value,
1317
- * and holder distribution: top-holder concentration and a health label
1318
- * (STRONG | HEALTHY | CONCERNING | BAD). See `api.tokens.getTokenHolders()`
1319
- * for the distribution fields.
1320
- * @deprecated Use `api.tokens.getTokenHolders()`. Removed in the next major.
1321
- */
1322
- public async getTokenHolders(
1323
- chain: Chain,
1324
- address: string,
1325
- args?: TokenHoldersArgs,
1326
- ): Promise<TokenHoldersResponse> {
1327
- return this.tokens.getTokenHolders(chain, address, args)
1328
- }
1329
-
1330
- /**
1331
- * Fetch liquidity pools for a token (pool type, USD reserves, and
1332
- * bonding-curve progress / graduation flag where applicable).
1333
- * @deprecated Use `api.tokens.getTokenLiquidityPools()`. Removed in the next major.
1334
- */
1335
- public async getTokenLiquidityPools(
1336
- chain: Chain,
1337
- address: string,
1338
- args?: TokenLiquidityPoolsArgs,
1339
- ): Promise<TokenLiquidityPoolsResponse> {
1340
- return this.tokens.getTokenLiquidityPools(chain, address, args)
1341
- }
1342
-
1343
- /**
1344
- * Fetch multiple NFTs in a single request.
1345
- * @deprecated Use `api.nfts.getNFTsBatch()`. Removed in the next major.
1346
- */
1347
- public async getNFTsBatch(
1348
- request: BatchNftsRequest,
1349
- ): Promise<NftBatchResponse> {
1350
- return this.nfts.getNFTsBatch(request)
1351
- }
1352
-
1353
- /**
1354
- * Fetch owners of an NFT.
1355
- * @deprecated Use `api.nfts.getNFTOwners()`. Removed in the next major.
1356
- */
1357
- public async getNFTOwners(
1358
- address: string,
1359
- identifier: string,
1360
- chain: Chain = this.chain,
1361
- args?: NFTOwnersArgs,
1362
- ): Promise<OwnersPaginatedResponse> {
1363
- return this.nfts.getNFTOwners(address, identifier, chain, args)
1364
- }
1365
-
1366
- /**
1367
- * Fetch analytics (historical sale points) for an NFT.
1368
- * @deprecated Use `api.nfts.getNFTAnalytics()`. Removed in the next major.
1369
- */
1370
- public async getNFTAnalytics(
1371
- address: string,
1372
- identifier: string,
1373
- chain: Chain = this.chain,
1374
- ): Promise<NftAnalyticsResponse> {
1375
- return this.nfts.getNFTAnalytics(address, identifier, chain)
1376
- }
1377
-
1378
- /**
1379
- * Fetch multiple collections in a single request by slug.
1380
- * @deprecated Use `api.collections.getCollectionsBatch()`. Removed in the next major.
1381
- */
1382
- public async getCollectionsBatch(
1383
- request: BatchCollectionsRequest,
1384
- ): Promise<CollectionBatchResponse> {
1385
- return this.collections.getCollectionsBatch(request)
1386
- }
1387
-
1388
- /**
1389
- * Fetch top offers for a collection grouped by price level.
1390
- * @deprecated Use `api.collections.getCollectionOfferAggregates()`. Removed in the next major.
1391
- */
1392
- public async getCollectionOfferAggregates(
1393
- slug: string,
1394
- args?: PaginatedAnalyticsArgs,
1395
- ): Promise<CollectionOfferAggregatesPaginatedResponse> {
1396
- return this.collections.getCollectionOfferAggregates(slug, args)
1397
- }
1398
-
1399
- /**
1400
- * Fetch holders of a collection.
1401
- * @deprecated Use `api.collections.getCollectionHolders()`. Removed in the next major.
1402
- */
1403
- public async getCollectionHolders(
1404
- slug: string,
1405
- args?: CollectionHoldersArgs,
1406
- ): Promise<CollectionHoldersPaginatedResponse> {
1407
- return this.collections.getCollectionHolders(slug, args)
1408
- }
1409
-
1410
- /**
1411
- * Fetch the floor-price history of a collection.
1412
- * @deprecated Use `api.collections.getCollectionFloorPrices()`. Removed in the next major.
1413
- */
1414
- public async getCollectionFloorPrices(
1415
- slug: string,
1416
- args?: CollectionFloorPricesArgs,
1417
- ): Promise<FloorPriceHistoryResponse> {
1418
- return this.collections.getCollectionFloorPrices(slug, args)
1419
- }
1420
-
1421
- /**
1422
- * Get ordered approval + sign actions to create one or more listings.
1423
- * @deprecated Use `api.listings.createListingActions()`. Removed in the next major.
1424
- */
1425
- public async createListingActions(
1426
- request: CreateListingActionsRequest,
1427
- ): Promise<CreateListingActionsResponse> {
1428
- return this.listings.createListingActions(request)
1429
- }
1430
-
1431
- /**
1432
- * Get ordered actions to fulfill a listing.
1433
- * @deprecated Use `api.listings.createListingFulfillmentActions()`. Removed in the next major.
1434
- */
1435
- public async createListingFulfillmentActions(
1436
- request: CreateListingFulfillmentActionsRequest,
1437
- ): Promise<CreateListingFulfillmentActionsResponse> {
1438
- return this.listings.createListingFulfillmentActions(request)
1439
- }
1440
-
1441
- /**
1442
- * Get ordered actions to create an offer.
1443
- * @deprecated Use `api.offers.createOfferActions()`. Removed in the next major.
1444
- */
1445
- public async createOfferActions(
1446
- request: CreateOfferActionsRequest,
1447
- ): Promise<CreateOfferActionsResponse> {
1448
- return this.offers.createOfferActions(request)
1449
- }
1450
-
1451
- /**
1452
- * Get ordered actions to fulfill an offer.
1453
- * @deprecated Use `api.offers.createOfferFulfillmentActions()`. Removed in the next major.
1454
- */
1455
- public async createOfferFulfillmentActions(
1456
- request: CreateOfferFulfillmentActionsRequest,
1457
- ): Promise<CreateOfferFulfillmentActionsResponse> {
1458
- return this.offers.createOfferFulfillmentActions(request)
1459
- }
1460
-
1461
- /**
1462
- * Build a deploy-contract transaction for a new drop.
1463
- * @deprecated Use `api.drops.deployDropContract()`. Removed in the next major.
1464
- */
1465
- public async deployDropContract(
1466
- request: DropDeployRequest,
1467
- ): Promise<DropDeployResponse> {
1468
- return this.drops.deployDropContract(request)
1469
- }
1470
-
1471
- /**
1472
- * Get the receipt of a previously submitted drop-deploy transaction.
1473
- * @deprecated Use `api.drops.getDeployReceipt()`. Removed in the next major.
1474
- */
1475
- public async getDeployContractReceipt(
1476
- chain: Chain,
1477
- txHash: string,
1478
- ): Promise<DropDeployReceiptResponse> {
1479
- return this.drops.getDeployReceipt(chain, txHash)
1480
- }
1481
-
1482
- /**
1483
- * Build transactions to transfer NFTs or tokens between wallets.
1484
- * @deprecated Use `api.assets.transferAssets()`. Removed in the next major.
1485
- */
1486
- public async transferAssets(
1487
- request: TransferRequest,
1488
- ): Promise<TransferResponse> {
1489
- return this.assets.transferAssets(request)
1490
- }
1491
-
1492
- /**
1493
- * Get portfolio stats (net worth, P&L) for an account.
1494
- * @deprecated Use `api.accounts.getPortfolioStats()`. Removed in the next major.
1495
- */
1496
- public async getPortfolioStats(
1497
- address: string,
1498
- args?: PortfolioArgs,
1499
- ): Promise<PortfolioStatsResponse> {
1500
- return this.accounts.getPortfolioStats(address, args)
1501
- }
1502
-
1503
- /**
1504
- * Get portfolio net-worth history for an account.
1505
- * @deprecated Use `api.accounts.getPortfolioHistory()`. Removed in the next major.
1506
- */
1507
- public async getPortfolioHistory(
1508
- address: string,
1509
- args?: PortfolioArgs,
1510
- ): Promise<PortfolioHistoryResponse> {
1511
- return this.accounts.getPortfolioHistory(address, args)
1512
- }
1513
-
1514
- /**
1515
- * Get offers received by an account.
1516
- * @deprecated Use `api.accounts.getProfileOffersReceived()`. Removed in the next major.
1517
- */
1518
- public async getProfileOffersReceived(
1519
- address: string,
1520
- args?: ProfileOrdersArgs,
1521
- ): Promise<ProfileOffersResponse> {
1522
- return this.accounts.getProfileOffersReceived(address, args)
1523
- }
1524
-
1525
- /**
1526
- * Get active offers made by an account.
1527
- * @deprecated Use `api.accounts.getProfileOffers()`. Removed in the next major.
1528
- */
1529
- public async getProfileOffers(
1530
- address: string,
1531
- args?: ProfileOrdersArgs,
1532
- ): Promise<ProfileOffersResponse> {
1533
- return this.accounts.getProfileOffers(address, args)
1534
- }
1535
-
1536
- /**
1537
- * Get active listings for an account.
1538
- * @deprecated Use `api.accounts.getProfileListings()`. Removed in the next major.
1539
- */
1540
- public async getProfileListings(
1541
- address: string,
1542
- args?: ProfileOrdersArgs,
1543
- ): Promise<ProfileListingsResponse> {
1544
- return this.accounts.getProfileListings(address, args)
1545
- }
1546
-
1547
- /**
1548
- * Get items favorited by an account.
1549
- * @deprecated Use `api.accounts.getProfileFavorites()`. Removed in the next major.
1550
- */
1551
- public async getProfileFavorites(
1552
- address: string,
1553
- args?: ProfileFavoritesArgs,
1554
- ): Promise<ProfileFavoritesResponse> {
1555
- return this.accounts.getProfileFavorites(address, args)
1556
- }
1557
-
1558
- /**
1559
- * Get collections owned by an account.
1560
- * @deprecated Use `api.accounts.getProfileCollections()`. Removed in the next major.
1561
- */
1562
- public async getProfileCollections(
1563
- address: string,
1564
- args?: ProfileCollectionsArgs,
1565
- ): Promise<ProfileCollectionsResponse> {
1566
- return this.accounts.getProfileCollections(address, args)
1567
- }
1568
-
1569
- /**
1570
- * Get aggregated trading P&L (realized + unrealized) for an account.
1571
- * @deprecated Use `api.accounts.getWalletPnl()`. Removed in the next major.
1572
- */
1573
- public async getWalletPnl(address: string): Promise<WalletPnlResponse> {
1574
- return this.accounts.getWalletPnl(address)
1575
- }
1576
-
1577
- /**
1578
- * Get closed (realized) trading positions for an account.
1579
- * @deprecated Use `api.accounts.getWalletClosedPositions()`. Removed in the next major.
1580
- */
1581
- public async getWalletClosedPositions(
1582
- address: string,
1583
- args?: WalletClosedPositionsArgs,
1584
- ): Promise<ClosedPositionsResponse> {
1585
- return this.accounts.getWalletClosedPositions(address, args)
1586
- }
1587
-
1588
- /**
1589
- * Get the token transfers contributing to a wallet's position in a currency.
1590
- * @deprecated Use `api.accounts.getWalletTokenTransfers()`. Removed in the next major.
1591
- */
1592
- public async getWalletTokenTransfers(
1593
- address: string,
1594
- args: WalletTokenTransfersArgs,
1595
- ): Promise<PositionTokenTransfersResponse> {
1596
- return this.accounts.getWalletTokenTransfers(address, args)
1597
- }
1598
-
1599
164
  /**
1600
165
  * Generic fetch method for any API endpoint with automatic rate limit retry,
1601
166
  * with the response left in its wire shape.
@@ -1853,7 +418,7 @@ export class OpenSeaAPI {
1853
418
  | undefined
1854
419
  if (errors?.length !== undefined && errors.length > 0) {
1855
420
  // Handle both string entries (`["not found"]`) and structured ones
1856
- // (`[{code: "invalid_param", message: "..."}]`) — String() on an
421
+ // (`[{code: "invalid_param", message: "..."}]`). String() on an
1857
422
  // object yields "[object Object]", so JSON-stringify any non-string
1858
423
  // element individually before joining.
1859
424
  const errorMessage = Array.isArray(errors)
@@ -1944,7 +509,7 @@ export class OpenSeaAPI {
1944
509
  private static readonly MAX_RETRY_AFTER_SECONDS = 300
1945
510
 
1946
511
  /**
1947
- * Parses the retry-after header from the response with robust error handling.
512
+ * Parses the retry-after header, tolerating missing or malformed values.
1948
513
  * @param response The HTTP response object from the API
1949
514
  * @returns The retry-after value in seconds (capped at 5 minutes), or undefined if not present or invalid
1950
515
  */
@@ -2005,18 +570,18 @@ export class OpenSeaAPI {
2005
570
  /**
2006
571
  * Creates a rate limit error with status code and retry-after information.
2007
572
  * This is async because it attempts to parse the response body. If the body
2008
- * is malformed JSON, responseBody will be undefined (intentional — the error
2009
- * itself is more important than the body).
573
+ * is malformed JSON, responseBody is undefined (on purpose: the error
574
+ * matters more than the body).
2010
575
  * @param response The HTTP response object from the API
2011
576
  * @returns An enhanced Error object with statusCode, retryAfter and responseBody properties
2012
577
  */
2013
578
  private async _createRateLimitError(
2014
579
  response: Response,
2015
- ): Promise<OpenSeaRateLimitError> {
580
+ ): Promise<OpenSeaApiError> {
2016
581
  const retryAfter = this._parseRetryAfter(response)
2017
582
  const error = new Error(
2018
583
  `${response.status} ${response.statusText}`,
2019
- ) as OpenSeaRateLimitError
584
+ ) as OpenSeaApiError
2020
585
 
2021
586
  // Add status code and retry-after information to the error object
2022
587
  error.statusCode = response.status