@metamask-previews/network-controller 33.0.0-preview-5c294abf8 → 33.0.0-preview-e0ee14da7
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 +20 -0
- package/dist/NetworkController-method-action-types.cjs.map +1 -1
- package/dist/NetworkController-method-action-types.d.cts +1 -19
- package/dist/NetworkController-method-action-types.d.cts.map +1 -1
- package/dist/NetworkController-method-action-types.d.mts +1 -19
- package/dist/NetworkController-method-action-types.d.mts.map +1 -1
- package/dist/NetworkController-method-action-types.mjs.map +1 -1
- package/dist/NetworkController.cjs +74 -37
- package/dist/NetworkController.cjs.map +1 -1
- package/dist/NetworkController.d.cts +15 -15
- package/dist/NetworkController.d.cts.map +1 -1
- package/dist/NetworkController.d.mts +15 -15
- package/dist/NetworkController.d.mts.map +1 -1
- package/dist/NetworkController.mjs +75 -38
- package/dist/NetworkController.mjs.map +1 -1
- package/dist/create-auto-managed-network-client.cjs +10 -15
- package/dist/create-auto-managed-network-client.cjs.map +1 -1
- package/dist/create-auto-managed-network-client.d.cts +8 -7
- package/dist/create-auto-managed-network-client.d.cts.map +1 -1
- package/dist/create-auto-managed-network-client.d.mts +8 -7
- package/dist/create-auto-managed-network-client.d.mts.map +1 -1
- package/dist/create-auto-managed-network-client.mjs +10 -15
- package/dist/create-auto-managed-network-client.mjs.map +1 -1
- package/dist/create-network-client.cjs +54 -24
- package/dist/create-network-client.cjs.map +1 -1
- package/dist/create-network-client.d.cts +7 -7
- package/dist/create-network-client.d.cts.map +1 -1
- package/dist/create-network-client.d.mts +7 -7
- package/dist/create-network-client.d.mts.map +1 -1
- package/dist/create-network-client.mjs +54 -24
- package/dist/create-network-client.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/rpc-service-events.cjs +87 -0
- package/dist/rpc-service-events.cjs.map +1 -0
- package/dist/rpc-service-events.d.cts +85 -0
- package/dist/rpc-service-events.d.cts.map +1 -0
- package/dist/rpc-service-events.d.mts +85 -0
- package/dist/rpc-service-events.d.mts.map +1 -0
- package/dist/rpc-service-events.mjs +81 -0
- package/dist/rpc-service-events.mjs.map +1 -0
- package/dist/selectors.cjs +12 -6
- package/dist/selectors.cjs.map +1 -1
- package/dist/selectors.d.cts +20 -1
- package/dist/selectors.d.cts.map +1 -1
- package/dist/selectors.d.mts +20 -1
- package/dist/selectors.d.mts.map +1 -1
- package/dist/selectors.mjs +10 -4
- package/dist/selectors.mjs.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,26 @@ 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 optional `analytics` 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
|
+
- No analytics are emitted when the option is omitted.
|
|
15
|
+
- Adds the `NetworkControllerAnalyticsOptions` and `RpcServiceEventName` types.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- **BREAKING:** Drive RPC failover from the single `corePlatformRpcFailoverMode` remote feature flag ([#9175](https://github.com/MetaMask/core/pull/9175))
|
|
20
|
+
- 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.
|
|
21
|
+
- `NetworkController` no longer reads the `walletFrameworkRpcFailoverEnabled` flag; the `enabled` mode replaces it. Update your remote feature flag configuration to set `corePlatformRpcFailoverMode`.
|
|
22
|
+
- **BREAKING:** The `NetworkControllerMessenger` now allows the `AnalyticsController:getState` and `AnalyticsController:trackEvent` actions ([#9270](https://github.com/MetaMask/core/pull/9270))
|
|
23
|
+
- Consumers that pass the `analytics` option must delegate these actions to the network controller messenger.
|
|
24
|
+
|
|
25
|
+
### Removed
|
|
26
|
+
|
|
27
|
+
- **BREAKING:** Remove the `NetworkController.enableRpcFailover` and `NetworkController.disableRpcFailover` methods, their `NetworkController:enableRpcFailover` / `NetworkController:disableRpcFailover` messenger actions, and the `NetworkControllerEnableRpcFailoverAction` / `NetworkControllerDisableRpcFailoverAction` types ([#9175](https://github.com/MetaMask/core/pull/9175))
|
|
28
|
+
- RPC failover is now driven entirely by the `corePlatformRpcFailoverMode` remote feature flag, so there is no longer an imperative toggle.
|
|
29
|
+
|
|
10
30
|
## [33.0.0]
|
|
11
31
|
|
|
12
32
|
### Added
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkController-method-action-types.cjs","sourceRoot":"","sources":["../src/NetworkController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { NetworkController } from './NetworkController';\n\n/**\n * Returns the EthQuery instance for the currently selected network.\n *\n * @returns The EthQuery instance, or undefined if the provider has not been\n * initialized.\n */\nexport type NetworkControllerGetEthQueryAction = {\n type: `NetworkController:getEthQuery`;\n handler: NetworkController['getEthQuery'];\n};\n\n/**\n * Enables the RPC failover functionality. That is, if any RPC endpoints are\n * configured with failover URLs, then traffic will automatically be diverted\n * to them if those RPC endpoints are unavailable.\n */\nexport type NetworkControllerEnableRpcFailoverAction = {\n type: `NetworkController:enableRpcFailover`;\n handler: NetworkController['enableRpcFailover'];\n};\n\n/**\n * Disables the RPC failover functionality. That is, even if any RPC endpoints\n * are configured with failover URLs, then traffic will not automatically be\n * diverted to them if those RPC endpoints are unavailable.\n */\nexport type NetworkControllerDisableRpcFailoverAction = {\n type: `NetworkController:disableRpcFailover`;\n handler: NetworkController['disableRpcFailover'];\n};\n\n/**\n * Accesses the provider and block tracker for the currently selected network.\n *\n * @returns The proxy and block tracker proxies.\n * @deprecated This method has been replaced by `getSelectedNetworkClient` (which has a more easily used return type) and will be removed in a future release.\n */\nexport type NetworkControllerGetProviderAndBlockTrackerAction = {\n type: `NetworkController:getProviderAndBlockTracker`;\n handler: NetworkController['getProviderAndBlockTracker'];\n};\n\n/**\n * Accesses the provider and block tracker for the currently selected network.\n *\n * @returns an object with the provider and block tracker proxies for the currently selected network.\n */\nexport type NetworkControllerGetSelectedNetworkClientAction = {\n type: `NetworkController:getSelectedNetworkClient`;\n handler: NetworkController['getSelectedNetworkClient'];\n};\n\n/**\n * Accesses the chain ID from the selected network client.\n *\n * @returns The chain ID of the selected network client in hex format or undefined if there is no network client.\n */\nexport type NetworkControllerGetSelectedChainIdAction = {\n type: `NetworkController:getSelectedChainId`;\n handler: NetworkController['getSelectedChainId'];\n};\n\n/**\n * Internally, the Infura and custom network clients are categorized by type\n * so that when accessing either kind of network client, TypeScript knows\n * which type to assign to the network client. For some cases it's more useful\n * to be able to access network clients by ID instead of by type and then ID,\n * so this function makes that possible.\n *\n * @returns The network clients registered so far, keyed by ID.\n */\nexport type NetworkControllerGetNetworkClientRegistryAction = {\n type: `NetworkController:getNetworkClientRegistry`;\n handler: NetworkController['getNetworkClientRegistry'];\n};\n\n/**\n * Returns the Infura network client with the given ID.\n *\n * @param infuraNetworkClientId - An Infura network client ID.\n * @returns The Infura network client.\n * @throws If an Infura network client does not exist with the given ID.\n */\nexport type NetworkControllerGetNetworkClientByIdAction = {\n type: `NetworkController:getNetworkClientById`;\n handler: NetworkController['getNetworkClientById'];\n};\n\n/**\n * Uses a request for the latest block to gather the following information on\n * the given or selected network, persisting it to state:\n *\n * - The connectivity status: whether it is available, geo-blocked (Infura\n * only), unavailable, or unknown\n * - The capabilities status: whether it supports EIP-1559, whether it does\n * not, or whether it is unknown\n *\n * @param networkClientId - The ID of the network client to inspect.\n * If no ID is provided, uses the currently selected network.\n */\nexport type NetworkControllerLookupNetworkAction = {\n type: `NetworkController:lookupNetwork`;\n handler: NetworkController['lookupNetwork'];\n};\n\n/**\n * Uses a request for the latest block to gather the following information on\n * the given network, persisting it to state:\n *\n * - The connectivity status: whether the network is available, geo-blocked\n * (Infura only), unavailable, or unknown\n * - The feature compatibility status: whether the network supports EIP-1559,\n * whether it does not, or whether it is unknown\n *\n * @param networkClientId - The ID of the network client to inspect.\n * @deprecated Please use `lookupNetwork` and pass a network client ID\n * instead. This method will be removed in a future major version.\n */\nexport type NetworkControllerLookupNetworkByClientIdAction = {\n type: `NetworkController:lookupNetworkByClientId`;\n handler: NetworkController['lookupNetworkByClientId'];\n};\n\n/**\n * Convenience method to update provider network type settings.\n *\n * @param type - Human readable network name.\n * @deprecated This has been replaced by `setActiveNetwork`, and will be\n * removed in a future release\n */\nexport type NetworkControllerSetProviderTypeAction = {\n type: `NetworkController:setProviderType`;\n handler: NetworkController['setProviderType'];\n};\n\n/**\n * Changes the selected network.\n *\n * @param networkClientId - The ID of a network client that will be used to\n * make requests.\n * @param options - Options for this method.\n * @param options.updateState - Allows for updating state.\n * @throws if no network client is associated with the given\n * network client ID.\n */\nexport type NetworkControllerSetActiveNetworkAction = {\n type: `NetworkController:setActiveNetwork`;\n handler: NetworkController['setActiveNetwork'];\n};\n\n/**\n * Determines whether the network supports EIP-1559 by checking whether the\n * latest block has a `baseFeePerGas` property, then updates state\n * appropriately.\n *\n * @param networkClientId - The networkClientId to fetch the correct provider against which to check 1559 compatibility.\n * @returns A promise that resolves to true if the network supports EIP-1559\n * , false otherwise, or `undefined` if unable to determine the compatibility.\n */\nexport type NetworkControllerGetEIP1559CompatibilityAction = {\n type: `NetworkController:getEIP1559Compatibility`;\n handler: NetworkController['getEIP1559Compatibility'];\n};\n\nexport type NetworkControllerGet1559CompatibilityWithNetworkClientIdAction = {\n type: `NetworkController:get1559CompatibilityWithNetworkClientId`;\n handler: NetworkController['get1559CompatibilityWithNetworkClientId'];\n};\n\n/**\n * Ensures that the provider and block tracker proxies are pointed to the\n * currently selected network and refreshes the metadata for the\n */\nexport type NetworkControllerResetConnectionAction = {\n type: `NetworkController:resetConnection`;\n handler: NetworkController['resetConnection'];\n};\n\n/**\n * Returns the network configuration that has been filed under the given chain\n * ID.\n *\n * @param chainId - The chain ID to use as a key.\n * @returns The network configuration if one exists, or undefined.\n */\nexport type NetworkControllerGetNetworkConfigurationByChainIdAction = {\n type: `NetworkController:getNetworkConfigurationByChainId`;\n handler: NetworkController['getNetworkConfigurationByChainId'];\n};\n\n/**\n * Returns the network configuration that contains an RPC endpoint with the\n * given network client ID.\n *\n * @param networkClientId - The network client ID to use as a key.\n * @returns The network configuration if one exists, or undefined.\n */\nexport type NetworkControllerGetNetworkConfigurationByNetworkClientIdAction = {\n type: `NetworkController:getNetworkConfigurationByNetworkClientId`;\n handler: NetworkController['getNetworkConfigurationByNetworkClientId'];\n};\n\n/**\n * Creates and registers network clients for the collection of Infura and\n * custom RPC endpoints that can be used to make requests for a particular\n * chain, storing the given configuration object in state for later reference.\n *\n * @param fields - The object that describes the new network/chain and lists\n * the RPC endpoints which front that chain.\n * @returns The newly added network configuration.\n * @throws if any part of `fields` would produce invalid state.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerAddNetworkAction = {\n type: `NetworkController:addNetwork`;\n handler: NetworkController['addNetwork'];\n};\n\n/**\n * Updates the configuration for a previously stored network filed under the\n * given chain ID, creating + registering new network clients to represent RPC\n * endpoints that have been added and destroying + unregistering existing\n * network clients for RPC endpoints that have been removed.\n *\n * Note that if `chainId` is changed, then all network clients associated with\n * that chain will be removed and re-added, even if none of the RPC endpoints\n * have changed.\n *\n * @param chainId - The chain ID associated with an existing network.\n * @param fields - The object that describes the updates to the network/chain,\n * including the new set of RPC endpoints which should front that chain.\n * @param options - Options to provide.\n * @param options.replacementSelectedRpcEndpointIndex - Usually you cannot\n * remove an RPC endpoint that is being represented by the currently selected\n * network client. This option allows you to specify another RPC endpoint\n * (either an existing one or a new one) that should be used to select a new\n * network instead.\n * @returns The updated network configuration.\n * @throws if `chainId` does not refer to an existing network configuration,\n * if any part of `fields` would produce invalid state, etc.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerUpdateNetworkAction = {\n type: `NetworkController:updateNetwork`;\n handler: NetworkController['updateNetwork'];\n};\n\n/**\n * Destroys and unregisters the network identified by the given chain ID, also\n * removing the associated network configuration from state.\n *\n * @param chainId - The chain ID associated with an existing network.\n * @throws if `chainId` does not refer to an existing network configuration,\n * or if the currently selected network is being removed.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerRemoveNetworkAction = {\n type: `NetworkController:removeNetwork`;\n handler: NetworkController['removeNetwork'];\n};\n\n/**\n * Assuming that the network has been previously switched, switches to this\n * new network.\n *\n * If the network has not been previously switched, this method is equivalent\n * to {@link resetConnection}.\n */\nexport type NetworkControllerRollbackToPreviousProviderAction = {\n type: `NetworkController:rollbackToPreviousProvider`;\n handler: NetworkController['rollbackToPreviousProvider'];\n};\n\n/**\n * Merges the given backup data into controller state.\n *\n * @param backup - The data that has been backed up.\n * @param backup.networkConfigurationsByChainId - Network configurations,\n * keyed by chain ID.\n */\nexport type NetworkControllerLoadBackupAction = {\n type: `NetworkController:loadBackup`;\n handler: NetworkController['loadBackup'];\n};\n\n/**\n * Searches for the default RPC endpoint configured for the given chain and\n * returns its network client ID. This can then be passed to\n * {@link getNetworkClientById} to retrieve the network client.\n *\n * @param chainId - Chain ID to search for.\n * @returns The ID of the network client created for the chain's default RPC\n * endpoint.\n */\nexport type NetworkControllerFindNetworkClientIdByChainIdAction = {\n type: `NetworkController:findNetworkClientIdByChainId`;\n handler: NetworkController['findNetworkClientIdByChainId'];\n};\n\n/**\n * Union of all NetworkController action types.\n */\nexport type NetworkControllerMethodActions =\n | NetworkControllerGetEthQueryAction\n | NetworkControllerEnableRpcFailoverAction\n | NetworkControllerDisableRpcFailoverAction\n | NetworkControllerGetProviderAndBlockTrackerAction\n | NetworkControllerGetSelectedNetworkClientAction\n | NetworkControllerGetSelectedChainIdAction\n | NetworkControllerGetNetworkClientRegistryAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerLookupNetworkAction\n | NetworkControllerLookupNetworkByClientIdAction\n | NetworkControllerSetProviderTypeAction\n | NetworkControllerSetActiveNetworkAction\n | NetworkControllerGetEIP1559CompatibilityAction\n | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction\n | NetworkControllerResetConnectionAction\n | NetworkControllerGetNetworkConfigurationByChainIdAction\n | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction\n | NetworkControllerAddNetworkAction\n | NetworkControllerUpdateNetworkAction\n | NetworkControllerRemoveNetworkAction\n | NetworkControllerRollbackToPreviousProviderAction\n | NetworkControllerLoadBackupAction\n | NetworkControllerFindNetworkClientIdByChainIdAction;\n"]}
|
|
1
|
+
{"version":3,"file":"NetworkController-method-action-types.cjs","sourceRoot":"","sources":["../src/NetworkController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { NetworkController } from './NetworkController';\n\n/**\n * Returns the EthQuery instance for the currently selected network.\n *\n * @returns The EthQuery instance, or undefined if the provider has not been\n * initialized.\n */\nexport type NetworkControllerGetEthQueryAction = {\n type: `NetworkController:getEthQuery`;\n handler: NetworkController['getEthQuery'];\n};\n\n/**\n * Accesses the provider and block tracker for the currently selected network.\n *\n * @returns The proxy and block tracker proxies.\n * @deprecated This method has been replaced by `getSelectedNetworkClient` (which has a more easily used return type) and will be removed in a future release.\n */\nexport type NetworkControllerGetProviderAndBlockTrackerAction = {\n type: `NetworkController:getProviderAndBlockTracker`;\n handler: NetworkController['getProviderAndBlockTracker'];\n};\n\n/**\n * Accesses the provider and block tracker for the currently selected network.\n *\n * @returns an object with the provider and block tracker proxies for the currently selected network.\n */\nexport type NetworkControllerGetSelectedNetworkClientAction = {\n type: `NetworkController:getSelectedNetworkClient`;\n handler: NetworkController['getSelectedNetworkClient'];\n};\n\n/**\n * Accesses the chain ID from the selected network client.\n *\n * @returns The chain ID of the selected network client in hex format or undefined if there is no network client.\n */\nexport type NetworkControllerGetSelectedChainIdAction = {\n type: `NetworkController:getSelectedChainId`;\n handler: NetworkController['getSelectedChainId'];\n};\n\n/**\n * Internally, the Infura and custom network clients are categorized by type\n * so that when accessing either kind of network client, TypeScript knows\n * which type to assign to the network client. For some cases it's more useful\n * to be able to access network clients by ID instead of by type and then ID,\n * so this function makes that possible.\n *\n * @returns The network clients registered so far, keyed by ID.\n */\nexport type NetworkControllerGetNetworkClientRegistryAction = {\n type: `NetworkController:getNetworkClientRegistry`;\n handler: NetworkController['getNetworkClientRegistry'];\n};\n\n/**\n * Returns the Infura network client with the given ID.\n *\n * @param infuraNetworkClientId - An Infura network client ID.\n * @returns The Infura network client.\n * @throws If an Infura network client does not exist with the given ID.\n */\nexport type NetworkControllerGetNetworkClientByIdAction = {\n type: `NetworkController:getNetworkClientById`;\n handler: NetworkController['getNetworkClientById'];\n};\n\n/**\n * Uses a request for the latest block to gather the following information on\n * the given or selected network, persisting it to state:\n *\n * - The connectivity status: whether it is available, geo-blocked (Infura\n * only), unavailable, or unknown\n * - The capabilities status: whether it supports EIP-1559, whether it does\n * not, or whether it is unknown\n *\n * @param networkClientId - The ID of the network client to inspect.\n * If no ID is provided, uses the currently selected network.\n */\nexport type NetworkControllerLookupNetworkAction = {\n type: `NetworkController:lookupNetwork`;\n handler: NetworkController['lookupNetwork'];\n};\n\n/**\n * Uses a request for the latest block to gather the following information on\n * the given network, persisting it to state:\n *\n * - The connectivity status: whether the network is available, geo-blocked\n * (Infura only), unavailable, or unknown\n * - The feature compatibility status: whether the network supports EIP-1559,\n * whether it does not, or whether it is unknown\n *\n * @param networkClientId - The ID of the network client to inspect.\n * @deprecated Please use `lookupNetwork` and pass a network client ID\n * instead. This method will be removed in a future major version.\n */\nexport type NetworkControllerLookupNetworkByClientIdAction = {\n type: `NetworkController:lookupNetworkByClientId`;\n handler: NetworkController['lookupNetworkByClientId'];\n};\n\n/**\n * Convenience method to update provider network type settings.\n *\n * @param type - Human readable network name.\n * @deprecated This has been replaced by `setActiveNetwork`, and will be\n * removed in a future release\n */\nexport type NetworkControllerSetProviderTypeAction = {\n type: `NetworkController:setProviderType`;\n handler: NetworkController['setProviderType'];\n};\n\n/**\n * Changes the selected network.\n *\n * @param networkClientId - The ID of a network client that will be used to\n * make requests.\n * @param options - Options for this method.\n * @param options.updateState - Allows for updating state.\n * @throws if no network client is associated with the given\n * network client ID.\n */\nexport type NetworkControllerSetActiveNetworkAction = {\n type: `NetworkController:setActiveNetwork`;\n handler: NetworkController['setActiveNetwork'];\n};\n\n/**\n * Determines whether the network supports EIP-1559 by checking whether the\n * latest block has a `baseFeePerGas` property, then updates state\n * appropriately.\n *\n * @param networkClientId - The networkClientId to fetch the correct provider against which to check 1559 compatibility.\n * @returns A promise that resolves to true if the network supports EIP-1559\n * , false otherwise, or `undefined` if unable to determine the compatibility.\n */\nexport type NetworkControllerGetEIP1559CompatibilityAction = {\n type: `NetworkController:getEIP1559Compatibility`;\n handler: NetworkController['getEIP1559Compatibility'];\n};\n\nexport type NetworkControllerGet1559CompatibilityWithNetworkClientIdAction = {\n type: `NetworkController:get1559CompatibilityWithNetworkClientId`;\n handler: NetworkController['get1559CompatibilityWithNetworkClientId'];\n};\n\n/**\n * Ensures that the provider and block tracker proxies are pointed to the\n * currently selected network and refreshes the metadata for the\n */\nexport type NetworkControllerResetConnectionAction = {\n type: `NetworkController:resetConnection`;\n handler: NetworkController['resetConnection'];\n};\n\n/**\n * Returns the network configuration that has been filed under the given chain\n * ID.\n *\n * @param chainId - The chain ID to use as a key.\n * @returns The network configuration if one exists, or undefined.\n */\nexport type NetworkControllerGetNetworkConfigurationByChainIdAction = {\n type: `NetworkController:getNetworkConfigurationByChainId`;\n handler: NetworkController['getNetworkConfigurationByChainId'];\n};\n\n/**\n * Returns the network configuration that contains an RPC endpoint with the\n * given network client ID.\n *\n * @param networkClientId - The network client ID to use as a key.\n * @returns The network configuration if one exists, or undefined.\n */\nexport type NetworkControllerGetNetworkConfigurationByNetworkClientIdAction = {\n type: `NetworkController:getNetworkConfigurationByNetworkClientId`;\n handler: NetworkController['getNetworkConfigurationByNetworkClientId'];\n};\n\n/**\n * Creates and registers network clients for the collection of Infura and\n * custom RPC endpoints that can be used to make requests for a particular\n * chain, storing the given configuration object in state for later reference.\n *\n * @param fields - The object that describes the new network/chain and lists\n * the RPC endpoints which front that chain.\n * @returns The newly added network configuration.\n * @throws if any part of `fields` would produce invalid state.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerAddNetworkAction = {\n type: `NetworkController:addNetwork`;\n handler: NetworkController['addNetwork'];\n};\n\n/**\n * Updates the configuration for a previously stored network filed under the\n * given chain ID, creating + registering new network clients to represent RPC\n * endpoints that have been added and destroying + unregistering existing\n * network clients for RPC endpoints that have been removed.\n *\n * Note that if `chainId` is changed, then all network clients associated with\n * that chain will be removed and re-added, even if none of the RPC endpoints\n * have changed.\n *\n * @param chainId - The chain ID associated with an existing network.\n * @param fields - The object that describes the updates to the network/chain,\n * including the new set of RPC endpoints which should front that chain.\n * @param options - Options to provide.\n * @param options.replacementSelectedRpcEndpointIndex - Usually you cannot\n * remove an RPC endpoint that is being represented by the currently selected\n * network client. This option allows you to specify another RPC endpoint\n * (either an existing one or a new one) that should be used to select a new\n * network instead.\n * @returns The updated network configuration.\n * @throws if `chainId` does not refer to an existing network configuration,\n * if any part of `fields` would produce invalid state, etc.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerUpdateNetworkAction = {\n type: `NetworkController:updateNetwork`;\n handler: NetworkController['updateNetwork'];\n};\n\n/**\n * Destroys and unregisters the network identified by the given chain ID, also\n * removing the associated network configuration from state.\n *\n * @param chainId - The chain ID associated with an existing network.\n * @throws if `chainId` does not refer to an existing network configuration,\n * or if the currently selected network is being removed.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerRemoveNetworkAction = {\n type: `NetworkController:removeNetwork`;\n handler: NetworkController['removeNetwork'];\n};\n\n/**\n * Assuming that the network has been previously switched, switches to this\n * new network.\n *\n * If the network has not been previously switched, this method is equivalent\n * to {@link resetConnection}.\n */\nexport type NetworkControllerRollbackToPreviousProviderAction = {\n type: `NetworkController:rollbackToPreviousProvider`;\n handler: NetworkController['rollbackToPreviousProvider'];\n};\n\n/**\n * Merges the given backup data into controller state.\n *\n * @param backup - The data that has been backed up.\n * @param backup.networkConfigurationsByChainId - Network configurations,\n * keyed by chain ID.\n */\nexport type NetworkControllerLoadBackupAction = {\n type: `NetworkController:loadBackup`;\n handler: NetworkController['loadBackup'];\n};\n\n/**\n * Searches for the default RPC endpoint configured for the given chain and\n * returns its network client ID. This can then be passed to\n * {@link getNetworkClientById} to retrieve the network client.\n *\n * @param chainId - Chain ID to search for.\n * @returns The ID of the network client created for the chain's default RPC\n * endpoint.\n */\nexport type NetworkControllerFindNetworkClientIdByChainIdAction = {\n type: `NetworkController:findNetworkClientIdByChainId`;\n handler: NetworkController['findNetworkClientIdByChainId'];\n};\n\n/**\n * Union of all NetworkController action types.\n */\nexport type NetworkControllerMethodActions =\n | NetworkControllerGetEthQueryAction\n | NetworkControllerGetProviderAndBlockTrackerAction\n | NetworkControllerGetSelectedNetworkClientAction\n | NetworkControllerGetSelectedChainIdAction\n | NetworkControllerGetNetworkClientRegistryAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerLookupNetworkAction\n | NetworkControllerLookupNetworkByClientIdAction\n | NetworkControllerSetProviderTypeAction\n | NetworkControllerSetActiveNetworkAction\n | NetworkControllerGetEIP1559CompatibilityAction\n | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction\n | NetworkControllerResetConnectionAction\n | NetworkControllerGetNetworkConfigurationByChainIdAction\n | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction\n | NetworkControllerAddNetworkAction\n | NetworkControllerUpdateNetworkAction\n | NetworkControllerRemoveNetworkAction\n | NetworkControllerRollbackToPreviousProviderAction\n | NetworkControllerLoadBackupAction\n | NetworkControllerFindNetworkClientIdByChainIdAction;\n"]}
|
|
@@ -13,24 +13,6 @@ export type NetworkControllerGetEthQueryAction = {
|
|
|
13
13
|
type: `NetworkController:getEthQuery`;
|
|
14
14
|
handler: NetworkController['getEthQuery'];
|
|
15
15
|
};
|
|
16
|
-
/**
|
|
17
|
-
* Enables the RPC failover functionality. That is, if any RPC endpoints are
|
|
18
|
-
* configured with failover URLs, then traffic will automatically be diverted
|
|
19
|
-
* to them if those RPC endpoints are unavailable.
|
|
20
|
-
*/
|
|
21
|
-
export type NetworkControllerEnableRpcFailoverAction = {
|
|
22
|
-
type: `NetworkController:enableRpcFailover`;
|
|
23
|
-
handler: NetworkController['enableRpcFailover'];
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Disables the RPC failover functionality. That is, even if any RPC endpoints
|
|
27
|
-
* are configured with failover URLs, then traffic will not automatically be
|
|
28
|
-
* diverted to them if those RPC endpoints are unavailable.
|
|
29
|
-
*/
|
|
30
|
-
export type NetworkControllerDisableRpcFailoverAction = {
|
|
31
|
-
type: `NetworkController:disableRpcFailover`;
|
|
32
|
-
handler: NetworkController['disableRpcFailover'];
|
|
33
|
-
};
|
|
34
16
|
/**
|
|
35
17
|
* Accesses the provider and block tracker for the currently selected network.
|
|
36
18
|
*
|
|
@@ -282,5 +264,5 @@ export type NetworkControllerFindNetworkClientIdByChainIdAction = {
|
|
|
282
264
|
/**
|
|
283
265
|
* Union of all NetworkController action types.
|
|
284
266
|
*/
|
|
285
|
-
export type NetworkControllerMethodActions = NetworkControllerGetEthQueryAction |
|
|
267
|
+
export type NetworkControllerMethodActions = NetworkControllerGetEthQueryAction | NetworkControllerGetProviderAndBlockTrackerAction | NetworkControllerGetSelectedNetworkClientAction | NetworkControllerGetSelectedChainIdAction | NetworkControllerGetNetworkClientRegistryAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerLookupNetworkAction | NetworkControllerLookupNetworkByClientIdAction | NetworkControllerSetProviderTypeAction | NetworkControllerSetActiveNetworkAction | NetworkControllerGetEIP1559CompatibilityAction | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction | NetworkControllerResetConnectionAction | NetworkControllerGetNetworkConfigurationByChainIdAction | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction | NetworkControllerAddNetworkAction | NetworkControllerUpdateNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerRollbackToPreviousProviderAction | NetworkControllerLoadBackupAction | NetworkControllerFindNetworkClientIdByChainIdAction;
|
|
286
268
|
//# sourceMappingURL=NetworkController-method-action-types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkController-method-action-types.d.cts","sourceRoot":"","sources":["../src/NetworkController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gCAA4B;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAC3C,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"NetworkController-method-action-types.d.cts","sourceRoot":"","sources":["../src/NetworkController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gCAA4B;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;GAKG;A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EAAE,iBAAiB,CAAC,eAAe,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,iDAAiD,GAAG;IAC9D,IAAI,EAAE,8CAA8C,CAAC;IACrD,OAAO,EAAE,iBAAiB,CAAC,4BAA4B,CAAC,CAAC;CAC1D,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,iBAAiB,CAAC,8BAA8B,CAAC,CAAC;CAC5D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACtC,kCAAkC,GAClC,iDAAiD,GACjD,+CAA+C,GAC/C,yCAAyC,GACzC,+CAA+C,GAC/C,2CAA2C,GAC3C,oCAAoC,GACpC,8CAA8C,GAC9C,sCAAsC,GACtC,uCAAuC,GACvC,8CAA8C,GAC9C,8DAA8D,GAC9D,sCAAsC,GACtC,uDAAuD,GACvD,+DAA+D,GAC/D,iCAAiC,GACjC,oCAAoC,GACpC,oCAAoC,GACpC,iDAAiD,GACjD,iCAAiC,GACjC,mDAAmD,CAAC"}
|
|
@@ -13,24 +13,6 @@ export type NetworkControllerGetEthQueryAction = {
|
|
|
13
13
|
type: `NetworkController:getEthQuery`;
|
|
14
14
|
handler: NetworkController['getEthQuery'];
|
|
15
15
|
};
|
|
16
|
-
/**
|
|
17
|
-
* Enables the RPC failover functionality. That is, if any RPC endpoints are
|
|
18
|
-
* configured with failover URLs, then traffic will automatically be diverted
|
|
19
|
-
* to them if those RPC endpoints are unavailable.
|
|
20
|
-
*/
|
|
21
|
-
export type NetworkControllerEnableRpcFailoverAction = {
|
|
22
|
-
type: `NetworkController:enableRpcFailover`;
|
|
23
|
-
handler: NetworkController['enableRpcFailover'];
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Disables the RPC failover functionality. That is, even if any RPC endpoints
|
|
27
|
-
* are configured with failover URLs, then traffic will not automatically be
|
|
28
|
-
* diverted to them if those RPC endpoints are unavailable.
|
|
29
|
-
*/
|
|
30
|
-
export type NetworkControllerDisableRpcFailoverAction = {
|
|
31
|
-
type: `NetworkController:disableRpcFailover`;
|
|
32
|
-
handler: NetworkController['disableRpcFailover'];
|
|
33
|
-
};
|
|
34
16
|
/**
|
|
35
17
|
* Accesses the provider and block tracker for the currently selected network.
|
|
36
18
|
*
|
|
@@ -282,5 +264,5 @@ export type NetworkControllerFindNetworkClientIdByChainIdAction = {
|
|
|
282
264
|
/**
|
|
283
265
|
* Union of all NetworkController action types.
|
|
284
266
|
*/
|
|
285
|
-
export type NetworkControllerMethodActions = NetworkControllerGetEthQueryAction |
|
|
267
|
+
export type NetworkControllerMethodActions = NetworkControllerGetEthQueryAction | NetworkControllerGetProviderAndBlockTrackerAction | NetworkControllerGetSelectedNetworkClientAction | NetworkControllerGetSelectedChainIdAction | NetworkControllerGetNetworkClientRegistryAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerLookupNetworkAction | NetworkControllerLookupNetworkByClientIdAction | NetworkControllerSetProviderTypeAction | NetworkControllerSetActiveNetworkAction | NetworkControllerGetEIP1559CompatibilityAction | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction | NetworkControllerResetConnectionAction | NetworkControllerGetNetworkConfigurationByChainIdAction | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction | NetworkControllerAddNetworkAction | NetworkControllerUpdateNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerRollbackToPreviousProviderAction | NetworkControllerLoadBackupAction | NetworkControllerFindNetworkClientIdByChainIdAction;
|
|
286
268
|
//# sourceMappingURL=NetworkController-method-action-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkController-method-action-types.d.mts","sourceRoot":"","sources":["../src/NetworkController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gCAA4B;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAC3C,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"NetworkController-method-action-types.d.mts","sourceRoot":"","sources":["../src/NetworkController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gCAA4B;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iDAAiD,GAAG;IAC9D,IAAI,EAAE,8CAA8C,CAAC;IACrD,OAAO,EAAE,iBAAiB,CAAC,4BAA4B,CAAC,CAAC;CAC1D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,iBAAiB,CAAC,0BAA0B,CAAC,CAAC;CACxD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;CAClD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,iBAAiB,CAAC,0BAA0B,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE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oC,GACpC,8CAA8C,GAC9C,sCAAsC,GACtC,uCAAuC,GACvC,8CAA8C,GAC9C,8DAA8D,GAC9D,sCAAsC,GACtC,uDAAuD,GACvD,+DAA+D,GAC/D,iCAAiC,GACjC,oCAAoC,GACpC,oCAAoC,GACpC,iDAAiD,GACjD,iCAAiC,GACjC,mDAAmD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkController-method-action-types.mjs","sourceRoot":"","sources":["../src/NetworkController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { NetworkController } from './NetworkController';\n\n/**\n * Returns the EthQuery instance for the currently selected network.\n *\n * @returns The EthQuery instance, or undefined if the provider has not been\n * initialized.\n */\nexport type NetworkControllerGetEthQueryAction = {\n type: `NetworkController:getEthQuery`;\n handler: NetworkController['getEthQuery'];\n};\n\n/**\n * Enables the RPC failover functionality. That is, if any RPC endpoints are\n * configured with failover URLs, then traffic will automatically be diverted\n * to them if those RPC endpoints are unavailable.\n */\nexport type NetworkControllerEnableRpcFailoverAction = {\n type: `NetworkController:enableRpcFailover`;\n handler: NetworkController['enableRpcFailover'];\n};\n\n/**\n * Disables the RPC failover functionality. That is, even if any RPC endpoints\n * are configured with failover URLs, then traffic will not automatically be\n * diverted to them if those RPC endpoints are unavailable.\n */\nexport type NetworkControllerDisableRpcFailoverAction = {\n type: `NetworkController:disableRpcFailover`;\n handler: NetworkController['disableRpcFailover'];\n};\n\n/**\n * Accesses the provider and block tracker for the currently selected network.\n *\n * @returns The proxy and block tracker proxies.\n * @deprecated This method has been replaced by `getSelectedNetworkClient` (which has a more easily used return type) and will be removed in a future release.\n */\nexport type NetworkControllerGetProviderAndBlockTrackerAction = {\n type: `NetworkController:getProviderAndBlockTracker`;\n handler: NetworkController['getProviderAndBlockTracker'];\n};\n\n/**\n * Accesses the provider and block tracker for the currently selected network.\n *\n * @returns an object with the provider and block tracker proxies for the currently selected network.\n */\nexport type NetworkControllerGetSelectedNetworkClientAction = {\n type: `NetworkController:getSelectedNetworkClient`;\n handler: NetworkController['getSelectedNetworkClient'];\n};\n\n/**\n * Accesses the chain ID from the selected network client.\n *\n * @returns The chain ID of the selected network client in hex format or undefined if there is no network client.\n */\nexport type NetworkControllerGetSelectedChainIdAction = {\n type: `NetworkController:getSelectedChainId`;\n handler: NetworkController['getSelectedChainId'];\n};\n\n/**\n * Internally, the Infura and custom network clients are categorized by type\n * so that when accessing either kind of network client, TypeScript knows\n * which type to assign to the network client. For some cases it's more useful\n * to be able to access network clients by ID instead of by type and then ID,\n * so this function makes that possible.\n *\n * @returns The network clients registered so far, keyed by ID.\n */\nexport type NetworkControllerGetNetworkClientRegistryAction = {\n type: `NetworkController:getNetworkClientRegistry`;\n handler: NetworkController['getNetworkClientRegistry'];\n};\n\n/**\n * Returns the Infura network client with the given ID.\n *\n * @param infuraNetworkClientId - An Infura network client ID.\n * @returns The Infura network client.\n * @throws If an Infura network client does not exist with the given ID.\n */\nexport type NetworkControllerGetNetworkClientByIdAction = {\n type: `NetworkController:getNetworkClientById`;\n handler: NetworkController['getNetworkClientById'];\n};\n\n/**\n * Uses a request for the latest block to gather the following information on\n * the given or selected network, persisting it to state:\n *\n * - The connectivity status: whether it is available, geo-blocked (Infura\n * only), unavailable, or unknown\n * - The capabilities status: whether it supports EIP-1559, whether it does\n * not, or whether it is unknown\n *\n * @param networkClientId - The ID of the network client to inspect.\n * If no ID is provided, uses the currently selected network.\n */\nexport type NetworkControllerLookupNetworkAction = {\n type: `NetworkController:lookupNetwork`;\n handler: NetworkController['lookupNetwork'];\n};\n\n/**\n * Uses a request for the latest block to gather the following information on\n * the given network, persisting it to state:\n *\n * - The connectivity status: whether the network is available, geo-blocked\n * (Infura only), unavailable, or unknown\n * - The feature compatibility status: whether the network supports EIP-1559,\n * whether it does not, or whether it is unknown\n *\n * @param networkClientId - The ID of the network client to inspect.\n * @deprecated Please use `lookupNetwork` and pass a network client ID\n * instead. This method will be removed in a future major version.\n */\nexport type NetworkControllerLookupNetworkByClientIdAction = {\n type: `NetworkController:lookupNetworkByClientId`;\n handler: NetworkController['lookupNetworkByClientId'];\n};\n\n/**\n * Convenience method to update provider network type settings.\n *\n * @param type - Human readable network name.\n * @deprecated This has been replaced by `setActiveNetwork`, and will be\n * removed in a future release\n */\nexport type NetworkControllerSetProviderTypeAction = {\n type: `NetworkController:setProviderType`;\n handler: NetworkController['setProviderType'];\n};\n\n/**\n * Changes the selected network.\n *\n * @param networkClientId - The ID of a network client that will be used to\n * make requests.\n * @param options - Options for this method.\n * @param options.updateState - Allows for updating state.\n * @throws if no network client is associated with the given\n * network client ID.\n */\nexport type NetworkControllerSetActiveNetworkAction = {\n type: `NetworkController:setActiveNetwork`;\n handler: NetworkController['setActiveNetwork'];\n};\n\n/**\n * Determines whether the network supports EIP-1559 by checking whether the\n * latest block has a `baseFeePerGas` property, then updates state\n * appropriately.\n *\n * @param networkClientId - The networkClientId to fetch the correct provider against which to check 1559 compatibility.\n * @returns A promise that resolves to true if the network supports EIP-1559\n * , false otherwise, or `undefined` if unable to determine the compatibility.\n */\nexport type NetworkControllerGetEIP1559CompatibilityAction = {\n type: `NetworkController:getEIP1559Compatibility`;\n handler: NetworkController['getEIP1559Compatibility'];\n};\n\nexport type NetworkControllerGet1559CompatibilityWithNetworkClientIdAction = {\n type: `NetworkController:get1559CompatibilityWithNetworkClientId`;\n handler: NetworkController['get1559CompatibilityWithNetworkClientId'];\n};\n\n/**\n * Ensures that the provider and block tracker proxies are pointed to the\n * currently selected network and refreshes the metadata for the\n */\nexport type NetworkControllerResetConnectionAction = {\n type: `NetworkController:resetConnection`;\n handler: NetworkController['resetConnection'];\n};\n\n/**\n * Returns the network configuration that has been filed under the given chain\n * ID.\n *\n * @param chainId - The chain ID to use as a key.\n * @returns The network configuration if one exists, or undefined.\n */\nexport type NetworkControllerGetNetworkConfigurationByChainIdAction = {\n type: `NetworkController:getNetworkConfigurationByChainId`;\n handler: NetworkController['getNetworkConfigurationByChainId'];\n};\n\n/**\n * Returns the network configuration that contains an RPC endpoint with the\n * given network client ID.\n *\n * @param networkClientId - The network client ID to use as a key.\n * @returns The network configuration if one exists, or undefined.\n */\nexport type NetworkControllerGetNetworkConfigurationByNetworkClientIdAction = {\n type: `NetworkController:getNetworkConfigurationByNetworkClientId`;\n handler: NetworkController['getNetworkConfigurationByNetworkClientId'];\n};\n\n/**\n * Creates and registers network clients for the collection of Infura and\n * custom RPC endpoints that can be used to make requests for a particular\n * chain, storing the given configuration object in state for later reference.\n *\n * @param fields - The object that describes the new network/chain and lists\n * the RPC endpoints which front that chain.\n * @returns The newly added network configuration.\n * @throws if any part of `fields` would produce invalid state.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerAddNetworkAction = {\n type: `NetworkController:addNetwork`;\n handler: NetworkController['addNetwork'];\n};\n\n/**\n * Updates the configuration for a previously stored network filed under the\n * given chain ID, creating + registering new network clients to represent RPC\n * endpoints that have been added and destroying + unregistering existing\n * network clients for RPC endpoints that have been removed.\n *\n * Note that if `chainId` is changed, then all network clients associated with\n * that chain will be removed and re-added, even if none of the RPC endpoints\n * have changed.\n *\n * @param chainId - The chain ID associated with an existing network.\n * @param fields - The object that describes the updates to the network/chain,\n * including the new set of RPC endpoints which should front that chain.\n * @param options - Options to provide.\n * @param options.replacementSelectedRpcEndpointIndex - Usually you cannot\n * remove an RPC endpoint that is being represented by the currently selected\n * network client. This option allows you to specify another RPC endpoint\n * (either an existing one or a new one) that should be used to select a new\n * network instead.\n * @returns The updated network configuration.\n * @throws if `chainId` does not refer to an existing network configuration,\n * if any part of `fields` would produce invalid state, etc.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerUpdateNetworkAction = {\n type: `NetworkController:updateNetwork`;\n handler: NetworkController['updateNetwork'];\n};\n\n/**\n * Destroys and unregisters the network identified by the given chain ID, also\n * removing the associated network configuration from state.\n *\n * @param chainId - The chain ID associated with an existing network.\n * @throws if `chainId` does not refer to an existing network configuration,\n * or if the currently selected network is being removed.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerRemoveNetworkAction = {\n type: `NetworkController:removeNetwork`;\n handler: NetworkController['removeNetwork'];\n};\n\n/**\n * Assuming that the network has been previously switched, switches to this\n * new network.\n *\n * If the network has not been previously switched, this method is equivalent\n * to {@link resetConnection}.\n */\nexport type NetworkControllerRollbackToPreviousProviderAction = {\n type: `NetworkController:rollbackToPreviousProvider`;\n handler: NetworkController['rollbackToPreviousProvider'];\n};\n\n/**\n * Merges the given backup data into controller state.\n *\n * @param backup - The data that has been backed up.\n * @param backup.networkConfigurationsByChainId - Network configurations,\n * keyed by chain ID.\n */\nexport type NetworkControllerLoadBackupAction = {\n type: `NetworkController:loadBackup`;\n handler: NetworkController['loadBackup'];\n};\n\n/**\n * Searches for the default RPC endpoint configured for the given chain and\n * returns its network client ID. This can then be passed to\n * {@link getNetworkClientById} to retrieve the network client.\n *\n * @param chainId - Chain ID to search for.\n * @returns The ID of the network client created for the chain's default RPC\n * endpoint.\n */\nexport type NetworkControllerFindNetworkClientIdByChainIdAction = {\n type: `NetworkController:findNetworkClientIdByChainId`;\n handler: NetworkController['findNetworkClientIdByChainId'];\n};\n\n/**\n * Union of all NetworkController action types.\n */\nexport type NetworkControllerMethodActions =\n | NetworkControllerGetEthQueryAction\n | NetworkControllerEnableRpcFailoverAction\n | NetworkControllerDisableRpcFailoverAction\n | NetworkControllerGetProviderAndBlockTrackerAction\n | NetworkControllerGetSelectedNetworkClientAction\n | NetworkControllerGetSelectedChainIdAction\n | NetworkControllerGetNetworkClientRegistryAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerLookupNetworkAction\n | NetworkControllerLookupNetworkByClientIdAction\n | NetworkControllerSetProviderTypeAction\n | NetworkControllerSetActiveNetworkAction\n | NetworkControllerGetEIP1559CompatibilityAction\n | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction\n | NetworkControllerResetConnectionAction\n | NetworkControllerGetNetworkConfigurationByChainIdAction\n | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction\n | NetworkControllerAddNetworkAction\n | NetworkControllerUpdateNetworkAction\n | NetworkControllerRemoveNetworkAction\n | NetworkControllerRollbackToPreviousProviderAction\n | NetworkControllerLoadBackupAction\n | NetworkControllerFindNetworkClientIdByChainIdAction;\n"]}
|
|
1
|
+
{"version":3,"file":"NetworkController-method-action-types.mjs","sourceRoot":"","sources":["../src/NetworkController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { NetworkController } from './NetworkController';\n\n/**\n * Returns the EthQuery instance for the currently selected network.\n *\n * @returns The EthQuery instance, or undefined if the provider has not been\n * initialized.\n */\nexport type NetworkControllerGetEthQueryAction = {\n type: `NetworkController:getEthQuery`;\n handler: NetworkController['getEthQuery'];\n};\n\n/**\n * Accesses the provider and block tracker for the currently selected network.\n *\n * @returns The proxy and block tracker proxies.\n * @deprecated This method has been replaced by `getSelectedNetworkClient` (which has a more easily used return type) and will be removed in a future release.\n */\nexport type NetworkControllerGetProviderAndBlockTrackerAction = {\n type: `NetworkController:getProviderAndBlockTracker`;\n handler: NetworkController['getProviderAndBlockTracker'];\n};\n\n/**\n * Accesses the provider and block tracker for the currently selected network.\n *\n * @returns an object with the provider and block tracker proxies for the currently selected network.\n */\nexport type NetworkControllerGetSelectedNetworkClientAction = {\n type: `NetworkController:getSelectedNetworkClient`;\n handler: NetworkController['getSelectedNetworkClient'];\n};\n\n/**\n * Accesses the chain ID from the selected network client.\n *\n * @returns The chain ID of the selected network client in hex format or undefined if there is no network client.\n */\nexport type NetworkControllerGetSelectedChainIdAction = {\n type: `NetworkController:getSelectedChainId`;\n handler: NetworkController['getSelectedChainId'];\n};\n\n/**\n * Internally, the Infura and custom network clients are categorized by type\n * so that when accessing either kind of network client, TypeScript knows\n * which type to assign to the network client. For some cases it's more useful\n * to be able to access network clients by ID instead of by type and then ID,\n * so this function makes that possible.\n *\n * @returns The network clients registered so far, keyed by ID.\n */\nexport type NetworkControllerGetNetworkClientRegistryAction = {\n type: `NetworkController:getNetworkClientRegistry`;\n handler: NetworkController['getNetworkClientRegistry'];\n};\n\n/**\n * Returns the Infura network client with the given ID.\n *\n * @param infuraNetworkClientId - An Infura network client ID.\n * @returns The Infura network client.\n * @throws If an Infura network client does not exist with the given ID.\n */\nexport type NetworkControllerGetNetworkClientByIdAction = {\n type: `NetworkController:getNetworkClientById`;\n handler: NetworkController['getNetworkClientById'];\n};\n\n/**\n * Uses a request for the latest block to gather the following information on\n * the given or selected network, persisting it to state:\n *\n * - The connectivity status: whether it is available, geo-blocked (Infura\n * only), unavailable, or unknown\n * - The capabilities status: whether it supports EIP-1559, whether it does\n * not, or whether it is unknown\n *\n * @param networkClientId - The ID of the network client to inspect.\n * If no ID is provided, uses the currently selected network.\n */\nexport type NetworkControllerLookupNetworkAction = {\n type: `NetworkController:lookupNetwork`;\n handler: NetworkController['lookupNetwork'];\n};\n\n/**\n * Uses a request for the latest block to gather the following information on\n * the given network, persisting it to state:\n *\n * - The connectivity status: whether the network is available, geo-blocked\n * (Infura only), unavailable, or unknown\n * - The feature compatibility status: whether the network supports EIP-1559,\n * whether it does not, or whether it is unknown\n *\n * @param networkClientId - The ID of the network client to inspect.\n * @deprecated Please use `lookupNetwork` and pass a network client ID\n * instead. This method will be removed in a future major version.\n */\nexport type NetworkControllerLookupNetworkByClientIdAction = {\n type: `NetworkController:lookupNetworkByClientId`;\n handler: NetworkController['lookupNetworkByClientId'];\n};\n\n/**\n * Convenience method to update provider network type settings.\n *\n * @param type - Human readable network name.\n * @deprecated This has been replaced by `setActiveNetwork`, and will be\n * removed in a future release\n */\nexport type NetworkControllerSetProviderTypeAction = {\n type: `NetworkController:setProviderType`;\n handler: NetworkController['setProviderType'];\n};\n\n/**\n * Changes the selected network.\n *\n * @param networkClientId - The ID of a network client that will be used to\n * make requests.\n * @param options - Options for this method.\n * @param options.updateState - Allows for updating state.\n * @throws if no network client is associated with the given\n * network client ID.\n */\nexport type NetworkControllerSetActiveNetworkAction = {\n type: `NetworkController:setActiveNetwork`;\n handler: NetworkController['setActiveNetwork'];\n};\n\n/**\n * Determines whether the network supports EIP-1559 by checking whether the\n * latest block has a `baseFeePerGas` property, then updates state\n * appropriately.\n *\n * @param networkClientId - The networkClientId to fetch the correct provider against which to check 1559 compatibility.\n * @returns A promise that resolves to true if the network supports EIP-1559\n * , false otherwise, or `undefined` if unable to determine the compatibility.\n */\nexport type NetworkControllerGetEIP1559CompatibilityAction = {\n type: `NetworkController:getEIP1559Compatibility`;\n handler: NetworkController['getEIP1559Compatibility'];\n};\n\nexport type NetworkControllerGet1559CompatibilityWithNetworkClientIdAction = {\n type: `NetworkController:get1559CompatibilityWithNetworkClientId`;\n handler: NetworkController['get1559CompatibilityWithNetworkClientId'];\n};\n\n/**\n * Ensures that the provider and block tracker proxies are pointed to the\n * currently selected network and refreshes the metadata for the\n */\nexport type NetworkControllerResetConnectionAction = {\n type: `NetworkController:resetConnection`;\n handler: NetworkController['resetConnection'];\n};\n\n/**\n * Returns the network configuration that has been filed under the given chain\n * ID.\n *\n * @param chainId - The chain ID to use as a key.\n * @returns The network configuration if one exists, or undefined.\n */\nexport type NetworkControllerGetNetworkConfigurationByChainIdAction = {\n type: `NetworkController:getNetworkConfigurationByChainId`;\n handler: NetworkController['getNetworkConfigurationByChainId'];\n};\n\n/**\n * Returns the network configuration that contains an RPC endpoint with the\n * given network client ID.\n *\n * @param networkClientId - The network client ID to use as a key.\n * @returns The network configuration if one exists, or undefined.\n */\nexport type NetworkControllerGetNetworkConfigurationByNetworkClientIdAction = {\n type: `NetworkController:getNetworkConfigurationByNetworkClientId`;\n handler: NetworkController['getNetworkConfigurationByNetworkClientId'];\n};\n\n/**\n * Creates and registers network clients for the collection of Infura and\n * custom RPC endpoints that can be used to make requests for a particular\n * chain, storing the given configuration object in state for later reference.\n *\n * @param fields - The object that describes the new network/chain and lists\n * the RPC endpoints which front that chain.\n * @returns The newly added network configuration.\n * @throws if any part of `fields` would produce invalid state.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerAddNetworkAction = {\n type: `NetworkController:addNetwork`;\n handler: NetworkController['addNetwork'];\n};\n\n/**\n * Updates the configuration for a previously stored network filed under the\n * given chain ID, creating + registering new network clients to represent RPC\n * endpoints that have been added and destroying + unregistering existing\n * network clients for RPC endpoints that have been removed.\n *\n * Note that if `chainId` is changed, then all network clients associated with\n * that chain will be removed and re-added, even if none of the RPC endpoints\n * have changed.\n *\n * @param chainId - The chain ID associated with an existing network.\n * @param fields - The object that describes the updates to the network/chain,\n * including the new set of RPC endpoints which should front that chain.\n * @param options - Options to provide.\n * @param options.replacementSelectedRpcEndpointIndex - Usually you cannot\n * remove an RPC endpoint that is being represented by the currently selected\n * network client. This option allows you to specify another RPC endpoint\n * (either an existing one or a new one) that should be used to select a new\n * network instead.\n * @returns The updated network configuration.\n * @throws if `chainId` does not refer to an existing network configuration,\n * if any part of `fields` would produce invalid state, etc.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerUpdateNetworkAction = {\n type: `NetworkController:updateNetwork`;\n handler: NetworkController['updateNetwork'];\n};\n\n/**\n * Destroys and unregisters the network identified by the given chain ID, also\n * removing the associated network configuration from state.\n *\n * @param chainId - The chain ID associated with an existing network.\n * @throws if `chainId` does not refer to an existing network configuration,\n * or if the currently selected network is being removed.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerRemoveNetworkAction = {\n type: `NetworkController:removeNetwork`;\n handler: NetworkController['removeNetwork'];\n};\n\n/**\n * Assuming that the network has been previously switched, switches to this\n * new network.\n *\n * If the network has not been previously switched, this method is equivalent\n * to {@link resetConnection}.\n */\nexport type NetworkControllerRollbackToPreviousProviderAction = {\n type: `NetworkController:rollbackToPreviousProvider`;\n handler: NetworkController['rollbackToPreviousProvider'];\n};\n\n/**\n * Merges the given backup data into controller state.\n *\n * @param backup - The data that has been backed up.\n * @param backup.networkConfigurationsByChainId - Network configurations,\n * keyed by chain ID.\n */\nexport type NetworkControllerLoadBackupAction = {\n type: `NetworkController:loadBackup`;\n handler: NetworkController['loadBackup'];\n};\n\n/**\n * Searches for the default RPC endpoint configured for the given chain and\n * returns its network client ID. This can then be passed to\n * {@link getNetworkClientById} to retrieve the network client.\n *\n * @param chainId - Chain ID to search for.\n * @returns The ID of the network client created for the chain's default RPC\n * endpoint.\n */\nexport type NetworkControllerFindNetworkClientIdByChainIdAction = {\n type: `NetworkController:findNetworkClientIdByChainId`;\n handler: NetworkController['findNetworkClientIdByChainId'];\n};\n\n/**\n * Union of all NetworkController action types.\n */\nexport type NetworkControllerMethodActions =\n | NetworkControllerGetEthQueryAction\n | NetworkControllerGetProviderAndBlockTrackerAction\n | NetworkControllerGetSelectedNetworkClientAction\n | NetworkControllerGetSelectedChainIdAction\n | NetworkControllerGetNetworkClientRegistryAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerLookupNetworkAction\n | NetworkControllerLookupNetworkByClientIdAction\n | NetworkControllerSetProviderTypeAction\n | NetworkControllerSetActiveNetworkAction\n | NetworkControllerGetEIP1559CompatibilityAction\n | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction\n | NetworkControllerResetConnectionAction\n | NetworkControllerGetNetworkConfigurationByChainIdAction\n | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction\n | NetworkControllerAddNetworkAction\n | NetworkControllerUpdateNetworkAction\n | NetworkControllerRemoveNetworkAction\n | NetworkControllerRollbackToPreviousProviderAction\n | NetworkControllerLoadBackupAction\n | NetworkControllerFindNetworkClientIdByChainIdAction;\n"]}
|
|
@@ -36,12 +36,13 @@ 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_networkConfigurationsByNetworkClientId,
|
|
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_analytics, _NetworkController_networkConfigurationsByNetworkClientId, _NetworkController_rpcFailoverMode, _NetworkController_trackRpcServiceEvent, _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");
|
|
43
43
|
const controller_utils_1 = require("@metamask/controller-utils");
|
|
44
44
|
const eth_query_1 = __importDefault(require("@metamask/eth-query"));
|
|
45
|
+
const remote_feature_flag_controller_1 = require("@metamask/remote-feature-flag-controller");
|
|
45
46
|
const rpc_errors_1 = require("@metamask/rpc-errors");
|
|
46
47
|
const swappable_obj_proxy_1 = require("@metamask/swappable-obj-proxy");
|
|
47
48
|
const utils_1 = require("@metamask/utils");
|
|
@@ -54,6 +55,8 @@ const uuid_1 = require("uuid");
|
|
|
54
55
|
const constants_1 = require("./constants.cjs");
|
|
55
56
|
const create_auto_managed_network_client_1 = require("./create-auto-managed-network-client.cjs");
|
|
56
57
|
const logger_1 = require("./logger.cjs");
|
|
58
|
+
const rpc_service_events_1 = require("./rpc-service-events.cjs");
|
|
59
|
+
const rpc_service_1 = require("./rpc-service/rpc-service.cjs");
|
|
57
60
|
const selectors_1 = require("./selectors.cjs");
|
|
58
61
|
const types_1 = require("./types.cjs");
|
|
59
62
|
const debugLog = (0, logger_1.createModuleLogger)(logger_1.projectLogger, 'NetworkController');
|
|
@@ -104,8 +107,6 @@ function isErrorWithCode(error) {
|
|
|
104
107
|
const controllerName = 'NetworkController';
|
|
105
108
|
const MESSENGER_EXPOSED_METHODS = [
|
|
106
109
|
'addNetwork',
|
|
107
|
-
'disableRpcFailover',
|
|
108
|
-
'enableRpcFailover',
|
|
109
110
|
'findNetworkClientIdByChainId',
|
|
110
111
|
'get1559CompatibilityWithNetworkClientId',
|
|
111
112
|
'getEIP1559Compatibility',
|
|
@@ -393,7 +394,7 @@ class NetworkController extends base_controller_1.BaseController {
|
|
|
393
394
|
* @param options - The options; see {@link NetworkControllerOptions}.
|
|
394
395
|
*/
|
|
395
396
|
constructor(options) {
|
|
396
|
-
const { messenger, state, infuraProjectId, failoverUrls, log, getRpcServiceOptions, getBlockTrackerOptions, } = options;
|
|
397
|
+
const { messenger, state, infuraProjectId, failoverUrls, log, getRpcServiceOptions, getBlockTrackerOptions, analytics, } = options;
|
|
397
398
|
const initialState = {
|
|
398
399
|
...getDefaultNetworkControllerState(),
|
|
399
400
|
...state,
|
|
@@ -440,13 +441,15 @@ class NetworkController extends base_controller_1.BaseController {
|
|
|
440
441
|
_NetworkController_log.set(this, void 0);
|
|
441
442
|
_NetworkController_getRpcServiceOptions.set(this, void 0);
|
|
442
443
|
_NetworkController_getBlockTrackerOptions.set(this, void 0);
|
|
444
|
+
_NetworkController_analytics.set(this, void 0);
|
|
443
445
|
_NetworkController_networkConfigurationsByNetworkClientId.set(this, void 0);
|
|
444
|
-
|
|
446
|
+
_NetworkController_rpcFailoverMode.set(this, 'disabled');
|
|
445
447
|
__classPrivateFieldSet(this, _NetworkController_infuraProjectId, infuraProjectId, "f");
|
|
446
448
|
__classPrivateFieldSet(this, _NetworkController_failoverUrls, failoverUrls, "f");
|
|
447
449
|
__classPrivateFieldSet(this, _NetworkController_log, log, "f");
|
|
448
450
|
__classPrivateFieldSet(this, _NetworkController_getRpcServiceOptions, getRpcServiceOptions, "f");
|
|
449
451
|
__classPrivateFieldSet(this, _NetworkController_getBlockTrackerOptions, getBlockTrackerOptions, "f");
|
|
452
|
+
__classPrivateFieldSet(this, _NetworkController_analytics, analytics, "f");
|
|
450
453
|
__classPrivateFieldSet(this, _NetworkController_previouslySelectedNetworkClientId, this.state.selectedNetworkClientId, "f");
|
|
451
454
|
__classPrivateFieldSet(this, _NetworkController_networkConfigurationsByNetworkClientId, buildNetworkConfigurationsByNetworkClientId(this.state.networkConfigurationsByChainId), "f");
|
|
452
455
|
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
@@ -465,11 +468,33 @@ class NetworkController extends base_controller_1.BaseController {
|
|
|
465
468
|
networkStatus: constants_1.NetworkStatus.Available,
|
|
466
469
|
});
|
|
467
470
|
});
|
|
471
|
+
if (__classPrivateFieldGet(this, _NetworkController_analytics, "f")) {
|
|
472
|
+
const analyticsOptions = __classPrivateFieldGet(this, _NetworkController_analytics, "f");
|
|
473
|
+
this.messenger.subscribe(`${this.name}:rpcEndpointUnavailable`, ({ chainId, endpointUrl, error }) => {
|
|
474
|
+
__classPrivateFieldGet(this, _NetworkController_instances, "m", _NetworkController_trackRpcServiceEvent).call(this, analyticsOptions, 'RPC Service Unavailable', {
|
|
475
|
+
chainId,
|
|
476
|
+
endpointUrl,
|
|
477
|
+
error,
|
|
478
|
+
});
|
|
479
|
+
});
|
|
480
|
+
this.messenger.subscribe(`${this.name}:rpcEndpointDegraded`, ({ chainId, duration, endpointUrl, error, retryReason, rpcMethodName, traceId, type, }) => {
|
|
481
|
+
__classPrivateFieldGet(this, _NetworkController_instances, "m", _NetworkController_trackRpcServiceEvent).call(this, analyticsOptions, 'RPC Service Degraded', {
|
|
482
|
+
chainId,
|
|
483
|
+
duration,
|
|
484
|
+
endpointUrl,
|
|
485
|
+
error,
|
|
486
|
+
retryReason,
|
|
487
|
+
rpcMethodName,
|
|
488
|
+
traceId,
|
|
489
|
+
type,
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
}
|
|
468
493
|
this.messenger.subscribe(
|
|
469
494
|
// eslint-disable-next-line no-restricted-syntax
|
|
470
|
-
'RemoteFeatureFlagController:stateChange', (
|
|
471
|
-
__classPrivateFieldGet(this, _NetworkController_instances, "m",
|
|
472
|
-
}, selectors_1.
|
|
495
|
+
'RemoteFeatureFlagController:stateChange', (rpcFailoverMode) => {
|
|
496
|
+
__classPrivateFieldGet(this, _NetworkController_instances, "m", _NetworkController_updateRpcFailover).call(this, rpcFailoverMode);
|
|
497
|
+
}, selectors_1.getRpcFailoverMode);
|
|
473
498
|
}
|
|
474
499
|
/**
|
|
475
500
|
* Returns the EthQuery instance for the currently selected network.
|
|
@@ -480,22 +505,6 @@ class NetworkController extends base_controller_1.BaseController {
|
|
|
480
505
|
getEthQuery() {
|
|
481
506
|
return __classPrivateFieldGet(this, _NetworkController_ethQuery, "f");
|
|
482
507
|
}
|
|
483
|
-
/**
|
|
484
|
-
* Enables the RPC failover functionality. That is, if any RPC endpoints are
|
|
485
|
-
* configured with failover URLs, then traffic will automatically be diverted
|
|
486
|
-
* to them if those RPC endpoints are unavailable.
|
|
487
|
-
*/
|
|
488
|
-
enableRpcFailover() {
|
|
489
|
-
__classPrivateFieldGet(this, _NetworkController_instances, "m", _NetworkController_updateRpcFailoverEnabled).call(this, true);
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Disables the RPC failover functionality. That is, even if any RPC endpoints
|
|
493
|
-
* are configured with failover URLs, then traffic will not automatically be
|
|
494
|
-
* diverted to them if those RPC endpoints are unavailable.
|
|
495
|
-
*/
|
|
496
|
-
disableRpcFailover() {
|
|
497
|
-
__classPrivateFieldGet(this, _NetworkController_instances, "m", _NetworkController_updateRpcFailoverEnabled).call(this, false);
|
|
498
|
-
}
|
|
499
508
|
/**
|
|
500
509
|
* Accesses the provider and block tracker for the currently selected network.
|
|
501
510
|
*
|
|
@@ -565,12 +574,13 @@ class NetworkController extends base_controller_1.BaseController {
|
|
|
565
574
|
return customNetworkClient;
|
|
566
575
|
}
|
|
567
576
|
/**
|
|
568
|
-
* Initialize the NetworkController,
|
|
569
|
-
* and applying the network
|
|
577
|
+
* Initialize the NetworkController, applying the RPC failover mode from the
|
|
578
|
+
* `corePlatformRpcFailoverMode` remote feature flag and applying the network
|
|
579
|
+
* selection.
|
|
570
580
|
*/
|
|
571
581
|
init() {
|
|
572
582
|
const state = this.messenger.call('RemoteFeatureFlagController:getState');
|
|
573
|
-
__classPrivateFieldGet(this, _NetworkController_instances, "m",
|
|
583
|
+
__classPrivateFieldGet(this, _NetworkController_instances, "m", _NetworkController_updateRpcFailover).call(this, (0, selectors_1.getRpcFailoverMode)(state));
|
|
574
584
|
__classPrivateFieldGet(this, _NetworkController_instances, "m", _NetworkController_applyNetworkSelection).call(this, this.state.selectedNetworkClientId);
|
|
575
585
|
}
|
|
576
586
|
/**
|
|
@@ -1063,8 +1073,37 @@ class NetworkController extends base_controller_1.BaseController {
|
|
|
1063
1073
|
}
|
|
1064
1074
|
}
|
|
1065
1075
|
exports.NetworkController = NetworkController;
|
|
1066
|
-
_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(),
|
|
1067
|
-
|
|
1076
|
+
_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_analytics = new WeakMap(), _NetworkController_networkConfigurationsByNetworkClientId = new WeakMap(), _NetworkController_rpcFailoverMode = new WeakMap(), _NetworkController_instances = new WeakSet(), _NetworkController_trackRpcServiceEvent = function _NetworkController_trackRpcServiceEvent(analytics, name, payload) {
|
|
1077
|
+
try {
|
|
1078
|
+
if ((0, rpc_service_1.isConnectionError)(payload.error)) {
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
const { analyticsId } = this.messenger.call('AnalyticsController:getState');
|
|
1082
|
+
if (!analyticsId) {
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
if ((0, remote_feature_flag_controller_1.generateDeterministicRandomNumber)(analyticsId) >=
|
|
1086
|
+
analytics.rpcServiceEventsSampleRate) {
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
const properties = (0, rpc_service_events_1.buildRpcServiceEventProperties)({
|
|
1090
|
+
chainId: payload.chainId,
|
|
1091
|
+
endpointUrl: payload.endpointUrl,
|
|
1092
|
+
error: payload.error,
|
|
1093
|
+
isRpcEndpointUrlPublic: analytics.isRpcEndpointUrlPublic,
|
|
1094
|
+
duration: payload.duration,
|
|
1095
|
+
retryReason: payload.retryReason,
|
|
1096
|
+
rpcMethodName: payload.rpcMethodName,
|
|
1097
|
+
traceId: payload.traceId,
|
|
1098
|
+
type: payload.type,
|
|
1099
|
+
});
|
|
1100
|
+
this.messenger.call('AnalyticsController:trackEvent', (0, rpc_service_events_1.toAnalyticsTrackingEvent)(name, properties));
|
|
1101
|
+
}
|
|
1102
|
+
catch (error) {
|
|
1103
|
+
this.messenger.captureException?.(error);
|
|
1104
|
+
}
|
|
1105
|
+
}, _NetworkController_updateRpcFailover = function _NetworkController_updateRpcFailover(newMode) {
|
|
1106
|
+
if (__classPrivateFieldGet(this, _NetworkController_rpcFailoverMode, "f") === newMode) {
|
|
1068
1107
|
return;
|
|
1069
1108
|
}
|
|
1070
1109
|
const autoManagedNetworkClientRegistry = __classPrivateFieldGet(this, _NetworkController_instances, "m", _NetworkController_ensureAutoManagedNetworkClientRegistryPopulated).call(this);
|
|
@@ -1074,13 +1113,11 @@ _NetworkController_ethQuery = new WeakMap(), _NetworkController_infuraProjectId
|
|
|
1074
1113
|
const networkClient = networkClientsById[networkClientId];
|
|
1075
1114
|
if (networkClient.configuration.failoverRpcUrls &&
|
|
1076
1115
|
networkClient.configuration.failoverRpcUrls.length > 0) {
|
|
1077
|
-
|
|
1078
|
-
? networkClient.enableRpcFailover()
|
|
1079
|
-
: networkClient.disableRpcFailover();
|
|
1116
|
+
networkClient.setRpcFailoverMode(newMode);
|
|
1080
1117
|
}
|
|
1081
1118
|
}
|
|
1082
1119
|
}
|
|
1083
|
-
__classPrivateFieldSet(this,
|
|
1120
|
+
__classPrivateFieldSet(this, _NetworkController_rpcFailoverMode, newMode, "f");
|
|
1084
1121
|
}, _NetworkController_refreshNetwork =
|
|
1085
1122
|
/**
|
|
1086
1123
|
* Executes a series of steps to switch the network:
|
|
@@ -1452,7 +1489,7 @@ async function _NetworkController_determineEIP1559Compatibility(networkClientId)
|
|
|
1452
1489
|
getRpcServiceOptions: __classPrivateFieldGet(this, _NetworkController_getRpcServiceOptions, "f"),
|
|
1453
1490
|
getBlockTrackerOptions: __classPrivateFieldGet(this, _NetworkController_getBlockTrackerOptions, "f"),
|
|
1454
1491
|
messenger: this.messenger,
|
|
1455
|
-
|
|
1492
|
+
rpcFailoverMode: __classPrivateFieldGet(this, _NetworkController_rpcFailoverMode, "f"),
|
|
1456
1493
|
logger: __classPrivateFieldGet(this, _NetworkController_log, "f"),
|
|
1457
1494
|
});
|
|
1458
1495
|
}
|
|
@@ -1469,7 +1506,7 @@ async function _NetworkController_determineEIP1559Compatibility(networkClientId)
|
|
|
1469
1506
|
getRpcServiceOptions: __classPrivateFieldGet(this, _NetworkController_getRpcServiceOptions, "f"),
|
|
1470
1507
|
getBlockTrackerOptions: __classPrivateFieldGet(this, _NetworkController_getBlockTrackerOptions, "f"),
|
|
1471
1508
|
messenger: this.messenger,
|
|
1472
|
-
|
|
1509
|
+
rpcFailoverMode: __classPrivateFieldGet(this, _NetworkController_rpcFailoverMode, "f"),
|
|
1473
1510
|
logger: __classPrivateFieldGet(this, _NetworkController_log, "f"),
|
|
1474
1511
|
});
|
|
1475
1512
|
}
|
|
@@ -1531,7 +1568,7 @@ async function _NetworkController_determineEIP1559Compatibility(networkClientId)
|
|
|
1531
1568
|
getRpcServiceOptions: __classPrivateFieldGet(this, _NetworkController_getRpcServiceOptions, "f"),
|
|
1532
1569
|
getBlockTrackerOptions: __classPrivateFieldGet(this, _NetworkController_getBlockTrackerOptions, "f"),
|
|
1533
1570
|
messenger: this.messenger,
|
|
1534
|
-
|
|
1571
|
+
rpcFailoverMode: __classPrivateFieldGet(this, _NetworkController_rpcFailoverMode, "f"),
|
|
1535
1572
|
logger: __classPrivateFieldGet(this, _NetworkController_log, "f"),
|
|
1536
1573
|
}),
|
|
1537
1574
|
];
|
|
@@ -1550,7 +1587,7 @@ async function _NetworkController_determineEIP1559Compatibility(networkClientId)
|
|
|
1550
1587
|
getRpcServiceOptions: __classPrivateFieldGet(this, _NetworkController_getRpcServiceOptions, "f"),
|
|
1551
1588
|
getBlockTrackerOptions: __classPrivateFieldGet(this, _NetworkController_getBlockTrackerOptions, "f"),
|
|
1552
1589
|
messenger: this.messenger,
|
|
1553
|
-
|
|
1590
|
+
rpcFailoverMode: __classPrivateFieldGet(this, _NetworkController_rpcFailoverMode, "f"),
|
|
1554
1591
|
logger: __classPrivateFieldGet(this, _NetworkController_log, "f"),
|
|
1555
1592
|
}),
|
|
1556
1593
|
];
|