@metamask-previews/assets-controller 3.1.1-preview-55f19615e → 3.1.1-preview-55f73f6ce

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
@@ -10,13 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
  ### Added
11
11
 
12
12
  - Add Sentry traces for Assets Health dashboard ([#8310](https://github.com/MetaMask/core/pull/8310))
13
- - `Assets Data Source Timing` — per-source latency for each middleware in the fetch pipeline
14
- - `Assets Data Source Error` — tracks middleware failures with source names and error counts
15
- - `Assets Full Fetch` — end-to-end fetch timing with asset/price/chain/account counts
16
- - `Assets Update Pipeline` — enrichment pipeline timing for pushed data source updates
17
- - `Assets Subscription Error` — subscription failure tracking per data source
18
- - `Assets State Size` — entry counts for balances, metadata, prices, and custom assets (once on app start)
19
- - `Aggregated Balance Selector` — balance selector computation time with asset/network/account counts
13
+ - `AssetsDataSourceTiming` — per-source latency for each middleware in the fetch pipeline
14
+ - `AssetsDataSourceError` — tracks middleware failures with source names and error counts
15
+ - `AssetsFullFetch` — end-to-end fetch timing with asset/price/chain/account counts
16
+ - `AssetsUpdatePipeline` — enrichment pipeline timing for pushed data source updates
17
+ - `AssetsSubscriptionError` — subscription failure tracking per data source
18
+ - `AssetsStateSize` — entry counts for balances, metadata, prices, custom assets, unique assets, and network count (once on app start)
19
+ - `AggregatedBalanceSelector` — balance selector computation time with asset/network/account counts
20
20
  - Add optional `trace` parameter to `getAggregatedBalanceForAccount` selector
21
21
 
22
22
  ### Changed
@@ -56,13 +56,13 @@ const DEFAULT_POLLING_INTERVAL_MS = 30000;
56
56
  // ============================================================================
57
57
  // TRACE NAMES — used in Sentry spans (search these strings in Discover)
58
58
  // ============================================================================
59
- const TRACE_FIRST_INIT_FETCH = 'AssetsController First Init Fetch';
60
- const TRACE_FULL_FETCH = 'Assets Full Fetch';
61
- const TRACE_DATA_SOURCE_TIMING = 'Assets Data Source Timing';
62
- const TRACE_DATA_SOURCE_ERROR = 'Assets Data Source Error';
63
- const TRACE_UPDATE_PIPELINE = 'Assets Update Pipeline';
64
- const TRACE_SUBSCRIPTION_ERROR = 'Assets Subscription Error';
65
- const TRACE_STATE_SIZE = 'Assets State Size';
59
+ const TRACE_FIRST_INIT_FETCH = 'AssetsControllerFirstInitFetch';
60
+ const TRACE_FULL_FETCH = 'AssetsFullFetch';
61
+ const TRACE_DATA_SOURCE_TIMING = 'AssetsDataSourceTiming';
62
+ const TRACE_DATA_SOURCE_ERROR = 'AssetsDataSourceError';
63
+ const TRACE_UPDATE_PIPELINE = 'AssetsUpdatePipeline';
64
+ const TRACE_SUBSCRIPTION_ERROR = 'AssetsSubscriptionError';
65
+ const TRACE_STATE_SIZE = 'AssetsStateSize';
66
66
  const log = (0, logger_1.createModuleLogger)(logger_1.projectLogger, CONTROLLER_NAME);
67
67
  /**
68
68
  * Returns the default state for AssetsController.
@@ -814,9 +814,21 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
814
814
  }
815
815
  __classPrivateFieldSet(this, _AssetsController_stateSizeReported, true, "f");
816
816
  const { assetsBalance: balances, customAssets, assetsInfo, assetsPrice, } = this.state;
817
+ // Count balance entries and collect unique asset IDs / chain IDs in one pass.
817
818
  let balanceEntries = 0;
819
+ const uniqueAssets = new Set();
820
+ const uniqueNetworks = new Set();
818
821
  for (const acct of Object.values(balances)) {
819
- balanceEntries += Object.keys(acct).length;
822
+ const assetIds = Object.keys(acct);
823
+ balanceEntries += assetIds.length;
824
+ for (const assetId of assetIds) {
825
+ uniqueAssets.add(assetId);
826
+ // CAIP-19 format: "eip155:1/slip44:60" — chainId is everything before "/"
827
+ const slash = assetId.indexOf('/');
828
+ if (slash > 0) {
829
+ uniqueNetworks.add(assetId.slice(0, slash));
830
+ }
831
+ }
820
832
  }
821
833
  let customAssetEntries = 0;
822
834
  for (const ids of Object.values(customAssets)) {
@@ -827,6 +839,8 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
827
839
  __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_emitTrace).call(this, TRACE_STATE_SIZE, {
828
840
  balance_entries: balanceEntries,
829
841
  balance_accounts: Object.keys(balances).length,
842
+ unique_asset_count: uniqueAssets.size,
843
+ network_count: uniqueNetworks.size,
830
844
  metadata_entries: Object.keys(assetsInfo).length,
831
845
  price_entries: Object.keys(assetsPrice).length,
832
846
  custom_asset_entries: customAssetEntries,