@metamask/assets-controller 7.1.2 → 8.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 (34) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/dist/AssetsController.cjs +2 -1
  3. package/dist/AssetsController.cjs.map +1 -1
  4. package/dist/AssetsController.d.cts.map +1 -1
  5. package/dist/AssetsController.d.mts.map +1 -1
  6. package/dist/AssetsController.mjs +4 -3
  7. package/dist/AssetsController.mjs.map +1 -1
  8. package/dist/data-sources/AccountsApiDataSource.cjs +4 -1
  9. package/dist/data-sources/AccountsApiDataSource.cjs.map +1 -1
  10. package/dist/data-sources/AccountsApiDataSource.d.cts.map +1 -1
  11. package/dist/data-sources/AccountsApiDataSource.d.mts.map +1 -1
  12. package/dist/data-sources/AccountsApiDataSource.mjs +4 -1
  13. package/dist/data-sources/AccountsApiDataSource.mjs.map +1 -1
  14. package/dist/data-sources/SnapDataSource.cjs +4 -0
  15. package/dist/data-sources/SnapDataSource.cjs.map +1 -1
  16. package/dist/data-sources/SnapDataSource.d.cts +2 -2
  17. package/dist/data-sources/SnapDataSource.d.cts.map +1 -1
  18. package/dist/data-sources/SnapDataSource.d.mts +2 -2
  19. package/dist/data-sources/SnapDataSource.d.mts.map +1 -1
  20. package/dist/data-sources/SnapDataSource.mjs +4 -0
  21. package/dist/data-sources/SnapDataSource.mjs.map +1 -1
  22. package/dist/data-sources/TokenDataSource.cjs +7 -4
  23. package/dist/data-sources/TokenDataSource.cjs.map +1 -1
  24. package/dist/data-sources/TokenDataSource.d.cts +6 -0
  25. package/dist/data-sources/TokenDataSource.d.cts.map +1 -1
  26. package/dist/data-sources/TokenDataSource.d.mts +6 -0
  27. package/dist/data-sources/TokenDataSource.d.mts.map +1 -1
  28. package/dist/data-sources/TokenDataSource.mjs +6 -3
  29. package/dist/data-sources/TokenDataSource.mjs.map +1 -1
  30. package/dist/types.cjs.map +1 -1
  31. package/dist/types.d.cts +1 -1
  32. package/dist/types.d.mts +1 -1
  33. package/dist/types.mjs.map +1 -1
  34. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [8.0.0]
