Skip to content

feat: use dRPC's chain label as a last-resort name - #122

Merged
kuzdogan merged 2 commits into
mainfrom
fix/drpc-chain-names
Aug 6, 2026
Merged

feat: use dRPC's chain label as a last-resort name#122
kuzdogan merged 2 commits into
mainfrom
fix/drpc-chain-names

Conversation

@kuzdogan

@kuzdogan kuzdogan commented Aug 6, 2026

Copy link
Copy Markdown
Member

Changes

Chains discovered only through dRPC were named Chain <id> — for example chain 61900 in #115. The name lookup in generate.ts only consulted chain-overrides.json, Etherscan, Blockscout and chainid.network, and none of them know that chain.

dRPC's chains.yaml does carry a name (a protocol-level label plus a per-network id); we just weren't reading it.

  • scripts/providers/drpc.ts: parse label / id and expose DrpcChainData.name.
  • scripts/generate.ts: use drpc?.name in the sourcifyName fallback chain, right before the Chain <id> placeholder — better-curated sources still win.
  • Two touch-ups when joining label + network id: drop the label when the network id already repeats it (megaETH + MegaETH TestnetMegaETH Testnet), and capitalise an all-lowercase network id (mainnetMainnet).
  • New scripts/providers/drpc.test.ts, wired into npm test.

Against today's chains.yaml all 262 dRPC chains resolve to a name. The placeholders currently in sourcify-chains-default.json become:

chain before after
61900 Chain 61900 Mova Mainnet
1672 Chain 1672 Pharos Mainnet
2910 Chain 2910 Morph Hoodi
6281971 Chain 6281971 DogeOS Testnet

🤖 Generated with Claude Code

kuzdogan and others added 2 commits August 6, 2026 11:44
Chains that only dRPC knows about ended up named "Chain <id>" (e.g.
chain 61900) because the name lookup only consulted chain-overrides.json,
Etherscan, Blockscout and chainid.network.

dRPC's chains.yaml does carry a name — a protocol-level `label` plus a
per-network `id` — we just weren't reading it. Extract it into
DrpcChainData.name and use it in generate.ts right before the
"Chain <id>" placeholder, so better-curated sources still win.

Joining label + network id needs two touch-ups: drop the label when the
network id already repeats it ("megaETH" + "MegaETH Testnet"), and
capitalise an all-lowercase network id ("mainnet"). Covered by a new
scripts/providers/drpc.test.ts, wired into `npm test`.

Against today's chains.yaml all 262 dRPC chains resolve to a name:
61900 -> Mova Mainnet, 1672 -> Pharos Mainnet, 2910 -> Morph Hoodi,
6281971 -> DogeOS Testnet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kuzdogan
kuzdogan merged commit a14f3f9 into main Aug 6, 2026
2 checks passed
@kuzdogan
kuzdogan deleted the fix/drpc-chain-names branch August 6, 2026 12:33
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.

2 participants