Skip to content

Commit 545feec

Browse files
committed
Release v11.4.0
Origin-SHA: f6f7bb6935b34b86858e8a800e61e4a225ee7bcc
1 parent 1944199 commit 545feec

16 files changed

Lines changed: 595 additions & 38 deletions

CHANGELOG.md

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

3+
## 11.4.0
4+
5+
### Minor Changes
6+
7+
- df2b152: Add SIWX wallet-link helpers for nonce, message, and link flows.
8+
- 4bef9a5: Add typed `api.walletAuth` helpers for all 29 scoped wallet operations.
9+
10+
### Patch Changes
11+
12+
- 2459068: Align wallet-auth scope metadata with the production OpenAPI specification.
13+
- 0df96eb: Enable Seaport support for Robinhood chain. Canonical Seaport 1.6 is deployed on Robinhood (chain id 4663) and configured in the marketplace backend, so the payment-token helpers no longer throw for it: offers use WETH `0x0bd7d308f8e1639fab988df18a8011f41eacad73`, listings use native ETH, and the chain uses the same default conduit as Abstract, HyperEVM, and Monad.
14+
- Updated dependencies [df2b152]
15+
- Updated dependencies [2459068]
16+
- Updated dependencies [4bef9a5]
17+
- @opensea/api-types@0.8.0
18+
319
## 11.3.0
420

521
### Minor Changes

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,29 @@ curl -s -X POST https://api.opensea.io/api/v2/auth/keys | jq -r '.api_key'
3939

4040
Happy seafaring!
4141

42+
### Wallet-authenticated API helpers
43+
44+
Pass an exchanged scoped JWT as `authToken`, then use the generated
45+
`walletAuth` helpers. Server-side allowlist and scope enforcement still apply.
46+
47+
```typescript
48+
import { OpenSeaAPI } from "@opensea/sdk"
49+
50+
const api = new OpenSeaAPI({
51+
apiKey: process.env.OPENSEA_API_KEY,
52+
authToken: process.env.OPENSEA_AUTH_TOKEN,
53+
})
54+
55+
const favorites = await api.walletAuth.getFavorites("0xYOUR_WALLET", {
56+
limit: 10,
57+
})
58+
await api.walletAuth.updateProfileSettings({ bio: "Building with OpenSea" })
59+
```
60+
61+
The helper request and response types are generated from the deployed OpenAPI
62+
operations. Drops, collections, profile shelves, favorites/watchlists, order
63+
cancellation, and wallet link/unlink are covered.
64+
4265
## Quick Start
4366

4467
### With ethers.js

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": "11.3.0",
3+
"version": "11.4.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.7.0",
48+
"@opensea/api-types": "^0.8.0",
4949
"@opensea/seaport-js": "^4.1.1",
5050
"ethers": "^6.16.0"
5151
},

src/api/api.ts

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { ChainsAPI } from "./chains"
2424
import { CollectionsAPI } from "./collections"
2525
import { DropsAPI } from "./drops"
2626
import { EventsAPI } from "./events"
27-
import type { PostOptions } from "./fetcher"
27+
import type { HttpMethod, PostOptions } from "./fetcher"
2828
import { ListingsAPI } from "./listings"
2929
import { NFTsAPI } from "./nfts"
3030
import { OffersAPI } from "./offers"
@@ -134,6 +134,7 @@ import {
134134
type WalletPnlResponse,
135135
type WalletTokenTransfersArgs,
136136
} from "./types"
137+
import { WalletAuthAPI } from "./walletAuth"
137138

138139
/**
139140
* The API class for the OpenSea SDK.
@@ -171,6 +172,8 @@ export class OpenSeaAPI {
171172
private dropsAPI: DropsAPI
172173
private transactionsAPI: TransactionsAPI
173174
private assetsAPI: AssetsAPI
175+
/** Wallet-authenticated scoped REST helpers. */
176+
public readonly walletAuth: WalletAuthAPI
174177

