The Network Switcher is a powerful dropdown component that allows users to easily switch between all supported blockchain networks in the Helios application.
- Helios - The native Helios blockchain
- Ethereum - Ethereum mainnet
- BNB Chain - Binance Smart Chain mainnet
- Arbitrum One - Arbitrum Layer 2
- Base - Coinbase's L2 network
- Optimism - Optimistic Ethereum L2
- Polygon - Polygon PoS mainnet
- Ethereum Sepolia - Ethereum testnet
- BNB Testnet - BSC testnet
- Arbitrum Sepolia - Arbitrum testnet
- Base Sepolia - Base testnet
- Optimism Sepolia - Optimism testnet
- Polygon Amoy - Polygon testnet (replacing Mumbai)
- Shows current network icon and name
- Colored border matching network brand color
- Chevron icon indicating dropdown state
- Hover effects for better interactivity
- Desktop: Appears below trigger button (360px wide)
- Mobile: Full-width bottom sheet (80vh max height)
- Backdrop blur for focus
- Smooth animations (framer-motion)
Three filter options:
- All Networks: Shows all 14 networks
- Mainnet: Shows only production networks
- Testnet: Shows only test networks
Each network displays:
- Network icon (with fallback to Helios icon)
- Network full name
- Testnet badge (orange, for testnet networks)
- Native currency symbol
- Checkmark icon (for currently connected network)
- Color-coded left border (brand color)
- Full overlay with spinner
- "Switching network..." message
- Prevents multiple simultaneous switches
wagmi- Blockchain wallet integrationframer-motion- Smooth animationslucide-react- Icons (if needed for future features)
- User clicks on a network
- Component checks if already connected (do nothing if true)
- Attempts to switch using wagmi's
switchChain - If wagmi fails (custom/unknown network):
- Requests
wallet_switchEthereumChain - If network not in wallet (error 4902):
- Requests
wallet_addEthereumChainwith full config
- Requests
- User approves in wallet popup
- Requests
- Success: dropdown closes, UI updates
- Failure: Error alert, button re-enabled
Each network has:
{
id: number; // Chain ID
name: string; // Full network name
shortName: string; // Display name in trigger
icon: string; // Icon URL (TrustWallet/official)
category: 'mainnet' | 'testnet';
color: string; // Brand color (hex)
rpcUrls: string[]; // RPC endpoints
blockExplorerUrls: string[];
nativeCurrency: {
name: string;
symbol: string;
decimals: number;
};
}- TrustWallet Assets: Most networks use official icons from TrustWallet's GitHub repo
- Base: Official Base brand kit SVG
- Helios: Local
/images/helios-icon.svg - Fallback: If icon fails to load, defaults to Helios icon
- Located between balance display and wallet button
- Hidden on mobile (can be added to mobile menu if needed)
<NetworkSwitcher />renders autonomously
All networks are imported and added to the networks array:
export const networks = [
heliosChain,
mainnet,
sepolia,
bsc,
bscTestnet,
// ... etc
];Networks array passed to createAppKit:
const modal = createAppKit({
// ...
networks,
defaultNetwork: heliosChain,
// ...
});- Follows Helios design system
- Colors:
#002DCB(primary blue),#E2EBFF(borders),#060F32(text) - Smooth transitions on all interactive elements
- Scrollable network list with custom scrollbar
- Responsive breakpoint at 640px for mobile layout
.triggerButton- Main button with border and hover effects.dropdown- Floating panel with shadow and rounded corners.networkItem- Individual network button with hover state.testnetBadge- Orange badge for testnet identification.switchingOverlay- Loading state overlay
-
Visual Feedback:
- Current network highlighted with checkmark and colored border
- Hover states on all clickable elements
- Smooth animations for dropdown open/close
-
Error Prevention:
- Disabled state while switching
- Can't click current network again
- Clear indication of testnet vs mainnet
-
Accessibility:
- Semantic HTML
- ARIA labels where needed
- Keyboard navigation supported (inherited from button elements)
-
Mobile Optimization:
- Bottom sheet on mobile
- Touch-friendly button sizes
- Scrollable list for many networks
-
Performance:
- Conditional rendering (only when open)
- Lazy image loading with error handling
- Efficient state management
- Recently used networks at top
- Search/filter by network name
- Network status indicators (RPC health)
- Custom network addition UI
- Favorite/pin networks
- Network-specific gas price display
- Multi-chain balance aggregation
- Quick switch between mainnet ↔ testnet pairs
- Full keyboard navigation
- Screen reader announcements
- Focus trap in dropdown
- Escape key to close
- Track most-used networks
- Monitor switch success/failure rates
- User preferences for default network
- Switching to each mainnet network
- Switching to each testnet network
- Switching from unknown network
- Adding custom network (Helios)
- User declining switch in wallet
- User declining add network
- Clicking current network (should do nothing)
- Mobile responsive layout
- Icon fallback on load error
- Filter buttons (All/Mainnet/Testnet)
- Dropdown closes on backdrop click
- Dropdown closes on successful switch
- Loading state during switch
- Network list scrollable when many items
- No linter errors
- Works with MetaMask
- Works with WalletConnect
- Works with Coinbase Wallet
- Works with other EVM wallets
- Wallet Support: Some wallets may not support all networks or may have different behaviors for
wallet_addEthereumChain - RPC Reliability: Public RPC endpoints can be slow or rate-limited
- Icon Loading: External icons depend on third-party CDNs (TrustWallet GitHub)
- Wagmi Support: Some networks may need to be added manually if not in wagmi's default list
- Check if wallet supports the network
- Verify RPC URL is accessible
- Try adding network manually in wallet first
- Check network CDN availability
- Verify icon URL is correct
- Fallback should show Helios icon
- Ensure wallet is connected (component hidden if not)
- Check z-index conflicts with other UI elements
- Verify framer-motion is installed
- Add network config to
NETWORKSarray inNetworkSwitcher.tsx - Import network from
@reown/appkit/networksinwagmi.ts(if available) - Add to
networksarray inwagmi.ts - Test switching and adding flow
- Update this documentation
- RPC URLs and explorers may change
- Keep icons up to date with official branding
- Monitor network ID changes (rare but possible for testnets)
Component Location: /src/components/NetworkSwitcher.tsx
Styles Location: /src/components/NetworkSwitcher.module.scss
Created: October 20, 2025
Version: 1.0