11
+
12
+ ### Changed
13
+
14
+ - Bump `@metamask/transaction-controller` from `^65.3.0` to `^66.0.0` ([#8796](https://github.com/MetaMask/core/pull/8796), [#8848](https://github.com/MetaMask/core/pull/8848))
15
+ - Bump `@metamask/core-backend` from `^6.2.2` to `^6.3.0` ([#8813](https://github.com/MetaMask/core/pull/8813))
16
+ - Bump `@metamask/phishing-controller` from `^17.1.2` to `^17.2.0` ([#8819](https://github.com/MetaMask/core/pull/8819))
17
+ - Bump `@metamask/network-enablement-controller` from `^5.1.1` to `^5.2.0` ([#8834](https://github.com/MetaMask/core/pull/8834))
18
+ - Bump `@metamask/polling-controller` from `^16.0.5` to `^16.0.6` ([#8834](https://github.com/MetaMask/core/pull/8834))
19
+
20
+ ### Fixed
21
+
22
+ - `AccountsApiDataSource` no longer treats non-EVM chains (e.g. Solana) returned by the Accounts API as active chains; only `eip155:` networks are now included ([#8864](https://github.com/MetaMask/core/pull/8864))
23
+ - **BREAKING:** **SnapDataSource:** `SnapControllerSnapInstalledEvent` has been added to `SnapDataSourceAllowedEvents`. Hosts that restrict which events flow through the `AssetsController` messenger must now also delegate `SnapController:snapInstalled`; failing to do so will prevent snap chain re-discovery after install. Re-run keyring snap discovery when a new snap is installed so that snap-backed chains (Bitcoin, Solana, Tron, etc.) become available immediately after install ([#8862](https://github.com/MetaMask/core/pull/8862))
24
+ - Non-EVM assets with a `slip44` asset namespace (e.g. Bitcoin, Solana native, TRON) are now correctly typed as `native` instead of `erc20` in `assetsInfo` ([#8811](https://github.com/MetaMask/core/pull/8811))
25
+ - Solana SPL tokens (CAIP-19 `solana:.../token:<address>`) are now correctly typed as `spl` instead of `erc20` in `assetsInfo` ([#8811](https://github.com/MetaMask/core/pull/8811))
26
+
10
27
  ## [7.1.2]
11
28
 
12
29
  ### Changed
@@ -22,7 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
22
39
  - `decimals: 0` is treated as valid; `name` and `symbol` are not required.
23
40
  - Decimals resolution in `#handleBalanceUpdate` and the manual-fetch path no longer relies on `??` to fall through from state to pipeline metadata. A new `#pickValidDecimals` helper picks the first source whose `decimals` is finite and non-negative, so a stale `decimals: NaN` (or `decimals: -1`) in state can no longer shadow the chain-status stub's `decimals: 18` and silently produce `amount: '0'` while `assetsInfo` reports `decimals: 18`.
24
41
  - `#convertToHumanReadable` now defensively returns `'0'` when `decimals` isn't a finite non-negative number or when the raw balance can't be parsed, matching the existing safe fallback used in the error path.
25
- - The mUSD (`MetaMask USD`) contract address stored in `defaults.ts` is now EIP-55 checksummed (`0xacA92E438df0B2401fF60dA7E4337B687a2435DA`) ([#8786](https://github.com/MetaMask/core/pull/8786)). Previously the address was all-lowercase, causing the CAIP-19 keys pre-seeded into `assetsInfo` by `buildDefaultAssetsInfo()` to differ from the checksummed keys written by data sources (which always normalise asset IDs via `normalizeAssetId`). The mismatch resulted in two separate `assetsInfo` entries for the same token after the first balance or token-data poll.
42
+ - The mUSD (`MetaMask USD`) contract address stored in `defaults.ts` is now EIP-55 checksummed (`0xacA92E438df0B2401fF60dA7E4337B687a2435DA`). Previously the address was all-lowercase, causing the CAIP-19 keys pre-seeded into `assetsInfo` by `buildDefaultAssetsInfo()` to differ from the checksummed keys written by data sources (which always normalise asset IDs via `normalizeAssetId`). The mismatch resulted in two separate `assetsInfo` entries for the same token after the first balance or token-data poll. ([#8786](https://github.com/MetaMask/core/pull/8786))
26
43
 
27
44
  ## [7.1.1]
28
45
 
@@ -497,7 +514,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
497
514
  - Refactor `RpcDataSource` to delegate polling to `BalanceFetcher` and `TokenDetector` services ([#7709](https://github.com/MetaMask/core/pull/7709))
498
515
  - Refactor `BalanceFetcher` and `TokenDetector` to extend `StaticIntervalPollingControllerOnly` for independent polling management ([#7709](https://github.com/MetaMask/core/pull/7709))
499
516
 
500
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@7.1.2...HEAD
517
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@8.0.0...HEAD
518
+ [8.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@7.1.2...@metamask/assets-controller@8.0.0
501
519
  [7.1.2]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@7.1.1...@metamask/assets-controller@7.1.2
502
520
  [7.1.1]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@7.1.0...@metamask/assets-controller@7.1.1
503
521
  [7.1.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@7.0.1...@metamask/assets-controller@7.1.0
@@ -619,7 +619,8 @@ class AssetsController extends base_controller_1.BaseController {
619
619
  if (__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_isNativeAsset).call(this, normalizedAssetId)) {
620
620
  tokenType = 'native';
621
621
  }
622
- else if (parsed.assetNamespace === 'spl') {
622
+ else if (parsed.chain.namespace === utils_1.KnownCaipNamespace.Solana &&
623
+ parsed.assetNamespace === TokenDataSource_1.CaipAssetNamespace.Token) {
623
624
  tokenType = 'spl';
624
625
  }
625
626
  const assetMetadata = {