175178
/**
176179
* Create an instance of the OpenSeaAPI
@@ -195,6 +198,7 @@ export class OpenSeaAPI {
195198
const fetcher = {
196199
get: this.get.bind(this),
197200
post: this.post.bind(this),
201+
request: this.request.bind(this),
198202
}
199203

200204
// Initialize specialized API clients
@@ -211,6 +215,7 @@ export class OpenSeaAPI {
211215
this.dropsAPI = new DropsAPI(fetcher)
212216
this.transactionsAPI = new TransactionsAPI(fetcher)
213217
this.assetsAPI = new AssetsAPI(fetcher)
218+
this.walletAuth = new WalletAuthAPI(fetcher)
214219
}
215220

216221
/**
@@ -1338,7 +1343,7 @@ export class OpenSeaAPI {
13381343
const url = qs
13391344
? `${this.apiBaseUrl}${apiPath}?${qs}`
13401345
: `${this.apiBaseUrl}${apiPath}`
1341-
const raw = await this._fetch(url, undefined, undefined, options)
1346+
const raw = await this._fetch(url, "GET", undefined, undefined, options)
13421347
return camelizeKeysDeep(raw) as Camelize<T>
13431348
},
13441349
{ logger: this.logger },
@@ -1361,6 +1366,17 @@ export class OpenSeaAPI {
13611366
body?: object,
13621367
headers?: object,
13631368
options?: PostOptions,
1369+
): Promise<Camelize<T>> {
1370+
return this.request("POST", apiPath, body, headers, options)
1371+
}
1372+
1373+
/** Send a typed JSON request to a write endpoint. */
1374+
public async request<T>(
1375+
method: HttpMethod,
1376+
apiPath: string,
1377+
body?: object,
1378+
headers?: object,
1379+
options?: PostOptions,
13641380
): Promise<Camelize<T>> {
13651381
return executeWithRateLimit(
13661382
async () => {
@@ -1372,7 +1388,7 @@ export class OpenSeaAPI {
13721388
const shouldSnakeize = options?.snakeizeBody !== false
13731389
const wireBody =
13741390
body == null || !shouldSnakeize ? body : snakeizeKeysDeep(body)
1375-
const raw = await this._fetch(url, headers, wireBody, options)
1391+
const raw = await this._fetch(url, method, headers, wireBody, options)
13761392
return camelizeKeysDeep(raw) as Camelize<T>
13771393
},
13781394
{ logger: this.logger },
@@ -1400,14 +1416,14 @@ export class OpenSeaAPI {
14001416
/**
14011417
* Fetch from an API Endpoint, sending auth token in headers
14021418
* @param url The URL to fetch
1419+
* @param method HTTP method to use.
14031420
* @param headers Additional headers to send with the request
1404-
* @param body Optional body to send. HTTP method is inferred: POST if body is
1405-
* provided (non-nullish), GET otherwise. This covers all OpenSea API
1406-
* endpoints which only use GET and POST.
1421+
* @param body Optional JSON body to send.
14071422
* @param options Request options like timeout and abort signal
14081423
*/
14091424
private async _fetch(
14101425
url: string,
1426+
method: "GET" | HttpMethod,
14111427
headers?: object,
14121428
body?: object,
14131429
options?: RequestOptions,
@@ -1426,7 +1442,7 @@ export class OpenSeaAPI {
14261442
delete sanitizedHeaders.Authorization
14271443
this.logger(
14281444
`Sending request: ${url} ${JSON.stringify({
1429-
method: body != null ? "POST" : "GET",
1445+
method,
14301446
headers: sanitizedHeaders,
14311447
body: body != null ? JSON.stringify(body, null, 2) : undefined,
14321448
})}`,
@@ -1460,7 +1476,7 @@ export class OpenSeaAPI {
14601476

14611477
try {
14621478
const response = await fetch(url, {
1463-
method: body != null ? "POST" : "GET",
1479+
method,
14641480
headers: mergedHeaders,
14651481
body: body != null ? JSON.stringify(body) : undefined,
14661482
signal,
@@ -1497,7 +1513,14 @@ export class OpenSeaAPI {
14971513
`Server Error (${response.status}): ${response.statusText}`,
14981514
)
14991515
}
1500-
return response.json()
1516+
if (
1517+
response.status === 204 ||
1518+
response.headers.get("content-length") === "0"
1519+
) {
1520+
return undefined
1521+
}
1522+
const text = await response.text()
1523+
return text.length > 0 ? JSON.parse(text) : undefined
15011524
} finally {
15021525
if (timeoutId !== undefined) {
15031526
clearTimeout(timeoutId)

src/api/fetcher.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export interface PostOptions extends RequestOptions {
2525
snakeizeBody?: boolean
2626
}
2727

28+
export type HttpMethod = "POST" | "PUT" | "PATCH" | "DELETE"
29+
2830
/**
2931
* Fetcher context interface for making HTTP requests to the OpenSea API.
3032
* This interface abstracts the HTTP methods used by specialized API clients.
@@ -64,3 +66,14 @@ export interface Fetcher {
6466
options?: PostOptions,
6567
): Promise<Camelize<T>>
6668
}
69+
70+
/** Fetcher used by scoped wallet helpers that need every write verb. */
71+
export interface WalletAuthFetcher extends Fetcher {
72+
request<T>(
73+
method: HttpMethod,
74+
apiPath: string,
75+
body?: object,
76+
headers?: object,
77+
options?: PostOptions,
78+
): Promise<Camelize<T>>
79+
}

src/api/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from "./api"
22
export * from "./fetcher"
3+
export * from "./walletAuth"

0 commit comments

Comments
 (0)