Simplify `contract.ts` read path: one simulate helper, configurable READ_SOURCE

Đang mở
#91 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
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
blockchain

Hướng nghiên cứu

Start in web/lib/contract.ts, comparing getTokenBalance with simulateRead and noting the dynamic Account import beside the static SDK import. Move the duplicated simulation logic into one helper that takes a contract id, then make the read source come from NEXT_PUBLIC_READ_SOURCE via web/lib/config.ts, keeping the current address as the default. Done when existing reads behave the same, no simulation code is duplicated, and web/.env.example documents the variable. Coordinate with #12, #16 and #60, which touch the same file.

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

Mô tả

difficulty: intermediate help wanted refactor Stellar Wave web

Difficulty: Intermediate

Problem

getTokenBalance duplicates the logic of simulateRead; Account is imported dynamically although the SDK is already imported statically; and READ_SOURCE is the admin address hard-coded in the file.

Why it matters

Duplicate code diverges, and anyone deploying their own contract inherits an unrelated hard-coded address.

Scope of work

Create a single simulation helper that takes a contract id, remove the dynamic import, and make the read source configurable through NEXT_PUBLIC_READ_SOURCE with the current value as the default. Document it in .env.example.

Acceptance criteria

  • Behaviour unchanged for all existing reads.
  • No duplicated simulation code.
  • .env.example documents the new variable.

Relevant files

  • web/lib/contract.ts, web/lib/config.ts, web/.env.example

Dependencies

Coordinate with #12 and #16 and with #60, which edit the same file.

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.