@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
1
  import type { Chain, OpenSeaAccount, OpenSeaPaymentToken } from "../types";
2
2
  import type { Fetcher } from "./fetcher";
3
- import type { GetAccountTokensArgs, GetAccountTokensResponse, ResolveAccountResponse } from "./types";
3
+ import type { GetAccountTokensArgs, GetAccountTokensResponse, PortfolioArgs, PortfolioHistoryResponse, PortfolioStatsResponse, ProfileCollectionsArgs, ProfileCollectionsResponse, ProfileFavoritesArgs, ProfileFavoritesResponse, ProfileListingsResponse, ProfileOffersResponse, ProfileOrdersArgs, ResolveAccountResponse } from "./types";
4
4
  /**
5
5
  * Account and payment token related API operations
6
6
  */
@@ -24,4 +24,32 @@ export declare class AccountsAPI {
24
24
  * Resolve an ENS name, OpenSea username, or wallet address to canonical account info.
25
25
  */
26
26
  resolveAccount(identifier: string): Promise<ResolveAccountResponse>;
27
+ /**
28
+ * Get portfolio stats (net worth, P&L) for an account.
29
+ */
30
+ getPortfolioStats(address: string, args?: PortfolioArgs): Promise<PortfolioStatsResponse>;
31
+ /**
32
+ * Get portfolio net-worth history for an account.
33
+ */
34
+ getPortfolioHistory(address: string, args?: PortfolioArgs): Promise<PortfolioHistoryResponse>;
35
+ /**
36
+ * Get offers received by an account, scoped by collection/chain.
37
+ */
38
+ getProfileOffersReceived(address: string, args?: ProfileOrdersArgs): Promise<ProfileOffersResponse>;
39
+ /**
40
+ * Get active offers made by an account.
41
+ */
42
+ getProfileOffers(address: string, args?: ProfileOrdersArgs): Promise<ProfileOffersResponse>;
43
+ /**
44
+ * Get active listings for an account.
45
+ */
46
+ getProfileListings(address: string, args?: ProfileOrdersArgs): Promise<ProfileListingsResponse>;
47
+ /**
48
+ * Get items favorited by an account.
49
+ */
50
+ getProfileFavorites(address: string, args?: ProfileFavoritesArgs): Promise<ProfileFavoritesResponse>;
51
+ /**
52
+ * Get collections owned by an account.
53
+ */
54
+ getProfileCollections(address: string, args?: ProfileCollectionsArgs): Promise<ProfileCollectionsResponse>;
27
55
  }
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AccountsAPI = void 0;
4
4
  const converters_1 = require("../utils/converters");
5
5
  const apiPaths_1 = require("./apiPaths");
6
+ function joinArray(value) {
7
+ return value && value.length > 0 ? value.join(",") : undefined;
8
+ }
6
9
  /**
7
10
  * Account and payment token related API operations
8
11
  */
@@ -41,6 +44,66 @@ class AccountsAPI {
41
44
  const response = await this.fetcher.get((0, apiPaths_1.getResolveAccountPath)(identifier));
42
45
  return response;
43
46
  }
47
+ /**
48
+ * Get portfolio stats (net worth, P&L) for an account.
49
+ */
50
+ async getPortfolioStats(address, args) {
51
+ return this.fetcher.get((0, apiPaths_1.getPortfolioStatsPath)(address), args);
52
+ }
53
+ /**
54
+ * Get portfolio net-worth history for an account.
55
+ */
56
+ async getPortfolioHistory(address, args) {
57
+ return this.fetcher.get((0, apiPaths_1.getPortfolioHistoryPath)(address), args);
58
+ }
59
+ /**
60
+ * Get offers received by an account, scoped by collection/chain.
61
+ */
62
+ async getProfileOffersReceived(address, args) {
63
+ return this.fetcher.get((0, apiPaths_1.getProfileOffersReceivedPath)(address), {
64
+ ...args,
65
+ collection_slugs: joinArray(args?.collection_slugs),
66
+ chains: joinArray(args?.chains),
67
+ });
68
+ }
69
+ /**
70
+ * Get active offers made by an account.
71
+ */
72
+ async getProfileOffers(address, args) {
73
+ return this.fetcher.get((0, apiPaths_1.getProfileOffersPath)(address), {
74
+ ...args,
75
+ collection_slugs: joinArray(args?.collection_slugs),
76
+ chains: joinArray(args?.chains),
77
+ });
78
+ }
79
+ /**
80
+ * Get active listings for an account.
81
+ */
82
+ async getProfileListings(address, args) {
83
+ return this.fetcher.get((0, apiPaths_1.getProfileListingsPath)(address), {
84
+ ...args,
85
+ collection_slugs: joinArray(args?.collection_slugs),
86
+ chains: joinArray(args?.chains),
87
+ });
88
+ }
89
+ /**
90
+ * Get items favorited by an account.
91
+ */
92
+ async getProfileFavorites(address, args) {
93
+ return this.fetcher.get((0, apiPaths_1.getProfileFavoritesPath)(address), {
94
+ ...args,
95
+ chains: joinArray(args?.chains),
96
+ });
97
+ }
98
+ /**
99
+ * Get collections owned by an account.
100
+ */
101
+ async getProfileCollections(address, args) {
102
+ return this.fetcher.get((0, apiPaths_1.getProfileCollectionsPath)(address), {
103
+ ...args,
104
+ chains: joinArray(args?.chains),
105
+ });
106
+ }
44
107
  }
