@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.
@@ -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
- return new Promise((resolve, reject) => {
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