@opensea/sdk 10.5.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.js +12 -8
- package/lib/api/accounts.js.map +1 -1
- package/lib/api/api.d.ts +16 -10
- package/lib/api/api.js +42 -18
- package/lib/api/api.js.map +1 -1
- package/lib/api/collections.js +7 -15
- package/lib/api/collections.js.map +1 -1
- package/lib/api/fetcher.d.ts +35 -5
- package/lib/api/listings.js +3 -3
- package/lib/api/listings.js.map +1 -1
- package/lib/api/nfts.d.ts +1 -1
- package/lib/api/nfts.js +2 -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 +2 -2
- package/lib/api/tokens.js +1 -1
- package/lib/api/tokens.js.map +1 -1
- package/lib/api/types.d.ts +196 -356
- 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 +14 -8
- package/src/api/api.ts +60 -25
- package/src/api/collections.ts +7 -21
- package/src/api/fetcher.ts +41 -6
- package/src/api/listings.ts +3 -3
- package/src/api/nfts.ts +3 -7
- package/src/api/offers.ts +17 -10
- package/src/api/orders.ts +29 -5
- package/src/api/tokens.ts +2 -2
- package/src/api/types.ts +265 -399
- 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,21 +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,
|
|
10
25
|
ListingsResponse,
|
|
26
|
+
NftDetailed,
|
|
11
27
|
NftListResponse,
|
|
28
|
+
NftResponse,
|
|
12
29
|
OffersResponse,
|
|
30
|
+
TokenBalanceResponse,
|
|
13
31
|
TokenGroupPaginatedResponse,
|
|
14
32
|
TokenGroupResponse,
|
|
15
33
|
} from "@opensea/api-types"
|
|
16
|
-
import type { ConsiderationItem } from "@opensea/seaport-js/lib/types"
|
|
17
34
|
import type { OrderType, ProtocolData } from "../orders/types"
|
|
18
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>
|
|
19
44
|
|
|
20
45
|
/**
|
|
21
46
|
* A single trait filter used by collection-scoped read endpoints (NFTs by
|
|
@@ -48,19 +73,16 @@ export function encodeTraitsParam(
|
|
|
48
73
|
}
|
|
49
74
|
|
|
50
75
|
/**
|
|
51
|
-
* 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).
|
|
52
79
|
* @category API Response Types
|
|
53
80
|
*/
|
|
54
|
-
export type BuildOfferResponse =
|
|
55
|
-
/** A portion of the parameters needed to submit a criteria offer, i.e. collection offer. */
|
|
56
|
-
partialParameters: PartialParameters
|
|
57
|
-
/** Criteria echoed back from the build request. Includes collection and trait info. */
|
|
58
|
-
criteria: BuildOfferCriteria
|
|
59
|
-
}
|
|
81
|
+
export type BuildOfferResponse = Camelize<ApiBuildOfferResponse>
|
|
60
82
|
|
|
61
83
|
/**
|
|
62
|
-
* Criteria returned by the build offer endpoint.
|
|
63
|
-
*
|
|
84
|
+
* Criteria returned by the build offer endpoint. Subset of the wire-format
|
|
85
|
+
* criteria — only collection and trait fields.
|
|
64
86
|
* @category API Response Types
|
|
65
87
|
*/
|
|
66
88
|
export type BuildOfferCriteria = {
|
|
@@ -69,31 +91,6 @@ export type BuildOfferCriteria = {
|
|
|
69
91
|
numericTraits?: NumericTraitCriteria[]
|
|
70
92
|
}
|
|
71
93
|
|
|
72
|
-
type PartialParameters = {
|
|
73
|
-
consideration: ConsiderationItem[]
|
|
74
|
-
zone: string
|
|
75
|
-
zoneHash: string
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Criteria for collection or trait offers.
|
|
80
|
-
* @category API Response Types
|
|
81
|
-
*/
|
|
82
|
-
type Criteria = {
|
|
83
|
-
/** The collection for the criteria */
|
|
84
|
-
collection: CollectionCriteria
|
|
85
|
-
/** The contract for the criteria */
|
|
86
|
-
contract: ContractCriteria
|
|
87
|
-
/** Represents a list of token ids which can be used to fulfill the criteria offer. */
|
|
88
|
-
encoded_token_ids?: string
|
|
89
|
-
/** The trait for the criteria (single trait) */
|
|
90
|
-
trait?: TraitCriteria
|
|
91
|
-
/** Multiple traits for the criteria (multi-trait offers) */
|
|
92
|
-
traits?: TraitCriteria[]
|
|
93
|
-
/** Numeric traits for the criteria (numeric trait offers) */
|
|
94
|
-
numericTraits?: NumericTraitCriteria[]
|
|
95
|
-
}
|
|
96
|
-
|
|
97
94
|
/**
|
|
98
95
|
* Criteria for trait offers.
|
|
99
96
|
* @category API Response Types
|
|
@@ -118,31 +115,25 @@ type CollectionCriteria = {
|
|
|
118
115
|
slug: string
|
|
119
116
|
}
|
|
120
117
|
|
|
121
|
-
type ContractCriteria = {
|
|
122
|
-
address: string
|
|
123
|
-
}
|
|
124
|
-
|
|
125
118
|
/**
|
|
126
119
|
* Query args for Get Collections
|
|
127
120
|
* @category API Query Args
|
|
128
121
|
*/
|
|
129
122
|
export interface GetCollectionsArgs {
|
|
130
|
-
|
|
123
|
+
orderBy?: string
|
|
131
124
|
limit?: number
|
|
132
125
|
next?: string
|
|
133
126
|
chain?: string
|
|
134
|
-
|
|
135
|
-
|
|
127
|
+
creatorUsername?: string
|
|
128
|
+
includeHidden?: boolean
|
|
136
129
|
}
|
|
137
130
|
|
|
138
131
|
/**
|
|
139
132
|
* Response from OpenSea API for fetching a single collection.
|
|
133
|
+
* Bare collection object (the response is not wrapped). See {@link OpenSeaCollection}.
|
|
140
134
|
* @category API Response Types
|
|
141
135
|
*/
|
|
142
|
-
export type GetCollectionResponse =
|
|
143
|
-
/** Collection object. See {@link OpenSeaCollection} */
|
|
144
|
-
collection: OpenSeaCollection
|
|
145
|
-
}
|
|
136
|
+
export type GetCollectionResponse = OpenSeaCollection
|
|
146
137
|
|
|
147
138
|
/**
|
|
148
139
|
* Response from OpenSea API for fetching a list of collections.
|
|
@@ -175,63 +166,46 @@ export enum OrderStatus {
|
|
|
175
166
|
}
|
|
176
167
|
|
|
177
168
|
/**
|
|
178
|
-
* 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.
|
|
179
172
|
* @category API Models
|
|
180
173
|
*/
|
|
181
|
-
export type Order = {
|
|
182
|
-
|
|
183
|
-
order_hash: string
|
|
184
|
-
/** Chain the offer exists on */
|
|
185
|
-
chain: string
|
|
186
|
-
/** The protocol data for the order. Only 'seaport' is currently supported. */
|
|
187
|
-
protocol_data: ProtocolData
|
|
188
|
-
/** The contract address of the protocol. */
|
|
189
|
-
protocol_address: string
|
|
190
|
-
/** The price of the order. */
|
|
191
|
-
price: Price
|
|
174
|
+
export type Order = Camelize<Omit<ApiOrder, "protocol_data">> & {
|
|
175
|
+
protocolData?: ProtocolData
|
|
192
176
|
}
|
|
193
177
|
|
|
194
178
|
/**
|
|
195
|
-
* 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).
|
|
196
182
|
* @category API Models
|
|
197
183
|
*/
|
|
198
|
-
export type Offer =
|
|
199
|
-
|
|
200
|
-
criteria?: Criteria
|
|
201
|
-
/** The status of the offer. */
|
|
184
|
+
export type Offer = Camelize<Omit<ApiOffer, "protocol_data" | "status">> & {
|
|
185
|
+
protocolData?: ProtocolData
|
|
202
186
|
status: OrderStatus
|
|
203
187
|
}
|
|
204
188
|
|
|
205
189
|
/**
|
|
206
|
-
* Collection Offer type.
|
|
190
|
+
* Collection Offer type — an {@link Offer} with `criteria` guaranteed present.
|
|
207
191
|
* @category API Models
|
|
208
192
|
*/
|
|
209
|
-
export type CollectionOffer =
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Price response.
|
|
213
|
-
* @category API Models
|
|
214
|
-
*/
|
|
215
|
-
export type Price = {
|
|
216
|
-
currency: string
|
|
217
|
-
decimals: number
|
|
218
|
-
value: string
|
|
193
|
+
export type CollectionOffer = Offer & {
|
|
194
|
+
criteria: NonNullable<Offer["criteria"]>
|
|
219
195
|
}
|
|
220
196
|
|
|
221
197
|
/**
|
|
222
|
-
* 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).
|
|
223
202
|
* @category API Models
|
|
224
203
|
*/
|
|
225
|
-
export type Listing =
|
|
226
|
-
|
|
204
|
+
export type Listing = Camelize<
|
|
205
|
+
Omit<ApiListing, "protocol_data" | "type" | "status">
|
|
206
|
+
> & {
|
|
207
|
+
protocolData?: ProtocolData
|
|
227
208
|
type: OrderType
|
|
228
|
-
/** The price of the listing with current price nested. */
|
|
229
|
-
price: {
|
|
230
|
-
current: Price
|
|
231
|
-
}
|
|
232
|
-
/** The remaining quantity available for the listing. This is important for partially filled orders. */
|
|
233
|
-
remaining_quantity: number
|
|
234
|
-
/** The status of the listing. */
|
|
235
209
|
status: OrderStatus
|
|
236
210
|
}
|
|
237
211
|
|
|
@@ -257,12 +231,10 @@ export type ListNFTsResponse = {
|
|
|
257
231
|
|
|
258
232
|
/**
|
|
259
233
|
* Response from OpenSea API for fetching a single NFT.
|
|
234
|
+
* Camelized from api-types `NftResponse`.
|
|
260
235
|
* @category API Response Types
|
|
261
236
|
*/
|
|
262
|
-
export type GetNFTResponse =
|
|
263
|
-
/** See {@link NFT} */
|
|
264
|
-
nft: NFT
|
|
265
|
-
}
|
|
237
|
+
export type GetNFTResponse = Camelize<NftResponse>
|
|
266
238
|
|
|
267
239
|
/**
|
|
268
240
|
* Base query cursors response from OpenSea API.
|
|
@@ -309,118 +281,63 @@ export type GetOrderByHashResponse = Offer | Listing
|
|
|
309
281
|
|
|
310
282
|
/**
|
|
311
283
|
* Response from OpenSea API for offchain canceling an order.
|
|
284
|
+
* Camelized from api-types `CancelResponse`.
|
|
312
285
|
* @category API Response Types
|
|
313
286
|
*/
|
|
314
|
-
export type CancelOrderResponse =
|
|
315
|
-
last_signature_issued_valid_until: string | null
|
|
316
|
-
}
|
|
287
|
+
export type CancelOrderResponse = Camelize<ApiCancelResponse>
|
|
317
288
|
|
|
318
289
|
/**
|
|
319
290
|
* Request body for sweeping (bulk-buying) items from a collection.
|
|
320
291
|
* @category API Query Args
|
|
321
292
|
*/
|
|
322
|
-
export type SweepCollectionRequest = ApiSweepCollectionRequest
|
|
293
|
+
export type SweepCollectionRequest = Camelize<ApiSweepCollectionRequest>
|
|
323
294
|
|
|
324
295
|
/**
|
|
325
296
|
* Response from sweeping a collection.
|
|
326
297
|
* @category API Response Types
|
|
327
298
|
*/
|
|
328
|
-
export type SweepCollectionResponse = ApiSweepCollectionResponse
|
|
299
|
+
export type SweepCollectionResponse = Camelize<ApiSweepCollectionResponse>
|
|
329
300
|
|
|
330
301
|
/**
|
|
331
302
|
* Request body for executing a token swap.
|
|
332
303
|
* @category API Query Args
|
|
333
304
|
*/
|
|
334
|
-
export type SwapExecuteRequest = ApiSwapExecuteRequest
|
|
305
|
+
export type SwapExecuteRequest = Camelize<ApiSwapExecuteRequest>
|
|
335
306
|
|
|
336
307
|
/**
|
|
337
308
|
* Response from executing a token swap.
|
|
338
309
|
* @category API Response Types
|
|
339
310
|
*/
|
|
340
|
-
export type SwapExecuteResponse = ApiSwapExecuteResponse
|
|
311
|
+
export type SwapExecuteResponse = Camelize<ApiSwapExecuteResponse>
|
|
341
312
|
|
|
342
313
|
/**
|
|
343
314
|
* Request body for fetching a transaction receipt.
|
|
344
315
|
* @category API Query Args
|
|
345
316
|
*/
|
|
346
|
-
export type TransactionReceiptRequest = ApiTransactionReceiptRequest
|
|
317
|
+
export type TransactionReceiptRequest = Camelize<ApiTransactionReceiptRequest>
|
|
347
318
|
|
|
348
319
|
/**
|
|
349
320
|
* Response from fetching a transaction receipt.
|
|
350
321
|
* @category API Response Types
|
|
351
322
|
*/
|
|
352
|
-
export type TransactionReceiptResponse = ApiTransactionReceiptResponse
|
|
323
|
+
export type TransactionReceiptResponse = Camelize<ApiTransactionReceiptResponse>
|
|
353
324
|
|
|
354
325
|
/**
|
|
355
|
-
* NFT type returned by OpenSea API.
|
|
326
|
+
* NFT type returned by OpenSea API. Sourced from api-types `NftDetailed`.
|
|
356
327
|
* @category API Models
|
|
357
328
|
*/
|
|
358
|
-
export type NFT =
|
|
359
|
-
/** NFT Identifier (also commonly referred to as tokenId) */
|
|
360
|
-
identifier: string
|
|
361
|
-
/** Slug identifier of collection */
|
|
362
|
-
collection: string
|
|
363
|
-
/** Address of contract */
|
|
364
|
-
contract: string
|
|
365
|
-
/** Token standard, i.e. ERC721, ERC1155, etc. */
|
|
366
|
-
token_standard: string
|
|
367
|
-
/** Name of NFT */
|
|
368
|
-
name: string
|
|
369
|
-
/** Description of NFT */
|
|
370
|
-
description: string
|
|
371
|
-
/** URL of image */
|
|
372
|
-
image_url: string
|
|
373
|
-
/** URL of metadata */
|
|
374
|
-
metadata_url: string
|
|
375
|
-
/** URL on OpenSea */
|
|
376
|
-
opensea_url: string
|
|
377
|
-
/** Date of latest NFT update */
|
|
378
|
-
updated_at: string
|
|
379
|
-
/** Whether NFT is disabled for trading on OpenSea */
|
|
380
|
-
is_disabled: boolean
|
|
381
|
-
/** Whether NFT is NSFW (Not Safe For Work) */
|
|
382
|
-
is_nsfw: boolean
|
|
383
|
-
/** Traits for the NFT, returns null if the NFT has than 50 traits */
|
|
384
|
-
traits: Trait[] | null
|
|
385
|
-
/** Creator of the NFT */
|
|
386
|
-
creator: string
|
|
387
|
-
/** Owners of the NFT */
|
|
388
|
-
owners: {
|
|
389
|
-
address: string
|
|
390
|
-
quantity: number
|
|
391
|
-
}[]
|
|
392
|
-
/** Rarity of the NFT */
|
|
393
|
-
rarity: null | {
|
|
394
|
-
strategy_id: string | null
|
|
395
|
-
strategy_version: string | null
|
|
396
|
-
rank: number | null
|
|
397
|
-
score: number | null
|
|
398
|
-
calculated_at: string
|
|
399
|
-
max_rank: number | null
|
|
400
|
-
tokens_scored: number | null
|
|
401
|
-
ranking_features: null | {
|
|
402
|
-
unique_attribute_count: number
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
329
|
+
export type NFT = Camelize<NftDetailed>
|
|
406
330
|
|
|
407
331
|
/**
|
|
408
|
-
* 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.
|
|
409
334
|
* @category API Models
|
|
410
335
|
*/
|
|
411
|
-
export type Trait =
|
|
412
|
-
/** The name of the trait category (e.g. 'Background') */
|
|
413
|
-
trait_type: string
|
|
414
|
-
/** A field indicating how to display. None is used for string traits. */
|
|
415
|
-
display_type: TraitDisplayType
|
|
416
|
-
/** Ceiling for possible numeric trait values */
|
|
417
|
-
max_value: string
|
|
418
|
-
/** The value of the trait (e.g. 'Red') */
|
|
419
|
-
value: string | number | Date
|
|
420
|
-
}
|
|
336
|
+
export type Trait = Camelize<ApiTrait>
|
|
421
337
|
|
|
422
338
|
/**
|
|
423
|
-
* 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.
|
|
424
341
|
* @category API Models
|
|
425
342
|
*/
|
|
426
343
|
export enum TraitDisplayType {
|
|
@@ -460,40 +377,16 @@ export enum OrderEventType {
|
|
|
460
377
|
}
|
|
461
378
|
|
|
462
379
|
/**
|
|
463
|
-
* Payment information for an event.
|
|
380
|
+
* Payment information for an event. Camelized from api-types `Payment`.
|
|
464
381
|
* @category API Models
|
|
465
382
|
*/
|
|
466
|
-
export type EventPayment =
|
|
467
|
-
/** Quantity of the payment token */
|
|
468
|
-
quantity: string
|
|
469
|
-
/** Address of the payment token (0x0...0 for ETH) */
|
|
470
|
-
token_address: string
|
|
471
|
-
/** Decimals of the payment token */
|
|
472
|
-
decimals: number
|
|
473
|
-
/** Symbol of the payment token */
|
|
474
|
-
symbol: string
|
|
475
|
-
}
|
|
383
|
+
export type EventPayment = Camelize<ApiPayment>
|
|
476
384
|
|
|
477
385
|
/**
|
|
478
|
-
* Asset information in an event.
|
|
386
|
+
* Asset information in an event. Camelized from api-types `Nft`.
|
|
479
387
|
* @category API Models
|
|
480
388
|
*/
|
|
481
|
-
export type EventAsset =
|
|
482
|
-
identifier: string
|
|
483
|
-
collection: string
|
|
484
|
-
contract: string
|
|
485
|
-
token_standard: string
|
|
486
|
-
name: string
|
|
487
|
-
description: string
|
|
488
|
-
image_url: string
|
|
489
|
-
display_image_url: string
|
|
490
|
-
display_animation_url: string | null
|
|
491
|
-
metadata_url: string
|
|
492
|
-
opensea_url: string
|
|
493
|
-
updated_at: string
|
|
494
|
-
is_disabled: boolean
|
|
495
|
-
is_nsfw: boolean
|
|
496
|
-
}
|
|
389
|
+
export type EventAsset = Camelize<ApiNft>
|
|
497
390
|
|
|
498
391
|
/**
|
|
499
392
|
* Base event type.
|
|
@@ -501,9 +394,9 @@ export type EventAsset = {
|
|
|
501
394
|
*/
|
|
502
395
|
type BaseEvent = {
|
|
503
396
|
/** Type of the event */
|
|
504
|
-
|
|
397
|
+
eventType: AssetEventType | string
|
|
505
398
|
/** Timestamp of the event */
|
|
506
|
-
|
|
399
|
+
eventTimestamp: number
|
|
507
400
|
/** Chain the event occurred on */
|
|
508
401
|
chain: string
|
|
509
402
|
/** Quantity involved in the event */
|
|
@@ -515,13 +408,13 @@ type BaseEvent = {
|
|
|
515
408
|
* @category API Models
|
|
516
409
|
*/
|
|
517
410
|
export type ListingEvent = BaseEvent & {
|
|
518
|
-
|
|
411
|
+
eventType: AssetEventType.LISTING | "listing"
|
|
519
412
|
/** Payment information */
|
|
520
413
|
payment: EventPayment
|
|
521
414
|
/** Start date of the listing */
|
|
522
|
-
|
|
415
|
+
startDate: number | null
|
|
523
416
|
/** Expiration date of the listing */
|
|
524
|
-
|
|
417
|
+
expirationDate: number
|
|
525
418
|
/** Asset involved in the listing */
|
|
526
419
|
asset: EventAsset
|
|
527
420
|
/** Maker of the listing */
|
|
@@ -529,11 +422,11 @@ export type ListingEvent = BaseEvent & {
|
|
|
529
422
|
/** Taker of the listing */
|
|
530
423
|
taker: string
|
|
531
424
|
/** Whether the listing is private */
|
|
532
|
-
|
|
425
|
+
isPrivateListing: boolean
|
|
533
426
|
/** Order hash (optional) */
|
|
534
|
-
|
|
427
|
+
orderHash?: string
|
|
535
428
|
/** Protocol address (optional) */
|
|
536
|
-
|
|
429
|
+
protocolAddress?: string
|
|
537
430
|
}
|
|
538
431
|
|
|
539
432
|
/**
|
|
@@ -541,13 +434,13 @@ export type ListingEvent = BaseEvent & {
|
|
|
541
434
|
* @category API Models
|
|
542
435
|
*/
|
|
543
436
|
export type OfferEvent = BaseEvent & {
|
|
544
|
-
|
|
437
|
+
eventType: AssetEventType.OFFER | "offer"
|
|
545
438
|
/** Payment information */
|
|
546
439
|
payment: EventPayment
|
|
547
440
|
/** Start date of the offer */
|
|
548
|
-
|
|
441
|
+
startDate: number | null
|
|
549
442
|
/** Expiration date of the offer */
|
|
550
|
-
|
|
443
|
+
expirationDate: number
|
|
551
444
|
/** Asset involved in the offer */
|
|
552
445
|
asset: EventAsset
|
|
553
446
|
/** Maker of the offer */
|
|
@@ -555,9 +448,9 @@ export type OfferEvent = BaseEvent & {
|
|
|
555
448
|
/** Taker of the offer */
|
|
556
449
|
taker: string
|
|
557
450
|
/** Order hash (optional) */
|
|
558
|
-
|
|
451
|
+
orderHash?: string
|
|
559
452
|
/** Protocol address (optional) */
|
|
560
|
-
|
|
453
|
+
protocolAddress?: string
|
|
561
454
|
}
|
|
562
455
|
|
|
563
456
|
/**
|
|
@@ -565,13 +458,13 @@ export type OfferEvent = BaseEvent & {
|
|
|
565
458
|
* @category API Models
|
|
566
459
|
*/
|
|
567
460
|
export type TraitOfferEvent = BaseEvent & {
|
|
568
|
-
|
|
461
|
+
eventType: AssetEventType.TRAIT_OFFER | "trait_offer"
|
|
569
462
|
/** Payment information */
|
|
570
463
|
payment: EventPayment
|
|
571
464
|
/** Start date of the offer */
|
|
572
|
-
|
|
465
|
+
startDate: number | null
|
|
573
466
|
/** Expiration date of the offer */
|
|
574
|
-
|
|
467
|
+
expirationDate: number
|
|
575
468
|
/** Criteria for trait offers */
|
|
576
469
|
criteria: Record<string, unknown>
|
|
577
470
|
/** Maker of the offer */
|
|
@@ -579,9 +472,9 @@ export type TraitOfferEvent = BaseEvent & {
|
|
|
579
472
|
/** Taker of the offer */
|
|
580
473
|
taker: string
|
|
581
474
|
/** Order hash (optional) */
|
|
582
|
-
|
|
475
|
+
orderHash?: string
|
|
583
476
|
/** Protocol address (optional) */
|
|
584
|
-
|
|
477
|
+
protocolAddress?: string
|
|
585
478
|
}
|
|
586
479
|
|
|
587
480
|
/**
|
|
@@ -589,13 +482,13 @@ export type TraitOfferEvent = BaseEvent & {
|
|
|
589
482
|
* @category API Models
|
|
590
483
|
*/
|
|
591
484
|
export type CollectionOfferEvent = BaseEvent & {
|
|
592
|
-
|
|
485
|
+
eventType: AssetEventType.COLLECTION_OFFER | "collection_offer"
|
|
593
486
|
/** Payment information */
|
|
594
487
|
payment: EventPayment
|
|
595
488
|
/** Start date of the offer */
|
|
596
|
-
|
|
489
|
+
startDate: number | null
|
|
597
490
|
/** Expiration date of the offer */
|
|
598
|
-
|
|
491
|
+
expirationDate: number
|
|
599
492
|
/** Criteria for collection offers */
|
|
600
493
|
criteria: Record<string, unknown>
|
|
601
494
|
/** Maker of the offer */
|
|
@@ -603,9 +496,9 @@ export type CollectionOfferEvent = BaseEvent & {
|
|
|
603
496
|
/** Taker of the offer */
|
|
604
497
|
taker: string
|
|
605
498
|
/** Order hash (optional) */
|
|
606
|
-
|
|
499
|
+
orderHash?: string
|
|
607
500
|
/** Protocol address (optional) */
|
|
608
|
-
|
|
501
|
+
protocolAddress?: string
|
|
609
502
|
}
|
|
610
503
|
|
|
611
504
|
/**
|
|
@@ -614,13 +507,13 @@ export type CollectionOfferEvent = BaseEvent & {
|
|
|
614
507
|
* @category API Models
|
|
615
508
|
*/
|
|
616
509
|
export type OrderEvent = BaseEvent & {
|
|
617
|
-
|
|
510
|
+
eventType: AssetEventType.ORDER | "order"
|
|
618
511
|
/** Payment information */
|
|
619
512
|
payment: EventPayment
|
|
620
513
|
/** Start date of the order */
|
|
621
|
-
|
|
514
|
+
startDate: number | null
|
|
622
515
|
/** Expiration date of the order */
|
|
623
|
-
|
|
516
|
+
expirationDate: number
|
|
624
517
|
/** Asset involved in the order (optional, not present for collection/trait offers) */
|
|
625
518
|
asset?: EventAsset
|
|
626
519
|
/** Criteria for collection/trait offers (optional) */
|
|
@@ -630,11 +523,11 @@ export type OrderEvent = BaseEvent & {
|
|
|
630
523
|
/** Taker of the order */
|
|
631
524
|
taker: string
|
|
632
525
|
/** Order hash (optional) */
|
|
633
|
-
|
|
526
|
+
orderHash?: string
|
|
634
527
|
/** Protocol address (optional) */
|
|
635
|
-
|
|
528
|
+
protocolAddress?: string
|
|
636
529
|
/** Order type providing more detail */
|
|
637
|
-
|
|
530
|
+
orderType?: OrderEventType
|
|
638
531
|
}
|
|
639
532
|
|
|
640
533
|
/**
|
|
@@ -642,11 +535,11 @@ export type OrderEvent = BaseEvent & {
|
|
|
642
535
|
* @category API Models
|
|
643
536
|
*/
|
|
644
537
|
export type MintEvent = BaseEvent & {
|
|
645
|
-
|
|
538
|
+
eventType: AssetEventType.MINT | "mint"
|
|
646
539
|
/** Transaction hash */
|
|
647
540
|
transaction: string
|
|
648
541
|
/** Address the NFT was minted to */
|
|
649
|
-
|
|
542
|
+
toAddress: string
|
|
650
543
|
/** NFT that was minted */
|
|
651
544
|
nft: EventAsset
|
|
652
545
|
}
|
|
@@ -656,17 +549,17 @@ export type MintEvent = BaseEvent & {
|
|
|
656
549
|
* @category API Models
|
|
657
550
|
*/
|
|
658
551
|
export type SaleEvent = BaseEvent & {
|
|
659
|
-
|
|
552
|
+
eventType: AssetEventType.SALE | "sale"
|
|
660
553
|
/** Transaction hash */
|
|
661
554
|
transaction: string
|
|
662
555
|
/** Order hash */
|
|
663
|
-
|
|
556
|
+
orderHash: string
|
|
664
557
|
/** Protocol address */
|
|
665
|
-
|
|
558
|
+
protocolAddress: string
|
|
666
559
|
/** Payment information */
|
|
667
560
|
payment: EventPayment
|
|
668
561
|
/** Closing date of the sale */
|
|
669
|
-
|
|
562
|
+
closingDate: number
|
|
670
563
|
/** Seller address */
|
|
671
564
|
seller: string
|
|
672
565
|
/** Buyer address */
|
|
@@ -680,13 +573,13 @@ export type SaleEvent = BaseEvent & {
|
|
|
680
573
|
* @category API Models
|
|
681
574
|
*/
|
|
682
575
|
export type TransferEvent = BaseEvent & {
|
|
683
|
-
|
|
576
|
+
eventType: AssetEventType.TRANSFER | "transfer"
|
|
684
577
|
/** Transaction hash */
|
|
685
578
|
transaction: string
|
|
686
579
|
/** Address the NFT was transferred from */
|
|
687
|
-
|
|
580
|
+
fromAddress: string
|
|
688
581
|
/** Address the NFT was transferred to */
|
|
689
|
-
|
|
582
|
+
toAddress: string
|
|
690
583
|
/** NFT involved in the transfer */
|
|
691
584
|
nft: EventAsset
|
|
692
585
|
}
|
|
@@ -715,7 +608,7 @@ export type AssetEvent =
|
|
|
715
608
|
*/
|
|
716
609
|
export interface GetEventsArgs {
|
|
717
610
|
/** Type of event to filter by */
|
|
718
|
-
|
|
611
|
+
eventType?: AssetEventType | string
|
|
719
612
|
/** Filter events after this timestamp */
|
|
720
613
|
after?: number
|
|
721
614
|
/** Filter events before this timestamp */
|
|
@@ -746,7 +639,7 @@ export interface GetEventsByCollectionArgs extends GetEventsArgs {
|
|
|
746
639
|
*/
|
|
747
640
|
export type GetEventsResponse = QueryCursorsV2 & {
|
|
748
641
|
/** List of {@link AssetEvent} */
|
|
749
|
-
|
|
642
|
+
assetEvents: AssetEvent[]
|
|
750
643
|
}
|
|
751
644
|
|
|
752
645
|
/**
|
|
@@ -758,12 +651,17 @@ export type Contract = {
|
|
|
758
651
|
address: string
|
|
759
652
|
/** Chain the contract is deployed on */
|
|
760
653
|
chain: string
|
|
761
|
-
/**
|
|
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
|
+
*/
|
|
762
660
|
collection: string | null
|
|
763
661
|
/** Contract name */
|
|
764
662
|
name: string
|
|
765
663
|
/** Contract standard (e.g., erc721, erc1155) */
|
|
766
|
-
|
|
664
|
+
contractStandard: string
|
|
767
665
|
}
|
|
768
666
|
|
|
769
667
|
/**
|
|
@@ -803,6 +701,11 @@ export type GetTraitsResponse = {
|
|
|
803
701
|
|
|
804
702
|
/**
|
|
805
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
|
+
*
|
|
806
709
|
* @category API Models
|
|
807
710
|
*/
|
|
808
711
|
export type Token = {
|
|
@@ -816,10 +719,10 @@ export type Token = {
|
|
|
816
719
|
symbol: string
|
|
817
720
|
/** Number of decimals */
|
|
818
721
|
decimals: number
|
|
819
|
-
/** URL of the token image */
|
|
820
|
-
|
|
722
|
+
/** URL of the token image (null when the token has no image) */
|
|
723
|
+
imageUrl: string | null
|
|
821
724
|
/** URL on OpenSea */
|
|
822
|
-
|
|
725
|
+
openseaUrl: string
|
|
823
726
|
}
|
|
824
727
|
|
|
825
728
|
/**
|
|
@@ -857,26 +760,25 @@ export interface GetTokensArgs {
|
|
|
857
760
|
*/
|
|
858
761
|
export interface GetSwapQuoteArgs {
|
|
859
762
|
/** Address of the input token */
|
|
860
|
-
|
|
763
|
+
tokenIn: string
|
|
861
764
|
/** Address of the output token */
|
|
862
|
-
|
|
765
|
+
tokenOut: string
|
|
863
766
|
/** Amount of input token */
|
|
864
767
|
amount: string
|
|
865
768
|
/** Chain for the swap */
|
|
866
769
|
chain: string
|
|
867
770
|
/** Address of the taker */
|
|
868
|
-
|
|
771
|
+
takerAddress?: string
|
|
869
772
|
/** Slippage tolerance */
|
|
870
773
|
slippage?: number
|
|
871
774
|
}
|
|
872
775
|
|
|
873
776
|
/**
|
|
874
777
|
* Response from OpenSea API for fetching a swap quote.
|
|
778
|
+
* Camelized from api-types `SwapQuoteResponse`.
|
|
875
779
|
* @category API Response Types
|
|
876
780
|
*/
|
|
877
|
-
export type GetSwapQuoteResponse =
|
|
878
|
-
[key: string]: unknown
|
|
879
|
-
}
|
|
781
|
+
export type GetSwapQuoteResponse = Camelize<ApiSwapQuoteResponse>
|
|
880
782
|
|
|
881
783
|
/**
|
|
882
784
|
* Response from OpenSea API for fetching token details.
|
|
@@ -888,13 +790,13 @@ export type GetTokenResponse = Token
|
|
|
888
790
|
* Response from OpenSea API for fetching a token group by slug.
|
|
889
791
|
* @category API Response Types
|
|
890
792
|
*/
|
|
891
|
-
export type GetTokenGroupResponse = TokenGroupResponse
|
|
793
|
+
export type GetTokenGroupResponse = Camelize<TokenGroupResponse>
|
|
892
794
|
|
|
893
795
|
/**
|
|
894
796
|
* Response from OpenSea API for fetching a paginated list of token groups.
|
|
895
797
|
* @category API Response Types
|
|
896
798
|
*/
|
|
897
|
-
export type GetTokenGroupsResponse = TokenGroupPaginatedResponse
|
|
799
|
+
export type GetTokenGroupsResponse = Camelize<TokenGroupPaginatedResponse>
|
|
898
800
|
|
|
899
801
|
/**
|
|
900
802
|
* Query args for the Get Token Groups endpoint.
|
|
@@ -911,7 +813,7 @@ export interface GetTokenGroupsArgs {
|
|
|
911
813
|
* Response from OpenSea API for requesting an instant API key.
|
|
912
814
|
* @category API Response Types
|
|
913
815
|
*/
|
|
914
|
-
export type RequestInstantApiKeyResponse = InstantApiKeyResponse
|
|
816
|
+
export type RequestInstantApiKeyResponse = Camelize<InstantApiKeyResponse>
|
|
915
817
|
|
|
916
818
|
/**
|
|
917
819
|
* Query args for the Search endpoint.
|
|
@@ -923,7 +825,7 @@ export interface SearchArgs {
|
|
|
923
825
|
/** Filter by blockchain(s) */
|
|
924
826
|
chains?: string[]
|
|
925
827
|
/** Filter by asset type(s): collection, nft, token, account */
|
|
926
|
-
|
|
828
|
+
assetTypes?: string[]
|
|
927
829
|
/** Number of results to return (default: 20, max: 50) */
|
|
928
830
|
limit?: number
|
|
929
831
|
}
|
|
@@ -938,13 +840,13 @@ export type CollectionSearchResult = {
|
|
|
938
840
|
/** The collection name */
|
|
939
841
|
name: string
|
|
940
842
|
/** URL of the collection image */
|
|
941
|
-
|
|
843
|
+
imageUrl: string | null
|
|
942
844
|
/** Whether trading is disabled for this collection */
|
|
943
|
-
|
|
845
|
+
isDisabled: boolean
|
|
944
846
|
/** Whether this collection is marked as NSFW */
|
|
945
|
-
|
|
847
|
+
isNsfw: boolean
|
|
946
848
|
/** URL to the collection on OpenSea */
|
|
947
|
-
|
|
849
|
+
openseaUrl: string
|
|
948
850
|
}
|
|
949
851
|
|
|
950
852
|
/**
|
|
@@ -961,13 +863,13 @@ export type TokenSearchResult = {
|
|
|
961
863
|
/** Token symbol */
|
|
962
864
|
symbol: string
|
|
963
865
|
/** URL of the token image */
|
|
964
|
-
|
|
866
|
+
imageUrl: string | null
|
|
965
867
|
/** Current USD price of the token */
|
|
966
|
-
|
|
868
|
+
usdPrice: string
|
|
967
869
|
/** Number of decimal places for the token */
|
|
968
870
|
decimals: number
|
|
969
871
|
/** URL to the token on OpenSea */
|
|
970
|
-
|
|
872
|
+
openseaUrl: string
|
|
971
873
|
}
|
|
972
874
|
|
|
973
875
|
/**
|
|
@@ -984,9 +886,9 @@ export type NftSearchResult = {
|
|
|
984
886
|
/** Name of the NFT */
|
|
985
887
|
name: string | null
|
|
986
888
|
/** URL of the NFT image */
|
|
987
|
-
|
|
889
|
+
imageUrl: string | null
|
|
988
890
|
/** URL to the NFT on OpenSea */
|
|
989
|
-
|
|
891
|
+
openseaUrl: string
|
|
990
892
|
}
|
|
991
893
|
|
|
992
894
|
/**
|
|
@@ -999,9 +901,9 @@ export type AccountSearchResult = {
|
|
|
999
901
|
/** Username of the account */
|
|
1000
902
|
username: string | null
|
|
1001
903
|
/** URL of the account's profile image */
|
|
1002
|
-
|
|
904
|
+
profileImageUrl: string | null
|
|
1003
905
|
/** URL to the account on OpenSea */
|
|
1004
|
-
|
|
906
|
+
openseaUrl: string
|
|
1005
907
|
}
|
|
1006
908
|
|
|
1007
909
|
/**
|
|
@@ -1031,23 +933,11 @@ export type SearchResponse = {
|
|
|
1031
933
|
}
|
|
1032
934
|
|
|
1033
935
|
/**
|
|
1034
|
-
* 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).
|
|
1035
938
|
* @category API Models
|
|
1036
939
|
*/
|
|
1037
|
-
export type ChainInfo =
|
|
1038
|
-
/** The chain identifier slug used in API paths */
|
|
1039
|
-
chain: string
|
|
1040
|
-
/** Human-readable chain name */
|
|
1041
|
-
name: string
|
|
1042
|
-
/** Native currency symbol */
|
|
1043
|
-
symbol: string
|
|
1044
|
-
/** Whether token swaps are supported on this chain */
|
|
1045
|
-
supports_swaps: boolean
|
|
1046
|
-
/** Block explorer name */
|
|
1047
|
-
block_explorer: string
|
|
1048
|
-
/** Block explorer base URL */
|
|
1049
|
-
block_explorer_url: string
|
|
1050
|
-
}
|
|
940
|
+
export type ChainInfo = Camelize<ChainResponse>
|
|
1051
941
|
|
|
1052
942
|
/**
|
|
1053
943
|
* Response from OpenSea API for listing supported chains.
|
|
@@ -1059,31 +949,12 @@ export type GetChainsResponse = {
|
|
|
1059
949
|
}
|
|
1060
950
|
|
|
1061
951
|
/**
|
|
1062
|
-
* 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.
|
|
1063
955
|
* @category API Models
|
|
1064
956
|
*/
|
|
1065
|
-
export type TokenBalance =
|
|
1066
|
-
/** Token contract address */
|
|
1067
|
-
address: string
|
|
1068
|
-
/** Chain the token is on */
|
|
1069
|
-
chain: string
|
|
1070
|
-
/** Token name */
|
|
1071
|
-
name: string
|
|
1072
|
-
/** Token symbol */
|
|
1073
|
-
symbol: string
|
|
1074
|
-
/** URL of the token image */
|
|
1075
|
-
image_url?: string
|
|
1076
|
-
/** Current price in USD */
|
|
1077
|
-
usd_price: string
|
|
1078
|
-
/** Number of decimals */
|
|
1079
|
-
decimals: number
|
|
1080
|
-
/** Token balance in display units */
|
|
1081
|
-
quantity: string
|
|
1082
|
-
/** Total USD value of the balance */
|
|
1083
|
-
usd_value: string
|
|
1084
|
-
/** URL to the token page on OpenSea */
|
|
1085
|
-
opensea_url: string
|
|
1086
|
-
}
|
|
957
|
+
export type TokenBalance = Camelize<TokenBalanceResponse>
|
|
1087
958
|
|
|
1088
959
|
/**
|
|
1089
960
|
* Query args for Get Account Tokens endpoint.
|
|
@@ -1095,11 +966,11 @@ export interface GetAccountTokensArgs {
|
|
|
1095
966
|
/** Comma-separated chain identifiers to filter by */
|
|
1096
967
|
chains?: string[]
|
|
1097
968
|
/** Field to sort by */
|
|
1098
|
-
|
|
969
|
+
sortBy?: string
|
|
1099
970
|
/** Sort direction */
|
|
1100
|
-
|
|
971
|
+
sortDirection?: "asc" | "desc"
|
|
1101
972
|
/** Whether to disable spam filtering */
|
|
1102
|
-
|
|
973
|
+
disableSpamFiltering?: boolean
|
|
1103
974
|
/** Cursor for pagination */
|
|
1104
975
|
cursor?: string
|
|
1105
976
|
}
|
|
@@ -1110,67 +981,27 @@ export interface GetAccountTokensArgs {
|
|
|
1110
981
|
*/
|
|
1111
982
|
export type GetAccountTokensResponse = QueryCursorsV2 & {
|
|
1112
983
|
/** List of token balances */
|
|
1113
|
-
|
|
984
|
+
tokenBalances: TokenBalance[]
|
|
1114
985
|
}
|
|
1115
986
|
|
|
1116
987
|
/**
|
|
1117
|
-
* Drop summary returned by OpenSea API.
|
|
988
|
+
* Drop summary returned by OpenSea API. Sourced from api-types `DropResponse`.
|
|
1118
989
|
* @category API Models
|
|
1119
990
|
*/
|
|
1120
|
-
export type Drop =
|
|
1121
|
-
/** Collection slug */
|
|
1122
|
-
collection_slug: string
|
|
1123
|
-
/** Collection name */
|
|
1124
|
-
collection_name?: string
|
|
1125
|
-
/** Blockchain the drop is on */
|
|
1126
|
-
chain: string
|
|
1127
|
-
/** Contract address */
|
|
1128
|
-
contract_address: string
|
|
1129
|
-
/** Drop type */
|
|
1130
|
-
drop_type: string
|
|
1131
|
-
/** Whether the drop is currently minting */
|
|
1132
|
-
is_minting: boolean
|
|
1133
|
-
/** Collection image URL */
|
|
1134
|
-
image_url?: string
|
|
1135
|
-
/** OpenSea URL for the drop */
|
|
1136
|
-
opensea_url: string
|
|
1137
|
-
}
|
|
991
|
+
export type Drop = Camelize<DropResponse>
|
|
1138
992
|
|
|
1139
993
|
/**
|
|
1140
|
-
* Drop stage information.
|
|
994
|
+
* Drop stage information. Sourced from api-types `DropStageResponse`.
|
|
1141
995
|
* @category API Models
|
|
1142
996
|
*/
|
|
1143
|
-
export type DropStage =
|
|
1144
|
-
/** Stage UUID */
|
|
1145
|
-
uuid: string
|
|
1146
|
-
/** Stage type (e.g. public_sale) */
|
|
1147
|
-
stage_type: string
|
|
1148
|
-
/** Stage label/name */
|
|
1149
|
-
label?: string
|
|
1150
|
-
/** Mint price per token in wei */
|
|
1151
|
-
price?: string
|
|
1152
|
-
/** Currency contract address */
|
|
1153
|
-
price_currency_address: string
|
|
1154
|
-
/** Stage start time (ISO 8601) */
|
|
1155
|
-
start_time: string
|
|
1156
|
-
/** Stage end time (ISO 8601) */
|
|
1157
|
-
end_time: string
|
|
1158
|
-
/** Max tokens mintable per wallet in this stage */
|
|
1159
|
-
max_per_wallet: string
|
|
1160
|
-
}
|
|
997
|
+
export type DropStage = Camelize<DropStageResponse>
|
|
1161
998
|
|
|
1162
999
|
/**
|
|
1163
1000
|
* Detailed drop information including stages and supply.
|
|
1001
|
+
* Sourced from api-types `DropDetailedResponse`.
|
|
1164
1002
|
* @category API Models
|
|
1165
1003
|
*/
|
|
1166
|
-
export type DropDetailed =
|
|
1167
|
-
/** Drop stages (public sale, presale, etc.) */
|
|
1168
|
-
stages: DropStage[]
|
|
1169
|
-
/** Total minted supply */
|
|
1170
|
-
total_supply?: string
|
|
1171
|
-
/** Maximum supply */
|
|
1172
|
-
max_supply?: string
|
|
1173
|
-
}
|
|
1004
|
+
export type DropDetailed = Camelize<DropDetailedResponse>
|
|
1174
1005
|
|
|
1175
1006
|
/**
|
|
1176
1007
|
* Response from OpenSea API for fetching a list of drops.
|
|
@@ -1251,7 +1082,7 @@ export interface GetTrendingCollectionsArgs {
|
|
|
1251
1082
|
*/
|
|
1252
1083
|
export interface GetTopCollectionsArgs {
|
|
1253
1084
|
/** Sort by: one_day_volume, seven_days_volume, thirty_days_volume, floor_price, one_day_sales, etc. */
|
|
1254
|
-
|
|
1085
|
+
sortBy?: string
|
|
1255
1086
|
/** Blockchain(s) to filter by */
|
|
1256
1087
|
chains?: string[]
|
|
1257
1088
|
/** Category to filter by (e.g. art, gaming, pfps) */
|
|
@@ -1280,7 +1111,7 @@ export type ResolveAccountResponse = {
|
|
|
1280
1111
|
/** OpenSea username, if available */
|
|
1281
1112
|
username?: string
|
|
1282
1113
|
/** Primary ENS name, if available */
|
|
1283
|
-
|
|
1114
|
+
ensName?: string
|
|
1284
1115
|
}
|
|
1285
1116
|
|
|
1286
1117
|
/**
|
|
@@ -1326,53 +1157,88 @@ export type ValidateMetadataResponse = {
|
|
|
1326
1157
|
* Derived from the generated OpenAPI spec type to stay in sync automatically.
|
|
1327
1158
|
* @category API Response Types
|
|
1328
1159
|
*/
|
|
1329
|
-
export type GetNFTMetadataResponse = AssetMetadataResponse
|
|
1160
|
+
export type GetNFTMetadataResponse = Camelize<AssetMetadataResponse>
|
|
1330
1161
|
|
|
1331
|
-
// ─── Cross-chain fulfillment types
|
|
1332
|
-
//
|
|
1333
|
-
//
|
|
1334
|
-
//
|
|
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.
|
|
1335
1167
|
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
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,
|
|
1343
1199
|
} from "@opensea/api-types"
|
|
1344
1200
|
|
|
1345
|
-
//
|
|
1346
|
-
//
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
export type
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
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>
|
|
1376
1242
|
|
|
1377
1243
|
/**
|
|
1378
1244
|
* Query args for paginated collection-analytics endpoints (offer aggregates,
|
|
@@ -1382,7 +1248,7 @@ export type {
|
|
|
1382
1248
|
export interface PaginatedAnalyticsArgs {
|
|
1383
1249
|
limit?: number
|
|
1384
1250
|
cursor?: string
|
|
1385
|
-
|
|
1251
|
+
sortDirection?: "asc" | "desc"
|
|
1386
1252
|
}
|
|
1387
1253
|
|
|
1388
1254
|
/**
|
|
@@ -1391,7 +1257,7 @@ export interface PaginatedAnalyticsArgs {
|
|
|
1391
1257
|
* @category API Query Args
|
|
1392
1258
|
*/
|
|
1393
1259
|
export interface CollectionHoldersArgs extends PaginatedAnalyticsArgs {
|
|
1394
|
-
|
|
1260
|
+
ownedBy?: string
|
|
1395
1261
|
}
|
|
1396
1262
|
|
|
1397
1263
|
/**
|
|
@@ -1411,13 +1277,13 @@ export interface CollectionFloorPricesArgs {
|
|
|
1411
1277
|
*/
|
|
1412
1278
|
export interface TokenTimeSeriesArgs {
|
|
1413
1279
|
/** Start time (ISO 8601, required by the API). */
|
|
1414
|
-
|
|
1280
|
+
startTime: string
|
|
1415
1281
|
/** End time (ISO 8601, defaults to now). */
|
|
1416
|
-
|
|
1282
|
+
endTime?: string
|
|
1417
1283
|
/** Candle bucket size: 1s, 1m, 5m, 15m, 1h, 4h, 1d. */
|
|
1418
|
-
|
|
1284
|
+
bucketSize?: string
|
|
1419
1285
|
/** Whether to fill empty time windows with zero-volume candles (OHLCV only). */
|
|
1420
|
-
|
|
1286
|
+
fillTimeWindow?: boolean
|
|
1421
1287
|
}
|
|
1422
1288
|
|
|
1423
1289
|
/**
|
|
@@ -1455,10 +1321,10 @@ export interface PortfolioArgs {
|
|
|
1455
1321
|
export interface ProfileOrdersArgs {
|
|
1456
1322
|
after?: string
|
|
1457
1323
|
limit?: number
|
|
1458
|
-
|
|
1324
|
+
collectionSlugs?: string[]
|
|
1459
1325
|
chains?: string[]
|
|
1460
|
-
|
|
1461
|
-
|
|
1326
|
+
sortBy?: string
|
|
1327
|
+
sortDirection?: "asc" | "desc"
|
|
1462
1328
|
}
|
|
1463
1329
|
|
|
1464
1330
|
/**
|
|
@@ -1468,8 +1334,8 @@ export interface ProfileOrdersArgs {
|
|
|
1468
1334
|
export interface ProfileFavoritesArgs {
|
|
1469
1335
|
after?: string
|
|
1470
1336
|
limit?: number
|
|
1471
|
-
|
|
1472
|
-
|
|
1337
|
+
sortBy?: string
|
|
1338
|
+
sortDirection?: "asc" | "desc"
|
|
1473
1339
|
chains?: string[]
|
|
1474
1340
|
}
|
|
1475
1341
|
|
|
@@ -1487,16 +1353,16 @@ export interface ProfileCollectionsArgs {
|
|
|
1487
1353
|
* Response from the account favorites endpoint — favorited NFTs.
|
|
1488
1354
|
* @category API Response Types
|
|
1489
1355
|
*/
|
|
1490
|
-
export type ProfileFavoritesResponse = NftListResponse
|
|
1356
|
+
export type ProfileFavoritesResponse = Camelize<NftListResponse>
|
|
1491
1357
|
|
|
1492
1358
|
/**
|
|
1493
1359
|
* Response from the account profile listings endpoint.
|
|
1494
1360
|
* @category API Response Types
|
|
1495
1361
|
*/
|
|
1496
|
-
export type ProfileListingsResponse = ListingsResponse
|
|
1362
|
+
export type ProfileListingsResponse = Camelize<ListingsResponse>
|
|
1497
1363
|
|
|
1498
1364
|
/**
|
|
1499
1365
|
* Response from the account profile offers / offers_received endpoints.
|
|
1500
1366
|
* @category API Response Types
|
|
1501
1367
|
*/
|
|
1502
|
-
export type ProfileOffersResponse = OffersResponse
|
|
1368
|
+
export type ProfileOffersResponse = Camelize<OffersResponse>
|