45
108
  exports.AccountsAPI = AccountsAPI;
46
109
  //# sourceMappingURL=accounts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../src/api/accounts.ts"],"names":[],"mappings":";;;AACA,oDAA2E;AAC3E,yCAKmB;AAQnB;;GAEG;AACH,MAAa,WAAW;IAEZ;IACA;IAFV,YACU,OAAgB,EAChB,KAAY;QADZ,YAAO,GAAP,OAAO,CAAS;QAChB,UAAK,GAAL,KAAK,CAAO;IACnB,CAAC;IAEJ;;OAEG;IACH,K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AM,EAAE,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;SAChC,CACF,CAAA;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,qBAAqB,CACzB,OAAe,EACf,IAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CACrB,IAAA,oCAAyB,EAAC,OAAO,CAAC,EAClC;YACE,GAAG,IAAI;YACP,MAAM,EAAE,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;SAChC,CACF,CAAA;IACH,CAAC;CACF;AA/JD,kCA+JC"}
package/lib/api/api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { FulfillmentDataResponse, OrderAPIOptions, OrdersQueryOptions, OrderV2, ProtocolData } from "../orders/types";
1
+ import type { FulfillmentDataResponse, ProtocolData } from "../orders/types";
2
2
  import { Chain, type OpenSeaAccount, type OpenSeaAPIConfig, type OpenSeaCollection, type OpenSeaCollectionStats, type OpenSeaPaymentToken, type OrderSide, type RequestOptions } from "../types";
3
- import { type BuildOfferResponse, type CancelOrderResponse, type CollectionOffer, CollectionOrderByOption, type CrossChainFulfillmentRequest, type CrossChainFulfillmentResponse, type DropMintRequest, type DropMintResponse, type GetAccountTokensArgs, type GetAccountTokensResponse, type GetBestListingResponse, type GetBestOfferResponse, type GetChainsResponse, type GetCollectionsPaginatedResponse, type GetCollectionsResponse, type GetContractResponse, type GetDropResponse, type GetDropsArgs, type GetDropsResponse, type GetEventsArgs, type GetEventsByCollectionArgs, type GetEventsResponse, type GetListingsResponse, type GetNFTMetadataResponse, type GetNFTResponse, type GetOffersResponse, type GetOrderByHashResponse, type GetOrdersResponse, type GetSwapQuoteArgs, type GetSwapQuoteResponse, type GetTokenGroupResponse, type GetTokenGroupsArgs, type GetTokenGroupsResponse, type GetTokenResponse, type GetTokensArgs, type GetTopCollectionsArgs, type GetTopTokensResponse, type GetTraitsResponse, type GetTrendingCollectionsArgs, type GetTrendingTokensResponse, type Listing, type ListNFTsResponse, type Offer, type RequestInstantApiKeyResponse, type ResolveAccountResponse, type SearchArgs, type SearchResponse, type TraitFilter, type ValidateMetadataResponse } from "./types";
3
+ import { type BatchCollectionsRequest, type BatchNftsRequest, type BatchTokensRequest, type BuildOfferResponse, type CancelOrderResponse, type CollectionBatchResponse, type CollectionFloorPricesArgs, type CollectionHoldersArgs, type CollectionHoldersPaginatedResponse, type CollectionOffer, type CollectionOfferAggregatesPaginatedResponse, CollectionOrderByOption, type CreateListingActionsRequest, type CreateListingActionsResponse, type CrossChainFulfillmentRequest, type CrossChainFulfillmentResponse, type DropDeployReceiptResponse, type DropDeployRequest, type DropDeployResponse, type DropMintRequest, type DropMintResponse, type FloorPriceHistoryResponse, type GetAccountTokensArgs, type GetAccountTokensResponse, type GetBestListingResponse, type GetBestOfferResponse, type GetChainsResponse, type GetCollectionsPaginatedResponse, type GetCollectionsResponse, type GetContractResponse, type GetDropResponse, type GetDropsArgs, type GetDropsResponse, type GetEventsArgs, type GetEventsByCollectionArgs, type GetEventsResponse, type GetListingsResponse, type GetNFTMetadataResponse, type GetNFTResponse, type GetOffersResponse, type GetOrderByHashResponse, type GetSwapQuoteArgs, type GetSwapQuoteResponse, type GetTokenGroupResponse, type GetTokenGroupsArgs, type GetTokenGroupsResponse, type GetTokenResponse, type GetTokensArgs, type GetTopCollectionsArgs, type GetTopTokensResponse, type GetTraitsResponse, type GetTrendingCollectionsArgs, type GetTrendingTokensResponse, type Listing, type ListNFTsResponse, type NFTOwnersArgs, type NftAnalyticsResponse, type NftBatchResponse, type Offer, type OhlcvResponse, type OwnersPaginatedResponse, type PaginatedAnalyticsArgs, type PortfolioArgs, type PortfolioHistoryResponse, type PortfolioStatsResponse, type PriceHistoryResponse, type ProfileCollectionsArgs, type ProfileCollectionsResponse, type ProfileFavoritesArgs, type ProfileFavoritesResponse, type ProfileListingsResponse, type ProfileOffersResponse, type ProfileOrdersArgs, type RequestInstantApiKeyResponse, type ResolveAccountResponse, type SearchArgs, type SearchResponse, type SwapExecuteRequest, type SwapExecuteResponse, type SweepCollectionRequest, type SweepCollectionResponse, type TokenActivityArgs, type TokenBatchResponse, type TokenSwapActivityPaginatedResponse, type TokenTimeSeriesArgs, type TraitFilter, type TransactionReceiptRequest, type TransactionReceiptResponse, type TransferRequest, type TransferResponse, type ValidateMetadataResponse } from "./types";
4
4
  /**
5
5
  * The API class for the OpenSea SDK.
6
6
  * @category Main Classes
@@ -31,21 +31,14 @@ export declare class OpenSeaAPI {
31
31
  private tokensAPI;
32
32
  private chainsAPI;
33
33
  private dropsAPI;
34
+ private transactionsAPI;
35
+ private assetsAPI;
34
36
  /**
35
37
  * Create an instance of the OpenSeaAPI
36
38
  * @param config OpenSeaAPIConfig for setting up the API, including an optional API key, Chain name, and base URL
37
39
  * @param logger Optional function for logging debug strings before and after requests are made. Defaults to no logging
38
40
  */
