Add network selector for testnet/mainnet - #454
Merged
Merged
Conversation
- Add frontend/src/config/network.js that reads VITE_STELLAR_NETWORK at build time and exports isTestnet, isMainnet, and freighterNetwork - Replace hardcoded 'TESTNET' in useFreighter.jsx with env-driven value (maps 'mainnet' to Freighter's 'PUBLIC' network name) - Update DemoBanner to only render on testnet - Add NetworkBadge component showing active network as a pill badge in the NavBar (amber for testnet, green for mainnet) - Update frontend Dockerfile to accept VITE_STELLAR_NETWORK as build arg - Update docker-compose.yml to forward STELLAR_NETWORK to the frontend build - Add VITE_STELLAR_NETWORK to .env.example Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VITE_STELLAR_NETWORKenvironment variable at build time, eliminating the hardcoded testnet dependencyNetworkBadgecomponent in the NavBar that shows the active network as a colored pill badge (amber for testnet, green for mainnet)DemoBanner) now only renders whenVITE_STELLAR_NETWORK=testnet, and is hidden on mainnetdocker-compose.ymlto forward theSTELLAR_NETWORKenv var as a Vite build argumentCloses #9
Test plan
VITE_STELLAR_NETWORK=testnetand verify the amber "Testnet" badge appears in the NavBar and the warning banner is visibleVITE_STELLAR_NETWORK=mainnetand verify the green "Mainnet" badge appears and the warning banner is hiddenVITE_STELLAR_NETWORKentirely and verify it defaults to testnetTESTNETvsPUBLIC)STELLAR_NETWORKfrom.envflows through to the frontend bundleGenerated with Claude Code