@metamask-previews/network-controller 22.1.0-preview-5047333 → 22.1.0-preview-3280bd3
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/dist/NetworkController.cjs +5 -1
- 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 +6 -2
- package/dist/NetworkController.mjs.map +1 -1
- package/dist/constants.cjs +7 -1
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +6 -0
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +6 -0
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +6 -0
- package/dist/constants.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1083,7 +1083,7 @@ async function _NetworkController_refreshNetwork(networkClientId, options = {})
|
|
|
1083
1083
|
}
|
|
1084
1084
|
const networkClient = this.getNetworkClientById(networkClientId);
|
|
1085
1085
|
const ethQuery = new eth_query_1.default(networkClient.provider);
|
|
1086
|
-
|
|
1086
|
+
const getBlock = new Promise((resolve, reject) => {
|
|
1087
1087
|
ethQuery.sendAsync({ method: 'eth_getBlockByNumber', params: ['latest', false] }, (error, block) => {
|
|
1088
1088
|
if (error) {
|
|
1089
1089
|
reject(error);
|
|
@@ -1094,6 +1094,10 @@ async function _NetworkController_refreshNetwork(networkClientId, options = {})
|
|
|
1094
1094
|
}
|
|
1095
1095
|
});
|
|
1096
1096
|
});
|
|
1097
|
+
const timeout = new Promise((_resolve, reject) => setTimeout(() => {
|
|
1098
|
+
reject(new Error(`Could not get latest block for network: Timed out calling 'eth_getBlockByNumber' on networkClientId '${networkClientId}'`));
|
|
1099
|
+
}, constants_1.GET_LATEST_BLOCK_TIMEOUT));
|
|
1100
|
+
return Promise.race([getBlock, timeout]);
|
|
1097
1101
|
}, _NetworkController_determineEIP1559Compatibility =
|
|
1098
1102
|
/**
|
|
1099
1103
|
* Retrieves and checks the latest block from the currently selected
|