@metamask-previews/network-controller 34.0.0-preview-0d2cbf546 → 34.0.0-preview-ec4680201

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
@@ -7,17 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
11
-
12
- - Add required `analyticsOptions` constructor option that makes `NetworkController` emit `RPC Service Unavailable` and `RPC Service Degraded` analytics events via the `AnalyticsController:trackEvent` action when an RPC endpoint becomes unavailable or degraded ([#9270](https://github.com/MetaMask/core/pull/9270))
13
- - The option takes `isRpcEndpointUrlPublic` (decides whether an endpoint URL is safe to report verbatim or as `'custom'`) and `rpcServiceEventsSampleRate` (the proportion of events to emit, between `0` and `1`).
14
- - Adds the `NetworkControllerAnalyticsOptions` and `RpcServiceEventName` types.
15
-
16
10
  ### Changed
17
11
 
18
- - **BREAKING:** `NetworkControllerMessenger` now requires the `AnalyticsController:getState` and `AnalyticsController:trackEvent` actions ([#9270](https://github.com/MetaMask/core/pull/9270))
19
- - Consumers must delegate these actions to the network controller messenger and pass the new required `analyticsOptions` constructor option.
20
-
21
12
  - **BREAKING:** `BuiltInNetworkClientId` is now `string` instead of `InfuraNetworkType` ([#9432](https://github.com/MetaMask/core/pull/9432))
22
13
  - This type was previously constrained to known Infura network names (e.g. `"mainnet"`, `"sepolia"`). It is now `string` to allow dynamically configured Infura networks whose names are not bundled into the package.
23
14
  - If you have code that narrows on `BuiltInNetworkClientId`, you will need to remove the narrowing or check the network client type via `NetworkClientType` instead.
@@ -39,8 +30,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
39
30
  - **BREAKING:** Drive RPC failover from the single `corePlatformRpcFailoverMode` remote feature flag ([#9175](https://github.com/MetaMask/core/pull/9175))
40
31
  - The flag is a string with three values: `disabled` (failover off), `enabled` (divert to failover URLs when the primary endpoint is unavailable), and `forced` (Infura endpoints that have failover URLs route all traffic to those URLs, bypassing Infura entirely). Custom endpoints are unaffected, and the value defaults to `disabled` when the flag is absent or unrecognized.
41
32
  - `NetworkController` no longer reads the `walletFrameworkRpcFailoverEnabled` flag; the `enabled` mode replaces it. Update your remote feature flag configuration to set `corePlatformRpcFailoverMode`.
42
- - **BREAKING:** The `NetworkControllerMessenger` now allows the `AnalyticsController:getState` and `AnalyticsController:trackEvent` actions ([#9270](https://github.com/MetaMask/core/pull/9270))
43
- - Consumers that pass the `analytics` option must delegate these actions to the network controller messenger.
44
33
 
45
34
  ### Removed
46
35
 
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
36
36
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
38
  };
39
- var _NetworkController_instances, _NetworkController_ethQuery, _NetworkController_infuraProjectId, _NetworkController_failoverUrls, _NetworkController_previouslySelectedNetworkClientId, _NetworkController_providerProxy, _NetworkController_blockTrackerProxy, _NetworkController_autoManagedNetworkClientRegistry, _NetworkController_autoManagedNetworkClient, _NetworkController_log, _NetworkController_getRpcServiceOptions, _NetworkController_getBlockTrackerOptions, _NetworkController_analyticsOptions, _NetworkController_networkConfigurationsByNetworkClientId, _NetworkController_rpcFailoverMode, _NetworkController_updateRpcFailover, _NetworkController_refreshNetwork, _NetworkController_determineNetworkMetadata, _NetworkController_lookupGivenNetwork, _NetworkController_lookupSelectedNetwork, _NetworkController_updateMetadataForNetwork, _NetworkController_getLatestBlock, _NetworkController_determineEIP1559Compatibility, _NetworkController_validateNetworkFields, _NetworkController_determineNetworkConfigurationToPersist, _NetworkController_registerNetworkClientsAsNeeded, _NetworkController_unregisterNetworkClientsAsNeeded, _NetworkController_updateNetworkConfigurations, _NetworkController_ensureAutoManagedNetworkClientRegistryPopulated, _NetworkController_createAutoManagedNetworkClientRegistry, _NetworkController_applyNetworkSelection;
39
+ var _NetworkController_instances, _NetworkController_ethQuery, _NetworkController_infuraProjectId, _NetworkController_failoverUrls, _NetworkController_previouslySelectedNetworkClientId, _NetworkController_providerProxy, _NetworkController_blockTrackerProxy, _NetworkController_autoManagedNetworkClientRegistry, _NetworkController_autoManagedNetworkClient, _NetworkController_log, _NetworkController_getRpcServiceOptions, _NetworkController_getBlockTrackerOptions, _NetworkController_networkConfigurationsByNetworkClientId, _NetworkController_rpcFailoverMode, _NetworkController_updateRpcFailover, _NetworkController_refreshNetwork, _NetworkController_determineNetworkMetadata, _NetworkController_lookupGivenNetwork, _NetworkController_lookupSelectedNetwork, _NetworkController_updateMetadataForNetwork, _NetworkController_getLatestBlock, _NetworkController_determineEIP1559Compatibility, _NetworkController_validateNetworkFields, _NetworkController_determineNetworkConfigurationToPersist, _NetworkController_registerNetworkClientsAsNeeded, _NetworkController_unregisterNetworkClientsAsNeeded, _NetworkController_updateNetworkConfigurations, _NetworkController_ensureAutoManagedNetworkClientRegistryPopulated, _NetworkController_createAutoManagedNetworkClientRegistry, _NetworkController_applyNetworkSelection;
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.NetworkController = exports.selectAvailableNetworkClientIds = exports.getAvailableNetworkClientIds = exports.selectNetworkConfigurations = exports.getNetworkConfigurations = exports.getDefaultNetworkControllerState = exports.knownKeysOf = exports.RpcEndpointType = void 0;
42
42
  const base_controller_1 = require("@metamask/base-controller");
@@ -54,7 +54,6 @@ const uuid_1 = require("uuid");
54
54
  const constants_1 = require("./constants.cjs");
55
55
  const create_auto_managed_network_client_1 = require("./create-auto-managed-network-client.cjs");
56
56
  const logger_1 = require("./logger.cjs");
57
- const rpc_service_analytics_1 = require("./rpc-service-analytics.cjs");
58
57
  const selectors_1 = require("./selectors.cjs");
59
58
  const types_1 = require("./types.cjs");
60
59
  const debugLog = (0, logger_1.createModuleLogger)(logger_1.projectLogger, 'NetworkController');
@@ -388,7 +387,7 @@ class NetworkController extends base_controller_1.BaseController {
388
387
  * @param options - The options; see {@link NetworkControllerOptions}.
389
388
  */
390
389
  constructor(options) {
391
- const { messenger, state, infuraProjectId, failoverUrls, log, getRpcServiceOptions, getBlockTrackerOptions, analyticsOptions, } = options;
390
+ const { messenger, state, infuraProjectId, failoverUrls, log, getRpcServiceOptions, getBlockTrackerOptions, } = options;
392
391
  const initialState = {
393
392
  ...getDefaultNetworkControllerState(),
394
393
  ...state,
@@ -435,7 +434,6 @@ class NetworkController extends base_controller_1.BaseController {
435
434
  _NetworkController_log.set(this, void 0);
436
435
  _NetworkController_getRpcServiceOptions.set(this, void 0);
437
436
  _NetworkController_getBlockTrackerOptions.set(this, void 0);
438
- _NetworkController_analyticsOptions.set(this, void 0);
439
437
  _NetworkController_networkConfigurationsByNetworkClientId.set(this, void 0);
440
438
  _NetworkController_rpcFailoverMode.set(this, 'disabled');
441
439
  __classPrivateFieldSet(this, _NetworkController_infuraProjectId, infuraProjectId, "f");
@@ -443,7 +441,6 @@ class NetworkController extends base_controller_1.BaseController {
443
441
  __classPrivateFieldSet(this, _NetworkController_log, log, "f");
444
442
  __classPrivateFieldSet(this, _NetworkController_getRpcServiceOptions, getRpcServiceOptions, "f");
445
443
  __classPrivateFieldSet(this, _NetworkController_getBlockTrackerOptions, getBlockTrackerOptions, "f");
446
- __classPrivateFieldSet(this, _NetworkController_analyticsOptions, analyticsOptions, "f");
447
444
  __classPrivateFieldSet(this, _NetworkController_previouslySelectedNetworkClientId, this.state.selectedNetworkClientId, "f");
448
445
  __classPrivateFieldSet(this, _NetworkController_networkConfigurationsByNetworkClientId, buildNetworkConfigurationsByNetworkClientId(this.state.networkConfigurationsByChainId), "f");
449
446
  this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
@@ -462,8 +459,6 @@ class NetworkController extends base_controller_1.BaseController {
462
459
  networkStatus: constants_1.NetworkStatus.Available,
463
460
  });
464
461
  });
465
- this.messenger.subscribe(`${this.name}:rpcEndpointUnavailable`, (payload) => (0, rpc_service_analytics_1.trackRpcServiceUnavailable)(this.messenger, __classPrivateFieldGet(this, _NetworkController_analyticsOptions, "f"), payload));
466
- this.messenger.subscribe(`${this.name}:rpcEndpointDegraded`, (payload) => (0, rpc_service_analytics_1.trackRpcServiceDegraded)(this.messenger, __classPrivateFieldGet(this, _NetworkController_analyticsOptions, "f"), payload));
467
462
  this.messenger.subscribe(
468
463
  // eslint-disable-next-line no-restricted-syntax
469
464
  'RemoteFeatureFlagController:stateChange', (rpcFailoverMode) => {
@@ -1042,7 +1037,7 @@ class NetworkController extends base_controller_1.BaseController {
1042
1037
  }
1043
1038
  }
1044
1039
  exports.NetworkController = NetworkController;
1045
- _NetworkController_ethQuery = new WeakMap(), _NetworkController_infuraProjectId = new WeakMap(), _NetworkController_failoverUrls = new WeakMap(), _NetworkController_previouslySelectedNetworkClientId = new WeakMap(), _NetworkController_providerProxy = new WeakMap(), _NetworkController_blockTrackerProxy = new WeakMap(), _NetworkController_autoManagedNetworkClientRegistry = new WeakMap(), _NetworkController_autoManagedNetworkClient = new WeakMap(), _NetworkController_log = new WeakMap(), _NetworkController_getRpcServiceOptions = new WeakMap(), _NetworkController_getBlockTrackerOptions = new WeakMap(), _NetworkController_analyticsOptions = new WeakMap(), _NetworkController_networkConfigurationsByNetworkClientId = new WeakMap(), _NetworkController_rpcFailoverMode = new WeakMap(), _NetworkController_instances = new WeakSet(), _NetworkController_updateRpcFailover = function _NetworkController_updateRpcFailover(newMode) {
1040
+ _NetworkController_ethQuery = new WeakMap(), _NetworkController_infuraProjectId = new WeakMap(), _NetworkController_failoverUrls = new WeakMap(), _NetworkController_previouslySelectedNetworkClientId = new WeakMap(), _NetworkController_providerProxy = new WeakMap(), _NetworkController_blockTrackerProxy = new WeakMap(), _NetworkController_autoManagedNetworkClientRegistry = new WeakMap(), _NetworkController_autoManagedNetworkClient = new WeakMap(), _NetworkController_log = new WeakMap(), _NetworkController_getRpcServiceOptions = new WeakMap(), _NetworkController_getBlockTrackerOptions = new WeakMap(), _NetworkController_networkConfigurationsByNetworkClientId = new WeakMap(), _NetworkController_rpcFailoverMode = new WeakMap(), _NetworkController_instances = new WeakSet(), _NetworkController_updateRpcFailover = function _NetworkController_updateRpcFailover(newMode) {
1046
1041
  if (__classPrivateFieldGet(this, _NetworkController_rpcFailoverMode, "f") === newMode) {
1047
1042
  return;
1048
1043
  }