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

Offen
#8,793 0 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@grypez arbeitet bereits daran.

Seit 26.5.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

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.
Vorherrschende Sprache
TypeScript
Sterne
424
Forks
311
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
446

Entwicklungsumgebung

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Hat eine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus MetaMask/core

Alle Issues in MetaMask/core

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.