@metamask/network-controller 23.3.0 → 23.4.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 CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [23.4.0]
11
+
12
+ ### Added
13
+
14
+ - Add Monad Testnet as default network ([#5724](https://github.com/MetaMask/core/pull/5724))
15
+
16
+ ### Changed
17
+
18
+ - Bump `@metamask/controller-utils` to `^11.8.0` ([#5765](https://github.com/MetaMask/core/pull/5765))
19
+
10
20
  ## [23.3.0]
11
21
 
12
22
  ### Added
@@ -829,7 +839,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
829
839
 
830
840
  All changes listed after this point were applied to this package following the monorepo conversion.
831
841
 
832
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/network-controller@23.3.0...HEAD
842
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/network-controller@23.4.0...HEAD
843
+ [23.4.0]: https://github.com/MetaMask/core/compare/@metamask/network-controller@23.3.0...@metamask/network-controller@23.4.0
833
844
  [23.3.0]: https://github.com/MetaMask/core/compare/@metamask/network-controller@23.2.0...@metamask/network-controller@23.3.0
834
845
  [23.2.0]: https://github.com/MetaMask/core/compare/@metamask/network-controller@23.1.0...@metamask/network-controller@23.2.0
835
846
  [23.1.0]: https://github.com/MetaMask/core/compare/@metamask/network-controller@23.0.0...@metamask/network-controller@23.1.0
@@ -161,24 +161,38 @@ function getDefaultInfuraNetworkConfigurationsByChainId() {
161
161
  * @returns The `networkConfigurationsByChainId` object of all custom networks.
162
162
  */
163
163
  function getDefaultCustomNetworkConfigurationsByChainId() {
164
- const { ticker, rpcPrefs } = controller_utils_1.BUILT_IN_NETWORKS[controller_utils_1.BuiltInNetworkName.MegaETHTestnet];
164
+ // Create the `networkConfigurationsByChainId` objects explicitly,
165
+ // Because it is not always guaranteed that the custom networks are included in the
166
+ // default networks.
165
167
  return {
166
- [controller_utils_1.ChainId[controller_utils_1.BuiltInNetworkName.MegaETHTestnet]]: {
167
- blockExplorerUrls: [rpcPrefs.blockExplorerUrl],
168
- chainId: controller_utils_1.ChainId[controller_utils_1.BuiltInNetworkName.MegaETHTestnet],
169
- defaultRpcEndpointIndex: 0,
170
- defaultBlockExplorerUrlIndex: 0,
171
- name: controller_utils_1.NetworkNickname[controller_utils_1.BuiltInNetworkName.MegaETHTestnet],
172
- nativeCurrency: ticker,
173
- rpcEndpoints: [
174
- {
175
- failoverUrls: [],
176
- networkClientId: controller_utils_1.BuiltInNetworkName.MegaETHTestnet,
177
- type: RpcEndpointType.Custom,
178
- url: controller_utils_1.BUILT_IN_CUSTOM_NETWORKS_RPC.MEGAETH_TESTNET,
179
- },
180
- ],
181
- },
168
+ [controller_utils_1.ChainId['megaeth-testnet']]: getCustomNetworkConfiguration(controller_utils_1.CustomNetworkType['megaeth-testnet']),
169
+ [controller_utils_1.ChainId['monad-testnet']]: getCustomNetworkConfiguration(controller_utils_1.CustomNetworkType['monad-testnet']),
170
+ };
171
+ }
172
+ /**
173
+ * Constructs a `NetworkConfiguration` object by `CustomNetworkType`.
174
+ *
175
+ * @param customNetworkType - The type of the custom network.
176
+ * @returns The `NetworkConfiguration` object.
177
+ */
178
+ function getCustomNetworkConfiguration(customNetworkType) {
179
+ const { ticker, rpcPrefs } = controller_utils_1.BUILT_IN_NETWORKS[customNetworkType];
180
+ const rpcEndpointUrl = controller_utils_1.BUILT_IN_CUSTOM_NETWORKS_RPC[customNetworkType];
181
+ return {
182
+ blockExplorerUrls: [rpcPrefs.blockExplorerUrl],
183
+ chainId: controller_utils_1.ChainId[customNetworkType],
184
+ defaultRpcEndpointIndex: 0,
185
+ defaultBlockExplorerUrlIndex: 0,
186
+ name: controller_utils_1.NetworkNickname[customNetworkType],
187
+ nativeCurrency: ticker,
188
+ rpcEndpoints: [
189
+ {
190
+ failoverUrls: [],
191
+ networkClientId: customNetworkType,
192
+ type: RpcEndpointType.Custom,
193
+ url: rpcEndpointUrl,
194
+ },
195
+ ],
182
196
  };
183
197
  }
184
198
  /**