@metamask-previews/network-controller 23.2.0-preview-836a8df → 23.2.0-preview-cabccf7

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
@@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
  ### Added
11
11
 
12
12
  - Add optional `getBlockTrackerOptions` argument to NetworkController constructor ([#5702](https://github.com/MetaMask/core/pull/5702))
13
+ - Add Monad Testnet as default network ([#5724](https://github.com/MetaMask/core/pull/5724))
14
+
15
+ ### Changed
16
+
17
+ - Bump `@metamask/base-controller` from ^8.0.0 to ^8.0.1 ([#5722](https://github.com/MetaMask/core/pull/5722))
13
18
 
14
19
  ## [23.2.0]
15
20
 
@@ -161,25 +161,35 @@ 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];
165
- return {
166
- [controller_utils_1.ChainId[controller_utils_1.BuiltInNetworkName.MegaETHTestnet]]: {
164
+ return Object.values(controller_utils_1.CustomNetworkType).reduce((obj, customNetworkType) => {
165
+ const chainId = controller_utils_1.ChainId[customNetworkType];
166
+ const { ticker, rpcPrefs } = controller_utils_1.BUILT_IN_NETWORKS[customNetworkType];
167
+ // It converts client id to upper case and replace '-' with '_'
168
+ // to match the key in BUILT_IN_CUSTOM_NETWORKS_RPC
169
+ // e.g. 'megaeth-testnet' to 'MEGAETH_TESTNET'
170
+ // e.g. 'monad-testnet' to 'MONAD_TESTNET'
171
+ // TODO: Refactor controller-utils to use the same format as others
172
+ const rpcEndpointUrlKey = customNetworkType
173
+ .toUpperCase()
174
+ .replace('-', '_');
175
+ const networkConfiguration = {
167
176
  blockExplorerUrls: [rpcPrefs.blockExplorerUrl],
168
- chainId: controller_utils_1.ChainId[controller_utils_1.BuiltInNetworkName.MegaETHTestnet],
177
+ chainId: controller_utils_1.ChainId[customNetworkType],
169
178
  defaultRpcEndpointIndex: 0,
170
179
  defaultBlockExplorerUrlIndex: 0,
171
- name: controller_utils_1.NetworkNickname[controller_utils_1.BuiltInNetworkName.MegaETHTestnet],
180
+ name: controller_utils_1.NetworkNickname[customNetworkType],
172
181
  nativeCurrency: ticker,
173
182
  rpcEndpoints: [
174
183
  {
175
184
  failoverUrls: [],
176
- networkClientId: controller_utils_1.BuiltInNetworkName.MegaETHTestnet,
185
+ networkClientId: customNetworkType,
177
186
  type: RpcEndpointType.Custom,
178
- url: controller_utils_1.BUILT_IN_CUSTOM_NETWORKS_RPC.MEGAETH_TESTNET,
187
+ url: controller_utils_1.BUILT_IN_CUSTOM_NETWORKS_RPC[rpcEndpointUrlKey],
179
188
  },
180
189
  ],
181
- },
182
- };
190
+ };
191
+ return { ...obj, [chainId]: networkConfiguration };
192
+ }, {});
183
193
  }
184
194
  /**
185
195
  * Constructs properties for the NetworkController state whose values will be