You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,16 +19,19 @@ pnpm run test # Run smoke tests with Vitest
19
19
|`opensea-api.json`| Local copy of the OpenAPI spec (fetched from `api.opensea.io/api/v2/openapi.json`) |
20
20
|`scripts/update-spec.mjs`| Fetches the latest spec; falls back to existing local file on network errors |
21
21
|`src/generated.ts`| Auto-generated types from `openapi-typescript` — do not edit manually |
22
-
|`src/index.ts`| Named re-exports of commonly used schema types (collections, NFTs, orders, etc.) |
22
+
|`src/schemas-generated.ts`| Auto-generated named re-exports of every `components.schemas.*` entry — do not edit manually |
23
+
|`src/index.ts`| Hand-written. Re-exports `schemas-generated.ts`, plus response envelopes and operation helpers |
24
+
|`scripts/generate-schema-exports.mjs`| Emits `schemas-generated.ts` from the spec; runs as part of `pnpm run generate`|
25
+
|`scripts/check-consumer-imports.mjs`| CI guard — verifies every name workspace packages import from `@opensea/api-types` is in the built `dist/index.d.ts`|
23
26
|`test/smoke.test.ts`| Smoke test verifying the generated types compile and export correctly |
24
27
25
28
## Review Checklist
26
29
27
30
When reviewing changes to this package, verify:
28
31
29
-
1.**Never hand-edit `src/generated.ts`**. It is produced by `openapi-typescript`from `opensea-api.json`. Changes are overwritten on the next build.
32
+
1.**Never hand-edit `src/generated.ts` or `src/schemas-generated.ts`**. Both are produced from `opensea-api.json` by `pnpm run generate`. Changes are overwritten on the next build.
30
33
31
-
2.**New types in `src/index.ts`**: When the spec adds new schemas, add named re-exports in `src/index.ts` grouped by domain (Collections, NFTs, Orders, etc.). Other packages import from `@opensea/api-types` — unnamed schemas are only accessible via `components["schemas"]["..."]`.
34
+
2.**Adding a new schema export — no action needed**. When the spec adds a new `components.schemas.X`, it surfaces as a named export automatically via `src/schemas-generated.ts`. Only edit `src/index.ts` for non-schema additions: response envelopes (`components.responses`), operation helpers, or namespace re-exports.
32
35
33
36
3.**Downstream consumers**: The SDK (`@opensea/sdk`) and CLI (`@opensea/cli`) depend on this package. After updating the spec, rebuild api-types and verify downstream packages still compile:
34
37
```bash
@@ -41,6 +44,8 @@ When reviewing changes to this package, verify:
41
44
42
45
4.**Chain enum sync**: The SDK's `Chain` enum has a compile-time assertion against `ChainIdentifier` from this package. If the spec adds a new chain, the SDK build will fail until `Chain` is updated.
43
46
47
+
5.**Consumer-imports CI guard**: A standalone CI job (`API Types consumer imports` in `.github/workflows/ci.yml`) runs `scripts/check-consumer-imports.mjs` on every PR. It greps every `from "@opensea/api-types"` import across the workspace and verifies each named import is exported by the built `dist/index.d.ts`. If a name is missing, the job fails with the file/line that imports it. This catches the failure mode where a downstream change happens to resolve through the workspace but would break against the published artifact (the exact bug that briefly broke order posting in SDK 11.0).
Copy file name to clipboardExpand all lines: CHANGELOG.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,36 @@
1
1
# @opensea/api-types
2
2
3
+
## 0.4.3
4
+
5
+
### Patch Changes
6
+
7
+
- 96928f4: Auto-generate named schema exports so every `components.schemas.*` from the OpenAPI spec is reachable as a named import — no manual curation step.
8
+
9
+
## What changed
10
+
11
+
- New `src/schemas-generated.ts` (auto-built from `opensea-api.json`) exports a named type for every schema in the spec. The previous hand-curated list in `src/index.ts` covered 147 of 199 schemas; the remaining 52 are now surfaced.
12
+
-`src/index.ts` re-exports `./schemas-generated` and keeps the hand-written sections (response envelopes, operation helpers).
13
+
-`pnpm run generate` now invokes `scripts/generate-schema-exports.mjs` after `openapi-typescript` so the schema-export list always tracks the spec.
14
+
- New CI guard: `scripts/check-consumer-imports.mjs` greps every `from "@opensea/api-types"` import across the workspace and verifies each named import appears in the built `dist/index.d.ts`. Wired into CI as the `API Types consumer imports` job — runs on every PR, not gated by path filter, because a consumer-package change can introduce an unsurfaced import without touching api-types itself (the exact failure mode that briefly broke order posting in SDK 11.0).
15
+
16
+
Both additions are belt-and-suspenders: auto-gen ensures the index never falls behind the spec; the CI guard ensures the index hasn't been broken by any change.
-`GET /api/v2/chain/{chain}/token/{address}/liquidity-pools` — paginated liquidity pools for a token (`TokenLiquidityPoolsResponse` → `TokenLiquidityPoolResponse[]`, exposes pool type, pool/contract address, base/quote reserves in USD, bonding-curve progress, graduation flag).
23
+
-`GET /api/v2/chain/{chain}/token/{address}/holders` — paginated token holders (`TokenHoldersResponse` → `TokenHolderResponse[]` plus aggregate `TokenHolderDistributionResponse` with total holders, top-1% concentration, and a `STRONG | HEALTHY | CONCERNING | BAD` health label).
- NFT list endpoint: new optional `has_agent_binding: boolean` query filter.
30
+
- New named exports: `AgentBindingResponse`, `AgentNftResponse`, `TokenHolderResponse`, `TokenHoldersResponse`, `TokenHolderDistributionResponse`, `TokenLiquidityPoolResponse`, `TokenLiquidityPoolsResponse`.
31
+
32
+
All changes are additive — no consumer breakage. SDK/CLI/skill don't need updates to keep working; wrapping the two new endpoints (typed SDK methods, CLI commands, skill shell scripts) is follow-up work.
0 commit comments