@metamask-previews/assets-controller 11.0.0-preview-3f3e1111c → 11.0.0-preview-1ed087802

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 (74) hide show
  1. package/CHANGELOG.md +0 -12
  2. package/dist/AssetsController.cjs +1 -3
  3. package/dist/AssetsController.cjs.map +1 -1
  4. package/dist/AssetsController.d.cts +2 -2
  5. package/dist/AssetsController.d.cts.map +1 -1
  6. package/dist/AssetsController.d.mts +2 -2
  7. package/dist/AssetsController.d.mts.map +1 -1
  8. package/dist/AssetsController.mjs +1 -3
  9. package/dist/AssetsController.mjs.map +1 -1
  10. package/dist/data-sources/AccountsApiDataSource.cjs +8 -50
  11. package/dist/data-sources/AccountsApiDataSource.cjs.map +1 -1
  12. package/dist/data-sources/AccountsApiDataSource.d.cts +1 -2
  13. package/dist/data-sources/AccountsApiDataSource.d.cts.map +1 -1
  14. package/dist/data-sources/AccountsApiDataSource.d.mts +1 -2
  15. package/dist/data-sources/AccountsApiDataSource.d.mts.map +1 -1
  16. package/dist/data-sources/AccountsApiDataSource.mjs +8 -50
  17. package/dist/data-sources/AccountsApiDataSource.mjs.map +1 -1
  18. package/dist/data-sources/TokenDataSource.cjs +1 -19
  19. package/dist/data-sources/TokenDataSource.cjs.map +1 -1
  20. package/dist/data-sources/TokenDataSource.d.cts +1 -2
  21. package/dist/data-sources/TokenDataSource.d.cts.map +1 -1
  22. package/dist/data-sources/TokenDataSource.d.mts +1 -2
  23. package/dist/data-sources/TokenDataSource.d.mts.map +1 -1
  24. package/dist/data-sources/TokenDataSource.mjs +1 -19
  25. package/dist/data-sources/TokenDataSource.mjs.map +1 -1
  26. package/dist/index.cjs +1 -10
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +1 -3
  29. package/dist/index.d.cts.map +1 -1
  30. package/dist/index.d.mts +1 -3
  31. package/dist/index.d.mts.map +1 -1
  32. package/dist/index.mjs +0 -2
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/utils/formatExchangeRatesForBridge.cjs +7 -36
  35. package/dist/utils/formatExchangeRatesForBridge.cjs.map +1 -1
  36. package/dist/utils/formatExchangeRatesForBridge.d.cts +14 -20
  37. package/dist/utils/formatExchangeRatesForBridge.d.cts.map +1 -1
  38. package/dist/utils/formatExchangeRatesForBridge.d.mts +14 -20
  39. package/dist/utils/formatExchangeRatesForBridge.d.mts.map +1 -1
  40. package/dist/utils/formatExchangeRatesForBridge.mjs +5 -34
  41. package/dist/utils/formatExchangeRatesForBridge.mjs.map +1 -1
  42. package/dist/utils/formatStateForTransactionPay.cjs +9 -40
  43. package/dist/utils/formatStateForTransactionPay.cjs.map +1 -1
  44. package/dist/utils/formatStateForTransactionPay.d.cts +17 -23
  45. package/dist/utils/formatStateForTransactionPay.d.cts.map +1 -1
  46. package/dist/utils/formatStateForTransactionPay.d.mts +17 -23
  47. package/dist/utils/formatStateForTransactionPay.d.mts.map +1 -1
  48. package/dist/utils/formatStateForTransactionPay.mjs +7 -38
  49. package/dist/utils/formatStateForTransactionPay.mjs.map +1 -1
  50. package/dist/utils/index.cjs +1 -4
  51. package/dist/utils/index.cjs.map +1 -1
  52. package/dist/utils/index.d.cts +5 -5
  53. package/dist/utils/index.d.cts.map +1 -1
  54. package/dist/utils/index.d.mts +5 -5
  55. package/dist/utils/index.d.mts.map +1 -1
  56. package/dist/utils/index.mjs +3 -3
  57. package/dist/utils/index.mjs.map +1 -1
  58. package/dist/utils/normalizeAssetId.cjs +3 -17
  59. package/dist/utils/normalizeAssetId.cjs.map +1 -1
  60. package/dist/utils/normalizeAssetId.d.cts +1 -10
  61. package/dist/utils/normalizeAssetId.d.cts.map +1 -1
  62. package/dist/utils/normalizeAssetId.d.mts +1 -10
  63. package/dist/utils/normalizeAssetId.d.mts.map +1 -1
  64. package/dist/utils/normalizeAssetId.mjs +1 -19
  65. package/dist/utils/normalizeAssetId.mjs.map +1 -1
  66. package/package.json +1 -1
  67. package/dist/utils/snaps-assets-migration.cjs +0 -171
  68. package/dist/utils/snaps-assets-migration.cjs.map +0 -1
  69. package/dist/utils/snaps-assets-migration.d.cts +0 -113
  70. package/dist/utils/snaps-assets-migration.d.cts.map +0 -1
  71. package/dist/utils/snaps-assets-migration.d.mts +0 -113
  72. package/dist/utils/snaps-assets-migration.d.mts.map +0 -1
  73. package/dist/utils/snaps-assets-migration.mjs +0 -162
  74. package/dist/utils/snaps-assets-migration.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -11,26 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
 
