@opensea/sdk 14.2.0 → 14.4.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/README.md +18 -1
- package/lib/api/collections.d.ts +2 -2
- package/lib/api/collections.js +2 -2
- package/lib/api/collections.js.map +1 -1
- package/lib/api/types.d.ts +5 -18
- package/lib/sdk/base.d.ts +9 -0
- package/package.json +2 -2
- package/src/api/collections.ts +6 -2
- package/src/api/types.ts +7 -18
package/README.md
CHANGED
|
@@ -108,10 +108,27 @@ the namespaced method of the same name, except four that were renamed; see the
|
|
|
108
108
|
|
|
109
109
|
### Optional discovery data
|
|
110
110
|
|
|
111
|
-
Existing methods accept opt-in data without changing their defaults. `api.collections.getCollectionOfferAggregates(slug, { includeDepth: true })` adds capped two-sided depth. `api.accounts.getAccount(address, { include: ["wallets"] })` expands public registered wallets.
|
|
111
|
+
Existing methods accept opt-in data without changing their defaults. `api.collections.getCollectionStats(slug, { volumeTimeframe: "seven_days" })` adds volume history; `api.collections.getCollectionOfferAggregates(slug, { includeDepth: true })` adds capped two-sided depth. `api.nfts.getNFTsByGroup(group, { includeCatalog: true })` requests optional catalog identities. The response omits them before unrestricted public launch or when no identity is available; this option does not bypass lab gating. `api.accounts.getAccount(address, { include: ["wallets"] })` expands public registered wallets.
|
|
112
|
+
|
|
113
|
+
Volume history is oldest first. Each bucket has a numeric Unix-seconds `time`, decimal-string `usd`, and `native` currency amount. Missing buckets are omitted, and the current bucket can be incomplete.
|
|
112
114
|
|
|
113
115
|
`api.nfts.getNFTsByCollection` keeps its first five positional arguments and accepts listing, price, rarity, numeric-trait and ordering filters as a sixth argument. See [the collection NFT parameters](developerDocs/api-reference.md#get-nfts-by-collection). Keep filters and ordering unchanged across cursor pages.
|
|
114
116
|
|
|
117
|
+
## Swap quotes for agents
|
|
118
|
+
|
|
119
|
+
`api.tokens.getSwapQuote` accepts `singleTransactionOnly` and `transactionFormat`.
|
|
120
|
+
`api.tokens.executeSwap` accepts both options and prepares transaction data for external signing
|
|
121
|
+
and submission.
|
|
122
|
+
|
|
123
|
+
The SDK returns camelCase response fields. `quote.routes` exposes `fromQuantity`, `toQuantity`,
|
|
124
|
+
and nullable `minToQuantity` as raw token-unit strings. The provider reports the minimum when available.
|
|
125
|
+
Verify the onchain floor independently. Solana transaction details can include unsigned
|
|
126
|
+
`serializedTransaction`, `blockhash`, `lastValidBlockHeight`, `requiresJitoBundle`, and nullable
|
|
127
|
+
`marketplaceFeeTransfer`. That field describes the reported OpenSea marketplace fee transfer.
|
|
128
|
+
|
|
129
|
+
Use an external Solana signer for serialized output, preserve the message bytes, and request a
|
|
130
|
+
new quote after its block-height expiry.
|
|
131
|
+
|
|
115
132
|
## Response casing
|
|
116
133
|
|
|
117
134
|
The API uses snake_case. The SDK converts response keys to camelCase, and converts camelCase
|
package/lib/api/collections.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Chain, OpenSeaCollection, OpenSeaCollectionStats } from "../types";
|
|
2
2
|
import type { Fetcher } from "./fetcher";
|
|
3
|
-
import { type BatchCollectionsRequest, type CollectionBatchResponse, type CollectionFloorPricesArgs, type CollectionHoldersArgs, type CollectionHoldersPaginatedResponse, type CollectionOfferAggregatesArgs, type CollectionOfferAggregatesPaginatedResponse, CollectionOrderByOption, type CollectionPfpProfilesResponse, type CreatorFeeEnforcementStatusResponse, type FloorPriceHistoryResponse, type GetCollectionPfpProfilesArgs, type GetCollectionsPaginatedResponse, type GetCollectionsResponse, type GetTopCollectionsArgs, type GetTopPfpCollectionsArgs, type GetTraitsResponse, type GetTrendingCollectionsArgs, type TopPfpCollectionsResponse, type TraitFloorsResponse } from "./types";
|
|
3
|
+
import { type BatchCollectionsRequest, type CollectionBatchResponse, type CollectionFloorPricesArgs, type CollectionHoldersArgs, type CollectionHoldersPaginatedResponse, type CollectionOfferAggregatesArgs, type CollectionOfferAggregatesPaginatedResponse, CollectionOrderByOption, type CollectionPfpProfilesResponse, type CollectionStatsArgs, type CreatorFeeEnforcementStatusResponse, type FloorPriceHistoryResponse, type GetCollectionPfpProfilesArgs, type GetCollectionsPaginatedResponse, type GetCollectionsResponse, type GetTopCollectionsArgs, type GetTopPfpCollectionsArgs, type GetTraitsResponse, type GetTrendingCollectionsArgs, type TopPfpCollectionsResponse, type TraitFloorsResponse } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* Collection-related API operations
|
|
6
6
|
*/
|
|
@@ -27,7 +27,7 @@ export declare class CollectionsAPI {
|
|
|
27
27
|
/**
|
|
28
28
|
* Fetch stats for an OpenSea collection.
|
|
29
29
|
*/
|
|
30
|
-
getCollectionStats(slug: string): Promise<OpenSeaCollectionStats>;
|
|
30
|
+
getCollectionStats(slug: string, args?: CollectionStatsArgs): Promise<OpenSeaCollectionStats>;
|
|
31
31
|
/**
|
|
32
32
|
* Fetch all traits for a collection with their possible values and counts.
|
|
33
33
|
*
|
package/lib/api/collections.js
CHANGED
|
@@ -47,9 +47,9 @@ class CollectionsAPI {
|
|
|
47
47
|
/**
|
|
48
48
|
* Fetch stats for an OpenSea collection.
|
|
49
49
|
*/
|
|
50
|
-
async getCollectionStats(slug) {
|
|
50
|
+
async getCollectionStats(slug, args) {
|
|
51
51
|
const path = (0, apiPaths_1.getCollectionStatsPath)(slug);
|
|
52
|
-
const response = await this.fetcher.get(path);
|
|
52
|
+
const response = await this.fetcher.get(path, args);
|
|
53
53
|
return response;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/api/collections.ts"],"names":[],"mappings":";;;AACA,yCAemB;AAEnB,
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/api/collections.ts"],"names":[],"mappings":";;;AACA,yCAemB;AAEnB,mCAwBgB;AAEhB;;GAEG;AACH;IACsB,OAAO;IAA3B,YAAoB,OAAgB;uBAAhB,OAAO;IAAY,CAAC;IAExC;;OAEG;I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KAAK,CAAC,wBAAwB,CAC5B,IAAY;QAEZ,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CACrB,IAAA,uCAA4B,EAAC,IAAI,CAAC,CACnC,CAAA;IACH,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,wBAAwB,CAC5B,IAAY,EACZ,IAAmC;QAEnC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CACrB,IAAA,uCAA4B,EAAC,IAAI,CAAC,EAClC,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,oBAAoB,CACxB,IAA8B;QAE9B,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,IAEnC,CAAA;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CACrB,IAAA,mCAAwB,GAAE,EAC1B,KAAK,CACN,CAAA;IACH,CAAC;CACF"}
|
package/lib/api/types.d.ts
CHANGED
|
@@ -702,24 +702,7 @@ export type TokenRankingSortBy = NonNullable<NonNullable<paths["/api/v2/tokens/t
|
|
|
702
702
|
* Query args for Get Swap Quote endpoint.
|
|
703
703
|
* @category API Query Args
|
|
704
704
|
*/
|
|
705
|
-
export
|
|
706
|
-
/** Chain of the token to swap from */
|
|
707
|
-
fromChain: string;
|
|
708
|
-
/** Contract address of the token to swap from */
|
|
709
|
-
fromAddress: string;
|
|
710
|
-
/** Chain of the token to swap to */
|
|
711
|
-
toChain: string;
|
|
712
|
-
/** Contract address of the token to swap to */
|
|
713
|
-
toAddress: string;
|
|
714
|
-
/** Amount to swap in the smallest unit of the token (e.g. wei for ETH) */
|
|
715
|
-
quantity: string;
|
|
716
|
-
/** Wallet address executing the swap */
|
|
717
|
-
address: string;
|
|
718
|
-
/** Slippage tolerance, 0.0 to 0.5 (default 0.01) */
|
|
719
|
-
slippage?: number;
|
|
720
|
-
/** Recipient address (defaults to the sender address) */
|
|
721
|
-
recipient?: string;
|
|
722
|
-
}
|
|
705
|
+
export type GetSwapQuoteArgs = Camelize<OperationQueryParams<"get_swap_quote">>;
|
|
723
706
|
/**
|
|
724
707
|
* Response from OpenSea API for fetching a swap quote.
|
|
725
708
|
* Camelized from api-types `SwapQuoteResponse`.
|
|
@@ -1246,6 +1229,8 @@ export type NFTGroupSortBy = "price" | "top_offer" | "last_sale" | "last_sale_da
|
|
|
1246
1229
|
* @category API Query Args
|
|
1247
1230
|
*/
|
|
1248
1231
|
export interface GetNFTsByGroupArgs extends NFTGroupFacetFilters {
|
|
1232
|
+
/** Request optional catalog identities; omitted before unrestricted public launch. */
|
|
1233
|
+
includeCatalog?: OperationQueryParams<"list_nfts_by_group">["include_catalog"];
|
|
1249
1234
|
/** Restrict results to these collections in the group (max 10). Defaults to the whole group. */
|
|
1250
1235
|
collectionSlugs?: string[];
|
|
1251
1236
|
/** Full-text match on NFT name, up to 100 characters. */
|
|
@@ -1447,6 +1432,8 @@ export type GetSignalResponse = Camelize<SignalResponse>;
|
|
|
1447
1432
|
export type ListSignalsResponse = Camelize<SignalsResponse>;
|
|
1448
1433
|
/** Indexed filters for collection NFTs. Numeric traits is a JSON array of traitType/min/max ranges. */
|
|
1449
1434
|
export type CollectionNFTFilters = Camelize<Pick<OperationQueryParams<"get_nfts_by_collection">, "is_listed" | "price_min" | "price_max" | "rarity_min" | "rarity_max" | "sort_by" | "sort_direction" | "numeric_traits">>;
|
|
1435
|
+
/** Optional volume buckets: numeric Unix seconds and decimal-string USD values. */
|
|
1436
|
+
export type CollectionStatsArgs = Camelize<OperationQueryParams<"get_collection_stats">>;
|
|
1450
1437
|
/** Optional capped two-sided collection depth. */
|
|
1451
1438
|
export type CollectionOfferAggregatesArgs = PaginatedAnalyticsArgs & Camelize<Pick<OperationQueryParams<"get_collection_offer_aggregates">, "include_depth">>;
|
|
1452
1439
|
/** Public account expansion; private registered wallets remain excluded. */
|
package/lib/sdk/base.d.ts
CHANGED
|
@@ -297,6 +297,15 @@ export declare class BaseOpenSeaSDK {
|
|
|
297
297
|
programId: string;
|
|
298
298
|
}[];
|
|
299
299
|
lastValidBlockHeight?: number | null | undefined;
|
|
300
|
+
marketplaceFeeTransfer?: {
|
|
301
|
+
decimals: number;
|
|
302
|
+
nativeToken: boolean;
|
|
303
|
+
rawAmount: string;
|
|
304
|
+
recipient: string;
|
|
305
|
+
recipientOwner?: string | null | undefined;
|
|
306
|
+
settlement: "separate_transfer" | "unknown";
|
|
307
|
+
tokenAddress: string;
|
|
308
|
+
} | null | undefined;
|
|
300
309
|
requiresJitoBundle: boolean;
|
|
301
310
|
serializedTransaction?: string | null | undefined;
|
|
302
311
|
transactionConfig?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensea/sdk",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.4.0",
|
|
4
4
|
"description": "TypeScript SDK for the OpenSea marketplace helps developers build new experiences using NFTs, tokens, and our marketplace data",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "OpenSea Developers",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"types": "lib/index.d.ts",
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@noble/hashes": "^2.0.1",
|
|
50
|
-
"@opensea/api-types": "^0.20.
|
|
50
|
+
"@opensea/api-types": "^0.20.2",
|
|
51
51
|
"@opensea/seaport-js": "^4.2.0",
|
|
52
52
|
"ethers": "^6.16.0"
|
|
53
53
|
},
|
package/src/api/collections.ts
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
type CollectionOfferAggregatesPaginatedResponse,
|
|
27
27
|
CollectionOrderByOption,
|
|
28
28
|
type CollectionPfpProfilesResponse,
|
|
29
|
+
type CollectionStatsArgs,
|
|
29
30
|
type CreatorFeeEnforcementStatusResponse,
|
|
30
31
|
type FloorPriceHistoryResponse,
|
|
31
32
|
type GetCollectionPfpProfilesArgs,
|
|
@@ -95,9 +96,12 @@ export class CollectionsAPI {
|
|
|
95
96
|
/**
|
|
96
97
|
* Fetch stats for an OpenSea collection.
|
|
97
98
|
*/
|
|
98
|
-
async getCollectionStats(
|
|
99
|
+
async getCollectionStats(
|
|
100
|
+
slug: string,
|
|
101
|
+
args?: CollectionStatsArgs,
|
|
102
|
+
): Promise<OpenSeaCollectionStats> {
|
|
99
103
|
const path = getCollectionStatsPath(slug)
|
|
100
|
-
const response = await this.fetcher.get<OpenSeaCollectionStats>(path)
|
|
104
|
+
const response = await this.fetcher.get<OpenSeaCollectionStats>(path, args)
|
|
101
105
|
return response as OpenSeaCollectionStats
|
|
102
106
|
}
|
|
103
107
|
|
package/src/api/types.ts
CHANGED
|
@@ -879,24 +879,7 @@ export type TokenRankingSortBy = NonNullable<
|
|
|
879
879
|
* Query args for Get Swap Quote endpoint.
|
|
880
880
|
* @category API Query Args
|
|
881
881
|
*/
|
|
882
|
-
export
|
|
883
|
-
/** Chain of the token to swap from */
|
|
884
|
-
fromChain: string
|
|
885
|
-
/** Contract address of the token to swap from */
|
|
886
|
-
fromAddress: string
|
|
887
|
-
/** Chain of the token to swap to */
|
|
888
|
-
toChain: string
|
|
889
|
-
/** Contract address of the token to swap to */
|
|
890
|
-
toAddress: string
|
|
891
|
-
/** Amount to swap in the smallest unit of the token (e.g. wei for ETH) */
|
|
892
|
-
quantity: string
|
|
893
|
-
/** Wallet address executing the swap */
|
|
894
|
-
address: string
|
|
895
|
-
/** Slippage tolerance, 0.0 to 0.5 (default 0.01) */
|
|
896
|
-
slippage?: number
|
|
897
|
-
/** Recipient address (defaults to the sender address) */
|
|
898
|
-
recipient?: string
|
|
899
|
-
}
|
|
882
|
+
export type GetSwapQuoteArgs = Camelize<OperationQueryParams<"get_swap_quote">>
|
|
900
883
|
|
|
901
884
|
/**
|
|
902
885
|
* Response from OpenSea API for fetching a swap quote.
|
|
@@ -1582,6 +1565,8 @@ export type NFTGroupSortBy =
|
|
|
1582
1565
|
* @category API Query Args
|
|
1583
1566
|
*/
|
|
1584
1567
|
export interface GetNFTsByGroupArgs extends NFTGroupFacetFilters {
|
|
1568
|
+
/** Request optional catalog identities; omitted before unrestricted public launch. */
|
|
1569
|
+
includeCatalog?: OperationQueryParams<"list_nfts_by_group">["include_catalog"]
|
|
1585
1570
|
/** Restrict results to these collections in the group (max 10). Defaults to the whole group. */
|
|
1586
1571
|
collectionSlugs?: string[]
|
|
1587
1572
|
/** Full-text match on NFT name, up to 100 characters. */
|
|
@@ -1827,6 +1812,10 @@ export type CollectionNFTFilters = Camelize<
|
|
|
1827
1812
|
| "numeric_traits"
|
|
1828
1813
|
>
|
|
1829
1814
|
>
|
|
1815
|
+
/** Optional volume buckets: numeric Unix seconds and decimal-string USD values. */
|
|
1816
|
+
export type CollectionStatsArgs = Camelize<
|
|
1817
|
+
OperationQueryParams<"get_collection_stats">
|
|
1818
|
+
>
|
|
1830
1819
|
/** Optional capped two-sided collection depth. */
|
|
1831
1820
|
export type CollectionOfferAggregatesArgs = PaginatedAnalyticsArgs &
|
|
1832
1821
|
Camelize<
|