Summary
The wallet balance API call is hitting the wrong URL and returning 404 on every request. This is the highest-priority frontend bug identified in the API audit because it causes WithdrawalForm.tsx to display an error banner on every load for every authenticated user.
Root Cause
lib/api/wallet.ts calls /wallets/balances but the correct backend path is /users/wallet/balances. Live probe confirmed:
GET /v1/wallets/balances → 404 Not Found ("Cannot GET /v1/wallets/balances")
GET /v1/users/wallet/balances → 401 Unauthorized (route exists and is protected)
Impact
WithdrawalForm.tsx calls getBalances() on mount. Because getBalances() always throws (404), the component lands on its error state and shows "Unable to load currencies or balances. Please try again." for every authenticated user — the form is unusable.
components/dashboard/account-overview.tsx has a TODO comment to wire up getBalances() once this path is fixed. Once this issue is resolved, that wiring can proceed (tracked in a separate issue).
What Needs to Be Done
File: lib/api/wallet.ts
Change:
const data = await apiClient<any>("/wallets/balances", {
To:
const data = await apiClient<any>("/users/wallet/balances", {
Also check whether useProxy should be true (routed via /api/proxy) or false (direct call). All other authenticated calls in lib/api/users.ts use useProxy: false — verify with the backend team which pattern applies here and update accordingly.
Acceptance Criteria
Constraints
- Do not change
WithdrawalForm.tsx logic in this PR — the path fix in lib/api/wallet.ts is the only required change
- Complexity: Low — 150 points
Summary
The wallet balance API call is hitting the wrong URL and returning 404 on every request. This is the highest-priority frontend bug identified in the API audit because it causes
WithdrawalForm.tsxto display an error banner on every load for every authenticated user.Root Cause
lib/api/wallet.tscalls/wallets/balancesbut the correct backend path is/users/wallet/balances. Live probe confirmed:GET /v1/wallets/balances→404 Not Found("Cannot GET /v1/wallets/balances")GET /v1/users/wallet/balances→401 Unauthorized(route exists and is protected)Impact
WithdrawalForm.tsxcallsgetBalances()on mount. BecausegetBalances()always throws (404), the component lands on its error state and shows"Unable to load currencies or balances. Please try again."for every authenticated user — the form is unusable.components/dashboard/account-overview.tsxhas aTODOcomment to wire upgetBalances()once this path is fixed. Once this issue is resolved, that wiring can proceed (tracked in a separate issue).What Needs to Be Done
File:
lib/api/wallet.tsChange:
To:
Also check whether
useProxyshould betrue(routed via/api/proxy) orfalse(direct call). All other authenticated calls inlib/api/users.tsuseuseProxy: false— verify with the backend team which pattern applies here and update accordingly.Acceptance Criteria
lib/api/wallet.tscalls/users/wallet/balancesgetBalances()no longer throws a 404 when called with a valid tokenWithdrawalForm.tsxno longer shows the error banner on load for authenticated usersuseProxyvalue is confirmed and documented in a code commentConstraints
WithdrawalForm.tsxlogic in this PR — the path fix inlib/api/wallet.tsis the only required change