Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7fcbed1
wip
Jwhiles Mar 16, 2026
b960c58
fix: add codeowner
Jwhiles Mar 16, 2026
890ecc1
chore: add missing code owner rules
Jwhiles Mar 17, 2026
6918391
chore: dedupe deps
Jwhiles Mar 17, 2026
8f6c75d
fix: handle non-hd keyrings in index check
Jwhiles Mar 17, 2026
882cff2
chore: use withKeyRing
Jwhiles Mar 17, 2026
c4a966a
chore: update team.json
Jwhiles Mar 17, 2026
9a8489e
chore: add the cash keyring to the accounts controller switch
Jwhiles Mar 19, 2026
ccc6c2c
fix: make createAccount idempotent
Jwhiles Mar 19, 2026
b652938
chore: remove uneeded guard
Jwhiles Mar 19, 2026
7ac9b62
chore: update teams.json
Jwhiles Mar 19, 2026
9b5b9b2
chore: update codeowners to make new service shared
Jwhiles Mar 19, 2026
99bc537
chore: updaet changelogs
Jwhiles Mar 19, 2026
49cab71
chore: regenerate lockfile
Jwhiles Mar 19, 2026
686bc3a
chore: fix formatting
Jwhiles Mar 19, 2026
31dcb5b
chore: fix misleading error message
Jwhiles Mar 19, 2026
377d179
chore: properly mark dependency as runtime
Jwhiles Mar 19, 2026
e257bae
chore: change cash to money
Jwhiles Mar 20, 2026
c532875
feat: check that we see a not found error else rethrow
Jwhiles Mar 20, 2026
ad6b7e1
fix: only ever create one money account
Jwhiles Mar 20, 2026
b8bdf65
feat: add getMoneyAccount method to the money service
Jwhiles Mar 20, 2026
355208d
fix: lock file and depenendecies after rebase
Jwhiles Mar 20, 2026
522a7ec
chore: lint money package
Jwhiles Mar 20, 2026
a23ba71
chore: fix changelog
Jwhiles Mar 20, 2026
e962090
fix: avoid race condition when creating money keyring
Jwhiles Mar 20, 2026
7d53b87
fix: deserialize mnemonic in money account service
Jwhiles Mar 20, 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
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

## Earn Team
/packages/earn-controller @MetaMask/metamask-earn
/packages/money-account-service @MetaMask/metamask-earn

## Social AI Team
/packages/ai-controllers @MetaMask/social-ai
Expand Down Expand Up @@ -116,6 +117,7 @@
/packages/remote-feature-flag-controller @MetaMask/extension-platform @MetaMask/mobile-platform @MetaMask/core-platform
/packages/storage-service @MetaMask/extension-platform @MetaMask/mobile-platform @MetaMask/core-platform
/packages/client-controller @MetaMask/core-platform @MetaMask/extension-platform @MetaMask/mobile-platform
/packages/money-account-service @MetaMask/accounts-engineers @MetaMask/metamask-earn

## Package Release related
/packages/account-tree-controller/package.json @MetaMask/accounts-engineers @MetaMask/core-platform
Expand All @@ -136,6 +138,9 @@
/packages/assets-controllers/CHANGELOG.md @MetaMask/metamask-assets @MetaMask/core-platform
/packages/assets-controller/package.json @MetaMask/metamask-assets @MetaMask/core-platform
/packages/assets-controller/CHANGELOG.md @MetaMask/metamask-assets @MetaMask/core-platform

