@metamask/assets-controllers 25.0.0 → 27.0.0

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.
Files changed (235) hide show
  1. package/CHANGELOG.md +210 -39
  2. package/dist/AccountTrackerController.js +9 -236
  3. package/dist/AccountTrackerController.js.map +1 -1
  4. package/dist/AccountTrackerController.mjs +10 -0
  5. package/dist/AccountTrackerController.mjs.map +1 -0
  6. package/dist/AssetsContractController.js +17 -385
  7. package/dist/AssetsContractController.js.map +1 -1
  8. package/dist/AssetsContractController.mjs +18 -0
  9. package/dist/AssetsContractController.mjs.map +1 -0
  10. package/dist/CurrencyRateController.js +10 -157
  11. package/dist/CurrencyRateController.js.map +1 -1
  12. package/dist/CurrencyRateController.mjs +11 -0
  13. package/dist/CurrencyRateController.mjs.map +1 -0
  14. package/dist/NftController.js +15 -1039
  15. package/dist/NftController.js.map +1 -1
  16. package/dist/NftController.mjs +16 -0
  17. package/dist/NftController.mjs.map +1 -0
  18. package/dist/NftDetectionController.js +12 -215
  19. package/dist/NftDetectionController.js.map +1 -1
  20. package/dist/NftDetectionController.mjs +13 -0
  21. package/dist/NftDetectionController.mjs.map +1 -0
  22. package/dist/Standards/ERC20Standard.js +8 -144
  23. package/dist/Standards/ERC20Standard.js.map +1 -1
  24. package/dist/Standards/ERC20Standard.mjs +9 -0
  25. package/dist/Standards/ERC20Standard.mjs.map +1 -0
  26. package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.js +8 -217
  27. package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.js.map +1 -1
  28. package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.mjs +9 -0
  29. package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.mjs.map +1 -0
  30. package/dist/Standards/NftStandards/ERC721/ERC721Standard.js +8 -175
  31. package/dist/Standards/NftStandards/ERC721/ERC721Standard.js.map +1 -1
  32. package/dist/Standards/NftStandards/ERC721/ERC721Standard.mjs +9 -0
  33. package/dist/Standards/NftStandards/ERC721/ERC721Standard.mjs.map +1 -0
  34. package/dist/TokenBalancesController.js +11 -144
  35. package/dist/TokenBalancesController.js.map +1 -1
  36. package/dist/TokenBalancesController.mjs +12 -0
  37. package/dist/TokenBalancesController.mjs.map +1 -0
  38. package/dist/TokenDetectionController.js +16 -245
  39. package/dist/TokenDetectionController.js.map +1 -1
  40. package/dist/TokenDetectionController.mjs +17 -0
  41. package/dist/TokenDetectionController.mjs.map +1 -0
  42. package/dist/TokenListController.js +13 -250
  43. package/dist/TokenListController.js.map +1 -1
  44. package/dist/TokenListController.mjs +14 -0
  45. package/dist/TokenListController.mjs.map +1 -0
  46. package/dist/TokenRatesController.js +11 -328
  47. package/dist/TokenRatesController.js.map +1 -1
  48. package/dist/TokenRatesController.mjs +12 -0
  49. package/dist/TokenRatesController.mjs.map +1 -0
  50. package/dist/TokensController.js +15 -636
  51. package/dist/TokensController.js.map +1 -1
  52. package/dist/TokensController.mjs +16 -0
  53. package/dist/TokensController.mjs.map +1 -0
  54. package/dist/assetsUtil.js +41 -380
  55. package/dist/assetsUtil.js.map +1 -1
  56. package/dist/assetsUtil.mjs +42 -0
  57. package/dist/assetsUtil.mjs.map +1 -0
  58. package/dist/chunk-23F5W3A2.mjs +157 -0
  59. package/dist/chunk-23F5W3A2.mjs.map +1 -0
  60. package/dist/chunk-27KOXCQK.mjs +1 -0
  61. package/dist/chunk-27KOXCQK.mjs.map +1 -0
  62. package/dist/chunk-3FMWI46J.mjs +361 -0
  63. package/dist/chunk-3FMWI46J.mjs.map +1 -0
  64. package/dist/chunk-3FOTFZIL.mjs +411 -0
  65. package/dist/chunk-3FOTFZIL.mjs.map +1 -0
  66. package/dist/chunk-4LY47RPI.mjs +139 -0
  67. package/dist/chunk-4LY47RPI.mjs.map +1 -0
  68. package/dist/chunk-5C7ZVZNM.mjs +267 -0
  69. package/dist/chunk-5C7ZVZNM.mjs.map +1 -0
  70. package/dist/chunk-64EHFYLM.mjs +245 -0
  71. package/dist/chunk-64EHFYLM.mjs.map +1 -0
  72. package/dist/chunk-6C2ZIK7A.js +245 -0
  73. package/dist/chunk-6C2ZIK7A.js.map +1 -0
  74. package/dist/chunk-6DTCHPBB.mjs +178 -0
  75. package/dist/chunk-6DTCHPBB.mjs.map +1 -0
  76. package/dist/chunk-74IP34EL.js +1177 -0
  77. package/dist/chunk-74IP34EL.js.map +1 -0
  78. package/dist/chunk-BZI7P3TD.js +115 -0
  79. package/dist/chunk-BZI7P3TD.js.map +1 -0
  80. package/dist/chunk-C4PQK53K.js +32 -0
  81. package/dist/chunk-C4PQK53K.js.map +1 -0
  82. package/dist/chunk-CP3HC7AQ.mjs +12 -0
  83. package/dist/chunk-CP3HC7AQ.mjs.map +1 -0
  84. package/dist/chunk-GHZX5DE4.js +215 -0
  85. package/dist/chunk-GHZX5DE4.js.map +1 -0
  86. package/dist/chunk-GMKIOYCB.js +361 -0
  87. package/dist/chunk-GMKIOYCB.js.map +1 -0
  88. package/dist/chunk-H6TOSWUM.js +157 -0
  89. package/dist/chunk-H6TOSWUM.js.map +1 -0
  90. package/dist/chunk-HWFBJFHS.js +284 -0
  91. package/dist/chunk-HWFBJFHS.js.map +1 -0
  92. package/dist/chunk-J2JQQNHN.mjs +115 -0
  93. package/dist/chunk-J2JQQNHN.mjs.map +1 -0
  94. package/dist/chunk-J6HPEQL3.mjs +704 -0
  95. package/dist/chunk-J6HPEQL3.mjs.map +1 -0
  96. package/dist/chunk-JC4WAN2J.mjs +1177 -0
  97. package/dist/chunk-JC4WAN2J.mjs.map +1 -0
  98. package/dist/chunk-LD4GC7OR.js +139 -0
  99. package/dist/chunk-LD4GC7OR.js.map +1 -0
  100. package/dist/chunk-NG2UOKDD.js +178 -0
  101. package/dist/chunk-NG2UOKDD.js.map +1 -0
  102. package/dist/chunk-NGIXA5M5.mjs +418 -0
  103. package/dist/chunk-NGIXA5M5.mjs.map +1 -0
  104. package/dist/chunk-NLNXQHAU.js +704 -0
  105. package/dist/chunk-NLNXQHAU.js.map +1 -0
  106. package/dist/chunk-OBUR4TXH.js +1 -0
  107. package/dist/chunk-OBUR4TXH.js.map +1 -0
  108. package/dist/chunk-PAJTKWEC.mjs +246 -0
  109. package/dist/chunk-PAJTKWEC.mjs.map +1 -0
  110. package/dist/chunk-PRIXT2R6.js +411 -0
  111. package/dist/chunk-PRIXT2R6.js.map +1 -0
  112. package/dist/chunk-PUFSYRJZ.js +74 -0
  113. package/dist/chunk-PUFSYRJZ.js.map +1 -0
  114. package/dist/chunk-QHRPRO5U.mjs +74 -0
  115. package/dist/chunk-QHRPRO5U.mjs.map +1 -0
  116. package/dist/chunk-QR4CX2JT.mjs +284 -0
  117. package/dist/chunk-QR4CX2JT.mjs.map +1 -0
  118. package/dist/chunk-RGHTNZQ6.js +12 -0
  119. package/dist/chunk-RGHTNZQ6.js.map +1 -0
  120. package/dist/chunk-TCO22VIO.mjs +32 -0
  121. package/dist/chunk-TCO22VIO.mjs.map +1 -0
  122. package/dist/chunk-TDKCVCGP.mjs +215 -0
  123. package/dist/chunk-TDKCVCGP.mjs.map +1 -0
  124. package/dist/chunk-UAH5YURZ.js +343 -0
  125. package/dist/chunk-UAH5YURZ.js.map +1 -0
  126. package/dist/chunk-V4ZO3F2S.js +246 -0
  127. package/dist/chunk-V4ZO3F2S.js.map +1 -0
  128. package/dist/chunk-VDJBJAUB.js +418 -0
  129. package/dist/chunk-VDJBJAUB.js.map +1 -0
  130. package/dist/chunk-WRQ7POD7.mjs +343 -0
  131. package/dist/chunk-WRQ7POD7.mjs.map +1 -0
  132. package/dist/chunk-XUI43LEZ.mjs +30 -0
  133. package/dist/chunk-XUI43LEZ.mjs.map +1 -0
  134. package/dist/chunk-YD3NRMFC.js +267 -0
  135. package/dist/chunk-YD3NRMFC.js.map +1 -0
  136. package/dist/chunk-Z4BLTVTB.js +30 -0
  137. package/dist/chunk-Z4BLTVTB.js.map +1 -0
  138. package/dist/constants.js +7 -9
  139. package/dist/constants.js.map +1 -1
  140. package/dist/constants.mjs +8 -0
  141. package/dist/constants.mjs.map +1 -0
  142. package/dist/crypto-compare.js +7 -66
  143. package/dist/crypto-compare.js.map +1 -1
  144. package/dist/crypto-compare.mjs +8 -0
  145. package/dist/crypto-compare.mjs.map +1 -0
  146. package/dist/index.js +72 -36
  147. package/dist/index.js.map +1 -1
  148. package/dist/index.mjs +73 -0
  149. package/dist/index.mjs.map +1 -0
  150. package/dist/token-prices-service/abstract-token-prices-service.js +1 -3
  151. package/dist/token-prices-service/abstract-token-prices-service.js.map +1 -1
  152. package/dist/token-prices-service/abstract-token-prices-service.mjs +1 -0
  153. package/dist/token-prices-service/abstract-token-prices-service.mjs.map +1 -0
  154. package/dist/token-prices-service/codefi-v2.js +11 -353
  155. package/dist/token-prices-service/codefi-v2.js.map +1 -1
  156. package/dist/token-prices-service/codefi-v2.mjs +12 -0
  157. package/dist/token-prices-service/codefi-v2.mjs.map +1 -0
  158. package/dist/token-prices-service/index.js +8 -5
  159. package/dist/token-prices-service/index.js.map +1 -1
  160. package/dist/token-prices-service/index.mjs +9 -0
  161. package/dist/token-prices-service/index.mjs.map +1 -0
  162. package/dist/token-service.js +14 -133
  163. package/dist/token-service.js.map +1 -1
  164. package/dist/token-service.mjs +15 -0
  165. package/dist/token-service.mjs.map +1 -0
  166. package/dist/tsconfig.build.tsbuildinfo +1 -0
  167. package/dist/types/AccountTrackerController.d.ts.map +1 -0
  168. package/dist/{AssetsContractController.d.ts → types/AssetsContractController.d.ts} +5 -6
  169. package/dist/types/AssetsContractController.d.ts.map +1 -0
  170. package/dist/types/CurrencyRateController.d.ts.map +1 -0
  171. package/dist/types/NftController.d.ts.map +1 -0
  172. package/dist/types/NftDetectionController.d.ts.map +1 -0
  173. package/dist/{Standards → types/Standards}/ERC20Standard.d.ts +1 -2
  174. package/dist/types/Standards/ERC20Standard.d.ts.map +1 -0
  175. package/dist/{Standards → types/Standards}/NftStandards/ERC1155/ERC1155Standard.d.ts +1 -2
  176. package/dist/types/Standards/NftStandards/ERC1155/ERC1155Standard.d.ts.map +1 -0
  177. package/dist/types/Standards/NftStandards/ERC721/ERC721Standard.d.ts.map +1 -0
  178. package/dist/{TokenBalancesController.d.ts → types/TokenBalancesController.d.ts} +12 -10
  179. package/dist/types/TokenBalancesController.d.ts.map +1 -0
  180. package/dist/types/TokenDetectionController.d.ts +111 -0
  181. package/dist/types/TokenDetectionController.d.ts.map +1 -0
  182. package/dist/types/TokenListController.d.ts.map +1 -0
  183. package/dist/types/TokenRatesController.d.ts.map +1 -0
  184. package/dist/{TokensController.d.ts → types/TokensController.d.ts} +26 -19
  185. package/dist/types/TokensController.d.ts.map +1 -0
  186. package/dist/{assetsUtil.d.ts → types/assetsUtil.d.ts} +1 -2
  187. package/dist/types/assetsUtil.d.ts.map +1 -0
  188. package/dist/types/constants.d.ts.map +1 -0
  189. package/dist/types/crypto-compare.d.ts.map +1 -0
  190. package/dist/{index.d.ts → types/index.d.ts} +6 -3
  191. package/dist/types/index.d.ts.map +1 -0
  192. package/dist/types/token-prices-service/abstract-token-prices-service.d.ts.map +1 -0
  193. package/dist/types/token-prices-service/codefi-v2.d.ts.map +1 -0
  194. package/dist/types/token-prices-service/index.d.ts.map +1 -0
  195. package/dist/types/token-service.d.ts.map +1 -0
  196. package/package.json +30 -13
  197. package/dist/AccountTrackerController.d.ts.map +0 -1
  198. package/dist/AssetsContractController.d.ts.map +0 -1
  199. package/dist/CurrencyRateController.d.ts.map +0 -1
  200. package/dist/NftController.d.ts.map +0 -1
  201. package/dist/NftDetectionController.d.ts.map +0 -1
  202. package/dist/Standards/ERC20Standard.d.ts.map +0 -1
  203. package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.d.ts.map +0 -1
  204. package/dist/Standards/NftStandards/ERC721/ERC721Standard.d.ts.map +0 -1
  205. package/dist/Standards/standards-types.d.ts +0 -15
  206. package/dist/Standards/standards-types.d.ts.map +0 -1
  207. package/dist/Standards/standards-types.js +0 -3
  208. package/dist/Standards/standards-types.js.map +0 -1
  209. package/dist/TokenBalancesController.d.ts.map +0 -1
  210. package/dist/TokenDetectionController.d.ts +0 -88
  211. package/dist/TokenDetectionController.d.ts.map +0 -1
  212. package/dist/TokenListController.d.ts.map +0 -1
  213. package/dist/TokenRatesController.d.ts.map +0 -1
  214. package/dist/TokensController.d.ts.map +0 -1
  215. package/dist/assetsUtil.d.ts.map +0 -1
  216. package/dist/constants.d.ts.map +0 -1
  217. package/dist/crypto-compare.d.ts.map +0 -1
  218. package/dist/index.d.ts.map +0 -1
  219. package/dist/token-prices-service/abstract-token-prices-service.d.ts.map +0 -1
  220. package/dist/token-prices-service/codefi-v2.d.ts.map +0 -1
  221. package/dist/token-prices-service/index.d.ts.map +0 -1
  222. package/dist/token-service.d.ts.map +0 -1
  223. /package/dist/{AccountTrackerController.d.ts → types/AccountTrackerController.d.ts} +0 -0
  224. /package/dist/{CurrencyRateController.d.ts → types/CurrencyRateController.d.ts} +0 -0
  225. /package/dist/{NftController.d.ts → types/NftController.d.ts} +0 -0
  226. /package/dist/{NftDetectionController.d.ts → types/NftDetectionController.d.ts} +0 -0
  227. /package/dist/{Standards → types/Standards}/NftStandards/ERC721/ERC721Standard.d.ts +0 -0
  228. /package/dist/{TokenListController.d.ts → types/TokenListController.d.ts} +0 -0
  229. /package/dist/{TokenRatesController.d.ts → types/TokenRatesController.d.ts} +0 -0
  230. /package/dist/{constants.d.ts → types/constants.d.ts} +0 -0
  231. /package/dist/{crypto-compare.d.ts → types/crypto-compare.d.ts} +0 -0
  232. /package/dist/{token-prices-service → types/token-prices-service}/abstract-token-prices-service.d.ts +0 -0
  233. /package/dist/{token-prices-service → types/token-prices-service}/codefi-v2.d.ts +0 -0
  234. /package/dist/{token-prices-service → types/token-prices-service}/index.d.ts +0 -0
  235. /package/dist/{token-service.d.ts → types/token-service.d.ts} +0 -0
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,14 +7,86 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## [Unreleased]
8
9
 
