wallet: Document the state-injection contract in README

Offen
#8,792 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

@metamask/wallet has no usage documentation. The persistence contract — how consumers supply initial state and subscribe to controller state changes — is entirely implicit. Callers must read the source to understand how to wire persistence, and there is no canonical reference for the expected data shapes or event subscription pattern.

Proposed direction

Add a Usage section to packages/wallet/README.md covering:

  • Hydration: pass an initial state object keyed by controller name to the Wallet constructor. Missing keys fall back to each controller's default state.
  • Writes: subscribe to ${ControllerName}:stateChanged events on wallet.messenger; use wallet.controllerMetadata to identify which fields carry persist: true.
  • Include short code examples for both.
Acceptance
  • README.md has a Usage section with working code examples for both hydration and the stateChanged subscription pattern.
  • The role of wallet.controllerMetadata (identifying persist-flagged fields) is explained.
  • Changelog entry added.
Vorherrschende Sprache
TypeScript
Sterne
422
Forks
313
Ø Merge
1 T. 12 Std.
Gemergte PRs (30 T.)
384

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.