Skip to content

Commit d88da8a

Browse files
committed
Resolved merge conflict by incorporating both suggestions
2 parents a07a1e6 + 4433150 commit d88da8a

17 files changed

+1180
-744
lines changed

constraints.pro

-7
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,3 @@ gen_enforced_field(WorkspaceCwd, 'publishConfig.registry', 'https://registry.npm
396396
% whatsoever.
397397
gen_enforced_field(WorkspaceCwd, 'publishConfig', null) :-
398398
workspace_field(WorkspaceCwd, 'private', true).
399-
400-
% eth-method-registry has an unlisted dependency on babel-runtime (via `ethjs->ethjs-query`), so
401-
% that package needs to be present if eth-method-registry is present.
402-
gen_enforced_dependency(WorkspaceCwd, 'babel-runtime', '^6.26.0', 'peerDependencies') :-
403-
workspace_has_dependency(WorkspaceCwd, 'eth-method-registry', _, 'dependencies').
404-
gen_enforced_dependency(WorkspaceCwd, 'babel-runtime', '^6.26.0', 'devDependencies') :-
405-
workspace_has_dependency(WorkspaceCwd, 'eth-method-registry', _, 'dependencies').

packages/assets-controllers/CHANGELOG.md

+36-11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- **BREAKING:** Adds `@metamask/accounts-controller` ^8.0.0 and `@metamask/keyring-controller` ^12.0.0 as dependencies and peer dependencies. ([#3775](https://github.com/MetaMask/core/pull/3775/)).
13+
- **BREAKING:** `TokenDetectionController` newly subscribes to the `PreferencesController:stateChange`, `AccountsController:selectedAccountChange`, `KeyringController:lock`, `KeyringController:unlock` events, and allows the `PreferencesController:getState` messenger action. ([#3775](https://github.com/MetaMask/core/pull/3775/))
14+
- `TokensController` now exports `TokensControllerActions`, `TokensControllerGetStateAction`, `TokensControllerAddDetectedTokensAction`, `TokensControllerEvents`, `TokensControllerStateChangeEvent`. ([#3690](https://github.com/MetaMask/core/pull/3690/))
15+
16+
### Changed
17+
18+
- **BREAKING:** `TokenDetectionController` is merged with `DetectTokensController` from the `metamask-extension` repo. ([#3775](https://github.com/MetaMask/core/pull/3775/))
19+
- **BREAKING:** `TokenDetectionController` now resets its polling interval to the default value of 3 minutes when token detection is triggered by external controller events `KeyringController:unlock`, `TokenListController:stateChange`, `PreferencesController:stateChange`, `AccountsController:selectedAccountChange`.
20+
- **BREAKING:** `TokenDetectionController` now refetches tokens on `NetworkController:networkDidChange` if the `networkClientId` is changed instead of `chainId`.
21+
- **BREAKING:** `TokenDetectionController` cannot initiate polling or token detection if `KeyringController` state is locked.
22+
- **BREAKING:** The `detectTokens` method now excludes tokens that are already included in the `TokensController`'s `detectedTokens` list from the batch of incoming tokens it sends to the `TokensController` `addDetectedTokens` method.
23+
- **BREAKING:** The constructor for `TokenDetectionController` expects a new required proprerty `trackMetaMetricsEvent`, which defines the callback that is called in the `detectTokens` method.
24+
- **BREAKING:** In Mainnet, even if the `PreferenceController`'s `useTokenDetection` option is set to false, automatic token detection is performed on the legacy token list (token data from the contract-metadata repo).
25+
- **BREAKING:** The `TokensState` type is now defined as a type alias rather than an interface. ([#3690](https://github.com/MetaMask/core/pull/3690/))
26+
- This is breaking because it could affect how this type is used with other types, such as `Json`, which does not support TypeScript interfaces.
27+
28+
### Removed
29+
30+
- **BREAKING:** `TokenDetectionController` constructor no longer accepts options `onPreferencesStateChange`, `getPreferencesState`, `getTokensState`, `addDetectedTokens`. ([#3690](https://github.com/MetaMask/core/pull/3690/), [#3775](https://github.com/MetaMask/core/pull/3775/))
31+
- **BREAKING:** `TokenDetectionController` no longer allows the `NetworkController:stateChange` event. The `NetworkController:networkDidChange` event can be used instead. ([#3775](https://github.com/MetaMask/core/pull/3775/))
32+
- **BREAKING:** `TokensController` constructor no longer accepts options `onPreferencesStateChange`, `onNetworkDidChange`, `onTokenListStateChange`, `getNetworkClientById`. ([#3690](https://github.com/MetaMask/core/pull/3690/))
33+
- **BREAKING:** `TokenBalancesController` constructor no longer accepts options `onTokensStateChange`, `getSelectedAddress`. ([#3690](https://github.com/MetaMask/core/pull/3690/))
34+
1035
## [25.0.0]
1136

1237
### Added
@@ -116,8 +141,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
116141
- These are needed for the new "polling by `networkClientId`" feature
117142
- **BREAKING:** `AccountTrackerController` has a new required state property, `accountByChainId`([#3586](https://github.com/MetaMask/core/pull/3586))
118143
- This is needed to track balances accross chains. It was introduced for the "polling by `networkClientId`" feature, but is useful on its own as well.
119-
- **BREAKING**: `AccountTrackerController` adds a mutex to `refresh` making it only possible for one call to be executed at time ([#3586](https://github.com/MetaMask/core/pull/3586))
120-
- **BREAKING**: `TokensController.watchAsset` now performs on-chain validation of the asset's symbol and decimals, if they're defined in the contract ([#1745](https://github.com/MetaMask/core/pull/1745))
144+
- **BREAKING:** `AccountTrackerController` adds a mutex to `refresh` making it only possible for one call to be executed at time ([#3586](https://github.com/MetaMask/core/pull/3586))
145+
- **BREAKING:** `TokensController.watchAsset` now performs on-chain validation of the asset's symbol and decimals, if they're defined in the contract ([#1745](https://github.com/MetaMask/core/pull/1745))
121146
- The `TokensController` constructor no longer accepts a `getERC20TokenName` option. It was no longer needed due to this change.
122147
- Add new method `_getProvider`, though this is intended for internal use and should not be called externally.
123148
- Additionally, if the symbol and decimals are defined in the contract, they are no longer required to be passed to `watchAsset`
@@ -148,10 +173,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
148173
- This method was previously used in TokenRatesController to access the CoinGecko API. There is no equivalent.
149174
- **BREAKING:** Remove `CoinGeckoResponse` and `CoinGeckoPlatform` types ([#3600](https://github.com/MetaMask/core/pull/3600))
150175
- These types were previously used in TokenRatesController to represent data returned from the CoinGecko API. There is no equivalent.
151-
- **BREAKING**: The TokenRatesController now only supports updating and polling rates for tokens tracked by the TokensController ([#3639](https://github.com/MetaMask/core/pull/3639))
176+
- **BREAKING:** The TokenRatesController now only supports updating and polling rates for tokens tracked by the TokensController ([#3639](https://github.com/MetaMask/core/pull/3639))
152177
- The `tokenAddresses` option has been removed from `startPollingByNetworkClientId`
153178
- The `tokenContractAddresses` option has been removed from `updateExchangeRatesByChainId`
154-
- **BREAKING**: `TokenRatesController.fetchAndMapExchangeRates` is no longer exposed publicly ([#3621](https://github.com/MetaMask/core/pull/3621))
179+
- **BREAKING:** `TokenRatesController.fetchAndMapExchangeRates` is no longer exposed publicly ([#3621](https://github.com/MetaMask/core/pull/3621))
155180

156181
### Fixed
157182

@@ -235,7 +260,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
235260
```
236261
- **BREAKING**: `CurrencyRateController` now extends `PollingController` ([#1805](https://github.com/MetaMask/core/pull/1805))
237262
- `start()` and `stop()` methods replaced with `startPollingByNetworkClientId()`, `stopPollingByPollingToken()`, and `stopAllPolling()`
238-
- **BREAKING**: `CurrencyRateController` now sends the `NetworkController:getNetworkClientById` action via messaging controller ([#1805](https://github.com/MetaMask/core/pull/1805))
263+
- **BREAKING:** `CurrencyRateController` now sends the `NetworkController:getNetworkClientById` action via messaging controller ([#1805](https://github.com/MetaMask/core/pull/1805))
239264
240265
### Fixed
241266
@@ -340,7 +365,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
340365
networkClientId?: NetworkClientId;
341366
}
342367
```
343-
- **BREAKING**: Bump peer dependency on `@metamask/network-controller` to ^13.0.0 ([#1633](https://github.com/MetaMask/core/pull/1633))
368+
- **BREAKING:** Bump peer dependency on `@metamask/network-controller` to ^13.0.0 ([#1633](https://github.com/MetaMask/core/pull/1633))
344369
- **CHANGED**: `TokensController.addToken` will use the chain ID value derived from state for `networkClientId` if provided ([#1676](https://github.com/MetaMask/core/pull/1676))
345370
- **CHANGED**: `TokensController.addTokens` now accepts an optional `networkClientId` as the last parameter ([#1676](https://github.com/MetaMask/core/pull/1676))
346371
- **CHANGED**: `TokensController.addTokens` will use the chain ID value derived from state for `networkClientId` if provided ([#1676](https://github.com/MetaMask/core/pull/1676))
@@ -405,13 +430,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
405430
406431
- **BREAKING**: New required constructor parameters for the `TokenRatesController` ([#1497](https://github.com/MetaMask/core/pull/1497), [#1511](https://github.com/MetaMask/core/pull/1511))
407432
- The new required parameters are `ticker`, `onSelectedAddress`, and `onPreferencesStateChange`
408-
- **BREAKING**: Remove `onCurrencyRateStateChange` constructor parameter from `TokenRatesController` ([#1496](https://github.com/MetaMask/core/pull/1496))
409-
- **BREAKING**: Disable `TokenRatesController` automatic polling ([#1501](https://github.com/MetaMask/core/pull/1501))
433+
- **BREAKING:** Remove `onCurrencyRateStateChange` constructor parameter from `TokenRatesController` ([#1496](https://github.com/MetaMask/core/pull/1496))
434+
- **BREAKING:** Disable `TokenRatesController` automatic polling ([#1501](https://github.com/MetaMask/core/pull/1501))
410435
- Polling must be started explicitly by calling the `start` method
411436
- The token rates are not updated upon state changes when polling is disabled.
412-
- **BREAKING**: Replace the `poll` method with `start` ([#1501](https://github.com/MetaMask/core/pull/1501))
437+
- **BREAKING:** Replace the `poll` method with `start` ([#1501](https://github.com/MetaMask/core/pull/1501))
413438
- The `start` method does not offer a way to change the interval. That must be done by calling `.configure` instead
414-
- **BREAKING**: Remove `TokenRatecontroller` setter for `chainId` and `tokens` properties ([#1505](https://github.com/MetaMask/core/pull/1505))
439+
- **BREAKING:** Remove `TokenRatecontroller` setter for `chainId` and `tokens` properties ([#1505](https://github.com/MetaMask/core/pull/1505))
415440
- Bump @metamask/abi-utils from 1.2.0 to 2.0.1 ([#1525](https://github.com/MetaMask/core/pull/1525))
416441
- Update `@metamask/utils` to `^6.2.0` ([#1514](https://github.com/MetaMask/core/pull/1514))
417442
- Remove unnecessary `babel-runtime` dependency ([#1504](https://github.com/MetaMask/core/pull/1504))
@@ -500,7 +525,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
500525
- The tokens controller `addDetectedTokens` method now accepts the `chainId` property of the `detectionDetails` parameter to be of type `Hex` rather than decimal `string`.
501526
- The tokens controller state properties `allTokens`, `allIgnoredTokens`, and `allDetectedTokens` are now keyed by chain ID in `Hex` format rather than decimal `string`.
502527
- This requires a state migration
503-
- **BREAKING**: Use approval controller for suggested assets ([#1261](https://github.com/MetaMask/core/pull/1261), [#1268](https://github.com/MetaMask/core/pull/1268))
528+
- **BREAKING:** Use approval controller for suggested assets ([#1261](https://github.com/MetaMask/core/pull/1261), [#1268](https://github.com/MetaMask/core/pull/1268))
504529
- The actions `ApprovalController:acceptRequest` and `ApprovalController:rejectRequest` are no longer required by the token controller messenger.
505530
- The `suggestedAssets` state has been removed, which means that suggested assets are no longer persisted in state
506531
- The return type for `watchAsset` has changed. It now returns a Promise that settles after the request has been confirmed or rejected.

packages/assets-controllers/jest.config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ module.exports = merge(baseConfig, {
1717
// An object that configures minimum threshold enforcement for coverage results
1818
coverageThreshold: {
1919
global: {
20-
branches: 89.29,
21-
functions: 97.74,
22-
lines: 97.64,
23-
statements: 97.68,
20+
branches: 88.47,
21+
functions: 95.89,
22+
lines: 96.87,
23+
statements: 96.87,
2424
},
2525
},
2626

packages/assets-controllers/package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@
3636
"@ethersproject/contracts": "^5.7.0",
3737
"@ethersproject/providers": "^5.7.0",
3838
"@metamask/abi-utils": "^2.0.2",
39+
"@metamask/accounts-controller": "^10.0.0",
3940
"@metamask/approval-controller": "^5.1.2",
4041
"@metamask/base-controller": "^4.1.1",
4142
"@metamask/contract-metadata": "^2.4.0",
4243
"@metamask/controller-utils": "^8.0.2",
4344
"@metamask/eth-query": "^4.0.0",
45+
"@metamask/keyring-controller": "^12.2.0",
4446
"@metamask/metamask-eth-abis": "3.0.0",
4547
"@metamask/network-controller": "^17.2.0",
4648
"@metamask/polling-controller": "^5.0.0",
@@ -58,7 +60,8 @@
5860
},
5961
"devDependencies": {
6062
"@metamask/auto-changelog": "^3.4.4",
61-
"@metamask/ethjs-provider-http": "^0.2.0",
63+
"@metamask/ethjs-provider-http": "^0.3.0",
64+
"@metamask/keyring-api": "^3.0.0",
6265
"@types/jest": "^27.4.1",
6366
"@types/lodash": "^4.14.191",
6467
"@types/node": "^16.18.54",
@@ -73,7 +76,9 @@
7376
"typescript": "~4.8.4"
7477
},
7578
"peerDependencies": {
79+
"@metamask/accounts-controller": "^10.0.0",
7680
"@metamask/approval-controller": "^5.1.2",
81+
"@metamask/keyring-controller": "^12.2.0",
7782
"@metamask/network-controller": "^17.2.0",
7883
"@metamask/preferences-controller": "^7.0.0"
7984
},

0 commit comments

Comments
 (0)