Skip to content

Connected Wallet Balance Display with Manual Refresh #508

Description

@Kingsman-99

Description

Users must open Freighter or an external explorer to check their current XLM and USDC balances while using the dApp, breaking their workflow when deciding whether they have enough funds to pay an invoice. A balance display in the wallet area with a manual refresh button should surface this information in-app.

Technical Context

src/components/wallet/WalletBalanceDisplay.tsx (new) calls src/app/api/wallet/balance/route.ts (new), which queries Horizon /accounts/<publicKey> for native and USDC balances. The balance is rendered in src/components/wallet/WalletMenu.tsx below the address display. A refresh icon button triggers a refetch via src/hooks/useWalletBalance.ts invalidating the swr key. Balances auto-refresh every 30 seconds when the menu is open.

Acceptance Criteria

  • The wallet menu shows the connected account's XLM and USDC balances fetched from Horizon
  • A refresh button in the wallet menu triggers an immediate balance refetch
  • Balances are formatted to 2 decimal places for USDC and 7 for XLM
  • While balances are loading, skeleton text placeholders appear
  • Balances auto-refresh every 30 seconds while the wallet menu is open, stopping when it closes
  • All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions