Skip to content

fix(schema): sync the documented chain list with the API's published spec - #662

Merged
gulshngill merged 3 commits into
mainfrom
fix/schema-chain-list
Sep 20, 2026
Merged

gulshngill merged 3 commits into
mainfrom
fix/schema-chain-list

Conversation

@gulshngill

Copy link
Copy Markdown
Contributor

Summary

nansen schema is the CLI's machine-readable self-description, and its top-level chains list is what agents (and shell completion for --chain) rely on. It had drifted from what the API accepts in both directions: it still listed scroll and ronin, which no endpoint serves any more (the API returns 422 for them), and it omitted 20 chains the API does serve.

This PR regenerates the list from the union of every chain enum in the API's published OpenAPI spec (https://api.nansen.ai/openapi.json), sorted and deduplicated (36 chains), and removes the hand-copied duplicates so the list cannot drift again.

  • Removed: ronin, scroll
  • Added: algorand, aptos, arc, bitcoin, bitlayer, chiliz, citrea, gravity, hyperliquid, injective, mantra, near, robinhood, stacks, starknet, stellar, sui, ton, tron, viction

Not every chain is served by every endpoint; the API keeps validating --chain per endpoint, and the all wildcard some endpoints accept is deliberately not listed as a chain.

Changes

  • src/schema.json: chains regenerated from the spec union (sorted, unique).
  • src/cli.js: the --help "Research chains" line is now interpolated from SCHEMA.chains instead of a second hand-written copy.
  • README.md: "Supported Chains" section updated to the same list.
  • src/chain-ids.js: EVM_CHAINS (the CLI's own address-format/ENS gating set) drops scroll and ronin, so the existing test guard "schema.json chains should be a superset of EVM_CHAINS" keeps holding. EVM_CHAIN_IDS, which wallet transfers depend on, is untouched, and no new chains were added to EVM_CHAINS (address validation for chains it does not know already falls through to the API).
  • src/api.js: comment on COUNTERPARTIES_BATCH_CHAINS updated to match.
  • src/__tests__/coverage.test.js: DOCUMENTED_CHAINS now reads SCHEMA.chains rather than a duplicated literal, plus a new test asserting every entry is a lowercase slug, appears once, and the list is alphabetically sorted.
  • src/__tests__/api.test.js: the "accept all documented chains" test reads the list from schema.json; one test title reworded (scroll/ronin are no longer "EVM chains this CLI knows").
  • .changeset/sync-schema-chain-list.md: patch changeset (the nansen schema output changes).

Validation

 Test Files  76 passed (76)
      Tests  3199 passed | 2 skipped (3201)

npm run lint: clean (eslint ., no findings).

Runtime: nansen schema | jq '.chains | length' → 36; nansen --help shows the regenerated "Research chains" line. Live read-only spot check against https://api.nansen.ai/api/v1/token-screener: scroll and ronin → HTTP 422 (Invalid value ... Valid options are: ...); tron, starknet, bitcoin → HTTP 200.

Checklist

  • Tests pass (npm test)
  • src/schema.json updated if new commands or flags were added
  • README.md updated if new top-level commands or categories were added
  • Changeset added (.changeset/) — only required for user-facing changes (new commands, flags, bug fixes, breaking changes)

🤖 Generated with Claude Code

…spec

`nansen schema` (and the copies of its chain list in `--help` and the
README) listed `scroll` and `ronin`, which no endpoint accepts any more,
and omitted 20 chains the API does serve. Regenerate the list from the
union of every chain enum in the API's published OpenAPI spec
(https://api.nansen.ai/openapi.json).

- schema.json `chains`: sorted, deduplicated union (36 chains)
- `--help` "Research chains" line now interpolates `SCHEMA.chains`
- coverage.test.js / api.test.js read the list from schema.json instead
  of hand-copied duplicates; new assertions pin lowercase slugs,
  uniqueness and alphabetical order
- `EVM_CHAINS` drops `scroll`/`ronin` so the existing "schema chains is a
  superset of EVM_CHAINS" guard still holds; `EVM_CHAIN_IDS` (used for
  wallet transfers) is untouched

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@nansen-pr-reviewer

nansen-pr-reviewer Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

pr-reviewer Summary for #d6712e2

✅ No issues found

The code review completed successfully with no findings.

Review effort: 2/5 (Simple)

Summary

This PR synchronises the CLI's chain list with the API's published OpenAPI spec, removes two stale chains (scroll, ronin), and eliminates the hand-copied duplicates that caused the drift in the first place. The changes are clean and well-executed.

Highlights:

  • schema.json is now the single source of truth; --help, README.md, and both test files all read from it dynamically — no more divergence risk.
  • EVM_CHAINS / EVM_CHAIN_IDS / transfer.js explorer map are consistently trimmed: scroll is gone from all three.
  • New test assertions in coverage.test.js (lowercase slug, uniqueness, sorted order) and cli.internal.test.js (EVM_CHAIN_IDS ⊆ EVM_CHAINS, COUNTERPARTIES_BATCH_CHAINS ⊆ schema chains) provide solid structural guards going forward.
  • COUNTERPARTIES_BATCH_CHAINS in api.js is verified to remain a strict subset of the new schema chains list — no orphaned entries.
  • Comments are meaningful (explaining why COUNTERPARTIES_BATCH_CHAINS is deliberately not derived from EVM_CHAINS), not slop.
  • Changeset is present, correctly typed patch, and accurately describes the user-visible change.

No bugs, logic errors, or convention violations found.


Token usage: 1,026 input, 4,128 output, 377,833 cache read, 26,659 cache write | Usage Guide

New pushes are reviewed automatically with a 10-minute cooldown between reviews. To request a review at any time, comment @nansen-pr-reviewer re-review.

nansen-pr-reviewer[bot]
nansen-pr-reviewer Bot previously approved these changes Sep 19, 2026

@nansen-pr-reviewer nansen-pr-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved

This PR was automatically approved because:

  • Claude recommends approval
  • Claude assessed this as a minimal effort change
  • The effort level is within the auto-approval threshold of 2
  • No high or critical issues were detected
  • Review comment contains non-blocking feedback

If you have any concerns, please request a manual review.

@gulshngill

Copy link
Copy Markdown
Contributor Author

Merge position: 3 of 9. Merge after #661.

Shares src/api.js and README.md with #661, and src/cli.js plus src/schema.json with #663, #666, #667 and #668. This is the first of the src/cli.js group, so it should land before the rest of them.

@gulshngill

Copy link
Copy Markdown
Contributor Author

Addressed the review finding in 419dafe: removed the orphaned scroll chain ID and explorer entry, and added a regression invariant that every EVM_CHAIN_IDS key remains present in EVM_CHAINS.

Local validation: npm test (3,200 passed, 2 skipped), npm run lint, production OpenAPI chain-union comparison, nansen schema, nansen --help, and an actual newly-added-chain request path with an intentionally invalid API key.

@nansen-pr-reviewer re-review

nansen-pr-reviewer[bot]
nansen-pr-reviewer Bot previously approved these changes Sep 20, 2026

@nansen-pr-reviewer nansen-pr-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved

This PR was automatically approved because:

  • Claude recommends approval
  • Claude assessed this as a moderate effort change
  • The effort level is within the auto-approval threshold of 2
  • No high or critical issues were detected
  • Review comment contains non-blocking feedback

If you have any concerns, please request a manual review.

@gulshngill

Copy link
Copy Markdown
Contributor Author

Addressed the follow-up drift-guard finding in d6712e2: cli.internal.test.js now asserts every concrete COUNTERPARTIES_BATCH_CHAINS value is covered by the global schema chain list (all remains the intentional wildcard exception). Focused result: 589 passed; lint passed.

@gulshngill

Copy link
Copy Markdown
Contributor Author

@nansen-pr-reviewer re-review

@nansen-pr-reviewer nansen-pr-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved

This PR was automatically approved because:

  • Claude recommends approval
  • Claude assessed this as a moderate effort change
  • The effort level is within the auto-approval threshold of 2
  • No high or critical issues were detected

If you have any concerns, please request a manual review.

@nansen-pr-reviewer nansen-pr-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved

This PR was automatically approved because:

  • Claude recommends approval
  • Claude assessed this as a moderate effort change
  • The effort level is within the auto-approval threshold of 2
  • No high or critical issues were detected

If you have any concerns, please request a manual review.

@gulshngill
gulshngill merged commit 55b5990 into main Sep 20, 2026
9 checks passed
@gulshngill
gulshngill deleted the fix/schema-chain-list branch September 20, 2026 05:08
@github-actions github-actions Bot mentioned this pull request Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant