Skip to main content

AccountsController Actions

15 actions registered.

NameDeprecated
clearStateYes
getAccountYes
getAccountByAddressYes
getAccountsYes
getSelectedAccountYes
getSelectedMultichainAccountYes
getStateYes
listAccountsYes
listMultichainAccountsYes
loadBackupYes
setAccountNameYes
setAccountNameAndSelectAccountYes
setSelectedAccountYes
updateAccountMetadataYes
updateAccountsYes

AccountsController:clearState​

Deprecated

Package: @metamask/accounts-controller

Clears the controller state and resets to default values. Deprecated: This method is deprecated and will be removed in a future version. Use AccountTreeController, MultichainAccountService, or the Keyring API v2 instead.

Handler signature:

() => void

AccountsController:getAccount​

Deprecated

Package: @metamask/accounts-controller

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.

Parameters:

NameDescription
accountIdThe ID of the account to retrieve.

Returns: The internal account object, or undefined if the account does not exist.

Handler signature:

(accountId: string) => InternalAccount | undefined

AccountsController:getAccountByAddress​

Deprecated

Package: @metamask/accounts-controller

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.

Parameters:

NameDescription
addressThe address of the account to retrieve.

Returns: The account with the specified address, or undefined if not found.

Handler signature:

(address: string) => InternalAccount | undefined

AccountsController:getAccounts​

Deprecated

Package: @metamask/accounts-controller

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.

Parameters:

NameDescription
accountIdsThe IDs of the accounts to retrieve.

Returns: The internal account objects, or undefined if the account(s) do not exist.

Handler signature:

(accountIds: string[]) => (InternalAccount | undefined)[]

AccountsController:getSelectedAccount​

Deprecated

Package: @metamask/accounts-controller

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.

Handler signature:

() => InternalAccount

AccountsController:getSelectedMultichainAccount​

Deprecated

Package: @metamask/accounts-controller

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. Deprecated: This method is deprecated and will be removed in a future version. Use AccountTreeController, MultichainAccountService, or the Keyring API v2 instead.

Parameters:

NameDescription
chainIdThe chain ID to filter the accounts.

Returns: The last selected account compatible with the specified chain ID or undefined.

Handler signature:

(chainId?: CaipChainId) => InternalAccount | undefined

AccountsController:getState​

Deprecated

Package: @metamask/accounts-controller

Deprecated: This type is deprecated and will be removed in a future version. Use AccountTreeController, MultichainAccountService, or the Keyring API v2 instead.

Handler signature:

() => AccountsControllerState

AccountsController:listAccounts​

Deprecated

Package: @metamask/accounts-controller

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.

Handler signature:

() => InternalAccount[]

AccountsController:listMultichainAccounts​

Deprecated

Package: @metamask/accounts-controller

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.

Parameters:

NameDescription
chainIdThe chain ID.

Returns: An array of InternalAccount objects.

Handler signature:

(chainId?: CaipChainId) => InternalAccount[]

AccountsController:loadBackup​

Deprecated

Package: @metamask/accounts-controller

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.

Parameters:

NameDescription
backupThe backup state to load.

Handler signature:

(backup: AccountsControllerState) => void

AccountsController:setAccountName​

Deprecated

Package: @metamask/accounts-controller

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.

Parameters:

NameDescription
accountIdThe ID of the account to set the name for.
accountNameThe new name for the account.

Handler signature:

(accountId: string, accountName: string) => void

AccountsController:setAccountNameAndSelectAccount​

Deprecated

Package: @metamask/accounts-controller

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.

Parameters:

NameDescription
accountIdThe ID of the account to set the name for and select.
accountNameThe new name for the account.

Handler signature:

(accountId: string, accountName: string) => void

AccountsController:setSelectedAccount​

Deprecated

Package: @metamask/accounts-controller

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.

Parameters:

NameDescription
accountIdThe ID of the account to be selected.

Handler signature:

(accountId: string) => void

AccountsController:updateAccountMetadata​

Deprecated

Package: @metamask/accounts-controller

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.

Parameters:

NameDescription
accountIdThe ID of the account for which the metadata will be updated.
metadataThe new metadata for the account.

Handler signature:

(accountId: string, metadata: Partial<InternalAccount['metadata']>) => void

AccountsController:updateAccounts​

Deprecated

Package: @metamask/accounts-controller

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.

Handler signature:

() => Promise<void>