Skip to content

feat(wallet): add network mismatch detection banner#73

Merged
johdanike merged 1 commit into
SwiftChainn:mainfrom
spiffamani:feat/network-detection
Apr 28, 2026
Merged

feat(wallet): add network mismatch detection banner#73
johdanike merged 1 commit into
SwiftChainn:mainfrom
spiffamani:feat/network-detection

Conversation

@spiffamani
Copy link
Copy Markdown

Closes #30

Summary

Implements network mismatch detection — a red banner appears immediately when the connected wallet is on a different Stellar network than the one configured in NEXT_PUBLIC_STELLAR_NETWORK.

Changes

  • services/networkService.ts — API service with getWalletNetwork() that fetches the wallet's current network from the backend
  • hooks/useNetworkCheck.ts — hook that polls every 10 seconds, compares wallet network against NEXT_PUBLIC_STELLAR_NETWORK, and returns a typed status
  • components/wallet/NetworkWarning.tsx — red banner component that:
    • Appears immediately on network mismatch
    • Shows which network the wallet is on vs which is expected
    • Has a dismiss button (banner reappears on next poll if still mismatched)
    • Has a Re-check button to trigger an immediate re-check
    • Handles error state with retry option
    • Hidden when networks match or no wallet is connected

Architecture

Follows the required Component → Hook → Service layered pattern.

Key behaviour

  • Banner appears immediately when wrong network is detected
  • Polls every 10 seconds while wallet is connected
  • Resets dismissed state if network changes again
  • Uses NEXT_PUBLIC_STELLAR_NETWORK from .env as the source of truth

Screenshot

[attach screenshot showing the red banner]

- Add services/networkService.ts with getWalletNetwork API call
- Add hooks/useNetworkCheck.ts with polling every 10s and mismatch detection
- Add components/wallet/NetworkWarning.tsx with red banner, dismiss, and retry

Closes SwiftChainn#30
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 28, 2026

@spiffamani Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@johdanike johdanike merged commit 74e8188 into SwiftChainn:main Apr 28, 2026
0 of 2 checks passed
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.

Frontend: Network Mismatch Detection Banner

2 participants