39
41
  constructor(config: OpenSeaAPIConfig, logger?: (arg: string) => void);
40
- /**
41
- * Gets an order from API based on query options.
42
- * @deprecated Use collection-based endpoints instead: getAllOffers, getAllListings, getBestOffer, getBestListing.
43
- * @param options Query options for fetching an order
44
- * @returns The first {@link OrderV2} returned by the API
45
- *
46
- * @throws An error if there are no matching orders.
47
- */
48
- getOrder(options: Omit<OrdersQueryOptions, "limit">): Promise<OrderV2>;
49
42
  /**
50
43
  * Gets a single order by its order hash.
51
44
  * @param orderHash The hash of the order to fetch
@@ -55,13 +48,6 @@ export declare class OpenSeaAPI {
55
48
  * @throws An error if the order is not found
56
49
  */
57
50
  getOrderByHash(orderHash: string, protocolAddress: string, chain?: Chain): Promise<GetOrderByHashResponse>;
58
- /**
59
- * Gets a list of orders from API based on query options.
60
- * @deprecated Use collection-based endpoints instead: getAllOffers, getAllListings, getBestOffer, getBestListing.
61
- * @param options Query options for fetching orders
62
- * @returns The {@link GetOrdersResponse} returned by the API.
63
- */
64
- getOrders(options: Omit<OrdersQueryOptions, "limit">): Promise<GetOrdersResponse>;
65
51
  /**
66
52
  * Gets all offers for a given collection.
67
53
  * @param collectionSlug The slug of the collection.
@@ -138,14 +124,6 @@ export declare class OpenSeaAPI {
138
124
  * @returns The {@link FulfillmentDataResponse}
139
125
  */
140
126
  generateFulfillmentData(fulfillerAddress: string, orderHash: string, protocolAddress: string, side: OrderSide, assetContractAddress?: string, tokenId?: string, unitsToFill?: string, recipientAddress?: string, includeOptionalCreatorFees?: boolean): Promise<FulfillmentDataResponse>;
