Skip to content

Commit b42b8e1

Browse files
authored
refactor(account-api)!: rename getGroupIndexFromMultichainAccountId -> getGroupIndexFromMultichainAccountGroupId (#336)
We forgot to rename this function when removing the old implementation.
1 parent 6adc50f commit b42b8e1

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

packages/account-api/CHANGELOG.md

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

88
## [Unreleased]
99

10+
### Changed
11+
12+
- **BREAKING:** Rename `getGroupIndexFromMultichainAccountId` to `getGroupIndexFromMultichainAccountGroupId` ([#336](https://github.com/MetaMask/accounts/pull/336))
13+
- This function was not following the same naming convention (this is an oversight from previous release).
14+
1015
## [0.6.0]
1116

1217
### Changed

packages/account-api/src/api/multichain/group.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export function isMultichainAccountGroupId(
9595
* @param id - Multichain account ID.
9696
* @returns The multichain account index if extractable, undefined otherwise.
9797
*/
98-
export function getGroupIndexFromMultichainAccountId(
98+
export function getGroupIndexFromMultichainAccountGroupId(
9999
id: MultichainAccountGroupId,
100100
): number {
101101
const matched = id.match(MULTICHAIN_ACCOUNT_GROUP_ID_REGEX);

packages/account-api/src/index.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
toAccountGroupId,
1616
toAccountWalletId,
1717
toDefaultAccountGroupId,
18-
getGroupIndexFromMultichainAccountId,
18+
getGroupIndexFromMultichainAccountGroupId,
1919
isBip44Account,
2020
toMultichainAccountWalletId,
2121
toMultichainAccountGroupId,
@@ -163,15 +163,17 @@ describe('index', () => {
163163
const walletId = toMultichainAccountWalletId('test');
164164
const groupId = toMultichainAccountGroupId(walletId, groupIndex);
165165

166-
expect(getGroupIndexFromMultichainAccountId(groupId)).toBe(groupIndex);
166+
expect(getGroupIndexFromMultichainAccountGroupId(groupId)).toBe(
167+
groupIndex,
168+
);
167169
});
168170

169171
it('throws if it cannot extract group index', () => {
170172
const walletId = toAccountWalletId(AccountWalletType.Keyring, 'test');
171173
const groupId = toAccountGroupId(walletId, 'test');
172174

173175
expect(() =>
174-
getGroupIndexFromMultichainAccountId(
176+
getGroupIndexFromMultichainAccountGroupId(
175177
// Force the error case even though, type wise, this should not
176178
// be possible!
177179
groupId as unknown as MultichainAccountGroupId,

0 commit comments

Comments
 (0)