Display user STX balance before sending tips#167
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
STACKS_API_BASEto contract config for centralized API endpointuseBalancehook that fetches balance from Hiro API