@opensea/sdk 10.4.0 → 11.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.
- package/lib/api/accounts.d.ts +29 -1
- package/lib/api/accounts.js +72 -5
- package/lib/api/accounts.js.map +1 -1
- package/lib/api/api.d.ts +116 -9
- package/lib/api/api.js +186 -17
- package/lib/api/api.js.map +1 -1
- package/lib/api/apiPaths.d.ts +22 -0
- package/lib/api/apiPaths.js +97 -1
- package/lib/api/apiPaths.js.map +1 -1
- package/lib/api/assets.d.ts +18 -0
- package/lib/api/assets.js +26 -0
- package/lib/api/assets.js.map +1 -0
- package/lib/api/collections.d.ts +19 -1
- package/lib/api/collections.js +33 -15
- package/lib/api/collections.js.map +1 -1
- package/lib/api/drops.d.ts +12 -1
- package/lib/api/drops.js +14 -0
- package/lib/api/drops.js.map +1 -1
- package/lib/api/fetcher.d.ts +35 -5
- package/lib/api/listings.d.ts +8 -1
- package/lib/api/listings.js +12 -3
- package/lib/api/listings.js.map +1 -1
- package/lib/api/nfts.d.ts +15 -2
- package/lib/api/nfts.js +21 -5
- package/lib/api/nfts.js.map +1 -1
- package/lib/api/offers.d.ts +11 -0
- package/lib/api/offers.js +14 -11
- package/lib/api/offers.js.map +1 -1
- package/lib/api/orders.d.ts +16 -1
- package/lib/api/orders.js +17 -3
- package/lib/api/orders.js.map +1 -1
- package/lib/api/tokens.d.ts +22 -1
- package/lib/api/tokens.js +26 -0
- package/lib/api/tokens.js.map +1 -1
- package/lib/api/types.d.ts +296 -341
- package/lib/api/types.js +2 -1
- package/lib/api/types.js.map +1 -1
- package/lib/orders/types.d.ts +2 -2
- package/lib/orders/utils.d.ts +53 -13
- package/lib/orders/utils.js +33 -50
- package/lib/orders/utils.js.map +1 -1
- package/lib/sdk/base.d.ts +11 -4
- package/lib/sdk/base.js +4 -4
- package/lib/sdk/base.js.map +1 -1
- package/lib/sdk/cancellation.d.ts +3 -1
- package/lib/sdk/cancellation.js +12 -6
- package/lib/sdk/cancellation.js.map +1 -1
- package/lib/sdk/fulfillment.js +7 -4
- package/lib/sdk/fulfillment.js.map +1 -1
- package/lib/sdk/orders.js +1 -1
- package/lib/sdk/orders.js.map +1 -1
- package/lib/types.d.ts +22 -122
- package/lib/types.js.map +1 -1
- package/lib/utils/case.d.ts +63 -0
- package/lib/utils/case.js +83 -0
- package/lib/utils/case.js.map +1 -0
- package/lib/utils/utils.d.ts +0 -1
- package/lib/utils/utils.js +0 -1
- package/lib/utils/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/api/accounts.ts +141 -5
- package/src/api/api.ts +328 -23
- package/src/api/apiPaths.ts +112 -0
- package/src/api/assets.ts +22 -0
- package/src/api/collections.ts +71 -20
- package/src/api/drops.ts +34 -1
- package/src/api/fetcher.ts +41 -6
- package/src/api/listings.ts +21 -3
- package/src/api/nfts.ts +47 -7
- package/src/api/offers.ts +17 -10
- package/src/api/orders.ts +29 -5
- package/src/api/tokens.ts +65 -0
- package/src/api/types.ts +382 -354
- package/src/orders/types.ts +2 -2
- package/src/orders/utils.ts +57 -79
- package/src/sdk/base.ts +4 -4
- package/src/sdk/cancellation.ts +16 -6
- package/src/sdk/fulfillment.ts +7 -6
- package/src/sdk/orders.ts +1 -1
- package/src/types.ts +33 -120
- package/src/utils/case.ts +150 -0
- package/src/utils/utils.ts +0 -1
- package/lib/utils/converters.d.ts +0 -37
- package/lib/utils/converters.js +0 -137
- package/lib/utils/converters.js.map +0 -1
- package/src/utils/converters.ts +0 -145
package/src/api/types.ts
CHANGED
|
@@ -1,18 +1,46 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
BuildOfferResponse as ApiBuildOfferResponse,
|
|
3
|
+
CancelResponse as ApiCancelResponse,
|
|
4
|
+
Listing as ApiListing,
|
|
5
|
+
Nft as ApiNft,
|
|
6
|
+
Offer as ApiOffer,
|
|
7
|
+
Order as ApiOrder,
|
|
8
|
+
OrderAsset as ApiOrderAsset,
|
|
9
|
+
Payment as ApiPayment,
|
|
10
|
+
Price as ApiPrice,
|
|
2
11
|
SwapExecuteRequest as ApiSwapExecuteRequest,
|
|
3
12
|
SwapExecuteResponse as ApiSwapExecuteResponse,
|
|
13
|
+
SwapQuoteResponse as ApiSwapQuoteResponse,
|
|
4
14
|
SweepCollectionRequest as ApiSweepCollectionRequest,
|
|
5
15
|
SweepCollectionResponse as ApiSweepCollectionResponse,
|
|
16
|
+
Trait as ApiTrait,
|
|
6
17
|
TransactionReceiptRequest as ApiTransactionReceiptRequest,
|
|
7
18
|
TransactionReceiptResponse as ApiTransactionReceiptResponse,
|
|
8
19
|
AssetMetadataResponse,
|
|
20
|
+
ChainResponse,
|
|
21
|
+
DropDetailedResponse,
|
|
22
|
+
DropResponse,
|
|
23
|
+
DropStageResponse,
|
|
9
24
|
InstantApiKeyResponse,
|
|
25
|
+
ListingsResponse,
|
|
26
|
+
NftDetailed,
|
|
27
|
+
NftListResponse,
|
|
28
|
+
NftResponse,
|
|
29
|
+
OffersResponse,
|
|
30
|
+
TokenBalanceResponse,
|
|
10
31
|
TokenGroupPaginatedResponse,
|
|
11
32
|
TokenGroupResponse,
|
|
12
33
|
} from "@opensea/api-types"
|
|
13
|
-
import type { ConsiderationItem } from "@opensea/seaport-js/lib/types"
|
|
14
34
|
import type { OrderType, ProtocolData } from "../orders/types"
|
|
15
35
|
import type { OpenSeaCollection } from "../types"
|
|
36
|
+
import type { Camelize } from "../utils/case"
|
|
37
|
+
|
|
38
|
+
// The Order family. Sourced from @opensea/api-types and camelized for the
|
|
39
|
+
// SDK consumer view (the fetcher camelizes responses at the boundary; see
|
|
40
|
+
// utils/case.ts). Narrowing intersections preserve `OrderType`/`OrderStatus`
|
|
41
|
+
// enums and the seaport-js `OrderWithCounter` shape on `protocolData`.
|
|
42
|
+
export type OrderAsset = Camelize<ApiOrderAsset>
|
|
43
|
+
export type Price = Camelize<ApiPrice>
|
|
16
44
|
|
|
17
45
|
/**
|
|
18
46
|
* A single trait filter used by collection-scoped read endpoints (NFTs by
|
|
@@ -45,19 +73,16 @@ export function encodeTraitsParam(
|
|
|
45
73
|
}
|
|
46
74
|
|
|
47
75
|
/**
|
|
48
|
-
* Response from OpenSea API for building an offer.
|
|
76
|
+
* Response from OpenSea API for building an offer. Camelized from api-types
|
|
77
|
+
* `BuildOfferResponse` (the spec already ships camelCase keys here, so the
|
|
78
|
+
* camelize at the fetcher is a no-op).
|
|
49
79
|
* @category API Response Types
|
|
50
80
|
*/
|
|
51
|
-
export type BuildOfferResponse =
|
|
52
|
-
/** A portion of the parameters needed to submit a criteria offer, i.e. collection offer. */
|
|
53
|
-
partialParameters: PartialParameters
|
|
54
|
-
/** Criteria echoed back from the build request. Includes collection and trait info. */
|
|
55
|
-
criteria: BuildOfferCriteria
|
|
56
|
-
}
|
|
81
|
+
export type BuildOfferResponse = Camelize<ApiBuildOfferResponse>
|
|
57
82
|
|
|
58
83
|
/**
|
|
59
|
-
* Criteria returned by the build offer endpoint.
|
|
60
|
-
*
|
|
84
|
+
* Criteria returned by the build offer endpoint. Subset of the wire-format
|
|
85
|
+
* criteria — only collection and trait fields.
|
|
61
86
|
* @category API Response Types
|
|
62
87
|
*/
|
|
63
88
|
export type BuildOfferCriteria = {
|
|
@@ -66,31 +91,6 @@ export type BuildOfferCriteria = {
|
|
|
66
91
|
numericTraits?: NumericTraitCriteria[]
|
|
67
92
|
}
|
|
68
93
|
|
|
69
|
-
type PartialParameters = {
|
|
70
|
-
consideration: ConsiderationItem[]
|
|
71
|
-
zone: string
|
|
72
|
-
zoneHash: string
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Criteria for collection or trait offers.
|
|
77
|
-
* @category API Response Types
|
|
78
|
-
*/
|
|
79
|
-
type Criteria = {
|
|
80
|
-
/** The collection for the criteria */
|
|
81
|
-
collection: CollectionCriteria
|
|
82
|
-
/** The contract for the criteria */
|
|
83
|
-
contract: ContractCriteria
|
|
84
|
-
/** Represents a list of token ids which can be used to fulfill the criteria offer. */
|
|
85
|
-
encoded_token_ids?: string
|
|
86
|
-
/** The trait for the criteria (single trait) */
|
|
87
|
-
trait?: TraitCriteria
|
|
88
|
-
/** Multiple traits for the criteria (multi-trait offers) */
|
|
89
|
-
traits?: TraitCriteria[]
|
|
90
|
-
/** Numeric traits for the criteria (numeric trait offers) */
|
|
91
|
-
numericTraits?: NumericTraitCriteria[]
|
|
92
|
-
}
|
|
93
|
-
|
|
94
94
|
/**
|
|
95
95
|
* Criteria for trait offers.
|
|
96
96
|
* @category API Response Types
|
|
@@ -115,31 +115,25 @@ type CollectionCriteria = {
|
|
|
115
115
|
slug: string
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
type ContractCriteria = {
|
|
119
|
-
address: string
|
|
120
|
-
}
|
|
121
|
-
|
|
122
118
|
/**
|
|
123
119
|
* Query args for Get Collections
|
|
124
120
|
* @category API Query Args
|
|
125
121
|
*/
|
|
126
122
|
export interface GetCollectionsArgs {
|
|
127
|
-
|
|
123
|
+
orderBy?: string
|
|
128
124
|
limit?: number
|
|
129
125
|
next?: string
|
|
130
126
|
chain?: string
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
creatorUsername?: string
|
|
128
|
+
includeHidden?: boolean
|
|
133
129
|
}
|
|
134
130
|
|
|
135
131
|
/**
|
|
136
132
|
* Response from OpenSea API for fetching a single collection.
|
|
133
|
+
* Bare collection object (the response is not wrapped). See {@link OpenSeaCollection}.
|
|
137
134
|
* @category API Response Types
|
|
138
135
|
*/
|
|
139
|
-
export type GetCollectionResponse =
|
|
140
|
-
/** Collection object. See {@link OpenSeaCollection} */
|
|
141
|
-
collection: OpenSeaCollection
|
|
142
|
-
}
|
|
136
|
+
export type GetCollectionResponse = OpenSeaCollection
|
|
143
137
|
|
|
144
138
|
/**
|
|
145
139
|
* Response from OpenSea API for fetching a list of collections.
|
|
@@ -172,63 +166,46 @@ export enum OrderStatus {
|
|
|
172
166
|
}
|
|
173
167
|
|
|
174
168
|
/**
|
|
175
|
-
* Base Order
|
|
169
|
+
* Base Order shape — camelized from `@opensea/api-types`, with `protocolData`
|
|
170
|
+
* narrowed to the seaport-js `OrderWithCounter` type (a.k.a. {@link ProtocolData})
|
|
171
|
+
* since SDK callers pass this directly to Seaport.
|
|
176
172
|
* @category API Models
|
|
177
173
|
*/
|
|
178
|
-
export type Order = {
|
|
179
|
-
|
|
180
|
-
order_hash: string
|
|
181
|
-
/** Chain the offer exists on */
|
|
182
|
-
chain: string
|
|
183
|
-
/** The protocol data for the order. Only 'seaport' is currently supported. */
|
|
184
|
-
protocol_data: ProtocolData
|
|
185
|
-
/** The contract address of the protocol. */
|
|
186
|
-
protocol_address: string
|
|
187
|
-
/** The price of the order. */
|
|
188
|
-
price: Price
|
|
174
|
+
export type Order = Camelize<Omit<ApiOrder, "protocol_data">> & {
|
|
175
|
+
protocolData?: ProtocolData
|
|
189
176
|
}
|
|
190
177
|
|
|
191
178
|
/**
|
|
192
|
-
* Offer type.
|
|
179
|
+
* Offer type. Camelized from `@opensea/api-types`, with `protocolData` narrowed
|
|
180
|
+
* to seaport-js {@link ProtocolData} and `status` narrowed to the
|
|
181
|
+
* {@link OrderStatus} enum (the OpenAPI spec ships status as a string union).
|
|
193
182
|
* @category API Models
|
|
194
183
|
*/
|
|
195
|
-
export type Offer =
|
|
196
|
-
|
|
197
|
-
criteria?: Criteria
|
|
198
|
-
/** The status of the offer. */
|
|
184
|
+
export type Offer = Camelize<Omit<ApiOffer, "protocol_data" | "status">> & {
|
|
185
|
+
protocolData?: ProtocolData
|
|
199
186
|
status: OrderStatus
|
|
200
187
|
}
|
|
201
188
|
|
|
202
189
|
/**
|
|
203
|
-
* Collection Offer type.
|
|
204
|
-
* @category API Models
|
|
205
|
-
*/
|
|
206
|
-
export type CollectionOffer = Required<Pick<Offer, "criteria">> & Offer
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Price response.
|
|
190
|
+
* Collection Offer type — an {@link Offer} with `criteria` guaranteed present.
|
|
210
191
|
* @category API Models
|
|
211
192
|
*/
|
|
212
|
-
export type
|
|
213
|
-
|
|
214
|
-
decimals: number
|
|
215
|
-
value: string
|
|
193
|
+
export type CollectionOffer = Offer & {
|
|
194
|
+
criteria: NonNullable<Offer["criteria"]>
|
|
216
195
|
}
|
|
217
196
|
|
|
218
197
|
/**
|
|
219
|
-
* Listing order type.
|
|
198
|
+
* Listing order type. Camelized from `@opensea/api-types`, with `protocolData`
|
|
199
|
+
* narrowed to seaport-js {@link ProtocolData}, `type` narrowed to the
|
|
200
|
+
* {@link OrderType} enum, and `status` narrowed to the {@link OrderStatus}
|
|
201
|
+
* enum (the OpenAPI spec ships type and status as plain strings).
|
|
220
202
|
* @category API Models
|
|
221
203
|
*/
|
|
222
|
-
export type Listing =
|
|
223
|
-
|
|
204
|
+
export type Listing = Camelize<
|
|
205
|
+
Omit<ApiListing, "protocol_data" | "type" | "status">
|
|
206
|
+
> & {
|
|
207
|
+
protocolData?: ProtocolData
|
|
224
208
|
type: OrderType
|
|
225
|
-
/** The price of the listing with current price nested. */
|
|
226
|
-
price: {
|
|
227
|
-
current: Price
|
|
228
|
-
}
|
|
229
|
-
/** The remaining quantity available for the listing. This is important for partially filled orders. */
|
|
230
|
-
remaining_quantity: number
|
|
231
|
-
/** The status of the listing. */
|
|
232
209
|
status: OrderStatus
|
|
233
210
|
}
|
|
234
211
|
|
|
@@ -254,12 +231,10 @@ export type ListNFTsResponse = {
|
|
|
254
231
|
|
|
255
232
|
/**
|
|
256
233
|
* Response from OpenSea API for fetching a single NFT.
|
|
234
|
+
* Camelized from api-types `NftResponse`.
|
|
257
235
|
* @category API Response Types
|
|
258
236
|
*/
|
|
259
|
-
export type GetNFTResponse =
|
|
260
|
-
/** See {@link NFT} */
|
|
261
|
-
nft: NFT
|
|
262
|
-
}
|
|
237
|
+
export type GetNFTResponse = Camelize<NftResponse>
|
|
263
238
|
|
|
264
239
|
/**
|
|
265
240
|
* Base query cursors response from OpenSea API.
|
|
@@ -306,118 +281,63 @@ export type GetOrderByHashResponse = Offer | Listing
|
|
|
306
281
|
|
|
307
282
|
/**
|
|
308
283
|
* Response from OpenSea API for offchain canceling an order.
|
|
284
|
+
* Camelized from api-types `CancelResponse`.
|
|
309
285
|
* @category API Response Types
|
|
310
286
|
*/
|
|
311
|
-
export type CancelOrderResponse =
|
|
312
|
-
last_signature_issued_valid_until: string | null
|
|
313
|
-
}
|
|
287
|
+
export type CancelOrderResponse = Camelize<ApiCancelResponse>
|
|
314
288
|
|
|
315
289
|
/**
|
|
316
290
|
* Request body for sweeping (bulk-buying) items from a collection.
|
|
317
291
|
* @category API Query Args
|
|
318
292
|
*/
|
|
319
|
-
export type SweepCollectionRequest = ApiSweepCollectionRequest
|
|
293
|
+
export type SweepCollectionRequest = Camelize<ApiSweepCollectionRequest>
|
|
320
294
|
|
|
321
295
|
/**
|
|
322
296
|
* Response from sweeping a collection.
|
|
323
297
|
* @category API Response Types
|
|
324
298
|
*/
|
|
325
|
-
export type SweepCollectionResponse = ApiSweepCollectionResponse
|
|
299
|
+
export type SweepCollectionResponse = Camelize<ApiSweepCollectionResponse>
|
|
326
300
|
|
|
327
301
|
/**
|
|
328
302
|
* Request body for executing a token swap.
|
|
329
303
|
* @category API Query Args
|
|
330
304
|
*/
|
|
331
|
-
export type SwapExecuteRequest = ApiSwapExecuteRequest
|
|
305
|
+
export type SwapExecuteRequest = Camelize<ApiSwapExecuteRequest>
|
|
332
306
|
|
|
333
307
|
/**
|
|
334
308
|
* Response from executing a token swap.
|
|
335
309
|
* @category API Response Types
|
|
336
310
|
*/
|
|
337
|
-
export type SwapExecuteResponse = ApiSwapExecuteResponse
|
|
311
|
+
export type SwapExecuteResponse = Camelize<ApiSwapExecuteResponse>
|
|
338
312
|
|
|
339
313
|
/**
|
|
340
314
|
* Request body for fetching a transaction receipt.
|
|
341
315
|
* @category API Query Args
|
|
342
316
|
*/
|
|
343
|
-
export type TransactionReceiptRequest = ApiTransactionReceiptRequest
|
|
317
|
+
export type TransactionReceiptRequest = Camelize<ApiTransactionReceiptRequest>
|
|
344
318
|
|
|
345
319
|
/**
|
|
346
320
|
* Response from fetching a transaction receipt.
|
|
347
321
|
* @category API Response Types
|
|
348
322
|
*/
|
|
349
|
-
export type TransactionReceiptResponse = ApiTransactionReceiptResponse
|
|
323
|
+
export type TransactionReceiptResponse = Camelize<ApiTransactionReceiptResponse>
|
|
350
324
|
|
|
351
325
|
/**
|
|
352
|
-
* NFT type returned by OpenSea API.
|
|
326
|
+
* NFT type returned by OpenSea API. Sourced from api-types `NftDetailed`.
|
|
353
327
|
* @category API Models
|
|
354
328
|
*/
|
|
355
|
-
export type NFT =
|
|
356
|
-
/** NFT Identifier (also commonly referred to as tokenId) */
|
|
357
|
-
identifier: string
|
|
358
|
-
/** Slug identifier of collection */
|
|
359
|
-
collection: string
|
|
360
|
-
/** Address of contract */
|
|
361
|
-
contract: string
|
|
362
|
-
/** Token standard, i.e. ERC721, ERC1155, etc. */
|
|
363
|
-
token_standard: string
|
|
364
|
-
/** Name of NFT */
|
|
365
|
-
name: string
|
|
366
|
-
/** Description of NFT */
|
|
367
|
-
description: string
|
|
368
|
-
/** URL of image */
|
|
369
|
-
image_url: string
|
|
370
|
-
/** URL of metadata */
|
|
371
|
-
metadata_url: string
|
|
372
|
-
/** URL on OpenSea */
|
|
373
|
-
opensea_url: string
|
|
374
|
-
/** Date of latest NFT update */
|
|
375
|
-
updated_at: string
|
|
376
|
-
/** Whether NFT is disabled for trading on OpenSea */
|
|
377
|
-
is_disabled: boolean
|
|
378
|
-
/** Whether NFT is NSFW (Not Safe For Work) */
|
|
379
|
-
is_nsfw: boolean
|
|
380
|
-
/** Traits for the NFT, returns null if the NFT has than 50 traits */
|
|
381
|
-
traits: Trait[] | null
|
|
382
|
-
/** Creator of the NFT */
|
|
383
|
-
creator: string
|
|
384
|
-
/** Owners of the NFT */
|
|
385
|
-
owners: {
|
|
386
|
-
address: string
|
|
387
|
-
quantity: number
|
|
388
|
-
}[]
|
|
389
|
-
/** Rarity of the NFT */
|
|
390
|
-
rarity: null | {
|
|
391
|
-
strategy_id: string | null
|
|
392
|
-
strategy_version: string | null
|
|
393
|
-
rank: number | null
|
|
394
|
-
score: number | null
|
|
395
|
-
calculated_at: string
|
|
396
|
-
max_rank: number | null
|
|
397
|
-
tokens_scored: number | null
|
|
398
|
-
ranking_features: null | {
|
|
399
|
-
unique_attribute_count: number
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
329
|
+
export type NFT = Camelize<NftDetailed>
|
|
403
330
|
|
|
404
331
|
/**
|
|
405
|
-
* Trait type returned by OpenSea API.
|
|
332
|
+
* Trait type returned by OpenSea API. Sourced from api-types `Trait`.
|
|
333
|
+
* For numeric traits, `value` arrives as a string — callers parse as needed.
|
|
406
334
|
* @category API Models
|
|
407
335
|
*/
|
|
408
|
-
export type Trait =
|
|
409
|
-
/** The name of the trait category (e.g. 'Background') */
|
|
410
|
-
trait_type: string
|
|
411
|
-
/** A field indicating how to display. None is used for string traits. */
|
|
412
|
-
display_type: TraitDisplayType
|
|
413
|
-
/** Ceiling for possible numeric trait values */
|
|
414
|
-
max_value: string
|
|
415
|
-
/** The value of the trait (e.g. 'Red') */
|
|
416
|
-
value: string | number | Date
|
|
417
|
-
}
|
|
336
|
+
export type Trait = Camelize<ApiTrait>
|
|
418
337
|
|
|
419
338
|
/**
|
|
420
|
-
* Trait display type returned by OpenSea API.
|
|
339
|
+
* Trait display type returned by OpenSea API. Kept as an enum value for
|
|
340
|
+
* convenience; api-types models the wire field as a plain string.
|
|
421
341
|
* @category API Models
|
|
422
342
|
*/
|
|
423
343
|
export enum TraitDisplayType {
|
|
@@ -457,40 +377,16 @@ export enum OrderEventType {
|
|
|
457
377
|
}
|
|
458
378
|
|
|
459
379
|
/**
|
|
460
|
-
* Payment information for an event.
|
|
380
|
+
* Payment information for an event. Camelized from api-types `Payment`.
|
|
461
381
|
* @category API Models
|
|
462
382
|
*/
|
|
463
|
-
export type EventPayment =
|
|
464
|
-
/** Quantity of the payment token */
|
|
465
|
-
quantity: string
|
|
466
|
-
/** Address of the payment token (0x0...0 for ETH) */
|
|
467
|
-
token_address: string
|
|
468
|
-
/** Decimals of the payment token */
|
|
469
|
-
decimals: number
|
|
470
|
-
/** Symbol of the payment token */
|
|
471
|
-
symbol: string
|
|
472
|
-
}
|
|
383
|
+
export type EventPayment = Camelize<ApiPayment>
|
|
473
384
|
|
|
474
385
|
/**
|
|
475
|
-
* Asset information in an event.
|
|
386
|
+
* Asset information in an event. Camelized from api-types `Nft`.
|
|
476
387
|
* @category API Models
|
|
477
388
|
*/
|
|
478
|
-
export type EventAsset =
|
|
479
|
-
identifier: string
|
|
480
|
-
collection: string
|
|
481
|
-
contract: string
|
|
482
|
-
token_standard: string
|
|
483
|
-
name: string
|
|
484
|
-
description: string
|
|
485
|
-
image_url: string
|
|
486
|
-
display_image_url: string
|
|
487
|
-
display_animation_url: string | null
|
|
488
|
-
metadata_url: string
|
|
489
|
-
opensea_url: string
|
|
490
|
-
updated_at: string
|
|
491
|
-
is_disabled: boolean
|
|
492
|
-
is_nsfw: boolean
|
|
493
|
-
}
|
|
389
|
+
export type EventAsset = Camelize<ApiNft>
|
|
494
390
|
|
|
495
391
|
/**
|
|
496
392
|
* Base event type.
|
|
@@ -498,9 +394,9 @@ export type EventAsset = {
|
|
|
498
394
|
*/
|
|
499
395
|
type BaseEvent = {
|
|
500
396
|
/** Type of the event */
|
|
501
|
-
|
|
397
|
+
eventType: AssetEventType | string
|
|
502
398
|
/** Timestamp of the event */
|
|
503
|
-
|
|
399
|
+
eventTimestamp: number
|
|
504
400
|
/** Chain the event occurred on */
|
|
505
401
|
chain: string
|
|
506
402
|
/** Quantity involved in the event */
|
|
@@ -512,13 +408,13 @@ type BaseEvent = {
|
|
|
512
408
|
* @category API Models
|
|
513
409
|
*/
|
|
514
410
|
export type ListingEvent = BaseEvent & {
|
|
515
|
-
|
|
411
|
+
eventType: AssetEventType.LISTING | "listing"
|
|
516
412
|
/** Payment information */
|
|
517
413
|
payment: EventPayment
|
|
518
414
|
/** Start date of the listing */
|
|
519
|
-
|
|
415
|
+
startDate: number | null
|
|
520
416
|
/** Expiration date of the listing */
|
|
521
|
-
|
|
417
|
+
expirationDate: number
|
|
522
418
|
/** Asset involved in the listing */
|
|
523
419
|
asset: EventAsset
|
|
524
420
|
/** Maker of the listing */
|
|
@@ -526,11 +422,11 @@ export type ListingEvent = BaseEvent & {
|
|
|
526
422
|
/** Taker of the listing */
|
|
527
423
|
taker: string
|
|
528
424
|
/** Whether the listing is private */
|
|
529
|
-
|
|
425
|
+
isPrivateListing: boolean
|
|
530
426
|
/** Order hash (optional) */
|
|
531
|
-
|
|
427
|
+
orderHash?: string
|
|
532
428
|
/** Protocol address (optional) */
|
|
533
|
-
|
|
429
|
+
protocolAddress?: string
|
|
534
430
|
}
|
|
535
431
|
|
|
536
432
|
/**
|
|
@@ -538,13 +434,13 @@ export type ListingEvent = BaseEvent & {
|
|
|
538
434
|
* @category API Models
|
|
539
435
|
*/
|
|
540
436
|
export type OfferEvent = BaseEvent & {
|
|
541
|
-
|
|
437
|
+
eventType: AssetEventType.OFFER | "offer"
|
|
542
438
|
/** Payment information */
|
|
543
439
|
payment: EventPayment
|
|
544
440
|
/** Start date of the offer */
|
|
545
|
-
|
|
441
|
+
startDate: number | null
|
|
546
442
|
/** Expiration date of the offer */
|
|
547
|
-
|
|
443
|
+
expirationDate: number
|
|
548
444
|
/** Asset involved in the offer */
|
|
549
445
|
asset: EventAsset
|
|
550
446
|
/** Maker of the offer */
|
|
@@ -552,9 +448,9 @@ export type OfferEvent = BaseEvent & {
|
|
|
552
448
|
/** Taker of the offer */
|
|
553
449
|
taker: string
|
|
554
450
|
/** Order hash (optional) */
|
|
555
|
-
|
|
451
|
+
orderHash?: string
|
|
556
452
|
/** Protocol address (optional) */
|
|
557
|
-
|
|
453
|
+
protocolAddress?: string
|
|
558
454
|
}
|
|
559
455
|
|
|
560
456
|
/**
|
|
@@ -562,13 +458,13 @@ export type OfferEvent = BaseEvent & {
|
|
|
562
458
|
* @category API Models
|
|
563
459
|
*/
|
|
564
460
|
export type TraitOfferEvent = BaseEvent & {
|
|
565
|
-
|
|
461
|
+
eventType: AssetEventType.TRAIT_OFFER | "trait_offer"
|
|
566
462
|
/** Payment information */
|
|
567
463
|
payment: EventPayment
|
|
568
464
|
/** Start date of the offer */
|
|
569
|
-
|
|
465
|
+
startDate: number | null
|
|
570
466
|
/** Expiration date of the offer */
|
|
571
|
-
|
|
467
|
+
expirationDate: number
|
|
572
468
|
/** Criteria for trait offers */
|
|
573
469
|
criteria: Record<string, unknown>
|
|
574
470
|
/** Maker of the offer */
|
|
@@ -576,9 +472,9 @@ export type TraitOfferEvent = BaseEvent & {
|
|
|
576
472
|
/** Taker of the offer */
|
|
577
473
|
taker: string
|
|
578
474
|
/** Order hash (optional) */
|
|
579
|
-
|
|
475
|
+
orderHash?: string
|
|
580
476
|
/** Protocol address (optional) */
|
|
581
|
-
|
|
477
|
+
protocolAddress?: string
|
|
582
478
|
}
|
|
583
479
|
|
|
584
480
|
/**
|
|
@@ -586,13 +482,13 @@ export type TraitOfferEvent = BaseEvent & {
|
|
|
586
482
|
* @category API Models
|
|
587
483
|
*/
|
|
588
484
|
export type CollectionOfferEvent = BaseEvent & {
|
|
589
|
-
|
|
485
|
+
eventType: AssetEventType.COLLECTION_OFFER | "collection_offer"
|
|
590
486
|
/** Payment information */
|
|
591
487
|
payment: EventPayment
|
|
592
488
|
/** Start date of the offer */
|
|
593
|
-
|
|
489
|
+
startDate: number | null
|
|
594
490
|
/** Expiration date of the offer */
|
|
595
|
-
|
|
491
|
+
expirationDate: number
|
|
596
492
|
/** Criteria for collection offers */
|
|
597
493
|
criteria: Record<string, unknown>
|
|
598
494
|
/** Maker of the offer */
|
|
@@ -600,9 +496,9 @@ export type CollectionOfferEvent = BaseEvent & {
|
|
|
600
496
|
/** Taker of the offer */
|
|
601
497
|
taker: string
|
|
602
498
|
/** Order hash (optional) */
|
|
603
|
-
|
|
499
|
+
orderHash?: string
|
|
604
500
|
/** Protocol address (optional) */
|
|
605
|
-
|
|
501
|
+
protocolAddress?: string
|
|
606
502
|
}
|
|
607
503
|
|
|
608
504
|
/**
|
|
@@ -611,13 +507,13 @@ export type CollectionOfferEvent = BaseEvent & {
|
|
|
611
507
|
* @category API Models
|
|
612
508
|
*/
|
|
613
509
|
export type OrderEvent = BaseEvent & {
|
|
614
|
-
|
|
510
|
+
eventType: AssetEventType.ORDER | "order"
|
|
615
511
|
/** Payment information */
|
|
616
512
|
payment: EventPayment
|
|
617
513
|
/** Start date of the order */
|
|
618
|
-
|
|
514
|
+
startDate: number | null
|
|
619
515
|
/** Expiration date of the order */
|
|
620
|
-
|
|
516
|
+
expirationDate: number
|
|
621
517
|
/** Asset involved in the order (optional, not present for collection/trait offers) */
|
|
622
518
|
asset?: EventAsset
|
|
623
519
|
/** Criteria for collection/trait offers (optional) */
|
|
@@ -627,11 +523,11 @@ export type OrderEvent = BaseEvent & {
|
|
|
627
523
|
/** Taker of the order */
|
|
628
524
|
taker: string
|
|
629
525
|
/** Order hash (optional) */
|
|
630
|
-
|
|
526
|
+
orderHash?: string
|
|
631
527
|
/** Protocol address (optional) */
|
|
632
|
-
|
|
528
|
+
protocolAddress?: string
|
|
633
529
|
/** Order type providing more detail */
|
|
634
|
-
|
|
530
|
+
orderType?: OrderEventType
|
|
635
531
|
}
|
|
636
532
|
|
|
637
533
|
/**
|
|
@@ -639,11 +535,11 @@ export type OrderEvent = BaseEvent & {
|
|
|
639
535
|
* @category API Models
|
|
640
536
|
*/
|
|
641
537
|
export type MintEvent = BaseEvent & {
|
|
642
|
-
|
|
538
|
+
eventType: AssetEventType.MINT | "mint"
|
|
643
539
|
/** Transaction hash */
|
|
644
540
|
transaction: string
|
|
645
541
|
/** Address the NFT was minted to */
|
|
646
|
-
|
|
542
|
+
toAddress: string
|
|
647
543
|
/** NFT that was minted */
|
|
648
544
|
nft: EventAsset
|
|
649
545
|
}
|
|
@@ -653,17 +549,17 @@ export type MintEvent = BaseEvent & {
|
|
|
653
549
|
* @category API Models
|
|
654
550
|
*/
|
|
655
551
|
export type SaleEvent = BaseEvent & {
|
|
656
|
-
|
|
552
|
+
eventType: AssetEventType.SALE | "sale"
|
|
657
553
|
/** Transaction hash */
|
|
658
554
|
transaction: string
|
|
659
555
|
/** Order hash */
|
|
660
|
-
|
|
556
|
+
orderHash: string
|
|
661
557
|
/** Protocol address */
|
|
662
|
-
|
|
558
|
+
protocolAddress: string
|
|
663
559
|
/** Payment information */
|
|
664
560
|
payment: EventPayment
|
|
665
561
|
/** Closing date of the sale */
|
|
666
|
-
|
|
562
|
+
closingDate: number
|
|
667
563
|
/** Seller address */
|
|
668
564
|
seller: string
|
|
669
565
|
/** Buyer address */
|
|
@@ -677,13 +573,13 @@ export type SaleEvent = BaseEvent & {
|
|
|
677
573
|
* @category API Models
|
|
678
574
|
*/
|
|
679
575
|
export type TransferEvent = BaseEvent & {
|
|
680
|
-
|
|
576
|
+
eventType: AssetEventType.TRANSFER | "transfer"
|
|
681
577
|
/** Transaction hash */
|
|
682
578
|
transaction: string
|
|
683
579
|
/** Address the NFT was transferred from */
|
|
684
|
-
|
|
580
|
+
fromAddress: string
|
|
685
581
|
/** Address the NFT was transferred to */
|
|
686
|
-
|
|
582
|
+
toAddress: string
|
|
687
583
|
/** NFT involved in the transfer */
|
|
688
584
|
nft: EventAsset
|
|
689
585
|
}
|
|
@@ -712,7 +608,7 @@ export type AssetEvent =
|
|
|
712
608
|
*/
|
|
713
609
|
export interface GetEventsArgs {
|
|
714
610
|
/** Type of event to filter by */
|
|
715
|
-
|
|
611
|
+
eventType?: AssetEventType | string
|
|
716
612
|
/** Filter events after this timestamp */
|
|
717
613
|
after?: number
|
|
718
614
|
/** Filter events before this timestamp */
|
|
@@ -743,7 +639,7 @@ export interface GetEventsByCollectionArgs extends GetEventsArgs {
|
|
|
743
639
|
*/
|
|
744
640
|
export type GetEventsResponse = QueryCursorsV2 & {
|
|
745
641
|
/** List of {@link AssetEvent} */
|
|
746
|
-
|
|
642
|
+
assetEvents: AssetEvent[]
|
|
747
643
|
}
|
|
748
644
|
|
|
749
645
|
/**
|
|
@@ -755,12 +651,17 @@ export type Contract = {
|
|
|
755
651
|
address: string
|
|
756
652
|
/** Chain the contract is deployed on */
|
|
757
653
|
chain: string
|
|
758
|
-
/**
|
|
654
|
+
/**
|
|
655
|
+
* Associated collection slug. `null` for contracts without an associated
|
|
656
|
+
* collection on OpenSea. TODO(api-types): the OpenAPI spec marks this as
|
|
657
|
+
* required non-null, but the live API returns null for standalone contracts —
|
|
658
|
+
* swap to `Camelize<ContractResponse>` once the spec is updated.
|
|
659
|
+
*/
|
|
759
660
|
collection: string | null
|
|
760
661
|
/** Contract name */
|
|
761
662
|
name: string
|
|
762
663
|
/** Contract standard (e.g., erc721, erc1155) */
|
|
763
|
-
|
|
664
|
+
contractStandard: string
|
|
764
665
|
}
|
|
765
666
|
|
|
766
667
|
/**
|
|
@@ -800,6 +701,11 @@ export type GetTraitsResponse = {
|
|
|
800
701
|
|
|
801
702
|
/**
|
|
802
703
|
* Token model returned by OpenSea API.
|
|
704
|
+
*
|
|
705
|
+
* TODO(api-types): swap to `Camelize<TokenResponse>` once the OpenAPI spec
|
|
706
|
+
* marks `image_url` as nullable (the live API returns `null` for tokens
|
|
707
|
+
* without an image). Currently the spec models it as optional non-null.
|
|
708
|
+
*
|
|
803
709
|
* @category API Models
|
|
804
710
|
*/
|
|
805
711
|
export type Token = {
|
|
@@ -813,10 +719,10 @@ export type Token = {
|
|
|
813
719
|
symbol: string
|
|
814
720
|
/** Number of decimals */
|
|
815
721
|
decimals: number
|
|
816
|
-
/** URL of the token image */
|
|
817
|
-
|
|
722
|
+
/** URL of the token image (null when the token has no image) */
|
|
723
|
+
imageUrl: string | null
|
|
818
724
|
/** URL on OpenSea */
|
|
819
|
-
|
|
725
|
+
openseaUrl: string
|
|
820
726
|
}
|
|
821
727
|
|
|
822
728
|
/**
|
|
@@ -854,26 +760,25 @@ export interface GetTokensArgs {
|
|
|
854
760
|
*/
|
|
855
761
|
export interface GetSwapQuoteArgs {
|
|
856
762
|
/** Address of the input token */
|
|
857
|
-
|
|
763
|
+
tokenIn: string
|
|
858
764
|
/** Address of the output token */
|
|
859
|
-
|
|
765
|
+
tokenOut: string
|
|
860
766
|
/** Amount of input token */
|
|
861
767
|
amount: string
|
|
862
768
|
/** Chain for the swap */
|
|
863
769
|
chain: string
|
|
864
770
|
/** Address of the taker */
|
|
865
|
-
|
|
771
|
+
takerAddress?: string
|
|
866
772
|
/** Slippage tolerance */
|
|
867
773
|
slippage?: number
|
|
868
774
|
}
|
|
869
775
|
|
|
870
776
|
/**
|
|
871
777
|
* Response from OpenSea API for fetching a swap quote.
|
|
778
|
+
* Camelized from api-types `SwapQuoteResponse`.
|
|
872
779
|
* @category API Response Types
|
|
873
780
|
*/
|
|
874
|
-
export type GetSwapQuoteResponse =
|
|
875
|
-
[key: string]: unknown
|
|
876
|
-
}
|
|
781
|
+
export type GetSwapQuoteResponse = Camelize<ApiSwapQuoteResponse>
|
|
877
782
|
|
|
878
783
|
/**
|
|
879
784
|
* Response from OpenSea API for fetching token details.
|
|
@@ -885,13 +790,13 @@ export type GetTokenResponse = Token
|
|
|
885
790
|
* Response from OpenSea API for fetching a token group by slug.
|
|
886
791
|
* @category API Response Types
|
|
887
792
|
*/
|
|
888
|
-
export type GetTokenGroupResponse = TokenGroupResponse
|
|
793
|
+
export type GetTokenGroupResponse = Camelize<TokenGroupResponse>
|
|
889
794
|
|
|
890
795
|
/**
|
|
891
796
|
* Response from OpenSea API for fetching a paginated list of token groups.
|
|
892
797
|
* @category API Response Types
|
|
893
798
|
*/
|
|
894
|
-
export type GetTokenGroupsResponse = TokenGroupPaginatedResponse
|
|
799
|
+
export type GetTokenGroupsResponse = Camelize<TokenGroupPaginatedResponse>
|
|
895
800
|
|
|
896
801
|
/**
|
|
897
802
|
* Query args for the Get Token Groups endpoint.
|
|
@@ -908,7 +813,7 @@ export interface GetTokenGroupsArgs {
|
|
|
908
813
|
* Response from OpenSea API for requesting an instant API key.
|
|
909
814
|
* @category API Response Types
|
|
910
815
|
*/
|
|
911
|
-
export type RequestInstantApiKeyResponse = InstantApiKeyResponse
|
|
816
|
+
export type RequestInstantApiKeyResponse = Camelize<InstantApiKeyResponse>
|
|
912
817
|
|
|
913
818
|
/**
|
|
914
819
|
* Query args for the Search endpoint.
|
|
@@ -920,7 +825,7 @@ export interface SearchArgs {
|
|
|
920
825
|
/** Filter by blockchain(s) */
|
|
921
826
|
chains?: string[]
|
|
922
827
|
/** Filter by asset type(s): collection, nft, token, account */
|
|
923
|
-
|
|
828
|
+
assetTypes?: string[]
|
|
924
829
|
/** Number of results to return (default: 20, max: 50) */
|
|
925
830
|
limit?: number
|
|
926
831
|
}
|
|
@@ -935,13 +840,13 @@ export type CollectionSearchResult = {
|
|
|
935
840
|
/** The collection name */
|
|
936
841
|
name: string
|
|
937
842
|
/** URL of the collection image */
|
|
938
|
-
|
|
843
|
+
imageUrl: string | null
|
|
939
844
|
/** Whether trading is disabled for this collection */
|
|
940
|
-
|
|
845
|
+
isDisabled: boolean
|
|
941
846
|
/** Whether this collection is marked as NSFW */
|
|
942
|
-
|
|
847
|
+
isNsfw: boolean
|
|
943
848
|
/** URL to the collection on OpenSea */
|
|
944
|
-
|
|
849
|
+
openseaUrl: string
|
|
945
850
|
}
|
|
946
851
|
|
|
947
852
|
/**
|
|
@@ -958,13 +863,13 @@ export type TokenSearchResult = {
|
|
|
958
863
|
/** Token symbol */
|
|
959
864
|
symbol: string
|
|
960
865
|
/** URL of the token image */
|
|
961
|
-
|
|
866
|
+
imageUrl: string | null
|
|
962
867
|
/** Current USD price of the token */
|
|
963
|
-
|
|
868
|
+
usdPrice: string
|
|
964
869
|
/** Number of decimal places for the token */
|
|
965
870
|
decimals: number
|
|
966
871
|
/** URL to the token on OpenSea */
|
|
967
|
-
|
|
872
|
+
openseaUrl: string
|
|
968
873
|
}
|
|
969
874
|
|
|
970
875
|
/**
|
|
@@ -981,9 +886,9 @@ export type NftSearchResult = {
|
|
|
981
886
|
/** Name of the NFT */
|
|
982
887
|
name: string | null
|
|
983
888
|
/** URL of the NFT image */
|
|
984
|
-
|
|
889
|
+
imageUrl: string | null
|
|
985
890
|
/** URL to the NFT on OpenSea */
|
|
986
|
-
|
|
891
|
+
openseaUrl: string
|
|
987
892
|
}
|
|
988
893
|
|
|
989
894
|
/**
|
|
@@ -996,9 +901,9 @@ export type AccountSearchResult = {
|
|
|
996
901
|
/** Username of the account */
|
|
997
902
|
username: string | null
|
|
998
903
|
/** URL of the account's profile image */
|
|
999
|
-
|
|
904
|
+
profileImageUrl: string | null
|
|
1000
905
|
/** URL to the account on OpenSea */
|
|
1001
|
-
|
|
906
|
+
openseaUrl: string
|
|
1002
907
|
}
|
|
1003
908
|
|
|
1004
909
|
/**
|
|
@@ -1028,23 +933,11 @@ export type SearchResponse = {
|
|
|
1028
933
|
}
|
|
1029
934
|
|
|
1030
935
|
/**
|
|
1031
|
-
* Information about a supported blockchain.
|
|
936
|
+
* Information about a supported blockchain. Sourced from `@opensea/api-types`
|
|
937
|
+
* (the SDK previously hand-rolled this with the same shape).
|
|
1032
938
|
* @category API Models
|
|
1033
939
|
*/
|
|
1034
|
-
export type ChainInfo =
|
|
1035
|
-
/** The chain identifier slug used in API paths */
|
|
1036
|
-
chain: string
|
|
1037
|
-
/** Human-readable chain name */
|
|
1038
|
-
name: string
|
|
1039
|
-
/** Native currency symbol */
|
|
1040
|
-
symbol: string
|
|
1041
|
-
/** Whether token swaps are supported on this chain */
|
|
1042
|
-
supports_swaps: boolean
|
|
1043
|
-
/** Block explorer name */
|
|
1044
|
-
block_explorer: string
|
|
1045
|
-
/** Block explorer base URL */
|
|
1046
|
-
block_explorer_url: string
|
|
1047
|
-
}
|
|
940
|
+
export type ChainInfo = Camelize<ChainResponse>
|
|
1048
941
|
|
|
1049
942
|
/**
|
|
1050
943
|
* Response from OpenSea API for listing supported chains.
|
|
@@ -1056,31 +949,12 @@ export type GetChainsResponse = {
|
|
|
1056
949
|
}
|
|
1057
950
|
|
|
1058
951
|
/**
|
|
1059
|
-
* Token balance for a wallet address.
|
|
952
|
+
* Token balance for a wallet address. Sourced from `@opensea/api-types`
|
|
953
|
+
* (`TokenBalanceResponse`). Gains optional `status`, `base_token_liquidity_usd`,
|
|
954
|
+
* and `quote_token_liquidity_usd` fields the hand-rolled version didn't expose.
|
|
1060
955
|
* @category API Models
|
|
1061
956
|
*/
|
|
1062
|
-
export type TokenBalance =
|
|
1063
|
-
/** Token contract address */
|
|
1064
|
-
address: string
|
|
1065
|
-
/** Chain the token is on */
|
|
1066
|
-
chain: string
|
|
1067
|
-
/** Token name */
|
|
1068
|
-
name: string
|
|
1069
|
-
/** Token symbol */
|
|
1070
|
-
symbol: string
|
|
1071
|
-
/** URL of the token image */
|
|
1072
|
-
image_url?: string
|
|
1073
|
-
/** Current price in USD */
|
|
1074
|
-
usd_price: string
|
|
1075
|
-
/** Number of decimals */
|
|
1076
|
-
decimals: number
|
|
1077
|
-
/** Token balance in display units */
|
|
1078
|
-
quantity: string
|
|
1079
|
-
/** Total USD value of the balance */
|
|
1080
|
-
usd_value: string
|
|
1081
|
-
/** URL to the token page on OpenSea */
|
|
1082
|
-
opensea_url: string
|
|
1083
|
-
}
|
|
957
|
+
export type TokenBalance = Camelize<TokenBalanceResponse>
|
|
1084
958
|
|
|
1085
959
|
/**
|
|
1086
960
|
* Query args for Get Account Tokens endpoint.
|
|
@@ -1092,11 +966,11 @@ export interface GetAccountTokensArgs {
|
|
|
1092
966
|
/** Comma-separated chain identifiers to filter by */
|
|
1093
967
|
chains?: string[]
|
|
1094
968
|
/** Field to sort by */
|
|
1095
|
-
|
|
969
|
+
sortBy?: string
|
|
1096
970
|
/** Sort direction */
|
|
1097
|
-
|
|
971
|
+
sortDirection?: "asc" | "desc"
|
|
1098
972
|
/** Whether to disable spam filtering */
|
|
1099
|
-
|
|
973
|
+
disableSpamFiltering?: boolean
|
|
1100
974
|
/** Cursor for pagination */
|
|
1101
975
|
cursor?: string
|
|
1102
976
|
}
|
|
@@ -1107,67 +981,27 @@ export interface GetAccountTokensArgs {
|
|
|
1107
981
|
*/
|
|
1108
982
|
export type GetAccountTokensResponse = QueryCursorsV2 & {
|
|
1109
983
|
/** List of token balances */
|
|
1110
|
-
|
|
984
|
+
tokenBalances: TokenBalance[]
|
|
1111
985
|
}
|
|
1112
986
|
|
|
1113
987
|
/**
|
|
1114
|
-
* Drop summary returned by OpenSea API.
|
|
988
|
+
* Drop summary returned by OpenSea API. Sourced from api-types `DropResponse`.
|
|
1115
989
|
* @category API Models
|
|
1116
990
|
*/
|
|
1117
|
-
export type Drop =
|
|
1118
|
-
/** Collection slug */
|
|
1119
|
-
collection_slug: string
|
|
1120
|
-
/** Collection name */
|
|
1121
|
-
collection_name?: string
|
|
1122
|
-
/** Blockchain the drop is on */
|
|
1123
|
-
chain: string
|
|
1124
|
-
/** Contract address */
|
|
1125
|
-
contract_address: string
|
|
1126
|
-
/** Drop type */
|
|
1127
|
-
drop_type: string
|
|
1128
|
-
/** Whether the drop is currently minting */
|
|
1129
|
-
is_minting: boolean
|
|
1130
|
-
/** Collection image URL */
|
|
1131
|
-
image_url?: string
|
|
1132
|
-
/** OpenSea URL for the drop */
|
|
1133
|
-
opensea_url: string
|
|
1134
|
-
}
|
|
991
|
+
export type Drop = Camelize<DropResponse>
|
|
1135
992
|
|
|
1136
993
|
/**
|
|
1137
|
-
* Drop stage information.
|
|
994
|
+
* Drop stage information. Sourced from api-types `DropStageResponse`.
|
|
1138
995
|
* @category API Models
|
|
1139
996
|
*/
|
|
1140
|
-
export type DropStage =
|
|
1141
|
-
/** Stage UUID */
|
|
1142
|
-
uuid: string
|
|
1143
|
-
/** Stage type (e.g. public_sale) */
|
|
1144
|
-
stage_type: string
|
|
1145
|
-
/** Stage label/name */
|
|
1146
|
-
label?: string
|
|
1147
|
-
/** Mint price per token in wei */
|
|
1148
|
-
price?: string
|
|
1149
|
-
/** Currency contract address */
|
|
1150
|
-
price_currency_address: string
|
|
1151
|
-
/** Stage start time (ISO 8601) */
|
|
1152
|
-
start_time: string
|
|
1153
|
-
/** Stage end time (ISO 8601) */
|
|
1154
|
-
end_time: string
|
|
1155
|
-
/** Max tokens mintable per wallet in this stage */
|
|
1156
|
-
max_per_wallet: string
|
|
1157
|
-
}
|
|
997
|
+
export type DropStage = Camelize<DropStageResponse>
|
|
1158
998
|
|
|
1159
999
|
/**
|
|
1160
1000
|
* Detailed drop information including stages and supply.
|
|
1001
|
+
* Sourced from api-types `DropDetailedResponse`.
|
|
1161
1002
|
* @category API Models
|
|
1162
1003
|
*/
|
|
1163
|
-
export type DropDetailed =
|
|
1164
|
-
/** Drop stages (public sale, presale, etc.) */
|
|
1165
|
-
stages: DropStage[]
|
|
1166
|
-
/** Total minted supply */
|
|
1167
|
-
total_supply?: string
|
|
1168
|
-
/** Maximum supply */
|
|
1169
|
-
max_supply?: string
|
|
1170
|
-
}
|
|
1004
|
+
export type DropDetailed = Camelize<DropDetailedResponse>
|
|
1171
1005
|
|
|
1172
1006
|
/**
|
|
1173
1007
|
* Response from OpenSea API for fetching a list of drops.
|
|
@@ -1248,7 +1082,7 @@ export interface GetTrendingCollectionsArgs {
|
|
|
1248
1082
|
*/
|
|
1249
1083
|
export interface GetTopCollectionsArgs {
|
|
1250
1084
|
/** Sort by: one_day_volume, seven_days_volume, thirty_days_volume, floor_price, one_day_sales, etc. */
|
|
1251
|
-
|
|
1085
|
+
sortBy?: string
|
|
1252
1086
|
/** Blockchain(s) to filter by */
|
|
1253
1087
|
chains?: string[]
|
|
1254
1088
|
/** Category to filter by (e.g. art, gaming, pfps) */
|
|
@@ -1277,7 +1111,7 @@ export type ResolveAccountResponse = {
|
|
|
1277
1111
|
/** OpenSea username, if available */
|
|
1278
1112
|
username?: string
|
|
1279
1113
|
/** Primary ENS name, if available */
|
|
1280
|
-
|
|
1114
|
+
ensName?: string
|
|
1281
1115
|
}
|
|
1282
1116
|
|
|
1283
1117
|
/**
|
|
@@ -1323,18 +1157,212 @@ export type ValidateMetadataResponse = {
|
|
|
1323
1157
|
* Derived from the generated OpenAPI spec type to stay in sync automatically.
|
|
1324
1158
|
* @category API Response Types
|
|
1325
1159
|
*/
|
|
1326
|
-
export type GetNFTMetadataResponse = AssetMetadataResponse
|
|
1160
|
+
export type GetNFTMetadataResponse = Camelize<AssetMetadataResponse>
|
|
1327
1161
|
|
|
1328
|
-
// ─── Cross-chain fulfillment types
|
|
1329
|
-
//
|
|
1330
|
-
//
|
|
1331
|
-
//
|
|
1162
|
+
// ─── Cross-chain fulfillment + new endpoint types ───────────────────────
|
|
1163
|
+
// Sourced from @opensea/api-types. Response shapes are camelized for the
|
|
1164
|
+
// consumer view (the fetcher camelizes responses; see utils/case.ts).
|
|
1165
|
+
// Request shapes stay snake_case to match the API wire format — they're
|
|
1166
|
+
// sent as POST bodies and need to hit the API in its native format.
|
|
1332
1167
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1168
|
+
import type {
|
|
1169
|
+
BatchCollectionsRequest as ApiBatchCollectionsRequest,
|
|
1170
|
+
BatchNftsRequest as ApiBatchNftsRequest,
|
|
1171
|
+
BatchTokensRequest as ApiBatchTokensRequest,
|
|
1172
|
+
CollectionBatchResponse as ApiCollectionBatchResponse,
|
|
1173
|
+
CollectionHoldersPaginatedResponse as ApiCollectionHoldersPaginatedResponse,
|
|
1174
|
+
CollectionOfferAggregatesPaginatedResponse as ApiCollectionOfferAggregatesPaginatedResponse,
|
|
1175
|
+
CreateListingActionsRequest as ApiCreateListingActionsRequest,
|
|
1176
|
+
CreateListingActionsResponse as ApiCreateListingActionsResponse,
|
|
1177
|
+
CrossChainFulfillmentRequest as ApiCrossChainFulfillmentRequest,
|
|
1178
|
+
CrossChainFulfillmentResponse as ApiCrossChainFulfillmentResponse,
|
|
1179
|
+
CrossChainPaymentToken as ApiCrossChainPaymentToken,
|
|
1180
|
+
DropDeployReceiptResponse as ApiDropDeployReceiptResponse,
|
|
1181
|
+
DropDeployRequest as ApiDropDeployRequest,
|
|
1182
|
+
DropDeployResponse as ApiDropDeployResponse,
|
|
1183
|
+
FloorPriceHistoryResponse as ApiFloorPriceHistoryResponse,
|
|
1184
|
+
FulfillerObject as ApiFulfillerObject,
|
|
1185
|
+
ListingObject as ApiListingObject,
|
|
1186
|
+
NftAnalyticsResponse as ApiNftAnalyticsResponse,
|
|
1187
|
+
NftBatchResponse as ApiNftBatchResponse,
|
|
1188
|
+
OhlcvResponse as ApiOhlcvResponse,
|
|
1189
|
+
OwnersPaginatedResponse as ApiOwnersPaginatedResponse,
|
|
1190
|
+
PortfolioHistoryResponse as ApiPortfolioHistoryResponse,
|
|
1191
|
+
PortfolioStatsResponse as ApiPortfolioStatsResponse,
|
|
1192
|
+
PriceHistoryResponse as ApiPriceHistoryResponse,
|
|
1193
|
+
ProfileCollectionsResponse as ApiProfileCollectionsResponse,
|
|
1194
|
+
SwapTransactionResponse as ApiSwapTransactionResponse,
|
|
1195
|
+
TokenBatchResponse as ApiTokenBatchResponse,
|
|
1196
|
+
TokenSwapActivityPaginatedResponse as ApiTokenSwapActivityPaginatedResponse,
|
|
1197
|
+
TransferRequest as ApiTransferRequest,
|
|
1198
|
+
TransferResponse as ApiTransferResponse,
|
|
1340
1199
|
} from "@opensea/api-types"
|
|
1200
|
+
|
|
1201
|
+
// Request types — camelized consumer view. The fetcher snakeizes the body on
|
|
1202
|
+
// the way out (see `api.ts`), so passing camelCase here hits the API correctly.
|
|
1203
|
+
export type BatchCollectionsRequest = Camelize<ApiBatchCollectionsRequest>
|
|
1204
|
+
export type BatchNftsRequest = Camelize<ApiBatchNftsRequest>
|
|
1205
|
+
export type BatchTokensRequest = Camelize<ApiBatchTokensRequest>
|
|
1206
|
+
export type CreateListingActionsRequest =
|
|
1207
|
+
Camelize<ApiCreateListingActionsRequest>
|
|
1208
|
+
export type CrossChainFulfillmentRequest =
|
|
1209
|
+
Camelize<ApiCrossChainFulfillmentRequest>
|
|
1210
|
+
export type DropDeployRequest = Camelize<ApiDropDeployRequest>
|
|
1211
|
+
export type FulfillerObject = Camelize<ApiFulfillerObject>
|
|
1212
|
+
export type ListingObject = Camelize<ApiListingObject>
|
|
1213
|
+
export type TransferRequest = Camelize<ApiTransferRequest>
|
|
1214
|
+
|
|
1215
|
+
// Response types — camelized for the consumer view.
|
|
1216
|
+
export type CollectionBatchResponse = Camelize<ApiCollectionBatchResponse>
|
|
1217
|
+
export type CollectionHoldersPaginatedResponse =
|
|
1218
|
+
Camelize<ApiCollectionHoldersPaginatedResponse>
|
|
1219
|
+
export type CollectionOfferAggregatesPaginatedResponse =
|
|
1220
|
+
Camelize<ApiCollectionOfferAggregatesPaginatedResponse>
|
|
1221
|
+
export type CreateListingActionsResponse =
|
|
1222
|
+
Camelize<ApiCreateListingActionsResponse>
|
|
1223
|
+
export type CrossChainFulfillmentResponse =
|
|
1224
|
+
Camelize<ApiCrossChainFulfillmentResponse>
|
|
1225
|
+
export type CrossChainPaymentToken = Camelize<ApiCrossChainPaymentToken>
|
|
1226
|
+
export type DropDeployReceiptResponse = Camelize<ApiDropDeployReceiptResponse>
|
|
1227
|
+
export type DropDeployResponse = Camelize<ApiDropDeployResponse>
|
|
1228
|
+
export type FloorPriceHistoryResponse = Camelize<ApiFloorPriceHistoryResponse>
|
|
1229
|
+
export type NftAnalyticsResponse = Camelize<ApiNftAnalyticsResponse>
|
|
1230
|
+
export type NftBatchResponse = Camelize<ApiNftBatchResponse>
|
|
1231
|
+
export type OhlcvResponse = Camelize<ApiOhlcvResponse>
|
|
1232
|
+
export type OwnersPaginatedResponse = Camelize<ApiOwnersPaginatedResponse>
|
|
1233
|
+
export type PortfolioHistoryResponse = Camelize<ApiPortfolioHistoryResponse>
|
|
1234
|
+
export type PortfolioStatsResponse = Camelize<ApiPortfolioStatsResponse>
|
|
1235
|
+
export type PriceHistoryResponse = Camelize<ApiPriceHistoryResponse>
|
|
1236
|
+
export type ProfileCollectionsResponse = Camelize<ApiProfileCollectionsResponse>
|
|
1237
|
+
export type SwapTransactionResponse = Camelize<ApiSwapTransactionResponse>
|
|
1238
|
+
export type TokenBatchResponse = Camelize<ApiTokenBatchResponse>
|
|
1239
|
+
export type TokenSwapActivityPaginatedResponse =
|
|
1240
|
+
Camelize<ApiTokenSwapActivityPaginatedResponse>
|
|
1241
|
+
export type TransferResponse = Camelize<ApiTransferResponse>
|
|
1242
|
+
|
|
1243
|
+
/**
|
|
1244
|
+
* Query args for paginated collection-analytics endpoints (offer aggregates,
|
|
1245
|
+
* holders). All fields are optional; `cursor` paginates forward.
|
|
1246
|
+
* @category API Query Args
|
|
1247
|
+
*/
|
|
1248
|
+
export interface PaginatedAnalyticsArgs {
|
|
1249
|
+
limit?: number
|
|
1250
|
+
cursor?: string
|
|
1251
|
+
sortDirection?: "asc" | "desc"
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* Query args for the collection holders endpoint — adds optional `owned_by`
|
|
1256
|
+
* filter on top of {@link PaginatedAnalyticsArgs}.
|
|
1257
|
+
* @category API Query Args
|
|
1258
|
+
*/
|
|
1259
|
+
export interface CollectionHoldersArgs extends PaginatedAnalyticsArgs {
|
|
1260
|
+
ownedBy?: string
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* Query args for the collection floor-price history endpoint.
|
|
1265
|
+
* @category API Query Args
|
|
1266
|
+
*/
|
|
1267
|
+
export interface CollectionFloorPricesArgs {
|
|
1268
|
+
/** Time window: one_minute, five_minutes, fifteen_minutes, one_hour, one_day, seven_days, thirty_days, one_year, all_time */
|
|
1269
|
+
timeframe?: string
|
|
1270
|
+
/** Number of data points to return */
|
|
1271
|
+
resolution?: number
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
* Query args for token price-history and OHLCV endpoints.
|
|
1276
|
+
* @category API Query Args
|
|
1277
|
+
*/
|
|
1278
|
+
export interface TokenTimeSeriesArgs {
|
|
1279
|
+
/** Start time (ISO 8601, required by the API). */
|
|
1280
|
+
startTime: string
|
|
1281
|
+
/** End time (ISO 8601, defaults to now). */
|
|
1282
|
+
endTime?: string
|
|
1283
|
+
/** Candle bucket size: 1s, 1m, 5m, 15m, 1h, 4h, 1d. */
|
|
1284
|
+
bucketSize?: string
|
|
1285
|
+
/** Whether to fill empty time windows with zero-volume candles (OHLCV only). */
|
|
1286
|
+
fillTimeWindow?: boolean
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
/**
|
|
1290
|
+
* Query args for the token swap-activity endpoint.
|
|
1291
|
+
* @category API Query Args
|
|
1292
|
+
*/
|
|
1293
|
+
export interface TokenActivityArgs {
|
|
1294
|
+
limit?: number
|
|
1295
|
+
cursor?: string
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
/**
|
|
1299
|
+
* Query args for the NFT owners endpoint (paginated with `next` cursor).
|
|
1300
|
+
* @category API Query Args
|
|
1301
|
+
*/
|
|
1302
|
+
export interface NFTOwnersArgs {
|
|
1303
|
+
limit?: number
|
|
1304
|
+
next?: string
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* Query args for the account portfolio and portfolio history endpoints.
|
|
1309
|
+
* @category API Query Args
|
|
1310
|
+
*/
|
|
1311
|
+
export interface PortfolioArgs {
|
|
1312
|
+
/** Timeframe for P&L / net-worth history calculation. */
|
|
1313
|
+
timeframe?: "HOUR" | "DAY" | "WEEK" | "MONTH"
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* Query args shared by the account profile listing-and-offer endpoints
|
|
1318
|
+
* (offers, offers_received, listings).
|
|
1319
|
+
* @category API Query Args
|
|
1320
|
+
*/
|
|
1321
|
+
export interface ProfileOrdersArgs {
|
|
1322
|
+
after?: string
|
|
1323
|
+
limit?: number
|
|
1324
|
+
collectionSlugs?: string[]
|
|
1325
|
+
chains?: string[]
|
|
1326
|
+
sortBy?: string
|
|
1327
|
+
sortDirection?: "asc" | "desc"
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* Query args for the account profile favorites endpoint.
|
|
1332
|
+
* @category API Query Args
|
|
1333
|
+
*/
|
|
1334
|
+
export interface ProfileFavoritesArgs {
|
|
1335
|
+
after?: string
|
|
1336
|
+
limit?: number
|
|
1337
|
+
sortBy?: string
|
|
1338
|
+
sortDirection?: "asc" | "desc"
|
|
1339
|
+
chains?: string[]
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* Query args for the account profile collections endpoint.
|
|
1344
|
+
* @category API Query Args
|
|
1345
|
+
*/
|
|
1346
|
+
export interface ProfileCollectionsArgs {
|
|
1347
|
+
after?: string
|
|
1348
|
+
limit?: number
|
|
1349
|
+
chains?: string[]
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
/**
|
|
1353
|
+
* Response from the account favorites endpoint — favorited NFTs.
|
|
1354
|
+
* @category API Response Types
|
|
1355
|
+
*/
|
|
1356
|
+
export type ProfileFavoritesResponse = Camelize<NftListResponse>
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* Response from the account profile listings endpoint.
|
|
1360
|
+
* @category API Response Types
|
|
1361
|
+
*/
|
|
1362
|
+
export type ProfileListingsResponse = Camelize<ListingsResponse>
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* Response from the account profile offers / offers_received endpoints.
|
|
1366
|
+
* @category API Response Types
|
|
1367
|
+
*/
|
|
1368
|
+
export type ProfileOffersResponse = Camelize<OffersResponse>
|