@metamask-previews/assets-controller 9.0.1-preview-280f4f25b → 9.0.1-preview-69b6829ad

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
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Changed
11
+
12
+ - Bump `@metamask/assets-controllers` from `^109.0.0` to `^109.1.0` ([#9110](https://github.com/MetaMask/core/pull/9110))
13
+ - Bump `@metamask/utils` from `^11.9.0` to `^11.11.0` ([#9074](https://github.com/MetaMask/core/pull/9074))
14
+ - Bump `@metamask/transaction-controller` from `^67.1.0` to `^68.0.0` ([#9089](https://github.com/MetaMask/core/pull/9089))
15
+ - Bump `@metamask/keyring-controller` from `^27.0.0` to `^27.1.0` ([#9129](https://github.com/MetaMask/core/pull/9129))
16
+
17
+ ### Fixed
18
+
19
+ - `AssetsController` reconciliate and self-heals stale assetInfo metadata types ([#9099](https://github.com/MetaMask/core/pull/9099))
20
+
10
21
  ## [9.0.1]
11
22
 
12
23
  ### Changed
@@ -1417,6 +1417,25 @@ async function _AssetsController_executeMiddlewares(sources, request, initialRes
1417
1417
  }
1418
1418
  }
1419
1419
  }
1420
+ // Reconcile & self-heal stale asset "types" (e.g. erc20 -> native)
1421
+ // using IDs from new response assetInfo and assetBalance
1422
+ const assetsInfoAssetIdsSet = new Set([
1423
+ ...Object.keys(normalizedResponse.assetsInfo ?? {}),
1424
+ ...Object.values(normalizedResponse.assetsBalance ?? {}).flatMap((accountBalances) => Object.keys(accountBalances)),
1425
+ ]);
1426
+ for (const assetId of assetsInfoAssetIdsSet) {
1427
+ const entry = metadata[assetId];
1428
+ if (!entry) {
1429
+ continue;
1430
+ }
1431
+ const correctType = __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_getAssetType).call(this, assetId);
1432
+ if (entry.type !== correctType) {
1433
+ metadata[assetId] = { ...entry, type: correctType };
1434
+ if (!changedMetadata.includes(assetId)) {
1435
+ changedMetadata.push(assetId);
1436
+ }
1437
+ }
1438
+ }
1420
1439
  if (normalizedResponse.assetsBalance) {
1421
1440
  for (const [accountId, accountBalances] of Object.entries(normalizedResponse.assetsBalance)) {
1422
1441
  const previousBalances = previousState.assetsBalance[accountId] ?? {};