@metamask-previews/network-controller 25.0.0-preview-a345102 → 25.0.0-preview-317c0a9f

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
@@ -11,22 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
 
12
12
  - **BREAKING:** Use `InternalProvider` instead of `SafeEventEmitterProvider` ([#6796](https://github.com/MetaMask/core/pull/6796))
13
13
  - Providers accessible either via network clients or global proxies no longer emit events (or inherit from EventEmitter, for that matter).
14
- - **BREAKING:** Make `Provider` type more specific ([#7061](https://github.com/MetaMask/core/pull/7061))
15
- - The `Provider` type is now an `InternalProvider` with a context type of `{ origin: string; skipCache: boolean } & Record<string, unknown>`.
16
- - **BREAKING:** Stop retrying `undefined` results for methods that include a block tag parameter ([#7001](https://github.com/MetaMask/core/pull/7001))
17
- - The network client middleware, via `@metamask/eth-json-rpc-middleware`, will now throw an error if it encounters an
18
- `undefined` result when dispatching a request with a later block number than the originally requested block number.
19
- - In practice, this should happen rarely if ever.
20
- - **BREAKING:** Migrate `NetworkClient` to `JsonRpcEngineV2` ([#7065](https://github.com/MetaMask/core/pull/7065))
21
- - This ought to be unobservable, but we mark it as breaking out of an abundance of caution.
22
14
  - Bump `@metamask/controller-utils` from `^11.14.1` to `^11.15.0` ([#7003](https://github.com/MetaMask/core/pull/7003))
23
15
 
24
- ### Fixed
25
-
26
- - Ensure `networksMetadata` never references old network client IDs ([#7047](https://github.com/MetaMask/core/pull/7047))
27
- - When removing a network configuration, ensure that metadata for all RPC endpoints in the network configuration are also removed from `networksMetadata`
28
- - When initializing the controller, remove metadata for RPC endpoints in `networksMetadata` that are not present in a network configuration
29
-
30
16
  ## [25.0.0]
31
17
 
32
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
  }
@@ -990,8 +980,6 @@ class NetworkController extends base_controller_1.BaseController {
990
980
  *
991
981
  * In-progress requests will not be aborted.
992
982
  */
993
- // We're intentionally changing the signature of an extended method.
994
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
995
983
  async destroy() {
996
984
  await __classPrivateFieldGet(this, _NetworkController_blockTrackerProxy, "f")?.destroy();
997
985
  }
@@ -1248,8 +1236,6 @@ async function _NetworkController_lookupSelectedNetwork() {
1248
1236
  return new Promise((resolve, reject) => {
1249
1237
  ethQuery.sendAsync({ method: 'eth_getBlockByNumber', params: ['latest', false] }, (error, block) => {
1250
1238
  if (error) {
1251
- // This error comes from JsonRpcEngine, we don't control it.
1252
- // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
1253
1239
  reject(error);
1254
1240
  }
1255
1241
  else {