12
12
  - `AccountsApiDataSource` now selects the Accounts API balances endpoint version from the `RemoteFeatureFlagController` (`assetsAccountsApiV6` flag, read per fetch off the shared messenger, default v5) so the v6 endpoint is gated consistently across clients (extension, mobile) without each client wiring a getter. The flag is read as a JSON variation shaped `{ value: boolean }` (same shape as `backendWebSocketConnection`). Adds a required `messenger` option and `RemoteFeatureFlagController:getState` to `AccountsApiDataSourceAllowedActions`. Only `category: 'token'` rows from the v6 response are consumed (DeFi positions are ignored) to preserve parity with v5 ([#9344](https://github.com/MetaMask/core/pull/9344))
13
13
  - Add `getAsset(accountId, assetId)` method and `AssetsController:getAsset` messenger action that returns the combined `Asset` (balance, metadata, price) for a single account/asset pair from controller state, or `undefined` when a complete renderable asset is not available ([#9521](https://github.com/MetaMask/core/pull/9521))
14
- - Add stage-gated ingestion of the Snaps → AssetsController migration networks (Solana, Stellar, Tron) ([#9534](https://github.com/MetaMask/core/pull/9534))
15
- - `AssetsController` and `AccountsApiDataSource` now resolve a per-network migration stage from `RemoteFeatureFlagController` state (via `RemoteFeatureFlagController:getState`) using the `networkAssetsSnapsMigrationSolana`, `networkAssetsSnapsMigrationStellar`, and `networkAssetsSnapsMigrationTron` flags. Migration networks are only ingested and surfaced as active chains from `SnapsAssetsMigrationStage.ReadAssetsControllerWithFallback` onward, and left to the Snap when the stage is `Off` (the fail-safe when the flag is missing). Non-migration namespaces (e.g. `eip155`) are never gated.
16
14
 
17
15
  ### Changed
18
16
 
19
- - Memoize hot-path asset ID / legacy-format conversions to cut repeated keccak256 (`toChecksumAddress`) and CAIP parsing ([#9555](https://github.com/MetaMask/core/pull/9555))
20
- - `normalizeAssetId` uses lodash `memoize` so already-normalized IDs skip re-checksumming across the pipeline
21
- - `formatExchangeRatesForBridge` caches the last result on input identity (`===` for BaseController slices, lodash `isEqual` for rebuilt native maps); exports `FormatExchangeRatesForBridgeParams`
22
- - `formatStateForTransactionPay` caches the last result the same way (`isEqual` for rebuilt `accounts` / `nativeAssetIdentifiers`); exports `FormatStateForTransactionPayParams`
23
- - `#getNativeAssetMap` returns a stable empty object when uncached so memoized formatters are not busted by `?? {}` identity churn
24
17
  - `TokenDataSource` EVM spam filtering now uses per-chain floors from Token API `GET /v1/suggestedOccurrenceFloors` (`queryApiClient.token.fetchV1SuggestedOccurrenceFloors`) instead of a hardcoded minimum of 3 occurrences. Chains missing from the response (or a failed floors fetch) still fall back to 3 ([#9537](https://github.com/MetaMask/core/pull/9537))
25
18
  - `TokensApiClient` (used by `RpcDataSource` / `TokenDetector`) now sets the token-list `occurrenceFloor` query param from the same Token API `GET /v1/suggestedOccurrenceFloors` endpoint (cached 1h), replacing the hardcoded Linea/MegaETH/Tempo special cases. Missing chains or failed fetches fall back to 3 ([#9537](https://github.com/MetaMask/core/pull/9537))
26
- - Add `@metamask/remote-feature-flag-controller` as a dependency ([#9534](https://github.com/MetaMask/core/pull/9534))
27
19
  - Bump `@metamask/network-enablement-controller` from `^5.5.0` to `^5.6.0` ([#9520](https://github.com/MetaMask/core/pull/9520))
28
20
  - Bump `@metamask/phishing-controller` from `^17.2.1` to `^17.3.0` ([#9532](https://github.com/MetaMask/core/pull/9532))
29
21
 
30
- ### Fixed
31
-
32
- - `TokenDataSource` now also fetches token metadata for assets present in `assetsBalance` that are missing `assetsInfo` (previously only detected assets without metadata were enriched) ([#9547](https://github.com/MetaMask/core/pull/9547))
33
-
34
22
  ## [11.0.0]
35
23
 
36
24
  ### Fixed
@@ -43,8 +43,6 @@ const constants_1 = require("./utils/constants.cjs");
43
43
  const customAssetsRpcSupplement_1 = require("./utils/customAssetsRpcSupplement.cjs");
44
44
  const processAccountActivityBalanceUpdates_1 = require("./utils/processAccountActivityBalanceUpdates.cjs");
45
45
  const NATIVE_ASSETS_QUERY_KEY = ['nativeAssets'];
46
- /** Stable empty map so memoized formatters are not busted by `?? {}` identity churn. */
47
- const EMPTY_NATIVE_ASSET_MAP = {};
48
46
  // ============================================================================
49
47
  // CONTROLLER CONSTANTS
50
48
  // ============================================================================
@@ -1493,7 +1491,7 @@ async function _AssetsController_executeMiddlewares(sources, request, initialRes
1493
1491
  log('Failed to fetch missing prices', { error });
1494
1492
  });
1495
1493
  }, _AssetsController_getNativeAssetMap = function _AssetsController_getNativeAssetMap() {
1496
- return (__classPrivateFieldGet(this, _AssetsController_queryApiClient, "f").getCachedData(NATIVE_ASSETS_QUERY_KEY) ?? EMPTY_NATIVE_ASSET_MAP);
1494
+ return (__classPrivateFieldGet(this, _AssetsController_queryApiClient, "f").getCachedData(NATIVE_ASSETS_QUERY_KEY) ?? {});
1497
1495
  }, _AssetsController_isNativeAsset = function _AssetsController_isNativeAsset(assetId) {
1498
1496
  const parsed = (0, utils_1.parseCaipAssetType)(assetId);
1499
1497
  if (parsed.assetNamespace === 'slip44') {