Commit 4a7d035
authored
feat: add
Added a v2 wrapper for the `MoneyKeyring`. Since the underlying keyring
is an `HDKeyring`, this wrapper is just converting the underlying
accounts to `KeyringAccount`.
Note: `deleteAccount` was added to satisfy the v2 interface but is a
no-op since deletion of Money accounts is not supported.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches account exposure and signing request handling for money
accounts, but follows the same EthKeyringWrapper pattern as other ETH
keyrings with extensive new tests.
>
> **Overview**
> Adds a **v2 `MoneyKeyring` adapter** for `@metamask/eth-money-keyring`
that wraps the existing legacy keyring behind the unified `Keyring` API
(`@metamask/keyring-sdk/v2`’s `EthKeyringWrapper`).
>
> Consumers can import it via the new
**`@metamask/eth-money-keyring/v2`** export (plus a Browserify `v2.js`
shim). The wrapper maps the inner HD-backed money keyring to
**`KeyringAccount`** objects: EOA scope, mnemonic entropy metadata on
`MONEY_DERIVATION_PATH`, and a **fixed signing method set** (personal
sign, typed data v1–v4, EIP-7702 authorization). Account lifecycle is
**strictly single-account**: `getAccounts`/`createAccounts` only allow
index `0`, reject other BIP-44 creation types and entropy mismatches,
and **`deleteAccount` is intentionally a no-op** to satisfy the v2
interface without removing money accounts. Package metadata, changelog,
README dependency graph, and **`@metamask/keyring-sdk`** dependency are
updated accordingly; broad Jest coverage exercises account shape,
creation guards, serialize/deserialize, and signing requests.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
8761382. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->MoneyKeyring keyring V2 wrapper (#554)1 parent f6e4d2e commit 4a7d035
8 files changed
Lines changed: 795 additions & 1 deletion
File tree
- packages/keyring-eth-money
- src/v2
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
35 | 46 | | |
36 | 47 | | |
37 | 48 | | |
| |||
57 | 68 | | |
58 | 69 | | |
59 | 70 | | |
| 71 | + | |
60 | 72 | | |
61 | 73 | | |
62 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments