Skip to content

Commit 092a40c

Browse files
committed
Release v10.5.0
Origin-SHA: 177a890fa9ab1976057dbe4c712f5179411215db
1 parent 97156b9 commit 092a40c

12 files changed

Lines changed: 947 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# @opensea/sdk
22

3+
## 10.5.0
4+
5+
### Minor Changes
6+
7+
- 051b558: Surface 22 new endpoints added in `@opensea/api-types` 0.4.0 as SDK methods and CLI commands.
8+
9+
**`@opensea/sdk`** — new methods on `OpenSeaAPI` (and the underlying domain clients):
10+
11+
- `getTokensBatch`, `getNFTsBatch`, `getCollectionsBatch` — batch lookups
12+
- `createListingActions` — ordered approval + Seaport-sign actions for new listings
13+
- `deployDropContract`, `getDeployContractReceipt` — drop contract deployment
14+
- `transferAssets` — build transactions to transfer NFTs or tokens
15+
- `getCollectionOfferAggregates`, `getCollectionHolders`, `getCollectionFloorPrices` — collection analytics
16+
- `getTokenPriceHistory`, `getTokenOhlcv`, `getTokenActivity` — token analytics
17+
- `getNFTOwners`, `getNFTAnalytics` — NFT analytics
18+
- `getPortfolioStats`, `getPortfolioHistory`, `getProfileOffers`, `getProfileOffersReceived`, `getProfileListings`, `getProfileFavorites`, `getProfileCollections` — account profile
19+
20+
New internal `AssetsAPI` client; new request/response types re-exported through `@opensea/sdk` (from `@opensea/api-types`).
21+
22+
**`@opensea/cli`** — new commands on the existing `accounts`, `collections`, `nfts`, `tokens`, `listings`, `drops` subcommands, plus a new `assets transfer` subcommand. SDK class methods mirroring the same surface added to `OpenSeaCLI`.
23+
24+
No removed endpoints; pure additive release.
25+
326
## 10.4.0
427

528
### Minor Changes

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opensea/sdk",
3-
"version": "10.4.0",
3+
"version": "10.5.0",
44
"description": "TypeScript SDK for the OpenSea marketplace helps developers build new experiences using NFTs, tokens, and our marketplace data",
55
"license": "MIT",
66
"author": "OpenSea Developers",
@@ -45,7 +45,7 @@
4545
"types": "lib/index.d.ts",
4646
"dependencies": {
4747
"@noble/hashes": "^2.0.1",
48-
"@opensea/api-types": "^0.3.0",
48+
"@opensea/api-types": "^0.4.0",
4949
"@opensea/seaport-js": "^4.1.1",
5050
"ethers": "^6.16.0"
5151
},

src/api/accounts.ts

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,36 @@ import {
44
getAccountPath,
55
getAccountTokensPath,
66
getPaymentTokenPath,
7+
getPortfolioHistoryPath,
8+
getPortfolioStatsPath,
9+
getProfileCollectionsPath,
10+
getProfileFavoritesPath,
11+
getProfileListingsPath,
12+
getProfileOffersPath,
13+
getProfileOffersReceivedPath,
714
getResolveAccountPath,
815
} from "./apiPaths"
916
import type { Fetcher } from "./fetcher"
1017
import type {
1118
GetAccountTokensArgs,
1219
GetAccountTokensResponse,
20+
PortfolioArgs,
21+
PortfolioHistoryResponse,
22+
PortfolioStatsResponse,
23+
ProfileCollectionsArgs,
24+
ProfileCollectionsResponse,
25+
ProfileFavoritesArgs,
26+
ProfileFavoritesResponse,
27+
ProfileListingsResponse,
28+
ProfileOffersResponse,
29+
ProfileOrdersArgs,
1330
ResolveAccountResponse,
1431
} from "./types"
1532

33+
function joinArray(value: string[] | undefined): string | undefined {
34+
return value && value.length > 0 ? value.join(",") : undefined
35+
}
36+
1637
/**
1738
* Account and payment token related API operations
1839
*/
@@ -66,4 +87,113 @@ export class AccountsAPI {
6687
)
6788
return response
6889
}
90+
91+
/**
92+
* Get portfolio stats (net worth, P&L) for an account.
93+
*/
94+
async getPortfolioStats(
95+
address: string,
96+
args?: PortfolioArgs,
97+
): Promise<PortfolioStatsResponse> {
98+
return this.fetcher.get<PortfolioStatsResponse>(
99+
getPortfolioStatsPath(address),
100+
args,
101+
)
102+
}
103+
104+
/**
105+
* Get portfolio net-worth history for an account.
106+
*/
107+
async getPortfolioHistory(
108+
address: string,
109+
args?: PortfolioArgs,
110+
): Promise<PortfolioHistoryResponse> {
111+
return this.fetcher.get<PortfolioHistoryResponse>(
112+
getPortfolioHistoryPath(address),
113+
args,
114+
)
115+
}
116+
117+
/**
118+
* Get offers received by an account, scoped by collection/chain.
119+
*/
120+
async getProfileOffersReceived(
121+
address: string,
122+
args?: ProfileOrdersArgs,
123+
): Promise<ProfileOffersResponse> {
124+
return this.fetcher.get<ProfileOffersResponse>(
125+
getProfileOffersReceivedPath(address),
126+
{
127+
...args,
128+
collection_slugs: joinArray(args?.collection_slugs),
129+
chains: joinArray(args?.chains),
130+
},
131+
)
132+
}
133+
134+
/**
135+
* Get active offers made by an account.
136+
*/
137+
async getProfileOffers(
138+
address: string,
139+
args?: ProfileOrdersArgs,
140+
): Promise<ProfileOffersResponse> {
141+
return this.fetcher.get<ProfileOffersResponse>(
142+
getProfileOffersPath(address),
143+
{
144+
...args,
145+
collection_slugs: joinArray(args?.collection_slugs),
146+
chains: joinArray(args?.chains),
147+
},
148+
)
149+
}
150+
151+
/**
152+
* Get active listings for an account.
153+
*/
154+
async getProfileListings(
155+
address: string,
156+
args?: ProfileOrdersArgs,
157+
): Promise<ProfileListingsResponse> {
158+
return this.fetcher.get<ProfileListingsResponse>(
159+
getProfileListingsPath(address),
160+
{
161+
...args,
162+
collection_slugs: joinArray(args?.collection_slugs),
163+
chains: joinArray(args?.chains),
164+
},
165+
)
166+
}
167+
168+
/**
169+
* Get items favorited by an account.
170+
*/
171+
async getProfileFavorites(
172+
address: string,
173+
args?: ProfileFavoritesArgs,
174+
): Promise<ProfileFavoritesResponse> {
175+
return this.fetcher.get<ProfileFavoritesResponse>(
176+
getProfileFavoritesPath(address),
177+
{
178+
...args,
179+
chains: joinArray(args?.chains),
180+
},
181+
)
182+
}
183+
184+
/**
185+
* Get collections owned by an account.
186+
*/
187+
async getProfileCollections(
188+
address: string,
189+
args?: ProfileCollectionsArgs,
190+
): Promise<ProfileCollectionsResponse> {
191+
return this.fetcher.get<ProfileCollectionsResponse>(
192+
getProfileCollectionsPath(address),
193+
{
194+
...args,
195+
chains: joinArray(args?.chains),
196+
},
197+
)
198+
}
69199
}

0 commit comments

Comments
 (0)