Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/account-tree-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **BREAKING:** Bump peer dependency `@metamask/account-api` from `^0.3.0` to `^0.5.0` ([#6214](https://github.com/MetaMask/core/pull/6214))
- **BREAKING:** Bump peer dependency `@metamask/account-api` from `^0.3.0` to `^0.6.0` ([#6214](https://github.com/MetaMask/core/pull/6214)), ([#6216](https://github.com/MetaMask/core/pull/6216))
- **BREAKING:** Move `wallet.metadata.type` tag to `wallet` node ([#6214](https://github.com/MetaMask/core/pull/6214))
- This `type` can be used as a tag to strongly-type (tagged-union) the `AccountWalletObject`.
- Defaults to the EVM account from a group when using `setSelectedAccountGroup` ([#6208](https://github.com/MetaMask/core/pull/6208))
Expand Down
4 changes: 2 additions & 2 deletions packages/account-tree-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"@metamask/account-api": "^0.5.0",
"@metamask/account-api": "^0.6.0",
"@metamask/accounts-controller": "^32.0.1",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/keyring-api": "^19.0.0",
Expand All @@ -70,7 +70,7 @@
"webextension-polyfill": "^0.12.0"
},
"peerDependencies": {
"@metamask/account-api": "^0.5.0",
"@metamask/account-api": "^0.6.0",
"@metamask/accounts-controller": "^32.0.0",
"@metamask/keyring-controller": "^22.0.0",
"@metamask/providers": "^22.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
AccountWalletType,
toAccountGroupId,
toAccountWalletId,
toMultichainAccountId,
toMultichainAccountGroupId,
toMultichainAccountWalletId,
type AccountGroupId,
} from '@metamask/account-api';
Expand Down Expand Up @@ -383,18 +383,18 @@ describe('AccountTreeController', () => {
const expectedWalletId1 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_1.metadata.id,
);
const expectedWalletId1Group = toMultichainAccountId(
const expectedWalletId1Group = toMultichainAccountGroupId(
expectedWalletId1,
MOCK_HD_ACCOUNT_1.options.entropy.groupIndex,
);
const expectedWalletId2 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_2.metadata.id,
);
const expectedWalletId2Group1 = toMultichainAccountId(
const expectedWalletId2Group1 = toMultichainAccountGroupId(
expectedWalletId2,
MOCK_HD_ACCOUNT_2.options.entropy.groupIndex,
);
const expectedWalletId2Group2 = toMultichainAccountId(
const expectedWalletId2Group2 = toMultichainAccountGroupId(
expectedWalletId2,
MOCK_SNAP_ACCOUNT_1.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -563,7 +563,7 @@ describe('AccountTreeController', () => {
const expectedWalletId = toMultichainAccountWalletId(
MOCK_HD_KEYRING_2.metadata.id,
);
const expectedGroupId = toMultichainAccountId(
const expectedGroupId = toMultichainAccountGroupId(
expectedWalletId,
mockSnapAccountWithEntropy.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -675,7 +675,7 @@ describe('AccountTreeController', () => {
const walletId1 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_1.metadata.id,
);
const walletId1Group = toMultichainAccountId(
const walletId1Group = toMultichainAccountGroupId(
walletId1,
mockHdAccount1.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -752,7 +752,7 @@ describe('AccountTreeController', () => {
const walletId1 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_1.metadata.id,
);
const walletId1Group = toMultichainAccountId(
const walletId1Group = toMultichainAccountGroupId(
walletId1,
mockHdAccount1.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -829,14 +829,14 @@ describe('AccountTreeController', () => {
const walletId1 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_1.metadata.id,
);
const walletId1Group = toMultichainAccountId(
const walletId1Group = toMultichainAccountGroupId(
walletId1,
mockHdAccount1.options.entropy.groupIndex,
);
const walletId2 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_2.metadata.id,
);
const walletId2Group = toMultichainAccountId(
const walletId2Group = toMultichainAccountGroupId(
walletId2,
mockHdAccount2.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -961,7 +961,7 @@ describe('AccountTreeController', () => {
const groups = wallet.getAccountGroups();
expect(groups).toHaveLength(1);
expect(groups[0].id).toStrictEqual(
toMultichainAccountId(
toMultichainAccountGroupId(
wallet.id as MultichainAccountWalletId,
MOCK_HD_ACCOUNT_1.options.entropy.groupIndex,
),
Expand All @@ -979,7 +979,7 @@ describe('AccountTreeController', () => {
expect(wallets).toHaveLength(1);

const wallet = wallets[0];
const groupId = toMultichainAccountId(
const groupId = toMultichainAccountGroupId(
wallet.id as MultichainAccountWalletId,
MOCK_HD_ACCOUNT_1.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -1178,7 +1178,7 @@ describe('AccountTreeController', () => {
const expectedWalletId2 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_2.metadata.id,
);
const expectedGroupId2 = toMultichainAccountId(
const expectedGroupId2 = toMultichainAccountGroupId(
expectedWalletId2,
MOCK_HD_ACCOUNT_2.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -1218,7 +1218,7 @@ describe('AccountTreeController', () => {
const expectedWalletId2 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_2.metadata.id,
);
const expectedGroupId2 = toMultichainAccountId(
const expectedGroupId2 = toMultichainAccountGroupId(
expectedWalletId2,
nonEvmAccount2.options.entropy.groupIndex,
);
Expand All @@ -1244,7 +1244,7 @@ describe('AccountTreeController', () => {
const expectedWalletId = toMultichainAccountWalletId(
MOCK_HD_KEYRING_1.metadata.id,
);
const expectedGroupId = toMultichainAccountId(
const expectedGroupId = toMultichainAccountGroupId(
expectedWalletId,
MOCK_HD_ACCOUNT_1.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -1277,7 +1277,7 @@ describe('AccountTreeController', () => {
const expectedWalletId1 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_1.metadata.id,
);
const expectedGroupId1 = toMultichainAccountId(
const expectedGroupId1 = toMultichainAccountGroupId(
expectedWalletId1,
MOCK_HD_ACCOUNT_1.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -1353,7 +1353,7 @@ describe('AccountTreeController', () => {
const expectedWalletId1 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_1.metadata.id,
);
const expectedGroupId1 = toMultichainAccountId(
const expectedGroupId1 = toMultichainAccountGroupId(
expectedWalletId1,
MOCK_HD_ACCOUNT_1.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -1387,7 +1387,7 @@ describe('AccountTreeController', () => {
const expectedWalletId1 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_1.metadata.id,
);
const expectedGroupId1 = toMultichainAccountId(
const expectedGroupId1 = toMultichainAccountGroupId(
expectedWalletId1,
MOCK_HD_ACCOUNT_1.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -1430,7 +1430,7 @@ describe('AccountTreeController', () => {
const expectedWalletId1 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_1.metadata.id,
);
const expectedGroupId1 = toMultichainAccountId(
const expectedGroupId1 = toMultichainAccountGroupId(
expectedWalletId1,
MOCK_HD_ACCOUNT_1.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -1467,7 +1467,7 @@ describe('AccountTreeController', () => {
const expectedWalletId1 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_1.metadata.id,
);
const expectedGroupId1 = toMultichainAccountId(
const expectedGroupId1 = toMultichainAccountGroupId(
expectedWalletId1,
MOCK_HD_ACCOUNT_1.options.entropy.groupIndex,
);
Expand All @@ -1476,7 +1476,7 @@ describe('AccountTreeController', () => {
const expectedWalletId2 = toMultichainAccountWalletId(
MOCK_HD_KEYRING_2.metadata.id,
);
const expectedGroupId2 = toMultichainAccountId(
const expectedGroupId2 = toMultichainAccountGroupId(
expectedWalletId2,
MOCK_HD_ACCOUNT_2.options.entropy.groupIndex,
);
Expand Down Expand Up @@ -1557,7 +1557,7 @@ describe('AccountTreeController', () => {
);

const group: AccountGroupObject = {
id: toMultichainAccountId(
id: toMultichainAccountGroupId(
toMultichainAccountWalletId('test'),
MOCK_HD_ACCOUNT_1.options.entropy.groupIndex,
),
Expand Down
4 changes: 2 additions & 2 deletions packages/account-tree-controller/src/group.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {
AccountGroupType,
MultichainAccountId,
MultichainAccountGroupId,
} from '@metamask/account-api';
import type { AccountGroup, AccountGroupId } from '@metamask/account-api';
import type { AccountId } from '@metamask/accounts-controller';
Expand Down Expand Up @@ -32,7 +32,7 @@ type IsAccountGroupObject<
*/
export type AccountGroupMultichainAccountObject = {
type: AccountGroupType.MultichainAccount;
id: MultichainAccountId;
id: MultichainAccountGroupId;
// Blockchain Accounts (at least 1 account per multichain-accounts):
accounts: [AccountId, ...AccountId[]];
metadata: {
Expand Down
4 changes: 2 additions & 2 deletions packages/account-tree-controller/src/rules/entropy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
AccountGroupType,
AccountWalletType,
isBip44Account,
toMultichainAccountId,
toMultichainAccountGroupId,
toMultichainAccountWalletId,
} from '@metamask/account-api';
import { isEvmAccountType } from '@metamask/keyring-api';
Expand Down Expand Up @@ -48,7 +48,7 @@ export class EntropyRule
}

const walletId = toMultichainAccountWalletId(entropySource);
const groupId = toMultichainAccountId(
const groupId = toMultichainAccountGroupId(
walletId,
account.options.entropy.groupIndex,
);
Expand Down
4 changes: 2 additions & 2 deletions packages/account-tree-controller/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ export type AccountWalletEntropyObject = {
type: AccountWalletType.Entropy;
id: MultichainAccountWalletId;
groups: {
// NOTE: Using `MultichainAccountId` instead of `AccountGroupId` would introduce
// NOTE: Using `MultichainAccountGroupId` instead of `AccountGroupId` would introduce
// some type problems when using a group ID as an `AccountGroupId` directly. This
// would require some up-cast to a `MultichainAccountId` which could be considered
// would require some up-cast to a `MultichainAccountGroupId` which could be considered
// unsafe... So we keep it as a `AccountGroupId` for now.
[groupId: AccountGroupId]: AccountGroupMultichainAccountObject;
};
Expand Down
6 changes: 5 additions & 1 deletion packages/multichain-account-service/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **BREAKING:** Bump peer dependency `@metamask/account-api` from `^0.3.0` to `^0.5.0` ([#6214](https://github.com/MetaMask/core/pull/6214))
- **BREAKING:** Bump peer dependency `@metamask/account-api` from `^0.3.0` to `^0.6.0` ([#6214](https://github.com/MetaMask/core/pull/6214)), ([#6216](https://github.com/MetaMask/core/pull/6216))
- **BREAKING:** Rename `MultichainAccount` to `MultichainAccountGroup` ([#6216](https://github.com/MetaMask/core/pull/6216))
- The naming was confusing and since a `MultichainAccount` is also an `AccountGroup` it makes sense to have the suffix there too.
- **BREAKING:** Rename `getMultichainAccount*` to `getMultichainAccountGroup*` ([#6216](https://github.com/MetaMask/core/pull/6216))
- The naming was confusing and since a `MultichainAccount` is also an `AccountGroup` it makes sense to have the suffix there too.

## [0.3.0]

Expand Down
5 changes: 3 additions & 2 deletions packages/multichain-account-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@
"@metamask/keyring-api": "^19.0.0",
"@metamask/keyring-internal-api": "^7.0.0",
"@metamask/keyring-snap-client": "^6.0.0",
"@metamask/keyring-utils": "^3.1.0",
"@metamask/snaps-sdk": "^9.0.0",
"@metamask/snaps-utils": "^11.0.0",
"@metamask/superstruct": "^3.1.0"
},
"devDependencies": {
"@metamask/account-api": "^0.5.0",
"@metamask/account-api": "^0.6.0",
"@metamask/accounts-controller": "^32.0.1",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eth-snap-keyring": "^14.0.0",
Expand All @@ -73,7 +74,7 @@
"webextension-polyfill": "^0.12.0"
},
"peerDependencies": {
"@metamask/account-api": "^0.5.0",
"@metamask/account-api": "^0.6.0",
"@metamask/accounts-controller": "^32.0.0",
"@metamask/keyring-controller": "^22.0.0",
"@metamask/providers": "^22.0.0",
Expand Down
Loading
Loading