You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StakingInterface.tsx calculates percentage presets from a hard-coded BALANCE = 1000. A user can therefore select an amount unrelated to the connected wallet's USDC balance. The interface also cannot distinguish insufficient token balance, missing trustline, or insufficient XLM for transaction fees.
Goal
Use live Stellar account data to make stake amounts accurate and prevent avoidable failed transactions.
Acceptance criteria
Add a reusable wallet-balance hook/service that loads native XLM and the configured stake asset balance for the active network and connected address.
Validate the stake asset by issuer and asset code or SAC contract ID; do not identify USDC by symbol alone.
The 25%, 50%, 75%, and MAX controls use the spendable stake-asset balance rather than a constant.
MAX respects the contract minimum/maximum stake rules and retains the required XLM reserve/fee buffer where applicable.
The interface displays distinct states for disconnected wallet, account not funded, missing trustline, stale RPC response, zero balance, and insufficient fee balance.
Stake submission is disabled when the amount is non-positive, exceeds the spendable balance, violates contract limits, or the market is no longer active.
Asset amounts preserve Stellar's 7-decimal precision internally and are formatted consistently for display.
Balance data refreshes after wallet/network changes and after a successful stake without causing duplicate requests.
Unit tests cover decimal conversion and MAX calculation; component tests cover each disabled/error state.
No hard-coded wallet balance remains in the staking production path.
Package:
packages/frontendComplexity: Medium
Problem
StakingInterface.tsxcalculates percentage presets from a hard-codedBALANCE = 1000. A user can therefore select an amount unrelated to the connected wallet's USDC balance. The interface also cannot distinguish insufficient token balance, missing trustline, or insufficient XLM for transaction fees.Goal
Use live Stellar account data to make stake amounts accurate and prevent avoidable failed transactions.
Acceptance criteria
Technical pointers
packages/frontend/src/components/StakingInterface.tsxpackages/frontend/src/components/StakeInput.tsxpackages/frontend/src/hooks/useWallet.tspackages/frontend/src/components/WalletContext.tsxpackages/frontend/src/components/GasFeeDisplay.tsxOut of scope