feat(keyring-eth-cash): add cash account keyring based on hd-key-ring#472
feat(keyring-eth-cash): add cash account keyring based on hd-key-ring#472
Conversation
5f50434 to
ca5f3e9
Compare
ca5f3e9 to
01e9b64
Compare
Yes, if this is what the product expects, we should enforce it. Otherwise, we might mistakenly create more than one account and end up dealing with this kind of hard-to-solve bug. |
|
Calling it WDYT @gantunesr, @ccharly ? |
|
|
||
| - Install [Node.js](https://nodejs.org) version 18 | ||
| - If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm use` will automatically choose the right node version for you. | ||
| - Install [Yarn v3](https://yarnpkg.com/getting-started/install) |
There was a problem hiding this comment.
Not sure this is up-to-date (to be checked @ccharly)
There was a problem hiding this comment.
Yep, we use v4 now. That does not change much anyway 😄 but if you could change that too, that'd be nice!
| } from '@metamask/eth-hd-keyring'; | ||
|
|
||
| const hdPathString = `m/44'/4392018'/0'/0`; | ||
| const type = 'Cash Account Keyring'; |
There was a problem hiding this comment.
I would also export it just in case and maybe rename it to CASH_ACCOUNT_KEYRING_TYPE.
That could allow us to re-inject this constant value in some other enums (like the one in @metamask/keyring-controller (KeyringTypes).
I think you're right yep! |
81d726d to
fe35f69
Compare
5395223 to
b26b341
Compare
| account_api --> keyring_api; | ||
| account_api --> keyring_utils; | ||
| keyring_api --> keyring_utils; | ||
| eth_cash_keyring --> keyring_eth_hd; |
There was a problem hiding this comment.
Mermaid diagram references wrong node variable name
Medium Severity
The new dependency edge eth_cash_keyring --> keyring_eth_hd references an undefined Mermaid node keyring_eth_hd. The correct variable name is eth_hd_keyring, as defined on line 45 and used consistently on lines 60–62. Mermaid will auto-create a separate orphan node instead of linking to the actual @metamask/eth-hd-keyring node, causing the dependency graph to render incorrectly.
| export const CASH_DERIVATION_PATH = `m/44'/4392018'/0'/0`; | ||
| const type = 'Cash Keyring'; | ||
|
|
||
| export class CashKeyring extends HdKeyring { |
There was a problem hiding this comment.
Double checking if this keyring should support removeAccount
There was a problem hiding this comment.
I don't know if we need it. But having it shouldn't cause an issue, right?
There was a problem hiding this comment.
I don't think so. Depending on designs, account is going to be largely hidden in the client anyway, so removing it wouldn't really serve any purpose
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions (from the Expand for full list of packages and versions. |


Implements a new keyring to support MUSD-386
Examples
Note
Medium Risk
Introduces a new public
KeyringType.Cashenum value and a new keyring package that derives/signs accounts on a different path; downstream consumers with exhaustive handling of keyring types or assumptions about HD derivation may need updates.Overview
Adds cash account support by introducing a new
@metamask/eth-cash-keyringpackage that extends@metamask/eth-hd-keyringwith a distinct type ("Cash Keyring"), fixed derivation path (m/44'/4392018'/0'/0), and single-account behavior.Updates the public API to include
KeyringType.Cash(with type-level coverage inkeyring.test-d.ts), and wires the new package into repo tooling/docs (PR title validation scope, root README module list/dependency graph, TS project references, andyarn.lock).Written by Cursor Bugbot for commit 25e4b24. This will update automatically on new commits. Configure here.