@metamask-previews/network-controller 25.0.0-preview-ab5f7a62 → 25.0.0-preview-7b44fb9a

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
@@ -13,12 +13,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
  - Providers accessible either via network clients or global proxies no longer emit events (or inherit from EventEmitter, for that matter).
14
14
  - Bump `@metamask/controller-utils` from `^11.14.1` to `^11.15.0` ([#7003](https://github.com/MetaMask/core/pull/7003))
15
15
 
16
- ### Fixed
17
-
18
- - Ensure `networksMetadata` never references old network client IDs ([#7047](https://github.com/MetaMask/core/pull/7047))
19
- - When removing a network configuration, ensure that metadata for all RPC endpoints in the network configuration are also removed from `networksMetadata`
20
- - When initializing the controller, remove metadata for RPC endpoints in `networksMetadata` that are not present in a network configuration
21
-
22
16
  ## [25.0.0]
23
17
 
24
18
  ### Changed
@@ -335,21 +335,14 @@ function validateInitialState(state) {
335
335
  */
336
336
  function correctInitialState(state, messenger) {
337
337
  const networkConfigurationsSortedByChainId = getNetworkConfigurations(state).sort((a, b) => a.chainId.localeCompare(b.chainId));
338
- const availableNetworkClientIds = getAvailableNetworkClientIds(networkConfigurationsSortedByChainId);
339
- const invalidNetworkClientIdsWithMetadata = Object.keys(state.networksMetadata).filter((networkClientId) => !availableNetworkClientIds.includes(networkClientId));
338
+ const networkClientIds = getAvailableNetworkClientIds(networkConfigurationsSortedByChainId);
340
339
  return (0, immer_1.produce)(state, (newState) => {
341
- if (!availableNetworkClientIds.includes(state.selectedNetworkClientId)) {
340
+ if (!networkClientIds.includes(state.selectedNetworkClientId)) {
342
341
  const firstNetworkConfiguration = networkConfigurationsSortedByChainId[0];
343
342
  const newSelectedNetworkClientId = firstNetworkConfiguration.rpcEndpoints[firstNetworkConfiguration.defaultRpcEndpointIndex].networkClientId;
344
343
  messenger.call('ErrorReportingService:captureException', new Error(`\`selectedNetworkClientId\` '${state.selectedNetworkClientId}' does not refer to an RPC endpoint within a network configuration; correcting to '${newSelectedNetworkClientId}'`));
345
344
  newState.selectedNetworkClientId = newSelectedNetworkClientId;
346
345
  }
347
- if (invalidNetworkClientIdsWithMetadata.length > 0) {
348
- for (const invalidNetworkClientId of invalidNetworkClientIdsWithMetadata) {
349
- delete newState.networksMetadata[invalidNetworkClientId];
350
- }
351
- messenger.call('ErrorReportingService:captureException', new Error('`networksMetadata` had invalid network client IDs, which have been removed'));
352
- }
353
346
  });
354
347
  }
355
348
  /**
@@ -969,9 +962,6 @@ class NetworkController extends base_controller_1.BaseController {
969
962
  mode: 'remove',
970
963
  existingNetworkConfiguration,
971
964
  });
972
- for (const rpcEndpoint of existingNetworkConfiguration.rpcEndpoints) {
973
- delete state.networksMetadata[rpcEndpoint.networkClientId];
974
- }
975
965
  });
976
966
  this.messenger.publish('NetworkController:networkRemoved', existingNetworkConfiguration);
977
967
  }