141
- /**
142
- * Post an order to OpenSea.
143
- * @deprecated Use postListing or postOffer instead.
144
- * @param order The order to post
145
- * @param apiOptions API options for the order
146
- * @returns The {@link OrderV2} posted to the API.
147
- */
148
- postOrder(order: ProtocolData, apiOptions: OrderAPIOptions): Promise<OrderV2>;
149
127
  /**
150
128
  * Post a listing to OpenSea. Returns the new v2 Listing response format.
151
129
  * @param order The order to post
@@ -411,25 +389,35 @@ export declare class OpenSeaAPI {
411
389
  validateNFTMetadata(address: string, identifier: string, chain?: Chain, ignoreCachedItemUrls?: boolean): Promise<ValidateMetadataResponse>;
412
390
  /**
413
391
  * Gets all active offers for a specific NFT (not just the best offer).
414
- * @param assetContractAddress The NFT contract address.
415
- * @param tokenId The token identifier.
416
- * @param limit The number of offers to return. Must be between 1 and 100.
417
- * @param next The cursor for the next page of results. This is returned from a previous request.
418
- * @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
392
+ * @param collectionSlug The collection slug.
393
+ * @param identifier The NFT token id.
394
+ * @param limit The number of offers to return. Must be between 1 and 200.
395
+ * @param next The cursor for the next page of results.
419
396
  * @returns The {@link GetOffersResponse} returned by the API.
420
397
  */
421
- getNFTOffers(assetContractAddress: string, tokenId: string, limit?: number, next?: string, chain?: Chain): Promise<GetOffersResponse>;
398
+ getOffersByNFT(collectionSlug: string, identifier: string | number, limit?: number, next?: string): Promise<GetOffersResponse>;
422
399
  /**
423
- * Gets all active listings for a specific NFT (not just the best listing).
424
- * @param assetContractAddress The NFT contract address.
425
- * @param tokenId The token identifier.
426
- * @param limit The number of listings to return. Must be between 1 and 100.
427
- * @param next The cursor for the next page of results. This is returned from a previous request.
428
- * @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
429
- * @param includePrivateListings Whether to include private listings (default: false)
430
- * @returns The {@link GetListingsResponse} returned by the API.
400
+ * Bulk-buy items from a collection using any payment token, including
401
+ * cross-chain. Returns an ordered list of transactions to execute.
402
+ * @param request The sweep request containing buyer, collection, payment, and item caps.
403
+ * @returns The {@link SweepCollectionResponse} returned by the API.
431
404
  */
432
- getNFTListings(assetContractAddress: string, tokenId: string, limit?: number, next?: string, chain?: Chain, includePrivateListings?: boolean): Promise<GetListingsResponse>;
405
+ sweepCollection(request: SweepCollectionRequest): Promise<SweepCollectionResponse>;
406
+ /**
407
+ * Get executable transactions for a token swap. Companion to
408
+ * {@link OpenSeaAPI.getSwapQuote} — quote first, then execute.
409
+ * @param request The swap execution request.
410
+ * @returns The {@link SwapExecuteResponse} with transactions and a quote.
411
+ */
412
+ executeSwap(request: SwapExecuteRequest): Promise<SwapExecuteResponse>;
413
+ /**
414
+ * Get the receipt/status for a submitted transaction. Works for all transaction
415
+ * types: listing fulfillments, cross-chain buys, sweeps, offer fulfillments,
416
+ * and token swaps. Poll this endpoint to check completion status.
417
+ * @param request The transaction receipt request.
418
+ * @returns The {@link TransactionReceiptResponse} returned by the API.
419
+ */
420
+ getTransactionReceipt(request: TransactionReceiptRequest): Promise<TransactionReceiptResponse>;
433
421
  /**
434
422
  * Gets a list of drops (mints).
435
423
  * @param args Optional query parameters for filtering and pagination.
@@ -486,6 +474,106 @@ export declare class OpenSeaAPI {
486
474
  * @returns The {@link GetNFTMetadataResponse} returned by the API.
487
475
  */
488
476
  getNFTMetadata(address: string, tokenId: string, chain?: Chain): Promise<GetNFTMetadataResponse>;
