Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
30ed126
feat: initial accounts controller commit
montelaidev Aug 28, 2023
2b66b11
fix: add eth-snap-keyring dep
montelaidev Aug 28, 2023
a03745e
fix: double negative in legacy account filter
montelaidev Aug 28, 2023
8f86aa7
fix: fix linting warning
danroc Aug 29, 2023
7fccb78
chore: run `yarn dedupe`
danroc Aug 29, 2023
a4aa0af
fix: add missing types package
danroc Aug 29, 2023
e104cf5
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
danroc Aug 29, 2023
14c98e4
chore: update CHANGELOG
danroc Aug 29, 2023
d3eda70
fix: changelog:validate to accounts-controller
montelaidev Aug 29, 2023
7c64ed8
fix: update accounts controller to not use code fences
montelaidev Aug 30, 2023
223b38d
feat: add initial test file
montelaidev Aug 30, 2023
5472cce
feat: add setSelectedAccount, getSelectedAccount, setAccountName tests
montelaidev Aug 30, 2023
78115a7
fix: lower coverage temporarily
montelaidev Aug 30, 2023
b518f7f
feat: tests for getAccountExpect, listAccounts, getAccount
montelaidev Aug 30, 2023
77b0595
feat: add tests for updateAccounts, loadBackup
montelaidev Aug 30, 2023
4fc9f9c
feat: add onSnapStateChange tests
montelaidev Aug 30, 2023
a59fab5
feat: add onKeyringStateChange tests
montelaidev Aug 30, 2023
cbd11a4
chore: lint
montelaidev Aug 30, 2023
4c272a7
chore: fix lint in package.json
montelaidev Aug 30, 2023
e5d9717
Merge branch 'main' into feat/accounts-controller
montelaidev Aug 30, 2023
46bc273
Merge branch 'main' into feat/accounts-controller
montelaidev Aug 31, 2023
4b781ce
chore: update yarn.lock
montelaidev Aug 31, 2023
545dd17
fix: change from default export and fix version
montelaidev Aug 31, 2023
40e8144
fix: update tests and bump coverage
montelaidev Sep 4, 2023
2c6baae
chore: use keyring-api 0.2.2 and eth-snap-keyring 0.2
montelaidev Sep 5, 2023
3db13e4
chore: update yarn.lock
montelaidev Sep 6, 2023
de8a8b5
chore: bump keyring controller dep in accounts controller
montelaidev Sep 6, 2023
008e45c
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
montelaidev Sep 6, 2023
49fb4ca
chore: update yarn.lock after merge
montelaidev Sep 6, 2023
0086334
fix: update peerdep
montelaidev Sep 6, 2023
c338244
chore: update yarn.lock
montelaidev Sep 6, 2023
f6a74c5
feat: add jsdocs
montelaidev Sep 6, 2023
dd5d578
feat: use messaging system to subscribe to snap and keyring state cha…
montelaidev Sep 7, 2023
6681dbe
fix: use EthMethod
montelaidev Sep 7, 2023
da0782e
chore: remove log
montelaidev Sep 7, 2023
573305c
fix: lint issue
montelaidev Sep 8, 2023
e521e20
fix: add jsdoc for #handleOnSnapStateChange and #handleOnKeyringState…
montelaidev Sep 8, 2023
6b2dea8
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
montelaidev Sep 8, 2023
e50cea2
chore: bump keyring dep
montelaidev Sep 8, 2023
54478a6
chore: update yarn.lock
montelaidev Sep 8, 2023
b08c994
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
montelaidev Sep 8, 2023
2368fa7
feat: add check for disabled snap accounts, or missing snap accounts
montelaidev Sep 11, 2023
69c9572
feat: use actions instead of importing keyringcontroller methods
montelaidev Sep 18, 2023
c7150a9
feat: add new AccountsController actions
montelaidev Sep 18, 2023
8ca81bb
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
montelaidev Sep 18, 2023
22e8000
fix: register the new actions to the messagingSystem
montelaidev Sep 18, 2023
f0f357a
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
montelaidev Sep 18, 2023
369440a
feat: add tests for actions
montelaidev Sep 18, 2023
ab82243
fix: changes accounts with unknown keyring to throw and error
montelaidev Sep 18, 2023
6d237b4
feat: add tests for new actions in KeyringController
montelaidev Sep 19, 2023
c237821
fix: remove comment
montelaidev Sep 19, 2023
c5136a4
chore: bump dep
montelaidev Sep 19, 2023
c5bf6b3
Merge branch 'main' into feat/accounts-controller
montelaidev Sep 20, 2023
d6a4f88
fix: rename legacyAccounts to normalAccounts
montelaidev Sep 20, 2023
ba6f5fe
fix: bump coverage to 100
montelaidev Sep 21, 2023
e743dfb
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
montelaidev Sep 21, 2023
2c2fa52
fix: bump jest coverage requirements, and update dependencies
montelaidev Sep 21, 2023
bf9b101
Update packages/accounts-controller/src/AccountsController.ts
montelaidev Sep 21, 2023
aaaa3ae
fix: remove unused ts-ignore and update legacy to normal
montelaidev Sep 21, 2023
834facc
fix: add @metamask/util dep
montelaidev Sep 21, 2023
0414e45
fix: readd deepmerge
montelaidev Sep 21, 2023
8c33bef
chore: update yarn.lock
montelaidev Sep 21, 2023
d5e3b8e
fix: roll back peerDep removal
montelaidev Sep 21, 2023
27ae5f3
fix: remove controller-utils from tsconfig
montelaidev Sep 21, 2023
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
11 changes: 11 additions & 0 deletions packages/accounts-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 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

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

