@metamask/network-controller 30.0.1 → 30.1.0
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 +54 -22
- package/dist/NetworkController-method-action-types.cjs +7 -0
- package/dist/NetworkController-method-action-types.cjs.map +1 -0
- package/dist/NetworkController-method-action-types.d.cts +308 -0
- package/dist/NetworkController-method-action-types.d.cts.map +1 -0
- package/dist/NetworkController-method-action-types.d.mts +308 -0
- package/dist/NetworkController-method-action-types.d.mts.map +1 -0
- package/dist/NetworkController-method-action-types.mjs +6 -0
- package/dist/NetworkController-method-action-types.mjs.map +1 -0
- package/dist/NetworkController.cjs +36 -15
- package/dist/NetworkController.cjs.map +1 -1
- package/dist/NetworkController.d.cts +15 -57
- package/dist/NetworkController.d.cts.map +1 -1
- package/dist/NetworkController.d.mts +15 -57
- package/dist/NetworkController.d.mts.map +1 -1
- package/dist/NetworkController.mjs +36 -15
- package/dist/NetworkController.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/abstract-rpc-service.cjs.map +1 -1
- package/dist/rpc-service/abstract-rpc-service.d.cts +5 -0
- package/dist/rpc-service/abstract-rpc-service.d.cts.map +1 -1
- package/dist/rpc-service/abstract-rpc-service.d.mts +5 -0
- package/dist/rpc-service/abstract-rpc-service.d.mts.map +1 -1
- package/dist/rpc-service/abstract-rpc-service.mjs.map +1 -1
- package/dist/rpc-service/rpc-service-chain.cjs +1 -1
- package/dist/rpc-service/rpc-service-chain.cjs.map +1 -1
- package/dist/rpc-service/rpc-service-chain.d.cts.map +1 -1
- package/dist/rpc-service/rpc-service-chain.d.mts.map +1 -1
- package/dist/rpc-service/rpc-service-chain.mjs +1 -1
- package/dist/rpc-service/rpc-service-chain.mjs.map +1 -1
- package/dist/rpc-service/rpc-service-requestable.cjs.map +1 -1
- package/dist/rpc-service/rpc-service-requestable.d.cts +5 -0
- package/dist/rpc-service/rpc-service-requestable.d.cts.map +1 -1
- package/dist/rpc-service/rpc-service-requestable.d.mts +5 -0
- package/dist/rpc-service/rpc-service-requestable.d.mts.map +1 -1
- package/dist/rpc-service/rpc-service-requestable.mjs.map +1 -1
- package/dist/rpc-service/rpc-service.cjs.map +1 -1
- package/dist/rpc-service/rpc-service.d.cts +17 -9
- package/dist/rpc-service/rpc-service.d.cts.map +1 -1
- package/dist/rpc-service/rpc-service.d.mts +17 -9
- package/dist/rpc-service/rpc-service.d.mts.map +1 -1
- package/dist/rpc-service/rpc-service.mjs.map +1 -1
- package/package.json +21 -18
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [30.1.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Expose missing public `NetworkController` methods through its messenger ([#8350](https://github.com/MetaMask/core/pull/8350))
|
|
15
|
+
- The following actions are now available:
|
|
16
|
+
- `NetworkController:enableRpcFailover`
|
|
17
|
+
- `NetworkController:disableRpcFailover`
|
|
18
|
+
- `NetworkController:getProviderAndBlockTracker`
|
|
19
|
+
- `NetworkController:getNetworkClientRegistry`
|
|
20
|
+
- `NetworkController:initializeProvider`
|
|
21
|
+
- `NetworkController:lookupNetwork`
|
|
22
|
+
- `NetworkController:lookupNetworkByClientId`
|
|
23
|
+
- `NetworkController:get1559CompatibilityWithNetworkClientId`
|
|
24
|
+
- `NetworkController:resetConnection`
|
|
25
|
+
- `NetworkController:rollbackToPreviousProvider`
|
|
26
|
+
- `NetworkController:loadBackup`
|
|
27
|
+
- Corresponding action types are available as well.
|
|
28
|
+
- Add `getEthQuery` method to `NetworkController` ([#8350](https://github.com/MetaMask/core/pull/8350))
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- Bump `@metamask/controller-utils` from `^11.19.0` to `^11.20.0` ([#8344](https://github.com/MetaMask/core/pull/8344))
|
|
33
|
+
- Bump `@metamask/eth-json-rpc-middleware` from `^23.1.1` to `^23.1.3` ([#8550](https://github.com/MetaMask/core/pull/8550), [#8611](https://github.com/MetaMask/core/pull/8611))
|
|
34
|
+
- Bump `@metamask/messenger` from `^1.0.0` to `^1.2.0` ([#8364](https://github.com/MetaMask/core/pull/8364), [#8373](https://github.com/MetaMask/core/pull/8373), [#8632](https://github.com/MetaMask/core/pull/8632))
|
|
35
|
+
- Bump `@metamask/base-controller` from `^9.0.1` to `^9.1.0` ([#8457](https://github.com/MetaMask/core/pull/8457))
|
|
36
|
+
|
|
37
|
+
### Deprecated
|
|
38
|
+
|
|
39
|
+
- `NetworkControllerGetNetworkConfigurationByNetworkClientId` type is deprecated in favor of `NetworkControllerGetNetworkConfigurationByNetworkClientIdAction` ([#8350](https://github.com/MetaMask/core/pull/8350))
|
|
40
|
+
- Deprecate `AbstractRpcService` and `RpcServiceRequestable` ([#8475](https://github.com/MetaMask/core/pull/8475))
|
|
41
|
+
- There are no equivalents to these interfaces. If you need to take an "RPC-service-like" argument, it's best to declare which properties you're interested in rather than accepting the entire RPC service interface.
|
|
42
|
+
|
|
10
43
|
## [30.0.1]
|
|
11
44
|
|
|
12
45
|
### Changed
|
|
@@ -522,7 +555,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
522
555
|
["Are the Types Wrong?"](https://arethetypeswrong.github.io/) tool as
|
|
523
556
|
["masquerading as CJS"](https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md).
|
|
524
557
|
All of the ATTW checks now pass.
|
|
525
|
-
- Remove chunk files ([#4648](https://github.com/MetaMask/core/pull/4648))
|
|
558
|
+
- Remove chunk files ([#4648](https://github.com/MetaMask/core/pull/4648))
|
|
526
559
|
- Previously, the build tool we used to generate JavaScript files extracted
|
|
527
560
|
common code to "chunk" files. While this was intended to make this package
|
|
528
561
|
more tree-shakeable, it also made debugging more difficult for our
|
|
@@ -532,23 +565,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
532
565
|
|
|
533
566
|
### Added
|
|
534
567
|
|
|
535
|
-
- **BREAKING:** Add `networkConfigurationsByChainId` to `NetworkState` (type: `Record<Hex, NetworkConfiguration>`) ([#4268](https://github.com/MetaMask/core/pull/
|
|
568
|
+
- **BREAKING:** Add `networkConfigurationsByChainId` to `NetworkState` (type: `Record<Hex, NetworkConfiguration>`) ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
536
569
|
- This property replaces `networkConfigurations`, and, as its name implies, organizes network configurations by chain ID rather than network client ID.
|
|
537
570
|
- If no initial state or this property is not included in initial state, the default value of this property will now include configurations for known Infura networks (Mainnet, Goerli, Sepolia, Linea Goerli, Linea Sepolia, and Linea Mainnet) by default.
|
|
538
|
-
- Add `getNetworkConfigurationByChainId` method, `NetworkController:getNetworkConfigurationByChainId` messenger action, and `NetworkControllerGetNetworkConfigurationByNetworkClientId` type ([#4268](https://github.com/MetaMask/core/pull/
|
|
539
|
-
- Add `addNetwork`, which replaces one half of `upsertNetworkConfiguration` and can be used to add new network clients for a chain ([#4268](https://github.com/MetaMask/core/pull/
|
|
571
|
+
- Add `getNetworkConfigurationByChainId` method, `NetworkController:getNetworkConfigurationByChainId` messenger action, and `NetworkControllerGetNetworkConfigurationByNetworkClientId` type ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
572
|
+
- Add `addNetwork`, which replaces one half of `upsertNetworkConfiguration` and can be used to add new network clients for a chain ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
540
573
|
- It's worth noting that this method now publishes a `NetworkController:networkAdded` event instead of calling a `trackMetaMetricsEvent` callback. It is expected that you will subscribe to this event and create a MetaMetrics event yourself.
|
|
541
|
-
- Add `updateNetwork`, which replaces one half of `upsertNetworkConfiguration` and can be used to recreate the network clients for an existing chain based on an updated configuration ([#4268](https://github.com/MetaMask/core/pull/
|
|
574
|
+
- Add `updateNetwork`, which replaces one half of `upsertNetworkConfiguration` and can be used to recreate the network clients for an existing chain based on an updated configuration ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
542
575
|
- Note that it is not possible to remove the RPC endpoint from a network configuration that is currently represented by the globally selected network client. To prevent an error, you'll need to detect when such a removal is occurring and pass the `replacementSelectedRpcEndpointIndex` to `updateNetwork`. It will then switch to the designated RPC endpoint's network client on your behalf.
|
|
543
|
-
- Add `removeNetwork`, which replaces `removeNetworkConfiguration` and can be used to remove existing network clients for a chain ([#4268](https://github.com/MetaMask/core/pull/
|
|
544
|
-
- Add `getDefaultNetworkControllerState` function, which replaces `defaultState` and matches patterns in other controllers ([#4268](https://github.com/MetaMask/core/pull/
|
|
545
|
-
- Add `RpcEndpointType`, `AddNetworkFields`, and `UpdateNetworkFields` types ([#4268](https://github.com/MetaMask/core/pull/
|
|
546
|
-
- Add `getNetworkConfigurations`, `getAvailableNetworkClientIds` and `selectAvailableNetworkClientIds` selectors ([#4268](https://github.com/MetaMask/core/pull/
|
|
576
|
+
- Add `removeNetwork`, which replaces `removeNetworkConfiguration` and can be used to remove existing network clients for a chain ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
577
|
+
- Add `getDefaultNetworkControllerState` function, which replaces `defaultState` and matches patterns in other controllers ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
578
|
+
- Add `RpcEndpointType`, `AddNetworkFields`, and `UpdateNetworkFields` types ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
579
|
+
- Add `getNetworkConfigurations`, `getAvailableNetworkClientIds` and `selectAvailableNetworkClientIds` selectors ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
547
580
|
- These new selectors can be applied to messenger event subscriptions
|
|
548
581
|
|
|
549
582
|
### Changed
|
|
550
583
|
|
|
551
|
-
- **BREAKING:** Replace `NetworkConfiguration` type with a new definition ([#4268](https://github.com/MetaMask/core/pull/
|
|
584
|
+
- **BREAKING:** Replace `NetworkConfiguration` type with a new definition ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
552
585
|
- A network configuration no longer represents a single RPC endpoint but rather a collection of RPC endpoints that can all be used to interface with a single chain.
|
|
553
586
|
- The only property that has brought over to this type unchanged is `chainId`.
|
|
554
587
|
- `ticker` has been renamed to `nativeCurrency`.
|
|
@@ -557,17 +590,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
557
590
|
- `defaultRpcEndpointIndex` has been added. This must point to an entry in `rpcEndpoints`.
|
|
558
591
|
- The block explorer URL is no longer located in `rpcPrefs` and is no longer restricted to one: `blockExplorerUrls` has been added along with a corresponding property `defaultBlockExplorerUrlIndex`, which must point to an entry in `blockExplorerUrls`.
|
|
559
592
|
- `id` has been removed. Previously, this represented the ID of the network client associated with the network configuration. Since network clients are now created from RPC endpoints, the equivalent to this is the `networkClientId` property on an `RpcEndpoint`.
|
|
560
|
-
- **BREAKING:** The network controller messenger must now allow the action `NetworkController:getNetworkConfigurationByChainId` ([#4268](https://github.com/MetaMask/core/pull/
|
|
561
|
-
- **BREAKING:** The network controller messenger must now allow the event `NetworkController:networkAdded` ([#4268](https://github.com/MetaMask/core/pull/
|
|
562
|
-
- **BREAKING:** The `NetworkController` constructor will now throw if the initial state provided is invalid ([#4268](https://github.com/MetaMask/core/pull/
|
|
593
|
+
- **BREAKING:** The network controller messenger must now allow the action `NetworkController:getNetworkConfigurationByChainId` ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
594
|
+
- **BREAKING:** The network controller messenger must now allow the event `NetworkController:networkAdded` ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
595
|
+
- **BREAKING:** The `NetworkController` constructor will now throw if the initial state provided is invalid ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
563
596
|
- `networkConfigurationsByChainId` cannot be empty.
|
|
564
597
|
- The `chainId` of a network configuration in `networkConfigurationsByChainId` must match the chain ID it is filed under.
|
|
565
598
|
- The `defaultRpcEndpointIndex` of a network configuration in `networkConfigurationsByChainId` must point to an entry in its `rpcEndpoints`.
|
|
566
599
|
- The `defaultBlockExplorerUrlIndex` of a network configuration in `networkConfigurationsByChainId` must point to an entry in its `blockExplorerUrls`.
|
|
567
600
|
- `selectedNetworkClientId` must match the `networkClientId` of an RPC endpoint in `networkConfigurationsByChainId`.
|
|
568
|
-
- **BREAKING:** Update `getNetworkConfigurationByNetworkClientId` so that when given an Infura network name (that is, a value from `InfuraNetworkType`), it will return a masked version of the RPC endpoint URL for the associated Infura network ([#4268](https://github.com/MetaMask/core/pull/
|
|
601
|
+
- **BREAKING:** Update `getNetworkConfigurationByNetworkClientId` so that when given an Infura network name (that is, a value from `InfuraNetworkType`), it will return a masked version of the RPC endpoint URL for the associated Infura network ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
569
602
|
- If you want the unmasked version, you'll need the `url` property from the network _client_ configuration, which you can get by calling `getNetworkClientById` and then accessing the `configuration` property off of the network client.
|
|
570
|
-
- **BREAKING:** Update `loadBackup` to take and update `networkConfigurationsByChainId` instead of `networkConfigurations` ([#4268](https://github.com/MetaMask/core/pull/
|
|
603
|
+
- **BREAKING:** Update `loadBackup` to take and update `networkConfigurationsByChainId` instead of `networkConfigurations` ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
571
604
|
- Bump `@metamask/base-controller` from `^6.0.2` to `^7.0.0` ([#4625](https://github.com/MetaMask/core/pull/4625), [#4643](https://github.com/MetaMask/core/pull/4643))
|
|
572
605
|
- Bump `@metamask/controller-utils` from `^11.0.2` to `^11.2.0` ([#4639](https://github.com/MetaMask/core/pull/4639), [#4651](https://github.com/MetaMask/core/pull/4651))
|
|
573
606
|
- Bump `@metamask/eth-block-tracker` from `^9.0.3` to `^10.0.0` ([#4424](https://github.com/MetaMask/core/pull/4424))
|
|
@@ -575,10 +608,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
575
608
|
|
|
576
609
|
### Removed
|
|
577
610
|
|
|
578
|
-
- **BREAKING:** Remove `networkConfigurations` from `NetworkState`, which has been replaced with `networkConfigurationsByChainId` ([#4268](https://github.com/MetaMask/core/pull/
|
|
579
|
-
- **BREAKING:** Remove `upsertNetworkConfiguration` and `removeNetworkConfiguration`, which have been replaced with `addNetwork`, `updateNetwork`, and `removeNetwork` ([#4268](https://github.com/MetaMask/core/pull/
|
|
580
|
-
- **BREAKING:** Remove `defaultState` variable, which has been replaced with a `getDefaultNetworkControllerState` function ([#4268](https://github.com/MetaMask/core/pull/
|
|
581
|
-
- **BREAKING:** Remove `trackMetaMetricsEvent` option from the NetworkController constructor ([#4268](https://github.com/MetaMask/core/pull/
|
|
611
|
+
- **BREAKING:** Remove `networkConfigurations` from `NetworkState`, which has been replaced with `networkConfigurationsByChainId` ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
612
|
+
- **BREAKING:** Remove `upsertNetworkConfiguration` and `removeNetworkConfiguration`, which have been replaced with `addNetwork`, `updateNetwork`, and `removeNetwork` ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
613
|
+
- **BREAKING:** Remove `defaultState` variable, which has been replaced with a `getDefaultNetworkControllerState` function ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
614
|
+
- **BREAKING:** Remove `trackMetaMetricsEvent` option from the NetworkController constructor ([#4268](https://github.com/MetaMask/core/pull/4268))
|
|
582
615
|
- Previously, this was used in `upsertNetworkConfiguration` to create a MetaMetrics event when a new network was added. This can now be achieved by subscribing to the `NetworkController:networkAdded` event and creating the event inside of the event handler.
|
|
583
616
|
|
|
584
617
|
## [20.2.0]
|
|
@@ -1119,14 +1152,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1119
1152
|
### Added
|
|
1120
1153
|
|
|
1121
1154
|
- Initial release
|
|
1122
|
-
|
|
1123
1155
|
- As a result of converting our shared controllers repo into a monorepo ([#831](https://github.com/MetaMask/core/pull/831)), we've created this package from select parts of [`@metamask/controllers` v33.0.0](https://github.com/MetaMask/core/tree/v33.0.0), namely:
|
|
1124
|
-
|
|
1125
1156
|
- Everything in `src/network` (minus `NetworkType` and `NetworksChainId`, which were placed in `@metamask/controller-utils`)
|
|
1126
1157
|
|
|
1127
1158
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
1128
1159
|
|
|
1129
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/network-controller@30.0
|
|
1160
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/network-controller@30.1.0...HEAD
|
|
1161
|
+
[30.1.0]: https://github.com/MetaMask/core/compare/@metamask/network-controller@30.0.1...@metamask/network-controller@30.1.0
|
|
1130
1162
|
[30.0.1]: https://github.com/MetaMask/core/compare/@metamask/network-controller@30.0.0...@metamask/network-controller@30.0.1
|
|
1131
1163
|
[30.0.0]: https://github.com/MetaMask/core/compare/@metamask/network-controller@29.0.0...@metamask/network-controller@30.0.0
|
|
1132
1164
|
[29.0.0]: https://github.com/MetaMask/core/compare/@metamask/network-controller@28.0.0...@metamask/network-controller@29.0.0
|
|
@@ -0,0 +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 * 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"]}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated.
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { NetworkController } from "./NetworkController.cjs";
|
|
6
|
+
/**
|
|
7
|
+
* Returns the EthQuery instance for the currently selected network.
|
|
8
|
+
*
|
|
9
|
+
* @returns The EthQuery instance, or undefined if the provider has not been
|
|
10
|
+
* initialized.
|
|
11
|
+
*/
|
|
12
|
+
export type NetworkControllerGetEthQueryAction = {
|
|
13
|
+
type: `NetworkController:getEthQuery`;
|
|
14
|
+
handler: NetworkController['getEthQuery'];
|
|
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
|
+
/**
|
|
35
|
+
* Accesses the provider and block tracker for the currently selected network.
|
|
36
|
+
*
|
|
37
|
+
* @returns The proxy and block tracker proxies.
|
|
38
|
+
* @deprecated This method has been replaced by `getSelectedNetworkClient` (which has a more easily used return type) and will be removed in a future release.
|
|
39
|
+
*/
|
|
40
|
+
export type NetworkControllerGetProviderAndBlockTrackerAction = {
|
|
41
|
+
type: `NetworkController:getProviderAndBlockTracker`;
|
|
42
|
+
handler: NetworkController['getProviderAndBlockTracker'];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Accesses the provider and block tracker for the currently selected network.
|
|
46
|
+
*
|
|
47
|
+
* @returns an object with the provider and block tracker proxies for the currently selected network.
|
|
48
|
+
*/
|
|
49
|
+
export type NetworkControllerGetSelectedNetworkClientAction = {
|
|
50
|
+
type: `NetworkController:getSelectedNetworkClient`;
|
|
51
|
+
handler: NetworkController['getSelectedNetworkClient'];
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Accesses the chain ID from the selected network client.
|
|
55
|
+
*
|
|
56
|
+
* @returns The chain ID of the selected network client in hex format or undefined if there is no network client.
|
|
57
|
+
*/
|
|
58
|
+
export type NetworkControllerGetSelectedChainIdAction = {
|
|
59
|
+
type: `NetworkController:getSelectedChainId`;
|
|
60
|
+
handler: NetworkController['getSelectedChainId'];
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Internally, the Infura and custom network clients are categorized by type
|
|
64
|
+
* so that when accessing either kind of network client, TypeScript knows
|
|
65
|
+
* which type to assign to the network client. For some cases it's more useful
|
|
66
|
+
* to be able to access network clients by ID instead of by type and then ID,
|
|
67
|
+
* so this function makes that possible.
|
|
68
|
+
*
|
|
69
|
+
* @returns The network clients registered so far, keyed by ID.
|
|
70
|
+
*/
|
|
71
|
+
export type NetworkControllerGetNetworkClientRegistryAction = {
|
|
72
|
+
type: `NetworkController:getNetworkClientRegistry`;
|
|
73
|
+
handler: NetworkController['getNetworkClientRegistry'];
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Returns the Infura network client with the given ID.
|
|
77
|
+
*
|
|
78
|
+
* @param infuraNetworkClientId - An Infura network client ID.
|
|
79
|
+
* @returns The Infura network client.
|
|
80
|
+
* @throws If an Infura network client does not exist with the given ID.
|
|
81
|
+
*/
|
|
82
|
+
export type NetworkControllerGetNetworkClientByIdAction = {
|
|
83
|
+
type: `NetworkController:getNetworkClientById`;
|
|
84
|
+
handler: NetworkController['getNetworkClientById'];
|
|
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
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Uses a request for the latest block to gather the following information on
|
|
110
|
+
* the given or selected network, persisting it to state:
|
|
111
|
+
*
|
|
112
|
+
* - The connectivity status: whether it is available, geo-blocked (Infura
|
|
113
|
+
* only), unavailable, or unknown
|
|
114
|
+
* - The capabilities status: whether it supports EIP-1559, whether it does
|
|
115
|
+
* not, or whether it is unknown
|
|
116
|
+
*
|
|
117
|
+
* @param networkClientId - The ID of the network client to inspect.
|
|
118
|
+
* If no ID is provided, uses the currently selected network.
|
|
119
|
+
*/
|
|
120
|
+
export type NetworkControllerLookupNetworkAction = {
|
|
121
|
+
type: `NetworkController:lookupNetwork`;
|
|
122
|
+
handler: NetworkController['lookupNetwork'];
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Uses a request for the latest block to gather the following information on
|
|
126
|
+
* the given network, persisting it to state:
|
|
127
|
+
*
|
|
128
|
+
* - The connectivity status: whether the network is available, geo-blocked
|
|
129
|
+
* (Infura only), unavailable, or unknown
|
|
130
|
+
* - The feature compatibility status: whether the network supports EIP-1559,
|
|
131
|
+
* whether it does not, or whether it is unknown
|
|
132
|
+
*
|
|
133
|
+
* @param networkClientId - The ID of the network client to inspect.
|
|
134
|
+
* @deprecated Please use `lookupNetwork` and pass a network client ID
|
|
135
|
+
* instead. This method will be removed in a future major version.
|
|
136
|
+
*/
|
|
137
|
+
export type NetworkControllerLookupNetworkByClientIdAction = {
|
|
138
|
+
type: `NetworkController:lookupNetworkByClientId`;
|
|
139
|
+
handler: NetworkController['lookupNetworkByClientId'];
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Convenience method to update provider network type settings.
|
|
143
|
+
*
|
|
144
|
+
* @param type - Human readable network name.
|
|
145
|
+
* @deprecated This has been replaced by `setActiveNetwork`, and will be
|
|
146
|
+
* removed in a future release
|
|
147
|
+
*/
|
|
148
|
+
export type NetworkControllerSetProviderTypeAction = {
|
|
149
|
+
type: `NetworkController:setProviderType`;
|
|
150
|
+
handler: NetworkController['setProviderType'];
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Changes the selected network.
|
|
154
|
+
*
|
|
155
|
+
* @param networkClientId - The ID of a network client that will be used to
|
|
156
|
+
* make requests.
|
|
157
|
+
* @param options - Options for this method.
|
|
158
|
+
* @param options.updateState - Allows for updating state.
|
|
159
|
+
* @throws if no network client is associated with the given
|
|
160
|
+
* network client ID.
|
|
161
|
+
*/
|
|
162
|
+
export type NetworkControllerSetActiveNetworkAction = {
|
|
163
|
+
type: `NetworkController:setActiveNetwork`;
|
|
164
|
+
handler: NetworkController['setActiveNetwork'];
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Determines whether the network supports EIP-1559 by checking whether the
|
|
168
|
+
* latest block has a `baseFeePerGas` property, then updates state
|
|
169
|
+
* appropriately.
|
|
170
|
+
*
|
|
171
|
+
* @param networkClientId - The networkClientId to fetch the correct provider against which to check 1559 compatibility.
|
|
172
|
+
* @returns A promise that resolves to true if the network supports EIP-1559
|
|
173
|
+
* , false otherwise, or `undefined` if unable to determine the compatibility.
|
|
174
|
+
*/
|
|
175
|
+
export type NetworkControllerGetEIP1559CompatibilityAction = {
|
|
176
|
+
type: `NetworkController:getEIP1559Compatibility`;
|
|
177
|
+
handler: NetworkController['getEIP1559Compatibility'];
|
|
178
|
+
};
|
|
179
|
+
export type NetworkControllerGet1559CompatibilityWithNetworkClientIdAction = {
|
|
180
|
+
type: `NetworkController:get1559CompatibilityWithNetworkClientId`;
|
|
181
|
+
handler: NetworkController['get1559CompatibilityWithNetworkClientId'];
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Ensures that the provider and block tracker proxies are pointed to the
|
|
185
|
+
* currently selected network and refreshes the metadata for the
|
|
186
|
+
*/
|
|
187
|
+
export type NetworkControllerResetConnectionAction = {
|
|
188
|
+
type: `NetworkController:resetConnection`;
|
|
189
|
+
handler: NetworkController['resetConnection'];
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Returns the network configuration that has been filed under the given chain
|
|
193
|
+
* ID.
|
|
194
|
+
*
|
|
195
|
+
* @param chainId - The chain ID to use as a key.
|
|
196
|
+
* @returns The network configuration if one exists, or undefined.
|
|
197
|
+
*/
|
|
198
|
+
export type NetworkControllerGetNetworkConfigurationByChainIdAction = {
|
|
199
|
+
type: `NetworkController:getNetworkConfigurationByChainId`;
|
|
200
|
+
handler: NetworkController['getNetworkConfigurationByChainId'];
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Returns the network configuration that contains an RPC endpoint with the
|
|
204
|
+
* given network client ID.
|
|
205
|
+
*
|
|
206
|
+
* @param networkClientId - The network client ID to use as a key.
|
|
207
|
+
* @returns The network configuration if one exists, or undefined.
|
|
208
|
+
*/
|
|
209
|
+
export type NetworkControllerGetNetworkConfigurationByNetworkClientIdAction = {
|
|
210
|
+
type: `NetworkController:getNetworkConfigurationByNetworkClientId`;
|
|
211
|
+
handler: NetworkController['getNetworkConfigurationByNetworkClientId'];
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Creates and registers network clients for the collection of Infura and
|
|
215
|
+
* custom RPC endpoints that can be used to make requests for a particular
|
|
216
|
+
* chain, storing the given configuration object in state for later reference.
|
|
217
|
+
*
|
|
218
|
+
* @param fields - The object that describes the new network/chain and lists
|
|
219
|
+
* the RPC endpoints which front that chain.
|
|
220
|
+
* @returns The newly added network configuration.
|
|
221
|
+
* @throws if any part of `fields` would produce invalid state.
|
|
222
|
+
* @see {@link NetworkConfiguration}
|
|
223
|
+
*/
|
|
224
|
+
export type NetworkControllerAddNetworkAction = {
|
|
225
|
+
type: `NetworkController:addNetwork`;
|
|
226
|
+
handler: NetworkController['addNetwork'];
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Updates the configuration for a previously stored network filed under the
|
|
230
|
+
* given chain ID, creating + registering new network clients to represent RPC
|
|
231
|
+
* endpoints that have been added and destroying + unregistering existing
|
|
232
|
+
* network clients for RPC endpoints that have been removed.
|
|
233
|
+
*
|
|
234
|
+
* Note that if `chainId` is changed, then all network clients associated with
|
|
235
|
+
* that chain will be removed and re-added, even if none of the RPC endpoints
|
|
236
|
+
* have changed.
|
|
237
|
+
*
|
|
238
|
+
* @param chainId - The chain ID associated with an existing network.
|
|
239
|
+
* @param fields - The object that describes the updates to the network/chain,
|
|
240
|
+
* including the new set of RPC endpoints which should front that chain.
|
|
241
|
+
* @param options - Options to provide.
|
|
242
|
+
* @param options.replacementSelectedRpcEndpointIndex - Usually you cannot
|
|
243
|
+
* remove an RPC endpoint that is being represented by the currently selected
|
|
244
|
+
* network client. This option allows you to specify another RPC endpoint
|
|
245
|
+
* (either an existing one or a new one) that should be used to select a new
|
|
246
|
+
* network instead.
|
|
247
|
+
* @returns The updated network configuration.
|
|
248
|
+
* @throws if `chainId` does not refer to an existing network configuration,
|
|
249
|
+
* if any part of `fields` would produce invalid state, etc.
|
|
250
|
+
* @see {@link NetworkConfiguration}
|
|
251
|
+
*/
|
|
252
|
+
export type NetworkControllerUpdateNetworkAction = {
|
|
253
|
+
type: `NetworkController:updateNetwork`;
|
|
254
|
+
handler: NetworkController['updateNetwork'];
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Destroys and unregisters the network identified by the given chain ID, also
|
|
258
|
+
* removing the associated network configuration from state.
|
|
259
|
+
*
|
|
260
|
+
* @param chainId - The chain ID associated with an existing network.
|
|
261
|
+
* @throws if `chainId` does not refer to an existing network configuration,
|
|
262
|
+
* or if the currently selected network is being removed.
|
|
263
|
+
* @see {@link NetworkConfiguration}
|
|
264
|
+
*/
|
|
265
|
+
export type NetworkControllerRemoveNetworkAction = {
|
|
266
|
+
type: `NetworkController:removeNetwork`;
|
|
267
|
+
handler: NetworkController['removeNetwork'];
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* Assuming that the network has been previously switched, switches to this
|
|
271
|
+
* new network.
|
|
272
|
+
*
|
|
273
|
+
* If the network has not been previously switched, this method is equivalent
|
|
274
|
+
* to {@link resetConnection}.
|
|
275
|
+
*/
|
|
276
|
+
export type NetworkControllerRollbackToPreviousProviderAction = {
|
|
277
|
+
type: `NetworkController:rollbackToPreviousProvider`;
|
|
278
|
+
handler: NetworkController['rollbackToPreviousProvider'];
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Merges the given backup data into controller state.
|
|
282
|
+
*
|
|
283
|
+
* @param backup - The data that has been backed up.
|
|
284
|
+
* @param backup.networkConfigurationsByChainId - Network configurations,
|
|
285
|
+
* keyed by chain ID.
|
|
286
|
+
*/
|
|
287
|
+
export type NetworkControllerLoadBackupAction = {
|
|
288
|
+
type: `NetworkController:loadBackup`;
|
|
289
|
+
handler: NetworkController['loadBackup'];
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Searches for the default RPC endpoint configured for the given chain and
|
|
293
|
+
* returns its network client ID. This can then be passed to
|
|
294
|
+
* {@link getNetworkClientById} to retrieve the network client.
|
|
295
|
+
*
|
|
296
|
+
* @param chainId - Chain ID to search for.
|
|
297
|
+
* @returns The ID of the network client created for the chain's default RPC
|
|
298
|
+
* endpoint.
|
|
299
|
+
*/
|
|
300
|
+
export type NetworkControllerFindNetworkClientIdByChainIdAction = {
|
|
301
|
+
type: `NetworkController:findNetworkClientIdByChainId`;
|
|
302
|
+
handler: NetworkController['findNetworkClientIdByChainId'];
|
|
303
|
+
};
|
|
304
|
+
/**
|
|
305
|
+
* Union of all NetworkController action types.
|
|
306
|
+
*/
|
|
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;
|
|
308
|
+
//# sourceMappingURL=NetworkController-method-action-types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkController-method-action-types.d.cts","sourceRoot":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