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

Đang mở
#60 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
66/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
frontend, payments

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
0
Fork
4
Merge trung bình
54 phút
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Yormee-103/PayLoop

Tất cả issue của Yormee-103/PayLoop

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.