Skip to content

feat: token balances hook, network hook, mismatch banner, and auto-reconnect#90

Merged
IbrahimIjai merged 1 commit into
SO4-Markets:mainfrom
boys-cyberhub:feat/issues-22-23-24-25
May 27, 2026
Merged

feat: token balances hook, network hook, mismatch banner, and auto-reconnect#90
IbrahimIjai merged 1 commit into
SO4-Markets:mainfrom
boys-cyberhub:feat/issues-22-23-24-25

Conversation

@boys-cyberhub
Copy link
Copy Markdown
Contributor

Closes #22
Closes #23
Closes #24
Closes #25

Summary

  • #22 — Implement useTokenBalances hook (SAC tokens) #22 useTokenBalancesfeatures/wallet/hooks/useTokenBalances.ts: React Query hook fetching USDC/BTC/ETH/XLM balances from Horizon /accounts/{address} (trustlines + native XLM). Returns Record<string, number>, staleTime/refetchInterval 15 s, only enabled when wallet is connected. Balance row wired into the TradePanel collateral input header.
  • #23 — Implement useNetwork hook #23 useNetworkfeatures/wallet/hooks/useNetwork.ts: Returns { network, isTestnet, isMainnet, mismatch } from the wallet store. mismatch is true when the wallet is connected and the stored network differs from VITE_NETWORK.
  • #24 — Network mismatch warning banner #24 NetworkMismatchBannerfeatures/wallet/components/NetworkMismatchBanner.tsx: Top-of-page role="alert" banner rendered when mismatch && connected. Skipped on the landing page (/). Dismissible for the session via sessionStorage.
  • #25 — Auto-reconnect on page refresh #25 Auto-reconnectfeatures/wallet/components/WalletProvider.tsx: On mount, if the store has a persisted address+walletId, calls walletKit.setWallet(walletId) then walletKit.getAddress(). Matching address → setConnected; mismatch or any error → setDisconnected silently (no toast). Mounted in __root.tsx wrapping all routes.

Test plan

  • Connect a wallet, refresh the page — verify no connection modal appears and the app shows the connected address
  • Remove the wallet extension, refresh — verify the store clears and no error toast fires
  • Set VITE_NETWORK=testnet with a mainnet wallet connected — verify the yellow banner appears on /trade but not on /
  • Dismiss the banner — verify it disappears for the session and reappears after reconnecting
  • Confirm the "Balance:" row appears next to the Collateral label when wallet is connected
  • Disconnect wallet — verify Balance row disappears

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@boys-cyberhub 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

@IbrahimIjai IbrahimIjai merged commit 51abe48 into SO4-Markets:main May 27, 2026
1 check failed
AbelOsaretin pushed a commit that referenced this pull request May 29, 2026
…th real StakingRouter.claimRewards tx, #127 #91 — Replace withdrawGLV stub with real GlvRouter.createWithdrawal tx, #126 #90 — Replace depositGLV stub with real GlvRouter.createDeposit tx, #125 #89 — Replace withdrawGM stub with real ExchangeRouter.createWithdrawal tx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants