Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0a98e0b
feat: add money-account-controller
ccharly Mar 30, 2026
b6497c7
feat: implement getMoneyAccount
ccharly Mar 30, 2026
8306c97
refactor: narrow MoneyAccount type
ccharly Mar 31, 2026
b173ad4
feat: implement createMoneyAccount + init
ccharly Apr 1, 2026
b18487b
feat: add clearState action
ccharly Apr 1, 2026
809c175
chore: yarn.lock
ccharly Apr 1, 2026
84dd804
chore: update deps
ccharly Apr 1, 2026
a8a28f4
chore: add CO
ccharly Apr 1, 2026
af616bd
chore: update teams.json
ccharly Apr 1, 2026
0864c37
chore: changelog
ccharly Apr 1, 2026
5591159
chore: lint
ccharly Apr 1, 2026
d3fb7fe
test: refactor
ccharly Apr 1, 2026
9eb6b60
chore: bump messenger deps
ccharly Apr 1, 2026
e6d07ff
refactor: use enum
ccharly Apr 1, 2026
ab79ead
refactor: better logs
ccharly Apr 1, 2026
14ddfb5
chore: cleanup
ccharly Apr 1, 2026
c82b568
chore: remove account-api dep
ccharly Apr 1, 2026
aedd6e9
fix: missing export
ccharly Apr 1, 2026
632c5a5
refactor: use deterministic ID
ccharly Apr 2, 2026
897b684
build: add generate-method-action-types + use it to re-generate actio…
ccharly Apr 2, 2026
2d300a0
chore: log if primary HD keyring was not found
ccharly Apr 2, 2026
c51008b
fix: remove EthMethod.Sign method
ccharly Apr 2, 2026
e367269
chore: add comment
ccharly Apr 2, 2026
053d1ae
test: remove eth_sign
ccharly Apr 2, 2026
de93c92
refactor: fix bad comment
ccharly Apr 2, 2026
05d4d8e
refactor: add #withKeyring
ccharly Apr 2, 2026
c19e491
chore: typo
ccharly Apr 2, 2026
fa2f2a4
refactor: explicit await
ccharly Apr 2, 2026
9e5f073
fix: fix race condition with #withKeyring
ccharly Apr 2, 2026
1beb776
test: add test for #withKeyring race-condition
ccharly Apr 2, 2026
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: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/packages/multichain-account-service @MetaMask/accounts-engineers
/packages/account-tree-controller @MetaMask/accounts-engineers
/packages/profile-sync-controller @MetaMask/accounts-engineers
/packages/money-account-controller @MetaMask/accounts-engineers