Copyright (c) 2018 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/accounts-controller/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# `@metamask/accounts-controller`

Manages internal accounts used in place of regular ethereum addresses.

## Installation

`yarn add @metamask/accounts-controller`

or

`npm install @metamask/accounts-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/accounts-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,
},
},
});
65 changes: 65 additions & 0 deletions packages/accounts-controller/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "@metamask/accounts-controller",
"version": "0.0.0",
"description": "Manages internal accounts",
"keywords": [
"MetaMask",
"Ethereum"
],
"homepage": "https://github.com/MetaMask/core/tree/main/packages/accounts-controller#readme",
"bugs": {
"url": "https://github.com/MetaMask/core/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/core.git"
},
"license": "MIT",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist/"
],
"scripts": {
"build:docs": "typedoc",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/accounts-controller",
"publish:preview": "yarn npm publish --tag preview",
"test": "jest",
"test:watch": "jest --watch"
},
"dependencies": {
"@metamask/base-controller": "^3.2.1",
"@metamask/eth-snap-keyring": "^0.2.2",
"@metamask/keyring-api": "^0.2.5",
"@metamask/snaps-utils": "^1.0.1",
"@metamask/utils": "^6.2.0",
"deepmerge": "^4.2.2",
"eth-rpc-errors": "^4.0.2",
"ethereumjs-util": "^7.0.10",
"immer": "^9.0.6",
"nanoid": "^3.1.31",
"uuid": "^8.3.2"
},
"devDependencies": {
"@metamask/auto-changelog": "^3.1.0",
"@metamask/keyring-controller": "^7.4.0",
"@metamask/snaps-controllers": "^1.0.1",
"@types/jest": "^27.4.1",
"@types/readable-stream": "^2.3.0",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"typedoc": "^0.22.15",
"typedoc-plugin-missing-exports": "^0.22.6",
"typescript": "~4.6.3"
},
"peerDependencies": {
"@metamask/keyring-controller": "^7.4.0"
Copy link
Member

Choose a reason for hiding this comment

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

We can probably remove this and leave it in devDependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, we can remove the peerDependencies. Changed in 2c2fa52

Copy link
Member

@mikesposito mikesposito Sep 21, 2023

Choose a reason for hiding this comment

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

I might have given a wrong suggestion here:
Seeing how we use messenger events/actions types in other packages, we usually include the package they come from in dependencies and peerDependencies, probably to ensure that we use the same versions of that package across the dep tree

@Gudahtt might have more insights on this, but I think we should rollback these changes - sorry about that.

Copy link
Contributor Author

@montelaidev montelaidev Sep 21, 2023

Choose a reason for hiding this comment

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

no problem, the change has been rolled back in d5e3b8e

},
"engines": {
"node": ">=16.0.0"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
Loading