Skip to content

Display user STX balance before sending tips#167

Merged
Mosas2000 merged 3 commits intomainfrom
feature/user-balance-display
Feb 26, 2026
Merged

Display user STX balance before sending tips#167
Mosas2000 merged 3 commits intomainfrom
feature/user-balance-display

Conversation

@Mosas2000
Copy link
Copy Markdown
Owner

Closes #50

Shows the user's current STX balance in the tip form so they know how much they can send without switching to their wallet.

Changes:

  • Add STACKS_API_BASE to contract config for centralized API endpoint
  • Add useBalance hook that fetches balance from Hiro API
  • Display balance card with refresh button above the amount field
  • Validate tip amount against available balance
  • Auto-refetch balance after successful tip

Centralizes the API endpoint based on VITE_NETWORK environment variable.
Supports mainnet, testnet, and devnet URLs. Defaults to mainnet.
Custom hook that fetches the user's STX balance from the Hiro API.
Returns balance as BigInt micro-STX for precision, along with loading
and error states. Includes a refetch function for manual refresh.
Show current STX balance above the amount field with a refresh button.
Validate tip amount against available balance before submission.
Refetch balance automatically after a successful tip transaction.
@Mosas2000 Mosas2000 merged commit 292fc51 into main Feb 26, 2026
2 of 4 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.

No user balance display before sending a tip

1 participant