wallet: Document the state-injection contract in README

未关闭
#8,792 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@grypez 已经在做这个了。

开始于 2026年5月26日。

评估

这个 Issue 还没有评估数据。

描述

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.
主要语言
TypeScript
星标
420
派生
313
平均合并
1 天 12 小时
30 天内合并 PR
384

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

MetaMask/core 的其他 Issue

查看 MetaMask/core 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。