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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/accounts-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add `init` method and `AccountsController:init` messenger action ([#10191](https://github.com/MetaMask/core/pull/10191))
- Loads accounts from the current keyring state, intended to pair with `clearState` for wallet reset flows (`clearState` then `init`).
- Idempotent: subsequent calls before `clearState` are no-ops.
- Fires `AccountsController:accountsAdded` for accounts newly discovered during initialization.
- Fires `AccountsController:initialized` (with current state as payload) when initialization completes.
- Add `AccountsController:initialized` event - fired by `init()` when the controller finishes its first full account sync ([#10191](https://github.com/MetaMask/core/pull/10191))
- Add `AccountsController:uninitialized` event - fired by `clearState()` to signal that `init()` must be called again ([#10191](https://github.com/MetaMask/core/pull/10191))

### Changed

- Bump `uuid` from `^8.3.2` to `^9.0.1` ([#10117](https://github.com/MetaMask/core/pull/10117))
- `clearState()` now resets the initialized flag and fires `AccountsController:uninitialized` ([#10191](https://github.com/MetaMask/core/pull/10191))

### Removed

- **BREAKING:** Remove `updateAccounts` method and `AccountsController:updateAccounts` messenger action ([#10191](https://github.com/MetaMask/core/pull/10191))
- Use `AccountsController:init` instead, it performs the same full keyring sync and additionally fires lifecycle events.

## [40.0.0]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,19 @@ export type AccountsControllerUpdateAccountMetadataAction = {
};

/**
* Updates the internal accounts list by retrieving normal and snap accounts,
* removing duplicates, and updating the metadata of each account.
* Initializes the controller by loading accounts from the current keyring
* state. Any accounts present in the keyrings but missing from the
* controller's state are added; existing accounts are preserved.
*
* Intended to be called after {@link clearState} to restore accounts from
* the keyrings (i.e. `clearState` then `init`), or on first startup.
*
* @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 = {
type: `AccountsController:updateAccounts`;
handler: AccountsController['updateAccounts'];
export type AccountsControllerInitAction = {
type: `AccountsController:init`;
handler: AccountsController['init'];
};

/**
Expand Down Expand Up @@ -201,6 +204,6 @@ export type AccountsControllerMethodActions =
| AccountsControllerSetAccountNameAction
| AccountsControllerSetAccountNameAndSelectAccountAction
| AccountsControllerUpdateAccountMetadataAction
| AccountsControllerUpdateAccountsAction
| AccountsControllerInitAction
| AccountsControllerLoadBackupAction
| AccountsControllerClearStateAction;
Loading