/packages/money-account-service/package.json @MetaMask/metamask-earn @MetaMask/core-platform
/packages/money-account-service/CHANGELOG.md @MetaMask/metamask-earn @MetaMask/core-platform
/packages/chain-agnostic-permission/package.json @MetaMask/wallet-integrations @MetaMask/core-platform
/packages/chain-agnostic-permission/CHANGELOG.md @MetaMask/wallet-integrations @MetaMask/core-platform
/packages/config-registry-controller/CHANGELOG.md @MetaMask/networks @MetaMask/core-platform
Expand Down
1 change: 1 addition & 0 deletions packages/accounts-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add support for `KeyringTypes.money` in `keyringTypeToName`, mapping it to `'Money Account'` ([#8204](https://github.com/MetaMask/core/pull/8204))
- Add `:accounts{Added,Removed}` batch events ([#8151](https://github.com/MetaMask/core/pull/8151))
- Those new events can be used instead of single `:accountAdded` and `:accountRemoved` events to reduce the number of events emitted during batch operations (e.g. `KeyringController` state re-synchronization).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2726,6 +2726,7 @@ describe('AccountsController', () => {
KeyringTypes.ledger,
KeyringTypes.lattice,
KeyringTypes.qr,
KeyringTypes.money,
])('should add accounts for %s type', async (keyringType) => {
mockUUIDWithNormalAccounts([mockAccount]);

Expand Down
3 changes: 3 additions & 0 deletions packages/accounts-controller/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export function keyringTypeToName(keyringType: string): string {
case KeyringTypes.qr: {
return 'QR';
}
case KeyringTypes.money: {
return 'Money Account';
}
case KeyringTypes.snap: {
return 'Snap Account';
}
Expand Down
6 changes: 6 additions & 0 deletions packages/keyring-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add `KeyringTypes.money` (`'Money Keyring'`) to the `KeyringTypes` enum ([#8204](https://github.com/MetaMask/core/pull/8204))
- Add `MoneyKeyring` (from `@metamask/eth-money-keyring`) as a built-in default keyring ([#8204](https://github.com/MetaMask/core/pull/8204))
- Export `KeyringControllerErrorMessage` enum to allow consumers to distinguish specific controller error cases ([#8204](https://github.com/MetaMask/core/pull/8204))

### Changed

- Bump `@metamask/keyring-api` from `^21.0.0` to `^21.6.0` ([#7857](https://github.com/MetaMask/core/pull/7857), [#8259](https://github.com/MetaMask/core/pull/8259))
Expand Down
1 change: 1 addition & 0 deletions packages/keyring-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@metamask/base-controller": "^9.0.0",
"@metamask/browser-passworder": "^6.0.0",
"@metamask/eth-hd-keyring": "^13.0.0",
"@metamask/eth-money-keyring": "1.0.0",
"@metamask/eth-sig-util": "^8.2.0",
"@metamask/eth-simple-keyring": "^11.0.0",
"@metamask/keyring-api": "^21.6.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/keyring-controller/src/KeyringController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { isValidPrivate, getBinarySize } from '@ethereumjs/util';
import { BaseController } from '@metamask/base-controller';
import type * as encryptorUtils from '@metamask/browser-passworder';
import { HdKeyring } from '@metamask/eth-hd-keyring';
import { MoneyKeyring } from '@metamask/eth-money-keyring';
import { normalize as ethNormalize } from '@metamask/eth-sig-util';
import SimpleKeyring from '@metamask/eth-simple-keyring';
import type {
Expand Down Expand Up @@ -55,6 +56,7 @@ export enum KeyringTypes {
/* eslint-disable @typescript-eslint/naming-convention */
simple = 'Simple Key Pair',
hd = 'HD Key Tree',
money = 'Money Keyring',
qr = 'QR Hardware Wallet Device',
trezor = 'Trezor Hardware',
oneKey = 'OneKey Hardware',
Expand Down Expand Up @@ -558,6 +560,7 @@ const defaultKeyringBuilders = [
// @ts-expect-error keyring types are mismatched
keyringBuilderFactory(SimpleKeyring),
keyringBuilderFactory(HdKeyring),
keyringBuilderFactory(MoneyKeyring),
];

export const getDefaultKeyringState = (): KeyringControllerState => {
Expand Down
1 change: 1 addition & 0 deletions packages/keyring-controller/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './KeyringController';
export type * from './types';
export * from './errors';
export { KeyringControllerErrorMessage } from './constants';
14 changes: 14 additions & 0 deletions packages/money-account-service/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

- Initial release ([#8204](https://github.com/MetaMask/core/pull/8204))

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

Copyright (c) 2025 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
SOFTWARE.
17 changes: 17 additions & 0 deletions packages/money-account-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# `@metamask/money-account-service`

Money account service.

This service provides operations for creating and managing Money accounts derived from HD keyrings.

## Installation

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

or

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

## 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-service/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,
},
},
});
73 changes: 73 additions & 0 deletions packages/money-account-service/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"name": "@metamask/money-account-service",
"version": "0.0.0",
"description": "Service to manage money accounts",
"keywords": [
"MetaMask",
"Ethereum"
],
"homepage": "https://github.com/MetaMask/core/tree/main/packages/money-account-service#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-service",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/money-account-service",
"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/base-controller": "^9.0.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused @metamask/base-controller dependency in new package

Low Severity

@metamask/base-controller is listed as a production dependency and referenced in tsconfig.build.json, but no source file in the package imports from it. The service class does not extend BaseController (which is correct per the AGENTS.md guideline that stateless services should not be controllers). This dependency and its tsconfig reference appear to be unnecessary.

Additional Locations (1)
Fix in Cursor Fix in Web

"@metamask/eth-hd-keyring": "^13.0.0",
"@metamask/keyring-controller": "^25.1.0",
"@metamask/messenger": "^0.3.0"
},
"devDependencies": {
"@metamask/auto-changelog": "^3.4.4",
"@ts-bridge/cli": "^0.6.4",
"@types/jest": "^29.5.14",
"deepmerge": "^4.2.2",
"jest": "^29.7.0",
"ts-jest": "^29.2.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,15 @@
import type { MoneyAccountService } from './MoneyAccountService';

export type MoneyAccountServiceCreateMoneyAccountAction = {
type: `MoneyAccountService:createMoneyAccount`;
handler: MoneyAccountService['createMoneyAccount'];
};

export type MoneyAccountServiceGetMoneyAccountAction = {
type: `MoneyAccountService:getMoneyAccount`;
handler: MoneyAccountService['getMoneyAccount'];
};

export type MoneyAccountServiceMethodActions =
| MoneyAccountServiceCreateMoneyAccountAction
| MoneyAccountServiceGetMoneyAccountAction;
Loading
Loading