Skip to content

Commit c254d0c

Browse files
authored
feat(accounts-controller): add account.options.groupIndex for native EVM accounts (#6122)
## Explanation We need this information to be able to group EVM accounts under their proper multichain accounts. ## References N/A ## Changelog N/A ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
1 parent 36c3f4b commit c254d0c

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

packages/accounts-controller/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Add `groupIndex` to EVM HD account options ([#6122](https://github.com/MetaMask/core/pull/6122))
13+
1014
### Changed
1115

1216
- **BREAKING:** Bump peer dependency `@metamask/snaps-controllers` from `^12.0.0` to `^14.0.0` ([#6035](https://github.com/MetaMask/core/pull/6035))

packages/accounts-controller/src/AccountsController.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,8 @@ export class AccountsController extends BaseController<
706706
// getting the keyring instance here feels a bit overkill.
707707
// This will be naturally fixed once every keyring start using `KeyringAccount` and implement the keyring API.
708708
derivationPath: getDerivationPathForIndex(accountIndex),
709+
// Required now for multichain accounts.
710+
groupIndex: accountIndex,
709711
};
710712
}
711713

packages/accounts-controller/src/tests/mocks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,12 @@ export const createMockInternalAccountOptions = (
111111
keyringIndex: number,
112112
keyringType: KeyringTypes,
113113
groupIndex: number,
114-
): Record<string, string> => {
114+
): Record<string, string | number> => {
115115
if (keyringType === KeyringTypes.hd) {
116116
return {
117117
entropySource: `mock-keyring-id-${keyringIndex}`,
118118
derivationPath: `m/44'/60'/0'/0/${groupIndex}`,
119+
groupIndex,
119120
};
120121
}
121122

0 commit comments

Comments
 (0)