@metamask-previews/assets-controllers 24.0.0-preview.d357889 → 25.0.0-preview.08978bf

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -6,34 +7,82 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## [Unreleased]
8
9
 
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
+
15
+ ### Changed
16
+
17
+ - **BREAKING:** `TokenDetectionController` is merged with `DetectTokensController` from the `metamask-extension` repo. ([#3775](https://github.com/MetaMask/core/pull/3775/))
18
+ - **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`.
19
+ - **BREAKING:** `TokenDetectionController` now refetches tokens on `NetworkController:networkDidChange` if the `networkClientId` is changed instead of `chainId`.
20
+ - **BREAKING:** `TokenDetectionController` cannot initiate polling or token detection if `KeyringController` state is locked.
21
+ - **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.
22
+ - **BREAKING:** The constructor for `TokenDetectionController` expects a new required proprerty `trackMetaMetricsEvent`, which defines the callback that is called in the `detectTokens` method.
23
+ - **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).
24
+
25
+ ### Removed
26
+
27
+ - **BREAKING:** `TokenDetectionController` constructor no longer accepts options `onPreferencesStateChange`, `getPreferencesState`. ([#3775](https://github.com/MetaMask/core/pull/3775/))
28
+ - **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/))
29
+
30
+ ## [25.0.0]
31
+
32
+ ### Added
33
+
34
+ - Add Linea to price api supported chains ([#3797](https://github.com/MetaMask/core/pull/3797))
35
+
36
+ ### Changed
37
+
38
+ - **BREAKING:** Convert `TokenBalancesController` to `BaseControllerV2` ([#3750](https://github.com/MetaMask/core/pull/3750))
39
+ - The constructor parameters have changed; rather than accepting a "config" parameter for interval and tokens we now pass both values as controller options, and a "state" parameter, there is now just a single object for all constructor arguments. This object has a mandatory `messenger` and an optional `state`, `tokens`, `interval` properties a disabled property has also been added.
40
+ - State now saves tokens balances as strings and not as a BNs.
41
+ - Additional BN export has been removed as it was intended to be removed in the next major release.
42
+ - **BREAKING:** Bump `@metamask/approval-controller` peer dependency to `^5.1.2` ([#3821](https://github.com/MetaMask/core/pull/3821))
43
+ - **BREAKING:** Bump `@metamask/network-controller` peer dependency to `^17.2.0` ([#3821](https://github.com/MetaMask/core/pull/3821))
44
+ - **BREAKING:** Bump `@metamask/preferences-controller` peer dependency to `^7.0.0` ([#3821](https://github.com/MetaMask/core/pull/3821))
45
+ - Bump `@metamask/utils` to `^8.3.0` ([#3769](https://github.com/MetaMask/core/pull/3769))
46
+ - Bump `@metamask/base-controller` to `^4.1.1` ([#3760](https://github.com/MetaMask/core/pull/3760), [#3821](https://github.com/MetaMask/core/pull/3821))
47
+ - Bump `@metamask/controller-utils` to `^8.0.2` ([#3821](https://github.com/MetaMask/core/pull/3821))
48
+ - Bump `@metamask/polling-controller` to `^5.0.0` ([#3821](https://github.com/MetaMask/core/pull/3821))
49
+
9
50
  ## [24.0.0]
51
+
10
52
  ### Added
53
+
11
54
  - Add `getDefaultTokenListState` function to `TokenListController` ([#3744](https://github.com/MetaMask/core/pull/3744))
12
55
  - Add `getDefaultNftState` function to the `NftController` ([#3742](https://github.com/MetaMask/core/pull/3742))
13
56
  - Add `getDefaultTokensState` function to the `TokensController` ([#3743](https://github.com/MetaMask/core/pull/3743))
14
57
 
15
58
  ### Changed
59
+
16
60
  - **BREAKING:** Bump `@metamask/preferences-controller` to ^6.0.0
17
61
  - Price API perf improvements ([#3753](https://github.com/MetaMask/core/pull/3753), [#3755](https://github.com/MetaMask/core/pull/3755))
18
62
  - Reduce token batch size from 100 to 30
19
63
  - Sort token addresses in query params for more cache hits
20
64
 
21
65
  ## [23.1.0]
66
+
22
67
  ### Added
68
+
23
69
  - Add support to `CodefiTokenPricesServiceV2` for tracking degraded service ([#3691](https://github.com/MetaMask/core/pull/3691))
24
70
  - The constructor has two new options: `onDegraded` and `degradedThreshold`. `onDegraded` is an event handler for instances of degraded service (i.e. failed or slow requests), and `degradedThreshold` determines how slow a request has to be before we consider service to be degraded.
25
71
 
26
72
  ## [23.0.0]
73
+
27
74
  ### Added
75
+
28
76
  - Add `onBreak` handler to `CodefiTokenPricesServiceV2` ([#3677](https://github.com/MetaMask/core/pull/3677))
29
77
  - This allows listening for "circuit breaks", which can indicate an outage. Useful for metrics.
30
78
  - Add `fetchTokenContractExchangeRates` utility method ([#3657](https://github.com/MetaMask/core/pull/3657))
31
79
  - `TokenListController` now exports a `TokenListControllerMessenger` type ([#3609](https://github.com/MetaMask/core/pull/3609)).
32
80
  - `TokenDetectionController` exports types `TokenDetectionControllerMessenger`, `TokenDetectionControllerActions`, `TokenDetectionControllerGetStateAction`, `TokenDetectionControllerEvents`, `TokenDetectionControllerStateChangeEvent` ([#3609](https://github.com/MetaMask/core/pull/3609)).
33
- - Add `enable` and `disable` methods to `TokenDetectionController`, which control whether the controller is able to make polling requests or all of its network calls are blocked. ([#3609](https://github.com/MetaMask/core/pull/3609)).
81
+ - Add `enable` and `disable` methods to `TokenDetectionController`, which control whether the controller is able to make polling requests or all of its network calls are blocked. ([#3609](https://github.com/MetaMask/core/pull/3609)).
34
82
  - Note that if the controller is initiated without the `disabled` constructor option set to `false`, the `enable` method will need to be called before the controller can make polling requests in response to subscribed events.
35
83
 
36
84
  ### Changed
85
+
37
86
  - **BREAKING:** Bump `@metamask/approval-controller` dependency and peer dependency from `^5.1.0` to `^5.1.1` ([#3695](https://github.com/MetaMask/core/pull/3695))
38
87
  - **BREAKING:** Bump `@metamask/network-controller` dependency and peer dependency from `^17.0.0` to `^17.1.0` ([#3695](https://github.com/MetaMask/core/pull/3695))
39
88
  - **BREAKING:** Bump `@metamask/preferences-controller` dependency and peer dependency from `^5.0.0` to `^5.0.1` ([#3695](https://github.com/MetaMask/core/pull/3695))
@@ -46,19 +95,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
46
95
  - Bump `@metamask/controller-utils` from `8.0.0` to `^8.0.1` ([#3695](https://github.com/MetaMask/core/pull/3695))
47
96
 
48
97
  ### Fixed
98
+
49
99
  - Fix error caused by OpenSea API rename of `supply` to `total_supply` ([#3692](https://github.com/MetaMask/core/pull/3692))
50
100
  - Fix `CodefiTokenPricesServiceV2` support for Shiden ([#3683](https://github.com/MetaMask/core/pull/3683))
51
101
  - Improve how `CodefiTokenPricesServiceV2` handles token price update failures ([#3687](https://github.com/MetaMask/core/pull/3687))
52
102
  - Previously a single failed token price update would prevent all other token prices from updating as well. With this update, we log and error and continue when we fail to update a token price, ensuring the others still get updated.
53
103
 
54
104
  ## [22.0.0]
105
+
55
106
  ### Changed
107
+
56
108
  - **BREAKING:** OpenSea V2 API is used instead of V1 ([#3654](https://github.com/MetaMask/core/pull/3654))
57
- - `NftDetectionController` constructor now requires the `NftController.getNftApi` function.
109
+ - `NftDetectionController` constructor now requires the `NftController.getNftApi` function.
58
110
  - NFT controllers will no longer return `last_sale` information for NFTs fetched after the OpenSea V2 update
59
111
 
60
112
  ## [21.0.0]
113
+
61
114
  ### Added
115
+
62
116
  - Add `CodefiTokenPricesServiceV2` ([#3600](https://github.com/MetaMask/core/pull/3600), [#3655](https://github.com/MetaMask/core/pull/3655), [#3655](https://github.com/MetaMask/core/pull/3655))
63
117
  - This class can be used for the new `tokenPricesService` argument for TokenRatesController. It uses a MetaMask API to fetch prices for tokens instead of CoinGecko.
64
118
  - The `CodefiTokenPricesServiceV2` will retry if the token price update fails
@@ -73,6 +127,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
73
127
  - Support token detection on Arbitrum and Optimism ([#2035](https://github.com/MetaMask/core/pull/2035))
74
128
 
75
129
  ### Changed
130
+
76
131
  - **BREAKING:** `TokenRatesController` now takes a required argument `tokenPricesService` ([#3600](https://github.com/MetaMask/core/pull/3600))
77
132
  - This object is responsible for fetching the prices for tokens held by this controller.
78
133
  - **BREAKING:** Update signature of `TokenRatesController.updateExchangeRatesByChainId` ([#3600](https://github.com/MetaMask/core/pull/3600), [#3653](https://github.com/MetaMask/core/pull/3653))
@@ -106,6 +161,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
106
161
  - Add dependencies `cockatiel` and `lodash` ([#3586](https://github.com/MetaMask/core/pull/3586), [#3655](https://github.com/MetaMask/core/pull/3655))
107
162
 
108
163
  ### Removed
164
+
109
165
  - **BREAKING:** Remove `fetchExchangeRate` method from TokenRatesController ([#3600](https://github.com/MetaMask/core/pull/3600))
110
166
  - This method (not to be confused with `updateExchangeRate`, which is still present) was only ever intended to be used internally and should not be accessed directly.
111
167
  - **BREAKING:** Remove `getChainSlug` method from TokenRatesController ([#3600](https://github.com/MetaMask/core/pull/3600))
@@ -118,6 +174,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
118
174
  - **BREAKING**: `TokenRatesController.fetchAndMapExchangeRates` is no longer exposed publicly ([#3621](https://github.com/MetaMask/core/pull/3621))
119
175
 
120
176
  ### Fixed
177
+
121
178
  - Prevent `TokenRatesController` from making redundant token rate updates when tokens change ([#3647](https://github.com/MetaMask/core/pull/3647), [#3663](https://github.com/MetaMask/core/pull/3663))
122
179
  - Previously, token rates would be re-fetched for the globally selected network on all TokensController state changes, but now token rates are always performed for a deduplicated and normalized set of addresses, and changes to this set determine whether rates should be re-fetched.
123
180
  - Prevent redundant overlapping token rate updates in `TokenRatesController` ([#3635](https://github.com/MetaMask/core/pull/3635))
@@ -129,7 +186,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
129
186
  - This affects `watchNft` and `addNft` methods
130
187
 
131
188
  ## [20.0.0]
189
+
132
190
  ### Added
191
+
133
192
  - **BREAKING**: `TokenRatesControllerState` now has required `contractExchangeRatesByChainId` property which an object keyed by `chainId` and `nativeCurrency` ([#2015](https://github.com/MetaMask/core/pull/2015))
134
193
  - **BREAKING**: `TokenRatesController` constructor params now requires `getNetworkClientById` ([#2015](https://github.com/MetaMask/core/pull/2015))
135
194
  - Add types `CurrencyRateControllerEvents` and `CurrencyRateControllerActions` ([#2029](https://github.com/MetaMask/core/pull/2029))
@@ -146,6 +205,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
146
205
  - `TokenRatesController.fetchAndMapExchangeRates()` now accepts an optional `tokenAddresses` as the last parameter ([#2015](https://github.com/MetaMask/core/pull/2015))
147
206
 
148
207
  ### Changed
208
+
149
209
  - **BREAKING:** Bump dependency on `@metamask/base-controller` to ^4.0.0 ([#2063](https://github.com/MetaMask/core/pull/2063))
150
210
  - This is breaking because the type of the `messenger` has backward-incompatible changes. See the changelog for this package for more.
151
211
  - Bump `@metamask/approval-controller` to ^5.0.0 ([#2063](https://github.com/MetaMask/core/pull/2063))
@@ -155,14 +215,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
155
215
  - Bump `@metamask/preferences-controller` to ^5.0.0 ([#2063](https://github.com/MetaMask/core/pull/2063))
156
216
 
157
217
  ## [19.0.0]
218
+
158
219
  ### Changed
220
+
159
221
  - **BREAKING:** Bump dependency and peer dependency on `@metamask/network-controller` to ^16.0.0
160
222
  - Add optional `networkClientId` and `userAddress` args to remaining `NftController` public methods ([#2006](https://github.com/MetaMask/core/pull/2006))
161
223
  - `watchNft`, `removeNft`, `removeAndIgnoreNft`, `removeNftContract`, `updateNftFavoriteStatus`, and `checkAndUpdateAllNftsOwnershipStatus` methods on `NftController` all now accept an optional options object argument containing `networkClientId` and `userAddress` to identify where in state to mutate.
162
224
  - **BREAKING**: `addNft` no longer accepts a `chainId` property in its options argument since this value can be retrieved by the `networkClientId` property and is therefore redundant.
163
225
  - **BREAKING**: The third and fourth arguments on NftController's `addNftVerifyOwnership` method, have been replaced with an options object containing optional properties `networkClientId`, `userAddress` and `source`. This method signature is more aligned with the options pattern for passing `networkClientId` and `userAddress` on this controller and elsewhere.
164
226
  - **BREAKING**: `checkAndUpdateSingleNftOwnershipStatus` on NftController no longer accepts a `chainId` in its options argument. This is replaced with an optional `networkClientId` property which can be used to fetch chainId.
165
- ***BREAKING**: The fourth argument of the `isNftOwner` method on `NftController` is now an options object with an optional `networkClientId` property. This method signature is more aligned with the options pattern for passing `networkClientId` on this controller and elsewhere.
227
+ **\*BREAKING**: The fourth argument of the `isNftOwner` method on `NftController` is now an options object with an optional `networkClientId` property. This method signature is more aligned with the options pattern for passing `networkClientId` on this controller and elsewhere.
166
228
  - **BREAKING**: `validateWatchNft` method on `NftController` is now private.
167
229
  - **BREAKING**: `detectNfts` on `NftDetectionController` now accepts a single object argument with optional properties `networkClientId` and `userAddress`, rather than taking these as two sequential arguments.
168
230
  - Bump dependency `@metamask/eth-query` from ^3.0.1 to ^4.0.0 ([#2028](https://github.com/MetaMask/core/pull/2028))
@@ -170,10 +232,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
170
232
  - Bump `@metamask/utils` from 8.1.0 to 8.2.0 ([#1957](https://github.com/MetaMask/core/pull/1957))
171
233
 
172
234
  ### Fixed
235
+
173
236
  - Add name and symbol to the payload returned by the `ERC1155Standard` class `getDetails` method for `ERC1155` contracts ([#1727](https://github.com/MetaMask/core/pull/1727))
174
237
 
175
238
  ## [18.0.0]
239
+
176
240
  ### Changed
241
+
177
242
  - **BREAKING**: `CurrencyRateController` is now keyed by `nativeCurrency` (i.e. ticker) for `conversionDate`, `conversionRate`, and `usdConversionRate` in the `currencyRates` object. `nativeCurrency`, `pendingNativeCurrency`, and `pendingCurrentCurrency` have been removed.
178
243
  - ```
179
244
  export type CurrencyRateState = {
@@ -188,27 +253,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
188
253
  >;
189
254
  };
190
255
  ```
191
- - **BREAKING**: `CurrencyRateController` now extends `PollingController` ([#1805](https://github.com/MetaMask/core/pull/1805))
256
+ - **BREAKING**: `CurrencyRateController` now extends `PollingController` ([#1805](https://github.com/MetaMask/core/pull/1805))
192
257
  - `start()` and `stop()` methods replaced with `startPollingByNetworkClientId()`, `stopPollingByPollingToken()`, and `stopAllPolling()`
193
258
  - **BREAKING**: `CurrencyRateController` now sends the `NetworkController:getNetworkClientById` action via messaging controller ([#1805](https://github.com/MetaMask/core/pull/1805))
194
259
 
195
260
  ### Fixed
261
+
196
262
  - Parallelize network requests in assets controllers for performance enhancement ([#1801](https://github.com/MetaMask/core/pull/1801))
197
263
  - Fix token detection on accounts when user changes account after token detection request is inflight ([#1848](https://github.com/MetaMask/core/pull/1848))
198
264
 
199
265
  ## [17.0.0]
266
+
200
267
  ### Changed
268
+
201
269
  - **BREAKING:** Bump dependency on `@metamask/polling-controller` to ^1.0.0
202
270
  - Bump dependency and peer dependency on `@metamask/network-controller` to ^15.1.0
203
271
 
204
272
  ## [16.0.0]
273
+
205
274
  ### Added
275
+
206
276
  - Add way to start and stop different polling sessions for the same network client ID by providing extra scoping data ([#1776](https://github.com/MetaMask/core/pull/1776))
207
277
  - Add optional second argument to `stopPollingByPollingToken` (formerly `stopPollingByNetworkClientId`)
208
278
  - Add optional second argument to `onPollingCompleteByNetworkClientId`
209
279
  - Add support for token detection for Linea mainnet and Linea Goerli ([#1799](https://github.com/MetaMask/core/pull/1799))
210
280
 
211
281
  ### Changed
282
+
212
283
  - **BREAKING:** Bump dependency and peer dependency on `@metamask/network-controller` to ^15.0.0
213
284
  - **BREAKING:** Make `executePoll` in TokenListController private ([#1810](https://github.com/MetaMask/core/pull/1810))
214
285
  - **BREAKING:** Update TokenListController to rename `stopPollingByNetworkClientId` to `stopPollingByPollingToken` ([#1810](https://github.com/MetaMask/core/pull/1810))
@@ -218,7 +289,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
218
289
  - Fix support for NFT metadata stored outside IPFS ([#1772](https://github.com/MetaMask/core/pull/1772))
219
290
 
220
291
  ## [15.0.0]
292
+
221
293
  ### Changed
294
+
222
295
  - **BREAKING**: `NftController` now expects `getNetworkClientById` in constructor options ([#1698](https://github.com/MetaMask/core/pull/1698))
223
296
  - **BREAKING**: `NftController.addNft` function signature has changed ([#1698](https://github.com/MetaMask/core/pull/1698))
224
297
  - Previously
@@ -244,7 +317,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
244
317
  networkClientId?: NetworkClientId; // new
245
318
  },
246
319
  ```
247
- - `NftController.addNftVerifyOwnership`: Now accepts optional 3rd argument `networkClientId` which is used to fetch NFT metadata and determine by which chainId the added NFT should be stored in state. Also accepts optional 4th argument `source` used for metrics to identify the flow in which the NFT was added to the wallet. ([#1698](https://github.com/MetaMask/core/pull/1698))
320
+ - `NftController.addNftVerifyOwnership`: Now accepts optional 3rd argument `networkClientId` which is used to fetch NFT metadata and determine by which chainId the added NFT should be stored in state. Also accepts optional 4th argument `source` used for metrics to identify the flow in which the NFT was added to the wallet. ([#1698](https://github.com/MetaMask/core/pull/1698))
248
321
  - `NftController.isNftOwner`: Now accepts optional `networkClientId` which is used to instantiate the provider for the correct chain and call the NFT contract to verify ownership ([#1698](https://github.com/MetaMask/core/pull/1698))
249
322
  - `NftController.addNft` will use the chainId value derived from `networkClientId` if provided ([#1698](https://github.com/MetaMask/core/pull/1698))
250
323
  - `NftController.watchNft` options now accepts optional `networkClientId` which is used to fetch NFT metadata and determine by which chainId the added NFT should be stored in state ([#1698](https://github.com/MetaMask/core/pull/1698))
@@ -255,19 +328,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
255
328
  - Bump dependency and peer dependency on `@metamask/network-controller` to ^14.0.0
256
329
 
257
330
  ### Fixed
331
+
258
332
  - Fix bug in TokensController where batched `addToken` overwrote each other because mutex was acquired after reading state ([#1768](https://github.com/MetaMask/core/pull/1768))
259
333
 
260
334
  ## [14.0.0]
335
+
261
336
  ### Changed
337
+
262
338
  - Update TypeScript to v4.8.x ([#1718](https://github.com/MetaMask/core/pull/1718))
263
339
  - Update `@metamask/rpc-errors` to `^6.0.0` ([#1690](https://github.com/MetaMask/core/pull/1690))
264
340
 
265
341
  ### Removed
342
+
266
343
  - **BREAKING:** Remove AbortController polyfill
267
344
  - This package now assumes that the AbortController global exists
268
345
 
269
346
  ## [13.0.0]
347
+
270
348
  ### Changed
349
+
271
350
  - **BREAKING**: `TokensController` now expects `getNetworkClientById` in constructor options ([#1676](https://github.com/MetaMask/core/pull/1676))
272
351
  - **BREAKING**: `TokensController.addToken` now accepts a single options object ([#1676](https://github.com/MetaMask/core/pull/1676))
273
352
  ```
@@ -290,33 +369,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
290
369
  - Bump dependency on `@metamask/preferences-controller` to ^4.4.1 ([#1676](https://github.com/MetaMask/core/pull/1676))
291
370
 
292
371
  ## [12.0.0]
372
+
293
373
  ### Added
374
+
294
375
  - Add `AssetsContractController` methods `getProvider`, `getChainId`, `getERC721Standard`, and `getERC1155Standard` ([#1638](https://github.com/MetaMask/core/pull/1638))
295
376
 
296
377
  ### Changed
378
+
297
379
  - **BREAKING**: Add `getNetworkClientById` to `AssetsContractController` constructor options ([#1638](https://github.com/MetaMask/core/pull/1638))
298
- - Add optional `networkClientId` parameter to various `AssetContractController` methods ([#1638](https://github.com/MetaMask/core/pull/1638))
299
- - The affected methods are:
300
- - `getERC20BalanceOf`
301
- - `getERC20TokenDecimals`
302
- - `getERC20TokenName`
303
- - `getERC721NftTokenId`
304
- - `getTokenStandardAndDetails`
305
- - `getERC721TokenURI`
306
- - `getERC721AssetName`
307
- - `getERC721AssetSymbol`
308
- - `getERC721OwnerOf`
309
- - `getERC1155TokenURI`
310
- - `getERC1155BalanceOf`
311
- - `transferSingleERC1155`
312
- - `getBalancesInSingleCall`
380
+ - Add optional `networkClientId` parameter to various `AssetContractController` methods ([#1638](https://github.com/MetaMask/core/pull/1638))
381
+ - The affected methods are:
382
+ - `getERC20BalanceOf`
383
+ - `getERC20TokenDecimals`
384
+ - `getERC20TokenName`
385
+ - `getERC721NftTokenId`
386
+ - `getTokenStandardAndDetails`
387
+ - `getERC721TokenURI`
388
+ - `getERC721AssetName`
389
+ - `getERC721AssetSymbol`
390
+ - `getERC721OwnerOf`
391
+ - `getERC1155TokenURI`
392
+ - `getERC1155BalanceOf`
393
+ - `transferSingleERC1155`
394
+ - `getBalancesInSingleCall`
313
395
 
314
396
  ## [11.1.0]
397
+
315
398
  ### Added
399
+
316
400
  - Add `tokenURI` to `NftMetadata` type ([#1577](https://github.com/MetaMask/core/pull/1577))
317
401
  - Populate token URL for NFT metadata under `tokenURI` ([#1577](https://github.com/MetaMask/core/pull/1577))
318
402
 
319
403
  ### Changed
404
+
320
405
  - Bump dependency and peer dependency on `@metamask/approval-controller` to ^3.5.1
321
406
  - Bump dependency on `@metamask/base-controller` to ^3.2.1
322
407
  - Bump dependency on `@metamask/controller-utils` to ^4.3.2
@@ -325,14 +410,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
325
410
  - Update NftController to add fallback for when IPFS gateway is disabled ([#1577](https://github.com/MetaMask/core/pull/1577))
326
411
 
327
412
  ## [11.0.1]
413
+
328
414
  ### Changed
415
+
329
416
  - Replace `eth-query` ^2.1.2 with `@metamask/eth-query` ^3.0.1 ([#1546](https://github.com/MetaMask/core/pull/1546))
330
417
 
331
418
  ## [11.0.0]
419
+
332
420
  ### Added
421
+
333
422
  - Add a `stop` method to stop polling
334
423
 
335
424
  ### Changed
425
+
336
426
  - **BREAKING**: New required constructor parameters for the `TokenRatesController` ([#1497](https://github.com/MetaMask/core/pull/1497), [#1511](https://github.com/MetaMask/core/pull/1511))
337
427
  - The new required parameters are `ticker`, `onSelectedAddress`, and `onPreferencesStateChange`
338
428
  - **BREAKING**: Remove `onCurrencyRateStateChange` constructor parameter from `TokenRatesController` ([#1496](https://github.com/MetaMask/core/pull/1496))
@@ -347,16 +437,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
347
437
  - Remove unnecessary `babel-runtime` dependency ([#1504](https://github.com/MetaMask/core/pull/1504))
348
438
 
349
439
  ### Fixed
440
+
350
441
  - Fix bug where token rates were incorrect after first update if initialized with a non-Ethereum selected network ([#1497](https://github.com/MetaMask/core/pull/1497))
351
442
  - Fix bug where token rates would be invalid if event handlers were triggered in the wrong order ([#1496](https://github.com/MetaMask/core/pull/1496), [#1511](https://github.com/MetaMask/core/pull/1511))
352
443
  - Prevent redundant token rate updates ([#1512](https://github.com/MetaMask/core/pull/1512))
353
444
 
354
445
  ## [10.0.0]
446
+
355
447
  ### Added
448
+
356
449
  - The method `getERC20TokenName` has been added to `AssetsContractController` ([#1127](https://github.com/MetaMask/core/pull/1127))
357
450
  - This method gets the token name from the token contract
358
451
 
359
452
  ### Changed
453
+
360
454
  - **BREAKING:** The tokens controller now requires `onTokenListStateChange` and `getERC20TokenName` as constructor parameters ([#1127](https://github.com/MetaMask/core/pull/1127))
361
455
  - The `getERC20TokenName` method is used to get the token name for tokens added via `wallet_watchAsset`
362
456
  - The `onTokenListStateChange` method is used to trigger a name update when the token list changes. On each change, token names are copied from the token list if they're missing from token controller state.
@@ -367,19 +461,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
367
461
  - The `Token` type now includes an optional `name` field ([#1127](https://github.com/MetaMask/core/pull/1127))
368
462
 
369
463
  ## [9.2.0]
464
+
370
465
  ### Added
466
+
371
467
  - Add validation that the nft standard matches the type argument of a `wallet_watchAsset` request when type is 'ERC721' or 'ERC1155' ([#1455](https://github.com/MetaMask/core/pull/1455))
372
468
 
373
469
  ## [9.1.0]
470
+
374
471
  ### Added
472
+
375
473
  - Add a fifth argument, `source`, to NftController's `addNft` method ([#1417](https://github.com/MetaMask/core/pull/1417))
376
474
  - This argument can be used to specify whether the NFT was detected, added manually, or suggested by a dapp
377
475
 
378
476
  ### Fixed
477
+
379
478
  - Fix `watchNft` in NftController to ensure that if the network changes before the user accepts the request, the NFT is added to the chain ID and address before the request was initiated ([#1417](https://github.com/MetaMask/core/pull/1417))
380
479
 
381
480
  ## [9.0.0]
481
+
382
482
  ### Added
483
+
383
484
  - **BREAKING**: Add required options `getSelectedAddress` and `getMultiAccountBalancesEnabled` to AccountTrackerController constructor and make use of them when refreshing account balances ([#1146](https://github.com/MetaMask/core/pull/1146))
384
485
  - Previously, the controller would refresh all account balances, but these options can be used to only refresh the currently selected account
385
486
  - **BREAKING:** Add logic to support validating and adding ERC721 and ERC1155 tokens to NFTController state via `wallet_watchAsset` API. ([#1173](https://github.com/MetaMask/core/pull/1173), [#1406](https://github.com/MetaMask/core/pull/1406))
@@ -387,15 +488,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
387
488
  - The `NFTController` now requires an instance of a ControllerMessenger to be passed to its constructor. This is messenger is used to pass the `watchNFT` message to the `ApprovalController`.
388
489
 
389
490
  ### Changed
491
+
390
492
  - Add dependency on `@ethersproject/address` ([#1173](https://github.com/MetaMask/core/pull/1173))
391
493
  - Replace `eth-rpc-errors` with `@metamask/rpc-errors` ([#1173](https://github.com/MetaMask/core/pull/1173))
392
494
 
393
495
  ## [8.0.0]
496
+
394
497
  ### Added
498
+
395
499
  - Support NFT detection on Ethereum Mainnet custom RPC endpoints ([#1360](https://github.com/MetaMask/core/pull/1360))
396
500
  - Enable token detection for the Aurora network ([#1327](https://github.com/MetaMask/core/pull/1327))
397
501
 
398
502
  ### Changed
503
+
399
504
  - **BREAKING:** Bump to Node 16 ([#1262](https://github.com/MetaMask/core/pull/1262))
400
505
  - **BREAKING:** Change format of chain ID in state to 0x-prefixed hex string ([#1367](https://github.com/MetaMask/core/pull/1367))
401
506
  - The functions `isTokenDetectionSupportedForNetwork` and `formatIconUrlWithProxy` now expect a chain ID as type `Hex` rather than as a decimal `string`
@@ -421,11 +526,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
421
526
  - The return type for `watchAsset` has changed. It now returns a Promise that settles after the request has been confirmed or rejected.
422
527
  - **BREAKING:** Initialize controllers with the current network ([#1361](https://github.com/MetaMask/core/pull/1361))
423
528
  - The following controllers now have a new `chainId` required constructor parameter:
424
- * `AssetsContractController`
425
- * `NftController`
426
- * `NftDetectionController`
427
- * `TokenRatesController`
428
- * `TokensController`
529
+ - `AssetsContractController`
530
+ - `NftController`
531
+ - `NftDetectionController`
532
+ - `TokenRatesController`
533
+ - `TokensController`
429
534
  - **BREAKING:** The token list controller messenger requires the `NetworkController:stateChange` event instead of the `NetworkController:providerConfigChange` event ([#1329](https://github.com/MetaMask/core/pull/1329))
430
535
  - **BREAKING:** The token list controller `onNetworkStateChange` option now has a more restrictive type ([#1329](https://github.com/MetaMask/core/pull/1329))
431
536
  - The event handler parameter type has been changed from `NetworkState | ProviderConfig` to `NetworkState`
@@ -437,42 +542,58 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
437
542
  - Bump @metamask/utils from 5.0.1 to 5.0.2 ([#1271](https://github.com/MetaMask/core/pull/1271))
438
543
 
439
544
  ### Removed
545
+
440
546
  - **BREAKING:** Remove the `networkType` configuration option from the NFT detection controller, NFT controller, and tokens controller ([#1360](https://github.com/MetaMask/core/pull/1360), [#1359](https://github.com/MetaMask/core/pull/1359))
441
547
  - **BREAKING:** Remove the `SuggestedAssetMeta` and `SuggestedAssetMetaBase` types from the token controller ([#1268](https://github.com/MetaMask/core/pull/1268))
442
548
  - **BREAKING:** Remove the `acceptWatchAsset` and `rejectWatchAsset` methods from the token controller ([#1268](https://github.com/MetaMask/core/pull/1268))
443
549
  - Suggested assets can be accepted or rejected using the approval controller instead
444
550
 
445
551
  ## [7.0.0]
552
+
446
553
  ### Changed
554
+
447
555
  - **BREAKING**: peerDeps: @metamask/network-controller@6.0.0->8.0.0 ([#1196](https://github.com/MetaMask/core/pull/1196))
448
556
 
449
557
  ## [6.0.0]
558
+
450
559
  ### Changed
560
+
451
561
  - **BREAKING:** Create approval requests using `@metamask/approval-controller` ([#1166](https://github.com/MetaMask/core/pull/1166))
452
562
 
453
563
  ## [5.1.0]
564
+
454
565
  ### Added
566
+
455
567
  - Support watching assets on a specific account ([#1124](https://github.com/MetaMask/core/pull/1124))
456
568
 
457
569
  ## [5.0.1]
570
+
458
571
  ### Changed
572
+
459
573
  - Update `@metamask/contract-metadata` from 2.1.0 to 2.3.1 ([#1141](https://github.com/MetaMask/core/pull/1141))
460
574
 
461
575
  ## [5.0.0]
576
+
462
577
  ### Removed
578
+
463
579
  - **BREAKING:** Remove `isomorphic-fetch` ([#1106](https://github.com/MetaMask/controllers/pull/1106))
464
580
  - Consumers must now import `isomorphic-fetch` or another polyfill themselves if they are running in an environment without `fetch`
465
581
 
466
582
  ## [4.0.1]
583
+
467
584
  ### Fixed
585
+
468
586
  - Update Nft Controller to add the NFT back to its own group if we are re-importing it ([#1082](https://github.com/MetaMask/core/pull/1082))
469
587
 
470
588
  ## [4.0.0]
589
+
471
590
  ### Added
591
+
472
592
  - Add Sepolia support to the currency rate controller ([#1041](https://github.com/MetaMask/controllers/pull/1041))
473
593
  - The currency rate controller will now treat Sepolia as a testnet, and return the Mainnet exchange rate when asked for the Sepolia exchange rate.
474
594
 
475
595
  ### Changed
596
+
476
597
  - **BREAKING:** Update `@metamask/network-controller` peer dependency to v3 ([#1041](https://github.com/MetaMask/controllers/pull/1041))
477
598
  - **BREAKING:** Migrate from `metaswap` to `metafi` subdomain for OpenSea proxy and token icons API ([#1060](https://github.com/MetaMask/core/pull/1060))
478
599
  - Rename this repository to `core` ([#1031](https://github.com/MetaMask/controllers/pull/1031))
@@ -480,29 +601,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
480
601
  - Update `@metamask/controller-utils` package ([#1041](https://github.com/MetaMask/controllers/pull/1041))
481
602
 
482
603
  ## Removed
604
+
483
605
  - **BREAKING**: Drop support for Ropsten, Rinkeby, and Kovan ([#1041](https://github.com/MetaMask/controllers/pull/1041))
484
606
  - The currency rate controller no longer has special handling of these three networks. It used to return the Mainnet exchange rate for these three networks, but now it includes no special handling for them.
485
607
  - The NFT controller no longer supports the Rinkeby OpenSea test API.
486
608
 
487
609
  ## [3.0.1]
610
+
488
611
  ### Changed
612
+
489
613
  - Export `isTokenDetectionSupportedForNetwork` function ([#1034](https://github.com/MetaMask/controllers/pull/1034))
490
614
  - Update `@metamask/contract-metadata` from 1.35.0 to 2.1.0 ([#1013](https://github.com/MetaMask/controllers/pull/1013))
491
615
 
492
616
  ### Fixed
617
+
493
618
  - Fix token controller state updates ([#1015](https://github.com/MetaMask/controllers/pull/1015))
494
619
  - Attempts to empty the list of "added", "ignored", or "detected" tokens were not saved in state correctly, resulting in that operation being undone after switching account or network.
495
620
 
496
621
  ## [3.0.0]
622
+
497
623
  ### Changed
624
+
498
625
  - **BREAKING:** A new private property, controlled by the `start` and `stop` methods, is added to the CurrencyRateController: `enabled`. When this is false, no network requests will be made from the controller. Previously, setNativeCurrency or setCurrentCurrency would trigger a network request. That is now prevented if `enabled` is false. ([#1002](https://github.com/MetaMask/core/pull/1002))
499
626
 
500
627
  ### Fixed
628
+
501
629
  - The TokenRatesController no longer overwrites the `disabled` config property passed to the constructor, allowing the controller to be instantiated with `config.disabled` set to either true or false. ([#1002](https://github.com/MetaMask/core/pull/1002))
502
630
  - This package will now warn if a required package is not present ([#1003](https://github.com/MetaMask/core/pull/1003))
503
631
 
504
632
  ## [2.0.0]
633
+
505
634
  ### Changed
635
+
506
636
  - **BREAKING:** Update `onNetworkStateChange`, a constructor option for several controllers, to take an object with a `providerConfig` property instead of `provider` ([#995](https://github.com/MetaMask/core/pull/995))
507
637
  - This affects:
508
638
  - AssetsContractController
@@ -516,22 +646,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
516
646
  - Relax dependencies on `@metamask/base-controller`, `@metamask/controller-utils`, `@metamask/network-controller`, and `@metamask/preferences-controller` (use `^` instead of `~`) ([#998](https://github.com/MetaMask/core/pull/998))
517
647
 
518
648
  ## [1.0.1]
649
+
519
650
  ### Fixed
651
+
520
652
  - Fix race condition where some token detections can get mistakenly added to the wrong account ([#956](https://github.com/MetaMask/core/pull/956))
521
653
 
522
654
  ## [1.0.0]
655
+
523
656
  ### Added
657
+
524
658
  - Initial release
659
+
525
660
  - As a result of converting our shared controllers repo into a monorepo ([#831](https://github.com/MetaMask/core/pull/831)), we've created this package from select parts of [`@metamask/controllers` v33.0.0](https://github.com/MetaMask/core/tree/v33.0.0), namely:
661
+
526
662
  - Everything in `src/assets`
527
663
  - Asset-related functions from `src/util.ts` and accompanying tests
528
664
 
529
665
  All changes listed after this point were applied to this package following the monorepo conversion.
530
666
 
531
667
  ### Changed
668
+
532
669
  - Use Ethers for AssetsContractController ([#845](https://github.com/MetaMask/core/pull/845))
533
670
 
534
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@24.0.0...HEAD
671
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@25.0.0...HEAD
672
+ [25.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@24.0.0...@metamask/assets-controllers@25.0.0
535
673
  [24.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@23.1.0...@metamask/assets-controllers@24.0.0
536
674
  [23.1.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@23.0.0...@metamask/assets-controllers@23.1.0
537
675
  [23.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@22.0.0...@metamask/assets-controllers@23.0.0