Skip to content

fix: derive active chain descriptions from CHAIN_NAMES (COW-982)#71

Merged
lgahdl merged 3 commits into
developfrom
luizhatem/cow-982-fix-derive-active-chain-list-dynamically-instead-of
May 29, 2026
Merged

fix: derive active chain descriptions from CHAIN_NAMES (COW-982)#71
lgahdl merged 3 commits into
developfrom
luizhatem/cow-982-fix-derive-active-chain-list-dynamically-instead-of

Conversation

@lgahdl
Copy link
Copy Markdown
Contributor

@lgahdl lgahdl commented May 28, 2026

Summary

  • Add CHAIN_NAMES: Record<SupportedChainId, string> to src/data.ts as single source of truth for chain display names
  • ChainIdQuery description in src/api/schemas/common.ts now derives the "Indexed chains: ..." text from CHAIN_NAMES — adding a new chain to SupportedChainId updates the API description automatically
  • Remove hardcoded "mainnet + gnosis" from docs/architecture.md; point to src/data.ts instead
  • Update "Indexed chains" table in docs/api-reference.md with a note pointing to src/data.ts as source of truth

How to Test

pnpm typecheck && pnpm lint — passes.

Related Issues

COW-982

🤖 Generated with Claude Code

…W-982)

Add CHAIN_NAMES map to src/data.ts as single source of truth for chain
labels. ChainIdQuery description now derives from it dynamically. Update
docs/api-reference.md and docs/architecture.md to remove hardcoded
chain references and point to src/data.ts instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 28, 2026

COW-982

4 tests: CHAIN_NAMES has expected entries, all names are non-empty,
ChainIdQuery.description contains every id+name pair from CHAIN_NAMES,
and the description is not the old hardcoded string.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread tests/api/chain-names.test.ts Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need this test? Looks like little overhead.

Comment thread src/data.ts
Comment on lines +134 to +137
export const CHAIN_NAMES: Record<SupportedChainId, string> = {
1: "Ethereum mainnet",
100: "Gnosis Chain",
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why not import this from cow-sdk?

…-982)

Addresses reviewer feedback: import chain labels from getChainInfo() instead
of hardcoding, and remove the low-value chain-names unit test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lgahdl lgahdl merged commit 7b91797 into develop May 29, 2026
4 checks passed
@lgahdl lgahdl deleted the luizhatem/cow-982-fix-derive-active-chain-list-dynamically-instead-of branch May 29, 2026 19:17
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.

3 participants