Skip to content

feat(solana): add Solana network support (Mainnet, Devnet, Testnet)#358

Open
AugustoL wants to merge 14 commits intoopenscan-explorer:devfrom
AugustoL:feat/solana-network-support
Open

feat(solana): add Solana network support (Mainnet, Devnet, Testnet)#358
AugustoL wants to merge 14 commits intoopenscan-explorer:devfrom
AugustoL:feat/solana-network-support

Conversation

@AugustoL
Copy link
Copy Markdown
Collaborator

@AugustoL AugustoL commented Apr 6, 2026

Description

Adds Solana as a third network type alongside EVM and Bitcoin. Implements the full data layer (types, adapter, service integration), 8 page views, routing for 3 Solana networks, and the i18n namespace.

Following the Bitcoin pattern: a standalone SolanaAdapter (does not extend NetworkAdapter), separate page components, and slug-based routes (/sol, /sol-devnet, /sol-testnet).

Related Issue

Type of Change

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

Changes Made

Foundation (Types, Config, DataService)

  • Added "solana" to NetworkType and ~15 new domain types in src/types/index.ts (SolanaBlock, SolanaTransaction, SolanaAccount, SolanaTokenHolding, SolanaValidator, etc.)
  • Added 3 networks to networks.json: Solana Mainnet (sol), Devnet (sol-devnet), Testnet (sol-testnet) with CAIP-2 chain IDs
  • Created SolanaAdapter (src/services/adapters/SolanaAdapter/) using real SolanaClient from @openscan/network-connectors v1.7
  • Extended DataService with isSolana() / getSolanaAdapter() using ClientFactory.createTypedClient
  • Added isSolanaNetwork() to networkResolver.ts
  • Added solana_transaction / solana_block / solana_account configs to AIPromptTemplates.ts
  • Added SOLANA_NETWORK_SLUGS to MetadataService.ts so the explorer fetches Solana RPCs from the metadata CDN (bumped METADATA_VERSION to 1.2.0-alpha.0)
  • Added Solana branch to NetworkBlockIndicator so navbar shows current slot

Default RPC Endpoints

  • Added public no-auth endpoints for all 3 Solana networks in BUILTIN_RPC_DEFAULTS (Solana Foundation, PublicNode, dRPC, Ankr, Pocket Network — 11 endpoints total)

Utilities & Hooks

  • src/utils/solanaUtils.tslamportsToSol, formatSol, shortenSolanaAddress, isSolanaAddress, isSolanaSignature, formatStake, calculateEpochProgress
  • src/hooks/useSolanaDashboard.ts — auto-refreshing dashboard hook (10s interval)

Pages (src/components/pages/solana/)

All pages follow the established BTC/EVM design system using shared CSS classes (block-display-card, tx-details, tx-row, dash-table, more-details-toggle, Breadcrumb, LoaderWithTimeout, CopyButton, link-accent, etc.)

  • Dashboardindex.tsx + SolanaDashboardStats.tsx (3 stats: SOL Price, Current Slot, Epoch) + SolanaBlocksTable.tsx + SolanaTransactionsTable.tsx
  • Slots listSolanaSlotsPage.tsx with skeleton loading states and dash-table
  • Slot detailSolanaSlotPage.tsx + SolanaSlotDisplay.tsx (blockhash, parent slot, block height, rewards table, collapsible transaction list using tx-list pattern)
  • Transactions listSolanaTransactionsPage.tsx with table-status-badge rounded status pills
  • Transaction detailSolanaTransactionPage.tsx + SolanaTransactionDisplay.tsx (signature, status badge, fee, compute units, account keys table, instructions, collapsible inner instructions, collapsible program logs using more-details-content / detail-row)
  • Account detailSolanaAccountPage.tsx + SolanaAccountDisplay.tsx (two-column layout: left = balance/owner/executable/data size/rent, right = SPL token holdings with section header)
  • SPL Token detailSolanaTokenPage.tsx (mint, supply, decimals, top holders table with percentage)
  • ValidatorsSolanaValidatorsPage.tsx (epoch info, total stake, current + delinquent validators sorted by stake)

Routing & Lazy Loading

  • 8 lazy components added to LazyComponents.tsx
  • 24 routes added to App.tsx (8 per network × 3 Solana networks), placed before the EVM :networkId catch-all

i18n

  • New solana namespace registered in i18n.ts and i18next.d.ts
  • src/locales/en/solana.json and es/solana.json with full translations
  • ja/, pt-BR/, zh/ seeded with English (falls back via i18next)

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 passing)
  • I have tested my changes locally
  • My code follows the project's architecture patterns

To Do

  • Translate solana.json for pt-BR, ja, zh (currently English fallback)
  • Wire Solana base58 address/signature detection into the global SearchBox
  • Add Solana logo to public/assets/networks/solana.svg (currently served from metadata CDN)

