Skip to content

Add network selector for testnet/mainnet - #454

Merged
dev-fatima-24 merged 1 commit into
Vacci-chain:mainfrom
Xaxxoo:fix/issue-9
Sep 2, 2026
Merged

Add network selector for testnet/mainnet#454
dev-fatima-24 merged 1 commit into
Vacci-chain:mainfrom
Xaxxoo:fix/issue-9

Conversation

@Xaxxoo

@Xaxxoo Xaxxoo commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Network (testnet/mainnet) is now driven by the VITE_STELLAR_NETWORK environment variable at build time, eliminating the hardcoded testnet dependency
  • Added a NetworkBadge component in the NavBar that shows the active network as a colored pill badge (amber for testnet, green for mainnet)
  • The testnet warning banner (DemoBanner) now only renders when VITE_STELLAR_NETWORK=testnet, and is hidden on mainnet
  • Updated the frontend Dockerfile and docker-compose.yml to forward the STELLAR_NETWORK env var as a Vite build argument

Closes #9

Test plan

  • Set VITE_STELLAR_NETWORK=testnet and verify the amber "Testnet" badge appears in the NavBar and the warning banner is visible
  • Set VITE_STELLAR_NETWORK=mainnet and verify the green "Mainnet" badge appears and the warning banner is hidden
  • Omit VITE_STELLAR_NETWORK entirely and verify it defaults to testnet
  • Verify Freighter wallet connection uses the correct network identifier (TESTNET vs PUBLIC)
  • Build with Docker and confirm STELLAR_NETWORK from .env flows through to the frontend bundle

Generated with Claude Code

- 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>
@dev-fatima-24
dev-fatima-24 merged commit 46b7ab1 into Vacci-chain:main Sep 2, 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.

Add network selector for testnet/mainnet

2 participants