477
+ /**
478
+ * Fetch multiple tokens in a single request.
479
+ * @param request Batch request listing chain + contract address pairs.
480
+ * @returns The {@link TokenBatchResponse} with detailed token info.
481
+ */
482
+ getTokensBatch(request: BatchTokensRequest): Promise<TokenBatchResponse>;
483
+ /**
484
+ * Fetch the price history of a token.
485
+ * @param chain Chain the token lives on.
486
+ * @param address Token contract address.
487
+ * @param args Time-series window — `start_time` required, `end_time` defaults to now.
488
+ * @returns The {@link PriceHistoryResponse} returned by the API.
489
+ */
490
+ getTokenPriceHistory(chain: Chain, address: string, args: TokenTimeSeriesArgs): Promise<PriceHistoryResponse>;
491
+ /**
492
+ * Fetch OHLCV candles for a token.
493
+ * @param chain Chain the token lives on.
494
+ * @param address Token contract address.
495
+ * @param args Time-series window plus candle `bucket_size` (required).
496
+ * @returns The {@link OhlcvResponse} returned by the API.
497
+ */
498
+ getTokenOhlcv(chain: Chain, address: string, args: TokenTimeSeriesArgs & {
499
+ bucket_size: string;
500
+ }): Promise<OhlcvResponse>;
501
+ /**
502
+ * Fetch recent swap activity for a token.
503
+ */
504
+ getTokenActivity(chain: Chain, address: string, args?: TokenActivityArgs): Promise<TokenSwapActivityPaginatedResponse>;
505
+ /**
506
+ * Fetch multiple NFTs in a single request.
507
+ */
508
+ getNFTsBatch(request: BatchNftsRequest): Promise<NftBatchResponse>;
509
+ /**
510
+ * Fetch owners of an NFT.
511
+ */
512
+ getNFTOwners(address: string, identifier: string, chain?: Chain, args?: NFTOwnersArgs): Promise<OwnersPaginatedResponse>;
513
+ /**
514
+ * Fetch analytics (historical sale points) for an NFT.
515
+ */
516
+ getNFTAnalytics(address: string, identifier: string, chain?: Chain): Promise<NftAnalyticsResponse>;
517
+ /**
518
+ * Fetch multiple collections in a single request by slug.
519
+ */
520
+ getCollectionsBatch(request: BatchCollectionsRequest): Promise<CollectionBatchResponse>;
521
+ /**
522
+ * Fetch top offers for a collection grouped by price level.
523
+ */
524
+ getCollectionOfferAggregates(slug: string, args?: PaginatedAnalyticsArgs): Promise<CollectionOfferAggregatesPaginatedResponse>;
525
+ /**
526
+ * Fetch holders of a collection.
527
+ */
528
+ getCollectionHolders(slug: string, args?: CollectionHoldersArgs): Promise<CollectionHoldersPaginatedResponse>;
529
+ /**
530
+ * Fetch the floor-price history of a collection.
531
+ */
532
+ getCollectionFloorPrices(slug: string, args?: CollectionFloorPricesArgs): Promise<FloorPriceHistoryResponse>;
533
+ /**
534
+ * Get ordered approval + sign actions to create one or more listings.
535
+ */
536
+ createListingActions(request: CreateListingActionsRequest): Promise<CreateListingActionsResponse>;
537
+ /**
538
+ * Build a deploy-contract transaction for a new drop.
539
+ */
540
+ deployDropContract(request: DropDeployRequest): Promise<DropDeployResponse>;
541
+ /**
542
+ * Get the receipt of a previously submitted drop-deploy transaction.
543
+ */
544
+ getDeployContractReceipt(chain: Chain, txHash: string): Promise<DropDeployReceiptResponse>;
545
+ /**
546
+ * Build transactions to transfer NFTs or tokens between wallets.
547
+ */
548
+ transferAssets(request: TransferRequest): Promise<TransferResponse>;
549
+ /**
550
+ * Get portfolio stats (net worth, P&L) for an account.
551
+ */
552
+ getPortfolioStats(address: string, args?: PortfolioArgs): Promise<PortfolioStatsResponse>;
553
+ /**
554
+ * Get portfolio net-worth history for an account.
555
+ */
556
+ getPortfolioHistory(address: string, args?: PortfolioArgs): Promise<PortfolioHistoryResponse>;
557
+ /**
558
+ * Get offers received by an account.
559
+ */
560
+ getProfileOffersReceived(address: string, args?: ProfileOrdersArgs): Promise<ProfileOffersResponse>;
561
+ /**
562
+ * Get active offers made by an account.
563
+ */
564
+ getProfileOffers(address: string, args?: ProfileOrdersArgs): Promise<ProfileOffersResponse>;
565
+ /**
566
+ * Get active listings for an account.
567
+ */
568
+ getProfileListings(address: string, args?: ProfileOrdersArgs): Promise<ProfileListingsResponse>;
569
+ /**
570
+ * Get items favorited by an account.
571
+ */
572
+ getProfileFavorites(address: string, args?: ProfileFavoritesArgs): Promise<ProfileFavoritesResponse>;
573
+ /**
574
+ * Get collections owned by an account.
575
+ */
576
+ getProfileCollections(address: string, args?: ProfileCollectionsArgs): Promise<ProfileCollectionsResponse>;
489
577
  /**
490
578
  * Generic fetch method for any API endpoint with automatic rate limit retry
491
579
  * @param apiPath Path to URL endpoint under API
package/lib/api/api.js CHANGED
@@ -6,6 +6,7 @@ const types_1 = require("../types");
6
6
  const rateLimit_1 = require("../utils/rateLimit");
7
7
  const accounts_1 = require("./accounts");
8
8
  const apiPaths_1 = require("./apiPaths");
9
+ const assets_1 = require("./assets");
9
10
  const chains_1 = require("./chains");
10
11
  const collections_1 = require("./collections");
11
12
  const drops_1 = require("./drops");
@@ -16,6 +17,7 @@ const offers_1 = require("./offers");
16
17
  const orders_1 = require("./orders");
17
18
  const search_1 = require("./search");
18
19
  const tokens_1 = require("./tokens");
20
+ const transactions_1 = require("./transactions");
19
21
  const types_2 = require("./types");
20
22
  /**
21
23
  * The API class for the OpenSea SDK.
@@ -48,6 +50,8 @@ class OpenSeaAPI {
48
50
  tokensAPI;
49
51
  chainsAPI;
50
52
  dropsAPI;
53
+ transactionsAPI;
54
+ assetsAPI;
51
55
  /**
52
56
  * Create an instance of the OpenSeaAPI
53
57
  * @param config OpenSeaAPIConfig for setting up the API, including an optional API key, Chain name, and base URL
@@ -72,7 +76,7 @@ class OpenSeaAPI {
72
76
  // Initialize specialized API clients
73
77
  this.ordersAPI = new orders_1.OrdersAPI(fetcher, this.chain);
74
78
  this.offersAPI = new offers_1.OffersAPI(fetcher, this.chain);
75
- this.listingsAPI = new listings_1.ListingsAPI(fetcher, this.chain);
79
+ this.listingsAPI = new listings_1.ListingsAPI(fetcher);
76
80
  this.collectionsAPI = new collections_1.CollectionsAPI(fetcher);
77
81
  this.nftsAPI = new nfts_1.NFTsAPI(fetcher, this.chain);
78
82
  this.accountsAPI = new accounts_1.AccountsAPI(fetcher, this.chain);
@@ -81,17 +85,8 @@ class OpenSeaAPI {
81
85
  this.tokensAPI = new tokens_1.TokensAPI(fetcher);
82
86
  this.chainsAPI = new chains_1.ChainsAPI(fetcher);
83
87
  this.dropsAPI = new drops_1.DropsAPI(fetcher);
84
- }
85
- /**
86
- * Gets an order from API based on query options.
87
- * @deprecated Use collection-based endpoints instead: getAllOffers, getAllListings, getBestOffer, getBestListing.
88
- * @param options Query options for fetching an order
89
- * @returns The first {@link OrderV2} returned by the API
90
- *
91
- * @throws An error if there are no matching orders.
92
- */
93
- async getOrder(options) {
94
- return this.ordersAPI.getOrder(options);
88
+ this.transactionsAPI = new transactions_1.TransactionsAPI(fetcher);
89
+ this.assetsAPI = new assets_1.AssetsAPI(fetcher);
95
90
  }