10
+ ## [27.0.0]
11
+
12
+ ### Added
13
+
14
+ - **BREAKING**: Add ESM build ([#3998](https://github.com/MetaMask/core/pull/3998))
15
+ - It's no longer possible to import files from `./dist` directly.
16
+
17
+ ### Changed
18
+
19
+ - **BREAKING:** Bump dependency and peer dependency on `@metamask/accounts-controller` to `^12.0.0` ([#4039](https://github.com/MetaMask/core/pull/4039))
20
+ - **BREAKING:** Bump dependency and peer dependency on `@metamask/approval-controller` to `^6.0.0` ([#4039](https://github.com/MetaMask/core/pull/4039))
21
+ - **BREAKING:** Bump `@metamask/base-controller` to `^5.0.0` ([#4039](https://github.com/MetaMask/core/pull/4039))
22
+ - This version has a number of breaking changes. See the changelog for more.
23
+ - **BREAKING:** Bump dependency and peer dependency on `@metamask/keyring-controller` to `^14.0.0` ([#4039](https://github.com/MetaMask/core/pull/4039))
24
+ - **BREAKING:** Bump dependency and peer dependency on `@metamask/network-controller` to `^18.0.0` ([#4039](https://github.com/MetaMask/core/pull/4039))
25
+ - **BREAKING:** Bump dependency and peer dependency on `@metamask/preferences-controller` to `^9.0.0` ([#4039](https://github.com/MetaMask/core/pull/4039))
26
+ - Relax `TokensControllerGetStateAction` and `TokensControllerStateChangeEvent` types so that they no longer constrain the `TokensController` state in the action handler and event payload to `Record<string, Json>` ([#3949](https://github.com/MetaMask/core/pull/3949))
27
+ - Bump `@metamask/controller-utils` to `^9.0.0` ([#4039](https://github.com/MetaMask/core/pull/4039))
28
+ - Bump `@metamask/polling-controller` to `^6.0.0` ([#4039](https://github.com/MetaMask/core/pull/4039))
29
+
30
+ ## [26.0.0]
31
+
32
+ ### Added
33
+
34
+ - **BREAKING:** `TokenDetectionController` newly subscribes to the `PreferencesController:stateChange`, `AccountsController:selectedAccountChange`, `KeyringController:lock`, and `KeyringController:unlock` events, and allows messenger actions `AccountsController:getSelectedAccount`, `NetworkController:getNetworkClientById`, `NetworkController:getNetworkConfigurationByNetworkClientId`, `NetworkController:getState`, `KeyringController:getState`, `PreferencesController:getState`, `TokenListController:getState`, `TokensController:getState`, and `TokensController:addDetectedTokens` ([#3775](https://github.com/MetaMask/core/pull/3775/), [#3923](https://github.com/MetaMask/core/pull/3923/), [#3938](https://github.com/MetaMask/core/pull/3938))
35
+ - `TokensController` now exports `TokensControllerActions`, `TokensControllerGetStateAction`, `TokensControllerAddDetectedTokensAction`, `TokensControllerEvents`, and `TokensControllerStateChangeEvent` ([#3690](https://github.com/MetaMask/core/pull/3690/))
36
+
37
+ ### Changed
38
+
39
+ - **BREAKING:** Add `@metamask/accounts-controller` `^11.0.0` as dependency and peer dependency ([#3775](https://github.com/MetaMask/core/pull/3775/), [#4007](https://github.com/MetaMask/core/pull/4007))
40
+ - **BREAKING:** Add `@metamask/keyring-controller` `^13.0.0` as dependency and peer dependency ([#3775](https://github.com/MetaMask/core/pull/3775), [#4007](https://github.com/MetaMask/core/pull/4007))
41
+ - **BREAKING:** Bump `@metamask/preferences-controller` dependency and peer dependency to `^8.0.0` ([#4007](https://github.com/MetaMask/core/pull/4007))
42
+ - **BREAKING:** `TokenDetectionController` is merged with `DetectTokensController` from the `metamask-extension` repo ([#3775](https://github.com/MetaMask/core/pull/3775/), [#3923](https://github.com/MetaMask/core/pull/3923)), ([#3938](https://github.com/MetaMask/core/pull/3938))
43
+ - **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`.
44
+ - **BREAKING:** `TokenDetectionController` now refetches tokens on `NetworkController:networkDidChange` if the `networkClientId` is changed instead of `chainId`.
45
+ - **BREAKING:** `TokenDetectionController` cannot initiate polling or token detection if `KeyringController` state is locked.
46
+ - **BREAKING:** The `detectTokens` method input option `accountAddress` has been renamed to `selectedAddress`.
47
+ - **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.
48
+ - **BREAKING:** The constructor for `TokenDetectionController` expects a new required property `trackMetaMetricsEvent`, which defines the callback that is called in the `detectTokens` method.
49
+ - **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).
50
+ - **BREAKING:** The `TokensState` type is now defined as a type alias rather than an interface. ([#3690](https://github.com/MetaMask/core/pull/3690/))
51
+ - This is breaking because it could affect how this type is used with other types, such as `Json`, which does not support TypeScript interfaces.
52
+ - The constructor option `selectedAddress` no longer defaults to `''` if omitted. Instead, the correct address is assigned using the `AccountsController:getSelectedAccount` messenger action.
53
+ - **BREAKING:** Change type of `provider` property in `AssetsContractController` from `any` to `Provider` from `@metamask/network-controller` ([#3818](https://github.com/MetaMask/core/pull/3818))
54
+ - **BREAKING:** Change type of `provider` property in `TokensController` from `any` to `Provider` from `@metamask/network-controller` ([#3818](https://github.com/MetaMask/core/pull/3818))
55
+ - Bump `@metamask/approval-controller` to `^5.1.3` ([#4007](https://github.com/MetaMask/core/pull/4007))
56
+ - Bump `@metamask/controller-utils` to `^8.0.4` ([#4007](https://github.com/MetaMask/core/pull/4007))
57
+ - Bump `@metamask/ethjs-unit` to `^0.3.0` ([#3897](https://github.com/MetaMask/core/pull/3897))
58
+ - Bump `@metamask/network-controller` to `^17.2.1` ([#4007](https://github.com/MetaMask/core/pull/4007))
59
+ - Bump `@metamask/polling-controller` to `^5.0.1` ([#4007](https://github.com/MetaMask/core/pull/4007))
60
+ - Bump `@metamask/rpc-errors` to `^6.2.1` ([#3970](https://github.com/MetaMask/core/pull/3970), [#3954](https://github.com/MetaMask/core/pull/3954))
61
+ - Replace `ethereumjs-util` with `@ethereumjs/util` and `bn.js` ([#3943](https://github.com/MetaMask/core/pull/3943))
62
+ - Update `CodefiTokenPricesServiceV2` so that requests to the price API now use the `No-Cache` HTTP header ([#3939](https://github.com/MetaMask/core/pull/3939))
63
+
64
+ ### Removed
65
+
66
+ - **BREAKING:** `TokenDetectionController` constructor no longer accepts options `networkClientId`, `onPreferencesStateChange`, `getPreferencesState`, `getTokensState`, or `addDetectedTokens` ([#3690](https://github.com/MetaMask/core/pull/3690/), [#3775](https://github.com/MetaMask/core/pull/3775/), [#3938](https://github.com/MetaMask/core/pull/3938))
67
+ - **BREAKING:** `TokenDetectionController` no longer allows the `NetworkController:stateChange` event. ([#3775](https://github.com/MetaMask/core/pull/3775/))
68
+ - The `NetworkController:networkDidChange` event can be used instead.
69
+ - **BREAKING:** `TokenDetectionController` constructor no longer accepts options `networkClientId`, `onPreferencesStateChange`, `getPreferencesState`, `getTokensState`, or `addDetectedTokens` ([#3690](https://github.com/MetaMask/core/pull/3690/), [#3775](https://github.com/MetaMask/core/pull/3775/), [#3938](https://github.com/MetaMask/core/pull/3938))
70
+ - **BREAKING:** `TokenBalancesController` constructor no longer accepts options `onTokensStateChange`, `getSelectedAddress` ([#3690](https://github.com/MetaMask/core/pull/3690/))
71
+
72
+ ### Fixed
73
+
74
+ - `TokenDetectionController.detectTokens()` now reads the chain ID keyed state properties from `TokenListController` and `TokensController` rather than incorrectly using the globally selected state properties when a network client ID is passed ([#3914](https://github.com/MetaMask/core/pull/3914))
75
+ - Fix `PreferencesController` state listener in `NftDetectionController` so that NFT detection is not run when any preference changes, but only when NFT detection is enabled ([#3917](https://github.com/MetaMask/core/pull/3917))
76
+ - Fix `isTokenListSupportedForNetwork` so that it returns false for chain 1337 ([#3777](https://github.com/MetaMask/core/pull/3777))
77
+ - When used in combination with `TokensController`, this makes it possible to import an ERC-20 token on a locally run chain.
78
+
9
79
  ## [25.0.0]
80
+
10
81
  ### Added
82
+
11
83
  - Add Linea to price api supported chains ([#3797](https://github.com/MetaMask/core/pull/3797))
12
84
 
13
85
  ### Changed
86
+
14
87
  - **BREAKING:** Convert `TokenBalancesController` to `BaseControllerV2` ([#3750](https://github.com/MetaMask/core/pull/3750))
15
- - 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.
16
- - State now saves tokens balances as strings and not as a BNs.
88
+ - 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.
89
+ - State now saves tokens balances as strings and not as a BNs.
17
90
  - Additional BN export has been removed as it was intended to be removed in the next major release.
18
91
  - **BREAKING:** Bump `@metamask/approval-controller` peer dependency to `^5.1.2` ([#3821](https://github.com/MetaMask/core/pull/3821))
19
92
  - **BREAKING:** Bump `@metamask/network-controller` peer dependency to `^17.2.0` ([#3821](https://github.com/MetaMask/core/pull/3821))
@@ -24,33 +97,41 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
24
97
  - Bump `@metamask/polling-controller` to `^5.0.0` ([#3821](https://github.com/MetaMask/core/pull/3821))
25
98
 
26
99
  ## [24.0.0]
100
+
27
101
  ### Added
102
+
28
103
  - Add `getDefaultTokenListState` function to `TokenListController` ([#3744](https://github.com/MetaMask/core/pull/3744))
29
104
  - Add `getDefaultNftState` function to the `NftController` ([#3742](https://github.com/MetaMask/core/pull/3742))
30
105
  - Add `getDefaultTokensState` function to the `TokensController` ([#3743](https://github.com/MetaMask/core/pull/3743))
31
106
 
32
107
  ### Changed
108
+
33
109
  - **BREAKING:** Bump `@metamask/preferences-controller` to ^6.0.0
34
110
  - Price API perf improvements ([#3753](https://github.com/MetaMask/core/pull/3753), [#3755](https://github.com/MetaMask/core/pull/3755))
35
111
  - Reduce token batch size from 100 to 30
36
112
  - Sort token addresses in query params for more cache hits
37
113
 
38
114
  ## [23.1.0]
115
+
39
116
  ### Added
117
+
40
118
  - Add support to `CodefiTokenPricesServiceV2` for tracking degraded service ([#3691](https://github.com/MetaMask/core/pull/3691))
41
119
  - 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.
42
120
 
43
121
  ## [23.0.0]
122
+
44
123
  ### Added
124
+
45
125
  - Add `onBreak` handler to `CodefiTokenPricesServiceV2` ([#3677](https://github.com/MetaMask/core/pull/3677))
46
126
  - This allows listening for "circuit breaks", which can indicate an outage. Useful for metrics.
47
127
  - Add `fetchTokenContractExchangeRates` utility method ([#3657](https://github.com/MetaMask/core/pull/3657))
48
128
  - `TokenListController` now exports a `TokenListControllerMessenger` type ([#3609](https://github.com/MetaMask/core/pull/3609)).
49
129
  - `TokenDetectionController` exports types `TokenDetectionControllerMessenger`, `TokenDetectionControllerActions`, `TokenDetectionControllerGetStateAction`, `TokenDetectionControllerEvents`, `TokenDetectionControllerStateChangeEvent` ([#3609](https://github.com/MetaMask/core/pull/3609)).
50
- - 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)).
130
+ - 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)).
51
131
  - 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.
52
132
 
53
133
  ### Changed
134
+
54
135
  - **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))
55
136
  - **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))
56
137
  - **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))
@@ -63,19 +144,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
63
144
  - Bump `@metamask/controller-utils` from `8.0.0` to `^8.0.1` ([#3695](https://github.com/MetaMask/core/pull/3695))
64
145
 
65
146
  ### Fixed
147
+
66
148
  - Fix error caused by OpenSea API rename of `supply` to `total_supply` ([#3692](https://github.com/MetaMask/core/pull/3692))
67
149
  - Fix `CodefiTokenPricesServiceV2` support for Shiden ([#3683](https://github.com/MetaMask/core/pull/3683))
68
150
  - Improve how `CodefiTokenPricesServiceV2` handles token price update failures ([#3687](https://github.com/MetaMask/core/pull/3687))
69
151
  - 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.
70
152
 
71
153
  ## [22.0.0]
154
+
72
155
  ### Changed
156
+
73
157
  - **BREAKING:** OpenSea V2 API is used instead of V1 ([#3654](https://github.com/MetaMask/core/pull/3654))
74
- - `NftDetectionController` constructor now requires the `NftController.getNftApi` function.
158
+ - `NftDetectionController` constructor now requires the `NftController.getNftApi` function.
75
159
  - NFT controllers will no longer return `last_sale` information for NFTs fetched after the OpenSea V2 update
76
160
 
77
161
  ## [21.0.0]
162
+
78
163
  ### Added
164
+
79
165
  - 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))
80
166
  - 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.
81
167
  - The `CodefiTokenPricesServiceV2` will retry if the token price update fails
@@ -90,6 +176,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
90
176
  - Support token detection on Arbitrum and Optimism ([#2035](https://github.com/MetaMask/core/pull/2035))
91
177
 
92
178
  ### Changed
179
+
93
180
  - **BREAKING:** `TokenRatesController` now takes a required argument `tokenPricesService` ([#3600](https://github.com/MetaMask/core/pull/3600))
94
181
  - This object is responsible for fetching the prices for tokens held by this controller.
95
182
  - **BREAKING:** Update signature of `TokenRatesController.updateExchangeRatesByChainId` ([#3600](https://github.com/MetaMask/core/pull/3600), [#3653](https://github.com/MetaMask/core/pull/3653))
@@ -98,8 +185,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
98
185
  - These are needed for the new "polling by `networkClientId`" feature
99
186
  - **BREAKING:** `AccountTrackerController` has a new required state property, `accountByChainId`([#3586](https://github.com/MetaMask/core/pull/3586))
100
187
  - 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.
101
- - **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))
102
- - **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))
188
+ - **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))
189
+ - **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))
103
190
  - The `TokensController` constructor no longer accepts a `getERC20TokenName` option. It was no longer needed due to this change.
104
191
  - Add new method `_getProvider`, though this is intended for internal use and should not be called externally.
105
192
  - Additionally, if the symbol and decimals are defined in the contract, they are no longer required to be passed to `watchAsset`
@@ -123,18 +210,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
123
210
  - Add dependencies `cockatiel` and `lodash` ([#3586](https://github.com/MetaMask/core/pull/3586), [#3655](https://github.com/MetaMask/core/pull/3655))
124
211
 
125
212
  ### Removed
213
+
126
214
  - **BREAKING:** Remove `fetchExchangeRate` method from TokenRatesController ([#3600](https://github.com/MetaMask/core/pull/3600))
127
215
  - 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.
128
216
  - **BREAKING:** Remove `getChainSlug` method from TokenRatesController ([#3600](https://github.com/MetaMask/core/pull/3600))
129
217
  - This method was previously used in TokenRatesController to access the CoinGecko API. There is no equivalent.
130
218
  - **BREAKING:** Remove `CoinGeckoResponse` and `CoinGeckoPlatform` types ([#3600](https://github.com/MetaMask/core/pull/3600))
131
219
  - These types were previously used in TokenRatesController to represent data returned from the CoinGecko API. There is no equivalent.
132
- - **BREAKING**: The TokenRatesController now only supports updating and polling rates for tokens tracked by the TokensController ([#3639](https://github.com/MetaMask/core/pull/3639))
220
+ - **BREAKING:** The TokenRatesController now only supports updating and polling rates for tokens tracked by the TokensController ([#3639](https://github.com/MetaMask/core/pull/3639))
133
221
  - The `tokenAddresses` option has been removed from `startPollingByNetworkClientId`
134
222
  - The `tokenContractAddresses` option has been removed from `updateExchangeRatesByChainId`
135
- - **BREAKING**: `TokenRatesController.fetchAndMapExchangeRates` is no longer exposed publicly ([#3621](https://github.com/MetaMask/core/pull/3621))
223
+ - **BREAKING:** `TokenRatesController.fetchAndMapExchangeRates` is no longer exposed publicly ([#3621](https://github.com/MetaMask/core/pull/3621))
136
224
 
137
225
  ### Fixed
226
+
138
227
  - 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))
139
228
  - 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.
140
229
  - Prevent redundant overlapping token rate updates in `TokenRatesController` ([#3635](https://github.com/MetaMask/core/pull/3635))
@@ -146,7 +235,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
146
235
  - This affects `watchNft` and `addNft` methods
147
236
 
148
237
  ## [20.0.0]
238
+
149
239
  ### Added
240
+
150
241
  - **BREAKING**: `TokenRatesControllerState` now has required `contractExchangeRatesByChainId` property which an object keyed by `chainId` and `nativeCurrency` ([#2015](https://github.com/MetaMask/core/pull/2015))
151
242
  - **BREAKING**: `TokenRatesController` constructor params now requires `getNetworkClientById` ([#2015](https://github.com/MetaMask/core/pull/2015))
152
243
  - Add types `CurrencyRateControllerEvents` and `CurrencyRateControllerActions` ([#2029](https://github.com/MetaMask/core/pull/2029))
@@ -163,6 +254,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
163
254
  - `TokenRatesController.fetchAndMapExchangeRates()` now accepts an optional `tokenAddresses` as the last parameter ([#2015](https://github.com/MetaMask/core/pull/2015))
164
255
 
165
256
  ### Changed
257
+
166
258
  - **BREAKING:** Bump dependency on `@metamask/base-controller` to ^4.0.0 ([#2063](https://github.com/MetaMask/core/pull/2063))
167
259
  - This is breaking because the type of the `messenger` has backward-incompatible changes. See the changelog for this package for more.
168
260
  - Bump `@metamask/approval-controller` to ^5.0.0 ([#2063](https://github.com/MetaMask/core/pull/2063))
@@ -172,14 +264,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
172
264
  - Bump `@metamask/preferences-controller` to ^5.0.0 ([#2063](https://github.com/MetaMask/core/pull/2063))
173
265
 
174
266
  ## [19.0.0]
267
+
175
268
  ### Changed
269
+
176
270
  - **BREAKING:** Bump dependency and peer dependency on `@metamask/network-controller` to ^16.0.0
177
271
  - Add optional `networkClientId` and `userAddress` args to remaining `NftController` public methods ([#2006](https://github.com/MetaMask/core/pull/2006))
178
272
  - `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.
179
273
  - **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.
180
274
  - **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.
181
275
  - **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.
182
- ***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.
276
+ **\*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.
183
277
  - **BREAKING**: `validateWatchNft` method on `NftController` is now private.
184
278
  - **BREAKING**: `detectNfts` on `NftDetectionController` now accepts a single object argument with optional properties `networkClientId` and `userAddress`, rather than taking these as two sequential arguments.
185
279
  - Bump dependency `@metamask/eth-query` from ^3.0.1 to ^4.0.0 ([#2028](https://github.com/MetaMask/core/pull/2028))
@@ -187,10 +281,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
187
281
  - Bump `@metamask/utils` from 8.1.0 to 8.2.0 ([#1957](https://github.com/MetaMask/core/pull/1957))
188
282
 
189
283
  ### Fixed
284
+
190
285
  - 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))
191
286
 
192
287
  ## [18.0.0]
288
+
193
289
  ### Changed
290
+
194
291
  - **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.
195
292
  - ```
196
293
  export type CurrencyRateState = {
@@ -205,27 +302,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
205
302
  >;
206
303
  };
207
304
  ```
208
- - **BREAKING**: `CurrencyRateController` now extends `PollingController` ([#1805](https://github.com/MetaMask/core/pull/1805))
305
+ - **BREAKING**: `CurrencyRateController` now extends `PollingController` ([#1805](https://github.com/MetaMask/core/pull/1805))
209
306
  - `start()` and `stop()` methods replaced with `startPollingByNetworkClientId()`, `stopPollingByPollingToken()`, and `stopAllPolling()`
210
- - **BREAKING**: `CurrencyRateController` now sends the `NetworkController:getNetworkClientById` action via messaging controller ([#1805](https://github.com/MetaMask/core/pull/1805))
307
+ - **BREAKING:** `CurrencyRateController` now sends the `NetworkController:getNetworkClientById` action via messaging controller ([#1805](https://github.com/MetaMask/core/pull/1805))
211
308
 
212
309
  ### Fixed
310
+
213
311
  - Parallelize network requests in assets controllers for performance enhancement ([#1801](https://github.com/MetaMask/core/pull/1801))
214
312
  - Fix token detection on accounts when user changes account after token detection request is inflight ([#1848](https://github.com/MetaMask/core/pull/1848))
215
313
 
216
314
  ## [17.0.0]
315
+
217
316
  ### Changed
317
+
218
318
  - **BREAKING:** Bump dependency on `@metamask/polling-controller` to ^1.0.0
219
319
  - Bump dependency and peer dependency on `@metamask/network-controller` to ^15.1.0
220
320
 
221
321
  ## [16.0.0]
322
+
222
323
  ### Added
324
+
223
325
  - 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))
224
326
  - Add optional second argument to `stopPollingByPollingToken` (formerly `stopPollingByNetworkClientId`)
225
327
  - Add optional second argument to `onPollingCompleteByNetworkClientId`
226
328
  - Add support for token detection for Linea mainnet and Linea Goerli ([#1799](https://github.com/MetaMask/core/pull/1799))
227
329
 
228
330
  ### Changed
331
+
229
332
  - **BREAKING:** Bump dependency and peer dependency on `@metamask/network-controller` to ^15.0.0
230
333
  - **BREAKING:** Make `executePoll` in TokenListController private ([#1810](https://github.com/MetaMask/core/pull/1810))
231
334
  - **BREAKING:** Update TokenListController to rename `stopPollingByNetworkClientId` to `stopPollingByPollingToken` ([#1810](https://github.com/MetaMask/core/pull/1810))
@@ -235,7 +338,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
235
338
  - Fix support for NFT metadata stored outside IPFS ([#1772](https://github.com/MetaMask/core/pull/1772))
236
339
 
237
340
  ## [15.0.0]
341
+
238
342
  ### Changed
343
+
239
344
  - **BREAKING**: `NftController` now expects `getNetworkClientById` in constructor options ([#1698](https://github.com/MetaMask/core/pull/1698))
240
345
  - **BREAKING**: `NftController.addNft` function signature has changed ([#1698](https://github.com/MetaMask/core/pull/1698))
241
346
  - Previously
@@ -261,7 +366,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
261
366
  networkClientId?: NetworkClientId; // new
262
367
  },
263
368
  ```
264
- - `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))
369
+ - `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))
265
370
  - `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))
266
371
  - `NftController.addNft` will use the chainId value derived from `networkClientId` if provided ([#1698](https://github.com/MetaMask/core/pull/1698))
267
372
  - `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))
@@ -272,19 +377,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
272
377
  - Bump dependency and peer dependency on `@metamask/network-controller` to ^14.0.0
273
378
 
274
379
  ### Fixed
380
+
275
381
  - 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))
276
382
 
277
383
  ## [14.0.0]
384
+
278
385
  ### Changed
386
+
279
387
  - Update TypeScript to v4.8.x ([#1718](https://github.com/MetaMask/core/pull/1718))
280
388
  - Update `@metamask/rpc-errors` to `^6.0.0` ([#1690](https://github.com/MetaMask/core/pull/1690))
281
389
 
282
390
  ### Removed
391
+
283
392
  - **BREAKING:** Remove AbortController polyfill
284
393
  - This package now assumes that the AbortController global exists
285
394
 
286
395
  ## [13.0.0]
396
+
287
397
  ### Changed
398
+
288
399
  - **BREAKING**: `TokensController` now expects `getNetworkClientById` in constructor options ([#1676](https://github.com/MetaMask/core/pull/1676))
289
400
  - **BREAKING**: `TokensController.addToken` now accepts a single options object ([#1676](https://github.com/MetaMask/core/pull/1676))
290
401
  ```
@@ -298,7 +409,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
298
409
  networkClientId?: NetworkClientId;
299
410
  }
300
411
  ```
301
- - **BREAKING**: Bump peer dependency on `@metamask/network-controller` to ^13.0.0 ([#1633](https://github.com/MetaMask/core/pull/1633))
412
+ - **BREAKING:** Bump peer dependency on `@metamask/network-controller` to ^13.0.0 ([#1633](https://github.com/MetaMask/core/pull/1633))
302
413
  - **CHANGED**: `TokensController.addToken` will use the chain ID value derived from state for `networkClientId` if provided ([#1676](https://github.com/MetaMask/core/pull/1676))
303
414
  - **CHANGED**: `TokensController.addTokens` now accepts an optional `networkClientId` as the last parameter ([#1676](https://github.com/MetaMask/core/pull/1676))
304
415
  - **CHANGED**: `TokensController.addTokens` will use the chain ID value derived from state for `networkClientId` if provided ([#1676](https://github.com/MetaMask/core/pull/1676))
@@ -307,33 +418,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
307
418
  - Bump dependency on `@metamask/preferences-controller` to ^4.4.1 ([#1676](https://github.com/MetaMask/core/pull/1676))
308
419
 
309
420
  ## [12.0.0]
421
+
310
422
  ### Added
423
+
311
424
  - Add `AssetsContractController` methods `getProvider`, `getChainId`, `getERC721Standard`, and `getERC1155Standard` ([#1638](https://github.com/MetaMask/core/pull/1638))
312
425
 
313
426
  ### Changed
427
+
314
428
  - **BREAKING**: Add `getNetworkClientById` to `AssetsContractController` constructor options ([#1638](https://github.com/MetaMask/core/pull/1638))
315
- - Add optional `networkClientId` parameter to various `AssetContractController` methods ([#1638](https://github.com/MetaMask/core/pull/1638))
316
- - The affected methods are:
317
- - `getERC20BalanceOf`
318
- - `getERC20TokenDecimals`
319
- - `getERC20TokenName`
320
- - `getERC721NftTokenId`
321
- - `getTokenStandardAndDetails`
322
- - `getERC721TokenURI`
323
- - `getERC721AssetName`
324
- - `getERC721AssetSymbol`
325
- - `getERC721OwnerOf`
326
- - `getERC1155TokenURI`
327
- - `getERC1155BalanceOf`
328
- - `transferSingleERC1155`
329
- - `getBalancesInSingleCall`
429
+ - Add optional `networkClientId` parameter to various `AssetContractController` methods ([#1638](https://github.com/MetaMask/core/pull/1638))
430
+ - The affected methods are:
431
+ - `getERC20BalanceOf`
432
+ - `getERC20TokenDecimals`
433
+ - `getERC20TokenName`
434
+ - `getERC721NftTokenId`
435
+ - `getTokenStandardAndDetails`
436
+ - `getERC721TokenURI`
437
+ - `getERC721AssetName`
438
+ - `getERC721AssetSymbol`
439
+ - `getERC721OwnerOf`
440
+ - `getERC1155TokenURI`
441
+ - `getERC1155BalanceOf`
442
+ - `transferSingleERC1155`
443
+ - `getBalancesInSingleCall`
330
444
 
331
445
  ## [11.1.0]
446
+
332
447
  ### Added
448
+
333
449
  - Add `tokenURI` to `NftMetadata` type ([#1577](https://github.com/MetaMask/core/pull/1577))
334
450
  - Populate token URL for NFT metadata under `tokenURI` ([#1577](https://github.com/MetaMask/core/pull/1577))
335
451
 
336
452
  ### Changed
453
+
337
454
  - Bump dependency and peer dependency on `@metamask/approval-controller` to ^3.5.1
338
455
  - Bump dependency on `@metamask/base-controller` to ^3.2.1
339
456
  - Bump dependency on `@metamask/controller-utils` to ^4.3.2
@@ -342,38 +459,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
342
459
  - Update NftController to add fallback for when IPFS gateway is disabled ([#1577](https://github.com/MetaMask/core/pull/1577))
343
460
 
344
461
  ## [11.0.1]
462
+
345
463
  ### Changed
464
+
346
465
  - Replace `eth-query` ^2.1.2 with `@metamask/eth-query` ^3.0.1 ([#1546](https://github.com/MetaMask/core/pull/1546))
347
466
 
348
467
  ## [11.0.0]
468
+
349
469
  ### Added
470
+
350
471
  - Add a `stop` method to stop polling
351
472
 
352
473
  ### Changed
474
+
353
475
  - **BREAKING**: New required constructor parameters for the `TokenRatesController` ([#1497](https://github.com/MetaMask/core/pull/1497), [#1511](https://github.com/MetaMask/core/pull/1511))
354
476
  - The new required parameters are `ticker`, `onSelectedAddress`, and `onPreferencesStateChange`
355
- - **BREAKING**: Remove `onCurrencyRateStateChange` constructor parameter from `TokenRatesController` ([#1496](https://github.com/MetaMask/core/pull/1496))
356
- - **BREAKING**: Disable `TokenRatesController` automatic polling ([#1501](https://github.com/MetaMask/core/pull/1501))
477
+ - **BREAKING:** Remove `onCurrencyRateStateChange` constructor parameter from `TokenRatesController` ([#1496](https://github.com/MetaMask/core/pull/1496))
478
+ - **BREAKING:** Disable `TokenRatesController` automatic polling ([#1501](https://github.com/MetaMask/core/pull/1501))
357
479
  - Polling must be started explicitly by calling the `start` method
358
480
  - The token rates are not updated upon state changes when polling is disabled.
359
- - **BREAKING**: Replace the `poll` method with `start` ([#1501](https://github.com/MetaMask/core/pull/1501))
481
+ - **BREAKING:** Replace the `poll` method with `start` ([#1501](https://github.com/MetaMask/core/pull/1501))
360
482
  - The `start` method does not offer a way to change the interval. That must be done by calling `.configure` instead
361
- - **BREAKING**: Remove `TokenRatecontroller` setter for `chainId` and `tokens` properties ([#1505](https://github.com/MetaMask/core/pull/1505))
483
+ - **BREAKING:** Remove `TokenRatecontroller` setter for `chainId` and `tokens` properties ([#1505](https://github.com/MetaMask/core/pull/1505))
362
484
  - Bump @metamask/abi-utils from 1.2.0 to 2.0.1 ([#1525](https://github.com/MetaMask/core/pull/1525))
363
485
  - Update `@metamask/utils` to `^6.2.0` ([#1514](https://github.com/MetaMask/core/pull/1514))
364
486
  - Remove unnecessary `babel-runtime` dependency ([#1504](https://github.com/MetaMask/core/pull/1504))
365
487
 
366
488
  ### Fixed
489
+
367
490
  - 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))
368
491
  - 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))
369
492
  - Prevent redundant token rate updates ([#1512](https://github.com/MetaMask/core/pull/1512))
370
493
 
371
494
  ## [10.0.0]
495
+
372
496
  ### Added
497
+
373
498
  - The method `getERC20TokenName` has been added to `AssetsContractController` ([#1127](https://github.com/MetaMask/core/pull/1127))
374
499
  - This method gets the token name from the token contract
375
500
 
376
501
  ### Changed
502
+
377
503
  - **BREAKING:** The tokens controller now requires `onTokenListStateChange` and `getERC20TokenName` as constructor parameters ([#1127](https://github.com/MetaMask/core/pull/1127))
378
504
  - The `getERC20TokenName` method is used to get the token name for tokens added via `wallet_watchAsset`
379
505
  - 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.
@@ -384,19 +510,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
384
510
  - The `Token` type now includes an optional `name` field ([#1127](https://github.com/MetaMask/core/pull/1127))
385
511
 
386
512
  ## [9.2.0]
513
+
387
514
  ### Added
515
+
388
516
  - 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))
389
517
 
390
518
  ## [9.1.0]
519
+
391
520
  ### Added
521
+
392
522
  - Add a fifth argument, `source`, to NftController's `addNft` method ([#1417](https://github.com/MetaMask/core/pull/1417))
393
523
  - This argument can be used to specify whether the NFT was detected, added manually, or suggested by a dapp
394
524
 
395
525
  ### Fixed
526
+
396
527
  - 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))
397
528
 
398
529
  ## [9.0.0]
530
+
399
531
  ### Added
532
+
400
533
  - **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))
401
534
  - Previously, the controller would refresh all account balances, but these options can be used to only refresh the currently selected account
402
535
  - **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))
@@ -404,15 +537,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
404
537
  - 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`.
405
538
 
406
539
  ### Changed
540
+
407
541
  - Add dependency on `@ethersproject/address` ([#1173](https://github.com/MetaMask/core/pull/1173))
408
542
  - Replace `eth-rpc-errors` with `@metamask/rpc-errors` ([#1173](https://github.com/MetaMask/core/pull/1173))
409
543
 
410
544
  ## [8.0.0]
545
+
411
546
  ### Added
547
+
412
548
  - Support NFT detection on Ethereum Mainnet custom RPC endpoints ([#1360](https://github.com/MetaMask/core/pull/1360))
413
549
  - Enable token detection for the Aurora network ([#1327](https://github.com/MetaMask/core/pull/1327))
414
550
 
415
551
  ### Changed
552
+
416
553
  - **BREAKING:** Bump to Node 16 ([#1262](https://github.com/MetaMask/core/pull/1262))
417
554
  - **BREAKING:** Change format of chain ID in state to 0x-prefixed hex string ([#1367](https://github.com/MetaMask/core/pull/1367))
418
555
  - The functions `isTokenDetectionSupportedForNetwork` and `formatIconUrlWithProxy` now expect a chain ID as type `Hex` rather than as a decimal `string`
@@ -432,17 +569,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
432
569
  - The tokens controller `addDetectedTokens` method now accepts the `chainId` property of the `detectionDetails` parameter to be of type `Hex` rather than decimal `string`.
433
570
  - The tokens controller state properties `allTokens`, `allIgnoredTokens`, and `allDetectedTokens` are now keyed by chain ID in `Hex` format rather than decimal `string`.
434
571
  - This requires a state migration
435
- - **BREAKING**: Use approval controller for suggested assets ([#1261](https://github.com/MetaMask/core/pull/1261), [#1268](https://github.com/MetaMask/core/pull/1268))
572
+ - **BREAKING:** Use approval controller for suggested assets ([#1261](https://github.com/MetaMask/core/pull/1261), [#1268](https://github.com/MetaMask/core/pull/1268))
436
573
  - The actions `ApprovalController:acceptRequest` and `ApprovalController:rejectRequest` are no longer required by the token controller messenger.
437
574
  - The `suggestedAssets` state has been removed, which means that suggested assets are no longer persisted in state
438
575
  - The return type for `watchAsset` has changed. It now returns a Promise that settles after the request has been confirmed or rejected.
439
576
  - **BREAKING:** Initialize controllers with the current network ([#1361](https://github.com/MetaMask/core/pull/1361))
440
577
  - The following controllers now have a new `chainId` required constructor parameter:
441
- * `AssetsContractController`
442
- * `NftController`
443
- * `NftDetectionController`
444
- * `TokenRatesController`
445
- * `TokensController`
578
+ - `AssetsContractController`
579
+ - `NftController`
580
+ - `NftDetectionController`
581
+ - `TokenRatesController`
582
+ - `TokensController`
446
583
  - **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))
447
584
  - **BREAKING:** The token list controller `onNetworkStateChange` option now has a more restrictive type ([#1329](https://github.com/MetaMask/core/pull/1329))
448
585
  - The event handler parameter type has been changed from `NetworkState | ProviderConfig` to `NetworkState`
@@ -454,42 +591,58 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
454
591
  - Bump @metamask/utils from 5.0.1 to 5.0.2 ([#1271](https://github.com/MetaMask/core/pull/1271))
455
592
 
456
593
  ### Removed
594
+
457
595
  - **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))
458
596
  - **BREAKING:** Remove the `SuggestedAssetMeta` and `SuggestedAssetMetaBase` types from the token controller ([#1268](https://github.com/MetaMask/core/pull/1268))
459
597
  - **BREAKING:** Remove the `acceptWatchAsset` and `rejectWatchAsset` methods from the token controller ([#1268](https://github.com/MetaMask/core/pull/1268))
460
598
  - Suggested assets can be accepted or rejected using the approval controller instead
461
599
 
462
600
  ## [7.0.0]
601
+
463
602
  ### Changed
603
+
464
604
  - **BREAKING**: peerDeps: @metamask/network-controller@6.0.0->8.0.0 ([#1196](https://github.com/MetaMask/core/pull/1196))
465
605
 
466
606
  ## [6.0.0]
607
+
467
608
  ### Changed
609
+
468
610
  - **BREAKING:** Create approval requests using `@metamask/approval-controller` ([#1166](https://github.com/MetaMask/core/pull/1166))
469
611
 
470
612
  ## [5.1.0]
613
+
471
614
  ### Added
615
+
472
616
  - Support watching assets on a specific account ([#1124](https://github.com/MetaMask/core/pull/1124))
473
617
 
474
618
  ## [5.0.1]
619
+
475
620
  ### Changed
621
+
476
622
  - Update `@metamask/contract-metadata` from 2.1.0 to 2.3.1 ([#1141](https://github.com/MetaMask/core/pull/1141))
477
623
 
478
624
  ## [5.0.0]
625
+
479
626
  ### Removed
627
+
480
628
  - **BREAKING:** Remove `isomorphic-fetch` ([#1106](https://github.com/MetaMask/controllers/pull/1106))
481
629
  - Consumers must now import `isomorphic-fetch` or another polyfill themselves if they are running in an environment without `fetch`
482
630
 
483
631
  ## [4.0.1]
632
+
484
633
  ### Fixed
634
+
485
635
  - 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))
486
636
 
487
637
  ## [4.0.0]
638
+
488
639
  ### Added
640
+
489
641
  - Add Sepolia support to the currency rate controller ([#1041](https://github.com/MetaMask/controllers/pull/1041))
490
642
  - The currency rate controller will now treat Sepolia as a testnet, and return the Mainnet exchange rate when asked for the Sepolia exchange rate.
491
643
 
492
644
  ### Changed
645
+
493
646
  - **BREAKING:** Update `@metamask/network-controller` peer dependency to v3 ([#1041](https://github.com/MetaMask/controllers/pull/1041))
494
647
  - **BREAKING:** Migrate from `metaswap` to `metafi` subdomain for OpenSea proxy and token icons API ([#1060](https://github.com/MetaMask/core/pull/1060))
495
648
  - Rename this repository to `core` ([#1031](https://github.com/MetaMask/controllers/pull/1031))
@@ -497,29 +650,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
497
650
  - Update `@metamask/controller-utils` package ([#1041](https://github.com/MetaMask/controllers/pull/1041))
498
651
 
499
652
  ## Removed
653
+
500
654
  - **BREAKING**: Drop support for Ropsten, Rinkeby, and Kovan ([#1041](https://github.com/MetaMask/controllers/pull/1041))
501
655
  - 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.
502
656
  - The NFT controller no longer supports the Rinkeby OpenSea test API.
503
657
 
504
658
  ## [3.0.1]
659
+
505
660
  ### Changed
661
+
506
662
  - Export `isTokenDetectionSupportedForNetwork` function ([#1034](https://github.com/MetaMask/controllers/pull/1034))
507
663
  - Update `@metamask/contract-metadata` from 1.35.0 to 2.1.0 ([#1013](https://github.com/MetaMask/controllers/pull/1013))
508
664
 
509
665
  ### Fixed
666
+
510
667
  - Fix token controller state updates ([#1015](https://github.com/MetaMask/controllers/pull/1015))
511
668
  - 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.
512
669
 
513
670
  ## [3.0.0]
671
+
514
672
  ### Changed
673
+
515
674
  - **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))
516
675
 
517
676
  ### Fixed
677
+
518
678
  - 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))
519
679
  - This package will now warn if a required package is not present ([#1003](https://github.com/MetaMask/core/pull/1003))
520
680
 
521
681
  ## [2.0.0]
682
+
522
683
  ### Changed
684
+
523
685
  - **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))
524
686
  - This affects:
525
687
  - AssetsContractController
@@ -533,22 +695,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
533
695
  - 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))
534
696
 
535
697
  ## [1.0.1]
698
+
536
699
  ### Fixed
700
+
537
701
  - Fix race condition where some token detections can get mistakenly added to the wrong account ([#956](https://github.com/MetaMask/core/pull/956))
538
702
 
539
703
  ## [1.0.0]
704
+
540
705
  ### Added
706
+
541
707
  - Initial release
708
+
542
709
  - 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:
710
+
543
711
  - Everything in `src/assets`
544
712
  - Asset-related functions from `src/util.ts` and accompanying tests
545
713
 
546
714
  All changes listed after this point were applied to this package following the monorepo conversion.
547
715
 
548
716
  ### Changed
717
+
549
718
  - Use Ethers for AssetsContractController ([#845](https://github.com/MetaMask/core/pull/845))
550
719
 
551
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@25.0.0...HEAD
720
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@27.0.0...HEAD
721
+ [27.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@26.0.0...@metamask/assets-controllers@27.0.0
722
+ [26.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@25.0.0...@metamask/assets-controllers@26.0.0
552
723
  [25.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@24.0.0...@metamask/assets-controllers@25.0.0
553
724
  [24.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@23.1.0...@metamask/assets-controllers@24.0.0
554
725
  [23.1.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@23.0.0...@metamask/assets-controllers@23.1.0