-
-
Notifications
You must be signed in to change notification settings - Fork 268
feat: accounts controller #1637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 2b66b11
fix: add eth-snap-keyring dep
montelaidev a03745e
fix: double negative in legacy account filter
montelaidev 8f86aa7
fix: fix linting warning
danroc 7fccb78
chore: run `yarn dedupe`
danroc a4aa0af
fix: add missing types package
danroc e104cf5
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
danroc 14c98e4
chore: update CHANGELOG
danroc d3eda70
fix: changelog:validate to accounts-controller
montelaidev 7c64ed8
fix: update accounts controller to not use code fences
montelaidev 223b38d
feat: add initial test file
montelaidev 5472cce
feat: add setSelectedAccount, getSelectedAccount, setAccountName tests
montelaidev 78115a7
fix: lower coverage temporarily
montelaidev b518f7f
feat: tests for getAccountExpect, listAccounts, getAccount
montelaidev 77b0595
feat: add tests for updateAccounts, loadBackup
montelaidev 4fc9f9c
feat: add onSnapStateChange tests
montelaidev a59fab5
feat: add onKeyringStateChange tests
montelaidev cbd11a4
chore: lint
montelaidev 4c272a7
chore: fix lint in package.json
montelaidev e5d9717
Merge branch 'main' into feat/accounts-controller
montelaidev 46bc273
Merge branch 'main' into feat/accounts-controller
montelaidev 4b781ce
chore: update yarn.lock
montelaidev 545dd17
fix: change from default export and fix version
montelaidev 40e8144
fix: update tests and bump coverage
montelaidev 2c6baae
chore: use keyring-api 0.2.2 and eth-snap-keyring 0.2
montelaidev 3db13e4
chore: update yarn.lock
montelaidev de8a8b5
chore: bump keyring controller dep in accounts controller
montelaidev 008e45c
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
montelaidev 49fb4ca
chore: update yarn.lock after merge
montelaidev 0086334
fix: update peerdep
montelaidev c338244
chore: update yarn.lock
montelaidev f6a74c5
feat: add jsdocs
montelaidev dd5d578
feat: use messaging system to subscribe to snap and keyring state cha…
montelaidev 6681dbe
fix: use EthMethod
montelaidev da0782e
chore: remove log
montelaidev 573305c
fix: lint issue
montelaidev e521e20
fix: add jsdoc for #handleOnSnapStateChange and #handleOnKeyringState…
montelaidev 6b2dea8
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
montelaidev e50cea2
chore: bump keyring dep
montelaidev 54478a6
chore: update yarn.lock
montelaidev b08c994
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
montelaidev 2368fa7
feat: add check for disabled snap accounts, or missing snap accounts
montelaidev 69c9572
feat: use actions instead of importing keyringcontroller methods
montelaidev c7150a9
feat: add new AccountsController actions
montelaidev 8ca81bb
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
montelaidev 22e8000
fix: register the new actions to the messagingSystem
montelaidev f0f357a
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
montelaidev 369440a
feat: add tests for actions
montelaidev ab82243
fix: changes accounts with unknown keyring to throw and error
montelaidev 6d237b4
feat: add tests for new actions in KeyringController
montelaidev c237821
fix: remove comment
montelaidev c5136a4
chore: bump dep
montelaidev c5bf6b3
Merge branch 'main' into feat/accounts-controller
montelaidev d6a4f88
fix: rename legacyAccounts to normalAccounts
montelaidev ba6f5fe
fix: bump coverage to 100
montelaidev e743dfb
Merge remote-tracking branch 'origin/main' into feat/accounts-controller
montelaidev 2c2fa52
fix: bump jest coverage requirements, and update dependencies
montelaidev bf9b101
Update packages/accounts-controller/src/AccountsController.ts
montelaidev aaaa3ae
fix: remove unused ts-ignore and update legacy to normal
montelaidev 834facc
fix: add @metamask/util dep
montelaidev 0414e45
fix: readd deepmerge
montelaidev 8c33bef
chore: update yarn.lock
montelaidev d5e3b8e
fix: roll back peerDep removal
montelaidev 27ae5f3
fix: remove controller-utils from tsconfig
montelaidev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| }, | ||
| }, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| }, | ||
| "engines": { | ||
| "node": ">=16.0.0" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public", | ||
| "registry": "https://registry.npmjs.org/" | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
devDependenciesThere was a problem hiding this comment.
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
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
dependenciesandpeerDependencies, 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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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