Skip to content

Commit cc7e39b

Browse files
Merge branch 'main' into refactor/7079_update_analytics_controller
2 parents 21a5dda + 3459847 commit cc7e39b

File tree

161 files changed

+5032
-4734
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+5032
-4734
lines changed

.github/pull_request_template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ For example:
2727

2828
- [ ] I've updated the test suite for new or updated code as appropriate
2929
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
30-
- [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary
31-
- [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
30+
- [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs)
31+
- [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

docs/breaking-changes.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Preparing & Releasing Breaking Changes
2+
3+
When developing packages, it is always important to be intentional about the impact that changes have on projects which use those packages. However, special consideration must be given to breaking changes.
4+
5+
This guide provides best practices for documenting, preparing, releasing, and adapting to breaking changes within `core` and in other projects.
6+
7+
## What is a breaking change?
8+
9+
A change to a package is "breaking" if upgrading a project to a version containing the change would require modifications to source code or configuration in order to avoid user- or developer-facing problems (an inability to use or build the project, a loss of functionality, etc.).
10+
11+
There are many kinds of breaking changes. Here are some examples:
12+
13+
- Removals
14+
- Removing a method from a class
15+
- Removing an export from a package (including a type export)
16+
- Functional changes that require code changes or change expectations
17+
- Changing the number of required arguments for a function or method
18+
- Throwing a new error in a function or method
19+
- Changing a function or method so that it no longer fires an event
20+
- Breaking changes to types
21+
- Adding external actions or events to a messenger type
22+
- Narrowing the type of an argument in a function or method
23+
- Changing the number of required properties in an object type
24+
- Narrowing the type of a property in an object type
25+
- Changing the number of type parameters for a type
26+
- Making any other change listed [here](https://www.semver-ts.org/formal-spec/2-breaking-changes.html)
27+
- Bumping the minimum supported Node.js version of a package
28+
- Upgrading a dependency referenced in published code to a version that causes any of the above
29+
30+
## Introducing breaking changes safely
31+
32+
Before merging a PR that introduces breaking changes, it is important to ensure that they are accounted for among projects.
33+
34+
### 1. Document breaking changes
35+
36+
To inform other maintainers now and in the future, make sure that breaking changes are documented in the changelog:
37+
38+
1. Be explicit in your changelog entries about which classes, functions, types, etc. are affected.
39+
2. Prefix entries with `**BREAKING:**`.
40+
3. If relevant, provide details on how consuming code can adapt to the changes safely.
41+
4. Move entries for breaking changes above all other kinds of changes within the same section.
42+
43+
For example:
44+
45+
```markdown
46+
### Changed
47+
48+
- **BREAKING:** Add a required `source` argument to `getTransactions` ([#1111](https://github.com/MetaMask/core/pull/1111))
49+
- **BREAKING:** Rename `Prices` to `PricesResponse` ([#2222](https://github.com/MetaMask/core/pull/2222))
50+
- **BREAKING:** `destroy` is now async ([#3333](https://github.com/MetaMask/core/pull/3333))
51+
- Widen the type of `getNetworkClientId` to return `string` ([#4444](https://github.com/MetaMask/core/pull/4444))
52+
53+
### Removed
54+
55+
- **BREAKING:** Remove `fetchGasPrices` from `GasPricesController` ([#5555](https://github.com/MetaMask/core/pull/5555))
56+
- Please use `GasPriceService` instead.
57+
```
58+
59+
### 2. Audit dependents
60+
61+
When you release your changes, which codebases will be affected?
62+
63+
Using the changelog as a guide, locate all of the places across MetaMask that use the affected classes, functions, types, etc.:
64+
65+
- To find dependents of your package within `core`, look in the package's `package.json`, or simply search across the repo.
66+
- To find dependents of your package across MetaMask, do a search on GitHub for import statements or, better, usages of the affected symbols.
67+
68+
### 3. Prepare upgrade PRs for dependents
69+
70+
Finally, how will dependent projects need to adapt to your breaking changes?
71+
72+
For dependent packages located in `core`, you may get type errors immediately that you will have to fix in the same PR that introduces the breaking changes. Otherwise, create new PRs to migrate existing code.
73+
74+
For other projects that live outside of `core`, you can use the following process to verify the effects:
75+
76+
1. Create a [preview build](./contributing.md#testing-changes-to-packages-with-preview-builds) for your package.
77+
2. Open draft PRs in the dependent projects.
78+
3. In each draft PR, upgrade your package to the preview build.
79+
4. Test the project, particularly the functionality that makes use of your package.
80+
5. If you see compile-time or runtime errors, make changes to the project as necessary.
81+
6. If you discover new breaking changes in your package that you haven't yet listed in the changelog, go back and [document them](#1-document-breaking-changes).
82+
7. Once you've done this for all projects, check off the "I've followed the process for releasing breaking changes" item in the checklist at the bottom of your PR.
83+
84+
This process serves as a check to help you understand the full impact of your changes. It will also save you time after you make a new release, because you can reuse the draft PRs later to complete upgrades.

docs/contributing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [Creating pull requests](#creating-pull-requests)
1212
- [Testing changes to packages in another project](#testing-changes-to-packages-in-another-project)
1313
- [Releasing changes](#releasing-changes)
14+
- [Preparing and releasing breaking changes](./breaking-changes.md)
1415
- [Performing operations across the monorepo](#performing-operations-across-the-monorepo)
1516
- [Adding new packages to the monorepo](#adding-new-packages-to-the-monorepo)
1617

@@ -201,6 +202,7 @@ Have changes that you need to release? There are a few things to understand:
201202
- The responsibility of maintenance is not the only thing shared among multiple teams at MetaMask; releases are as well. That means **if you work on a team that has codeownership over a package, you are free to create a new release without needing the Wallet Framework team to do so.**
202203
- Unlike clients, releases are not issued on a schedule; **anyone may create a release at any time**. Because of this, you may wish to review the Pull Requests tab on GitHub and ensure that no one else has a release candidate already in progress. If not, then you are free to start the process.
203204
- The release process is a work in progress. Further improvements to simplify the process are planned, but in the meantime, if you encounter any issues, please reach out to the Wallet Framework team.
205+
- Breaking changes take special consideration. [Read the guide](./breaking-changes.md) on how to prepare and handle them effectively.
204206
205207
Now for the process itself, you have two options: using our interactive UI (recommended for most users) or manual specification.
206208

docs/reviewing-release-prs.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,9 @@ With that in mind, there are three ways changes can be categorized:
9090

9191
### Breaking changes
9292

93-
A change is "breaking" if it is included in a version of a package, which, after a consumer upgrades to it and makes no further changes, causes one of the following:
94-
95-
- An error at runtime
96-
- An error at compile time (e.g., a TypeScript type error)
97-
- An error at install time (e.g., the consumer's package manager reports a Node version incompatibility)
98-
- A surprising difference in behavior
99-
100-
Given this, there are many ways a change could be regarded as breaking:
101-
102-
- Changing a function or method to throw an error
103-
- Adding a required argument to a function or method
104-
- Adding a required property to a TypeScript type
105-
- Narrowing the type of a property in a TypeScript type
106-
- Narrowing the type of an argument in a function
107-
- Adding or removing a parameter to a TypeScript type
108-
- Upgrading a runtime dependency to a version which causes any of the above
109-
- Removing an export from the package
110-
- Bumping the minimum supported Node.js version
93+
A change is "breaking" if upgrading a project to a version containing the change would require modifications to source code or configuration in order to avoid user- or developer-facing problems (an inability to use or build the project, a loss of functionality, etc.).
94+
95+
There are many kinds of breaking changes. You can find a list of examples [here](./breaking-changes.md#what-is-a-breaking-change).
11196

11297
### Additions
11398

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/core-monorepo",
3-
"version": "686.0.0",
3+
"version": "690.0.0",
44
"private": true,
55
"description": "Monorepo for packages shared between MetaMask clients",
66
"repository": {
@@ -60,10 +60,10 @@
6060
"@metamask/eslint-config-jest": "^14.1.0",
6161
"@metamask/eslint-config-nodejs": "^14.0.0",
6262
"@metamask/eslint-config-typescript": "^14.1.0",
63-
"@metamask/eth-block-tracker": "^14.0.0",
64-
"@metamask/eth-json-rpc-provider": "^5.0.1",
65-
"@metamask/json-rpc-engine": "^10.1.1",
66-
"@metamask/network-controller": "^25.0.0",
63+
"@metamask/eth-block-tracker": "^15.0.0",
64+
"@metamask/eth-json-rpc-provider": "^6.0.0",
65+
"@metamask/json-rpc-engine": "^10.2.0",
66+
"@metamask/network-controller": "^26.0.0",
6767
"@metamask/utils": "^11.8.1",
6868
"@ts-bridge/cli": "^0.6.4",
6969
"@types/jest": "^27.4.1",

packages/account-tree-controller/CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [4.0.0]
11+
12+
### Changed
13+
14+
- **BREAKING:** Bump `@metamask/profile-sync-controller` from `^26.0.0` to `^27.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
15+
- **BREAKING:** Bump `@metamask/multichain-account-service` from `^3.0.0` to `^4.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
16+
- **BREAKING:** Bump `@metamask/keyring-controller` from `^24.0.0` to `^25.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
17+
- **BREAKING:** Bump `@metamask/accounts-controller` from `^34.0.0` to `^35.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
18+
1019
## [3.0.0]
1120

1221
### Changed
@@ -399,7 +408,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
399408
- Initial release ([#5847](https://github.com/MetaMask/core/pull/5847))
400409
- Grouping accounts into 3 main categories: Entropy source, Snap ID, keyring types.
401410

402-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/account-tree-controller@3.0.0...HEAD
411+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/account-tree-controller@4.0.0...HEAD
412+
[4.0.0]: https://github.com/MetaMask/core/compare/@metamask/account-tree-controller@3.0.0...@metamask/account-tree-controller@4.0.0
403413
[3.0.0]: https://github.com/MetaMask/core/compare/@metamask/account-tree-controller@2.0.0...@metamask/account-tree-controller@3.0.0
404414
[2.0.0]: https://github.com/MetaMask/core/compare/@metamask/account-tree-controller@1.6.0...@metamask/account-tree-controller@2.0.0
405415
[1.6.0]: https://github.com/MetaMask/core/compare/@metamask/account-tree-controller@1.5.0...@metamask/account-tree-controller@1.6.0

packages/account-tree-controller/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/account-tree-controller",
3-
"version": "3.0.0",
3+
"version": "4.0.0",
44
"description": "Controller to group account together based on some pre-defined rules",
55
"keywords": [
66
"MetaMask",
@@ -59,12 +59,12 @@
5959
},
6060
"devDependencies": {
6161
"@metamask/account-api": "^0.12.0",
62-
"@metamask/accounts-controller": "^34.0.0",
62+
"@metamask/accounts-controller": "^35.0.0",
6363
"@metamask/auto-changelog": "^3.4.4",
6464
"@metamask/keyring-api": "^21.0.0",
65-
"@metamask/keyring-controller": "^24.0.0",
66-
"@metamask/multichain-account-service": "^3.0.0",
67-
"@metamask/profile-sync-controller": "^26.0.0",
65+
"@metamask/keyring-controller": "^25.0.0",
66+
"@metamask/multichain-account-service": "^4.0.0",
67+
"@metamask/profile-sync-controller": "^27.0.0",
6868
"@metamask/providers": "^22.1.0",
6969
"@metamask/snaps-controllers": "^14.0.1",
7070
"@ts-bridge/cli": "^0.6.4",
@@ -79,10 +79,10 @@
7979
},
8080
"peerDependencies": {
8181
"@metamask/account-api": "^0.12.0",
82-
"@metamask/accounts-controller": "^34.0.0",
83-
"@metamask/keyring-controller": "^24.0.0",
84-
"@metamask/multichain-account-service": "^3.0.0",
85-
"@metamask/profile-sync-controller": "^26.0.0",
82+
"@metamask/accounts-controller": "^35.0.0",
83+
"@metamask/keyring-controller": "^25.0.0",
84+
"@metamask/multichain-account-service": "^4.0.0",
85+
"@metamask/profile-sync-controller": "^27.0.0",
8686
"@metamask/providers": "^22.0.0",
8787
"@metamask/snaps-controllers": "^14.0.0",
8888
"webextension-polyfill": "^0.10.0 || ^0.11.0 || ^0.12.0"

packages/accounts-controller/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [35.0.0]
11+
12+
### Changed
13+
14+
- **BREAKING:** Bump `@metamask/network-controller` from `^25.0.0` to `^26.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
15+
- **BREAKING:** Bump `@metamask/keyring-controller` from `^24.0.0` to `^25.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
16+
1017
## [34.0.0]
1118

1219
### Changed
@@ -649,7 +656,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
649656

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

652-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@34.0.0...HEAD
659+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@35.0.0...HEAD
660+
[35.0.0]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@34.0.0...@metamask/accounts-controller@35.0.0
653661
[34.0.0]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@33.2.0...@metamask/accounts-controller@34.0.0
654662
[33.2.0]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@33.1.1...@metamask/accounts-controller@33.2.0
655663
[33.1.1]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@33.1.0...@metamask/accounts-controller@33.1.1

packages/accounts-controller/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/accounts-controller",
3-
"version": "34.0.0",
3+
"version": "35.0.0",
44
"description": "Manages internal accounts",
55
"keywords": [
66
"MetaMask",
@@ -67,9 +67,9 @@
6767
},
6868
"devDependencies": {
6969
"@metamask/auto-changelog": "^3.4.4",
70-
"@metamask/controller-utils": "^11.15.0",
71-
"@metamask/keyring-controller": "^24.0.0",
72-
"@metamask/network-controller": "^25.0.0",
70+
"@metamask/controller-utils": "^11.16.0",
71+
"@metamask/keyring-controller": "^25.0.0",
72+
"@metamask/network-controller": "^26.0.0",
7373
"@metamask/providers": "^22.1.0",
7474
"@metamask/snaps-controllers": "^14.0.1",
7575
"@ts-bridge/cli": "^0.6.4",
@@ -83,8 +83,8 @@
8383
"webextension-polyfill": "^0.12.0"
8484
},
8585
"peerDependencies": {
86-
"@metamask/keyring-controller": "^24.0.0",
87-
"@metamask/network-controller": "^25.0.0",
86+
"@metamask/keyring-controller": "^25.0.0",
87+
"@metamask/network-controller": "^26.0.0",
8888
"@metamask/providers": "^22.0.0",
8989
"@metamask/snaps-controllers": "^14.0.0",
9090
"webextension-polyfill": "^0.10.0 || ^0.11.0 || ^0.12.0"

packages/address-book-controller/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [7.0.1]
11+
12+
### Changed
13+
14+
- Bump `@metamask/controller-utils` from `^11.15.0` to `^11.16.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
15+
1016
## [7.0.0]
1117

1218
### Changed
@@ -257,7 +263,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
257263

258264
All changes listed after this point were applied to this package following the monorepo conversion.
259265

260-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@7.0.0...HEAD
266+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@7.0.1...HEAD
267+
[7.0.1]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@7.0.0...@metamask/address-book-controller@7.0.1
261268
[7.0.0]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@6.2.1...@metamask/address-book-controller@7.0.0
262269
[6.2.1]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@6.2.0...@metamask/address-book-controller@6.2.1
263270
[6.2.0]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@6.1.1...@metamask/address-book-controller@6.2.0

0 commit comments

Comments
 (0)