wallet: Make `fetch` injectable in `NetworkController` initialization

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

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

@grypez đang làm issue này rồi.

Từ ngày 26/5/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

team-ocap-kernel
Problem

getRpcServiceOptions in packages/wallet/src/initialization/instances/network-controller.ts hardcodes fetch to globalThis.fetch. Platforms that provide their own fetch implementation — React Native being the primary example — cannot supply it, making the wallet non-portable across those environments.

Proposed direction

Add an optional fetch?: typeof globalThis.fetch field to WalletOptions. The NetworkController init should use options.fetch ?? globalThis.fetch.bind(globalThis) when building getRpcServiceOptions, so the default behaviour is unchanged and platform-specific implementations can be injected at construction time.

Acceptance
  • WalletOptions has an optional fetch field.
  • getRpcServiceOptions uses the injected fetch when provided, falling back to globalThis.fetch.
  • Existing tests pass; a test covers the injected-fetch path.
  • Changelog entry added.
Ngôn ngữ chính
TypeScript
Star
424
Fork
311
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
446

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

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

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 MetaMask/core

Tất cả issue của MetaMask/core

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.