`getTokenBalance` returns 0 on RPC errors, showing a false "0 USDC"

Aperta
#60 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
66/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
frontend, payments

Direzione di ricerca

Start with getTokenBalance in web/lib/contract.ts, where the isSimulationError || !retval branch returns 0n, then find its callers in web/app/pay/[id]/page.tsx, web/app/dashboard/page.tsx and web/app/withdraw/page.tsx. Decide whether to throw or return null, and make callers show a placeholder with a retry instead of 0. Done when a simulated RPC failure never displays 0, the insufficient-balance prompt appears only for a real balance, and the withdraw page change is coordinated with #26.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug difficulty: beginner help wanted web

Difficulty: Beginner

Problem

getTokenBalance does if (isSimulationError || !retval) return 0n;, hiding failures. The pay page then concludes the balance is insufficient and nudges the client to the faucet, and Withdraw shows a balance of 0.

Why it matters

Showing wrong money information on a payment screen erodes trust and causes confusing prompts.

Scope of work

Throw (or return null) on error. Callers show "—" with a retry, and keep 0 for a genuine zero balance.

Acceptance criteria

  • A simulated RPC failure shows an error or placeholder, never 0.
  • The insufficient-balance prompt only appears for a real balance.

Relevant files

  • web/lib/contract.ts, web/app/pay/[id]/page.tsx, web/app/dashboard/page.tsx, web/app/withdraw/page.tsx

Dependencies

None. Note that #26 also edits the Withdraw page.

Maintainer discussion needed?

No.

Lingua principale
TypeScript
Stelle
0
Fork
4
Merge medio
54m
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Yormee-103/PayLoop

Tutte le issue di Yormee-103/PayLoop

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.