Skip to content

Commit d195b01

Browse files
authored
Merge branch 'main' into swaps2873-dynamic-stablecoins
2 parents 8029191 + e565f7e commit d195b01

File tree

95 files changed

+1286
-250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1286
-250
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/core-monorepo",
3-
"version": "553.0.0",
3+
"version": "556.0.0",
44
"private": true,
55
"description": "Monorepo for packages shared between MetaMask clients",
66
"repository": {

packages/account-tree-controller/CHANGELOG.md

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

1010
### Changed
1111

12+
- **BREAKING:** Use `:getSelectedMultichainAccount` instead of `:getSelectedAccount` to compute currently selected account group ([#6608](https://github.com/MetaMask/core/pull/6608))
13+
- Coming from the old account model, a non-EVM account could have been selected and the lastly selected EVM account might not be using the same group index.
1214
- Bump `@metamask/utils` from `^11.4.2` to `^11.8.0` ([#6588](https://github.com/MetaMask/core/pull/6588))
1315

16+
### Removed
17+
18+
- Remove use of `:getSelectedAccount` action ([#6608](https://github.com/MetaMask/core/pull/6608))
19+
1420
## [0.15.1]
1521

1622
### Fixed

packages/account-tree-controller/src/AccountTreeController.test.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ function getAccountTreeControllerMessenger(
229229
allowedActions: [
230230
'AccountsController:listMultichainAccounts',
231231
'AccountsController:getAccount',
232-
'AccountsController:getSelectedAccount',
232+
'AccountsController:getSelectedMultichainAccount',
233233
'AccountsController:setSelectedAccount',
234234
'UserStorageController:getState',
235235
'UserStorageController:performGetStorage',
@@ -305,7 +305,7 @@ function setup({
305305
AccountsController: {
306306
accounts: InternalAccount[];
307307
listMultichainAccounts: jest.Mock;
308-
getSelectedAccount: jest.Mock;
308+
getSelectedMultichainAccount: jest.Mock;
309309
getAccount: jest.Mock;
310310
};
311311
UserStorageController: {
@@ -329,7 +329,7 @@ function setup({
329329
accounts,
330330
listMultichainAccounts: jest.fn(),
331331
getAccount: jest.fn(),
332-
getSelectedAccount: jest.fn(),
332+
getSelectedMultichainAccount: jest.fn(),
333333
},
334334
UserStorageController: {
335335
getState: jest.fn(),
@@ -366,13 +366,13 @@ function setup({
366366
mocks.AccountsController.getAccount,
367367
);
368368

369-
// Mock AccountsController:getSelectedAccount to return the first account
370-
mocks.AccountsController.getSelectedAccount.mockImplementation(
369+
// Mock AccountsController:getSelectedMultichainAccount to return the first account
370+
mocks.AccountsController.getSelectedMultichainAccount.mockImplementation(
371371
() => accounts[0] || MOCK_HD_ACCOUNT_1,
372372
);
373373
messenger.registerActionHandler(
374-
'AccountsController:getSelectedAccount',
375-
mocks.AccountsController.getSelectedAccount,
374+
'AccountsController:getSelectedMultichainAccount',
375+
mocks.AccountsController.getSelectedMultichainAccount,
376376
);
377377

378378
// Mock AccountsController:setSelectedAccount
@@ -750,7 +750,7 @@ describe('AccountTreeController', () => {
750750
keyrings: [MOCK_HD_KEYRING_1],
751751
});
752752

753-
mocks.AccountsController.getSelectedAccount.mockImplementation(
753+
mocks.AccountsController.getSelectedMultichainAccount.mockImplementation(
754754
() => MOCK_HD_ACCOUNT_1,
755755
);
756756

@@ -767,7 +767,7 @@ describe('AccountTreeController', () => {
767767

768768
mocks.AccountsController.accounts = [MOCK_HD_ACCOUNT_2];
769769
mocks.KeyringController.keyrings = [MOCK_HD_KEYRING_2];
770-
mocks.AccountsController.getSelectedAccount.mockImplementation(
770+
mocks.AccountsController.getSelectedMultichainAccount.mockImplementation(
771771
() => MOCK_HD_ACCOUNT_2,
772772
);
773773

@@ -1554,10 +1554,10 @@ describe('AccountTreeController', () => {
15541554

15551555
// Unregister existing handler and register new one BEFORE init
15561556
messenger.unregisterActionHandler(
1557-
'AccountsController:getSelectedAccount',
1557+
'AccountsController:getSelectedMultichainAccount',
15581558
);
15591559
messenger.registerActionHandler(
1560-
'AccountsController:getSelectedAccount',
1560+
'AccountsController:getSelectedMultichainAccount',
15611561
() => EMPTY_ACCOUNT_MOCK,
15621562
);
15631563

@@ -1581,17 +1581,17 @@ describe('AccountTreeController', () => {
15811581
keyrings: [MOCK_HD_KEYRING_1, MOCK_HD_KEYRING_2],
15821582
});
15831583

1584-
// Mock getSelectedAccount to return an account not in the tree BEFORE init
1584+
// Mock getSelectedMultichainAccount to return an account not in the tree BEFORE init
15851585
const unknownAccount: InternalAccount = {
15861586
...MOCK_HD_ACCOUNT_1,
15871587
id: 'unknown-account-id',
15881588
};
15891589

15901590
messenger.unregisterActionHandler(
1591-
'AccountsController:getSelectedAccount',
1591+
'AccountsController:getSelectedMultichainAccount',
15921592
);
15931593
messenger.registerActionHandler(
1594-
'AccountsController:getSelectedAccount',
1594+
'AccountsController:getSelectedMultichainAccount',
15951595
() => unknownAccount,
15961596
);
15971597

@@ -1609,18 +1609,18 @@ describe('AccountTreeController', () => {
16091609
expect(controller.getSelectedAccountGroup()).toBe(expectedGroupId1);
16101610
});
16111611

1612-
it('returns empty string when no wallets exist and getSelectedAccount returns EMPTY_ACCOUNT', () => {
1612+
it('returns empty string when no wallets exist and getSelectedMultichainAccount returns EMPTY_ACCOUNT', () => {
16131613
const { controller, messenger } = setup({
16141614
accounts: [],
16151615
keyrings: [],
16161616
});
16171617

1618-
// Mock getSelectedAccount to return EMPTY_ACCOUNT_MOCK (id is '') BEFORE init
1618+
// Mock getSelectedMultichainAccount to return EMPTY_ACCOUNT_MOCK (id is '') BEFORE init
16191619
messenger.unregisterActionHandler(
1620-
'AccountsController:getSelectedAccount',
1620+
'AccountsController:getSelectedMultichainAccount',
16211621
);
16221622
messenger.registerActionHandler(
1623-
'AccountsController:getSelectedAccount',
1623+
'AccountsController:getSelectedMultichainAccount',
16241624
() => EMPTY_ACCOUNT_MOCK,
16251625
);
16261626

@@ -2813,7 +2813,7 @@ describe('AccountTreeController', () => {
28132813
keyrings: [MOCK_HD_KEYRING_1],
28142814
});
28152815

2816-
mocks.AccountsController.getSelectedAccount.mockImplementation(
2816+
mocks.AccountsController.getSelectedMultichainAccount.mockImplementation(
28172817
() => MOCK_HD_ACCOUNT_1,
28182818
);
28192819

@@ -2842,7 +2842,7 @@ describe('AccountTreeController', () => {
28422842
keyrings: [MOCK_HD_KEYRING_1],
28432843
});
28442844

2845-
mocks.AccountsController.getSelectedAccount.mockImplementation(
2845+
mocks.AccountsController.getSelectedMultichainAccount.mockImplementation(
28462846
() => MOCK_HD_ACCOUNT_1,
28472847
);
28482848

@@ -2865,7 +2865,7 @@ describe('AccountTreeController', () => {
28652865

28662866
mocks.AccountsController.accounts = [MOCK_HD_ACCOUNT_2];
28672867
mocks.KeyringController.keyrings = [MOCK_HD_KEYRING_2];
2868-
mocks.AccountsController.getSelectedAccount.mockImplementation(
2868+
mocks.AccountsController.getSelectedMultichainAccount.mockImplementation(
28692869
() => MOCK_HD_ACCOUNT_2,
28702870
);
28712871

packages/account-tree-controller/src/AccountTreeController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ export class AccountTreeController extends BaseController<
828828
[walletId: AccountWalletId]: AccountWalletObject;
829829
}): AccountGroupId | '' {
830830
const selectedAccount = this.messagingSystem.call(
831-
'AccountsController:getSelectedAccount',
831+
'AccountsController:getSelectedMultichainAccount',
832832
);
833833
if (selectedAccount && selectedAccount.id) {
834834
const accountMapping = this.#accountIdToContext.get(selectedAccount.id);

packages/account-tree-controller/src/rule.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function getAccountTreeControllerMessenger(
8787
allowedActions: [
8888
'AccountsController:listMultichainAccounts',
8989
'AccountsController:getAccount',
90-
'AccountsController:getSelectedAccount',
90+
'AccountsController:getSelectedMultichainAccount',
9191
'AccountsController:setSelectedAccount',
9292
'KeyringController:getState',
9393
'SnapController:get',

packages/account-tree-controller/src/rules/entropy.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function getAccountTreeControllerMessenger(
9494
allowedActions: [
9595
'AccountsController:listMultichainAccounts',
9696
'AccountsController:getAccount',
97-
'AccountsController:getSelectedAccount',
97+
'AccountsController:getSelectedMultichainAccount',
9898
'AccountsController:setSelectedAccount',
9999
'KeyringController:getState',
100100
'SnapController:get',

packages/account-tree-controller/src/rules/keyring.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe('keyring', () => {
9898
allowedActions: [
9999
'AccountsController:listMultichainAccounts',
100100
'AccountsController:getAccount',
101-
'AccountsController:getSelectedAccount',
101+
'AccountsController:getSelectedMultichainAccount',
102102
'AccountsController:setSelectedAccount',
103103
'KeyringController:getState',
104104
'SnapController:get',

packages/account-tree-controller/src/rules/snap.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function getAccountTreeControllerMessenger(
9090
allowedActions: [
9191
'AccountsController:listMultichainAccounts',
9292
'AccountsController:getAccount',
93-
'AccountsController:getSelectedAccount',
93+
'AccountsController:getSelectedMultichainAccount',
9494
'AccountsController:setSelectedAccount',
9595
'KeyringController:getState',
9696
'SnapController:get',

packages/account-tree-controller/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {
33
AccountsControllerAccountAddedEvent,
44
AccountsControllerAccountRemovedEvent,
55
AccountsControllerGetAccountAction,
6-
AccountsControllerGetSelectedAccountAction,
6+
AccountsControllerGetSelectedMultichainAccountAction,
77
AccountsControllerListMultichainAccountsAction,
88
AccountsControllerSelectedAccountChangeEvent,
99
AccountsControllerSetSelectedAccountAction,
@@ -115,7 +115,7 @@ export type AccountTreeControllerSetAccountGroupPinnedAction = {
115115

116116
export type AllowedActions =
117117
| AccountsControllerGetAccountAction
118-
| AccountsControllerGetSelectedAccountAction
118+
| AccountsControllerGetSelectedMultichainAccountAction
119119
| AccountsControllerListMultichainAccountsAction
120120
| AccountsControllerSetSelectedAccountAction
121121
| KeyringControllerGetStateAction

packages/accounts-controller/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
},
6666
"devDependencies": {
6767
"@metamask/auto-changelog": "^3.4.4",
68-
"@metamask/controller-utils": "^11.12.0",
68+
"@metamask/controller-utils": "^11.14.0",
6969
"@metamask/keyring-controller": "^23.1.0",
7070
"@metamask/network-controller": "^24.1.0",
7171
"@metamask/providers": "^22.1.0",

0 commit comments

Comments
 (0)