## Assets Team
/packages/assets-controllers @MetaMask/metamask-assets
Expand Down Expand Up @@ -222,3 +223,5 @@
/packages/client-controller/CHANGELOG.md @MetaMask/core-platform @MetaMask/extension-platform @MetaMask/mobile-platform
/packages/social-controllers/package.json @MetaMask/social-ai @MetaMask/core-platform
/packages/social-controllers/CHANGELOG.md @MetaMask/social-ai @MetaMask/core-platform
/packages/money-account-controller/package.json @MetaMask/accounts-engineers @MetaMask/core-platform
/packages/money-account-controller/CHANGELOG.md @MetaMask/accounts-engineers @MetaMask/core-platform
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Each package in this repository has its own README where you can find installati
- [`@metamask/logging-controller`](packages/logging-controller)
- [`@metamask/message-manager`](packages/message-manager)
- [`@metamask/messenger`](packages/messenger)
- [`@metamask/money-account-controller`](packages/money-account-controller)
- [`@metamask/multichain-account-service`](packages/multichain-account-service)
- [`@metamask/multichain-api-middleware`](packages/multichain-api-middleware)
- [`@metamask/multichain-network-controller`](packages/multichain-network-controller)
Expand Down Expand Up @@ -148,6 +149,7 @@ linkStyle default opacity:0.5
logging_controller(["@metamask/logging-controller"]);
message_manager(["@metamask/message-manager"]);
messenger(["@metamask/messenger"]);
money_account_controller(["@metamask/money-account-controller"]);
multichain_account_service(["@metamask/multichain-account-service"]);
multichain_api_middleware(["@metamask/multichain-api-middleware"]);
multichain_network_controller(["@metamask/multichain-network-controller"]);
Expand Down
14 changes: 14 additions & 0 deletions packages/money-account-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Add `MoneyAccountController` ([#8361](https://github.com/MetaMask/core/pull/8361))

[Unreleased]: https://github.com/MetaMask/core/
20 changes: 20 additions & 0 deletions packages/money-account-controller/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MIT License

Copyright (c) 2026 MetaMask

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
15 changes: 15 additions & 0 deletions packages/money-account-controller/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# `@metamask/money-account-controller`

MetaMask Money account controller.

## Installation

`yarn add @metamask/money-account-controller`

or

`npm install @metamask/money-account-controller`

## Contributing

This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme).
26 changes: 26 additions & 0 deletions packages/money-account-controller/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/

const merge = require('deepmerge');
const path = require('path');

const baseConfig = require('../../jest.config.packages');

const displayName = path.basename(__dirname);

module.exports = merge(baseConfig, {
// The display name when running multiple projects
displayName,

// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
});
80 changes: 80 additions & 0 deletions packages/money-account-controller/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"name": "@metamask/money-account-controller",
"version": "0.0.0",
"description": "MetaMask Money account controller",
"keywords": [
"MetaMask",
"Ethereum"
],
"homepage": "https://github.com/MetaMask/core/tree/main/packages/money-account-controller#readme",
"bugs": {
"url": "https://github.com/MetaMask/core/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/core.git"
},
"license": "MIT",
"sideEffects": false,
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
"build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
"build:docs": "typedoc",
"changelog:update": "../../scripts/update-changelog.sh @metamask/money-account-controller",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/money-account-controller",
"generate-method-action-types": "tsx ../../packages/messenger/src/generate-action-types/cli.ts",
"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",
"test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose",
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
},
"dependencies": {
"@metamask/accounts-controller": "^37.2.0",
"@metamask/base-controller": "^9.0.1",
"@metamask/eth-money-keyring": "^2.0.0",
"@metamask/keyring-api": "^21.6.0",
"@metamask/keyring-controller": "^25.2.0",
"@metamask/messenger": "^1.1.0",
"async-mutex": "^0.5.0"
},
"devDependencies": {
"@metamask/auto-changelog": "^3.4.4",
"@metamask/keyring-utils": "^3.1.0",
"@metamask/utils": "^11.9.0",
"@ts-bridge/cli": "^0.6.4",
"@types/jest": "^29.5.14",
"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"
},
"engines": {
"node": "^18.18 || >=20"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* This file is auto generated.
* Do not edit manually.
*/

import type { MoneyAccountController } from './MoneyAccountController';

/**
* Creates a money account for the given entropy source. If an account
* already exists for that entropy source, it is returned as-is (idempotent).
*
* @param entropySource - The entropy source ID to create the money account for.
* @returns The money account.
*/
export type MoneyAccountControllerCreateMoneyAccountAction = {
type: `MoneyAccountController:createMoneyAccount`;
handler: MoneyAccountController['createMoneyAccount'];
};

/**
* Gets a money account by its associated entropy source ID. If no ID is
* provided, the primary entropy source will be used.
*
* @param selector - Selector options for getting the money account.
* @param selector.entropySource - The entropy source ID to get the money account for. If not provided, the primary entropy source will be used.
* @returns The money account, or `undefined` if no account exists for the given entropy source.
*/
export type MoneyAccountControllerGetMoneyAccountAction = {
type: `MoneyAccountController:getMoneyAccount`;
handler: MoneyAccountController['getMoneyAccount'];
};

/**
* 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 — the caller is
* responsible for ensuring the associated keyring state is also cleared.
*/
export type MoneyAccountControllerClearStateAction = {
type: `MoneyAccountController:clearState`;
handler: MoneyAccountController['clearState'];
};

/**
* Union of all MoneyAccountController action types.
*/
export type MoneyAccountControllerMethodActions =
| MoneyAccountControllerCreateMoneyAccountAction
| MoneyAccountControllerGetMoneyAccountAction
| MoneyAccountControllerClearStateAction;
Loading
Loading