Skip to content

feat: CSV-driven multi-API chain resolution (Etherscan + Blockscout) - #1

Open
mdeacey wants to merge 1 commit into
aaurelions:mainfrom
mdeacey:main
Open

mdeacey wants to merge 1 commit into
aaurelions:mainfrom
mdeacey:main

Conversation

@mdeacey

@mdeacey mdeacey commented Aug 4, 2026

Copy link
Copy Markdown

Summary

Replaces the hardcoded chainIdMap / chainNameMap chain alias tables
with two data files in data/:

File Rows Format
data/etherscan-chains.csv 64 chainId,name
data/blockscout-chains.csv 723 chainId,url (Etherscan chains excluded)

src/chains.js is now a minimal CSV loader (no external deps, no
quoting). src/main.js resolves in this order:

  1. etherscanChains[chainId] β†’ Etherscan V2 (preferred for chains it supports)
  2. blockscoutChains[chainId] β†’ Blockscout V2 (chains not on Etherscan)
  3. Error β€” chain not in any registry

The Blockscout V2 fetcher and multi-file source parser are included
so any chain with a Blockscout instance (not just the ones the tool
originally supported) works out of the box.

Validation is relaxed from ^\d+$ to ^[A-Za-z0-9_-]+$ so newer
chains with alphanumeric IDs (e.g. 5dax, arise) work.

Files changed

data/blockscout-chains.csv   (new, 723 entries)
data/etherscan-chains.csv    (new, 64 entries)
src/chains.js                (CSV loader + 2 exports)
src/main.js                  (resolution chain + Blockscout fetcher)

Verified end-to-end

Chain Backend Files
Ethereum (1) Etherscan V2 1
Polygon (137) Etherscan V2 5
Gnosis (100) Etherscan V2 1
Scroll (534352) Blockscout V2 22
Unknown (999999) error β€”

Refresh workflow

For new Etherscan chains: append to data/etherscan-chains.csv and
remove from data/blockscout-chains.csv. For new Blockscout-only
chains: append to data/blockscout-chains.csv. No code changes.

@mdeacey mdeacey changed the title Add Robinhood Chain support via Blockscout V2 API feat: Robinhood Chain + CSV-driven multi-API chain resolution Aug 4, 2026
Replace the hardcoded `chainIdMap` and `chainNameMap` with two data
files in `data/`:

  data/etherscan-chains.csv   64 chains, Etherscan V2 supported
                              (chainId,name)

  data/blockscout-chains.csv  723 chains with a Blockscout instance
                              (chainId,url); Etherscan chains are
                              pre-filtered out so Etherscan wins for
                              chains on both

`src/chains.js` is now just a minimal CSV loader (no external deps,
no quoting). `src/main.js` resolves in this order:

  1. etherscanChains[chainId]   β†’ Etherscan V2 (preferred)
  2. blockscoutChains[chainId]  β†’ Blockscout V2
  3. error β€” chain not in any registry

The Blockscout fetch + multi-file parser are added (carried over from
the original Robinhood Chain support, now generalised via the CSV).

Validation is relaxed from `^\d+$` to `^[A-Za-z0-9_-]+$` so newer
chains with alphanumeric IDs (e.g. `5dax`, `arise`) work.

Verified end-to-end:
  - Ethereum / Polygon / Gnosis β†’ Etherscan V2
  - Scroll / ZetaChain          β†’ Blockscout V2
  - Unknown chain               β†’ clear error pointing at the CSVs

Refresh workflow: edit the CSVs, no code changes needed.

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@mdeacey mdeacey changed the title feat: Robinhood Chain + CSV-driven multi-API chain resolution feat: CSV-driven multi-API chain resolution (Etherscan + Blockscout) Aug 4, 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