From d47974c57db48cfb5bb9bd39d161ca53985a9f4b Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Tue, 17 Feb 2026 16:21:41 +0100 Subject: [PATCH 01/27] migrate `AccountsController` to use `registerMethodActionHandlers` --- .../src/AccountsController.test.ts | 93 ++++----------- .../src/AccountsController.ts | 107 ++++++------------ 2 files changed, 59 insertions(+), 141 deletions(-) diff --git a/packages/accounts-controller/src/AccountsController.test.ts b/packages/accounts-controller/src/AccountsController.test.ts index 30efe029834..bbf550cfea9 100644 --- a/packages/accounts-controller/src/AccountsController.test.ts +++ b/packages/accounts-controller/src/AccountsController.test.ts @@ -386,11 +386,9 @@ describe('AccountsController', () => { messenger.publish('SnapController:stateChange', mockSnapChangeState, []); - const updatedAccount = accountsController.getAccountExpect( - mockSnapAccount.id, - ); + const updatedAccount = accountsController.getAccount(mockSnapAccount.id); - expect(updatedAccount.metadata.snap?.enabled).toBe(true); + expect(updatedAccount?.metadata.snap?.enabled).toBe(true); }); it('disables an account if the Snap is disabled', async () => { @@ -430,11 +428,9 @@ describe('AccountsController', () => { messenger.publish('SnapController:stateChange', mockSnapChangeState, []); - const updatedAccount = accountsController.getAccountExpect( - mockSnapAccount.id, - ); + const updatedAccount = accountsController.getAccount(mockSnapAccount.id); - expect(updatedAccount.metadata.snap?.enabled).toBe(false); + expect(updatedAccount?.metadata.snap?.enabled).toBe(false); }); it('disables an account if the Snap is blocked', async () => { @@ -474,11 +470,9 @@ describe('AccountsController', () => { messenger.publish('SnapController:stateChange', mockSnapChangeState, []); - const updatedAccount = accountsController.getAccountExpect( - mockSnapAccount.id, - ); + const updatedAccount = accountsController.getAccount(mockSnapAccount.id); - expect(updatedAccount.metadata.snap?.enabled).toBe(false); + expect(updatedAccount?.metadata.snap?.enabled).toBe(false); }); it('does not trigger any unnecessary updates', async () => { @@ -521,16 +515,14 @@ describe('AccountsController', () => { // First update will update the account's metadata, thus triggering a `AccountsController:stateChange`. messenger.publish('SnapController:stateChange', mockSnapChangeState, []); - const updatedAccount = accountsController.getAccountExpect( - mockSnapAccount.id, - ); - expect(updatedAccount.metadata.snap?.enabled).toBe(true); + const updatedAccount = accountsController.getAccount(mockSnapAccount.id); + expect(updatedAccount?.metadata.snap?.enabled).toBe(true); expect(mockStateChange).toHaveBeenCalled(); // Second update is the same, thus the account does not need any update, and SHOULD NOT trigger a `AccountsController:stateChange`. mockStateChange.mockReset(); messenger.publish('SnapController:stateChange', mockSnapChangeState, []); - expect(updatedAccount.metadata.snap?.enabled).toBe(true); + expect(updatedAccount?.metadata.snap?.enabled).toBe(true); expect(mockStateChange).not.toHaveBeenCalled(); }); @@ -565,15 +557,13 @@ describe('AccountsController', () => { }); // Initial state - const account = accountsController.getAccountExpect(mockSnapAccount.id); - expect(account.metadata.snap?.enabled).toBe(true); + const account = accountsController.getAccount(mockSnapAccount.id); + expect(account?.metadata.snap?.enabled).toBe(true); // The Snap 'mock-snap' won't be found, so we will automatically consider it disabled. messenger.publish('SnapController:stateChange', mockSnapChangeState, []); - const updatedAccount = accountsController.getAccountExpect( - mockSnapAccount.id, - ); - expect(updatedAccount.metadata.snap?.enabled).toBe(false); + const updatedAccount = accountsController.getAccount(mockSnapAccount.id); + expect(updatedAccount?.metadata.snap?.enabled).toBe(false); }); }); @@ -3136,38 +3126,6 @@ describe('AccountsController', () => { }); }); - describe('getAccountExpect', () => { - it('return an account by ID', () => { - const { accountsController } = setupAccountsController({ - initialState: { - internalAccounts: { - accounts: { [mockAccount.id]: mockAccount }, - selectedAccount: mockAccount.id, - }, - }, - }); - const result = accountsController.getAccountExpect(mockAccount.id); - - expect(result).toStrictEqual(setExpectedLastSelectedAsAny(mockAccount)); - }); - - it('throw an error for an unknown account ID', () => { - const accountId = 'unknown id'; - const { accountsController } = setupAccountsController({ - initialState: { - internalAccounts: { - accounts: { [mockAccount.id]: mockAccount }, - selectedAccount: mockAccount.id, - }, - }, - }); - - expect(() => accountsController.getAccountExpect(accountId)).toThrow( - `Account Id "${accountId}" not found`, - ); - }); - }); - describe('setSelectedAccount', () => { it('set the selected account', () => { const { accountsController } = setupAccountsController({ @@ -3256,9 +3214,9 @@ describe('AccountsController', () => { newAccountName, ); - expect( - accountsController.getAccountExpect(mockAccount.id).metadata.name, - ).toBe(newAccountName); + expect(accountsController.getAccount(mockAccount.id)?.metadata.name).toBe( + newAccountName, + ); expect(accountsController.state.internalAccounts.selectedAccount).toBe( mockAccount.id, ); @@ -3283,7 +3241,7 @@ describe('AccountsController', () => { ); expect( - accountsController.getAccountExpect(mockAccount2.id).metadata.name, + accountsController.getAccount(mockAccount2.id)?.metadata.name, ).toBe(newAccountName); expect(accountsController.state.internalAccounts.selectedAccount).toBe( mockAccount2.id, @@ -3303,7 +3261,7 @@ describe('AccountsController', () => { ); expect( - accountsController.getAccountExpect(mockAccount.id).metadata + accountsController.getAccount(mockAccount.id)?.metadata .nameLastUpdatedAt, ).toBe(expectedTimestamp); }); @@ -3321,7 +3279,7 @@ describe('AccountsController', () => { expect(messengerSpy).toHaveBeenCalledWith( 'AccountsController:accountRenamed', - accountsController.getAccountExpect(mockAccount.id), + accountsController.getAccount(mockAccount.id), ); }); }); @@ -3338,9 +3296,9 @@ describe('AccountsController', () => { }); accountsController.setAccountName(mockAccount.id, 'new name'); - expect( - accountsController.getAccountExpect(mockAccount.id).metadata.name, - ).toBe('new name'); + expect(accountsController.getAccount(mockAccount.id)?.metadata.name).toBe( + 'new name', + ); }); it('sets the nameLastUpdatedAt timestamp when setting the name of an existing account', () => { @@ -3360,7 +3318,7 @@ describe('AccountsController', () => { accountsController.setAccountName(mockAccount.id, 'new name'); expect( - accountsController.getAccountExpect(mockAccount.id).metadata + accountsController.getAccount(mockAccount.id)?.metadata .nameLastUpdatedAt, ).toBe(expectedTimestamp); }); @@ -3382,7 +3340,7 @@ describe('AccountsController', () => { expect(messengerSpy).toHaveBeenCalledWith( 'AccountsController:accountRenamed', - accountsController.getAccountExpect(mockAccount.id), + accountsController.getAccount(mockAccount.id), ); }); @@ -3428,8 +3386,7 @@ describe('AccountsController', () => { }); expect( - accountsController.getAccountExpect(mockAccount.id).metadata - .lastSelected, + accountsController.getAccount(mockAccount.id)?.metadata.lastSelected, ).toBe(1); }); }); diff --git a/packages/accounts-controller/src/AccountsController.ts b/packages/accounts-controller/src/AccountsController.ts index ed4288bf7ad..afdbed0cd83 100644 --- a/packages/accounts-controller/src/AccountsController.ts +++ b/packages/accounts-controller/src/AccountsController.ts @@ -191,6 +191,27 @@ export type AccountsControllerUpdateAccountMetadataAction = { * @deprecated This type is deprecated and will be removed in a future version. * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. */ +export type AccountsControllerLoadBackupAction = { + type: `${typeof controllerName}:loadBackup`; + handler: AccountsController['loadBackup']; +}; + +const MESSENGER_EXPOSED_METHODS = [ + 'setSelectedAccount', + 'setAccountName', + 'setAccountNameAndSelectAccount', + 'listAccounts', + 'listMultichainAccounts', + 'updateAccounts', + 'getSelectedAccount', + 'getSelectedMultichainAccount', + 'getAccountByAddress', + 'getAccount', + 'getAccounts', + 'updateAccountMetadata', + 'loadBackup', +] as const; + export type AllowedActions = | KeyringControllerGetKeyringsByTypeAction | KeyringControllerGetStateAction; @@ -212,7 +233,8 @@ export type AccountsControllerActions = | AccountsControllerGetAccountAction | AccountsControllerGetAccountsAction | AccountsControllerGetSelectedMultichainAccountAction - | AccountsControllerUpdateAccountMetadataAction; + | AccountsControllerUpdateAccountMetadataAction + | AccountsControllerLoadBackupAction; /** * @deprecated This type is deprecated and will be removed in a future version. @@ -420,8 +442,12 @@ export class AccountsController extends BaseController< }, }); + this.messenger.registerMethodActionHandlers( + this, + MESSENGER_EXPOSED_METHODS, + ); + this.#subscribeToMessageEvents(); - this.#registerMessageHandlers(); } /** @@ -492,7 +518,7 @@ export class AccountsController extends BaseController< * @returns The internal account object. * @throws An error if the account ID is not found. */ - getAccountExpect(accountId: string): InternalAccount { + #getAccountExpect(accountId: string): InternalAccount { const account = this.getAccount(accountId); if (account === undefined) { throw new Error(`Account Id "${accountId}" not found`); @@ -518,7 +544,7 @@ export class AccountsController extends BaseController< return EMPTY_ACCOUNT; } - const account = this.getAccountExpect(selectedAccount); + const account = this.#getAccountExpect(selectedAccount); if (isEvmAccountType(account.type)) { return account; } @@ -558,7 +584,7 @@ export class AccountsController extends BaseController< } if (!chainId) { - return this.getAccountExpect(selectedAccount); + return this.#getAccountExpect(selectedAccount); } const accounts = this.listMultichainAccounts(chainId); @@ -588,7 +614,7 @@ export class AccountsController extends BaseController< * @param accountId - The ID of the account to be selected. */ setSelectedAccount(accountId: string): void { - const account = this.getAccountExpect(accountId); + const account = this.#getAccountExpect(accountId); if (this.state.internalAccounts.selectedAccount === account.id) { return; @@ -630,7 +656,7 @@ export class AccountsController extends BaseController< * @throws An error if an account with the same name already exists. */ setAccountNameAndSelectAccount(accountId: string, accountName: string): void { - const account = this.getAccountExpect(accountId); + const account = this.#getAccountExpect(accountId); this.#assertAccountCanBeRenamed(account, accountName); @@ -682,7 +708,7 @@ export class AccountsController extends BaseController< accountId: string, metadata: Partial, ): void { - const account = this.getAccountExpect(accountId); + const account = this.#getAccountExpect(accountId); if (metadata.name) { this.#assertAccountCanBeRenamed(account, metadata.name); @@ -1328,69 +1354,4 @@ export class AccountsController extends BaseController< (id) => this.#handleOnMultichainNetworkDidChange(id), ); } - - /** - * Registers message handlers for the AccountsController. - */ - #registerMessageHandlers(): void { - this.messenger.registerActionHandler( - `${controllerName}:setSelectedAccount`, - this.setSelectedAccount.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:listAccounts`, - this.listAccounts.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:listMultichainAccounts`, - this.listMultichainAccounts.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:setAccountName`, - this.setAccountName.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:setAccountNameAndSelectAccount`, - this.setAccountNameAndSelectAccount.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:updateAccounts`, - this.updateAccounts.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:getSelectedAccount`, - this.getSelectedAccount.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:getSelectedMultichainAccount`, - this.getSelectedMultichainAccount.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:getAccountByAddress`, - this.getAccountByAddress.bind(this), - ); - - this.messenger.registerActionHandler( - `AccountsController:getAccount`, - this.getAccount.bind(this), - ); - - this.messenger.registerActionHandler( - `AccountsController:getAccounts`, - this.getAccounts.bind(this), - ); - - this.messenger.registerActionHandler( - `AccountsController:updateAccountMetadata`, - this.updateAccountMetadata.bind(this), - ); - } } From 30c0dddbe2431ac7e88d5f914e056000db974b66 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Tue, 17 Feb 2026 16:29:57 +0100 Subject: [PATCH 02/27] migrate `MultichainAccountService` to use `registerMethodActionHandlers` --- .../src/MultichainAccountService.ts | 70 +++++-------------- 1 file changed, 19 insertions(+), 51 deletions(-) diff --git a/packages/multichain-account-service/src/MultichainAccountService.ts b/packages/multichain-account-service/src/MultichainAccountService.ts index bd8c39e7b7d..792c1f9b451 100644 --- a/packages/multichain-account-service/src/MultichainAccountService.ts +++ b/packages/multichain-account-service/src/MultichainAccountService.ts @@ -90,6 +90,22 @@ export type CreateWalletParams = password: string; }; +const MESSENGER_EXPOSED_METHODS = [ + 'getMultichainAccountGroup', + 'getMultichainAccountGroups', + 'getMultichainAccountWallet', + 'getMultichainAccountWallets', + 'createNextMultichainAccountGroup', + 'createMultichainAccountGroup', + 'setBasicFunctionality', + 'alignWallets', + 'alignWallet', + 'createMultichainAccountWallet', + 'resyncAccounts', + 'removeMultichainAccountWallet', + 'ensureCanUseSnapPlatform', +] as const; + /** * Service to expose multichain accounts capabilities. */ @@ -154,57 +170,9 @@ export class MultichainAccountService { this.#watcher = new SnapPlatformWatcher(messenger); - this.#messenger.registerActionHandler( - 'MultichainAccountService:getMultichainAccountGroup', - (...args) => this.getMultichainAccountGroup(...args), - ); - this.#messenger.registerActionHandler( - 'MultichainAccountService:getMultichainAccountGroups', - (...args) => this.getMultichainAccountGroups(...args), - ); - this.#messenger.registerActionHandler( - 'MultichainAccountService:getMultichainAccountWallet', - (...args) => this.getMultichainAccountWallet(...args), - ); - this.#messenger.registerActionHandler( - 'MultichainAccountService:getMultichainAccountWallets', - (...args) => this.getMultichainAccountWallets(...args), - ); - this.#messenger.registerActionHandler( - 'MultichainAccountService:createNextMultichainAccountGroup', - (...args) => this.createNextMultichainAccountGroup(...args), - ); - this.#messenger.registerActionHandler( - 'MultichainAccountService:createMultichainAccountGroup', - (...args) => this.createMultichainAccountGroup(...args), - ); - this.#messenger.registerActionHandler( - 'MultichainAccountService:setBasicFunctionality', - (...args) => this.setBasicFunctionality(...args), - ); - this.#messenger.registerActionHandler( - 'MultichainAccountService:alignWallets', - (...args) => this.alignWallets(...args), - ); - this.#messenger.registerActionHandler( - 'MultichainAccountService:alignWallet', - (...args) => this.alignWallet(...args), - ); - this.#messenger.registerActionHandler( - 'MultichainAccountService:createMultichainAccountWallet', - (...args) => this.createMultichainAccountWallet(...args), - ); - this.#messenger.registerActionHandler( - 'MultichainAccountService:resyncAccounts', - (...args) => this.resyncAccounts(...args), - ); - this.#messenger.registerActionHandler( - 'MultichainAccountService:removeMultichainAccountWallet', - (...args) => this.removeMultichainAccountWallet(...args), - ); - this.#messenger.registerActionHandler( - 'MultichainAccountService:ensureCanUseSnapPlatform', - (...args) => this.ensureCanUseSnapPlatform(...args), + this.#messenger.registerMethodActionHandlers( + this, + MESSENGER_EXPOSED_METHODS, ); } From 973c84f171eaa4aa884265d8df605ece45d57826 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Wed, 18 Feb 2026 12:06:04 +0100 Subject: [PATCH 03/27] migrate `AccountTreeController`, `AuthenticationController` and `UserStorageController` --- .../src/AccountTreeController.test.ts | 25 +++--- .../src/AccountTreeController.ts | 73 ++++++----------- packages/account-tree-controller/src/types.ts | 38 ++++++++- .../AuthenticationController.ts | 56 +++---------- .../user-storage/UserStorageController.ts | 82 +++++++------------ 5 files changed, 116 insertions(+), 158 deletions(-) diff --git a/packages/account-tree-controller/src/AccountTreeController.test.ts b/packages/account-tree-controller/src/AccountTreeController.test.ts index 624e60b2af4..cf890836556 100644 --- a/packages/account-tree-controller/src/AccountTreeController.test.ts +++ b/packages/account-tree-controller/src/AccountTreeController.test.ts @@ -4575,21 +4575,18 @@ describe('AccountTreeController', () => { }); // Test suffix resolution directly using the public method - const wallet = controller.state.accountTree.wallets[walletId]; - const resolvedName = controller.resolveNameConflict( - wallet, - groupId, - 'Suffix Test', - ); - expect(resolvedName).toBe('Suffix Test (3)'); + controller.setAccountGroupName(groupId, 'Suffix Test', true); - // Test with no conflicts: should return "Unique Name (2)" - const uniqueName = controller.resolveNameConflict( - wallet, - groupId, - 'Unique Name', - ); - expect(uniqueName).toBe('Unique Name (2)'); + const collidingGroupObject = controller.getAccountGroupObject(groupId); + + expect(collidingGroupObject?.metadata.name).toBe('Suffix Test (3)'); + + // Test with no conflicts: should return "Unique Name" + controller.setAccountGroupName(groupId, 'Unique Name', true); + + const uniqueGroupObject = controller.getAccountGroupObject(groupId); + + expect(uniqueGroupObject?.metadata.name).toBe('Unique Name'); }); it('throws error when group ID not found in tree', () => { diff --git a/packages/account-tree-controller/src/AccountTreeController.ts b/packages/account-tree-controller/src/AccountTreeController.ts index 9f8d0aeacdc..20d993a1129 100644 --- a/packages/account-tree-controller/src/AccountTreeController.ts +++ b/packages/account-tree-controller/src/AccountTreeController.ts @@ -44,6 +44,23 @@ import type { AccountWalletObject, AccountWalletObjectOf } from './wallet'; export const controllerName = 'AccountTreeController'; +const MESSENGER_EXPOSED_METHODS = [ + 'getSelectedAccountGroup', + 'setSelectedAccountGroup', + 'getAccountsFromSelectedAccountGroup', + 'getAccountContext', + 'setAccountWalletName', + 'setAccountGroupName', + 'setAccountGroupPinned', + 'setAccountGroupHidden', + 'getAccountWalletObject', + 'getAccountWalletObjects', + 'getAccountGroupObject', + 'clearState', + 'syncWithUserStorage', + 'syncWithUserStorageAtLeastOnce', +] as const; + const accountTreeControllerMetadata: StateMetadata = { accountTree: { @@ -246,7 +263,10 @@ export class AccountTreeController extends BaseController< }, ); - this.#registerMessageHandlers(); + this.messenger.registerMethodActionHandlers( + this, + MESSENGER_EXPOSED_METHODS, + ); } /** @@ -507,7 +527,7 @@ export class AccountTreeController extends BaseController< proposedName.length && !isAccountGroupNameUniqueFromWallet(wallet, group.id, proposedName) ) { - proposedName = this.resolveNameConflict(wallet, group.id, proposedName); + proposedName = this.#resolveNameConflict(wallet, group.id, proposedName); } return proposedName; @@ -1324,7 +1344,7 @@ export class AccountTreeController extends BaseController< * @param name - The desired name that has a conflict. * @returns A unique name with suffix added if necessary. */ - resolveNameConflict( + #resolveNameConflict( wallet: AccountWalletObject, groupId: AccountGroupId, name: string, @@ -1371,7 +1391,7 @@ export class AccountTreeController extends BaseController< autoHandleConflict && !isAccountGroupNameUniqueFromWallet(wallet, groupId, name) ) { - finalName = this.resolveNameConflict(wallet, groupId, name); + finalName = this.#resolveNameConflict(wallet, groupId, name); } else { // Validate that the name is unique this.#assertAccountGroupNameIsUnique(groupId, finalName); @@ -1538,51 +1558,6 @@ export class AccountTreeController extends BaseController< this.#initialized = false; } - /** - * Registers message handlers for the AccountTreeController. - */ - #registerMessageHandlers(): void { - this.messenger.registerActionHandler( - `${controllerName}:getSelectedAccountGroup`, - this.getSelectedAccountGroup.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:setSelectedAccountGroup`, - this.setSelectedAccountGroup.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:getAccountsFromSelectedAccountGroup`, - this.getAccountsFromSelectedAccountGroup.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:getAccountContext`, - this.getAccountContext.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:setAccountWalletName`, - this.setAccountWalletName.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:setAccountGroupName`, - this.setAccountGroupName.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:setAccountGroupPinned`, - this.setAccountGroupPinned.bind(this), - ); - - this.messenger.registerActionHandler( - `${controllerName}:setAccountGroupHidden`, - this.setAccountGroupHidden.bind(this), - ); - } - /** * Bi-directionally syncs the account tree with user storage. * This will perform a full sync, including both pulling updates diff --git a/packages/account-tree-controller/src/types.ts b/packages/account-tree-controller/src/types.ts index 415c5b4f55f..4f05edb15f9 100644 --- a/packages/account-tree-controller/src/types.ts +++ b/packages/account-tree-controller/src/types.ts @@ -119,6 +119,36 @@ export type AccountTreeControllerSetAccountGroupPinnedAction = { handler: AccountTreeController['setAccountGroupPinned']; }; +export type AccountTreeControllerGetAccountWalletObjectAction = { + type: `${typeof controllerName}:getAccountWalletObject`; + handler: AccountTreeController['getAccountWalletObject']; +}; + +export type AccountTreeControllerGetAccountWalletObjectsAction = { + type: `${typeof controllerName}:getAccountWalletObjects`; + handler: AccountTreeController['getAccountWalletObjects']; +}; + +export type AccountTreeControllerGetAccountGroupObjectAction = { + type: `${typeof controllerName}:getAccountGroupObject`; + handler: AccountTreeController['getAccountGroupObject']; +}; + +export type AccountTreeControllerClearStateAction = { + type: `${typeof controllerName}:clearState`; + handler: AccountTreeController['clearState']; +}; + +export type AccountTreeControllerSyncWithUserStorageAction = { + type: `${typeof controllerName}:syncWithUserStorage`; + handler: AccountTreeController['syncWithUserStorage']; +}; + +export type AccountTreeControllerSyncWithUserStorageAtLeastOnceAction = { + type: `${typeof controllerName}:syncWithUserStorageAtLeastOnce`; + handler: AccountTreeController['syncWithUserStorageAtLeastOnce']; +}; + export type AllowedActions = | AccountsControllerGetAccountAction | AccountsControllerGetSelectedMultichainAccountAction @@ -143,7 +173,13 @@ export type AccountTreeControllerActions = | AccountTreeControllerSetAccountWalletNameAction | AccountTreeControllerSetAccountGroupNameAction | AccountTreeControllerSetAccountGroupPinnedAction - | AccountTreeControllerSetAccountGroupHiddenAction; + | AccountTreeControllerSetAccountGroupHiddenAction + | AccountTreeControllerGetAccountWalletObjectAction + | AccountTreeControllerGetAccountWalletObjectsAction + | AccountTreeControllerGetAccountGroupObjectAction + | AccountTreeControllerClearStateAction + | AccountTreeControllerSyncWithUserStorageAction + | AccountTreeControllerSyncWithUserStorageAtLeastOnceAction; export type AccountTreeControllerStateChangeEvent = ControllerStateChangeEvent< typeof controllerName, diff --git a/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.ts b/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.ts index 37aefcc5d47..2ad09b02b11 100644 --- a/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.ts +++ b/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.ts @@ -83,6 +83,15 @@ type ControllerConfig = { env: Env; }; +const MESSENGER_EXPOSED_METHODS = [ + 'performSignIn', + 'performSignOut', + 'getBearerToken', + 'getSessionProfile', + 'getUserProfileLineage', + 'isSignedIn', +] as const; + // Messenger Actions type CreateActionsObj = { [K in Controller]: { @@ -90,14 +99,7 @@ type CreateActionsObj = { handler: AuthenticationController[K]; }; }; -type ActionsObj = CreateActionsObj< - | 'performSignIn' - | 'performSignOut' - | 'getBearerToken' - | 'getSessionProfile' - | 'getUserProfileLineage' - | 'isSignedIn' ->; +type ActionsObj = CreateActionsObj<(typeof MESSENGER_EXPOSED_METHODS)[number]>; export type Actions = | ActionsObj[keyof ActionsObj] | AuthenticationControllerGetStateAction; @@ -223,42 +225,10 @@ export default class AuthenticationController extends BaseController< ); this.#keyringController.setupLockedStateSubscriptions(); - this.#registerMessageHandlers(); - } - - /** - * Constructor helper for registering this controller's messaging system - * actions. - */ - #registerMessageHandlers(): void { - this.messenger.registerActionHandler( - 'AuthenticationController:getBearerToken', - this.getBearerToken.bind(this), - ); - - this.messenger.registerActionHandler( - 'AuthenticationController:getSessionProfile', - this.getSessionProfile.bind(this), - ); - - this.messenger.registerActionHandler( - 'AuthenticationController:isSignedIn', - this.isSignedIn.bind(this), - ); - - this.messenger.registerActionHandler( - 'AuthenticationController:performSignIn', - this.performSignIn.bind(this), - ); - - this.messenger.registerActionHandler( - 'AuthenticationController:performSignOut', - this.performSignOut.bind(this), - ); - this.messenger.registerActionHandler( - 'AuthenticationController:getUserProfileLineage', - this.getUserProfileLineage.bind(this), + this.messenger.registerMethodActionHandlers( + this, + MESSENGER_EXPOSED_METHODS, ); } diff --git a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts index 563101108e0..96a9462dcf1 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts @@ -139,6 +139,21 @@ type ControllerConfig = { }; }; +const MESSENGER_EXPOSED_METHODS = [ + 'performGetStorage', + 'performGetStorageAllFeatureEntries', + 'performSetStorage', + 'performBatchSetStorage', + 'performDeleteStorage', + 'performBatchDeleteStorage', + 'getStorageKey', + 'performDeleteStorageAllFeatureEntries', + 'listEntropySources', + 'setIsBackupAndSyncFeatureEnabled', + 'setIsContactSyncingInProgress', + 'syncContactsWithUserStorage', +] as const; + // Messenger Actions type CreateActionsObj = { [K in Controller]: { @@ -146,15 +161,7 @@ type CreateActionsObj = { handler: UserStorageController[K]; }; }; -type ActionsObj = CreateActionsObj< - | 'performGetStorage' - | 'performGetStorageAllFeatureEntries' - | 'performSetStorage' - | 'performBatchSetStorage' - | 'performDeleteStorage' - | 'performBatchDeleteStorage' - | 'getStorageKey' ->; +type ActionsObj = CreateActionsObj<(typeof MESSENGER_EXPOSED_METHODS)[number]>; export type UserStorageControllerGetStateAction = ControllerGetStateAction< typeof controllerName, UserStorageControllerState @@ -175,6 +182,16 @@ export type UserStorageControllerPerformDeleteStorage = export type UserStorageControllerPerformBatchDeleteStorage = ActionsObj['performBatchDeleteStorage']; export type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey']; +export type UserStoragePerformDeleteStorageAllFeatureEntries = + ActionsObj['performDeleteStorageAllFeatureEntries']; +export type UserStorageControllerListEntropySources = + ActionsObj['listEntropySources']; +export type UserStorageControllerSetIsBackupAndSyncFeatureEnabled = + ActionsObj['setIsBackupAndSyncFeatureEnabled']; +export type UserStorageControllerSetIsContactSyncingInProgress = + ActionsObj['setIsContactSyncingInProgress']; +export type UserStorageControllerSyncContactsWithUserStorage = + ActionsObj['syncContactsWithUserStorage']; export type AllowedActions = // Keyring Requests @@ -346,8 +363,12 @@ export default class UserStorageController extends BaseController< }, ); + this.messenger.registerMethodActionHandlers( + this, + MESSENGER_EXPOSED_METHODS, + ); + this.#keyringController.setupLockedStateSubscriptions(); - this.#registerMessageHandlers(); this.#nativeScryptCrypto = nativeScryptCrypto; // Contact Syncing @@ -358,47 +379,6 @@ export default class UserStorageController extends BaseController< }); } - /** - * Constructor helper for registering this controller's messaging system - * actions. - */ - #registerMessageHandlers(): void { - this.messenger.registerActionHandler( - 'UserStorageController:performGetStorage', - this.performGetStorage.bind(this), - ); - - this.messenger.registerActionHandler( - 'UserStorageController:performGetStorageAllFeatureEntries', - this.performGetStorageAllFeatureEntries.bind(this), - ); - - this.messenger.registerActionHandler( - 'UserStorageController:performSetStorage', - this.performSetStorage.bind(this), - ); - - this.messenger.registerActionHandler( - 'UserStorageController:performBatchSetStorage', - this.performBatchSetStorage.bind(this), - ); - - this.messenger.registerActionHandler( - 'UserStorageController:performDeleteStorage', - this.performDeleteStorage.bind(this), - ); - - this.messenger.registerActionHandler( - 'UserStorageController:performBatchDeleteStorage', - this.performBatchDeleteStorage.bind(this), - ); - - this.messenger.registerActionHandler( - 'UserStorageController:getStorageKey', - this.getStorageKey.bind(this), - ); - } - /** * Allows retrieval of stored data. Data stored is string formatted. * Developers can extend the entry path and entry name through the `schema.ts` file. From 61459942db641a1819decf2afe9976c4a68bb54a Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Wed, 18 Feb 2026 14:41:34 +0100 Subject: [PATCH 04/27] fix action name --- .../src/controllers/user-storage/UserStorageController.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts index 96a9462dcf1..70836a5d4eb 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts @@ -182,7 +182,7 @@ export type UserStorageControllerPerformDeleteStorage = export type UserStorageControllerPerformBatchDeleteStorage = ActionsObj['performBatchDeleteStorage']; export type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey']; -export type UserStoragePerformDeleteStorageAllFeatureEntries = +export type UserStorageControllerPerformDeleteStorageAllFeatureEntries = ActionsObj['performDeleteStorageAllFeatureEntries']; export type UserStorageControllerListEntropySources = ActionsObj['listEntropySources']; @@ -218,7 +218,6 @@ export type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent< export type Events = UserStorageControllerStateChangeEvent; export type AllowedEvents = - | UserStorageControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent // Address Book Events From 19538b26d4f747c1fbd04be26b358f66c01fc61e Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Thu, 19 Feb 2026 15:29:13 +0100 Subject: [PATCH 05/27] use `generate-method-action-types` in `account-tree-controller` --- packages/account-tree-controller/package.json | 3 + ...countTreeController-method-action-types.ts | 196 ++++++++++++++++++ packages/account-tree-controller/src/index.ts | 26 ++- packages/account-tree-controller/src/types.ts | 91 +------- packages/assets-controller/src/index.ts | 2 +- yarn.lock | 1 + 6 files changed, 222 insertions(+), 97 deletions(-) create mode 100644 packages/account-tree-controller/src/AccountTreeController-method-action-types.ts diff --git a/packages/account-tree-controller/package.json b/packages/account-tree-controller/package.json index 53605770a8c..d5e86f62d1b 100644 --- a/packages/account-tree-controller/package.json +++ b/packages/account-tree-controller/package.json @@ -40,6 +40,8 @@ "build:docs": "typedoc", "changelog:update": "../../scripts/update-changelog.sh @metamask/account-tree-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/account-tree-controller", + "generate-method-action-types": "tsx ../../scripts/generate-method-action-types.ts", + "publish:preview": "yarn npm publish --tag preview", "since-latest-release": "../../scripts/since-latest-release.sh", "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", @@ -71,6 +73,7 @@ "deepmerge": "^4.2.2", "jest": "^29.7.0", "ts-jest": "^29.2.5", + "tsx": "^4.20.5", "typedoc": "^0.25.13", "typedoc-plugin-missing-exports": "^2.0.0", "typescript": "~5.3.3", diff --git a/packages/account-tree-controller/src/AccountTreeController-method-action-types.ts b/packages/account-tree-controller/src/AccountTreeController-method-action-types.ts new file mode 100644 index 00000000000..365dbe342c9 --- /dev/null +++ b/packages/account-tree-controller/src/AccountTreeController-method-action-types.ts @@ -0,0 +1,196 @@ +/** + * This file is auto generated by `scripts/generate-method-action-types.ts`. + * Do not edit manually. + */ + +import type { AccountTreeController } from './AccountTreeController'; + +/** + * Gets the account wallet object from its ID. + * + * @param walletId - Account wallet ID. + * @returns The account wallet object if found, undefined otherwise. + */ +export type AccountTreeControllerGetAccountWalletObjectAction = { + type: `AccountTreeController:getAccountWalletObject`; + handler: AccountTreeController['getAccountWalletObject']; +}; + +/** + * Gets all account wallet objects. + * + * @returns All account wallet objects. + */ +export type AccountTreeControllerGetAccountWalletObjectsAction = { + type: `AccountTreeController:getAccountWalletObjects`; + handler: AccountTreeController['getAccountWalletObjects']; +}; + +/** + * Gets all underlying accounts from the currently selected account + * group. + * + * It also support account selector, which allows to filter specific + * accounts given some criterias (account type, address, scopes, etc...). + * + * @param selector - Optional account selector. + * @returns Underlying accounts for the currently selected account (filtered + * by the selector if provided). + */ +export type AccountTreeControllerGetAccountsFromSelectedAccountGroupAction = { + type: `AccountTreeController:getAccountsFromSelectedAccountGroup`; + handler: AccountTreeController['getAccountsFromSelectedAccountGroup']; +}; + +/** + * Gets the account group object from its ID. + * + * @param groupId - Account group ID. + * @returns The account group object if found, undefined otherwise. + */ +export type AccountTreeControllerGetAccountGroupObjectAction = { + type: `AccountTreeController:getAccountGroupObject`; + handler: AccountTreeController['getAccountGroupObject']; +}; + +/** + * Gets the account's context which contains its wallet ID, group ID, and sort order. + * + * @param accountId - Account ID. + * @returns The account context if found, undefined otherwise. + */ +export type AccountTreeControllerGetAccountContextAction = { + type: `AccountTreeController:getAccountContext`; + handler: AccountTreeController['getAccountContext']; +}; + +/** + * Gets the currently selected account group ID. + * + * @returns The selected account group ID or empty string if none selected. + */ +export type AccountTreeControllerGetSelectedAccountGroupAction = { + type: `AccountTreeController:getSelectedAccountGroup`; + handler: AccountTreeController['getSelectedAccountGroup']; +}; + +/** + * Sets the selected account group and updates the AccountsController selectedAccount accordingly. + * + * @param groupId - The account group ID to select. + */ +export type AccountTreeControllerSetSelectedAccountGroupAction = { + type: `AccountTreeController:setSelectedAccountGroup`; + handler: AccountTreeController['setSelectedAccountGroup']; +}; + +/** + * Sets a custom name for an account group. + * + * @param groupId - The account group ID. + * @param name - The custom name to set. + * @param autoHandleConflict - If true, automatically resolves name conflicts by adding a suffix. If false, throws on conflicts. + * @throws If the account group ID is not found in the current tree. + * @throws If the account group name already exists and autoHandleConflict is false. + */ +export type AccountTreeControllerSetAccountGroupNameAction = { + type: `AccountTreeController:setAccountGroupName`; + handler: AccountTreeController['setAccountGroupName']; +}; + +/** + * Sets a custom name for an account wallet. + * + * @param walletId - The account wallet ID. + * @param name - The custom name to set. + * @throws If the account wallet ID is not found in the current tree. + */ +export type AccountTreeControllerSetAccountWalletNameAction = { + type: `AccountTreeController:setAccountWalletName`; + handler: AccountTreeController['setAccountWalletName']; +}; + +/** + * Toggles the pinned state of an account group. + * + * @param groupId - The account group ID. + * @param pinned - Whether the group should be pinned. + * @throws If the account group ID is not found in the current tree. + */ +export type AccountTreeControllerSetAccountGroupPinnedAction = { + type: `AccountTreeController:setAccountGroupPinned`; + handler: AccountTreeController['setAccountGroupPinned']; +}; + +/** + * Toggles the hidden state of an account group. + * + * @param groupId - The account group ID. + * @param hidden - Whether the group should be hidden. + * @throws If the account group ID is not found in the current tree. + */ +export type AccountTreeControllerSetAccountGroupHiddenAction = { + type: `AccountTreeController:setAccountGroupHidden`; + handler: AccountTreeController['setAccountGroupHidden']; +}; + +/** + * Clears the controller state and resets to default values. + * Also clears the backup and sync service state. + */ +export type AccountTreeControllerClearStateAction = { + type: `AccountTreeController:clearState`; + handler: AccountTreeController['clearState']; +}; + +/** + * Bi-directionally syncs the account tree with user storage. + * This will perform a full sync, including both pulling updates + * from user storage and pushing local changes to user storage. + * This also performs legacy account syncing if needed. + * + * IMPORTANT: + * If a full sync is already in progress, it will return the ongoing promise. + * + * @returns A promise that resolves when the sync is complete. + */ +export type AccountTreeControllerSyncWithUserStorageAction = { + type: `AccountTreeController:syncWithUserStorage`; + handler: AccountTreeController['syncWithUserStorage']; +}; + +/** + * Bi-directionally syncs the account tree with user storage. + * This will ensure at least one full sync is ran, including both pulling updates + * from user storage and pushing local changes to user storage. + * This also performs legacy account syncing if needed. + * + * IMPORTANT: + * If the first ever full sync is already in progress, it will return the ongoing promise. + * If the first ever full sync was previously completed, it will NOT start a new sync, and will resolve immediately. + * + * @returns A promise that resolves when the first ever full sync is complete. + */ +export type AccountTreeControllerSyncWithUserStorageAtLeastOnceAction = { + type: `AccountTreeController:syncWithUserStorageAtLeastOnce`; + handler: AccountTreeController['syncWithUserStorageAtLeastOnce']; +}; + +/** + * Union of all AccountTreeController action types. + */ +export type AccountTreeControllerMethodActions = + | AccountTreeControllerGetAccountWalletObjectAction + | AccountTreeControllerGetAccountWalletObjectsAction + | AccountTreeControllerGetAccountsFromSelectedAccountGroupAction + | AccountTreeControllerGetAccountGroupObjectAction + | AccountTreeControllerGetAccountContextAction + | AccountTreeControllerGetSelectedAccountGroupAction + | AccountTreeControllerSetSelectedAccountGroupAction + | AccountTreeControllerSetAccountGroupNameAction + | AccountTreeControllerSetAccountWalletNameAction + | AccountTreeControllerSetAccountGroupPinnedAction + | AccountTreeControllerSetAccountGroupHiddenAction + | AccountTreeControllerClearStateAction + | AccountTreeControllerSyncWithUserStorageAction + | AccountTreeControllerSyncWithUserStorageAtLeastOnceAction; diff --git a/packages/account-tree-controller/src/index.ts b/packages/account-tree-controller/src/index.ts index d25b4896a36..9865bf006ab 100644 --- a/packages/account-tree-controller/src/index.ts +++ b/packages/account-tree-controller/src/index.ts @@ -11,14 +11,6 @@ export type { AccountTreeControllerState, AccountTreeControllerGetStateAction, AccountTreeControllerActions, - AccountTreeControllerSetSelectedAccountGroupAction, - AccountTreeControllerGetSelectedAccountGroupAction, - AccountTreeControllerGetAccountsFromSelectedAccountGroupAction, - AccountTreeControllerGetAccountContextAction, - AccountTreeControllerSetAccountWalletNameAction, - AccountTreeControllerSetAccountGroupNameAction, - AccountTreeControllerSetAccountGroupPinnedAction, - AccountTreeControllerSetAccountGroupHiddenAction, AccountTreeControllerStateChangeEvent, AccountTreeControllerAccountTreeChangeEvent, AccountTreeControllerSelectedAccountGroupChangeEvent, @@ -26,6 +18,24 @@ export type { AccountTreeControllerMessenger, } from './types'; +export type { + AccountTreeControllerGetAccountWalletObjectAction, + AccountTreeControllerGetAccountWalletObjectsAction, + AccountTreeControllerGetAccountsFromSelectedAccountGroupAction, + AccountTreeControllerGetAccountGroupObjectAction, + AccountTreeControllerGetAccountContextAction, + AccountTreeControllerGetSelectedAccountGroupAction, + AccountTreeControllerSetSelectedAccountGroupAction, + AccountTreeControllerSetAccountGroupNameAction, + AccountTreeControllerSetAccountWalletNameAction, + AccountTreeControllerSetAccountGroupPinnedAction, + AccountTreeControllerSetAccountGroupHiddenAction, + AccountTreeControllerClearStateAction, + AccountTreeControllerSyncWithUserStorageAction, + AccountTreeControllerSyncWithUserStorageAtLeastOnceAction, + AccountTreeControllerMethodActions, +} from './AccountTreeController-method-action-types'; + export type { AccountContext } from './AccountTreeController'; export { diff --git a/packages/account-tree-controller/src/types.ts b/packages/account-tree-controller/src/types.ts index 4f05edb15f9..e571e8bc0a2 100644 --- a/packages/account-tree-controller/src/types.ts +++ b/packages/account-tree-controller/src/types.ts @@ -23,10 +23,8 @@ import type { } from '@metamask/profile-sync-controller'; import type { GetSnap as SnapControllerGetSnap } from '@metamask/snaps-controllers'; -import type { - AccountTreeController, - controllerName, -} from './AccountTreeController'; +import type { controllerName } from './AccountTreeController'; +import { AccountTreeControllerMethodActions } from './AccountTreeController-method-action-types'; import type { BackupAndSyncAnalyticsEventPayload, BackupAndSyncEmitAnalyticsEventParams, @@ -79,76 +77,6 @@ export type AccountTreeControllerGetStateAction = ControllerGetStateAction< AccountTreeControllerState >; -export type AccountTreeControllerSetSelectedAccountGroupAction = { - type: `${typeof controllerName}:setSelectedAccountGroup`; - handler: AccountTreeController['setSelectedAccountGroup']; -}; - -export type AccountTreeControllerGetSelectedAccountGroupAction = { - type: `${typeof controllerName}:getSelectedAccountGroup`; - handler: AccountTreeController['getSelectedAccountGroup']; -}; - -export type AccountTreeControllerGetAccountsFromSelectedAccountGroupAction = { - type: `${typeof controllerName}:getAccountsFromSelectedAccountGroup`; - handler: AccountTreeController['getAccountsFromSelectedAccountGroup']; -}; - -export type AccountTreeControllerGetAccountContextAction = { - type: `${typeof controllerName}:getAccountContext`; - handler: AccountTreeController['getAccountContext']; -}; - -export type AccountTreeControllerSetAccountWalletNameAction = { - type: `${typeof controllerName}:setAccountWalletName`; - handler: AccountTreeController['setAccountWalletName']; -}; - -export type AccountTreeControllerSetAccountGroupNameAction = { - type: `${typeof controllerName}:setAccountGroupName`; - handler: AccountTreeController['setAccountGroupName']; -}; - -export type AccountTreeControllerSetAccountGroupHiddenAction = { - type: `${typeof controllerName}:setAccountGroupHidden`; - handler: AccountTreeController['setAccountGroupHidden']; -}; - -export type AccountTreeControllerSetAccountGroupPinnedAction = { - type: `${typeof controllerName}:setAccountGroupPinned`; - handler: AccountTreeController['setAccountGroupPinned']; -}; - -export type AccountTreeControllerGetAccountWalletObjectAction = { - type: `${typeof controllerName}:getAccountWalletObject`; - handler: AccountTreeController['getAccountWalletObject']; -}; - -export type AccountTreeControllerGetAccountWalletObjectsAction = { - type: `${typeof controllerName}:getAccountWalletObjects`; - handler: AccountTreeController['getAccountWalletObjects']; -}; - -export type AccountTreeControllerGetAccountGroupObjectAction = { - type: `${typeof controllerName}:getAccountGroupObject`; - handler: AccountTreeController['getAccountGroupObject']; -}; - -export type AccountTreeControllerClearStateAction = { - type: `${typeof controllerName}:clearState`; - handler: AccountTreeController['clearState']; -}; - -export type AccountTreeControllerSyncWithUserStorageAction = { - type: `${typeof controllerName}:syncWithUserStorage`; - handler: AccountTreeController['syncWithUserStorage']; -}; - -export type AccountTreeControllerSyncWithUserStorageAtLeastOnceAction = { - type: `${typeof controllerName}:syncWithUserStorageAtLeastOnce`; - handler: AccountTreeController['syncWithUserStorageAtLeastOnce']; -}; - export type AllowedActions = | AccountsControllerGetAccountAction | AccountsControllerGetSelectedMultichainAccountAction @@ -166,20 +94,7 @@ export type AllowedActions = export type AccountTreeControllerActions = | AccountTreeControllerGetStateAction - | AccountTreeControllerSetSelectedAccountGroupAction - | AccountTreeControllerGetSelectedAccountGroupAction - | AccountTreeControllerGetAccountsFromSelectedAccountGroupAction - | AccountTreeControllerGetAccountContextAction - | AccountTreeControllerSetAccountWalletNameAction - | AccountTreeControllerSetAccountGroupNameAction - | AccountTreeControllerSetAccountGroupPinnedAction - | AccountTreeControllerSetAccountGroupHiddenAction - | AccountTreeControllerGetAccountWalletObjectAction - | AccountTreeControllerGetAccountWalletObjectsAction - | AccountTreeControllerGetAccountGroupObjectAction - | AccountTreeControllerClearStateAction - | AccountTreeControllerSyncWithUserStorageAction - | AccountTreeControllerSyncWithUserStorageAtLeastOnceAction; + | AccountTreeControllerMethodActions; export type AccountTreeControllerStateChangeEvent = ControllerStateChangeEvent< typeof controllerName, diff --git a/packages/assets-controller/src/index.ts b/packages/assets-controller/src/index.ts index a25a2971355..cd6e2505fdc 100644 --- a/packages/assets-controller/src/index.ts +++ b/packages/assets-controller/src/index.ts @@ -30,7 +30,7 @@ export type { AssetsControllerHideAssetAction, AssetsControllerUnhideAssetAction, AssetsControllerMethodActions, -} from './AssetsController-method-action-types'; +} from './AssetsController-'; // Core types export type { diff --git a/yarn.lock b/yarn.lock index 20cceb41217..1e3d01ab7ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2301,6 +2301,7 @@ __metadata: jest: "npm:^29.7.0" lodash: "npm:^4.17.21" ts-jest: "npm:^29.2.5" + tsx: "npm:^4.20.5" typedoc: "npm:^0.25.13" typedoc-plugin-missing-exports: "npm:^2.0.0" typescript: "npm:~5.3.3" From b1a94d3f5fb2f4a21abc5e5249643e87547a278f Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Thu, 19 Feb 2026 15:44:40 +0100 Subject: [PATCH 06/27] use `generate-method-action-types` in `accounts-controller` --- packages/accounts-controller/package.json | 3 + .../AccountsController-method-action-types.ts | 168 ++++++++++++++++++ .../src/AccountsController.ts | 132 +------------- packages/accounts-controller/src/index.ts | 28 +-- yarn.lock | 1 + 5 files changed, 190 insertions(+), 142 deletions(-) create mode 100644 packages/accounts-controller/src/AccountsController-method-action-types.ts diff --git a/packages/accounts-controller/package.json b/packages/accounts-controller/package.json index c66f9ee460d..8ae42b8b765 100644 --- a/packages/accounts-controller/package.json +++ b/packages/accounts-controller/package.json @@ -40,6 +40,8 @@ "build:docs": "typedoc", "changelog:update": "../../scripts/update-changelog.sh @metamask/accounts-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/accounts-controller", + "generate-method-action-types": "tsx ../../scripts/generate-method-action-types.ts", + "publish:preview": "yarn npm publish --tag preview", "since-latest-release": "../../scripts/since-latest-release.sh", "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", @@ -76,6 +78,7 @@ "@types/readable-stream": "^2.3.0", "jest": "^29.7.0", "ts-jest": "^29.2.5", + "tsx": "^4.20.5", "typedoc": "^0.25.13", "typedoc-plugin-missing-exports": "^2.0.0", "typescript": "~5.3.3", diff --git a/packages/accounts-controller/src/AccountsController-method-action-types.ts b/packages/accounts-controller/src/AccountsController-method-action-types.ts new file mode 100644 index 00000000000..816b42d40c1 --- /dev/null +++ b/packages/accounts-controller/src/AccountsController-method-action-types.ts @@ -0,0 +1,168 @@ +/** + * This file is auto generated by `scripts/generate-method-action-types.ts`. + * Do not edit manually. + */ + +import type { AccountsController } from './AccountsController'; + +/** + * Returns the internal account object for the given account ID, if it exists. + * + * @param accountId - The ID of the account to retrieve. + * @returns The internal account object, or undefined if the account does not exist. + */ +export type AccountsControllerGetAccountAction = { + type: `AccountsController:getAccount`; + handler: AccountsController['getAccount']; +}; + +/** + * Returns the internal account objects for the given account IDs, if they exist. + * + * @param accountIds - The IDs of the accounts to retrieve. + * @returns The internal account objects, or undefined if the account(s) do not exist. + */ +export type AccountsControllerGetAccountsAction = { + type: `AccountsController:getAccounts`; + handler: AccountsController['getAccounts']; +}; + +/** + * Returns an array of all evm internal accounts. + * + * @returns An array of InternalAccount objects. + */ +export type AccountsControllerListAccountsAction = { + type: `AccountsController:listAccounts`; + handler: AccountsController['listAccounts']; +}; + +/** + * Returns an array of all internal accounts. + * + * @param chainId - The chain ID. + * @returns An array of InternalAccount objects. + */ +export type AccountsControllerListMultichainAccountsAction = { + type: `AccountsController:listMultichainAccounts`; + handler: AccountsController['listMultichainAccounts']; +}; + +/** + * Returns the last selected EVM account. + * + * @returns The selected internal account. + */ +export type AccountsControllerGetSelectedAccountAction = { + type: `AccountsController:getSelectedAccount`; + handler: AccountsController['getSelectedAccount']; +}; + +/** + * __WARNING The return value may be undefined if there isn't an account for that chain id.__ + * + * Retrieves the last selected account by chain ID. + * + * @param chainId - The chain ID to filter the accounts. + * @returns The last selected account compatible with the specified chain ID or undefined. + */ +export type AccountsControllerGetSelectedMultichainAccountAction = { + type: `AccountsController:getSelectedMultichainAccount`; + handler: AccountsController['getSelectedMultichainAccount']; +}; + +/** + * Returns the account with the specified address. + * ! This method will only return the first account that matches the address + * + * @param address - The address of the account to retrieve. + * @returns The account with the specified address, or undefined if not found. + */ +export type AccountsControllerGetAccountByAddressAction = { + type: `AccountsController:getAccountByAddress`; + handler: AccountsController['getAccountByAddress']; +}; + +/** + * Sets the selected account by its ID. + * + * @param accountId - The ID of the account to be selected. + */ +export type AccountsControllerSetSelectedAccountAction = { + type: `AccountsController:setSelectedAccount`; + handler: AccountsController['setSelectedAccount']; +}; + +/** + * Sets the name of the account with the given ID. + * + * @param accountId - The ID of the account to set the name for. + * @param accountName - The new name for the account. + * @throws An error if an account with the same name already exists. + */ +export type AccountsControllerSetAccountNameAction = { + type: `AccountsController:setAccountName`; + handler: AccountsController['setAccountName']; +}; + +/** + * Sets the name of the account with the given ID and select it. + * + * @param accountId - The ID of the account to set the name for and select. + * @param accountName - The new name for the account. + * @throws An error if an account with the same name already exists. + */ +export type AccountsControllerSetAccountNameAndSelectAccountAction = { + type: `AccountsController:setAccountNameAndSelectAccount`; + handler: AccountsController['setAccountNameAndSelectAccount']; +}; + +/** + * Updates the metadata of the account with the given ID. + * + * @param accountId - The ID of the account for which the metadata will be updated. + * @param metadata - The new metadata for the account. + */ +export type AccountsControllerUpdateAccountMetadataAction = { + type: `AccountsController:updateAccountMetadata`; + handler: AccountsController['updateAccountMetadata']; +}; + +/** + * Updates the internal accounts list by retrieving normal and snap accounts, + * removing duplicates, and updating the metadata of each account. + * + * @returns A Promise that resolves when the accounts have been updated. + */ +export type AccountsControllerUpdateAccountsAction = { + type: `AccountsController:updateAccounts`; + handler: AccountsController['updateAccounts']; +}; + +/** + * Loads the backup state of the accounts controller. + * + * @param backup - The backup state to load. + */ +export type AccountsControllerLoadBackupAction = { + type: `AccountsController:loadBackup`; + handler: AccountsController['loadBackup']; +}; + +/** + * Union of all AccountsController action types. + */ +export type AccountsControllerMethodActions = + | AccountsControllerGetAccountAction + | AccountsControllerGetAccountsAction + | AccountsControllerListAccountsAction + | AccountsControllerListMultichainAccountsAction + | AccountsControllerGetSelectedAccountAction + | AccountsControllerGetSelectedMultichainAccountAction + | AccountsControllerGetAccountByAddressAction + | AccountsControllerSetSelectedAccountAction + | AccountsControllerSetAccountNameAction + | AccountsControllerSetAccountNameAndSelectAccountAction + | AccountsControllerUpdateAccountMetadataAction + | AccountsControllerUpdateAccountsAction + | AccountsControllerLoadBackupAction; diff --git a/packages/accounts-controller/src/AccountsController.ts b/packages/accounts-controller/src/AccountsController.ts index afdbed0cd83..51c3ee32f53 100644 --- a/packages/accounts-controller/src/AccountsController.ts +++ b/packages/accounts-controller/src/AccountsController.ts @@ -38,6 +38,7 @@ import type { CaipChainId } from '@metamask/utils'; import type { WritableDraft } from 'immer/dist/internal.js'; import { cloneDeep } from 'lodash'; +import { AccountsControllerMethodActions } from './AccountsController-method-action-types'; import type { MultichainNetworkControllerNetworkDidChangeEvent } from './types'; import type { AccountsControllerStrictState } from './typing'; import type { HdSnapKeyringAccount } from './utils'; @@ -79,123 +80,6 @@ export type AccountsControllerGetStateAction = ControllerGetStateAction< AccountsControllerState >; -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerSetSelectedAccountAction = { - type: `${typeof controllerName}:setSelectedAccount`; - handler: AccountsController['setSelectedAccount']; -}; - -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerSetAccountNameAction = { - type: `${typeof controllerName}:setAccountName`; - handler: AccountsController['setAccountName']; -}; - -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerSetAccountNameAndSelectAccountAction = { - type: `${typeof controllerName}:setAccountNameAndSelectAccount`; - handler: AccountsController['setAccountNameAndSelectAccount']; -}; - -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerListAccountsAction = { - type: `${typeof controllerName}:listAccounts`; - handler: AccountsController['listAccounts']; -}; - -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerListMultichainAccountsAction = { - type: `${typeof controllerName}:listMultichainAccounts`; - handler: AccountsController['listMultichainAccounts']; -}; - -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerUpdateAccountsAction = { - type: `${typeof controllerName}:updateAccounts`; - handler: AccountsController['updateAccounts']; -}; - -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerGetSelectedAccountAction = { - type: `${typeof controllerName}:getSelectedAccount`; - handler: AccountsController['getSelectedAccount']; -}; - -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerGetSelectedMultichainAccountAction = { - type: `${typeof controllerName}:getSelectedMultichainAccount`; - handler: AccountsController['getSelectedMultichainAccount']; -}; - -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerGetAccountByAddressAction = { - type: `${typeof controllerName}:getAccountByAddress`; - handler: AccountsController['getAccountByAddress']; -}; - -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerGetAccountAction = { - type: `${typeof controllerName}:getAccount`; - handler: AccountsController['getAccount']; -}; - -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerGetAccountsAction = { - type: `${typeof controllerName}:getAccounts`; - handler: AccountsController['getAccounts']; -}; - -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerUpdateAccountMetadataAction = { - type: `${typeof controllerName}:updateAccountMetadata`; - handler: AccountsController['updateAccountMetadata']; -}; - -/** - * @deprecated This type is deprecated and will be removed in a future version. - * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. - */ -export type AccountsControllerLoadBackupAction = { - type: `${typeof controllerName}:loadBackup`; - handler: AccountsController['loadBackup']; -}; - const MESSENGER_EXPOSED_METHODS = [ 'setSelectedAccount', 'setAccountName', @@ -222,19 +106,7 @@ export type AllowedActions = */ export type AccountsControllerActions = | AccountsControllerGetStateAction - | AccountsControllerSetSelectedAccountAction - | AccountsControllerListAccountsAction - | AccountsControllerListMultichainAccountsAction - | AccountsControllerSetAccountNameAction - | AccountsControllerSetAccountNameAndSelectAccountAction - | AccountsControllerUpdateAccountsAction - | AccountsControllerGetAccountByAddressAction - | AccountsControllerGetSelectedAccountAction - | AccountsControllerGetAccountAction - | AccountsControllerGetAccountsAction - | AccountsControllerGetSelectedMultichainAccountAction - | AccountsControllerUpdateAccountMetadataAction - | AccountsControllerLoadBackupAction; + | AccountsControllerMethodActions; /** * @deprecated This type is deprecated and will be removed in a future version. diff --git a/packages/accounts-controller/src/index.ts b/packages/accounts-controller/src/index.ts index c3af66e31d5..c07a7dd2cee 100644 --- a/packages/accounts-controller/src/index.ts +++ b/packages/accounts-controller/src/index.ts @@ -2,18 +2,6 @@ export type { AccountId, AccountsControllerState, AccountsControllerGetStateAction, - AccountsControllerSetSelectedAccountAction, - AccountsControllerSetAccountNameAction, - AccountsControllerSetAccountNameAndSelectAccountAction, - AccountsControllerListAccountsAction, - AccountsControllerListMultichainAccountsAction, - AccountsControllerUpdateAccountsAction, - AccountsControllerGetSelectedAccountAction, - AccountsControllerGetSelectedMultichainAccountAction, - AccountsControllerGetAccountByAddressAction, - AccountsControllerGetAccountAction, - AccountsControllerGetAccountsAction, - AccountsControllerUpdateAccountMetadataAction, AllowedActions, AccountsControllerActions, AccountsControllerChangeEvent, @@ -29,6 +17,22 @@ export type { AccountsControllerEvents, AccountsControllerMessenger, } from './AccountsController'; +export type { + AccountsControllerGetAccountAction, + AccountsControllerGetAccountsAction, + AccountsControllerListAccountsAction, + AccountsControllerListMultichainAccountsAction, + AccountsControllerGetSelectedAccountAction, + AccountsControllerGetSelectedMultichainAccountAction, + AccountsControllerGetAccountByAddressAction, + AccountsControllerSetSelectedAccountAction, + AccountsControllerSetAccountNameAction, + AccountsControllerSetAccountNameAndSelectAccountAction, + AccountsControllerUpdateAccountMetadataAction, + AccountsControllerUpdateAccountsAction, + AccountsControllerLoadBackupAction, + AccountsControllerMethodActions, +} from './AccountsController-method-action-types'; export { EMPTY_ACCOUNT, AccountsController } from './AccountsController'; export { keyringTypeToName, diff --git a/yarn.lock b/yarn.lock index 1e3d01ab7ea..a44c8a8d992 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2342,6 +2342,7 @@ __metadata: jest: "npm:^29.7.0" lodash: "npm:^4.17.21" ts-jest: "npm:^29.2.5" + tsx: "npm:^4.20.5" typedoc: "npm:^0.25.13" typedoc-plugin-missing-exports: "npm:^2.0.0" typescript: "npm:~5.3.3" From 2f75dca2df7ba626440fc487d3cc89d81ad1c223 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Thu, 19 Feb 2026 15:50:45 +0100 Subject: [PATCH 07/27] use `generate-method-action-types` in `multichain-account-service` --- .../multichain-account-service/package.json | 3 + ...chainAccountService-method-action-types.ts | 191 ++++++++++++++++++ .../multichain-account-service/src/index.ts | 21 +- .../multichain-account-service/src/types.ts | 86 +------- yarn.lock | 1 + 5 files changed, 213 insertions(+), 89 deletions(-) create mode 100644 packages/multichain-account-service/src/MultichainAccountService-method-action-types.ts diff --git a/packages/multichain-account-service/package.json b/packages/multichain-account-service/package.json index ccdb1c42c95..c95bea8f732 100644 --- a/packages/multichain-account-service/package.json +++ b/packages/multichain-account-service/package.json @@ -40,6 +40,8 @@ "build:docs": "typedoc", "changelog:update": "../../scripts/update-changelog.sh @metamask/multichain-account-service", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/multichain-account-service", + "generate-method-action-types": "tsx ../../scripts/generate-method-action-types.ts", + "publish:preview": "yarn npm publish --tag preview", "since-latest-release": "../../scripts/since-latest-release.sh", "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", @@ -77,6 +79,7 @@ "deepmerge": "^4.2.2", "jest": "^29.7.0", "ts-jest": "^29.2.5", + "tsx": "^4.20.5", "typedoc": "^0.25.13", "typedoc-plugin-missing-exports": "^2.0.0", "typescript": "~5.3.3", diff --git a/packages/multichain-account-service/src/MultichainAccountService-method-action-types.ts b/packages/multichain-account-service/src/MultichainAccountService-method-action-types.ts new file mode 100644 index 00000000000..caf82281de1 --- /dev/null +++ b/packages/multichain-account-service/src/MultichainAccountService-method-action-types.ts @@ -0,0 +1,191 @@ +/** + * This file is auto generated by `scripts/generate-method-action-types.ts`. + * Do not edit manually. + */ + +import type { MultichainAccountService } from './MultichainAccountService'; + +/** + * Re-synchronize MetaMask accounts and the providers accounts if needed. + * + * NOTE: This is mostly required if one of the providers (keyrings or Snaps) + * have different sets of accounts. This method would ensure that both are + * in-sync and use the same accounts (and same IDs). + * + * READ THIS CAREFULLY (State inconsistency bugs/de-sync) + * We've seen some problems were keyring accounts on some Snaps were not synchronized + * with the accounts on MM side. This causes problems where we cannot interact with + * those accounts because the Snap does know about them. + * To "workaround" this de-sync problem for now, we make sure that both parties are + * in-sync when the service boots up. + * ---------------------------------------------------------------------------------- + */ +export type MultichainAccountServiceResyncAccountsAction = { + type: `MultichainAccountService:resyncAccounts`; + handler: MultichainAccountService['resyncAccounts']; +}; + +export type MultichainAccountServiceEnsureCanUseSnapPlatformAction = { + type: `MultichainAccountService:ensureCanUseSnapPlatform`; + handler: MultichainAccountService['ensureCanUseSnapPlatform']; +}; + +/** + * Gets a reference to the multichain account wallet matching this entropy source. + * + * @param options - Options. + * @param options.entropySource - The entropy source of the multichain account. + * @throws If none multichain account match this entropy. + * @returns A reference to the multichain account wallet. + */ +export type MultichainAccountServiceGetMultichainAccountWalletAction = { + type: `MultichainAccountService:getMultichainAccountWallet`; + handler: MultichainAccountService['getMultichainAccountWallet']; +}; + +/** + * Gets an array of all multichain account wallets. + * + * @returns An array of all multichain account wallets. + */ +export type MultichainAccountServiceGetMultichainAccountWalletsAction = { + type: `MultichainAccountService:getMultichainAccountWallets`; + handler: MultichainAccountService['getMultichainAccountWallets']; +}; + +/** + * Creates a new multichain account wallet by either importing an existing mnemonic, + * creating a new vault and keychain, or restoring a vault and keyring. + * + * NOTE: This method should only be called in client code where a mutex lock is acquired. + * `discoverAccounts` should be called after this method to discover and create accounts. + * + * @param params - The parameters to use to create the new wallet. + * @param params.mnemonic - The mnemonic to use to create the new wallet. + * @param params.password - The password to encrypt the vault with. + * @param params.type - The flow type to use to create the new wallet. + * @throws If the mnemonic has already been imported. + * @returns The new multichain account wallet. + */ +export type MultichainAccountServiceCreateMultichainAccountWalletAction = { + type: `MultichainAccountService:createMultichainAccountWallet`; + handler: MultichainAccountService['createMultichainAccountWallet']; +}; + +/** + * Removes a multichain account wallet. + * + * NOTE: This method should only be called in client code as a revert mechanism. + * At the point that this code is called, discovery shouldn't have been triggered. + * This is meant to be used in the scenario where a seed phrase backup is not successful. + * + * @param entropySource - The entropy source of the multichain account wallet. + * @param accountAddress - The address of the account to remove. + * @returns The removed multichain account wallet. + */ +export type MultichainAccountServiceRemoveMultichainAccountWalletAction = { + type: `MultichainAccountService:removeMultichainAccountWallet`; + handler: MultichainAccountService['removeMultichainAccountWallet']; +}; + +/** + * Gets a reference to the multichain account group matching this entropy source + * and a group index. + * + * @param options - Options. + * @param options.entropySource - The entropy source of the multichain account. + * @param options.groupIndex - The group index of the multichain account. + * @throws If none multichain account match this entropy source and group index. + * @returns A reference to the multichain account. + */ +export type MultichainAccountServiceGetMultichainAccountGroupAction = { + type: `MultichainAccountService:getMultichainAccountGroup`; + handler: MultichainAccountService['getMultichainAccountGroup']; +}; + +/** + * Gets all multichain account groups for a given entropy source. + * + * @param options - Options. + * @param options.entropySource - The entropy source to query. + * @throws If no multichain accounts match this entropy source. + * @returns A list of all multichain accounts. + */ +export type MultichainAccountServiceGetMultichainAccountGroupsAction = { + type: `MultichainAccountService:getMultichainAccountGroups`; + handler: MultichainAccountService['getMultichainAccountGroups']; +}; + +/** + * Creates the next multichain account group. + * + * @param options - Options. + * @param options.entropySource - The wallet's entropy source. + * @returns The next multichain account group. + */ +export type MultichainAccountServiceCreateNextMultichainAccountGroupAction = { + type: `MultichainAccountService:createNextMultichainAccountGroup`; + handler: MultichainAccountService['createNextMultichainAccountGroup']; +}; + +/** + * Creates a multichain account group. + * + * @param options - Options. + * @param options.groupIndex - The group index to use. + * @param options.entropySource - The wallet's entropy source. + * @returns The multichain account group for this group index. + */ +export type MultichainAccountServiceCreateMultichainAccountGroupAction = { + type: `MultichainAccountService:createMultichainAccountGroup`; + handler: MultichainAccountService['createMultichainAccountGroup']; +}; + +/** + * Set basic functionality state and trigger alignment if enabled. + * When basic functionality is disabled, snap-based providers are disabled. + * When enabled, all snap providers are enabled and wallet alignment is triggered. + * EVM providers are never disabled as they're required for basic wallet functionality. + * + * @param enabled - Whether basic functionality is enabled. + */ +export type MultichainAccountServiceSetBasicFunctionalityAction = { + type: `MultichainAccountService:setBasicFunctionality`; + handler: MultichainAccountService['setBasicFunctionality']; +}; + +/** + * Align all multichain account wallets. + */ +export type MultichainAccountServiceAlignWalletsAction = { + type: `MultichainAccountService:alignWallets`; + handler: MultichainAccountService['alignWallets']; +}; + +/** + * Align a specific multichain account wallet. + * + * @param entropySource - The entropy source of the multichain account wallet. + */ +export type MultichainAccountServiceAlignWalletAction = { + type: `MultichainAccountService:alignWallet`; + handler: MultichainAccountService['alignWallet']; +}; + +/** + * Union of all MultichainAccountService action types. + */ +export type MultichainAccountServiceMethodActions = + | MultichainAccountServiceResyncAccountsAction + | MultichainAccountServiceEnsureCanUseSnapPlatformAction + | MultichainAccountServiceGetMultichainAccountWalletAction + | MultichainAccountServiceGetMultichainAccountWalletsAction + | MultichainAccountServiceCreateMultichainAccountWalletAction + | MultichainAccountServiceRemoveMultichainAccountWalletAction + | MultichainAccountServiceGetMultichainAccountGroupAction + | MultichainAccountServiceGetMultichainAccountGroupsAction + | MultichainAccountServiceCreateNextMultichainAccountGroupAction + | MultichainAccountServiceCreateMultichainAccountGroupAction + | MultichainAccountServiceSetBasicFunctionalityAction + | MultichainAccountServiceAlignWalletsAction + | MultichainAccountServiceAlignWalletAction; diff --git a/packages/multichain-account-service/src/index.ts b/packages/multichain-account-service/src/index.ts index 8a322a0894f..bb988a804d9 100644 --- a/packages/multichain-account-service/src/index.ts +++ b/packages/multichain-account-service/src/index.ts @@ -2,17 +2,26 @@ export type { MultichainAccountServiceActions, MultichainAccountServiceEvents, MultichainAccountServiceMessenger, - MultichainAccountServiceGetMultichainAccountGroupAction, + MultichainAccountServiceMultichainAccountGroupCreatedEvent, + MultichainAccountServiceMultichainAccountGroupUpdatedEvent, + MultichainAccountServiceWalletStatusChangeEvent, +} from './types'; +export type { + MultichainAccountServiceResyncAccountsAction, + MultichainAccountServiceEnsureCanUseSnapPlatformAction, MultichainAccountServiceGetMultichainAccountWalletAction, MultichainAccountServiceGetMultichainAccountWalletsAction, + MultichainAccountServiceCreateMultichainAccountWalletAction, + MultichainAccountServiceRemoveMultichainAccountWalletAction, + MultichainAccountServiceGetMultichainAccountGroupAction, MultichainAccountServiceGetMultichainAccountGroupsAction, - MultichainAccountServiceCreateMultichainAccountGroupAction, MultichainAccountServiceCreateNextMultichainAccountGroupAction, + MultichainAccountServiceCreateMultichainAccountGroupAction, MultichainAccountServiceSetBasicFunctionalityAction, - MultichainAccountServiceMultichainAccountGroupCreatedEvent, - MultichainAccountServiceMultichainAccountGroupUpdatedEvent, - MultichainAccountServiceWalletStatusChangeEvent, -} from './types'; + MultichainAccountServiceAlignWalletsAction, + MultichainAccountServiceAlignWalletAction, + MultichainAccountServiceMethodActions, +} from './MultichainAccountService-method-action-types'; export { AccountProviderWrapper, BaseBip44AccountProvider, diff --git a/packages/multichain-account-service/src/types.ts b/packages/multichain-account-service/src/types.ts index 74943136558..ebb9e13e160 100644 --- a/packages/multichain-account-service/src/types.ts +++ b/packages/multichain-account-service/src/types.ts @@ -35,94 +35,14 @@ import type { SnapStateChange as SnapControllerStateChangeEvent, } from '@metamask/snaps-controllers'; -import type { - MultichainAccountService, - serviceName, -} from './MultichainAccountService'; - -export type MultichainAccountServiceGetMultichainAccountGroupAction = { - type: `${typeof serviceName}:getMultichainAccountGroup`; - handler: MultichainAccountService['getMultichainAccountGroup']; -}; - -export type MultichainAccountServiceGetMultichainAccountGroupsAction = { - type: `${typeof serviceName}:getMultichainAccountGroups`; - handler: MultichainAccountService['getMultichainAccountGroups']; -}; - -export type MultichainAccountServiceGetMultichainAccountWalletAction = { - type: `${typeof serviceName}:getMultichainAccountWallet`; - handler: MultichainAccountService['getMultichainAccountWallet']; -}; - -export type MultichainAccountServiceGetMultichainAccountWalletsAction = { - type: `${typeof serviceName}:getMultichainAccountWallets`; - handler: MultichainAccountService['getMultichainAccountWallets']; -}; - -export type MultichainAccountServiceCreateNextMultichainAccountGroupAction = { - type: `${typeof serviceName}:createNextMultichainAccountGroup`; - handler: MultichainAccountService['createNextMultichainAccountGroup']; -}; - -export type MultichainAccountServiceCreateMultichainAccountGroupAction = { - type: `${typeof serviceName}:createMultichainAccountGroup`; - handler: MultichainAccountService['createMultichainAccountGroup']; -}; - -export type MultichainAccountServiceSetBasicFunctionalityAction = { - type: `${typeof serviceName}:setBasicFunctionality`; - handler: MultichainAccountService['setBasicFunctionality']; -}; - -export type MultichainAccountServiceAlignWalletAction = { - type: `${typeof serviceName}:alignWallet`; - handler: MultichainAccountService['alignWallet']; -}; - -export type MultichainAccountServiceAlignWalletsAction = { - type: `${typeof serviceName}:alignWallets`; - handler: MultichainAccountService['alignWallets']; -}; - -export type MultichainAccountServiceCreateMultichainAccountWalletAction = { - type: `${typeof serviceName}:createMultichainAccountWallet`; - handler: MultichainAccountService['createMultichainAccountWallet']; -}; - -export type MultichainAccountServiceResyncAccountsAction = { - type: `${typeof serviceName}:resyncAccounts`; - handler: MultichainAccountService['resyncAccounts']; -}; - -export type MultichainAccountServiceRemoveMultichainAccountWalletAction = { - type: `${typeof serviceName}:removeMultichainAccountWallet`; - handler: MultichainAccountService['removeMultichainAccountWallet']; -}; - -export type MultichainAccountServiceEnsureCanUseSnapPlatformAction = { - type: `${typeof serviceName}:ensureCanUseSnapPlatform`; - handler: MultichainAccountService['ensureCanUseSnapPlatform']; -}; - +import type { serviceName } from './MultichainAccountService'; +import { MultichainAccountServiceMethodActions } from './MultichainAccountService-method-action-types'; /** * All actions that {@link MultichainAccountService} registers so that other * modules can call them. */ export type MultichainAccountServiceActions = - | MultichainAccountServiceGetMultichainAccountGroupAction - | MultichainAccountServiceGetMultichainAccountGroupsAction - | MultichainAccountServiceGetMultichainAccountWalletAction - | MultichainAccountServiceGetMultichainAccountWalletsAction - | MultichainAccountServiceCreateNextMultichainAccountGroupAction - | MultichainAccountServiceCreateMultichainAccountGroupAction - | MultichainAccountServiceSetBasicFunctionalityAction - | MultichainAccountServiceAlignWalletAction - | MultichainAccountServiceAlignWalletsAction - | MultichainAccountServiceCreateMultichainAccountWalletAction - | MultichainAccountServiceResyncAccountsAction - | MultichainAccountServiceRemoveMultichainAccountWalletAction - | MultichainAccountServiceEnsureCanUseSnapPlatformAction; + MultichainAccountServiceMethodActions; export type MultichainAccountServiceMultichainAccountGroupCreatedEvent = { type: `${typeof serviceName}:multichainAccountGroupCreated`; diff --git a/yarn.lock b/yarn.lock index a44c8a8d992..c7627809aa9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4042,6 +4042,7 @@ __metadata: jest: "npm:^29.7.0" lodash: "npm:^4.17.21" ts-jest: "npm:^29.2.5" + tsx: "npm:^4.20.5" typedoc: "npm:^0.25.13" typedoc-plugin-missing-exports: "npm:^2.0.0" typescript: "npm:~5.3.3" From e0c14b70bdc90bb206c55858d351cc28a781f1a9 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Thu, 19 Feb 2026 16:10:36 +0100 Subject: [PATCH 08/27] use `generate-method-action-types` in `profile-sync-controller` --- packages/profile-sync-controller/package.json | 5 + ...nticationController-method-action-types.ts | 61 +++++++ .../AuthenticationController.ts | 26 +-- .../src/controllers/authentication/index.ts | 15 +- ...erStorageController-method-action-types.ts | 162 ++++++++++++++++++ .../user-storage/UserStorageController.ts | 56 ++---- .../src/controllers/user-storage/index.ts | 20 ++- yarn.lock | 1 + 8 files changed, 276 insertions(+), 70 deletions(-) create mode 100644 packages/profile-sync-controller/src/controllers/authentication/AuthenticationController-method-action-types.ts create mode 100644 packages/profile-sync-controller/src/controllers/user-storage/UserStorageController-method-action-types.ts diff --git a/packages/profile-sync-controller/package.json b/packages/profile-sync-controller/package.json index 323151f3743..9ad39132365 100644 --- a/packages/profile-sync-controller/package.json +++ b/packages/profile-sync-controller/package.json @@ -93,6 +93,10 @@ "build:docs": "typedoc", "changelog:update": "../../scripts/update-changelog.sh @metamask/profile-sync-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/profile-sync-controller", + "generate-method-action-types": "yarn generate-method-action-types:authentication \"$@\" && yarn generate-method-action-types:user-storage \"$@\"", + "generate-method-action-types:authentication": "tsx ../../scripts/generate-method-action-types.ts src/controllers/authentication", + "generate-method-action-types:user-storage": "tsx ../../scripts/generate-method-action-types.ts src/controllers/user-storage", + "publish:preview": "yarn npm publish --tag preview", "since-latest-release": "../../scripts/since-latest-release.sh", "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", @@ -129,6 +133,7 @@ "jest-environment-jsdom": "^29.7.0", "nock": "^13.3.1", "ts-jest": "^29.2.5", + "tsx": "^4.20.5", "typedoc": "^0.25.13", "typedoc-plugin-missing-exports": "^2.0.0", "typescript": "~5.3.3", diff --git a/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController-method-action-types.ts b/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController-method-action-types.ts new file mode 100644 index 00000000000..9b3db73e8c5 --- /dev/null +++ b/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController-method-action-types.ts @@ -0,0 +1,61 @@ +/** + * This file is auto generated by `scripts/generate-method-action-types.ts`. + * Do not edit manually. + */ + +import type { AuthenticationController } from './AuthenticationController'; + +export type AuthenticationControllerPerformSignInAction = { + type: `AuthenticationController:performSignIn`; + handler: AuthenticationController['performSignIn']; +}; + +export type AuthenticationControllerPerformSignOutAction = { + type: `AuthenticationController:performSignOut`; + handler: AuthenticationController['performSignOut']; +}; + +/** + * Will return a bearer token. + * Logs a user in if a user is not logged in. + * + * @returns profile for the session. + */ +export type AuthenticationControllerGetBearerTokenAction = { + type: `AuthenticationController:getBearerToken`; + handler: AuthenticationController['getBearerToken']; +}; + +/** + * Will return a session profile. + * Logs a user in if a user is not logged in. + * + * @param entropySourceId - The entropy source ID used to derive the key, + * when multiple sources are available (Multi-SRP). + * @returns profile for the session. + */ +export type AuthenticationControllerGetSessionProfileAction = { + type: `AuthenticationController:getSessionProfile`; + handler: AuthenticationController['getSessionProfile']; +}; + +export type AuthenticationControllerGetUserProfileLineageAction = { + type: `AuthenticationController:getUserProfileLineage`; + handler: AuthenticationController['getUserProfileLineage']; +}; + +export type AuthenticationControllerIsSignedInAction = { + type: `AuthenticationController:isSignedIn`; + handler: AuthenticationController['isSignedIn']; +}; + +/** + * Union of all AuthenticationController action types. + */ +export type AuthenticationControllerMethodActions = + | AuthenticationControllerPerformSignInAction + | AuthenticationControllerPerformSignOutAction + | AuthenticationControllerGetBearerTokenAction + | AuthenticationControllerGetSessionProfileAction + | AuthenticationControllerGetUserProfileLineageAction + | AuthenticationControllerIsSignedInAction; diff --git a/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.ts b/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.ts index 2ad09b02b11..238b4a84bd2 100644 --- a/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.ts +++ b/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.ts @@ -18,6 +18,7 @@ import { createSnapAllPublicKeysRequest, createSnapSignMessageRequest, } from './auth-snap-requests'; +import { AuthenticationControllerMethodActions } from './AuthenticationController-method-action-types'; import type { LoginResponse, SRPInterface, @@ -92,31 +93,14 @@ const MESSENGER_EXPOSED_METHODS = [ 'isSignedIn', ] as const; -// Messenger Actions -type CreateActionsObj = { - [K in Controller]: { - type: `${typeof controllerName}:${K}`; - handler: AuthenticationController[K]; - }; -}; -type ActionsObj = CreateActionsObj<(typeof MESSENGER_EXPOSED_METHODS)[number]>; export type Actions = - | ActionsObj[keyof ActionsObj] - | AuthenticationControllerGetStateAction; + | AuthenticationControllerGetStateAction + | AuthenticationControllerMethodActions; + export type AuthenticationControllerGetStateAction = ControllerGetStateAction< typeof controllerName, AuthenticationControllerState >; -export type AuthenticationControllerPerformSignIn = ActionsObj['performSignIn']; -export type AuthenticationControllerPerformSignOut = - ActionsObj['performSignOut']; -export type AuthenticationControllerGetBearerToken = - ActionsObj['getBearerToken']; -export type AuthenticationControllerGetSessionProfile = - ActionsObj['getSessionProfile']; -export type AuthenticationControllerGetUserProfileLineage = - ActionsObj['getUserProfileLineage']; -export type AuthenticationControllerIsSignedIn = ActionsObj['isSignedIn']; export type AuthenticationControllerStateChangeEvent = ControllerStateChangeEvent< @@ -142,7 +126,7 @@ export type AuthenticationControllerMessenger = Messenger< * Controller that enables authentication for restricted endpoints. * Used for Backup & Sync, Notifications, and other services. */ -export default class AuthenticationController extends BaseController< +export class AuthenticationController extends BaseController< typeof controllerName, AuthenticationControllerState, AuthenticationControllerMessenger diff --git a/packages/profile-sync-controller/src/controllers/authentication/index.ts b/packages/profile-sync-controller/src/controllers/authentication/index.ts index c3d62950a41..680066e11ae 100644 --- a/packages/profile-sync-controller/src/controllers/authentication/index.ts +++ b/packages/profile-sync-controller/src/controllers/authentication/index.ts @@ -1,7 +1,16 @@ -import Controller from './AuthenticationController'; +import { AuthenticationController } from './AuthenticationController'; -const AuthenticationController = Controller; -export { Controller }; +export { AuthenticationController as Controller }; export default AuthenticationController; export * from './AuthenticationController'; export * as Mocks from './mocks'; + +export type { + AuthenticationControllerPerformSignInAction, + AuthenticationControllerPerformSignOutAction, + AuthenticationControllerGetBearerTokenAction, + AuthenticationControllerGetSessionProfileAction, + AuthenticationControllerGetUserProfileLineageAction, + AuthenticationControllerIsSignedInAction, + AuthenticationControllerMethodActions, +} from './AuthenticationController-method-action-types'; diff --git a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController-method-action-types.ts b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController-method-action-types.ts new file mode 100644 index 00000000000..46977986548 --- /dev/null +++ b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController-method-action-types.ts @@ -0,0 +1,162 @@ +/** + * This file is auto generated by `scripts/generate-method-action-types.ts`. + * Do not edit manually. + */ + +import type { UserStorageController } from './UserStorageController'; + +/** + * Allows retrieval of stored data. Data stored is string formatted. + * Developers can extend the entry path and entry name through the `schema.ts` file. + * + * @param path - string in the form of `${feature}.${key}` that matches schema + * @param entropySourceId - The entropy source ID used to generate the encryption key. + * @returns the decrypted string contents found from user storage (or null if not found) + */ +export type UserStorageControllerPerformGetStorageAction = { + type: `UserStorageController:performGetStorage`; + handler: UserStorageController['performGetStorage']; +}; + +/** + * Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings. + * Developers can extend the entry path through the `schema.ts` file. + * + * @param path - string in the form of `${feature}` that matches schema + * @param entropySourceId - The entropy source ID used to generate the encryption key. + * @returns the array of decrypted string contents found from user storage (or null if not found) + */ +export type UserStorageControllerPerformGetStorageAllFeatureEntriesAction = { + type: `UserStorageController:performGetStorageAllFeatureEntries`; + handler: UserStorageController['performGetStorageAllFeatureEntries']; +}; + +/** + * Allows storage of user data. Data stored must be string formatted. + * Developers can extend the entry path and entry name through the `schema.ts` file. + * + * @param path - string in the form of `${feature}.${key}` that matches schema + * @param value - The string data you want to store. + * @param entropySourceId - The entropy source ID used to generate the encryption key. + * @returns nothing. NOTE that an error is thrown if fails to store data. + */ +export type UserStorageControllerPerformSetStorageAction = { + type: `UserStorageController:performSetStorage`; + handler: UserStorageController['performSetStorage']; +}; + +/** + * Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted. + * Developers can extend the entry path through the `schema.ts` file. + * + * @param path - string in the form of `${feature}` that matches schema + * @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs + * @param entropySourceId - The entropy source ID used to generate the encryption key. + * @returns nothing. NOTE that an error is thrown if fails to store data. + */ +export type UserStorageControllerPerformBatchSetStorageAction = { + type: `UserStorageController:performBatchSetStorage`; + handler: UserStorageController['performBatchSetStorage']; +}; + +/** + * Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file. + * + * @param path - string in the form of `${feature}.${key}` that matches schema + * @param entropySourceId - The entropy source ID used to generate the encryption key. + * @returns nothing. NOTE that an error is thrown if fails to delete data. + */ +export type UserStorageControllerPerformDeleteStorageAction = { + type: `UserStorageController:performDeleteStorage`; + handler: UserStorageController['performDeleteStorage']; +}; + +/** + * Allows deletion of all user data entries for a specific feature. + * Developers can extend the entry path through the `schema.ts` file. + * + * @param path - string in the form of `${feature}` that matches schema + * @param entropySourceId - The entropy source ID used to generate the encryption key. + * @returns nothing. NOTE that an error is thrown if fails to delete data. + */ +export type UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction = { + type: `UserStorageController:performDeleteStorageAllFeatureEntries`; + handler: UserStorageController['performDeleteStorageAllFeatureEntries']; +}; + +/** + * Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted. + * Developers can extend the entry path through the `schema.ts` file. + * + * @param path - string in the form of `${feature}` that matches schema + * @param values - data to store, in the form of an array of entryKey[] + * @param entropySourceId - The entropy source ID used to generate the encryption key. + * @returns nothing. NOTE that an error is thrown if fails to store data. + */ +export type UserStorageControllerPerformBatchDeleteStorageAction = { + type: `UserStorageController:performBatchDeleteStorage`; + handler: UserStorageController['performBatchDeleteStorage']; +}; + +/** + * Retrieves the storage key, for internal use only! + * + * @returns the storage key + */ +export type UserStorageControllerGetStorageKeyAction = { + type: `UserStorageController:getStorageKey`; + handler: UserStorageController['getStorageKey']; +}; + +/** + * Lists all the available HD keyring metadata IDs. + * These IDs can be used in a multi-SRP context to segregate data specific to different SRPs. + * + * @returns A promise that resolves to an array of HD keyring metadata IDs. + */ +export type UserStorageControllerListEntropySourcesAction = { + type: `UserStorageController:listEntropySources`; + handler: UserStorageController['listEntropySources']; +}; + +export type UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction = { + type: `UserStorageController:setIsBackupAndSyncFeatureEnabled`; + handler: UserStorageController['setIsBackupAndSyncFeatureEnabled']; +}; + +/** + * Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization + * + * @param isContactSyncingInProgress - Whether contact syncing is in progress + */ +export type UserStorageControllerSetIsContactSyncingInProgressAction = { + type: `UserStorageController:setIsContactSyncingInProgress`; + handler: UserStorageController['setIsContactSyncingInProgress']; +}; + +/** + * Syncs the address book list with the user storage address book list. + * This method is used to make sure that the address book list is up-to-date with the user storage address book list and vice-versa. + * It will add new contacts to the address book list, update/merge conflicting contacts and re-upload the results in some cases to the user storage. + */ +export type UserStorageControllerSyncContactsWithUserStorageAction = { + type: `UserStorageController:syncContactsWithUserStorage`; + handler: UserStorageController['syncContactsWithUserStorage']; +}; + +/** + * Union of all UserStorageController action types. + */ +export type UserStorageControllerMethodActions = + | UserStorageControllerPerformGetStorageAction + | UserStorageControllerPerformGetStorageAllFeatureEntriesAction + | UserStorageControllerPerformSetStorageAction + | UserStorageControllerPerformBatchSetStorageAction + | UserStorageControllerPerformDeleteStorageAction + | UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction + | UserStorageControllerPerformBatchDeleteStorageAction + | UserStorageControllerGetStorageKeyAction + | UserStorageControllerListEntropySourcesAction + | UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction + | UserStorageControllerSetIsContactSyncingInProgressAction + | UserStorageControllerSyncContactsWithUserStorageAction; diff --git a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts index 70836a5d4eb..97b4c6991c1 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts @@ -29,6 +29,7 @@ import type { HandleSnapRequest } from '@metamask/snaps-controllers'; import { BACKUPANDSYNC_FEATURES } from './constants'; import { syncContactsWithUserStorage } from './contact-syncing/controller-integration'; import { setupContactSyncingSubscriptions } from './contact-syncing/setup-subscriptions'; +import { UserStorageControllerMethodActions } from './UserStorageController-method-action-types'; import type { UserStorageGenericFeatureKey, UserStorageGenericPathWithFeatureAndKey, @@ -39,11 +40,11 @@ import type { NativeScrypt } from '../../shared/types/encryption'; import { EventQueue } from '../../shared/utils/event-queue'; import { createSnapSignMessageRequest } from '../authentication/auth-snap-requests'; import type { - AuthenticationControllerGetBearerToken, - AuthenticationControllerGetSessionProfile, - AuthenticationControllerIsSignedIn, - AuthenticationControllerPerformSignIn, -} from '../authentication/AuthenticationController'; + AuthenticationControllerGetBearerTokenAction, + AuthenticationControllerGetSessionProfileAction, + AuthenticationControllerIsSignedInAction, + AuthenticationControllerPerformSignInAction, +} from '../authentication/AuthenticationController-method-action-types'; const controllerName = 'UserStorageController'; @@ -154,44 +155,13 @@ const MESSENGER_EXPOSED_METHODS = [ 'syncContactsWithUserStorage', ] as const; -// Messenger Actions -type CreateActionsObj = { - [K in Controller]: { - type: `${typeof controllerName}:${K}`; - handler: UserStorageController[K]; - }; -}; -type ActionsObj = CreateActionsObj<(typeof MESSENGER_EXPOSED_METHODS)[number]>; export type UserStorageControllerGetStateAction = ControllerGetStateAction< typeof controllerName, UserStorageControllerState >; export type Actions = - | ActionsObj[keyof ActionsObj] - | UserStorageControllerGetStateAction; -export type UserStorageControllerPerformGetStorage = - ActionsObj['performGetStorage']; -export type UserStorageControllerPerformGetStorageAllFeatureEntries = - ActionsObj['performGetStorageAllFeatureEntries']; -export type UserStorageControllerPerformSetStorage = - ActionsObj['performSetStorage']; -export type UserStorageControllerPerformBatchSetStorage = - ActionsObj['performBatchSetStorage']; -export type UserStorageControllerPerformDeleteStorage = - ActionsObj['performDeleteStorage']; -export type UserStorageControllerPerformBatchDeleteStorage = - ActionsObj['performBatchDeleteStorage']; -export type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey']; -export type UserStorageControllerPerformDeleteStorageAllFeatureEntries = - ActionsObj['performDeleteStorageAllFeatureEntries']; -export type UserStorageControllerListEntropySources = - ActionsObj['listEntropySources']; -export type UserStorageControllerSetIsBackupAndSyncFeatureEnabled = - ActionsObj['setIsBackupAndSyncFeatureEnabled']; -export type UserStorageControllerSetIsContactSyncingInProgress = - ActionsObj['setIsContactSyncingInProgress']; -export type UserStorageControllerSyncContactsWithUserStorage = - ActionsObj['syncContactsWithUserStorage']; + | UserStorageControllerGetStateAction + | UserStorageControllerMethodActions; export type AllowedActions = // Keyring Requests @@ -199,10 +169,10 @@ export type AllowedActions = // Snap Requests | HandleSnapRequest // Auth Requests - | AuthenticationControllerGetBearerToken - | AuthenticationControllerGetSessionProfile - | AuthenticationControllerPerformSignIn - | AuthenticationControllerIsSignedIn + | AuthenticationControllerGetBearerTokenAction + | AuthenticationControllerGetSessionProfileAction + | AuthenticationControllerPerformSignInAction + | AuthenticationControllerIsSignedInAction // Contact Syncing | AddressBookControllerListAction | AddressBookControllerSetAction @@ -239,7 +209,7 @@ export type UserStorageControllerMessenger = Messenger< * - data stored on UserStorage is FULLY encrypted, with the only keys stored/managed on the client. * - No one can access this data unless they are have the SRP and are able to run the signing snap. */ -export default class UserStorageController extends BaseController< +export class UserStorageController extends BaseController< typeof controllerName, UserStorageControllerState, UserStorageControllerMessenger diff --git a/packages/profile-sync-controller/src/controllers/user-storage/index.ts b/packages/profile-sync-controller/src/controllers/user-storage/index.ts index 732a6aad660..4801d5bb470 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/index.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/index.ts @@ -1,10 +1,24 @@ -import Controller from './UserStorageController'; +import { UserStorageController } from './UserStorageController'; -const UserStorageController = Controller; -export { Controller }; +export { UserStorageController as Controller }; export default UserStorageController; export * from './UserStorageController'; export * as Mocks from './mocks'; export * from './constants'; export * from '../../shared/encryption'; export * from '../../shared/storage-schema'; +export type { + UserStorageControllerPerformGetStorageAction, + UserStorageControllerPerformGetStorageAllFeatureEntriesAction, + UserStorageControllerPerformSetStorageAction, + UserStorageControllerPerformBatchSetStorageAction, + UserStorageControllerPerformDeleteStorageAction, + UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction, + UserStorageControllerPerformBatchDeleteStorageAction, + UserStorageControllerGetStorageKeyAction, + UserStorageControllerListEntropySourcesAction, + UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction, + UserStorageControllerSetIsContactSyncingInProgressAction, + UserStorageControllerSyncContactsWithUserStorageAction, + UserStorageControllerMethodActions, +} from './UserStorageController-method-action-types'; diff --git a/yarn.lock b/yarn.lock index c7627809aa9..dbae3d53334 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4523,6 +4523,7 @@ __metadata: nock: "npm:^13.3.1" siwe: "npm:^2.3.2" ts-jest: "npm:^29.2.5" + tsx: "npm:^4.20.5" typedoc: "npm:^0.25.13" typedoc-plugin-missing-exports: "npm:^2.0.0" typescript: "npm:~5.3.3" From bb9f0fd740282f948f1a78cb95ac94ac00a6891e Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Thu, 19 Feb 2026 16:12:02 +0100 Subject: [PATCH 09/27] revert typo --- packages/assets-controller/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/assets-controller/src/index.ts b/packages/assets-controller/src/index.ts index cd6e2505fdc..a25a2971355 100644 --- a/packages/assets-controller/src/index.ts +++ b/packages/assets-controller/src/index.ts @@ -30,7 +30,7 @@ export type { AssetsControllerHideAssetAction, AssetsControllerUnhideAssetAction, AssetsControllerMethodActions, -} from './AssetsController-'; +} from './AssetsController-method-action-types'; // Core types export type { From d746685dc7f699447679110f6dd66d31f96918a6 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Thu, 19 Feb 2026 16:17:44 +0100 Subject: [PATCH 10/27] fix import --- .../src/controllers/user-storage/contact-syncing/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/profile-sync-controller/src/controllers/user-storage/contact-syncing/types.ts b/packages/profile-sync-controller/src/controllers/user-storage/contact-syncing/types.ts index 4e60940d0f0..496db060f2a 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/contact-syncing/types.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/contact-syncing/types.ts @@ -6,7 +6,7 @@ import type { USER_STORAGE_VERSION, } from './constants'; import type { UserStorageControllerMessenger } from '../UserStorageController'; -import type UserStorageController from '../UserStorageController'; +import type { UserStorageController } from '../UserStorageController'; export type UserStorageContactEntry = { /** From 1c148402095cae2a1dfd03dad18fc3251ad7a9de Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Thu, 19 Feb 2026 16:30:29 +0100 Subject: [PATCH 11/27] fix action name usage --- packages/assets-controllers/src/TokenBalancesController.ts | 2 +- packages/assets-controllers/src/TokenDetectionController.ts | 2 +- packages/claims-controller/src/ClaimsService.ts | 2 +- packages/core-backend/src/BackendWebSocketService.ts | 2 +- .../NotificationServicesController.test.ts | 2 +- .../NotificationServicesController.ts | 2 +- .../NotificationServicesPushController.test.ts | 6 +++--- .../NotificationServicesPushController.ts | 2 +- .../profile-metrics-controller/src/ProfileMetricsService.ts | 2 +- .../subscription-controller/src/SubscriptionController.ts | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/assets-controllers/src/TokenBalancesController.ts b/packages/assets-controllers/src/TokenBalancesController.ts index 2ac7fcc38b1..2c8f0e91a43 100644 --- a/packages/assets-controllers/src/TokenBalancesController.ts +++ b/packages/assets-controllers/src/TokenBalancesController.ts @@ -151,7 +151,7 @@ export type AllowedActions = | AccountTrackerUpdateNativeBalancesAction | AccountTrackerUpdateStakedBalancesAction | KeyringControllerGetStateAction - | AuthenticationController.AuthenticationControllerGetBearerToken; + | AuthenticationController.AuthenticationControllerGetBearerTokenAction; export type AllowedEvents = | TokensControllerStateChangeEvent diff --git a/packages/assets-controllers/src/TokenDetectionController.ts b/packages/assets-controllers/src/TokenDetectionController.ts index 464ed175d23..d3c2f312806 100644 --- a/packages/assets-controllers/src/TokenDetectionController.ts +++ b/packages/assets-controllers/src/TokenDetectionController.ts @@ -152,7 +152,7 @@ export type AllowedActions = | TokensControllerAddDetectedTokensAction | TokensControllerAddTokensAction | NetworkControllerFindNetworkClientIdByChainIdAction - | AuthenticationController.AuthenticationControllerGetBearerToken; + | AuthenticationController.AuthenticationControllerGetBearerTokenAction; export type TokenDetectionControllerStateChangeEvent = ControllerStateChangeEvent; diff --git a/packages/claims-controller/src/ClaimsService.ts b/packages/claims-controller/src/ClaimsService.ts index 1e54c596c44..8e09a1a50a0 100644 --- a/packages/claims-controller/src/ClaimsService.ts +++ b/packages/claims-controller/src/ClaimsService.ts @@ -55,7 +55,7 @@ export type ClaimsServiceActions = | ClaimsServiceGenerateMessageForClaimSignatureAction; export type AllowedActions = - AuthenticationController.AuthenticationControllerGetBearerToken; + AuthenticationController.AuthenticationControllerGetBearerTokenAction; export type ClaimsServiceEvents = never; diff --git a/packages/core-backend/src/BackendWebSocketService.ts b/packages/core-backend/src/BackendWebSocketService.ts index 59e2d4efb8d..d8ca9139d5d 100644 --- a/packages/core-backend/src/BackendWebSocketService.ts +++ b/packages/core-backend/src/BackendWebSocketService.ts @@ -237,7 +237,7 @@ export type BackendWebSocketServiceActions = BackendWebSocketServiceMethodActions; type AllowedActions = - AuthenticationController.AuthenticationControllerGetBearerToken; + AuthenticationController.AuthenticationControllerGetBearerTokenAction; // Event types for WebSocket connection state changes export type BackendWebSocketServiceConnectionStateChangedEvent = { diff --git a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts index e8a9252ee87..c09a7f953af 100644 --- a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts +++ b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts @@ -1591,7 +1591,7 @@ function mockNotificationMessenger(): { }); const mockGetBearerToken = - typedMockAction().mockResolvedValue( + typedMockAction().mockResolvedValue( AuthenticationController.Mocks.MOCK_OATH_TOKEN_RESPONSE.access_token, ); diff --git a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts index 1d75602191d..f6a2be2f4a4 100644 --- a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts +++ b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts @@ -228,7 +228,7 @@ type AllowedActions = // Keyring Controller Requests | KeyringControllerGetStateAction // Auth Controller Requests - | AuthenticationController.AuthenticationControllerGetBearerToken + | AuthenticationController.AuthenticationControllerGetBearerTokenAction | AuthenticationController.AuthenticationControllerIsSignedIn | AuthenticationController.AuthenticationControllerPerformSignIn // Push Notifications Controller Requests diff --git a/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.test.ts b/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.test.ts index 394aec2973f..f0d726f2630 100644 --- a/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.test.ts +++ b/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.test.ts @@ -414,14 +414,14 @@ function mockAuthBearerTokenCall( messenger: NotificationServicesPushControllerMessenger, ): jest.Mock< ReturnType< - AuthenticationController.AuthenticationControllerGetBearerToken['handler'] + AuthenticationController.AuthenticationControllerGetBearerTokenAction['handler'] >, Parameters< - AuthenticationController.AuthenticationControllerGetBearerToken['handler'] + AuthenticationController.AuthenticationControllerGetBearerTokenAction['handler'] > > { type Fn = - AuthenticationController.AuthenticationControllerGetBearerToken['handler']; + AuthenticationController.AuthenticationControllerGetBearerTokenAction['handler']; const mockAuthGetBearerToken = jest .fn, Parameters>() .mockResolvedValue(MOCK_JWT); diff --git a/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.ts b/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.ts index 285f3800058..164a46283ac 100644 --- a/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.ts +++ b/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.ts @@ -57,7 +57,7 @@ export type Actions = | NotificationServicesPushControllerSubscribeToNotificationsAction; type AllowedActions = - AuthenticationController.AuthenticationControllerGetBearerToken; + AuthenticationController.AuthenticationControllerGetBearerTokenAction; export type NotificationServicesPushControllerStateChangeEvent = ControllerStateChangeEvent< diff --git a/packages/profile-metrics-controller/src/ProfileMetricsService.ts b/packages/profile-metrics-controller/src/ProfileMetricsService.ts index de680f73982..af72ee6b341 100644 --- a/packages/profile-metrics-controller/src/ProfileMetricsService.ts +++ b/packages/profile-metrics-controller/src/ProfileMetricsService.ts @@ -48,7 +48,7 @@ export type ProfileMetricsServiceActions = ProfileMetricsServiceMethodActions; * Actions from other messengers that {@link ProfileMetricsService} calls. */ type AllowedActions = - AuthenticationController.AuthenticationControllerGetBearerToken; + AuthenticationController.AuthenticationControllerGetBearerTokenAction; /** * Events that {@link ProfileMetricsService} exposes to other consumers. diff --git a/packages/subscription-controller/src/SubscriptionController.ts b/packages/subscription-controller/src/SubscriptionController.ts index 8ff4ba2693b..ceb513101b6 100644 --- a/packages/subscription-controller/src/SubscriptionController.ts +++ b/packages/subscription-controller/src/SubscriptionController.ts @@ -154,7 +154,7 @@ export type SubscriptionControllerActions = | SubscriptionControllerClearLastSelectedPaymentMethodAction; export type AllowedActions = - | AuthenticationController.AuthenticationControllerGetBearerToken + | AuthenticationController.AuthenticationControllerGetBearerTokenAction | AuthenticationController.AuthenticationControllerPerformSignOut; // Events From beadfa986985eee8103d51a2c2d714e1400e5999 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Fri, 20 Feb 2026 10:50:36 +0100 Subject: [PATCH 12/27] fix lint and exports --- .../controllers/authentication/AuthenticationController.test.ts | 2 +- .../src/controllers/user-storage/UserStorageController.test.ts | 2 +- .../src/controllers/user-storage/UserStorageController.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.test.ts b/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.test.ts index 09fed6861d3..224bbb9c273 100644 --- a/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.test.ts +++ b/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.test.ts @@ -6,7 +6,7 @@ import type { MockAnyNamespace, } from '@metamask/messenger'; -import AuthenticationController from './AuthenticationController'; +import { AuthenticationController } from './AuthenticationController'; import type { AuthenticationControllerMessenger, AuthenticationControllerState, diff --git a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.test.ts b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.test.ts index 01ad34ea1af..8451be8ed21 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.test.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.test.ts @@ -13,7 +13,7 @@ import { } from './__fixtures__/mockServices'; import { BACKUPANDSYNC_FEATURES } from './constants'; import { MOCK_STORAGE_DATA, MOCK_STORAGE_KEY } from './mocks/mockStorage'; -import UserStorageController, { defaultState } from './UserStorageController'; +import { UserStorageController, defaultState } from './UserStorageController'; import { USER_STORAGE_FEATURE_NAMES } from '../../shared/storage-schema'; describe('UserStorageController', () => { diff --git a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts index 97b4c6991c1..4c9e823331d 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts @@ -503,7 +503,7 @@ export class UserStorageController extends BaseController< * * @returns A promise that resolves to an array of HD keyring metadata IDs. */ - async listEntropySources() { + async listEntropySources(): Promise { if (!this.#isUnlocked) { throw new Error( 'listEntropySources - unable to list entropy sources, wallet is locked', From 75962199ecbd287c925209164a931836702b9923 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Fri, 20 Feb 2026 10:52:57 +0100 Subject: [PATCH 13/27] use type only imports --- packages/account-tree-controller/src/types.ts | 2 +- packages/multichain-account-service/src/types.ts | 2 +- .../src/controllers/user-storage/UserStorageController.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/account-tree-controller/src/types.ts b/packages/account-tree-controller/src/types.ts index e571e8bc0a2..46e7a1415d8 100644 --- a/packages/account-tree-controller/src/types.ts +++ b/packages/account-tree-controller/src/types.ts @@ -24,7 +24,7 @@ import type { import type { GetSnap as SnapControllerGetSnap } from '@metamask/snaps-controllers'; import type { controllerName } from './AccountTreeController'; -import { AccountTreeControllerMethodActions } from './AccountTreeController-method-action-types'; +import type { AccountTreeControllerMethodActions } from './AccountTreeController-method-action-types'; import type { BackupAndSyncAnalyticsEventPayload, BackupAndSyncEmitAnalyticsEventParams, diff --git a/packages/multichain-account-service/src/types.ts b/packages/multichain-account-service/src/types.ts index ebb9e13e160..074ccb328b2 100644 --- a/packages/multichain-account-service/src/types.ts +++ b/packages/multichain-account-service/src/types.ts @@ -36,7 +36,7 @@ import type { } from '@metamask/snaps-controllers'; import type { serviceName } from './MultichainAccountService'; -import { MultichainAccountServiceMethodActions } from './MultichainAccountService-method-action-types'; +import type { MultichainAccountServiceMethodActions } from './MultichainAccountService-method-action-types'; /** * All actions that {@link MultichainAccountService} registers so that other * modules can call them. diff --git a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts index 4c9e823331d..7911f8312ab 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts @@ -29,7 +29,7 @@ import type { HandleSnapRequest } from '@metamask/snaps-controllers'; import { BACKUPANDSYNC_FEATURES } from './constants'; import { syncContactsWithUserStorage } from './contact-syncing/controller-integration'; import { setupContactSyncingSubscriptions } from './contact-syncing/setup-subscriptions'; -import { UserStorageControllerMethodActions } from './UserStorageController-method-action-types'; +import type { UserStorageControllerMethodActions } from './UserStorageController-method-action-types'; import type { UserStorageGenericFeatureKey, UserStorageGenericPathWithFeatureAndKey, From 86019939fcb9f9a43089fea1fd43f223d859d587 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Fri, 20 Feb 2026 11:09:08 +0100 Subject: [PATCH 14/27] fix `account-tree-controller` type imports --- packages/account-tree-controller/src/types.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/account-tree-controller/src/types.ts b/packages/account-tree-controller/src/types.ts index 46e7a1415d8..2ca9126d698 100644 --- a/packages/account-tree-controller/src/types.ts +++ b/packages/account-tree-controller/src/types.ts @@ -85,11 +85,11 @@ export type AllowedActions = | KeyringControllerGetStateAction | SnapControllerGetSnap | UserStorageController.UserStorageControllerGetStateAction - | UserStorageController.UserStorageControllerPerformGetStorage - | UserStorageController.UserStorageControllerPerformGetStorageAllFeatureEntries - | UserStorageController.UserStorageControllerPerformSetStorage - | UserStorageController.UserStorageControllerPerformBatchSetStorage - | AuthenticationController.AuthenticationControllerGetSessionProfile + | UserStorageController.UserStorageControllerPerformGetStorageAction + | UserStorageController.UserStorageControllerPerformGetStorageAllFeatureEntriesAction + | UserStorageController.UserStorageControllerPerformSetStorageAction + | UserStorageController.UserStorageControllerPerformBatchSetStorageAction + | AuthenticationController.AuthenticationControllerGetSessionProfileAction | MultichainAccountServiceCreateMultichainAccountGroupAction; export type AccountTreeControllerActions = From a44156c14b042afa0e44dadd7ed18afec42ed020 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Fri, 20 Feb 2026 11:37:36 +0100 Subject: [PATCH 15/27] fix lint, rename actions in other controllers --- eslint-suppressions.json | 4 ++-- packages/bridge-controller/src/types.ts | 4 ++-- packages/bridge-status-controller/src/types.ts | 4 ++-- .../NotificationServicesController.ts | 4 ++-- .../subscription-controller/src/SubscriptionController.ts | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/eslint-suppressions.json b/eslint-suppressions.json index 47eeb2b5bab..699be49291b 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -1415,7 +1415,7 @@ }, "packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts": { "@typescript-eslint/explicit-function-return-type": { - "count": 13 + "count": 12 }, "id-length": { "count": 1 @@ -1863,4 +1863,4 @@ "count": 1 } } -} +} \ No newline at end of file diff --git a/packages/bridge-controller/src/types.ts b/packages/bridge-controller/src/types.ts index 8a215683fb1..41217d8578c 100644 --- a/packages/bridge-controller/src/types.ts +++ b/packages/bridge-controller/src/types.ts @@ -13,7 +13,7 @@ import type { NetworkControllerFindNetworkClientIdByChainIdAction, NetworkControllerGetNetworkClientByIdAction, } from '@metamask/network-controller'; -import type { AuthenticationControllerGetBearerToken } from '@metamask/profile-sync-controller/auth'; +import type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth'; import type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller'; import type { HandleSnapRequest } from '@metamask/snaps-controllers'; import type { Infer } from '@metamask/superstruct'; @@ -393,7 +393,7 @@ export type BridgeControllerEvents = BridgeControllerStateChangeEvent; export type AllowedActions = | AccountsControllerGetAccountByAddressAction - | AuthenticationControllerGetBearerToken + | AuthenticationControllerGetBearerTokenAction | GetCurrencyRateState | TokenRatesControllerGetStateAction | MultichainAssetsRatesControllerGetStateAction diff --git a/packages/bridge-status-controller/src/types.ts b/packages/bridge-status-controller/src/types.ts index 66f3cb6464c..12d4688e4c5 100644 --- a/packages/bridge-status-controller/src/types.ts +++ b/packages/bridge-status-controller/src/types.ts @@ -20,7 +20,7 @@ import type { NetworkControllerGetNetworkClientByIdAction, NetworkControllerGetStateAction, } from '@metamask/network-controller'; -import type { AuthenticationControllerGetBearerToken } from '@metamask/profile-sync-controller/auth'; +import type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth'; import type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller'; import type { HandleSnapRequest } from '@metamask/snaps-controllers'; import type { Infer } from '@metamask/superstruct'; @@ -304,7 +304,7 @@ type AllowedActions = | GetGasFeeState | AccountsControllerGetAccountByAddressAction | RemoteFeatureFlagControllerGetStateAction - | AuthenticationControllerGetBearerToken; + | AuthenticationControllerGetBearerTokenAction; /** * The external events available to the BridgeStatusController. diff --git a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts index f6a2be2f4a4..957ff38a450 100644 --- a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts +++ b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts @@ -229,8 +229,8 @@ type AllowedActions = | KeyringControllerGetStateAction // Auth Controller Requests | AuthenticationController.AuthenticationControllerGetBearerTokenAction - | AuthenticationController.AuthenticationControllerIsSignedIn - | AuthenticationController.AuthenticationControllerPerformSignIn + | AuthenticationController.AuthenticationControllerIsSignedInAction + | AuthenticationController.AuthenticationControllerPerformSignInAction // Push Notifications Controller Requests | NotificationServicesPushControllerEnablePushNotificationsAction | NotificationServicesPushControllerDisablePushNotificationsAction diff --git a/packages/subscription-controller/src/SubscriptionController.ts b/packages/subscription-controller/src/SubscriptionController.ts index ceb513101b6..e640a5005dc 100644 --- a/packages/subscription-controller/src/SubscriptionController.ts +++ b/packages/subscription-controller/src/SubscriptionController.ts @@ -155,7 +155,7 @@ export type SubscriptionControllerActions = export type AllowedActions = | AuthenticationController.AuthenticationControllerGetBearerTokenAction - | AuthenticationController.AuthenticationControllerPerformSignOut; + | AuthenticationController.AuthenticationControllerPerformSignOutAction; // Events export type SubscriptionControllerStateChangeEvent = ControllerStateChangeEvent< From f4be97273f03e5dcb001faf7513ada6d5b8a1f5c Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Fri, 20 Feb 2026 11:44:01 +0100 Subject: [PATCH 16/27] fill coverage in `AccountsController` --- .../src/AccountsController.test.ts | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/packages/accounts-controller/src/AccountsController.test.ts b/packages/accounts-controller/src/AccountsController.test.ts index bbf550cfea9..9ccfe9636b2 100644 --- a/packages/accounts-controller/src/AccountsController.test.ts +++ b/packages/accounts-controller/src/AccountsController.test.ts @@ -2893,6 +2893,24 @@ describe('AccountsController', () => { EMPTY_ACCOUNT, ); }); + + it('throws an error if the selected account ID does not exist in the accounts list', () => { + const { accountsController } = setupAccountsController({ + initialState: { + internalAccounts: { + accounts: { + [mockOlderEvmAccount.id]: mockOlderEvmAccount, + [mockNewerEvmAccount.id]: mockNewerEvmAccount, + }, + selectedAccount: 'non-existent-account-id', + }, + }, + }); + + expect(() => accountsController.getSelectedAccount()).toThrow( + 'Account Id "non-existent-account-id" not found', + ); + }); }); describe('getSelectedMultichainAccount', () => { @@ -2980,6 +2998,25 @@ describe('AccountsController', () => { EMPTY_ACCOUNT, ); }); + + it('throws an error if the selected account ID does not exist in the accounts list', () => { + const { accountsController } = setupAccountsController({ + initialState: { + internalAccounts: { + accounts: { + [mockOlderEvmAccount.id]: mockOlderEvmAccount, + [mockNewerEvmAccount.id]: mockNewerEvmAccount, + [mockBtcAccount.id]: mockBtcAccount, + }, + selectedAccount: 'non-existent-account-id', + }, + }, + }); + + expect(() => accountsController.getSelectedMultichainAccount()).toThrow( + 'Account Id "non-existent-account-id" not found', + ); + }); }); describe('listAccounts', () => { @@ -3147,6 +3184,24 @@ describe('AccountsController', () => { ).toStrictEqual(mockAccount2.id); }); + it('throws an error if the account ID does not exist in the accounts list', () => { + const { accountsController } = setupAccountsController({ + initialState: { + internalAccounts: { + accounts: { + [mockAccount.id]: mockAccount, + [mockAccount2.id]: mockAccount2, + }, + selectedAccount: 'non-existent-account-id', + }, + }, + }); + + expect(() => + accountsController.setSelectedAccount('non-existent-account-id'), + ).toThrow('Account Id "non-existent-account-id" not found'); + }); + it('does not emit setSelectedEvmAccountChange if the account is non-EVM', () => { const mockNonEvmAccount = createMockInternalAccount({ id: 'mock-non-evm', From 82db2cbf70c10fb75b251ce224ce81a4594c39f4 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Fri, 20 Feb 2026 12:09:28 +0100 Subject: [PATCH 17/27] update CHANGELOGs --- packages/account-tree-controller/CHANGELOG.md | 5 +++++ packages/accounts-controller/CHANGELOG.md | 7 +++++++ packages/assets-controllers/CHANGELOG.md | 1 + packages/claims-controller/CHANGELOG.md | 4 ++++ packages/multichain-account-service/CHANGELOG.md | 4 ++++ packages/notification-services-controller/CHANGELOG.md | 1 + packages/profile-metrics-controller/CHANGELOG.md | 1 + packages/profile-sync-controller/CHANGELOG.md | 7 +++++++ packages/subscription-controller/CHANGELOG.md | 1 + 9 files changed, 31 insertions(+) diff --git a/packages/account-tree-controller/CHANGELOG.md b/packages/account-tree-controller/CHANGELOG.md index 91b01bf7ac3..886809004f4 100644 --- a/packages/account-tree-controller/CHANGELOG.md +++ b/packages/account-tree-controller/CHANGELOG.md @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Refactor the controller's messenger action registration ([#7976](https://github.com/MetaMask/core/pull/7976/)) + - The controller's methods are now exposed to the messenger through `registerMethodActionHandlers` and `MESSENGER_EXPOSED_METHODS`. + - The action types are now generated using `generate-method-action-types`. + - Exposes the missing public methods in the messenger. +- Update `UserStorageController` and `AuthenticationController` actions to their new names ([#7976](https://github.com/MetaMask/core/pull/7976)) - Bump `@metamask/accounts-controller` from `^36.0.0` to `^36.0.1` ([#7996](https://github.com/MetaMask/core/pull/7996)) ## [4.1.1] diff --git a/packages/accounts-controller/CHANGELOG.md b/packages/accounts-controller/CHANGELOG.md index 38ed18b4c91..e38b0b4ddf6 100644 --- a/packages/accounts-controller/CHANGELOG.md +++ b/packages/accounts-controller/CHANGELOG.md @@ -11,6 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Mark `AccountsController`, all of its public methods, and all exported types as deprecated in favor of `AccountTreeController`, `MultichainAccountService`, and Keyring API v2 ([#8027](https://github.com/MetaMask/core/pull/8027)) +### Changed + +- Refactor the controller's messenger action registration ([#7976](https://github.com/MetaMask/core/pull/7976/)) + - The controller's methods are now exposed to the messenger through `registerMethodActionHandlers` and `MESSENGER_EXPOSED_METHODS`. + - The action types are now generated using `generate-method-action-types`. + - Exposes the missing public methods in the messenger. + ## [36.0.1] ### Changed diff --git a/packages/assets-controllers/CHANGELOG.md b/packages/assets-controllers/CHANGELOG.md index 557117ffe2f..203fcc2d8c7 100644 --- a/packages/assets-controllers/CHANGELOG.md +++ b/packages/assets-controllers/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Update `AuthenticationController` actions to their new names ([#7976](https://github.com/MetaMask/core/pull/7976)) - Bump `@metamask/transaction-controller` from `^62.17.1` to `^62.18.0` ([#8005](https://github.com/MetaMask/core/pull/8005)) ### Fixed diff --git a/packages/claims-controller/CHANGELOG.md b/packages/claims-controller/CHANGELOG.md index 4282ca2ab8c..c15c9c99317 100644 --- a/packages/claims-controller/CHANGELOG.md +++ b/packages/claims-controller/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Update `AuthenticationController` action to its new name ([#7976](https://github.com/MetaMask/core/pull/7976)) + +### Changed + - Bump `@metamask/profile-sync-controller` from `^27.0.0` to `^27.1.0` ([#7849](https://github.com/MetaMask/core/pull/7849)) - Bump `@metamask/controller-utils` from `^11.18.0` to `^11.19.0` ([#7995](https://github.com/MetaMask/core/pull/7995)) diff --git a/packages/multichain-account-service/CHANGELOG.md b/packages/multichain-account-service/CHANGELOG.md index 2c5ceee4713..c4058ba342d 100644 --- a/packages/multichain-account-service/CHANGELOG.md +++ b/packages/multichain-account-service/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Refactor the controller's messenger action registration ([#7976](https://github.com/MetaMask/core/pull/7976/)) + - The controller's methods are now exposed to the messenger through `registerMethodActionHandlers` and `MESSENGER_EXPOSED_METHODS`. + - The action types are now generated using `generate-method-action-types`. + - Exposes the missing public methods in the messenger. - Bump `@metamask/accounts-controller` from `^36.0.0` to `^36.0.1` ([#7996](https://github.com/MetaMask/core/pull/7996)) ## [7.0.0] diff --git a/packages/notification-services-controller/CHANGELOG.md b/packages/notification-services-controller/CHANGELOG.md index bf5750cbca9..c1c851444b2 100644 --- a/packages/notification-services-controller/CHANGELOG.md +++ b/packages/notification-services-controller/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Debounce `KeyringController:stateChange` handler to reduce redundant notification subscription calls during rapid account syncing ([#7980](https://github.com/MetaMask/core/pull/7980)) - Filter out Product Account announcements notifications older than 3 months ([#7884](https://github.com/MetaMask/core/pull/7884)) - Bump `@metamask/controller-utils` from `^11.18.0` to `^11.19.0` ([#7995](https://github.com/MetaMask/core/pull/7995)) +- Update `AuthenticationController` actions to their new names ([#7976](https://github.com/MetaMask/core/pull/7976)) ## [22.0.0] diff --git a/packages/profile-metrics-controller/CHANGELOG.md b/packages/profile-metrics-controller/CHANGELOG.md index edcb4b6c406..7390d3a28e3 100644 --- a/packages/profile-metrics-controller/CHANGELOG.md +++ b/packages/profile-metrics-controller/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Update `AuthenticationController` action to its new name ([#7976](https://github.com/MetaMask/core/pull/7976)) - Bump `@metamask/accounts-controller` from `^36.0.0` to `^36.0.1` ([#7996](https://github.com/MetaMask/core/pull/7996)) - Bump `@metamask/polling-controller` from `^16.0.2` to `^16.0.3` ([#7996](https://github.com/MetaMask/core/pull/7996)) - Bump `@metamask/transaction-controller` from `^62.17.0` to `^62.18.0` ([#7996](https://github.com/MetaMask/core/pull/7996), [#8005](https://github.com/MetaMask/core/pull/8005)) diff --git a/packages/profile-sync-controller/CHANGELOG.md b/packages/profile-sync-controller/CHANGELOG.md index 113b8877da1..fc7ee61ca40 100644 --- a/packages/profile-sync-controller/CHANGELOG.md +++ b/packages/profile-sync-controller/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- **BREAKING:** Refactor the controller's messenger action registration ([#7976](https://github.com/MetaMask/core/pull/7976/)) + - The controller's methods are now exposed to the messenger through `registerMethodActionHandlers` and `MESSENGER_EXPOSED_METHODS`. + - The action types are now generated using `generate-method-action-types`. + - Exposes the missing public methods in the messenger. + ## [27.1.0] ### Changed diff --git a/packages/subscription-controller/CHANGELOG.md b/packages/subscription-controller/CHANGELOG.md index 8399c6086b7..3a7e0caba8d 100644 --- a/packages/subscription-controller/CHANGELOG.md +++ b/packages/subscription-controller/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Bump `@metamask/transaction-controller` from `^62.16.0` to `^62.18.0` ([#7897](https://github.com/MetaMask/core/pull/7897), [#7996](https://github.com/MetaMask/core/pull/7996), [#8005](https://github.com/MetaMask/core/pull/8005)) - Bump `@metamask/polling-controller` from `^16.0.2` to `^16.0.3` ([#7996](https://github.com/MetaMask/core/pull/7996)) - Bump `@metamask/controller-utils` from `^11.18.0` to `^11.19.0` ([#7995](https://github.com/MetaMask/core/pull/7995)) +- Update `AuthenticationController` actions to their new names ([#7976](https://github.com/MetaMask/core/pull/7976)) ## [6.0.0] From 8d63c0283ba98efe47ebd5cfc9f37c755d20b1d3 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Fri, 20 Feb 2026 12:29:25 +0100 Subject: [PATCH 18/27] fix `eslint-suppressions.json` lint --- eslint-suppressions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint-suppressions.json b/eslint-suppressions.json index 699be49291b..2c57c22256e 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -1863,4 +1863,4 @@ "count": 1 } } -} \ No newline at end of file +} From dda276890b7462ac38a2819407456156a8234e0b Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Fri, 20 Feb 2026 12:31:23 +0100 Subject: [PATCH 19/27] fix `claims-controller` changelog --- packages/claims-controller/CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/claims-controller/CHANGELOG.md b/packages/claims-controller/CHANGELOG.md index c15c9c99317..ec2d0662d8e 100644 --- a/packages/claims-controller/CHANGELOG.md +++ b/packages/claims-controller/CHANGELOG.md @@ -9,12 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Update `AuthenticationController` action to its new name ([#7976](https://github.com/MetaMask/core/pull/7976)) - -### Changed - - Bump `@metamask/profile-sync-controller` from `^27.0.0` to `^27.1.0` ([#7849](https://github.com/MetaMask/core/pull/7849)) - Bump `@metamask/controller-utils` from `^11.18.0` to `^11.19.0` ([#7995](https://github.com/MetaMask/core/pull/7995)) +- Update `AuthenticationController` action to its new name ([#7976](https://github.com/MetaMask/core/pull/7976)) ## [0.4.2] From f6875a0cb8b23794f383a6d5b85333073e1b857e Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Fri, 20 Feb 2026 13:59:39 +0100 Subject: [PATCH 20/27] fix `multichain-account-service` tests --- .../src/MultichainAccountService.test.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/multichain-account-service/src/MultichainAccountService.test.ts b/packages/multichain-account-service/src/MultichainAccountService.test.ts index c452c3c1df4..996f63b30db 100644 --- a/packages/multichain-account-service/src/MultichainAccountService.test.ts +++ b/packages/multichain-account-service/src/MultichainAccountService.test.ts @@ -847,13 +847,14 @@ describe('MultichainAccountService', () => { }); it('resync accounts with MultichainAccountService:resyncAccounts', async () => { - const { messenger, service } = await setup({ + const { messenger, mocks } = await setup({ accounts: [MOCK_HD_ACCOUNT_1], }); - const resyncAccountsSpy = jest.spyOn(service, 'resyncAccounts'); await messenger.call('MultichainAccountService:resyncAccounts'); - expect(resyncAccountsSpy).toHaveBeenCalled(); + + expect(mocks.EvmAccountProvider.resyncAccounts).toHaveBeenCalled(); + expect(mocks.SolAccountProvider.resyncAccounts).toHaveBeenCalled(); }); it('removes a multichain account wallet with MultichainAccountService:removeMultichainAccountWallet', async () => { @@ -873,18 +874,18 @@ describe('MultichainAccountService', () => { }); it('checks for Snap platform readiness with MultichainAccountService:ensureCanUseSnapPlatform', async () => { - const { messenger, service } = await setup({ + const { rootMessenger, service, spies } = await setup({ accounts: [], }); await service.ensureCanUseSnapPlatform(); - const ensureCanUseSnapPlatformSpy = jest.spyOn( - service, - 'ensureCanUseSnapPlatform', + await rootMessenger.call( + 'MultichainAccountService:ensureCanUseSnapPlatform', ); - await messenger.call('MultichainAccountService:ensureCanUseSnapPlatform'); - expect(ensureCanUseSnapPlatformSpy).toHaveBeenCalled(); + expect( + spies.SnapPlatformWatcher.ensureCanUseSnapPlatform, + ).toHaveBeenCalled(); }); }); From 1de02f4bda1aca3f8f5d332af61512058c16880f Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Fri, 20 Feb 2026 14:15:45 +0100 Subject: [PATCH 21/27] remove direct call to method in test --- .../src/MultichainAccountService.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/multichain-account-service/src/MultichainAccountService.test.ts b/packages/multichain-account-service/src/MultichainAccountService.test.ts index 996f63b30db..474c2675bfb 100644 --- a/packages/multichain-account-service/src/MultichainAccountService.test.ts +++ b/packages/multichain-account-service/src/MultichainAccountService.test.ts @@ -874,12 +874,10 @@ describe('MultichainAccountService', () => { }); it('checks for Snap platform readiness with MultichainAccountService:ensureCanUseSnapPlatform', async () => { - const { rootMessenger, service, spies } = await setup({ + const { rootMessenger, spies } = await setup({ accounts: [], }); - await service.ensureCanUseSnapPlatform(); - await rootMessenger.call( 'MultichainAccountService:ensureCanUseSnapPlatform', ); From 0731bd4634d7ecbbb82ac9b1b809634adcfe8cce Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Mon, 23 Feb 2026 12:10:52 +0100 Subject: [PATCH 22/27] Address requested changes - Update CHANGELOGs - Remove non public-facing changes - Make entries clearer - Remove export of `*MethodActions` --- packages/account-tree-controller/CHANGELOG.md | 22 +++++++++++++------ packages/account-tree-controller/src/index.ts | 1 - packages/accounts-controller/CHANGELOG.md | 15 ++++++++----- packages/accounts-controller/src/index.ts | 1 - packages/assets-controllers/CHANGELOG.md | 1 - packages/claims-controller/CHANGELOG.md | 1 - .../multichain-account-service/CHANGELOG.md | 6 ----- .../multichain-account-service/src/index.ts | 1 - .../CHANGELOG.md | 1 - .../profile-metrics-controller/CHANGELOG.md | 1 - packages/profile-sync-controller/CHANGELOG.md | 18 +++++++++++---- .../src/controllers/authentication/index.ts | 1 - .../src/controllers/user-storage/index.ts | 1 - packages/subscription-controller/CHANGELOG.md | 1 - 14 files changed, 39 insertions(+), 32 deletions(-) diff --git a/packages/account-tree-controller/CHANGELOG.md b/packages/account-tree-controller/CHANGELOG.md index 886809004f4..807407934a6 100644 --- a/packages/account-tree-controller/CHANGELOG.md +++ b/packages/account-tree-controller/CHANGELOG.md @@ -7,14 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### Changed +### Added + +- Expose missing public `AccountTreeController` methods through its messenger ([#7976](https://github.com/MetaMask/core/pull/7976/)) + - The following actions are now available: + - `AccountTreeController:getAccountWalletObject` + - `AccountTreeController:getAccountWalletObjects` + - `AccountTreeController:getAccountGroupObject` + - `AccountTreeController:clearState` + - `AccountTreeController:syncWithUserStorage` + - `AccountTreeController:syncWithUserStorageAtLeastOnce` + - Corresponding action types (e.g. `AccountTreeControllerGetAccountWalletObjectAction`) are available as well. + +### Removed -- Refactor the controller's messenger action registration ([#7976](https://github.com/MetaMask/core/pull/7976/)) - - The controller's methods are now exposed to the messenger through `registerMethodActionHandlers` and `MESSENGER_EXPOSED_METHODS`. - - The action types are now generated using `generate-method-action-types`. - - Exposes the missing public methods in the messenger. -- Update `UserStorageController` and `AuthenticationController` actions to their new names ([#7976](https://github.com/MetaMask/core/pull/7976)) -- Bump `@metamask/accounts-controller` from `^36.0.0` to `^36.0.1` ([#7996](https://github.com/MetaMask/core/pull/7996)) +- **BREAKING:** Remove `resolveNameConflict` from `AccountTreeController` ([#7976](https://github.com/MetaMask/core/pull/7976)) + - This method was only used internally. ## [4.1.1] diff --git a/packages/account-tree-controller/src/index.ts b/packages/account-tree-controller/src/index.ts index 9865bf006ab..96df965c0a6 100644 --- a/packages/account-tree-controller/src/index.ts +++ b/packages/account-tree-controller/src/index.ts @@ -33,7 +33,6 @@ export type { AccountTreeControllerClearStateAction, AccountTreeControllerSyncWithUserStorageAction, AccountTreeControllerSyncWithUserStorageAtLeastOnceAction, - AccountTreeControllerMethodActions, } from './AccountTreeController-method-action-types'; export type { AccountContext } from './AccountTreeController'; diff --git a/packages/accounts-controller/CHANGELOG.md b/packages/accounts-controller/CHANGELOG.md index e38b0b4ddf6..9f10a91dcae 100644 --- a/packages/accounts-controller/CHANGELOG.md +++ b/packages/accounts-controller/CHANGELOG.md @@ -11,12 +11,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Mark `AccountsController`, all of its public methods, and all exported types as deprecated in favor of `AccountTreeController`, `MultichainAccountService`, and Keyring API v2 ([#8027](https://github.com/MetaMask/core/pull/8027)) -### Changed +### Added + +- Expose missing public `AccountsController` methods through its messenger ([#7976](https://github.com/MetaMask/core/pull/7976/)) + - The following actions are now available: + - `AccountController:loadBackupAction` + - Corresponding action types (e.g. `AccountControllerLoadBackupAction`) are available as well. + +### Removed -- Refactor the controller's messenger action registration ([#7976](https://github.com/MetaMask/core/pull/7976/)) - - The controller's methods are now exposed to the messenger through `registerMethodActionHandlers` and `MESSENGER_EXPOSED_METHODS`. - - The action types are now generated using `generate-method-action-types`. - - Exposes the missing public methods in the messenger. +- **BREAKING:** Remove `getAccountExpect` from `AccountsController` ([#7976](https://github.com/MetaMask/core/pull/7976)) + - This method was only used internally. ## [36.0.1] diff --git a/packages/accounts-controller/src/index.ts b/packages/accounts-controller/src/index.ts index c07a7dd2cee..cbf415bd443 100644 --- a/packages/accounts-controller/src/index.ts +++ b/packages/accounts-controller/src/index.ts @@ -31,7 +31,6 @@ export type { AccountsControllerUpdateAccountMetadataAction, AccountsControllerUpdateAccountsAction, AccountsControllerLoadBackupAction, - AccountsControllerMethodActions, } from './AccountsController-method-action-types'; export { EMPTY_ACCOUNT, AccountsController } from './AccountsController'; export { diff --git a/packages/assets-controllers/CHANGELOG.md b/packages/assets-controllers/CHANGELOG.md index 203fcc2d8c7..557117ffe2f 100644 --- a/packages/assets-controllers/CHANGELOG.md +++ b/packages/assets-controllers/CHANGELOG.md @@ -11,7 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Update `AuthenticationController` actions to their new names ([#7976](https://github.com/MetaMask/core/pull/7976)) - Bump `@metamask/transaction-controller` from `^62.17.1` to `^62.18.0` ([#8005](https://github.com/MetaMask/core/pull/8005)) ### Fixed diff --git a/packages/claims-controller/CHANGELOG.md b/packages/claims-controller/CHANGELOG.md index ec2d0662d8e..4282ca2ab8c 100644 --- a/packages/claims-controller/CHANGELOG.md +++ b/packages/claims-controller/CHANGELOG.md @@ -11,7 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Bump `@metamask/profile-sync-controller` from `^27.0.0` to `^27.1.0` ([#7849](https://github.com/MetaMask/core/pull/7849)) - Bump `@metamask/controller-utils` from `^11.18.0` to `^11.19.0` ([#7995](https://github.com/MetaMask/core/pull/7995)) -- Update `AuthenticationController` action to its new name ([#7976](https://github.com/MetaMask/core/pull/7976)) ## [0.4.2] diff --git a/packages/multichain-account-service/CHANGELOG.md b/packages/multichain-account-service/CHANGELOG.md index c4058ba342d..37642ec1683 100644 --- a/packages/multichain-account-service/CHANGELOG.md +++ b/packages/multichain-account-service/CHANGELOG.md @@ -7,12 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### Changed - -- Refactor the controller's messenger action registration ([#7976](https://github.com/MetaMask/core/pull/7976/)) - - The controller's methods are now exposed to the messenger through `registerMethodActionHandlers` and `MESSENGER_EXPOSED_METHODS`. - - The action types are now generated using `generate-method-action-types`. - - Exposes the missing public methods in the messenger. - Bump `@metamask/accounts-controller` from `^36.0.0` to `^36.0.1` ([#7996](https://github.com/MetaMask/core/pull/7996)) ## [7.0.0] diff --git a/packages/multichain-account-service/src/index.ts b/packages/multichain-account-service/src/index.ts index bb988a804d9..59f24f42b0f 100644 --- a/packages/multichain-account-service/src/index.ts +++ b/packages/multichain-account-service/src/index.ts @@ -20,7 +20,6 @@ export type { MultichainAccountServiceSetBasicFunctionalityAction, MultichainAccountServiceAlignWalletsAction, MultichainAccountServiceAlignWalletAction, - MultichainAccountServiceMethodActions, } from './MultichainAccountService-method-action-types'; export { AccountProviderWrapper, diff --git a/packages/notification-services-controller/CHANGELOG.md b/packages/notification-services-controller/CHANGELOG.md index c1c851444b2..bf5750cbca9 100644 --- a/packages/notification-services-controller/CHANGELOG.md +++ b/packages/notification-services-controller/CHANGELOG.md @@ -12,7 +12,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Debounce `KeyringController:stateChange` handler to reduce redundant notification subscription calls during rapid account syncing ([#7980](https://github.com/MetaMask/core/pull/7980)) - Filter out Product Account announcements notifications older than 3 months ([#7884](https://github.com/MetaMask/core/pull/7884)) - Bump `@metamask/controller-utils` from `^11.18.0` to `^11.19.0` ([#7995](https://github.com/MetaMask/core/pull/7995)) -- Update `AuthenticationController` actions to their new names ([#7976](https://github.com/MetaMask/core/pull/7976)) ## [22.0.0] diff --git a/packages/profile-metrics-controller/CHANGELOG.md b/packages/profile-metrics-controller/CHANGELOG.md index 7390d3a28e3..edcb4b6c406 100644 --- a/packages/profile-metrics-controller/CHANGELOG.md +++ b/packages/profile-metrics-controller/CHANGELOG.md @@ -9,7 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Update `AuthenticationController` action to its new name ([#7976](https://github.com/MetaMask/core/pull/7976)) - Bump `@metamask/accounts-controller` from `^36.0.0` to `^36.0.1` ([#7996](https://github.com/MetaMask/core/pull/7996)) - Bump `@metamask/polling-controller` from `^16.0.2` to `^16.0.3` ([#7996](https://github.com/MetaMask/core/pull/7996)) - Bump `@metamask/transaction-controller` from `^62.17.0` to `^62.18.0` ([#7996](https://github.com/MetaMask/core/pull/7996), [#8005](https://github.com/MetaMask/core/pull/8005)) diff --git a/packages/profile-sync-controller/CHANGELOG.md b/packages/profile-sync-controller/CHANGELOG.md index fc7ee61ca40..f7d0979a7a0 100644 --- a/packages/profile-sync-controller/CHANGELOG.md +++ b/packages/profile-sync-controller/CHANGELOG.md @@ -7,12 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Expose missing public `UserStorageController` methods through its messenger ([#7976](https://github.com/MetaMask/core/pull/7976/)) + - The following actions are now available: + - `UserStorageController:performDeleteStorageAllFeatureEntries` + - `UserStorageController:listEntropySources` + - `UserStorageController:setIsBackupAndSyncFeatureEnabled` + - `UserStorageController:setIsContactSyncingInProgress` + - `UserStorageController:syncContactsWithUserStorage` + - Corresponding action types (e.g. `UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction`) are available as well. + ### Changed -- **BREAKING:** Refactor the controller's messenger action registration ([#7976](https://github.com/MetaMask/core/pull/7976/)) - - The controller's methods are now exposed to the messenger through `registerMethodActionHandlers` and `MESSENGER_EXPOSED_METHODS`. - - The action types are now generated using `generate-method-action-types`. - - Exposes the missing public methods in the messenger. +- **BREAKING:** Standardize names of `AuthenticationController` and `UserStorageController` messenger action types ([#7976](https://github.com/MetaMask/core/pull/7976/)) + - All existing types for messenger actions have been renamed so they end in `Action` (e.g. `AuthenticationControllerPerformSignIn` -> `AuthenticationControllerPerformSignInAction`). You will need to update imports appropriately. + - This change only affects the types. The action type strings themselves have not changed, so you do not need to update the list of actions you pass when initializing `AuthenticationController` and `UserStorageController` messengers. ## [27.1.0] diff --git a/packages/profile-sync-controller/src/controllers/authentication/index.ts b/packages/profile-sync-controller/src/controllers/authentication/index.ts index 680066e11ae..3d9926709cc 100644 --- a/packages/profile-sync-controller/src/controllers/authentication/index.ts +++ b/packages/profile-sync-controller/src/controllers/authentication/index.ts @@ -12,5 +12,4 @@ export type { AuthenticationControllerGetSessionProfileAction, AuthenticationControllerGetUserProfileLineageAction, AuthenticationControllerIsSignedInAction, - AuthenticationControllerMethodActions, } from './AuthenticationController-method-action-types'; diff --git a/packages/profile-sync-controller/src/controllers/user-storage/index.ts b/packages/profile-sync-controller/src/controllers/user-storage/index.ts index 4801d5bb470..c6d746f502b 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/index.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/index.ts @@ -20,5 +20,4 @@ export type { UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction, UserStorageControllerSetIsContactSyncingInProgressAction, UserStorageControllerSyncContactsWithUserStorageAction, - UserStorageControllerMethodActions, } from './UserStorageController-method-action-types'; diff --git a/packages/subscription-controller/CHANGELOG.md b/packages/subscription-controller/CHANGELOG.md index 3a7e0caba8d..8399c6086b7 100644 --- a/packages/subscription-controller/CHANGELOG.md +++ b/packages/subscription-controller/CHANGELOG.md @@ -12,7 +12,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Bump `@metamask/transaction-controller` from `^62.16.0` to `^62.18.0` ([#7897](https://github.com/MetaMask/core/pull/7897), [#7996](https://github.com/MetaMask/core/pull/7996), [#8005](https://github.com/MetaMask/core/pull/8005)) - Bump `@metamask/polling-controller` from `^16.0.2` to `^16.0.3` ([#7996](https://github.com/MetaMask/core/pull/7996)) - Bump `@metamask/controller-utils` from `^11.18.0` to `^11.19.0` ([#7995](https://github.com/MetaMask/core/pull/7995)) -- Update `AuthenticationController` actions to their new names ([#7976](https://github.com/MetaMask/core/pull/7976)) ## [6.0.0] From f05f3012fded0c2aff7300fb4068b6b389c3d178 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Mon, 23 Feb 2026 12:17:38 +0100 Subject: [PATCH 23/27] fix `multichain-account-service` CHANGELOG --- packages/multichain-account-service/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/multichain-account-service/CHANGELOG.md b/packages/multichain-account-service/CHANGELOG.md index 37642ec1683..2c5ceee4713 100644 --- a/packages/multichain-account-service/CHANGELOG.md +++ b/packages/multichain-account-service/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + - Bump `@metamask/accounts-controller` from `^36.0.0` to `^36.0.1` ([#7996](https://github.com/MetaMask/core/pull/7996)) ## [7.0.0] From 6a0f46a1fd509792bb12797c926ec5bc30d4be5a Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Tue, 24 Feb 2026 12:29:08 +0100 Subject: [PATCH 24/27] fix CHANGELOGs and package.json after rebase --- packages/account-tree-controller/CHANGELOG.md | 4 ++++ packages/account-tree-controller/package.json | 1 - packages/accounts-controller/package.json | 1 - packages/multichain-account-service/package.json | 1 - packages/profile-sync-controller/package.json | 1 - 5 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/account-tree-controller/CHANGELOG.md b/packages/account-tree-controller/CHANGELOG.md index 807407934a6..72d23de8979 100644 --- a/packages/account-tree-controller/CHANGELOG.md +++ b/packages/account-tree-controller/CHANGELOG.md @@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `AccountTreeController:syncWithUserStorageAtLeastOnce` - Corresponding action types (e.g. `AccountTreeControllerGetAccountWalletObjectAction`) are available as well. +### Changed + +- Bump `@metamask/accounts-controller` from `^36.0.0` to `^36.0.1` ([#7996](https://github.com/MetaMask/core/pull/7996)) + ### Removed - **BREAKING:** Remove `resolveNameConflict` from `AccountTreeController` ([#7976](https://github.com/MetaMask/core/pull/7976)) diff --git a/packages/account-tree-controller/package.json b/packages/account-tree-controller/package.json index d5e86f62d1b..26393bdad9c 100644 --- a/packages/account-tree-controller/package.json +++ b/packages/account-tree-controller/package.json @@ -41,7 +41,6 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/account-tree-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/account-tree-controller", "generate-method-action-types": "tsx ../../scripts/generate-method-action-types.ts", - "publish:preview": "yarn npm publish --tag preview", "since-latest-release": "../../scripts/since-latest-release.sh", "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", diff --git a/packages/accounts-controller/package.json b/packages/accounts-controller/package.json index 8ae42b8b765..f05c64ae8ff 100644 --- a/packages/accounts-controller/package.json +++ b/packages/accounts-controller/package.json @@ -41,7 +41,6 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/accounts-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/accounts-controller", "generate-method-action-types": "tsx ../../scripts/generate-method-action-types.ts", - "publish:preview": "yarn npm publish --tag preview", "since-latest-release": "../../scripts/since-latest-release.sh", "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", diff --git a/packages/multichain-account-service/package.json b/packages/multichain-account-service/package.json index c95bea8f732..55524aa7382 100644 --- a/packages/multichain-account-service/package.json +++ b/packages/multichain-account-service/package.json @@ -41,7 +41,6 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/multichain-account-service", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/multichain-account-service", "generate-method-action-types": "tsx ../../scripts/generate-method-action-types.ts", - "publish:preview": "yarn npm publish --tag preview", "since-latest-release": "../../scripts/since-latest-release.sh", "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", diff --git a/packages/profile-sync-controller/package.json b/packages/profile-sync-controller/package.json index 9ad39132365..fa4503a3b8b 100644 --- a/packages/profile-sync-controller/package.json +++ b/packages/profile-sync-controller/package.json @@ -96,7 +96,6 @@ "generate-method-action-types": "yarn generate-method-action-types:authentication \"$@\" && yarn generate-method-action-types:user-storage \"$@\"", "generate-method-action-types:authentication": "tsx ../../scripts/generate-method-action-types.ts src/controllers/authentication", "generate-method-action-types:user-storage": "tsx ../../scripts/generate-method-action-types.ts src/controllers/user-storage", - "publish:preview": "yarn npm publish --tag preview", "since-latest-release": "../../scripts/since-latest-release.sh", "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", From 73143ae89a6812efc6e1f7589d94d6e0d7e0495b Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Tue, 24 Feb 2026 14:28:46 +0100 Subject: [PATCH 25/27] fix action types after rebase --- .../AccountsController-method-action-types.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/accounts-controller/src/AccountsController-method-action-types.ts b/packages/accounts-controller/src/AccountsController-method-action-types.ts index 816b42d40c1..fc8a6706d6e 100644 --- a/packages/accounts-controller/src/AccountsController-method-action-types.ts +++ b/packages/accounts-controller/src/AccountsController-method-action-types.ts @@ -8,6 +8,8 @@ import type { AccountsController } from './AccountsController'; /** * Returns the internal account object for the given account ID, if it exists. * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @param accountId - The ID of the account to retrieve. * @returns The internal account object, or undefined if the account does not exist. */ @@ -19,6 +21,8 @@ export type AccountsControllerGetAccountAction = { /** * Returns the internal account objects for the given account IDs, if they exist. * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @param accountIds - The IDs of the accounts to retrieve. * @returns The internal account objects, or undefined if the account(s) do not exist. */ @@ -30,6 +34,8 @@ export type AccountsControllerGetAccountsAction = { /** * Returns an array of all evm internal accounts. * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @returns An array of InternalAccount objects. */ export type AccountsControllerListAccountsAction = { @@ -40,6 +46,8 @@ export type AccountsControllerListAccountsAction = { /** * Returns an array of all internal accounts. * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @param chainId - The chain ID. * @returns An array of InternalAccount objects. */ @@ -51,6 +59,8 @@ export type AccountsControllerListMultichainAccountsAction = { /** * Returns the last selected EVM account. * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @returns The selected internal account. */ export type AccountsControllerGetSelectedAccountAction = { @@ -63,6 +73,8 @@ export type AccountsControllerGetSelectedAccountAction = { * * Retrieves the last selected account by chain ID. * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @param chainId - The chain ID to filter the accounts. * @returns The last selected account compatible with the specified chain ID or undefined. */ @@ -75,6 +87,8 @@ export type AccountsControllerGetSelectedMultichainAccountAction = { * Returns the account with the specified address. * ! This method will only return the first account that matches the address * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @param address - The address of the account to retrieve. * @returns The account with the specified address, or undefined if not found. */ @@ -86,6 +100,8 @@ export type AccountsControllerGetAccountByAddressAction = { /** * Sets the selected account by its ID. * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @param accountId - The ID of the account to be selected. */ export type AccountsControllerSetSelectedAccountAction = { @@ -96,6 +112,8 @@ export type AccountsControllerSetSelectedAccountAction = { /** * Sets the name of the account with the given ID. * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @param accountId - The ID of the account to set the name for. * @param accountName - The new name for the account. * @throws An error if an account with the same name already exists. @@ -108,6 +126,8 @@ export type AccountsControllerSetAccountNameAction = { /** * Sets the name of the account with the given ID and select it. * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @param accountId - The ID of the account to set the name for and select. * @param accountName - The new name for the account. * @throws An error if an account with the same name already exists. @@ -120,6 +140,8 @@ export type AccountsControllerSetAccountNameAndSelectAccountAction = { /** * Updates the metadata of the account with the given ID. * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @param accountId - The ID of the account for which the metadata will be updated. * @param metadata - The new metadata for the account. */ @@ -132,6 +154,8 @@ export type AccountsControllerUpdateAccountMetadataAction = { * Updates the internal accounts list by retrieving normal and snap accounts, * removing duplicates, and updating the metadata of each account. * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @returns A Promise that resolves when the accounts have been updated. */ export type AccountsControllerUpdateAccountsAction = { @@ -142,6 +166,8 @@ export type AccountsControllerUpdateAccountsAction = { /** * Loads the backup state of the accounts controller. * + * @deprecated This method is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. * @param backup - The backup state to load. */ export type AccountsControllerLoadBackupAction = { From 603df2341093bb9d262264f2fc7c589ee98ca13d Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Tue, 24 Feb 2026 14:29:47 +0100 Subject: [PATCH 26/27] re-add comment --- packages/accounts-controller/src/AccountsController.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/accounts-controller/src/AccountsController.ts b/packages/accounts-controller/src/AccountsController.ts index 51c3ee32f53..86be1b96a98 100644 --- a/packages/accounts-controller/src/AccountsController.ts +++ b/packages/accounts-controller/src/AccountsController.ts @@ -96,6 +96,10 @@ const MESSENGER_EXPOSED_METHODS = [ 'loadBackup', ] as const; +/** + * @deprecated This type is deprecated and will be removed in a future version. + * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead. + */ export type AllowedActions = | KeyringControllerGetKeyringsByTypeAction | KeyringControllerGetStateAction; From 57054792cf300f505354b43a86fbbc69ff914bff Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Tue, 24 Feb 2026 15:25:17 +0100 Subject: [PATCH 27/27] fix CHANGELOG --- packages/accounts-controller/CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/accounts-controller/CHANGELOG.md b/packages/accounts-controller/CHANGELOG.md index 9f10a91dcae..d522595c14d 100644 --- a/packages/accounts-controller/CHANGELOG.md +++ b/packages/accounts-controller/CHANGELOG.md @@ -7,10 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### Deprecated - -- Mark `AccountsController`, all of its public methods, and all exported types as deprecated in favor of `AccountTreeController`, `MultichainAccountService`, and Keyring API v2 ([#8027](https://github.com/MetaMask/core/pull/8027)) - ### Added - Expose missing public `AccountsController` methods through its messenger ([#7976](https://github.com/MetaMask/core/pull/7976/)) @@ -18,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `AccountController:loadBackupAction` - Corresponding action types (e.g. `AccountControllerLoadBackupAction`) are available as well. +### Deprecated + +- Mark `AccountsController`, all of its public methods, and all exported types as deprecated in favor of `AccountTreeController`, `MultichainAccountService`, and Keyring API v2 ([#8027](https://github.com/MetaMask/core/pull/8027)) + ### Removed - **BREAKING:** Remove `getAccountExpect` from `AccountsController` ([#7976](https://github.com/MetaMask/core/pull/7976))