96
91
  /**
97
92
  * Gets a single order by its order hash.
@@ -104,15 +99,6 @@ class OpenSeaAPI {
104
99
  async getOrderByHash(orderHash, protocolAddress, chain = this.chain) {
105
100
  return this.ordersAPI.getOrderByHash(orderHash, protocolAddress, chain);
106
101
  }
107
- /**
108
- * Gets a list of orders from API based on query options.
109
- * @deprecated Use collection-based endpoints instead: getAllOffers, getAllListings, getBestOffer, getBestListing.
110
- * @param options Query options for fetching orders
111
- * @returns The {@link GetOrdersResponse} returned by the API.
112
- */
113
- async getOrders(options) {
114
- return this.ordersAPI.getOrders({ ...options, pageSize: this.pageSize });
115
- }
116
102
  /**
117
103
  * Gets all offers for a given collection.
118
104
  * @param collectionSlug The slug of the collection.
@@ -205,16 +191,6 @@ class OpenSeaAPI {
205
191
  async generateFulfillmentData(fulfillerAddress, orderHash, protocolAddress, side, assetContractAddress, tokenId, unitsToFill, recipientAddress, includeOptionalCreatorFees = false) {
206
192
  return this.ordersAPI.generateFulfillmentData(fulfillerAddress, orderHash, protocolAddress, side, assetContractAddress, tokenId, unitsToFill, recipientAddress, includeOptionalCreatorFees);
207
193
  }
208
- /**
209
- * Post an order to OpenSea.
210
- * @deprecated Use postListing or postOffer instead.
211
- * @param order The order to post
212
- * @param apiOptions API options for the order
213
- * @returns The {@link OrderV2} posted to the API.
214
- */
215
- async postOrder(order, apiOptions) {
216
- return this.ordersAPI.postOrder(order, apiOptions);
217
- }
218
194
  /**
219
195
  * Post a listing to OpenSea. Returns the new v2 Listing response format.
220
196
  * @param order The order to post
@@ -530,28 +506,42 @@ class OpenSeaAPI {
530
506
  }
531
507
  /**
532
508
  * Gets all active offers for a specific NFT (not just the best offer).
533
- * @param assetContractAddress The NFT contract address.
534
- * @param tokenId The token identifier.
535
- * @param limit The number of offers to return. Must be between 1 and 100.
536
- * @param next The cursor for the next page of results. This is returned from a previous request.
537
- * @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
509
+ * @param collectionSlug The collection slug.
510
+ * @param identifier The NFT token id.
511
+ * @param limit The number of offers to return. Must be between 1 and 200.
512
+ * @param next The cursor for the next page of results.
538
513
  * @returns The {@link GetOffersResponse} returned by the API.
539
514
  */
