@metamask-previews/network-controller 23.1.0-preview-bf2d2c4c → 23.1.0-preview-6cc620a
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 +5 -0
- package/dist/NetworkController.cjs +15 -4
- package/dist/NetworkController.cjs.map +1 -1
- package/dist/NetworkController.d.cts +11 -1
- package/dist/NetworkController.d.cts.map +1 -1
- package/dist/NetworkController.d.mts +11 -1
- package/dist/NetworkController.d.mts.map +1 -1
- package/dist/NetworkController.mjs +16 -5
- package/dist/NetworkController.mjs.map +1 -1
- package/dist/constants.cjs +7 -1
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +6 -0
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +6 -0
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +6 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
14
14
|
- Update `NetworkClientConfiguration` so that `failoverUrls` is optional ([#5561](https://github.com/MetaMask/core/pull/5561))
|
|
15
15
|
- This property was introduced in 23.0.0 as a breaking change, but this change makes it non-breaking
|
|
16
16
|
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Upgrade `@metamask/eth-json-rpc-infura` to `^10.1.1` and `@metamask/eth-json-rpc-infura` to `^16.0.1` ([#5573](https://github.com/MetaMask/core/pull/5573))
|
|
20
|
+
- This fixes a bug where non-standard unsuccessful JSON-RPC errors were being ignored/discarded
|
|
21
|
+
|
|
17
22
|
## [23.1.0]
|
|
18
23
|
|
|
19
24
|
### Added
|
|
@@ -129,6 +129,10 @@ function getDefaultNetworkConfigurationsByChainId(additionalDefaultNetworks = []
|
|
|
129
129
|
function getDefaultInfuraNetworkConfigurationsByChainId() {
|
|
130
130
|
return Object.values(controller_utils_1.InfuraNetworkType).reduce((obj, infuraNetworkType) => {
|
|
131
131
|
const chainId = controller_utils_1.ChainId[infuraNetworkType];
|
|
132
|
+
// Skip deprecated network as default network.
|
|
133
|
+
if (constants_1.DEPRECATED_NETWORKS.has(chainId)) {
|
|
134
|
+
return obj;
|
|
135
|
+
}
|
|
132
136
|
const rpcEndpointUrl =
|
|
133
137
|
// This ESLint rule mistakenly produces an error.
|
|
134
138
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
@@ -416,10 +420,8 @@ class NetworkController extends base_controller_1.BaseController {
|
|
|
416
420
|
// ESLint is mistaken here; `name` is a string.
|
|
417
421
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
418
422
|
`${this.name}:getNetworkConfigurationByNetworkClientId`, this.getNetworkConfigurationByNetworkClientId.bind(this));
|
|
419
|
-
this.messagingSystem.registerActionHandler(
|
|
420
|
-
|
|
421
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
422
|
-
`${this.name}:getSelectedNetworkClient`, this.getSelectedNetworkClient.bind(this));
|
|
423
|
+
this.messagingSystem.registerActionHandler(`${this.name}:getSelectedNetworkClient`, this.getSelectedNetworkClient.bind(this));
|
|
424
|
+
this.messagingSystem.registerActionHandler(`${this.name}:getSelectedChainId`, this.getSelectedChainId.bind(this));
|
|
423
425
|
this.messagingSystem.registerActionHandler(
|
|
424
426
|
// ESLint is mistaken here; `name` is a string.
|
|
425
427
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
@@ -458,6 +460,15 @@ class NetworkController extends base_controller_1.BaseController {
|
|
|
458
460
|
}
|
|
459
461
|
return undefined;
|
|
460
462
|
}
|
|
463
|
+
/**
|
|
464
|
+
* Accesses the chain ID from the selected network client.
|
|
465
|
+
*
|
|
466
|
+
* @returns The chain ID of the selected network client in hex format or undefined if there is no network client.
|
|
467
|
+
*/
|
|
468
|
+
getSelectedChainId() {
|
|
469
|
+
const networkConfiguration = this.getNetworkConfigurationByNetworkClientId(this.state.selectedNetworkClientId);
|
|
470
|
+
return networkConfiguration?.chainId;
|
|
471
|
+
}
|
|
461
472
|
/**
|
|
462
473
|
* Internally, the Infura and custom network clients are categorized by type
|
|
463
474
|
* so that when accessing either kind of network client, TypeScript knows
|