Skip to content

feat(networks): add 5 EVM testnets from metadata v1.2.1-alpha.0#361

Merged
AugustoL merged 2 commits into
openscan-explorer:devfrom
AugustoL:feat/add-testnet-networks
Apr 22, 2026
Merged

feat(networks): add 5 EVM testnets from metadata v1.2.1-alpha.0#361
AugustoL merged 2 commits into
openscan-explorer:devfrom
AugustoL:feat/add-testnet-networks

Conversation

@AugustoL

Copy link
Copy Markdown
Collaborator

Description

Adds 5 EVM testnets introduced in explorer-metadata PR #16 (released as @openscan/metadata@1.2.1-alpha.0): Arbitrum Sepolia (421614), Optimism Sepolia (11155420), Base Sepolia (84532), Polygon Amoy (80002), and Avalanche Fuji (43113).

Each new chain ID is routed to its L1 family's adapter so block/tx/account pages render the right L2-specific fields (Arbitrum l1BlockNumber/sendCount/sendRoot, OP/Base l1Fee/l1GasPrice/l1GasUsed).

Related Issue

N/A — follows explorer-metadata#16.

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Refactoring
  • Performance improvement
  • Other

Changes Made

  • Bump METADATA_VERSION to 1.2.1-alpha.0 (src/services/MetadataService.ts) — fetches refreshed RPCs, new testnet RPC lists, and new logos from jsDelivr. Also acts as localStorage cache-bust.
  • Add 5 testnet entries to src/config/networks.json with slugs arb-sepolia, op-sepolia, base-sepolia, polygon-amoy, avax-fuji, each marked isTestnet: true with logo, color, currency, and faucet/bridge/docs links.
  • Register testnets in AdapterFactory (src/services/adapters/adaptersFactory.ts):
    • 421614ArbitrumAdapter
    • 11155420OptimismAdapter
    • 84532BaseAdapter
    • 80002PolygonAdapter
    • 43113EVMAdapter (same as Avalanche mainnet)
  • Work around missing ClientFactory support (src/services/DataService.ts) — @openscan/network-connectors does not yet register these testnet chain IDs in its CHAIN_REGISTRY, which would cause ClientFactory.createTypedClient to throw at runtime. DataService now instantiates the L1 family's client directly for the 5 testnet chain IDs via an EVM_TESTNET_CLIENTS lookup (they share the same JSON-RPC surface).
  • Widen AppChainId and L2 adapter constructor types to accept the new testnet chain IDs alongside their mainnet pair (42161 | 421614, 10 | 11155420, 8453 | 84532, 137 | 80002).
  • Tighten PolygonAdapter constructor type from SupportedChainId to 137 | 80002 to match sibling L2 adapters (refactor commit).

Screenshots

N/A — CDN-sourced logos and existing EVM page layouts.

Checklist

  • I have run npm run format:fix and npm run lint:fix
  • I have run npm run typecheck with no errors
  • I have run tests with npm run test:run (88/88 pass)
  • I have tested my changes locally
  • I have updated documentation if needed (no doc surface changed)
  • My code follows the project's architecture patterns

Additional Notes

  • No changes to BUILTIN_RPC_DEFAULTS (src/utils/rpcStorage.ts): the new testnets fetch RPCs purely from the metadata CDN, matching the pattern used by Sepolia and BSC Testnet.
  • Follow-up for @openscan/network-connectors: once the library registers these 5 chain IDs in its CHAIN_REGISTRY, the EVM_TESTNET_CLIENTS workaround in DataService.ts can be removed and the widened types collapsed back.
  • Verification steps for reviewers:
    1. DevTools → Application → Local Storage: clear OPENSCAN_METADATA_RPCS, reload, confirm the new cache entry's version is "1.2.1-alpha.0".
    2. Navigate to /arb-sepolia, /op-sepolia, /base-sepolia, /polygon-amoy, /avax-fuji and confirm each network dashboard loads with block number + gas price.
    3. On Arb Sepolia, open a recent block detail and verify l1BlockNumber renders; on OP/Base Sepolia open a transaction and verify L1 fee fields.
    4. Settings → RPCs tab lists the new endpoints with tracking/isOpenSource metadata from v1.2.1.

Bumps @openscan/metadata to 1.2.1-alpha.0 and registers Arbitrum
Sepolia (421614), Optimism Sepolia (11155420), Base Sepolia (84532),
Polygon Amoy (80002), and Avalanche Fuji (43113).

Each new chain ID is mapped to its L1 family adapter (Arbitrum, OP,
Base, Polygon, EVM) in AdapterFactory. Since @openscan/network-connectors
does not yet register these testnet chain IDs in its ClientFactory,
DataService instantiates the L1 family client directly for them. The
L2 adapter constructors and AppChainId are widened to accept the new
testnet chain IDs.
Types EVM_TESTNET_CLIENTS to return the client union instead of
unknown so AdapterFactory.createAdapter can keep its strict client
union without `| unknown`. Also narrows PolygonAdapter's constructor
from SupportedChainId to `137 | 80002` to match sibling L2 adapters.
@github-actions

Copy link
Copy Markdown

🚀 Preview: https://pr-361--openscan.netlify.app
📝 Commit: 23816b4388ed988229c7d63cec33bc210077f8a5

@AugustoL AugustoL requested a review from MatiasOS April 21, 2026 13:30
@AugustoL AugustoL merged commit c43c279 into openscan-explorer:dev Apr 22, 2026
3 checks passed
@AugustoL AugustoL mentioned this pull request Apr 29, 2026
11 tasks
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