Skip to content
Open
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
3 changes: 0 additions & 3 deletions eslint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"@typescript-eslint/explicit-function-return-type": {
"count": 7
},
"@typescript-eslint/prefer-nullish-coalescing": {
"count": 1
},
"no-negated-condition": {
"count": 3
},
Expand Down
4 changes: 4 additions & 0 deletions packages/account-tree-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add `getAccountFromSelectedAccountGroup` and `setSelectedAccountGroupByAccountId` methods ([#9739](https://github.com/MetaMask/core/pull/9739))

### Changed

- Bump `@metamask/keyring-api` from `^23.5.0` to `^23.7.0` ([#9676](https://github.com/MetaMask/core/pull/9676))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,30 @@ export type AccountTreeControllerGetAccountsFromSelectedAccountGroupAction = {
handler: AccountTreeController['getAccountsFromSelectedAccountGroup'];
};

/**
* Gets an account from the currently selected account group, optionally
* filtered by a CAIP-2 chain ID.
*
* This is the group-based replacement for both
* `AccountsController:getSelectedAccount` and
* `AccountsController:getSelectedMultichainAccount`.
*
* When no chain ID is provided, an account of the selected group is returned
* using an EVM-priority rule: the first EVM account found in the group, or the
* first account in the group if no EVM account is found. When a chain ID is
* provided, the first account in the selected group whose scopes match the
* given chain is returned.
*
* @param chainId - Optional CAIP-2 chain ID used to filter accounts by scope.
* @returns The matching internal account from the selected group, or
* undefined if no group is selected or no account matches.
* @throws If `chainId` is provided but is not a valid CAIP-2 chain ID.
*/
export type AccountTreeControllerGetAccountFromSelectedAccountGroupAction = {
type: `AccountTreeController:getAccountFromSelectedAccountGroup`;
handler: AccountTreeController['getAccountFromSelectedAccountGroup'];
};

/**
* Gets the account group object from its ID.
*
Expand Down Expand Up @@ -107,6 +131,16 @@ export type AccountTreeControllerSetSelectedAccountGroupAction = {
handler: AccountTreeController['setSelectedAccountGroup'];
};

/**
* Sets the selected account group and updates the AccountsController selectedAccount accordingly.
*
* @param accountId - The account ID to select the group for.
*/
export type AccountTreeControllerSetSelectedAccountGroupByAccountIdAction = {
type: `AccountTreeController:setSelectedAccountGroupByAccountId`;
handler: AccountTreeController['setSelectedAccountGroupByAccountId'];
};

/**
* Sets a custom name for an account group.
*
Expand Down Expand Up @@ -208,10 +242,12 @@ export type AccountTreeControllerMethodActions =
| AccountTreeControllerGetAccountWalletObjectAction
| AccountTreeControllerGetAccountWalletObjectsAction
| AccountTreeControllerGetAccountsFromSelectedAccountGroupAction
| AccountTreeControllerGetAccountFromSelectedAccountGroupAction
| AccountTreeControllerGetAccountGroupObjectAction
| AccountTreeControllerGetAccountContextAction
| AccountTreeControllerGetSelectedAccountGroupAction
| AccountTreeControllerSetSelectedAccountGroupAction
| AccountTreeControllerSetSelectedAccountGroupByAccountIdAction
| AccountTreeControllerSetAccountGroupNameAction
| AccountTreeControllerSetAccountWalletNameAction
| AccountTreeControllerSetAccountGroupPinnedAction
Expand Down
Loading