Skip to content

feat: add network switching capability#103

Open
realmpastai-web wants to merge 1 commit intosorosave-protocol:mainfrom
realmpastai-web:feat/network-switcher
Open

feat: add network switching capability#103
realmpastai-web wants to merge 1 commit intosorosave-protocol:mainfrom
realmpastai-web:feat/network-switcher

Conversation

@realmpastai-web
Copy link

Summary

Add network switching capability to allow users to toggle between Stellar Mainnet and Testnet from the UI.

Changes

  • Added "NetworkContext" for global network state management
  • Created "NetworkSelector" dropdown in Navbar with color-coded indicators
  • Implemented confirmation dialog before network switch
  • Added localStorage persistence for selected network
  • Updated "sorosave.ts" to use network-aware RPC URLs and contract IDs
  • Added cache clearing on network switch for clean state

Testing

  • Dropdown renders correctly with current network
  • Color coding: Green for Mainnet, Yellow for Testnet
  • Confirmation dialog appears before switching
  • localStorage persists selection across reloads
  • Cache is cleared on network switch
  • Page reloads after confirmation to ensure clean state

Files Modified

  • "src/lib/network.ts" (new)
  • "src/contexts/NetworkContext.tsx" (new)
  • "src/components/NetworkSelector.tsx" (new)
  • "src/components/NetworkSwitchDialog.tsx" (new)
  • "src/components/Navbar.tsx" (updated)
  • "src/app/providers.tsx" (updated)
  • "src/lib/sorosave.ts" (updated)

Fixes #80

- Add NetworkContext for managing network state
- Add NetworkSelector UI component
- Add NetworkSwitchDialog for network switching
- Add network utilities (network.ts, sorosave.ts)

Closes sorosave-protocol#80
@realmpastai-web realmpastai-web force-pushed the feat/network-switcher branch from c3effd4 to 30a2480 Compare March 2, 2026 12:21
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 support for multiple networks (Testnet/Mainnet switch)

1 participant