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

Abierto
#8,793 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@grypez ya está trabajando en esto.

Desde el 26/5/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

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.
Lenguaje dominante
TypeScript
Estrellas
424
Forks
311
Merge medio
1 d 8 h
PR fusionados (30 d)
446

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MetaMask/core

Todos los issues de MetaMask/core

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.