@metamask-previews/network-controller 32.0.0-preview-2fc626b → 32.0.0-preview-2f3fe6006

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +0 -30
  2. package/dist/NetworkController-method-action-types.cjs.map +1 -1
  3. package/dist/NetworkController-method-action-types.d.cts +23 -1
  4. package/dist/NetworkController-method-action-types.d.cts.map +1 -1
  5. package/dist/NetworkController-method-action-types.d.mts +23 -1
  6. package/dist/NetworkController-method-action-types.d.mts.map +1 -1
  7. package/dist/NetworkController-method-action-types.mjs.map +1 -1
  8. package/dist/NetworkController.cjs +24 -23
  9. package/dist/NetworkController.cjs.map +1 -1
  10. package/dist/NetworkController.d.cts +59 -12
  11. package/dist/NetworkController.d.cts.map +1 -1
  12. package/dist/NetworkController.d.mts +59 -12
  13. package/dist/NetworkController.d.mts.map +1 -1
  14. package/dist/NetworkController.mjs +24 -23
  15. package/dist/NetworkController.mjs.map +1 -1
  16. package/dist/create-auto-managed-network-client.cjs.map +1 -1
  17. package/dist/create-auto-managed-network-client.d.cts +2 -2
  18. package/dist/create-auto-managed-network-client.d.cts.map +1 -1
  19. package/dist/create-auto-managed-network-client.d.mts +2 -2
  20. package/dist/create-auto-managed-network-client.d.mts.map +1 -1
  21. package/dist/create-auto-managed-network-client.mjs.map +1 -1
  22. package/dist/create-network-client.cjs +16 -53
  23. package/dist/create-network-client.cjs.map +1 -1
  24. package/dist/create-network-client.d.cts +2 -2
  25. package/dist/create-network-client.d.cts.map +1 -1
  26. package/dist/create-network-client.d.mts +2 -2
  27. package/dist/create-network-client.d.mts.map +1 -1
  28. package/dist/create-network-client.mjs +17 -54
  29. package/dist/create-network-client.mjs.map +1 -1
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +1 -1
  32. package/dist/index.d.cts.map +1 -1
  33. package/dist/index.d.mts +1 -1
  34. package/dist/index.d.mts.map +1 -1
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/rpc-service/rpc-service.cjs +0 -2
  37. package/dist/rpc-service/rpc-service.cjs.map +1 -1
  38. package/dist/rpc-service/rpc-service.d.cts +0 -6
  39. package/dist/rpc-service/rpc-service.d.cts.map +1 -1
  40. package/dist/rpc-service/rpc-service.d.mts +0 -6
  41. package/dist/rpc-service/rpc-service.d.mts.map +1 -1
  42. package/dist/rpc-service/rpc-service.mjs +0 -2
  43. package/dist/rpc-service/rpc-service.mjs.map +1 -1
  44. package/dist/types.cjs.map +1 -1
  45. package/dist/types.d.cts +5 -1
  46. package/dist/types.d.cts.map +1 -1
  47. package/dist/types.d.mts +5 -1
  48. package/dist/types.d.mts.map +1 -1
  49. package/dist/types.mjs.map +1 -1
  50. package/package.json +3 -3
  51. package/dist/selectors.cjs +0 -10
  52. package/dist/selectors.cjs.map +0 -1
  53. package/dist/selectors.d.cts +0 -3
  54. package/dist/selectors.d.cts.map +0 -1
  55. package/dist/selectors.d.mts +0 -3
  56. package/dist/selectors.d.mts.map +0 -1
  57. package/dist/selectors.mjs +0 -6
  58. package/dist/selectors.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,36 +7,6 @@ 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 defaults for policy and block tracker options ([#9002](https://github.com/MetaMask/core/pull/9002))
13
- - The `NetworkController` constructor argument `getRpcServiceOptions` is now optional.
14
- - The default `policyOptions.maxRetries` is now `3`.
15
- - The default `policyOptions.maxConsecutiveFailures` is now `12` for regular RPC endpoints and `40` for fallback RPC endpoints.
16
- - The default `policyOptions.circuitBreakDuration` is now `30` seconds.
17
- - The default `pollingInterval` for the block tracker is now `20` seconds.
18
- - The default `retryTimeout` for the block tracker is now `20` seconds.
19
-
20
- ### Changed
21
-
22
- - Bump `@metamask/controller-utils` from `^12.1.0` to `^12.2.0` ([#9058](https://github.com/MetaMask/core/pull/9058), [#9083](https://github.com/MetaMask/core/pull/9083))
23
- - **BREAKING:** Automatically populate `isRpcFailoverEnabled` using `RemoteFeatureFlagController` ([#9013](https://github.com/MetaMask/core/pull/9013))
24
- - `NetworkController.init` must now be called to fully initialize the controller.
25
- - The constructor argument `isRpcFailoverEnabled` is no longer available.
26
- - `RemoteFeatureFlagController:stateChange` and `RemoteFeatureFlagController:getState` are now required.
27
- - Drop `async-mutex` dependency, which was no longer used in source ([#9064](https://github.com/MetaMask/core/pull/9064))
28
-
29
- ### Removed
30
-
31
- - **BREAKING:** Remove `initializeProvider` in favor of `init` ([#9034](https://github.com/MetaMask/core/pull/9034))
32
- - `init` does not call `lookupNetwork`, if this is required it must be called manually.
33
- - **BREAKING:** Remove `additionalDefaultNetworks` constructor option ([#9035](https://github.com/MetaMask/core/pull/9035))
34
-
35
- ### Fixed
36
-
37
- - Add defaults for `fetch`, `btoa` and `isOffline` in `RpcServiceOptions` ([#9000](https://github.com/MetaMask/core/pull/9000))
38
- - Ensure block explorer URLs are populated for default networks ([#9005](https://github.com/MetaMask/core/pull/9005))
39
-
40
10
  ## [32.0.0]
41
11
 
42
12
  ### Changed
@@ -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 * 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 * Creates proxies for accessing the global network client and its block\n * tracker. You must call this method in order to use\n * `getProviderAndBlockTracker` (or its replacement,\n * `getSelectedNetworkClient`).\n *\n * @param options - Optional arguments.\n * @param options.lookupNetwork - Usually, metadata for the global network\n * will be populated via a call to `lookupNetwork` after creating the provider\n * and block tracker proxies. This allows for responding to the status of the\n * global network after initializing this controller; however, it requires\n * making a request to the network to do so. In the clients, where controllers\n * are initialized before the UI is shown, this may be undesirable, as it\n * means that if the user has just installed MetaMask, their IP address may be\n * shared with a third party before they have a chance to finish onboarding.\n * You can pass `false` if you'd like to disable this request and call\n * `lookupNetwork` yourself.\n */\nexport type NetworkControllerInitializeProviderAction = {\n type: `NetworkController:initializeProvider`;\n handler: NetworkController['initializeProvider'];\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 | NetworkControllerInitializeProviderAction\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"]}
@@ -83,6 +83,28 @@ export type NetworkControllerGetNetworkClientByIdAction = {
83
83
  type: `NetworkController:getNetworkClientById`;
84
84
  handler: NetworkController['getNetworkClientById'];
85
85
  };
86
+ /**
87
+ * Creates proxies for accessing the global network client and its block
88
+ * tracker. You must call this method in order to use
89
+ * `getProviderAndBlockTracker` (or its replacement,
90
+ * `getSelectedNetworkClient`).
91
+ *
92
+ * @param options - Optional arguments.
93
+ * @param options.lookupNetwork - Usually, metadata for the global network
94
+ * will be populated via a call to `lookupNetwork` after creating the provider
95
+ * and block tracker proxies. This allows for responding to the status of the
96
+ * global network after initializing this controller; however, it requires
97
+ * making a request to the network to do so. In the clients, where controllers
98
+ * are initialized before the UI is shown, this may be undesirable, as it
99
+ * means that if the user has just installed MetaMask, their IP address may be
100
+ * shared with a third party before they have a chance to finish onboarding.
101
+ * You can pass `false` if you'd like to disable this request and call
102
+ * `lookupNetwork` yourself.
103
+ */
104
+ export type NetworkControllerInitializeProviderAction = {
105
+ type: `NetworkController:initializeProvider`;
106
+ handler: NetworkController['initializeProvider'];
107
+ };
86
108
  /**
87
109
  * Uses a request for the latest block to gather the following information on
88
110
  * the given or selected network, persisting it to state:
@@ -282,5 +304,5 @@ export type NetworkControllerFindNetworkClientIdByChainIdAction = {
282
304
  /**
283
305
  * Union of all NetworkController action types.
284
306
  */
285
- export type NetworkControllerMethodActions = NetworkControllerGetEthQueryAction | NetworkControllerEnableRpcFailoverAction | NetworkControllerDisableRpcFailoverAction | NetworkControllerGetProviderAndBlockTrackerAction | NetworkControllerGetSelectedNetworkClientAction | NetworkControllerGetSelectedChainIdAction | NetworkControllerGetNetworkClientRegistryAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerLookupNetworkAction | NetworkControllerLookupNetworkByClientIdAction | NetworkControllerSetProviderTypeAction | NetworkControllerSetActiveNetworkAction | NetworkControllerGetEIP1559CompatibilityAction | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction | NetworkControllerResetConnectionAction | NetworkControllerGetNetworkConfigurationByChainIdAction | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction | NetworkControllerAddNetworkAction | NetworkControllerUpdateNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerRollbackToPreviousProviderAction | NetworkControllerLoadBackupAction | NetworkControllerFindNetworkClientIdByChainIdAction;
307
+ export type NetworkControllerMethodActions = NetworkControllerGetEthQueryAction | NetworkControllerEnableRpcFailoverAction | NetworkControllerDisableRpcFailoverAction | NetworkControllerGetProviderAndBlockTrackerAction | NetworkControllerGetSelectedNetworkClientAction | NetworkControllerGetSelectedChainIdAction | NetworkControllerGetNetworkClientRegistryAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerInitializeProviderAction | NetworkControllerLookupNetworkAction | NetworkControllerLookupNetworkByClientIdAction | NetworkControllerSetProviderTypeAction | NetworkControllerSetActiveNetworkAction | NetworkControllerGetEIP1559CompatibilityAction | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction | NetworkControllerResetConnectionAction | NetworkControllerGetNetworkConfigurationByChainIdAction | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction | NetworkControllerAddNetworkAction | NetworkControllerUpdateNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerRollbackToPreviousProviderAction | NetworkControllerLoadBackupAction | NetworkControllerFindNetworkClientIdByChainIdAction;
286
308
  //# 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;;;;GAIG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,iBAAiB,CAAC,mBAAmB,CAAC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I,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,iBAAiB,CAAC,eAAe,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,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,wCAAwC,GACxC,yCAAyC,GACzC,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"}
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;;;;;G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zC,+CAA+C,GAC/C,2CAA2C,GAC3C,yCAAyC,GACzC,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"}
@@ -83,6 +83,28 @@ export type NetworkControllerGetNetworkClientByIdAction = {
83
83
  type: `NetworkController:getNetworkClientById`;
84
84
  handler: NetworkController['getNetworkClientById'];
85
85
  };
86
+ /**
87
+ * Creates proxies for accessing the global network client and its block
88
+ * tracker. You must call this method in order to use
89
+ * `getProviderAndBlockTracker` (or its replacement,
90
+ * `getSelectedNetworkClient`).
91
+ *
92
+ * @param options - Optional arguments.
93
+ * @param options.lookupNetwork - Usually, metadata for the global network
94
+ * will be populated via a call to `lookupNetwork` after creating the provider
95
+ * and block tracker proxies. This allows for responding to the status of the
96
+ * global network after initializing this controller; however, it requires
97
+ * making a request to the network to do so. In the clients, where controllers
98
+ * are initialized before the UI is shown, this may be undesirable, as it
99
+ * means that if the user has just installed MetaMask, their IP address may be
100
+ * shared with a third party before they have a chance to finish onboarding.
101
+ * You can pass `false` if you'd like to disable this request and call
102
+ * `lookupNetwork` yourself.
103
+ */
104
+ export type NetworkControllerInitializeProviderAction = {
105
+ type: `NetworkController:initializeProvider`;
106
+ handler: NetworkController['initializeProvider'];
107
+ };
86
108
  /**
87
109
  * Uses a request for the latest block to gather the following information on
88
110
  * the given or selected network, persisting it to state:
@@ -282,5 +304,5 @@ export type NetworkControllerFindNetworkClientIdByChainIdAction = {
282
304
  /**
283
305
  * Union of all NetworkController action types.
284
306
  */
285
- export type NetworkControllerMethodActions = NetworkControllerGetEthQueryAction | NetworkControllerEnableRpcFailoverAction | NetworkControllerDisableRpcFailoverAction | NetworkControllerGetProviderAndBlockTrackerAction | NetworkControllerGetSelectedNetworkClientAction | NetworkControllerGetSelectedChainIdAction | NetworkControllerGetNetworkClientRegistryAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerLookupNetworkAction | NetworkControllerLookupNetworkByClientIdAction | NetworkControllerSetProviderTypeAction | NetworkControllerSetActiveNetworkAction | NetworkControllerGetEIP1559CompatibilityAction | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction | NetworkControllerResetConnectionAction | NetworkControllerGetNetworkConfigurationByChainIdAction | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction | NetworkControllerAddNetworkAction | NetworkControllerUpdateNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerRollbackToPreviousProviderAction | NetworkControllerLoadBackupAction | NetworkControllerFindNetworkClientIdByChainIdAction;
307
+ export type NetworkControllerMethodActions = NetworkControllerGetEthQueryAction | NetworkControllerEnableRpcFailoverAction | NetworkControllerDisableRpcFailoverAction | NetworkControllerGetProviderAndBlockTrackerAction | NetworkControllerGetSelectedNetworkClientAction | NetworkControllerGetSelectedChainIdAction | NetworkControllerGetNetworkClientRegistryAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerInitializeProviderAction | NetworkControllerLookupNetworkAction | NetworkControllerLookupNetworkByClientIdAction | NetworkControllerSetProviderTypeAction | NetworkControllerSetActiveNetworkAction | NetworkControllerGetEIP1559CompatibilityAction | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction | NetworkControllerResetConnectionAction | NetworkControllerGetNetworkConfigurationByChainIdAction | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction | NetworkControllerAddNetworkAction | NetworkControllerUpdateNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerRollbackToPreviousProviderAction | NetworkControllerLoadBackupAction | NetworkControllerFindNetworkClientIdByChainIdAction;
286
308
  //# 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":[],"m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AuC,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
+ {"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;;;;GAIG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;CAClD,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,MAA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C,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,wCAAwC,GACxC,yCAAyC,GACzC,iDAAiD,GACjD,+CAA+C,GAC/C,yCAAyC,GACzC,+CAA+C,GAC/C,2CAA2C,GAC3C,yCAAyC,GACzC,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"}
@@ -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 * 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 * Creates proxies for accessing the global network client and its block\n * tracker. You must call this method in order to use\n * `getProviderAndBlockTracker` (or its replacement,\n * `getSelectedNetworkClient`).\n *\n * @param options - Optional arguments.\n * @param options.lookupNetwork - Usually, metadata for the global network\n * will be populated via a call to `lookupNetwork` after creating the provider\n * and block tracker proxies. This allows for responding to the status of the\n * global network after initializing this controller; however, it requires\n * making a request to the network to do so. In the clients, where controllers\n * are initialized before the UI is shown, this may be undesirable, as it\n * means that if the user has just installed MetaMask, their IP address may be\n * shared with a third party before they have a chance to finish onboarding.\n * You can pass `false` if you'd like to disable this request and call\n * `lookupNetwork` yourself.\n */\nexport type NetworkControllerInitializeProviderAction = {\n type: `NetworkController:initializeProvider`;\n handler: NetworkController['initializeProvider'];\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 | NetworkControllerInitializeProviderAction\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"]}
@@ -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 selectors_1 = require("./selectors.cjs");
58
57
  const types_1 = require("./types.cjs");
59
58
  const debugLog = (0, logger_1.createModuleLogger)(logger_1.projectLogger, 'NetworkController');
60
59
  const INFURA_URL_REGEX = /^https:\/\/(?<networkName>[^.]+)\.infura\.io\/v\d+\/(?<apiKey>.+)$/u;
@@ -117,6 +116,7 @@ const MESSENGER_EXPOSED_METHODS = [
117
116
  'getProviderAndBlockTracker',
118
117
  'getSelectedChainId',
119
118
  'getSelectedNetworkClient',
119
+ 'initializeProvider',
120
120
  'loadBackup',
121
121
  'lookupNetwork',
122
122
  'lookupNetworkByClientId',
@@ -131,12 +131,20 @@ const MESSENGER_EXPOSED_METHODS = [
131
131
  * Constructs a value for the state property `networkConfigurationsByChainId`
132
132
  * which will be used if it has not been provided to the constructor.
133
133
  *
134
+ * @param [additionalDefaultNetworks] - An array of Hex Chain IDs representing the additional networks to be included as default.
134
135
  * @returns The default value for `networkConfigurationsByChainId`.
135
136
  */
136
- function getDefaultNetworkConfigurationsByChainId() {
137
+ function getDefaultNetworkConfigurationsByChainId(additionalDefaultNetworks = []) {
137
138
  const infuraNetworks = getDefaultInfuraNetworkConfigurationsByChainId();
138
139
  const customNetworks = getDefaultCustomNetworkConfigurationsByChainId();
139
- return { ...customNetworks, ...infuraNetworks };
140
+ return additionalDefaultNetworks.reduce((obj, chainId) => {
141
+ if ((0, utils_1.hasProperty)(customNetworks, chainId)) {
142
+ obj[chainId] = customNetworks[chainId];
143
+ }
144
+ return obj;
145
+ },
146
+ // Always include the infura networks in the default networks
147
+ infuraNetworks);
140
148
  }
141
149
  /**
142
150
  * Constructs a `networkConfigurationsByChainId` object for all default Infura networks.
@@ -151,10 +159,8 @@ function getDefaultInfuraNetworkConfigurationsByChainId() {
151
159
  return obj;
152
160
  }
153
161
  const rpcEndpointUrl = `https://${infuraNetworkType}.infura.io/v3/{infuraProjectId}`;
154
- const { rpcPrefs } = controller_utils_1.BUILT_IN_NETWORKS[infuraNetworkType];
155
162
  const networkConfiguration = {
156
- blockExplorerUrls: [rpcPrefs.blockExplorerUrl],
157
- defaultBlockExplorerUrlIndex: 0,
163
+ blockExplorerUrls: [],
158
164
  chainId,
159
165
  defaultRpcEndpointIndex: 0,
160
166
  name: controller_utils_1.NetworkNickname[infuraNetworkType],
@@ -216,11 +222,12 @@ function getCustomNetworkConfiguration(customNetworkType) {
216
222
  * Constructs properties for the NetworkController state whose values will be
217
223
  * used if not provided to the constructor.
218
224
  *
225
+ * @param [additionalDefaultNetworks] - An array of Hex Chain IDs representing the additional networks to be included as default.
219
226
  * @returns The default NetworkController state.
220
227
  */
221
- function getDefaultNetworkControllerState() {
228
+ function getDefaultNetworkControllerState(additionalDefaultNetworks) {
222
229
  const networksMetadata = {};
223
- const networkConfigurationsByChainId = getDefaultNetworkConfigurationsByChainId();
230
+ const networkConfigurationsByChainId = getDefaultNetworkConfigurationsByChainId(additionalDefaultNetworks);
224
231
  return {
225
232
  selectedNetworkClientId: controller_utils_1.InfuraNetworkType.mainnet,
226
233
  networksMetadata,
@@ -394,9 +401,9 @@ class NetworkController extends base_controller_1.BaseController {
394
401
  * @param options - The options; see {@link NetworkControllerOptions}.
395
402
  */
396
403
  constructor(options) {
397
- const { messenger, state, infuraProjectId, log, getRpcServiceOptions, getBlockTrackerOptions, } = options;
404
+ const { messenger, state, infuraProjectId, log, getRpcServiceOptions, getBlockTrackerOptions, additionalDefaultNetworks, isRpcFailoverEnabled = false, } = options;
398
405
  const initialState = {
399
- ...getDefaultNetworkControllerState(),
406
+ ...getDefaultNetworkControllerState(additionalDefaultNetworks),
400
407
  ...state,
401
408
  };
402
409
  validateInitialState(initialState);
@@ -441,11 +448,12 @@ class NetworkController extends base_controller_1.BaseController {
441
448
  _NetworkController_getRpcServiceOptions.set(this, void 0);
442
449
  _NetworkController_getBlockTrackerOptions.set(this, void 0);
443
450
  _NetworkController_networkConfigurationsByNetworkClientId.set(this, void 0);
444
- _NetworkController_isRpcFailoverEnabled.set(this, false);
451
+ _NetworkController_isRpcFailoverEnabled.set(this, void 0);
445
452
  __classPrivateFieldSet(this, _NetworkController_infuraProjectId, infuraProjectId, "f");
446
453
  __classPrivateFieldSet(this, _NetworkController_log, log, "f");
447
454
  __classPrivateFieldSet(this, _NetworkController_getRpcServiceOptions, getRpcServiceOptions, "f");
448
455
  __classPrivateFieldSet(this, _NetworkController_getBlockTrackerOptions, getBlockTrackerOptions, "f");
456
+ __classPrivateFieldSet(this, _NetworkController_isRpcFailoverEnabled, isRpcFailoverEnabled, "f");
449
457
  __classPrivateFieldSet(this, _NetworkController_previouslySelectedNetworkClientId, this.state.selectedNetworkClientId, "f");
450
458
  __classPrivateFieldSet(this, _NetworkController_networkConfigurationsByNetworkClientId, buildNetworkConfigurationsByNetworkClientId(this.state.networkConfigurationsByChainId), "f");
451
459
  this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
@@ -464,11 +472,6 @@ class NetworkController extends base_controller_1.BaseController {
464
472
  networkStatus: constants_1.NetworkStatus.Available,
465
473
  });
466
474
  });
467
- this.messenger.subscribe(
468
- // eslint-disable-next-line no-restricted-syntax
469
- 'RemoteFeatureFlagController:stateChange', (isRpcFailoverEnabled) => {
470
- __classPrivateFieldGet(this, _NetworkController_instances, "m", _NetworkController_updateRpcFailoverEnabled).call(this, isRpcFailoverEnabled);
471
- }, selectors_1.getIsRpcFailoverEnabled);
472
475
  }
473
476
  /**
474
477
  * Returns the EthQuery instance for the currently selected network.
@@ -563,14 +566,12 @@ class NetworkController extends base_controller_1.BaseController {
563
566
  }
564
567
  return customNetworkClient;
565
568
  }
566
- /**
567
- * Initialize the NetworkController, updating the RPC failover feature flag
568
- * and applying the network selection.
569
- */
570
- init() {
571
- const state = this.messenger.call('RemoteFeatureFlagController:getState');
572
- __classPrivateFieldGet(this, _NetworkController_instances, "m", _NetworkController_updateRpcFailoverEnabled).call(this, (0, selectors_1.getIsRpcFailoverEnabled)(state));
569
+ initializeProvider({ lookupNetwork = true, } = {}) {
573
570
  __classPrivateFieldGet(this, _NetworkController_instances, "m", _NetworkController_applyNetworkSelection).call(this, this.state.selectedNetworkClientId);
571
+ if (lookupNetwork) {
572
+ return this.lookupNetwork();
573
+ }
574
+ return undefined;
574
575
  }
575
576
  /**
576
577
  * Uses a request for the latest block to gather the following information on