@opensea/sdk 12.2.0 → 12.4.1
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.
- package/README.md +23 -8
- package/lib/api/api.d.ts +136 -14
- package/lib/api/api.js +233 -114
- package/lib/api/api.js.map +1 -1
- package/lib/api/events.d.ts +0 -3
- package/lib/api/events.js +18 -1
- package/lib/api/events.js.map +1 -1
- package/lib/api/tokens.js +23 -2
- package/lib/api/tokens.js.map +1 -1
- package/lib/api/types.d.ts +30 -5
- package/lib/api/types.js.map +1 -1
- package/lib/types.d.ts +39 -0
- package/lib/types.js.map +1 -1
- package/package.json +2 -2
- package/src/api/api.ts +238 -119
- package/src/api/events.ts +19 -1
- package/src/api/tokens.ts +24 -2
- package/src/api/types.ts +30 -4
- package/src/types.ts +39 -0
package/lib/api/api.js
CHANGED
|
@@ -40,29 +40,43 @@ class OpenSeaAPI {
|
|
|
40
40
|
logger;
|
|
41
41
|
apiKey;
|
|
42
42
|
authToken;
|
|
43
|
+
/** Transport for every instance request. See {@link OpenSeaAPIConfig.fetch}. */
|
|
44
|
+
fetchImpl;
|
|
43
45
|
chain;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Per-domain clients. Prefer these over the flat `getCollection` / `getTraits` style methods on
|
|
48
|
+
* this class, which are deprecated and will be removed in the next major.
|
|
49
|
+
*
|
|
50
|
+
* `search` is absent because `SearchAPI` holds a single method also called `search`, so the
|
|
51
|
+
* property and the existing `search()` method want the same name and only one can be added
|
|
52
|
+
* without a break. Call it as `api.search(args)`.
|
|
53
|
+
*/
|
|
54
|
+
orders;
|
|
55
|
+
offers;
|
|
56
|
+
listings;
|
|
57
|
+
collections;
|
|
58
|
+
nfts;
|
|
59
|
+
accounts;
|
|
60
|
+
events;
|
|
61
|
+
tokens;
|
|
62
|
+
chains;
|
|
63
|
+
drops;
|
|
64
|
+
transactions;
|
|
65
|
+
assets;
|
|
58
66
|
/** Wallet-authenticated scoped REST helpers. */
|
|
59
67
|
walletAuth;
|
|
68
|
+
/** See the note above: this one stays private, and `api.search(args)` is the call. */
|
|
69
|
+
searchAPI;
|
|
60
70
|
/**
|
|
61
71
|
* Create an instance of the OpenSeaAPI
|
|
62
72
|
* @param config OpenSeaAPIConfig for setting up the API, including an optional API key, Chain name, and base URL
|
|
63
73
|
* @param logger Optional function for logging debug strings before and after requests are made. Defaults to no logging
|
|
64
74
|
*/
|
|
65
75
|
constructor(config, logger) {
|
|
76
|
+
// Read through globalThis rather than captured at construction, so a caller who swaps
|
|
77
|
+
// globalThis.fetch afterwards still takes effect.
|
|
78
|
+
this.fetchImpl =
|
|
79
|
+
config.fetch ?? ((url, init) => globalThis.fetch(url, init));
|
|
66
80
|
this.apiKey = config.apiKey;
|
|
67
81
|
this.authToken = config.authToken;
|
|
68
82
|
this.chain = config.chain ?? types_1.Chain.Mainnet;
|
|
@@ -81,19 +95,19 @@ class OpenSeaAPI {
|
|
|
81
95
|
request: this.request.bind(this),
|
|
82
96
|
};
|
|
83
97
|
// Initialize specialized API clients
|
|
84
|
-
this.
|
|
85
|
-
this.
|
|
86
|
-
this.
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
89
|
-
this.
|
|
90
|
-
this.
|
|
98
|
+
this.orders = new orders_1.OrdersAPI(fetcher, this.chain);
|
|
99
|
+
this.offers = new offers_1.OffersAPI(fetcher, this.chain);
|
|
100
|
+
this.listings = new listings_1.ListingsAPI(fetcher);
|
|
101
|
+
this.collections = new collections_1.CollectionsAPI(fetcher);
|
|
102
|
+
this.nfts = new nfts_1.NFTsAPI(fetcher, this.chain);
|
|
103
|
+
this.accounts = new accounts_1.AccountsAPI(fetcher, this.chain);
|
|
104
|
+
this.events = new events_1.EventsAPI(fetcher);
|
|
91
105
|
this.searchAPI = new search_1.SearchAPI(fetcher);
|
|
92
|
-
this.
|
|
93
|
-
this.
|
|
94
|
-
this.
|
|
95
|
-
this.
|
|
96
|
-
this.
|
|
106
|
+
this.tokens = new tokens_1.TokensAPI(fetcher);
|
|
107
|
+
this.chains = new chains_1.ChainsAPI(fetcher);
|
|
108
|
+
this.drops = new drops_1.DropsAPI(fetcher);
|
|
109
|
+
this.transactions = new transactions_1.TransactionsAPI(fetcher);
|
|
110
|
+
this.assets = new assets_1.AssetsAPI(fetcher);
|
|
97
111
|
this.walletAuth = new walletAuth_1.WalletAuthAPI(fetcher);
|
|
98
112
|
}
|
|
99
113
|
/**
|
|
@@ -103,9 +117,10 @@ class OpenSeaAPI {
|
|
|
103
117
|
* @param chain The chain where the order is located. Defaults to the chain set in the constructor.
|
|
104
118
|
* @returns The {@link GetOrderByHashResponse} returned by the API (can be Offer or Listing)
|
|
105
119
|
* @throws An error if the order is not found
|
|
120
|
+
* @deprecated Use `api.orders.getOrderByHash()`. Removed in the next major.
|
|
106
121
|
*/
|
|
107
122
|
async getOrderByHash(orderHash, protocolAddress, chain = this.chain) {
|
|
108
|
-
return this.
|
|
123
|
+
return this.orders.getOrderByHash(orderHash, protocolAddress, chain);
|
|
109
124
|
}
|
|
110
125
|
/**
|
|
111
126
|
* Gets all offers for a given collection.
|
|
@@ -113,9 +128,10 @@ class OpenSeaAPI {
|
|
|
113
128
|
* @param limit The number of offers to return. Must be between 1 and 100. Default: 100
|
|
114
129
|
* @param next The cursor for the next page of results. This is returned from a previous request.
|
|
115
130
|
* @returns The {@link GetOffersResponse} returned by the API.
|
|
131
|
+
* @deprecated Use `api.offers.getAllOffers()`. Removed in the next major.
|
|
116
132
|
*/
|
|
117
133
|
async getAllOffers(collectionSlug, limit, next) {
|
|
118
|
-
return this.
|
|
134
|
+
return this.offers.getAllOffers(collectionSlug, limit, next);
|
|
119
135
|
}
|
|
120
136
|
/**
|
|
121
137
|
* Gets all listings for a given collection.
|
|
@@ -124,9 +140,10 @@ class OpenSeaAPI {
|
|
|
124
140
|
* @param next The cursor for the next page of results. This is returned from a previous request.
|
|
125
141
|
* @param includePrivateListings Whether to include private listings (default: false)
|
|
126
142
|
* @returns The {@link GetListingsResponse} returned by the API.
|
|
143
|
+
* @deprecated Use `api.listings.getAllListings()`. Removed in the next major.
|
|
127
144
|
*/
|
|
128
145
|
async getAllListings(collectionSlug, limit, next, includePrivateListings) {
|
|
129
|
-
return this.
|
|
146
|
+
return this.listings.getAllListings(collectionSlug, limit, next, includePrivateListings);
|
|
130
147
|
}
|
|
131
148
|
/**
|
|
132
149
|
* Gets trait offers for a given collection.
|
|
@@ -138,18 +155,20 @@ class OpenSeaAPI {
|
|
|
138
155
|
* @param floatValue The value of the trait for decimal-based numeric traits.
|
|
139
156
|
* @param intValue The value of the trait for integer-based numeric traits.
|
|
140
157
|
* @returns The {@link GetOffersResponse} returned by the API.
|
|
158
|
+
* @deprecated Use `api.offers.getTraitOffers()`. Removed in the next major.
|
|
141
159
|
*/
|
|
142
160
|
async getTraitOffers(collectionSlug, type, value, limit, next, floatValue, intValue) {
|
|
143
|
-
return this.
|
|
161
|
+
return this.offers.getTraitOffers(collectionSlug, type, value, limit, next, floatValue, intValue);
|
|
144
162
|
}
|
|
145
163
|
/**
|
|
146
164
|
* Gets the best offer for a given token.
|
|
147
165
|
* @param collectionSlug The slug of the collection.
|
|
148
166
|
* @param tokenId The token identifier.
|
|
149
167
|
* @returns The {@link GetBestOfferResponse} returned by the API.
|
|
168
|
+
* @deprecated Use `api.offers.getBestOffer()`. Removed in the next major.
|
|
150
169
|
*/
|
|
151
170
|
async getBestOffer(collectionSlug, tokenId) {
|
|
152
|
-
return this.
|
|
171
|
+
return this.offers.getBestOffer(collectionSlug, tokenId);
|
|
153
172
|
}
|
|
154
173
|
/**
|
|
155
174
|
* Gets the best listing for a given token.
|
|
@@ -157,9 +176,10 @@ class OpenSeaAPI {
|
|
|
157
176
|
* @param tokenId The token identifier.
|
|
158
177
|
* @param includePrivateListings Whether to include private listings (default: false)
|
|
159
178
|
* @returns The {@link GetBestListingResponse} returned by the API.
|
|
179
|
+
* @deprecated Use `api.listings.getBestListing()`. Removed in the next major.
|
|
160
180
|
*/
|
|
161
181
|
async getBestListing(collectionSlug, tokenId, includePrivateListings) {
|
|
162
|
-
return this.
|
|
182
|
+
return this.listings.getBestListing(collectionSlug, tokenId, includePrivateListings);
|
|
163
183
|
}
|
|
164
184
|
/**
|
|
165
185
|
* Gets the best listings for a given collection.
|
|
@@ -169,9 +189,10 @@ class OpenSeaAPI {
|
|
|
169
189
|
* @param includePrivateListings Whether to include private listings (default: false)
|
|
170
190
|
* @param traits Optional {@link TraitFilter} array. Returns 400 if a single trait matches more than 1000 items.
|
|
171
191
|
* @returns The {@link GetListingsResponse} returned by the API.
|
|
192
|
+
* @deprecated Use `api.listings.getBestListings()`. Removed in the next major.
|
|
172
193
|
*/
|
|
173
194
|
async getBestListings(collectionSlug, limit, next, includePrivateListings, traits) {
|
|
174
|
-
return this.
|
|
195
|
+
return this.listings.getBestListings(collectionSlug, limit, next, includePrivateListings, traits);
|
|
175
196
|
}
|
|
176
197
|
/**
|
|
177
198
|
* Get cross-chain fulfillment data for one or more listings.
|
|
@@ -179,9 +200,10 @@ class OpenSeaAPI {
|
|
|
179
200
|
* All listings must be EVM (Seaport orders). Payment can be from any chain (EVM or SVM).
|
|
180
201
|
* @param request The cross-chain fulfillment request containing listings, fulfiller, payment, and optional recipient
|
|
181
202
|
* @returns The {@link CrossChainFulfillmentResponse} with ordered transactions to sign and submit
|
|
203
|
+
* @deprecated Use `api.listings.getCrossChainFulfillmentData()`. Removed in the next major.
|
|
182
204
|
*/
|
|
183
205
|
async getCrossChainFulfillmentData(request) {
|
|
184
|
-
return this.
|
|
206
|
+
return this.listings.getCrossChainFulfillmentData(request);
|
|
185
207
|
}
|
|
186
208
|
/**
|
|
187
209
|
* Generate the data needed to fulfill a listing or an offer onchain.
|
|
@@ -195,27 +217,30 @@ class OpenSeaAPI {
|
|
|
195
217
|
* @param recipientAddress Optional recipient address for the NFT when fulfilling a listing. Not applicable for offers.
|
|
196
218
|
* @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.
|
|
197
219
|
* @returns The {@link FulfillmentDataResponse}
|
|
220
|
+
* @deprecated Use `api.orders.generateFulfillmentData()`. Removed in the next major.
|
|
198
221
|
*/
|
|
199
222
|
async generateFulfillmentData(fulfillerAddress, orderHash, protocolAddress, side, assetContractAddress, tokenId, unitsToFill, recipientAddress, includeOptionalCreatorFees = false) {
|
|
200
|
-
return this.
|
|
223
|
+
return this.orders.generateFulfillmentData(fulfillerAddress, orderHash, protocolAddress, side, assetContractAddress, tokenId, unitsToFill, recipientAddress, includeOptionalCreatorFees);
|
|
201
224
|
}
|
|
202
225
|
/**
|
|
203
226
|
* Post a listing to OpenSea. Returns the new v2 Listing response format.
|
|
204
227
|
* @param order The order to post
|
|
205
228
|
* @param protocolAddress The contract address of the seaport protocol
|
|
206
229
|
* @returns The {@link Listing} posted to the API.
|
|
230
|
+
* @deprecated Use `api.orders.postListing()`. Removed in the next major.
|
|
207
231
|
*/
|
|
208
232
|
async postListing(order, protocolAddress) {
|
|
209
|
-
return this.
|
|
233
|
+
return this.orders.postListing(order, protocolAddress);
|
|
210
234
|
}
|
|
211
235
|
/**
|
|
212
236
|
* Post an offer to OpenSea. Returns the new v2 Offer response format.
|
|
213
237
|
* @param order The order to post
|
|
214
238
|
* @param protocolAddress The contract address of the seaport protocol
|
|
215
239
|
* @returns The {@link Offer} posted to the API.
|
|
240
|
+
* @deprecated Use `api.orders.postOffer()`. Removed in the next major.
|
|
216
241
|
*/
|
|
217
242
|
async postOffer(order, protocolAddress) {
|
|
218
|
-
return this.
|
|
243
|
+
return this.orders.postOffer(order, protocolAddress);
|
|
219
244
|
}
|
|
220
245
|
/**
|
|
221
246
|
* Build a OpenSea collection offer.
|
|
@@ -228,9 +253,10 @@ class OpenSeaAPI {
|
|
|
228
253
|
* @param traits If defined, an array of traits to create the multi-trait collection offer for.
|
|
229
254
|
* @param numericTraits If defined, an array of numeric trait criteria with min/max ranges.
|
|
230
255
|
* @returns The {@link BuildOfferResponse} returned by the API.
|
|
256
|
+
* @deprecated Use `api.offers.buildOffer()`. Removed in the next major.
|
|
231
257
|
*/
|
|
232
258
|
async buildOffer(offererAddress, quantity, collectionSlug, offerProtectionEnabled = true, traitType, traitValue, traits, numericTraits) {
|
|
233
|
-
return this.
|
|
259
|
+
return this.offers.buildOffer(offererAddress, quantity, collectionSlug, offerProtectionEnabled, traitType, traitValue, traits, numericTraits);
|
|
234
260
|
}
|
|
235
261
|
/**
|
|
236
262
|
* Get a list collection offers for a given slug.
|
|
@@ -238,9 +264,10 @@ class OpenSeaAPI {
|
|
|
238
264
|
* @param limit Optional limit for number of results.
|
|
239
265
|
* @param next Optional cursor for pagination.
|
|
240
266
|
* @returns The {@link GetOffersResponse} returned by the API.
|
|
267
|
+
* @deprecated Use `api.offers.getCollectionOffers()`. Removed in the next major.
|
|
241
268
|
*/
|
|
242
269
|
async getCollectionOffers(slug, limit, next) {
|
|
243
|
-
return this.
|
|
270
|
+
return this.offers.getCollectionOffers(slug, limit, next);
|
|
244
271
|
}
|
|
245
272
|
/**
|
|
246
273
|
* Post a collection offer to OpenSea.
|
|
@@ -251,9 +278,10 @@ class OpenSeaAPI {
|
|
|
251
278
|
* @param traits If defined, an array of traits to create the multi-trait collection offer for.
|
|
252
279
|
* @param numericTraits If defined, an array of numeric trait criteria with min/max ranges.
|
|
253
280
|
* @returns The {@link Offer} returned to the API.
|
|
281
|
+
* @deprecated Use `api.offers.postCollectionOffer()`. Removed in the next major.
|
|
254
282
|
*/
|
|
255
283
|
async postCollectionOffer(order, slug, traitType, traitValue, traits, numericTraits) {
|
|
256
|
-
return this.
|
|
284
|
+
return this.offers.postCollectionOffer(order, slug, traitType, traitValue, traits, numericTraits);
|
|
257
285
|
}
|
|
258
286
|
/**
|
|
259
287
|
* Fetch multiple NFTs for a collection.
|
|
@@ -262,9 +290,10 @@ class OpenSeaAPI {
|
|
|
262
290
|
* @param next Cursor to retrieve the next page of NFTs
|
|
263
291
|
* @param traits Optional {@link TraitFilter} array. Returns 400 if a single trait matches more than 1000 items.
|
|
264
292
|
* @returns The {@link ListNFTsResponse} returned by the API.
|
|
293
|
+
* @deprecated Use `api.nfts.getNFTsByCollection()`. Removed in the next major.
|
|
265
294
|
*/
|
|
266
295
|
async getNFTsByCollection(slug, limit = undefined, next = undefined, traits = undefined) {
|
|
267
|
-
return this.
|
|
296
|
+
return this.nfts.getNFTsByCollection(slug, limit, next, traits);
|
|
268
297
|
}
|
|
269
298
|
/**
|
|
270
299
|
* Fetch multiple NFTs for a contract.
|
|
@@ -273,9 +302,10 @@ class OpenSeaAPI {
|
|
|
273
302
|
* @param next Cursor to retrieve the next page of NFTs.
|
|
274
303
|
* @param chain The NFT's chain.
|
|
275
304
|
* @returns The {@link ListNFTsResponse} returned by the API.
|
|
305
|
+
* @deprecated Use `api.nfts.getNFTsByContract()`. Removed in the next major.
|
|
276
306
|
*/
|
|
277
307
|
async getNFTsByContract(address, limit = undefined, next = undefined, chain = this.chain) {
|
|
278
|
-
return this.
|
|
308
|
+
return this.nfts.getNFTsByContract(address, limit, next, chain);
|
|
279
309
|
}
|
|
280
310
|
/**
|
|
281
311
|
* Fetch NFTs owned by an account.
|
|
@@ -284,9 +314,10 @@ class OpenSeaAPI {
|
|
|
284
314
|
* @param next Cursor to retrieve the next page of NFTs
|
|
285
315
|
* @param chain The chain to query. Defaults to the chain set in the constructor.
|
|
286
316
|
* @returns The {@link ListNFTsResponse} returned by the API.
|
|
317
|
+
* @deprecated Use `api.nfts.getNFTsByAccount()`. Removed in the next major.
|
|
287
318
|
*/
|
|
288
319
|
async getNFTsByAccount(address, limit = undefined, next = undefined, chain = this.chain) {
|
|
289
|
-
return this.
|
|
320
|
+
return this.nfts.getNFTsByAccount(address, limit, next, chain);
|
|
290
321
|
}
|
|
291
322
|
/**
|
|
292
323
|
* Fetch metadata, traits, ownership information, and rarity for a single NFT.
|
|
@@ -294,17 +325,19 @@ class OpenSeaAPI {
|
|
|
294
325
|
* @param identifier the identifier of the NFT (i.e. Token ID)
|
|
295
326
|
* @param chain The NFT's chain.
|
|
296
327
|
* @returns The {@link GetNFTResponse} returned by the API.
|
|
328
|
+
* @deprecated Use `api.nfts.getNFT()`. Removed in the next major.
|
|
297
329
|
*/
|
|
298
330
|
async getNFT(address, identifier, chain = this.chain) {
|
|
299
|
-
return this.
|
|
331
|
+
return this.nfts.getNFT(address, identifier, chain);
|
|
300
332
|
}
|
|
301
333
|
/**
|
|
302
334
|
* Fetch an OpenSea collection.
|
|
303
335
|
* @param slug The slug (identifier) of the collection.
|
|
304
336
|
* @returns The {@link OpenSeaCollection} returned by the API.
|
|
337
|
+
* @deprecated Use `api.collections.getCollection()`. Removed in the next major.
|
|
305
338
|
*/
|
|
306
339
|
async getCollection(slug) {
|
|
307
|
-
return this.
|
|
340
|
+
return this.collections.getCollection(slug);
|
|
308
341
|
}
|
|
309
342
|
/**
|
|
310
343
|
* Fetch a list of OpenSea collections.
|
|
@@ -315,34 +348,38 @@ class OpenSeaAPI {
|
|
|
315
348
|
* @param limit The limit of collections to return.
|
|
316
349
|
* @param next The cursor for the next page of results. This is returned from a previous request.
|
|
317
350
|
* @returns List of {@link OpenSeaCollection} returned by the API.
|
|
351
|
+
* @deprecated Use `api.collections.getCollections()`. Removed in the next major.
|
|
318
352
|
*/
|
|
319
353
|
async getCollections(orderBy = types_2.CollectionOrderByOption.CREATED_DATE, chain, creatorUsername, includeHidden = false, limit, next) {
|
|
320
|
-
return this.
|
|
354
|
+
return this.collections.getCollections(orderBy, chain, creatorUsername, includeHidden, limit, next);
|
|
321
355
|
}
|
|
322
356
|
/**
|
|
323
357
|
* Fetch stats for an OpenSea collection.
|
|
324
358
|
* @param slug The slug (identifier) of the collection.
|
|
325
359
|
* @returns The {@link OpenSeaCollection} returned by the API.
|
|
360
|
+
* @deprecated Use `api.collections.getCollectionStats()`. Removed in the next major.
|
|
326
361
|
*/
|
|
327
362
|
async getCollectionStats(slug) {
|
|
328
|
-
return this.
|
|
363
|
+
return this.collections.getCollectionStats(slug);
|
|
329
364
|
}
|
|
330
365
|
/**
|
|
331
366
|
* Fetch a payment token.
|
|
332
367
|
* @param address The address of the payment token
|
|
333
368
|
* @param chain The chain of the payment token
|
|
334
369
|
* @returns The {@link OpenSeaPaymentToken} returned by the API.
|
|
370
|
+
* @deprecated Use `api.accounts.getPaymentToken()`. Removed in the next major.
|
|
335
371
|
*/
|
|
336
372
|
async getPaymentToken(address, chain = this.chain) {
|
|
337
|
-
return this.
|
|
373
|
+
return this.accounts.getPaymentToken(address, chain);
|
|
338
374
|
}
|
|
339
375
|
/**
|
|
340
376
|
* Fetch account for an address.
|
|
341
377
|
* @param address The address to fetch the account for
|
|
342
378
|
* @returns The {@link OpenSeaAccount} returned by the API.
|
|
379
|
+
* @deprecated Use `api.accounts.getAccount()`. Removed in the next major.
|
|
343
380
|
*/
|
|
344
381
|
async getAccount(address) {
|
|
345
|
-
return this.
|
|
382
|
+
return this.accounts.getAccount(address);
|
|
346
383
|
}
|
|
347
384
|
/**
|
|
348
385
|
* Force refresh the metadata for an NFT.
|
|
@@ -350,9 +387,10 @@ class OpenSeaAPI {
|
|
|
350
387
|
* @param identifier The identifier of the NFT.
|
|
351
388
|
* @param chain The chain where the NFT is located.
|
|
352
389
|
* @returns The response from the API.
|
|
390
|
+
* @deprecated Use `api.nfts.refreshNFTMetadata()`. Removed in the next major.
|
|
353
391
|
*/
|
|
354
392
|
async refreshNFTMetadata(address, identifier, chain = this.chain) {
|
|
355
|
-
return this.
|
|
393
|
+
return this.nfts.refreshNFTMetadata(address, identifier, chain);
|
|
356
394
|
}
|
|
357
395
|
/**
|
|
358
396
|
* Offchain cancel an order, offer or listing, by its order hash when protected by the SignedZone.
|
|
@@ -367,32 +405,36 @@ class OpenSeaAPI {
|
|
|
367
405
|
* name, version, address, and chain. The struct to sign is `OrderHash` containing a
|
|
368
406
|
* single bytes32 field.
|
|
369
407
|
* @returns The response from the API.
|
|
408
|
+
* @deprecated Use `api.orders.offchainCancelOrder()`. Removed in the next major.
|
|
370
409
|
*/
|
|
371
410
|
async offchainCancelOrder(protocolAddress, orderHash, chain = this.chain, offererSignature) {
|
|
372
|
-
return this.
|
|
411
|
+
return this.orders.offchainCancelOrder(protocolAddress, orderHash, chain, offererSignature);
|
|
373
412
|
}
|
|
374
413
|
/**
|
|
375
414
|
* Get ordered actions to cancel an order onchain.
|
|
415
|
+
* @deprecated Use `api.orders.createCancelOrderActions()`. Removed in the next major.
|
|
376
416
|
*/
|
|
377
417
|
async createCancelOrderActions(protocolAddress, orderIdentifier, request, chain = this.chain) {
|
|
378
|
-
return this.
|
|
418
|
+
return this.orders.createCancelOrderActions(protocolAddress, orderIdentifier, request, chain);
|
|
379
419
|
}
|
|
380
420
|
/**
|
|
381
421
|
* Gets a list of events based on query parameters.
|
|
382
422
|
* @param args Query parameters for filtering events.
|
|
383
423
|
* @returns The {@link GetEventsResponse} returned by the API.
|
|
424
|
+
* @deprecated Use `api.events.getEvents()`. Removed in the next major.
|
|
384
425
|
*/
|
|
385
426
|
async getEvents(args) {
|
|
386
|
-
return this.
|
|
427
|
+
return this.events.getEvents(args);
|
|
387
428
|
}
|
|
388
429
|
/**
|
|
389
430
|
* Gets a list of events for a specific account.
|
|
390
431
|
* @param address The account address.
|
|
391
432
|
* @param args Query parameters for filtering events.
|
|
392
433
|
* @returns The {@link GetEventsResponse} returned by the API.
|
|
434
|
+
* @deprecated Use `api.events.getEventsByAccount()`. Removed in the next major.
|
|
393
435
|
*/
|
|
394
436
|
async getEventsByAccount(address, args) {
|
|
395
|
-
return this.
|
|
437
|
+
return this.events.getEventsByAccount(address, args);
|
|
396
438
|
}
|
|
397
439
|
/**
|
|
398
440
|
* Gets a list of events for a specific collection. Pass `args.traits` to
|
|
@@ -400,9 +442,10 @@ class OpenSeaAPI {
|
|
|
400
442
|
* @param collectionSlug The slug (identifier) of the collection.
|
|
401
443
|
* @param args Query parameters; see {@link GetEventsByCollectionArgs}.
|
|
402
444
|
* @returns The {@link GetEventsResponse} returned by the API.
|
|
445
|
+
* @deprecated Use `api.events.getEventsByCollection()`. Removed in the next major.
|
|
403
446
|
*/
|
|
404
447
|
async getEventsByCollection(collectionSlug, args) {
|
|
405
|
-
return this.
|
|
448
|
+
return this.events.getEventsByCollection(collectionSlug, args);
|
|
406
449
|
}
|
|
407
450
|
/**
|
|
408
451
|
* Gets a list of events for a specific NFT.
|
|
@@ -411,76 +454,99 @@ class OpenSeaAPI {
|
|
|
411
454
|
* @param identifier The token identifier.
|
|
412
455
|
* @param args Query parameters for filtering events.
|
|
413
456
|
* @returns The {@link GetEventsResponse} returned by the API.
|
|
457
|
+
* @deprecated Use `api.events.getEventsByNFT()`. Removed in the next major.
|
|
414
458
|
*/
|
|
415
459
|
async getEventsByNFT(chain, address, identifier, args) {
|
|
416
|
-
return this.
|
|
460
|
+
return this.events.getEventsByNFT(chain, address, identifier, args);
|
|
417
461
|
}
|
|
418
462
|
/**
|
|
419
463
|
* Fetch smart contract information for a given chain and address.
|
|
420
464
|
* @param address The contract address.
|
|
421
465
|
* @param chain The chain where the contract is deployed. Defaults to the chain set in the constructor.
|
|
422
466
|
* @returns The {@link GetContractResponse} returned by the API.
|
|
467
|
+
* @deprecated Use `api.nfts.getContract()`. Removed in the next major.
|
|
423
468
|
*/
|
|
424
469
|
async getContract(address, chain = this.chain) {
|
|
425
|
-
return this.
|
|
470
|
+
return this.nfts.getContract(address, chain);
|
|
426
471
|
}
|
|
427
472
|
/**
|
|
428
473
|
* Fetch all traits for a collection with their possible values and counts.
|
|
429
474
|
* @param collectionSlug The slug (identifier) of the collection.
|
|
430
475
|
* @returns The {@link GetTraitsResponse} returned by the API.
|
|
476
|
+
* @deprecated Use `api.collections.getTraits()`. Removed in the next major.
|
|
431
477
|
*/
|
|
432
478
|
async getTraits(collectionSlug) {
|
|
433
|
-
return this.
|
|
479
|
+
return this.collections.getTraits(collectionSlug);
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Fetch floor prices per trait value for a collection.
|
|
483
|
+
*
|
|
484
|
+
* Covers text traits with at least one active listing, ordered by trait type, then value, then
|
|
485
|
+
* price. Numeric traits are not enumerated here; use {@link getTraits} for their min/max range.
|
|
486
|
+
* Every floor is denominated on the collection's own chain, identified by `chain` plus each
|
|
487
|
+
* entry's `paymentTokenSymbol`.
|
|
488
|
+
* @param collectionSlug The slug (identifier) of the collection.
|
|
489
|
+
* @returns The {@link TraitFloorsResponse} returned by the API.
|
|
490
|
+
* @deprecated Use `api.collections.getCollectionTraitFloors()`. Removed in the next major.
|
|
491
|
+
*/
|
|
492
|
+
async getCollectionTraitFloors(collectionSlug) {
|
|
493
|
+
return this.collections.getCollectionTraitFloors(collectionSlug);
|
|
434
494
|
}
|
|
435
495
|
/**
|
|
436
496
|
* Gets a list of trending tokens.
|
|
437
497
|
* @param args Optional query parameters for pagination.
|
|
438
498
|
* @returns The {@link GetTrendingTokensResponse} returned by the API.
|
|
499
|
+
* @deprecated Use `api.tokens.getTrendingTokens()`. Removed in the next major.
|
|
439
500
|
*/
|
|
440
501
|
async getTrendingTokens(args) {
|
|
441
|
-
return this.
|
|
502
|
+
return this.tokens.getTrendingTokens(args);
|
|
442
503
|
}
|
|
443
504
|
/**
|
|
444
505
|
* Gets a list of top tokens.
|
|
445
506
|
* @param args Optional query parameters for pagination.
|
|
446
507
|
* @returns The {@link GetTopTokensResponse} returned by the API.
|
|
508
|
+
* @deprecated Use `api.tokens.getTopTokens()`. Removed in the next major.
|
|
447
509
|
*/
|
|
448
510
|
async getTopTokens(args) {
|
|
449
|
-
return this.
|
|
511
|
+
return this.tokens.getTopTokens(args);
|
|
450
512
|
}
|
|
451
513
|
/**
|
|
452
514
|
* Gets a swap quote for exchanging tokens.
|
|
453
515
|
* @param args Query parameters for the swap quote including token addresses, amount, and chain.
|
|
454
516
|
* @returns The {@link GetSwapQuoteResponse} returned by the API.
|
|
517
|
+
* @deprecated Use `api.tokens.getSwapQuote()`. Removed in the next major.
|
|
455
518
|
*/
|
|
456
519
|
async getSwapQuote(args) {
|
|
457
|
-
return this.
|
|
520
|
+
return this.tokens.getSwapQuote(args);
|
|
458
521
|
}
|
|
459
522
|
/**
|
|
460
523
|
* Gets details for a specific token.
|
|
461
524
|
* @param chain The chain the token is on.
|
|
462
525
|
* @param address The token contract address.
|
|
463
526
|
* @returns The {@link GetTokenResponse} returned by the API.
|
|
527
|
+
* @deprecated Use `api.tokens.getToken()`. Removed in the next major.
|
|
464
528
|
*/
|
|
465
529
|
async getToken(chain, address) {
|
|
466
|
-
return this.
|
|
530
|
+
return this.tokens.getToken(chain, address);
|
|
467
531
|
}
|
|
468
532
|
/**
|
|
469
533
|
* Gets a paginated list of token groups — equivalent currencies across
|
|
470
534
|
* chains (e.g. ETH on Ethereum, Base, and Arbitrum share the "eth" group).
|
|
471
535
|
* @param args Optional query parameters (`limit`, `cursor`).
|
|
472
536
|
* @returns The {@link GetTokenGroupsResponse} returned by the API.
|
|
537
|
+
* @deprecated Use `api.tokens.getTokenGroups()`. Removed in the next major.
|
|
473
538
|
*/
|
|
474
539
|
async getTokenGroups(args) {
|
|
475
|
-
return this.
|
|
540
|
+
return this.tokens.getTokenGroups(args);
|
|
476
541
|
}
|
|
477
542
|
/**
|
|
478
543
|
* Gets a single token group by its slug (e.g. "eth").
|
|
479
544
|
* @param slug The token group slug.
|
|
480
545
|
* @returns The {@link GetTokenGroupResponse} returned by the API.
|
|
546
|
+
* @deprecated Use `api.tokens.getTokenGroup()`. Removed in the next major.
|
|
481
547
|
*/
|
|
482
548
|
async getTokenGroup(slug) {
|
|
483
|
-
return this.
|
|
549
|
+
return this.tokens.getTokenGroup(slug);
|
|
484
550
|
}
|
|
485
551
|
/**
|
|
486
552
|
* Search across collections, tokens, NFTs, and accounts.
|
|
@@ -494,18 +560,20 @@ class OpenSeaAPI {
|
|
|
494
560
|
/**
|
|
495
561
|
* Gets the list of supported blockchains and their capabilities.
|
|
496
562
|
* @returns The {@link GetChainsResponse} returned by the API.
|
|
563
|
+
* @deprecated Use `api.chains.getChains()`. Removed in the next major.
|
|
497
564
|
*/
|
|
498
565
|
async getChains() {
|
|
499
|
-
return this.
|
|
566
|
+
return this.chains.getChains();
|
|
500
567
|
}
|
|
501
568
|
/**
|
|
502
569
|
* Gets token balances for a given account.
|
|
503
570
|
* @param address The wallet address to fetch token balances for.
|
|
504
571
|
* @param args Optional query parameters for filtering and pagination.
|
|
505
572
|
* @returns The {@link GetAccountTokensResponse} returned by the API.
|
|
573
|
+
* @deprecated Use `api.accounts.getAccountTokens()`. Removed in the next major.
|
|
506
574
|
*/
|
|
507
575
|
async getAccountTokens(address, args) {
|
|
508
|
-
return this.
|
|
576
|
+
return this.accounts.getAccountTokens(address, args);
|
|
509
577
|
}
|
|
510
578
|
/**
|
|
511
579
|
* Validate NFT metadata by fetching and parsing it.
|
|
@@ -514,9 +582,10 @@ class OpenSeaAPI {
|
|
|
514
582
|
* @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
|
|
515
583
|
* @param ignoreCachedItemUrls Whether to ignore cached item URLs and re-fetch from source.
|
|
516
584
|
* @returns The {@link ValidateMetadataResponse} returned by the API.
|
|
585
|
+
* @deprecated Use `api.nfts.validateMetadata()`. Removed in the next major.
|
|
517
586
|
*/
|
|
518
587
|
async validateNFTMetadata(address, identifier, chain = this.chain, ignoreCachedItemUrls) {
|
|
519
|
-
return this.
|
|
588
|
+
return this.nfts.validateMetadata(address, identifier, chain, ignoreCachedItemUrls);
|
|
520
589
|
}
|
|
521
590
|
/**
|
|
522
591
|
* Gets all active offers for a specific NFT (not just the best offer).
|
|
@@ -525,27 +594,30 @@ class OpenSeaAPI {
|
|
|
525
594
|
* @param limit The number of offers to return. Must be between 1 and 200.
|
|
526
595
|
* @param next The cursor for the next page of results.
|
|
527
596
|
* @returns The {@link GetOffersResponse} returned by the API.
|
|
597
|
+
* @deprecated Use `api.offers.getOffersByNFT()`. Removed in the next major.
|
|
528
598
|
*/
|
|
529
599
|
async getOffersByNFT(collectionSlug, identifier, limit, next) {
|
|
530
|
-
return this.
|
|
600
|
+
return this.offers.getOffersByNFT(collectionSlug, identifier, limit, next);
|
|
531
601
|
}
|
|
532
602
|
/**
|
|
533
603
|
* Bulk-buy items from a collection using any payment token, including
|
|
534
604
|
* cross-chain. Returns an ordered list of transactions to execute.
|
|
535
605
|
* @param request The sweep request containing buyer, collection, payment, and item caps.
|
|
536
606
|
* @returns The {@link SweepCollectionResponse} returned by the API.
|
|
607
|
+
* @deprecated Use `api.listings.sweepCollection()`. Removed in the next major.
|
|
537
608
|
*/
|
|
538
609
|
async sweepCollection(request) {
|
|
539
|
-
return this.
|
|
610
|
+
return this.listings.sweepCollection(request);
|
|
540
611
|
}
|
|
541
612
|
/**
|
|
542
613
|
* Get executable transactions for a token swap. Companion to
|
|
543
614
|
* {@link OpenSeaAPI.getSwapQuote} — quote first, then execute.
|
|
544
615
|
* @param request The swap execution request.
|
|
545
616
|
* @returns The {@link SwapExecuteResponse} with transactions and a quote.
|
|
617
|
+
* @deprecated Use `api.tokens.executeSwap()`. Removed in the next major.
|
|
546
618
|
*/
|
|
547
619
|
async executeSwap(request) {
|
|
548
|
-
return this.
|
|
620
|
+
return this.tokens.executeSwap(request);
|
|
549
621
|
}
|
|
550
622
|
/**
|
|
551
623
|
* Get the receipt/status for a submitted transaction. Works for all transaction
|
|
@@ -553,34 +625,38 @@ class OpenSeaAPI {
|
|
|
553
625
|
* fulfillments, and token swaps. Poll this endpoint to check completion status.
|
|
554
626
|
* @param request The transaction receipt request.
|
|
555
627
|
* @returns The {@link TransactionReceiptResponse} returned by the API.
|
|
628
|
+
* @deprecated Use `api.transactions.getTransactionReceipt()`. Removed in the next major.
|
|
556
629
|
*/
|
|
557
630
|
async getTransactionReceipt(request) {
|
|
558
|
-
return this.
|
|
631
|
+
return this.transactions.getTransactionReceipt(request);
|
|
559
632
|
}
|
|
560
633
|
/**
|
|
561
634
|
* Gets a list of drops (mints).
|
|
562
635
|
* @param args Optional query parameters for filtering and pagination.
|
|
563
636
|
* @returns The {@link GetDropsResponse} returned by the API.
|
|
637
|
+
* @deprecated Use `api.drops.getDrops()`. Removed in the next major.
|
|
564
638
|
*/
|
|
565
639
|
async getDrops(args) {
|
|
566
|
-
return this.
|
|
640
|
+
return this.drops.getDrops(args);
|
|
567
641
|
}
|
|
568
642
|
/**
|
|
569
643
|
* Gets detailed drop information for a collection.
|
|
570
644
|
* @param slug The collection slug identifying the drop.
|
|
571
645
|
* @returns The {@link GetDropResponse} returned by the API.
|
|
646
|
+
* @deprecated Use `api.drops.getDrop()`. Removed in the next major.
|
|
572
647
|
*/
|
|
573
648
|
async getDrop(slug) {
|
|
574
|
-
return this.
|
|
649
|
+
return this.drops.getDrop(slug);
|
|
575
650
|
}
|
|
576
651
|
/**
|
|
577
652
|
* Builds a mint transaction for a drop.
|
|
578
653
|
* @param slug The collection slug identifying the drop.
|
|
579
654
|
* @param request The mint request containing minter address and quantity.
|
|
580
655
|
* @returns The {@link DropMintResponse} with ready-to-sign transaction data.
|
|
656
|
+
* @deprecated Use `api.drops.buildMintTransaction()`. Removed in the next major.
|
|
581
657
|
*/
|
|
582
658
|
async buildDropMintTransaction(slug, request) {
|
|
583
|
-
return this.
|
|
659
|
+
return this.drops.buildMintTransaction(slug, request);
|
|
584
660
|
}
|
|
585
661
|
/**
|
|
586
662
|
* Builds ordered transactions for paying on one chain and minting a drop on
|
|
@@ -590,42 +666,47 @@ class OpenSeaAPI {
|
|
|
590
666
|
* @param slug The collection slug identifying the drop.
|
|
591
667
|
* @param request The payer, minter, quantity, and source payment asset.
|
|
592
668
|
* @returns Transactions to submit and the request used to poll their receipt.
|
|
669
|
+
* @deprecated Use `api.drops.buildCrossChainMintTransactions()`. Removed in the next major.
|
|
593
670
|
*/
|
|
594
671
|
async buildCrossChainDropMintTransactions(slug, request) {
|
|
595
|
-
return this.
|
|
672
|
+
return this.drops.buildCrossChainMintTransactions(slug, request);
|
|
596
673
|
}
|
|
597
674
|
/**
|
|
598
675
|
* Gets trending collections sorted by sales activity.
|
|
599
676
|
* @param args Optional query parameters for timeframe, chain, category, and pagination.
|
|
600
677
|
* @returns The {@link GetCollectionsPaginatedResponse} returned by the API.
|
|
678
|
+
* @deprecated Use `api.collections.getTrendingCollections()`. Removed in the next major.
|
|
601
679
|
*/
|
|
602
680
|
async getTrendingCollections(args) {
|
|
603
|
-
return this.
|
|
681
|
+
return this.collections.getTrendingCollections(args);
|
|
604
682
|
}
|
|
605
683
|
/**
|
|
606
684
|
* Gets top collections ranked by various stats.
|
|
607
685
|
* @param args Optional query parameters for sort_by, chain, category, and pagination.
|
|
608
686
|
* @returns The {@link GetCollectionsPaginatedResponse} returned by the API.
|
|
687
|
+
* @deprecated Use `api.collections.getTopCollections()`. Removed in the next major.
|
|
609
688
|
*/
|
|
610
689
|
async getTopCollections(args) {
|
|
611
|
-
return this.
|
|
690
|
+
return this.collections.getTopCollections(args);
|
|
612
691
|
}
|
|
613
692
|
/**
|
|
614
693
|
* Resolve an ENS name, OpenSea username, or wallet address to canonical account info.
|
|
615
694
|
* @param identifier An ENS name (e.g. vitalik.eth), OpenSea username, or wallet address.
|
|
616
695
|
* @returns The {@link ResolveAccountResponse} returned by the API.
|
|
696
|
+
* @deprecated Use `api.accounts.resolveAccount()`. Removed in the next major.
|
|
617
697
|
*/
|
|
618
698
|
async resolveAccount(identifier) {
|
|
619
|
-
return this.
|
|
699
|
+
return this.accounts.resolveAccount(identifier);
|
|
620
700
|
}
|
|
621
701
|
/**
|
|
622
702
|
* Get the public agent ownership relationships for a profile.
|
|
623
703
|
* This is a public read and does not require wallet authentication.
|
|
624
704
|
* @param addressOrUsername An ENS name, OpenSea username, or wallet address.
|
|
625
705
|
* @returns The {@link AgentProfileRelationshipsResponse} returned by the API.
|
|
706
|
+
* @deprecated Use `api.accounts.getAgentProfileRelationships()`. Removed in the next major.
|
|
626
707
|
*/
|
|
627
708
|
async getAgentProfileRelationships(addressOrUsername) {
|
|
628
|
-
return this.
|
|
709
|
+
return this.accounts.getAgentProfileRelationships(addressOrUsername);
|
|
629
710
|
}
|
|
630
711
|
/**
|
|
631
712
|
* Get the collection that an NFT belongs to.
|
|
@@ -635,9 +716,10 @@ class OpenSeaAPI {
|
|
|
635
716
|
* @param identifier The token identifier.
|
|
636
717
|
* @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
|
|
637
718
|
* @returns The {@link OpenSeaCollection} returned by the API.
|
|
719
|
+
* @deprecated Use `api.nfts.getNFTCollection()`. Removed in the next major.
|
|
638
720
|
*/
|
|
639
721
|
async getNFTCollection(address, identifier, chain = this.chain) {
|
|
640
|
-
return this.
|
|
722
|
+
return this.nfts.getNFTCollection(address, identifier, chain);
|
|
641
723
|
}
|
|
642
724
|
/**
|
|
643
725
|
* Get detailed metadata for an NFT including name, description, image, traits,
|
|
@@ -646,17 +728,19 @@ class OpenSeaAPI {
|
|
|
646
728
|
* @param tokenId The token identifier.
|
|
647
729
|
* @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
|
|
648
730
|
* @returns The {@link GetNFTMetadataResponse} returned by the API.
|
|
731
|
+
* @deprecated Use `api.nfts.getNFTMetadata()`. Removed in the next major.
|
|
649
732
|
*/
|
|
650
733
|
async getNFTMetadata(address, tokenId, chain = this.chain) {
|
|
651
|
-
return this.
|
|
734
|
+
return this.nfts.getNFTMetadata(address, tokenId, chain);
|
|
652
735
|
}
|
|
653
736
|
/**
|
|
654
737
|
* Fetch multiple tokens in a single request.
|
|
655
738
|
* @param request Batch request listing chain + contract address pairs.
|
|
656
739
|
* @returns The {@link TokenBatchResponse} with detailed token info.
|
|
740
|
+
* @deprecated Use `api.tokens.getTokensBatch()`. Removed in the next major.
|
|
657
741
|
*/
|
|
658
742
|
async getTokensBatch(request) {
|
|
659
|
-
return this.
|
|
743
|
+
return this.tokens.getTokensBatch(request);
|
|
660
744
|
}
|
|
661
745
|
/**
|
|
662
746
|
* Fetch the price history of a token.
|
|
@@ -664,9 +748,10 @@ class OpenSeaAPI {
|
|
|
664
748
|
* @param address Token contract address.
|
|
665
749
|
* @param args Time-series window — `start_time` required, `end_time` defaults to now.
|
|
666
750
|
* @returns The {@link PriceHistoryResponse} returned by the API.
|
|
751
|
+
* @deprecated Use `api.tokens.getTokenPriceHistory()`. Removed in the next major.
|
|
667
752
|
*/
|
|
668
753
|
async getTokenPriceHistory(chain, address, args) {
|
|
669
|
-
return this.
|
|
754
|
+
return this.tokens.getTokenPriceHistory(chain, address, args);
|
|
670
755
|
}
|
|
671
756
|
/**
|
|
672
757
|
* Fetch OHLCV candles for a token.
|
|
@@ -674,187 +759,217 @@ class OpenSeaAPI {
|
|
|
674
759
|
* @param address Token contract address.
|
|
675
760
|
* @param args Time-series window plus candle `bucketSize` (required).
|
|
676
761
|
* @returns The {@link OhlcvResponse} returned by the API.
|
|
762
|
+
* @deprecated Use `api.tokens.getTokenOhlcv()`. Removed in the next major.
|
|
677
763
|
*/
|
|
678
764
|
async getTokenOhlcv(chain, address, args) {
|
|
679
|
-
return this.
|
|
765
|
+
return this.tokens.getTokenOhlcv(chain, address, args);
|
|
680
766
|
}
|
|
681
767
|
/**
|
|
682
768
|
* Fetch recent swap activity for a token.
|
|
769
|
+
* @deprecated Use `api.tokens.getTokenActivity()`. Removed in the next major.
|
|
683
770
|
*/
|
|
684
771
|
async getTokenActivity(chain, address, args) {
|
|
685
|
-
return this.
|
|
772
|
+
return this.tokens.getTokenActivity(chain, address, args);
|
|
686
773
|
}
|
|
687
774
|
/**
|
|
688
775
|
* Fetch materialized trade count, USD volume, and average trade size for a
|
|
689
776
|
* token across the requested windows.
|
|
777
|
+
* @deprecated Use `api.tokens.getTokenActivityStats()`. Removed in the next major.
|
|
690
778
|
*/
|
|
691
779
|
async getTokenActivityStats(chain, address, args) {
|
|
692
|
-
return this.
|
|
780
|
+
return this.tokens.getTokenActivityStats(chain, address, args);
|
|
693
781
|
}
|
|
694
782
|
/**
|
|
695
783
|
* Fetch paginated fungible token activity (transfers, swaps, wraps, and
|
|
696
784
|
* unwraps) for an account across all chains.
|
|
785
|
+
* @deprecated Use `api.tokens.getAccountTokenActivity()`. Removed in the next major.
|
|
697
786
|
*/
|
|
698
787
|
async getAccountTokenActivity(address, args) {
|
|
699
|
-
return this.
|
|
788
|
+
return this.tokens.getAccountTokenActivity(address, args);
|
|
700
789
|
}
|
|
701
790
|
/**
|
|
702
791
|
* Fetch paginated holders for a token, including quantity held, USD value,
|
|
703
792
|
* and aggregate distribution health (STRONG | HEALTHY | CONCERNING | BAD).
|
|
793
|
+
* @deprecated Use `api.tokens.getTokenHolders()`. Removed in the next major.
|
|
704
794
|
*/
|
|
705
795
|
async getTokenHolders(chain, address, args) {
|
|
706
|
-
return this.
|
|
796
|
+
return this.tokens.getTokenHolders(chain, address, args);
|
|
707
797
|
}
|
|
708
798
|
/**
|
|
709
799
|
* Fetch liquidity pools for a token (pool type, USD reserves, and
|
|
710
800
|
* bonding-curve progress / graduation flag where applicable).
|
|
801
|
+
* @deprecated Use `api.tokens.getTokenLiquidityPools()`. Removed in the next major.
|
|
711
802
|
*/
|
|
712
803
|
async getTokenLiquidityPools(chain, address, args) {
|
|
713
|
-
return this.
|
|
804
|
+
return this.tokens.getTokenLiquidityPools(chain, address, args);
|
|
714
805
|
}
|
|
715
806
|
/**
|
|
716
807
|
* Fetch multiple NFTs in a single request.
|
|
808
|
+
* @deprecated Use `api.nfts.getNFTsBatch()`. Removed in the next major.
|
|
717
809
|
*/
|
|
718
810
|
async getNFTsBatch(request) {
|
|
719
|
-
return this.
|
|
811
|
+
return this.nfts.getNFTsBatch(request);
|
|
720
812
|
}
|
|
721
813
|
/**
|
|
722
814
|
* Fetch owners of an NFT.
|
|
815
|
+
* @deprecated Use `api.nfts.getNFTOwners()`. Removed in the next major.
|
|
723
816
|
*/
|
|
724
817
|
async getNFTOwners(address, identifier, chain = this.chain, args) {
|
|
725
|
-
return this.
|
|
818
|
+
return this.nfts.getNFTOwners(address, identifier, chain, args);
|
|
726
819
|
}
|
|
727
820
|
/**
|
|
728
821
|
* Fetch analytics (historical sale points) for an NFT.
|
|
822
|
+
* @deprecated Use `api.nfts.getNFTAnalytics()`. Removed in the next major.
|
|
729
823
|
*/
|
|
730
824
|
async getNFTAnalytics(address, identifier, chain = this.chain) {
|
|
731
|
-
return this.
|
|
825
|
+
return this.nfts.getNFTAnalytics(address, identifier, chain);
|
|
732
826
|
}
|
|
733
827
|
/**
|
|
734
828
|
* Fetch multiple collections in a single request by slug.
|
|
829
|
+
* @deprecated Use `api.collections.getCollectionsBatch()`. Removed in the next major.
|
|
735
830
|
*/
|
|
736
831
|
async getCollectionsBatch(request) {
|
|
737
|
-
return this.
|
|
832
|
+
return this.collections.getCollectionsBatch(request);
|
|
738
833
|
}
|
|
739
834
|
/**
|
|
740
835
|
* Fetch top offers for a collection grouped by price level.
|
|
836
|
+
* @deprecated Use `api.collections.getCollectionOfferAggregates()`. Removed in the next major.
|
|
741
837
|
*/
|
|
742
838
|
async getCollectionOfferAggregates(slug, args) {
|
|
743
|
-
return this.
|
|
839
|
+
return this.collections.getCollectionOfferAggregates(slug, args);
|
|
744
840
|
}
|
|
745
841
|
/**
|
|
746
842
|
* Fetch holders of a collection.
|
|
843
|
+
* @deprecated Use `api.collections.getCollectionHolders()`. Removed in the next major.
|
|
747
844
|
*/
|
|
748
845
|
async getCollectionHolders(slug, args) {
|
|
749
|
-
return this.
|
|
846
|
+
return this.collections.getCollectionHolders(slug, args);
|
|
750
847
|
}
|
|
751
848
|
/**
|
|
752
849
|
* Fetch the floor-price history of a collection.
|
|
850
|
+
* @deprecated Use `api.collections.getCollectionFloorPrices()`. Removed in the next major.
|
|
753
851
|
*/
|
|
754
852
|
async getCollectionFloorPrices(slug, args) {
|
|
755
|
-
return this.
|
|
853
|
+
return this.collections.getCollectionFloorPrices(slug, args);
|
|
756
854
|
}
|
|
757
855
|
/**
|
|
758
856
|
* Get ordered approval + sign actions to create one or more listings.
|
|
857
|
+
* @deprecated Use `api.listings.createListingActions()`. Removed in the next major.
|
|
759
858
|
*/
|
|
760
859
|
async createListingActions(request) {
|
|
761
|
-
return this.
|
|
860
|
+
return this.listings.createListingActions(request);
|
|
762
861
|
}
|
|
763
862
|
/**
|
|
764
863
|
* Get ordered actions to fulfill a listing.
|
|
864
|
+
* @deprecated Use `api.listings.createListingFulfillmentActions()`. Removed in the next major.
|
|
765
865
|
*/
|
|
766
866
|
async createListingFulfillmentActions(request) {
|
|
767
|
-
return this.
|
|
867
|
+
return this.listings.createListingFulfillmentActions(request);
|
|
768
868
|
}
|
|
769
869
|
/**
|
|
770
870
|
* Get ordered actions to create an offer.
|
|
871
|
+
* @deprecated Use `api.offers.createOfferActions()`. Removed in the next major.
|
|
771
872
|
*/
|
|
772
873
|
async createOfferActions(request) {
|
|
773
|
-
return this.
|
|
874
|
+
return this.offers.createOfferActions(request);
|
|
774
875
|
}
|
|
775
876
|
/**
|
|
776
877
|
* Get ordered actions to fulfill an offer.
|
|
878
|
+
* @deprecated Use `api.offers.createOfferFulfillmentActions()`. Removed in the next major.
|
|
777
879
|
*/
|
|
778
880
|
async createOfferFulfillmentActions(request) {
|
|
779
|
-
return this.
|
|
881
|
+
return this.offers.createOfferFulfillmentActions(request);
|
|
780
882
|
}
|
|
781
883
|
/**
|
|
782
884
|
* Build a deploy-contract transaction for a new drop.
|
|
885
|
+
* @deprecated Use `api.drops.deployDropContract()`. Removed in the next major.
|
|
783
886
|
*/
|
|
784
887
|
async deployDropContract(request) {
|
|
785
|
-
return this.
|
|
888
|
+
return this.drops.deployDropContract(request);
|
|
786
889
|
}
|
|
787
890
|
/**
|
|
788
891
|
* Get the receipt of a previously submitted drop-deploy transaction.
|
|
892
|
+
* @deprecated Use `api.drops.getDeployReceipt()`. Removed in the next major.
|
|
789
893
|
*/
|
|
790
894
|
async getDeployContractReceipt(chain, txHash) {
|
|
791
|
-
return this.
|
|
895
|
+
return this.drops.getDeployReceipt(chain, txHash);
|
|
792
896
|
}
|
|
793
897
|
/**
|
|
794
898
|
* Build transactions to transfer NFTs or tokens between wallets.
|
|
899
|
+
* @deprecated Use `api.assets.transferAssets()`. Removed in the next major.
|
|
795
900
|
*/
|
|
796
901
|
async transferAssets(request) {
|
|
797
|
-
return this.
|
|
902
|
+
return this.assets.transferAssets(request);
|
|
798
903
|
}
|
|
799
904
|
/**
|
|
800
905
|
* Get portfolio stats (net worth, P&L) for an account.
|
|
906
|
+
* @deprecated Use `api.accounts.getPortfolioStats()`. Removed in the next major.
|
|
801
907
|
*/
|
|
802
908
|
async getPortfolioStats(address, args) {
|
|
803
|
-
return this.
|
|
909
|
+
return this.accounts.getPortfolioStats(address, args);
|
|
804
910
|
}
|
|
805
911
|
/**
|
|
806
912
|
* Get portfolio net-worth history for an account.
|
|
913
|
+
* @deprecated Use `api.accounts.getPortfolioHistory()`. Removed in the next major.
|
|
807
914
|
*/
|
|
808
915
|
async getPortfolioHistory(address, args) {
|
|
809
|
-
return this.
|
|
916
|
+
return this.accounts.getPortfolioHistory(address, args);
|
|
810
917
|
}
|
|
811
918
|
/**
|
|
812
919
|
* Get offers received by an account.
|
|
920
|
+
* @deprecated Use `api.accounts.getProfileOffersReceived()`. Removed in the next major.
|
|
813
921
|
*/
|
|
814
922
|
async getProfileOffersReceived(address, args) {
|
|
815
|
-
return this.
|
|
923
|
+
return this.accounts.getProfileOffersReceived(address, args);
|
|
816
924
|
}
|
|
817
925
|
/**
|
|
818
926
|
* Get active offers made by an account.
|
|
927
|
+
* @deprecated Use `api.accounts.getProfileOffers()`. Removed in the next major.
|
|
819
928
|
*/
|
|
820
929
|
async getProfileOffers(address, args) {
|
|
821
|
-
return this.
|
|
930
|
+
return this.accounts.getProfileOffers(address, args);
|
|
822
931
|
}
|
|
823
932
|
/**
|
|
824
933
|
* Get active listings for an account.
|
|
934
|
+
* @deprecated Use `api.accounts.getProfileListings()`. Removed in the next major.
|
|
825
935
|
*/
|
|
826
936
|
async getProfileListings(address, args) {
|
|
827
|
-
return this.
|
|
937
|
+
return this.accounts.getProfileListings(address, args);
|
|
828
938
|
}
|
|
829
939
|
/**
|
|
830
940
|
* Get items favorited by an account.
|
|
941
|
+
* @deprecated Use `api.accounts.getProfileFavorites()`. Removed in the next major.
|
|
831
942
|
*/
|
|
832
943
|
async getProfileFavorites(address, args) {
|
|
833
|
-
return this.
|
|
944
|
+
return this.accounts.getProfileFavorites(address, args);
|
|
834
945
|
}
|
|
835
946
|
/**
|
|
836
947
|
* Get collections owned by an account.
|
|
948
|
+
* @deprecated Use `api.accounts.getProfileCollections()`. Removed in the next major.
|
|
837
949
|
*/
|
|
838
950
|
async getProfileCollections(address, args) {
|
|
839
|
-
return this.
|
|
951
|
+
return this.accounts.getProfileCollections(address, args);
|
|
840
952
|
}
|
|
841
953
|
/**
|
|
842
954
|
* Get aggregated trading P&L (realized + unrealized) for an account.
|
|
955
|
+
* @deprecated Use `api.accounts.getWalletPnl()`. Removed in the next major.
|
|
843
956
|
*/
|
|
844
957
|
async getWalletPnl(address) {
|
|
845
|
-
return this.
|
|
958
|
+
return this.accounts.getWalletPnl(address);
|
|
846
959
|
}
|
|
847
960
|
/**
|
|
848
961
|
* Get closed (realized) trading positions for an account.
|
|
962
|
+
* @deprecated Use `api.accounts.getWalletClosedPositions()`. Removed in the next major.
|
|
849
963
|
*/
|
|
850
964
|
async getWalletClosedPositions(address, args) {
|
|
851
|
-
return this.
|
|
965
|
+
return this.accounts.getWalletClosedPositions(address, args);
|
|
852
966
|
}
|
|
853
967
|
/**
|
|
854
968
|
* Get the token transfers contributing to a wallet's position in a currency.
|
|
969
|
+
* @deprecated Use `api.accounts.getWalletTokenTransfers()`. Removed in the next major.
|
|
855
970
|
*/
|
|
856
971
|
async getWalletTokenTransfers(address, args) {
|
|
857
|
-
return this.
|
|
972
|
+
return this.accounts.getWalletTokenTransfers(address, args);
|
|
858
973
|
}
|
|
859
974
|
/**
|
|
860
975
|
* Generic fetch method for any API endpoint with automatic rate limit retry
|
|
@@ -984,7 +1099,11 @@ class OpenSeaAPI {
|
|
|
984
1099
|
throw new Error("Request aborted");
|
|
985
1100
|
}
|
|
986
1101
|
try {
|
|
987
|
-
|
|
1102
|
+
// .call(globalThis, ...) rather than a plain call: a caller can pass native fetch
|
|
1103
|
+
// unbound (`fetch: globalThis.fetch`), and browsers throw "Illegal invocation" when it
|
|
1104
|
+
// runs with anything but the global as its receiver. A bound function or an arrow
|
|
1105
|
+
// ignores the thisArg, so this does not clobber a deliberately bound transport.
|
|
1106
|
+
const response = await this.fetchImpl.call(globalThis, url, {
|
|
988
1107
|
method,
|
|
989
1108
|
headers: mergedHeaders,
|
|
990
1109
|
body: body != null ? JSON.stringify(body) : undefined,
|