Skip to content

Commit 5be5f2b

Browse files
committed
Release v11.9.0
Origin-SHA: 6868dd473476a5fc15f49366d865a6ec4e2e065d
1 parent 59a0152 commit 5be5f2b

38 files changed

Lines changed: 4719 additions & 284 deletions

.config/typedoc.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

AGENTS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pnpm run lint
1616
## Responsibilities
1717

1818
- Provide `OpenSeaSDK` (ethers) and `OpenSeaViemSDK` (viem) entry points.
19+
- Provide the Stream API client at the `@opensea/sdk/stream` subpath.
1920
- Camelize API responses and expose typed helpers for orders, fulfillment, assets, and wallet auth.
2021
- Keep the `Chain` enum in sync with `ChainIdentifier` from `@opensea/api-types`.
2122

@@ -26,9 +27,20 @@ pnpm run lint
2627
3. **Dual provider support**. Changes to `BaseOpenSeaSDK` affect both ethers and viem paths; update both provider adapters if provider-specific logic changes.
2728
4. **OAuth token contract**. `OpenSeaOAuth` requests `offline_access`; refresh responses may omit rotation — keep the previous refresh token. The top-level `wallet` JWT claim is wallet identity; `sub` is an account id.
2829
5. **No secret leakage**. API keys live in `OpenSeaAPIConfig.apiKey`; never log them.
30+
6. **Stream stays on its own subpath**. `EventType`, `Trait`, `TraitOfferEvent`,
31+
and `CollectionOfferEvent` exist in both surfaces with different shapes, so
32+
`src/stream/` must never be re-exported from `src/index.ts`.
33+
7. **The stream transport is internal**. `src/stream/transport/` is not exported
34+
from `src/stream/index.ts`. Stream API v2 will not speak Phoenix Channels, so
35+
the interface must stay free to change without a breaking release. Client code
36+
talks to `StreamTransport`, never to `PhoenixChannelsTransport` directly.
37+
8. **No dependency for the stream client**. `@opensea/sdk/stream` resolves to six
38+
local files and nothing else. Verify with a require-graph walk before adding
39+
any import there.
2940

3041
## Conventions
3142

3243
- CommonJS (`"type": "commonjs"`) for broad consumer support.
44+
- Node 22+ is the floor. The stream client relies on a global `WebSocket`.
3345
- `viem` is an optional peer dependency; main entry uses ethers.
3446
- Prefer `string` for decimal `Amount` values.

CHANGELOG.md

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

