Problem
The planned deposit modal (issue #19) requires validating the user's input against their actual Stellar wallet balance. Currently there is no utility to fetch a wallet's asset balance from Horizon. Without this, the UI cannot prevent users from attempting to deposit more than they hold, which would produce a confusing contract error.
Expected Behaviour
Before the deposit modal renders (or within it as a side-effect), the connected wallet's balance for the pool's staking asset is fetched from Horizon and displayed. The amount input's max value is capped at this balance, and attempting to submit more shows an inline validation error.
Acceptance Criteria
Relevant Files
src/lib/stellar.ts — create this file
src/hooks/useAccountBalance.ts — create this hook
src/config/index.ts — horizonUrl already exported
Problem
The planned deposit modal (issue #19) requires validating the user's input against their actual Stellar wallet balance. Currently there is no utility to fetch a wallet's asset balance from Horizon. Without this, the UI cannot prevent users from attempting to deposit more than they hold, which would produce a confusing contract error.
Expected Behaviour
Before the deposit modal renders (or within it as a side-effect), the connected wallet's balance for the pool's staking asset is fetched from Horizon and displayed. The amount input's max value is capped at this balance, and attempting to submit more shows an inline validation error.
Acceptance Criteria
src/lib/stellar.ts(new file) exportsfetchAccountBalances(publicKey: string, horizonUrl: string): Promise<Balance[]>whereBalance = { asset_code: string; asset_issuer?: string; balance: string; is_native?: boolean }GET /accounts/{id}(not the SDK'sAccountCallBuilder) so it works in a static-export Next.js environment without a Node.js serveruseAccountBalance(assetCode, assetIssuer)hook insrc/hooks/useAccountBalance.tscallsfetchAccountBalanceswith React Query (staleTime: 15000, refetch on wallet focus)Relevant Files
src/lib/stellar.ts— create this filesrc/hooks/useAccountBalance.ts— create this hooksrc/config/index.ts—horizonUrlalready exported