@metamask-previews/network-controller 22.2.1-preview-c1633ccd → 22.2.1-preview-912bed25
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 +0 -4
- package/dist/NetworkController.cjs +8 -11
- package/dist/NetworkController.cjs.map +1 -1
- package/dist/NetworkController.d.cts +3 -6
- package/dist/NetworkController.d.cts.map +1 -1
- package/dist/NetworkController.d.mts +3 -6
- package/dist/NetworkController.d.mts.map +1 -1
- package/dist/NetworkController.mjs +8 -11
- package/dist/NetworkController.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -42,10 +42,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
42
42
|
- Bump `@metamask/eth-json-rpc-infura` to `^10.1.0`
|
|
43
43
|
- Bump `@metamask/eth-json-rpc-middleware` to `^15.1.0`
|
|
44
44
|
|
|
45
|
-
### Fixed
|
|
46
|
-
|
|
47
|
-
- Fix `findNetworkClientIdByChainId` to return the network client ID for the chain's configured default RPC endpoint instead of its first listed RPC endpoint ([#5344](https://github.com/MetaMask/core/pull/5344))
|
|
48
|
-
|
|
49
45
|
## [22.2.1]
|
|
50
46
|
|
|
51
47
|
### Changed
|
|
@@ -1094,21 +1094,18 @@ class NetworkController extends base_controller_1.BaseController {
|
|
|
1094
1094
|
});
|
|
1095
1095
|
}
|
|
1096
1096
|
/**
|
|
1097
|
-
* Searches for
|
|
1098
|
-
* returns its network client ID. This can then be passed to
|
|
1099
|
-
* {@link getNetworkClientById} to retrieve the network client.
|
|
1097
|
+
* Searches for a network configuration ID with the given ChainID and returns it.
|
|
1100
1098
|
*
|
|
1101
|
-
* @param chainId -
|
|
1102
|
-
* @returns
|
|
1103
|
-
* endpoint.
|
|
1099
|
+
* @param chainId - ChainId to search for
|
|
1100
|
+
* @returns networkClientId of the network configuration with the given chainId
|
|
1104
1101
|
*/
|
|
1105
1102
|
findNetworkClientIdByChainId(chainId) {
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1108
|
-
|
|
1103
|
+
const networkClients = this.getNetworkClientRegistry();
|
|
1104
|
+
const networkClientEntry = Object.entries(networkClients).find(([_, networkClient]) => networkClient.configuration.chainId === chainId);
|
|
1105
|
+
if (networkClientEntry === undefined) {
|
|
1106
|
+
throw new Error("Couldn't find networkClientId for chainId");
|
|
1109
1107
|
}
|
|
1110
|
-
|
|
1111
|
-
return networkClientId;
|
|
1108
|
+
return networkClientEntry[0];
|
|
1112
1109
|
}
|
|
1113
1110
|
}
|
|
1114
1111
|
exports.NetworkController = NetworkController;
|