3+
## 11.9.0
4+
5+
### Minor Changes
6+
7+
- d355093: Three fixes from community reports on the public mirror, each of which changes behavior for input that previously produced a wrong answer or an unhelpful crash.
8+
9+
**`getTraits` no longer camelizes its response.** The fetcher rewrites every response's keys from snake_case to camelCase, which is right for the spec-derived endpoints and wrong for this one: its keys are the collection's own trait names and trait values. A `fur_color` trait was reported as `furColor`, and a collection with both `dark_brown` and `darkBrown` values had them merged into one entry whose count was wrong, with nothing in the response to indicate it. `RequestOptions` gains a `camelizeResponse` opt-out, honored by both reads and writes, and `getTraits` is the only caller that sets it. If you have been reading camelized trait keys since 11.0.0, they now come back as the collection authored them. (ProjectOpenSea/opensea-js#1989)
10+
11+
**`parseUnits` accepts scientific notation from strings.** It only stripped exponent notation when the value was a `number`, so `parseUnits("1e-8", 18)` reached `BigInt` intact and threw `Cannot convert 1e-8000000000000000000 to a BigInt`. Any caller that stringifies an amount first hit this, including the SDK's own `wrapEth`, `unwrapWeth`, and listing/offer price paths, which all call `amount.toString()`. Expansion is now done with string math rather than `Number.prototype.toFixed`, so large values stay exact (`toFixed` corrupts above 2^53 and returns exponential notation again at or above 1e21) and a value below the token's precision throws `Too many decimal places` rather than silently truncating to zero. Malformed input now throws `Invalid decimal value` instead of a raw `SyntaxError` from `BigInt`, and an empty string throws rather than parsing as `0`. (ProjectOpenSea/opensea-js#1990)
12+
13+
**Private listings reject payment items in different tokens.** `constructPrivateListingCounterOrder` checked that every payment item shared an `itemType` but not that they shared a token, then summed them into a single offer item denominated in the first item's token: 100 TOKEN_A plus 20 TOKEN_B became 120 TOKEN_A. Seaport rejected the resulting match, so the failure surfaced as an onchain revert instead of an SDK error. Token comparison is case-insensitive, so the same address in checksummed and lowercase form is still one currency. (ProjectOpenSea/opensea-js#1991)
14+
15+
- 8527112: Add the OpenSea Stream API client at the `@opensea/sdk/stream` subpath, replacing the standalone `@opensea/stream-js` package.
16+
17+
The client speaks the Phoenix Channels wire protocol directly instead of depending on `phoenix`, so the subpath resolves to six local files and no third-party runtime code. Importing it pulls in neither ethers nor seaport. The transport sits behind an internal interface so a future Stream API v2, which will not use Phoenix framing, can be added without a breaking change.
18+
19+
Migrating from `@opensea/stream-js` is mostly an import change. See `developerDocs/stream-migration.md`.
20+
21+
- Node users no longer need `ws` or `node-localstorage`. Node 22+ and browsers supply a global `WebSocket`, and `sessionStorage` was only read by an unused long-poll fallback.
22+
- `apiKey` replaces `token` in `ClientConfig`. `token` still works and is deprecated.
23+
- `connectOptions` is now `StreamConnectOptions` rather than `Partial<SocketConnectOption>` from `@types/phoenix`. Options that only fed the long-poll fallback and binary serializer are gone.
24+
- Unsubscribing now removes a single handler instead of leaving the whole collection channel. Previously, two subscriptions on one collection meant unsubscribing from one silently stopped the other.
25+
- `engines.node` is raised to `>=22.0.0`. Node 20 reached end of life in April 2026.
26+
27+
### Patch Changes
28+
29+
- 8715ac2: Point the package metadata at the renamed public repo, `ProjectOpenSea/opensea-sdk`. `repository.url` and `bugs.url` both moved, so the npm page links to the right place rather than relying on GitHub's rename redirect. The npm package name is unchanged.
30+
31+
Also drops the TypeDoc setup that fed the GitHub Pages site at `projectopensea.github.io/opensea-js`. Nothing published it: no workflow built the `gh-pages` branch, so the site had been serving v8.0.20 docs against a shipped 11.8.0 for months. The `docs-build` and `docs-build-md` scripts, the `typedoc` and `typedoc-plugin-markdown` devDependencies, and `.config/typedoc.json` are gone, along with the dead Coveralls badge (that project returns 403 and no CI job has uploaded coverage in a long time). Method-level reference docs live in `developerDocs/api-reference.md`.
32+
333
## 11.8.0
434

535
### Minor Changes

README.md

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
[![Version][version-badge]][version-link]
66
[![npm][npm-badge]][npm-link]
77
[![Test CI][ci-badge]][ci-link]
8-
[![Coverage Status][coverage-badge]][coverage-link]
98
[![License][license-badge]][license-link]
109
[![Docs][docs-badge]][docs-link]
1110
[![Discussions][discussions-badge]][discussions-link]
@@ -135,13 +134,48 @@ console.log(activity.windows["24h"]?.volumeUsd)
135134
The SDK exposes camel-cased fields. A requested window is absent when the token
136135
has no swaps in that period.
137136

137+
### Real-time events
138+
139+
Subscribe to marketplace events over WebSocket from the `@opensea/sdk/stream`
140+
subpath. Streaming events do not count toward your API rate limits.
141+
142+
```typescript
143+
import { OpenSeaStreamClient, EventType } from "@opensea/sdk/stream";
144+
145+
const client = new OpenSeaStreamClient({ apiKey: "YOUR_API_KEY" });
146+
147+
// Listings for one collection, by slug
148+
const unsubscribe = client.onItemListed("doodles-official", event => {
149+
console.log(event.payload.item.nft_id, event.payload.base_price);
150+
});
151+
152+
// Sales across every collection
153+
client.onItemSold("*", event => console.log(event.payload.sale_price));
154+
155+
// Several event types at once, filtered server-side
156+
client.onEvents(
157+
"doodles-official",
158+
[EventType.ITEM_SOLD, EventType.ITEM_CANCELLED],
159+
console.log,
160+
);
161+
162+
unsubscribe();
163+
```
164+
165+
Node 22 or newer, or any browser, needs no extra dependencies. The client
166+
reconnects with backoff and re-subscribes to every topic it was watching, so a
167+
dropped connection recovers without any work from you.
168+
169+
This code was published as `@opensea/stream-js` until version 0.4.0. See the
170+
[migration guide](developerDocs/stream-migration.md) for the differences.
171+
138172
## Documentation
139173

140174
- [Quick Start Guide](developerDocs/quick-start.md)
141175
- [Getting Started Guide](developerDocs/getting-started.md)
142176
- [API Reference](developerDocs/api-reference.md)
177+
- [Stream migration from @opensea/stream-js](developerDocs/stream-migration.md)
143178
- [Advanced Use Cases](developerDocs/advanced-use-cases.md)
144-
- [SDK Reference](https://projectopensea.github.io/opensea-js/)
145179
- [Frequently Asked Questions](developerDocs/faq.md)
146180
- [Contributing](CONTRIBUTING.md)
147181

@@ -164,20 +198,18 @@ For frontend applications that need to interact with OpenSea functionality:
164198

165199
The changelog for recent versions can be found at:
166200

167-
- @opensea/sdk: https://github.com/ProjectOpenSea/opensea-js/releases
201+
- @opensea/sdk: https://github.com/ProjectOpenSea/opensea-sdk/releases
168202
- OpenSea API: https://docs.opensea.io/changelog
169203

170-
[version-badge]: https://img.shields.io/github/package-json/v/ProjectOpenSea/opensea-js
171-
[version-link]: https://github.com/ProjectOpenSea/opensea-js/releases
204+
[version-badge]: https://img.shields.io/github/package-json/v/ProjectOpenSea/opensea-sdk
205+
[version-link]: https://github.com/ProjectOpenSea/opensea-sdk/releases
172206
[npm-badge]: https://img.shields.io/npm/v/@opensea/sdk?color=red
173207
[npm-link]: https://www.npmjs.com/package/@opensea/sdk
174-
[ci-badge]: https://github.com/ProjectOpenSea/opensea-js/actions/workflows/ci.yml/badge.svg
175-
[ci-link]: https://github.com/ProjectOpenSea/opensea-js/actions/workflows/ci.yml
176-
[coverage-badge]: https://coveralls.io/repos/github/ProjectOpenSea/opensea-js/badge.svg?branch=main
177-
[coverage-link]: https://coveralls.io/github/ProjectOpenSea/opensea-js?branch=main
178-
[license-badge]: https://img.shields.io/github/license/ProjectOpenSea/opensea-js
179-
[license-link]: https://github.com/ProjectOpenSea/opensea-js/blob/main/LICENSE
208+
[ci-badge]: https://github.com/ProjectOpenSea/opensea-sdk/actions/workflows/ci.yml/badge.svg
209+
[ci-link]: https://github.com/ProjectOpenSea/opensea-sdk/actions/workflows/ci.yml
210+
[license-badge]: https://img.shields.io/github/license/ProjectOpenSea/opensea-sdk
211+
[license-link]: https://github.com/ProjectOpenSea/opensea-sdk/blob/main/LICENSE
180212
[docs-badge]: https://img.shields.io/badge/@opensea/sdk-documentation-informational
181-
[docs-link]: https://github.com/ProjectOpenSea/opensea-js#documentation
213+
[docs-link]: https://github.com/ProjectOpenSea/opensea-sdk#documentation
182214
[discussions-badge]: https://img.shields.io/badge/@opensea/sdk-discussions-blueviolet
183-
[discussions-link]: https://github.com/ProjectOpenSea/opensea-js/discussions
215+
[discussions-link]: https://github.com/ProjectOpenSea/opensea-sdk/discussions

developerDocs/contributing.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,6 @@ npm link
8686
npm link @opensea/sdk
8787
```
8888

89-
**Generate Documentation**
90-
91-
Generate HTML docs (also available for browsing at [https://projectopensea.github.io/opensea-js](https://projectopensea.github.io/opensea-js)):
92-
93-
```bash
94-
npm run docs-build
95-
```
96-
97-
Generate Markdown docs:
98-
99-
```bash
100-
npm run docs-build-md
101-
```
102-
10389
## Pull Request Guidelines
10490

10591
When submitting a pull request:
@@ -156,6 +142,6 @@ When adding new features:
156142

157143
## Getting Help
158144

159-
- **Issues**: Use [GitHub Issues](https://github.com/ProjectOpenSea/opensea-js/issues) for bug reports and feature requests
160-
- **Discussions**: Use [GitHub Discussions](https://github.com/ProjectOpenSea/opensea-js/discussions) for questions and general discussion
145+
- **Issues**: Use [GitHub Issues](https://github.com/ProjectOpenSea/opensea-sdk/issues) for bug reports and feature requests
146+
- **Discussions**: Use [GitHub Discussions](https://github.com/ProjectOpenSea/opensea-sdk/discussions) for questions and general discussion
161147
- **Documentation**: Check the [docs](https://docs.opensea.io/reference/sdk-overview) for API and SDK guidance

developerDocs/faq.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ hidden: false
1515

1616
## How do I access the source code?
1717

18-
The source code for the SDK can be found on [GitHub](https://github.com/ProjectOpenSea/opensea-js).
18+
The source code for the SDK can be found on [GitHub](https://github.com/ProjectOpenSea/opensea-sdk).
1919

2020
## What chains are supported?
2121

22-
See the `Chain` enum in [`src/types.ts`](https://github.com/ProjectOpenSea/opensea-js/blob/main/src/types.ts) for a complete list of supported chains.
22+
See the `Chain` enum in [`src/types.ts`](https://github.com/ProjectOpenSea/opensea-sdk/blob/main/src/types.ts) for a complete list of supported chains.
2323

2424
Please use methods in the v2 API for multichain capabilities.
2525

2626
## Why is there no SDK method for the API request I am trying to call?
2727

2828
First, check the [API Reference](api-reference.md) to see all available SDK methods - many OpenSea API v2 endpoints are now supported.
2929

30-
If the SDK does not currently have a specific API, you can use the generic `get` and `post` methods on the `OpenSeaAPI` class in [`src/api/api.ts`](https://github.com/ProjectOpenSea/opensea-js/blob/main/src/api/api.ts) to make any API request. This repository is also open source, so please feel free to create a pull request.
30+
If the SDK does not currently have a specific API, you can use the generic `get` and `post` methods on the `OpenSeaAPI` class in [`src/api/api.ts`](https://github.com/ProjectOpenSea/opensea-sdk/blob/main/src/api/api.ts) to make any API request. This repository is also open source, so please feel free to create a pull request.
3131

3232
## Does the SDK support viem?
3333

developerDocs/overview.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ Happy seafaring! ⛵️
2323
- **[Getting Started Guide](getting-started.md)** - Learn the basics: fetching NFTs, making offers, creating listings, and swapping tokens
2424
- **[API Reference](api-reference.md)** - Complete reference for all SDK methods
2525
- **[Advanced Use Cases](advanced-use-cases.md)** - Bulk operations, canceling orders, event listening, and more
26-
- **[SDK Reference](https://projectopensea.github.io/opensea-js/)** - Auto-generated TypeDoc API documentation
2726
- **Key v10 Types**: `Amount` (`string | number | bigint`), `OpenSeaSigner`, `OpenSeaProvider`, `ContractCaller`, `OpenSeaWallet`
2827
- **[FAQ](faq.md)** - Frequently asked questions
2928
- **[Contributing](contributing.md)** - How to contribute to the SDK

developerDocs/sdk-references.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)