Skip to content

Commit b630e0f

Browse files
committed
Release v0.4.3
Origin-SHA: bbe72b6405aad02845d2b39d2706d893c4b165de
1 parent ff9f39d commit b630e0f

9 files changed

Lines changed: 1103 additions & 222 deletions

AGENTS.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@ pnpm run test # Run smoke tests with Vitest
1919
| `opensea-api.json` | Local copy of the OpenAPI spec (fetched from `api.opensea.io/api/v2/openapi.json`) |
2020
| `scripts/update-spec.mjs` | Fetches the latest spec; falls back to existing local file on network errors |
2121
| `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` |
2326
| `test/smoke.test.ts` | Smoke test verifying the generated types compile and export correctly |
2427

2528
## Review Checklist
2629

2730
When reviewing changes to this package, verify:
2831

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.
3033

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.
3235

3336
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:
3437
```bash
@@ -41,6 +44,8 @@ When reviewing changes to this package, verify:
4144

4245
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.
4346

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).
48+
4449
## Conventions
4550

4651
- ESM-only (`"type": "module"`).

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# @opensea/api-types
22

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.
17+
18+
- 90702a7: Sync OpenAPI spec — add Token holders/liquidity-pools endpoints, NftDetailed.agent_binding, Token.twitter_follower_count.
19+
20+
## New endpoints
21+
22+
- `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).
24+
25+
## New / changed schemas
26+
27+
- `NftDetailed`: optional `agent_binding: AgentBindingResponse` (ERC-8217 agent binding — exposes `agent_id`, `binding_contract`, the bound `AgentNftResponse`, optional `registered_by`).
28+
- `Token` (token base): optional `twitter_follower_count: int64`.
29+
- 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.
33+
334
## 0.4.2
435

536
### Patch Changes

0 commit comments

Comments
 (0)