Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
690cc28
wip
Jwhiles Mar 16, 2026
36dccae
fix: add codeowner
Jwhiles Mar 16, 2026
f4c5d35
chore: add missing code owner rules
Jwhiles Mar 17, 2026
286d381
chore: dedupe deps
Jwhiles Mar 17, 2026
cc84595
fix: handle non-hd keyrings in index check
Jwhiles Mar 17, 2026
6047418
chore: use withKeyRing
Jwhiles Mar 17, 2026
90debd9
chore: update team.json
Jwhiles Mar 17, 2026
9f28a02
chore: add the cash keyring to the accounts controller switch
Jwhiles Mar 19, 2026
62b1890
fix: make createAccount idempotent
Jwhiles Mar 19, 2026
2e1fd0b
chore: remove uneeded guard
Jwhiles Mar 19, 2026
2430819
chore: update teams.json
Jwhiles Mar 19, 2026
19e35aa
chore: update codeowners to make new service shared
Jwhiles Mar 19, 2026
287c702
chore: updaet changelogs
Jwhiles Mar 19, 2026
e6b6e51
chore: regenerate lockfile
Jwhiles Mar 19, 2026
7e71ef2
chore: fix formatting
Jwhiles Mar 19, 2026
246ac82
chore: fix misleading error message
Jwhiles Mar 19, 2026
c731c07
chore: properly mark dependency as runtime
Jwhiles Mar 19, 2026
05fd2d6
chore: change cash to money
Jwhiles Mar 20, 2026
fa00622
feat: check that we see a not found error else rethrow
Jwhiles Mar 20, 2026
6081c5d
fix: only ever create one money account
Jwhiles Mar 20, 2026
b9f1826
feat: add getMoneyAccount method to the money service
Jwhiles Mar 20, 2026
4d7e6a1
fix: lock file and depenendecies after rebase
Jwhiles Mar 20, 2026
a8107e7
chore: lint money package
Jwhiles Mar 20, 2026
e1da388
chore: fix changelog
Jwhiles Mar 20, 2026
c54955d
fix: avoid race condition when creating money keyring
Jwhiles Mar 20, 2026
9308820
fix: deserialize mnemonic in money account service
Jwhiles Mar 20, 2026
f8bd9bc
feat: add money account service test that interacts with real money k…
Jwhiles Mar 20, 2026
5c688f4
chore: add a carat to keyring version in package.json
Jwhiles Mar 20, 2026
3790a39
fix: don’t export method action type from money service
Jwhiles Mar 20, 2026
0509156
chore: fix codeowners changes
Jwhiles Mar 23, 2026
782e6bb
fix: don't export KeyringControllerErrorMessage from the keyring
Jwhiles Mar 23, 2026
d5fe4cc
chore: use correct year in License
Jwhiles Mar 23, 2026
7fda193
refactor(money-account-service): use group/wallet/account
ccharly Mar 23, 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
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,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 +137,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
5 changes: 5 additions & 0 deletions packages/keyring-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ 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))

### 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
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) 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
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,
},
},
});
81 changes: 81 additions & 0 deletions packages/money-account-service/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"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",
"generate-method-action-types": "tsx ../../scripts/generate-method-action-types.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/account-tree-controller": "^5.0.1",
"@metamask/accounts-controller": "^37.0.0",
"@metamask/base-controller": "^9.0.0",
"@metamask/eth-hd-keyring": "^13.0.0",
"@metamask/eth-money-keyring": "^1.0.0",
"@metamask/keyring-controller": "^25.1.0",
"@metamask/messenger": "^0.3.0"
},
"devDependencies": {
"@metamask/account-api": "^1.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/keyring-internal-api": "^10.0.0",
"@metamask/keyring-utils": "^3.1.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,58 @@
/**
* This file is auto generated by `scripts/generate-method-action-types.ts`.
* Do not edit manually.
*/

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

/**
* Creates a Money keyring derived from the primary HD keyring, and returns
* the associated account.
*
* If a Money keyring already exists, returns undefined.
*
* @returns The account of the newly created Money keyring, or undefined if one already existed.
*/
export type MoneyAccountServiceCreateMoneyAccountAction = {
type: `MoneyAccountService:createMoneyAccount`;
handler: MoneyAccountService['createMoneyAccount'];
};

/**
* Returns the account associated with the Money keyring, or undefined if none exists.
*
* @returns The Money keyring account, or undefined if none exists.
*/
export type MoneyAccountServiceGetMoneyAccountAction = {
type: `MoneyAccountService:getMoneyAccount`;
handler: MoneyAccountService['getMoneyAccount'];
};

/**
* Returns the account wallet associated with the Money keyring, or undefined if none exists.
*
* @returns The Money keyring account wallet, or undefined if none exists.
*/
export type MoneyAccountServiceGetMoneyAccountWalletAction = {
type: `MoneyAccountService:getMoneyAccountWallet`;
handler: MoneyAccountService['getMoneyAccountWallet'];
};

/**
* Returns the account group associated with the Money keyring, or undefined if none exists.
*
* @returns The account group of the Money keyring, or undefined if none exists.
*/
export type MoneyAccountServiceGetMoneyAccountGroupAction = {
type: `MoneyAccountService:getMoneyAccountGroup`;
handler: MoneyAccountService['getMoneyAccountGroup'];
};

/**
* Union of all MoneyAccountService action types.
*/
export type MoneyAccountServiceMethodActions =
| MoneyAccountServiceCreateMoneyAccountAction
| MoneyAccountServiceGetMoneyAccountAction
| MoneyAccountServiceGetMoneyAccountWalletAction
| MoneyAccountServiceGetMoneyAccountGroupAction;
Loading
Loading