Additional Notes

Architectural decision: Bitcoin-style adapter

The SolanaAdapter does not extend NetworkAdapter — it follows the Bitcoin pattern of a fully standalone class. Solana's data model (slots, signatures, programs, SPL tokens) is sufficiently different from EVM that forcing it into the EVM-centric NetworkAdapter interface would require many no-op stubs. The DataService discriminates on networkType and exposes getSolanaAdapter() analogous to getBitcoinAdapter().

CAIP-2 chain IDs

Network Chain ID
Mainnet Beta solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
Devnet solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1
Testnet solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z

Adds Solana as a third network type alongside EVM and Bitcoin, with
dashboard, slots/blocks, transactions, accounts, SPL tokens, and
validators views.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

🚀 Preview: https://pr-358--openscan.netlify.app
📝 Commit: 2087334dad641f140f7c59710fbc019b1ead6a8c

AugustoL added 12 commits April 6, 2026 17:56
Bumps @openscan/network-connectors to 1.7 (which now ships SolanaClient),
deletes the local SolanaClientTypes stub, replaces the inline JSON-RPC
client in DataService with ClientFactory.createTypedClient, and updates
SolanaAdapter and adaptersFactory to use the real types.
…kIndicator

- Add public Solana RPC endpoints (mainnet-beta, devnet, testnet) to
  BUILTIN_RPC_DEFAULTS so the app can connect out of the box
- Add Solana branch to NetworkBlockIndicator so the navbar shows the
  current slot for Solana networks instead of crashing with
  "At least one RPC URL must be provided"
Adds PublicNode, dRPC, Ankr, and Pocket Network as additional fallback
RPCs for Solana mainnet, devnet, and testnet so the fallback strategy
has more options when the official endpoints are rate-limited.
Refactors all Solana pages to use the same shared style classes and
patterns established by the Bitcoin/EVM pages:

- Wrap pages in container-wide / page-container-padded
- Use Breadcrumb on every detail and list page
- Use block-display-card, blocks-header, block-display-header,
  block-label, tx-details, tx-row, tx-value, tx-mono, tx-link
- Use dash-table / table-wrapper / table-cell-* classes for tables
- Use block-status-badge for status indicators
- Use LoaderWithTimeout for loading states
- Add CopyButton to addresses, signatures, mints, blockhashes
- Skeleton placeholders match the Bitcoin loading pattern

New display components extracted (mirroring BitcoinBlockDisplay pattern):
- SolanaSlotDisplay
- SolanaTransactionDisplay
- SolanaAccountDisplay
- SolanaTransactionsPage and SolanaAccountDisplay now use the shared
  table-status-badge / table-status-success / table-status-failed
  classes (matching EVM TransactionHistory) so the success/failed
  pills render with rounded corners.
- Add a block-status-failed CSS rule next to block-status-finalized
  and block-status-pending so the SolanaTransactionDisplay header
  badge has the correct red rounded style.
…ldings

Wrap the account details and token holdings inside btc-tx-details-grid
so they render side-by-side, mirroring the BTC/EVM address page layout.
The address row stays full-width on top, then the left column holds the
account metadata (balance, owner, executable, data size, rent) and the
right column holds the SPL token holdings table.
…s as section header

- Move the address row into its own tx-details block outside the
  two-column grid so it spans the full card width.
- Replace the 'Token Holdings:' tx-row label with a proper
  block-display-section-title header inside the right column, so the
  token table has its own section heading like the rest of the app.
The custom tx-link class doesn't exist — replace all occurrences in
SolanaTransactionDisplay, SolanaSlotDisplay, and SolanaAccountDisplay
with link-accent tx-mono, matching how BTC/EVM detail pages render
their block/slot/account/tx links.
Replace the Transactions stat card (which showed the cumulative
transaction count) with a Version stat card. The cumulative count
isn't useful at a glance and was taking up a prominent dashboard slot.
Remove the Version stat card so the Solana dashboard header only
shows SOL Price, Current Slot, and Epoch.
Replace the table-based collapsible transactions section in
SolanaSlotDisplay with the tx-list / tx-list-item / tx-list-index /
tx-list-hash pattern used by EVM BlockAnalyser and BTC BitcoinBlockDisplay,
toggled via a more-details-toggle button. The signatures now render
as a numbered list of full hashes with link-accent styling, matching
how EVM and BTC blocks display their transaction lists.
Replace the bare <pre> with nonexistent log-output class with the
shared more-details-toggle / more-details-content / detail-row pattern.
Logs now render as a numbered list inside the styled container, matching
how EVM raw traces and block details display expandable content.
@AugustoL AugustoL marked this pull request as ready for review April 11, 2026 12:16
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