@metamask-previews/network-controller 22.2.1-preview-e744341c → 22.2.1-preview-86cafc23
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.
|
@@ -109,6 +109,17 @@ const controllerName = 'NetworkController';
|
|
|
109
109
|
* @returns The default value for `networkConfigurationsByChainId`.
|
|
110
110
|
*/
|
|
111
111
|
function getDefaultNetworkConfigurationsByChainId() {
|
|
112
|
+
return {
|
|
113
|
+
...getDefaultInfuraNetworkConfigurationsByChainId(),
|
|
114
|
+
...getDefaultCustomNetworkConfigurationsByChainId(),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Constructs a `networkConfigurationsByChainId` object for all default Infura networks.
|
|
119
|
+
*
|
|
120
|
+
* @returns The `networkConfigurationsByChainId` object of all Infura networks.
|
|
121
|
+
*/
|
|
122
|
+
function getDefaultInfuraNetworkConfigurationsByChainId() {
|
|
112
123
|
return Object.values(controller_utils_1.InfuraNetworkType).reduce((obj, infuraNetworkType) => {
|
|
113
124
|
const chainId = controller_utils_1.ChainId[infuraNetworkType];
|
|
114
125
|
const rpcEndpointUrl =
|
|
@@ -133,6 +144,32 @@ function getDefaultNetworkConfigurationsByChainId() {
|
|
|
133
144
|
return { ...obj, [chainId]: networkConfiguration };
|
|
134
145
|
}, {});
|
|
135
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Constructs a `networkConfigurationsByChainId` object for all default custom networks.
|
|
149
|
+
*
|
|
150
|
+
* @returns The `networkConfigurationsByChainId` object of all custom networks.
|
|
151
|
+
*/
|
|
152
|
+
function getDefaultCustomNetworkConfigurationsByChainId() {
|
|
153
|
+
const { ticker, rpcPrefs } = controller_utils_1.BUILT_IN_NETWORKS[controller_utils_1.BuiltInNetworkName.MegaETHTestnet];
|
|
154
|
+
return {
|
|
155
|
+
[controller_utils_1.ChainId[controller_utils_1.BuiltInNetworkName.MegaETHTestnet]]: {
|
|
156
|
+
blockExplorerUrls: [rpcPrefs.blockExplorerUrl],
|
|
157
|
+
chainId: controller_utils_1.ChainId[controller_utils_1.BuiltInNetworkName.MegaETHTestnet],
|
|
158
|
+
defaultRpcEndpointIndex: 0,
|
|
159
|
+
defaultBlockExplorerUrlIndex: 0,
|
|
160
|
+
name: controller_utils_1.NetworkNickname[controller_utils_1.BuiltInNetworkName.MegaETHTestnet],
|
|
161
|
+
nativeCurrency: ticker,
|
|
162
|
+
rpcEndpoints: [
|
|
163
|
+
{
|
|
164
|
+
failoverUrls: [],
|
|
165
|
+
networkClientId: controller_utils_1.BuiltInNetworkName.MegaETHTestnet,
|
|
166
|
+
type: RpcEndpointType.Custom,
|
|
167
|
+
url: controller_utils_1.BUILT_IN_CUSTOM_NETWORKS_RPC.MEGAETH_TESTNET,
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|
|
136
173
|
/**
|
|
137
174
|
* Constructs properties for the NetworkController state whose values will be
|
|
138
175
|
* used if not provided to the constructor.
|