540
- async getNFTOffers(assetContractAddress, tokenId, limit, next, chain = this.chain) {
541
- return this.offersAPI.getNFTOffers(assetContractAddress, tokenId, limit, next, chain);
515
+ async getOffersByNFT(collectionSlug, identifier, limit, next) {
516
+ return this.offersAPI.getOffersByNFT(collectionSlug, identifier, limit, next);
542
517
  }
543
518
  /**
544
- * Gets all active listings for a specific NFT (not just the best listing).
545
- * @param assetContractAddress The NFT contract address.
546
- * @param tokenId The token identifier.
547
- * @param limit The number of listings to return. Must be between 1 and 100.
548
- * @param next The cursor for the next page of results. This is returned from a previous request.
549
- * @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
550
- * @param includePrivateListings Whether to include private listings (default: false)
551
- * @returns The {@link GetListingsResponse} returned by the API.
519
+ * Bulk-buy items from a collection using any payment token, including
520
+ * cross-chain. Returns an ordered list of transactions to execute.
521
+ * @param request The sweep request containing buyer, collection, payment, and item caps.
522
+ * @returns The {@link SweepCollectionResponse} returned by the API.
523
+ */
524
+ async sweepCollection(request) {
525
+ return this.listingsAPI.sweepCollection(request);
526
+ }
527
+ /**
528
+ * Get executable transactions for a token swap. Companion to
529
+ * {@link OpenSeaAPI.getSwapQuote} — quote first, then execute.
530
+ * @param request The swap execution request.
531
+ * @returns The {@link SwapExecuteResponse} with transactions and a quote.
532
+ */
533
+ async executeSwap(request) {
534
+ return this.tokensAPI.executeSwap(request);
535
+ }
536
+ /**
537
+ * Get the receipt/status for a submitted transaction. Works for all transaction
538
+ * types: listing fulfillments, cross-chain buys, sweeps, offer fulfillments,
539
+ * and token swaps. Poll this endpoint to check completion status.
540
+ * @param request The transaction receipt request.
541
+ * @returns The {@link TransactionReceiptResponse} returned by the API.
552
542
  */
553
- async getNFTListings(assetContractAddress, tokenId, limit, next, chain = this.chain, includePrivateListings) {
554
- return this.listingsAPI.getNFTListings(assetContractAddress, tokenId, limit, next, chain, includePrivateListings);
543
+ async getTransactionReceipt(request) {
544
+ return this.transactionsAPI.getTransactionReceipt(request);
555
545
  }
556
546
  /**
557
547
  * Gets a list of drops (mints).
@@ -625,6 +615,148 @@ class OpenSeaAPI {
625
615
  async getNFTMetadata(address, tokenId, chain = this.chain) {
626
616
  return this.nftsAPI.getNFTMetadata(address, tokenId, chain);
627
617
  }
618
+ /**
619
+ * Fetch multiple tokens in a single request.
620
+ * @param request Batch request listing chain + contract address pairs.
621
+ * @returns The {@link TokenBatchResponse} with detailed token info.
622
+ */
623
+ async getTokensBatch(request) {
624
+ return this.tokensAPI.getTokensBatch(request);
625
+ }
626
+ /**
627
+ * Fetch the price history of a token.
628
+ * @param chain Chain the token lives on.
629
+ * @param address Token contract address.
630
+ * @param args Time-series window — `start_time` required, `end_time` defaults to now.
631
+ * @returns The {@link PriceHistoryResponse} returned by the API.
632
+ */
633
+ async getTokenPriceHistory(chain, address, args) {
634
+ return this.tokensAPI.getTokenPriceHistory(chain, address, args);
635
+ }
636
+ /**
637
+ * Fetch OHLCV candles for a token.
638
+ * @param chain Chain the token lives on.
639
+ * @param address Token contract address.
640
+ * @param args Time-series window plus candle `bucket_size` (required).
641
+ * @returns The {@link OhlcvResponse} returned by the API.
642
+ */
643
+ async getTokenOhlcv(chain, address, args) {
644
+ return this.tokensAPI.getTokenOhlcv(chain, address, args);
645
+ }
646
+ /**
647
+ * Fetch recent swap activity for a token.
648
+ */
649
+ async getTokenActivity(chain, address, args) {
650
+ return this.tokensAPI.getTokenActivity(chain, address, args);
651
+ }
652
+ /**
653
+ * Fetch multiple NFTs in a single request.
654
+ */
655
+ async getNFTsBatch(request) {
656
+ return this.nftsAPI.getNFTsBatch(request);
657
+ }
658
+ /**
659
+ * Fetch owners of an NFT.
660
+ */
661
+ async getNFTOwners(address, identifier, chain = this.chain, args) {
662
+ return this.nftsAPI.getNFTOwners(address, identifier, chain, args);
663
+ }
664
+ /**
665
+ * Fetch analytics (historical sale points) for an NFT.
666
+ */
667
+ async getNFTAnalytics(address, identifier, chain = this.chain) {
668
+ return this.nftsAPI.getNFTAnalytics(address, identifier, chain);
669
+ }
670
+ /**
671
+ * Fetch multiple collections in a single request by slug.
672
+ */
673
+ async getCollectionsBatch(request) {
674
+ return this.collectionsAPI.getCollectionsBatch(request);
675
+ }
676
+ /**
677
+ * Fetch top offers for a collection grouped by price level.
678
+ */
679
+ async getCollectionOfferAggregates(slug, args) {
680
+ return this.collectionsAPI.getCollectionOfferAggregates(slug, args);
681
+ }
682
+ /**
683
+ * Fetch holders of a collection.
684
+ */
685
+ async getCollectionHolders(slug, args) {
686
+ return this.collectionsAPI.getCollectionHolders(slug, args);
687
+ }
688
+ /**
689
+ * Fetch the floor-price history of a collection.
690
+ */
691
+ async getCollectionFloorPrices(slug, args) {
692
+ return this.collectionsAPI.getCollectionFloorPrices(slug, args);
693
+ }
694
+ /**
695
+ * Get ordered approval + sign actions to create one or more listings.
696
+ */
697
+ async createListingActions(request) {
698
+ return this.listingsAPI.createListingActions(request);
699
+ }
700
+ /**
701
+ * Build a deploy-contract transaction for a new drop.
702
+ */
703
+ async deployDropContract(request) {
704
+ return this.dropsAPI.deployDropContract(request);
705
+ }
706
+ /**
707
+ * Get the receipt of a previously submitted drop-deploy transaction.
708
+ */
709
+ async getDeployContractReceipt(chain, txHash) {
710
+ return this.dropsAPI.getDeployReceipt(chain, txHash);
711
+ }
712
+ /**
713
+ * Build transactions to transfer NFTs or tokens between wallets.
714
+ */
715
+ async transferAssets(request) {
716
+ return this.assetsAPI.transferAssets(request);
717
+ }
718
+ /**
719
+ * Get portfolio stats (net worth, P&L) for an account.
720
+ */
721
+ async getPortfolioStats(address, args) {
722
+ return this.accountsAPI.getPortfolioStats(address, args);
723
+ }
724
+ /**
725
+ * Get portfolio net-worth history for an account.
726
+ */
727
+ async getPortfolioHistory(address, args) {
728
+ return this.accountsAPI.getPortfolioHistory(address, args);
729
+ }
730
+ /**
731
+ * Get offers received by an account.
732
+ */
733
+ async getProfileOffersReceived(address, args) {
734
+ return this.accountsAPI.getProfileOffersReceived(address, args);
735
+ }
736
+ /**
737
+ * Get active offers made by an account.
738
+ */
739
+ async getProfileOffers(address, args) {
740
+ return this.accountsAPI.getProfileOffers(address, args);
741
+ }
742
+ /**
743
+ * Get active listings for an account.
744
+ */
745
+ async getProfileListings(address, args) {
746
+ return this.accountsAPI.getProfileListings(address, args);
747
+ }
748
+ /**
749
+ * Get items favorited by an account.
750
+ */
751
+ async getProfileFavorites(address, args) {
752
+ return this.accountsAPI.getProfileFavorites(address, args);
753
+ }
754
+ /**
755
+ * Get collections owned by an account.
756
+ */
757
+ async getProfileCollections(address, args) {
758
+ return this.accountsAPI.getProfileCollections(address, args);
759
+ }
628
760
  /**
629
761
  * Generic fetch method for any API endpoint with automatic rate limit retry
630
762
  * @param apiPath Path to URL endpoint under API