@metamask-previews/network-controller 23.3.0-preview-fa22a478 → 23.3.0-preview-64413dce
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 +4 -0
- package/dist/NetworkController.cjs +31 -17
- package/dist/NetworkController.cjs.map +1 -1
- package/dist/NetworkController.d.cts.map +1 -1
- package/dist/NetworkController.d.mts.map +1 -1
- package/dist/NetworkController.mjs +32 -18
- package/dist/NetworkController.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +2 -2
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +2 -2
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -161,24 +161,38 @@ function getDefaultInfuraNetworkConfigurationsByChainId() {
|
|
|
161
161
|
* @returns The `networkConfigurationsByChainId` object of all custom networks.
|
|
162
162
|
*/
|
|
163
163
|
function getDefaultCustomNetworkConfigurationsByChainId() {
|
|
164
|
-
|
|
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[
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
/**
|