Skip to main content

MoneyAccountController Actions

6 actions registered.

NameDeprecated
clearState
createMoneyAccount
getMoneyAccount
getState
init
setDefaultMoneyAccount

MoneyAccountController:clearState​

Package: @metamask/money-account-controller

Resets the controller state to its default, removing all money accounts.

Intended for use during a full app reset (e.g. when the user wipes all wallet data). Does not interact with the keyring.

Handler signature:

() => void

MoneyAccountController:createMoneyAccount​

Package: @metamask/money-account-controller

Creates a money account. If an account already exists for the given source, it is returned as-is (idempotent).

NOTE: Creating an MPC-backed account may trigger the MPC setup, which can be long-running and require interactive authentication.

Parameters:

NameDescription
paramsThe parameters for creating the money account.

Returns: The money account.

Handler signature:

(params: CreateMoneyAccountParams) => Promise<MoneyAccount>

MoneyAccountController:getMoneyAccount​

Package: @metamask/money-account-controller

Gets a money account by id, by entropy source, the MPC-backed one, or the default one when no selector is provided.

Parameters:

NameDescription
selectorSelector for getting the money account.

Returns: The money account, or undefined if none matches.

Handler signature:

(selector?: GetMoneyAccountSelector) => MoneyAccount | undefined

MoneyAccountController:getState​

Package: @metamask/money-account-controller

Handler signature:

() => MoneyAccountControllerState

MoneyAccountController:init​

Package: @metamask/money-account-controller

Initializes the controller by creating a money account for the primary entropy source if one does not already exist, and by setting that account as the default if no default is set.

Handler signature:

() => Promise<void>

MoneyAccountController:setDefaultMoneyAccount​

Package: @metamask/money-account-controller

Sets the default money account.

Parameters:

NameDescription
idThe id of the money account to use as the default.

Handler signature:

(id: MoneyAccount['id']) => void