@metamask/snaps-controllers 6.0.1 → 6.0.2

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/dist/{chunk-6XGUJ27X.js → chunk-6HI7J27U.js} +3 -3
  3. package/dist/{chunk-7PZECZV3.mjs → chunk-AELC3WCV.mjs} +2 -2
  4. package/dist/{chunk-PGKMKSAR.mjs → chunk-BAJUEBP6.mjs} +2 -2
  5. package/dist/{chunk-U6T2MPXT.js → chunk-CFTCANAK.js} +3 -3
  6. package/dist/{chunk-6YVCFPP6.mjs → chunk-E7627MMH.mjs} +2 -2
  7. package/dist/{chunk-PXECEHH7.mjs → chunk-E7FBXFXJ.mjs} +2 -2
  8. package/dist/{chunk-KF4PCKG7.mjs → chunk-KEEKVE7E.mjs} +2 -2
  9. package/dist/{chunk-FZY2Z5NP.js → chunk-LAVQZHSH.js} +3 -3
  10. package/dist/{chunk-KBVG3CL2.js → chunk-MXCU2GFU.js} +3 -3
  11. package/dist/{chunk-5R4ENIDN.mjs → chunk-PGQDHVHI.mjs} +22 -25
  12. package/dist/chunk-PGQDHVHI.mjs.map +1 -0
  13. package/dist/{chunk-ZRS2VVUV.mjs → chunk-SXF7KAMU.mjs} +2 -2
  14. package/dist/{chunk-43ODL57R.js → chunk-TXR2WWIP.js} +3 -3
  15. package/dist/{chunk-ZAMIT33L.js → chunk-V7FYGVMW.js} +22 -25
  16. package/dist/chunk-V7FYGVMW.js.map +1 -0
  17. package/dist/{chunk-JDHKH5YU.js → chunk-VJZI4VSJ.js} +19 -8
  18. package/dist/chunk-VJZI4VSJ.js.map +1 -0
  19. package/dist/{chunk-4LGL4A3M.js → chunk-VOAJRWUB.js} +3 -3
  20. package/dist/{chunk-J4PGHMLL.js → chunk-WFADRL7I.js} +3 -3
  21. package/dist/{chunk-6NYC5VNK.mjs → chunk-XBGQ5PKQ.mjs} +19 -8
  22. package/dist/chunk-XBGQ5PKQ.mjs.map +1 -0
  23. package/dist/{chunk-IMBPDTVN.mjs → chunk-YDVUJQ2S.mjs} +2 -2
  24. package/dist/cronjob/CronjobController.js +6 -6
  25. package/dist/cronjob/CronjobController.mjs +6 -6
  26. package/dist/cronjob/index.js +6 -6
  27. package/dist/cronjob/index.mjs +6 -6
  28. package/dist/index.js +7 -7
  29. package/dist/index.mjs +6 -6
  30. package/dist/node.js +9 -9
  31. package/dist/node.mjs +8 -8
  32. package/dist/react-native.js +8 -8
  33. package/dist/react-native.mjs +7 -7
  34. package/dist/services/AbstractExecutionService.js +2 -2
  35. package/dist/services/AbstractExecutionService.mjs +1 -1
  36. package/dist/services/browser.js +7 -7
  37. package/dist/services/browser.mjs +6 -6
  38. package/dist/services/iframe/IframeExecutionService.js +3 -3
  39. package/dist/services/iframe/IframeExecutionService.mjs +2 -2
  40. package/dist/services/iframe/index.js +3 -3
  41. package/dist/services/iframe/index.mjs +2 -2
  42. package/dist/services/index.js +6 -6
  43. package/dist/services/index.mjs +5 -5
  44. package/dist/services/node-js/NodeProcessExecutionService.js +7 -7
  45. package/dist/services/node-js/NodeProcessExecutionService.mjs +6 -6
  46. package/dist/services/node-js/NodeThreadExecutionService.js +7 -7
  47. package/dist/services/node-js/NodeThreadExecutionService.mjs +6 -6
  48. package/dist/services/node-js/index.js +8 -8
  49. package/dist/services/node-js/index.mjs +7 -7
  50. package/dist/services/node.js +8 -8
  51. package/dist/services/node.mjs +7 -7
  52. package/dist/services/offscreen/OffscreenExecutionService.js +4 -4
  53. package/dist/services/offscreen/OffscreenExecutionService.mjs +3 -3
  54. package/dist/services/offscreen/index.js +4 -4
  55. package/dist/services/offscreen/index.mjs +3 -3
  56. package/dist/services/proxy/ProxyExecutionService.js +3 -3
  57. package/dist/services/proxy/ProxyExecutionService.mjs +2 -2
  58. package/dist/services/react-native.js +7 -7
  59. package/dist/services/react-native.mjs +6 -6
  60. package/dist/services/webview/WebViewExecutionService.js +4 -4
  61. package/dist/services/webview/WebViewExecutionService.mjs +3 -3
  62. package/dist/services/webview/index.js +4 -4
  63. package/dist/services/webview/index.mjs +3 -3
  64. package/dist/services/webworker/WebWorkerExecutionService.js +3 -3
  65. package/dist/services/webworker/WebWorkerExecutionService.mjs +2 -2
  66. package/dist/services/webworker/index.js +3 -3
  67. package/dist/services/webworker/index.mjs +2 -2
  68. package/dist/snaps/SnapController.js +2 -2
  69. package/dist/snaps/SnapController.mjs +1 -1
  70. package/dist/snaps/index.js +2 -2
  71. package/dist/snaps/index.mjs +1 -1
  72. package/dist/tsconfig.build.tsbuildinfo +1 -1
  73. package/dist/types/services/AbstractExecutionService.d.ts +2 -1
  74. package/dist/types/snaps/SnapController.d.ts +6 -1
  75. package/package.json +6 -6
  76. package/dist/chunk-5R4ENIDN.mjs.map +0 -1
  77. package/dist/chunk-6NYC5VNK.mjs.map +0 -1
  78. package/dist/chunk-JDHKH5YU.js.map +0 -1
  79. package/dist/chunk-ZAMIT33L.js.map +0 -1
  80. /package/dist/{chunk-6XGUJ27X.js.map → chunk-6HI7J27U.js.map} +0 -0
  81. /package/dist/{chunk-7PZECZV3.mjs.map → chunk-AELC3WCV.mjs.map} +0 -0
  82. /package/dist/{chunk-PGKMKSAR.mjs.map → chunk-BAJUEBP6.mjs.map} +0 -0
  83. /package/dist/{chunk-U6T2MPXT.js.map → chunk-CFTCANAK.js.map} +0 -0
  84. /package/dist/{chunk-6YVCFPP6.mjs.map → chunk-E7627MMH.mjs.map} +0 -0
  85. /package/dist/{chunk-PXECEHH7.mjs.map → chunk-E7FBXFXJ.mjs.map} +0 -0
  86. /package/dist/{chunk-KF4PCKG7.mjs.map → chunk-KEEKVE7E.mjs.map} +0 -0
  87. /package/dist/{chunk-FZY2Z5NP.js.map → chunk-LAVQZHSH.js.map} +0 -0
  88. /package/dist/{chunk-KBVG3CL2.js.map → chunk-MXCU2GFU.js.map} +0 -0
  89. /package/dist/{chunk-ZRS2VVUV.mjs.map → chunk-SXF7KAMU.mjs.map} +0 -0
  90. /package/dist/{chunk-43ODL57R.js.map → chunk-TXR2WWIP.js.map} +0 -0
  91. /package/dist/{chunk-4LGL4A3M.js.map → chunk-VOAJRWUB.js.map} +0 -0
  92. /package/dist/{chunk-J4PGHMLL.js.map → chunk-WFADRL7I.js.map} +0 -0
  93. /package/dist/{chunk-IMBPDTVN.mjs.map → chunk-YDVUJQ2S.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [6.0.2]
10
+ ### Changed
11
+ - Improve timeout handling when the execution environment fails to load ([#2242](https://github.com/MetaMask/snaps/pull/2242))
12
+
9
13
  ## [6.0.1]
10
14
  ### Fixed
11
15
  - Fix minor build configuration problems ([#2220](https://github.com/MetaMask/snaps/pull/2220))
@@ -207,7 +211,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
207
211
  - The version of the package no longer needs to match the version of all other
208
212
  MetaMask Snaps packages.
209
213
 
210
- [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@6.0.1...HEAD
214
+ [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@6.0.2...HEAD
215
+ [6.0.2]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@6.0.1...@metamask/snaps-controllers@6.0.2
211
216
  [6.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@6.0.0...@metamask/snaps-controllers@6.0.1
212
217
  [6.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@5.0.1...@metamask/snaps-controllers@6.0.0
213
218
  [5.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@5.0.0...@metamask/snaps-controllers@5.0.1
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkU6T2MPXTjs = require('./chunk-U6T2MPXT.js');
3
+ var _chunkCFTCANAKjs = require('./chunk-CFTCANAK.js');
4
4
 
5
5
 
6
6
 
@@ -9,7 +9,7 @@ var _chunkEXN2TFDJjs = require('./chunk-EXN2TFDJ.js');
9
9
  // src/services/offscreen/OffscreenExecutionService.ts
10
10
  var _postmessagestream = require('@metamask/post-message-stream');
11
11
  var _createDocument, createDocument_fn;
12
- var OffscreenExecutionService = class extends _chunkU6T2MPXTjs.ProxyExecutionService {
12
+ var OffscreenExecutionService = class extends _chunkCFTCANAKjs.ProxyExecutionService {
13
13
  /**
14
14
  * Create a new offscreen execution service.
15
15
  *
@@ -69,4 +69,4 @@ createDocument_fn = async function() {
69
69
 
70
70
 
71
71
  exports.OffscreenExecutionService = OffscreenExecutionService;
72
- //# sourceMappingURL=chunk-6XGUJ27X.js.map
72
+ //# sourceMappingURL=chunk-6HI7J27U.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AbstractExecutionService
3
- } from "./chunk-6NYC5VNK.mjs";
3
+ } from "./chunk-XBGQ5PKQ.mjs";
4
4
 
5
5
  // src/services/iframe/IframeExecutionService.ts
6
6
  import { WindowPostMessageStream } from "@metamask/post-message-stream";
@@ -35,4 +35,4 @@ var IframeExecutionService = class extends AbstractExecutionService {
35
35
  export {
36
36
  IframeExecutionService
37
37
  };
38
- //# sourceMappingURL=chunk-7PZECZV3.mjs.map
38
+ //# sourceMappingURL=chunk-AELC3WCV.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AbstractExecutionService
3
- } from "./chunk-6NYC5VNK.mjs";
3
+ } from "./chunk-XBGQ5PKQ.mjs";
4
4
  import {
5
5
  ProxyPostMessageStream
6
6
  } from "./chunk-ZVOYOZFT.mjs";
@@ -102,4 +102,4 @@ export {
102
102
  WORKER_POOL_ID,
103
103
  WebWorkerExecutionService
104
104
  };
105
- //# sourceMappingURL=chunk-PGKMKSAR.mjs.map
105
+ //# sourceMappingURL=chunk-BAJUEBP6.mjs.map
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJDHKH5YUjs = require('./chunk-JDHKH5YU.js');
3
+ var _chunkVJZI4VSJjs = require('./chunk-VJZI4VSJ.js');
4
4
 
5
5
 
6
6
  var _chunk7Y6P5FRNjs = require('./chunk-7Y6P5FRN.js');
@@ -13,7 +13,7 @@ var _chunkEXN2TFDJjs = require('./chunk-EXN2TFDJ.js');
13
13
  // src/services/proxy/ProxyExecutionService.ts
14
14
  var _nanoid = require('nanoid');
15
15
  var _stream;
16
- var ProxyExecutionService = class extends _chunkJDHKH5YUjs.AbstractExecutionService {
16
+ var ProxyExecutionService = class extends _chunkVJZI4VSJjs.AbstractExecutionService {
17
17
  /**
18
18
  * Create a new proxy execution service.
19
19
  *
@@ -71,4 +71,4 @@ _stream = new WeakMap();
71
71
 
72
72
 
73
73
  exports.ProxyExecutionService = ProxyExecutionService;
74
- //# sourceMappingURL=chunk-U6T2MPXT.js.map
74
+ //# sourceMappingURL=chunk-CFTCANAK.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-IGC4E7PI.mjs";
4
4
  import {
5
5
  ProxyExecutionService
6
- } from "./chunk-KF4PCKG7.mjs";
6
+ } from "./chunk-KEEKVE7E.mjs";
7
7
  import {
8
8
  __privateAdd,
9
9
  __privateGet,
@@ -55,4 +55,4 @@ ensureWebViewLoaded_fn = async function() {
55
55
  export {
56
56
  WebViewExecutionService
57
57
  };
58
- //# sourceMappingURL=chunk-6YVCFPP6.mjs.map
58
+ //# sourceMappingURL=chunk-E7627MMH.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AbstractExecutionService
3
- } from "./chunk-6NYC5VNK.mjs";
3
+ } from "./chunk-XBGQ5PKQ.mjs";
4
4
  import {
5
5
  __require
6
6
  } from "./chunk-YRZVIDCF.mjs";
@@ -36,4 +36,4 @@ var NodeThreadExecutionService = class extends AbstractExecutionService {
36
36
  export {
37
37
  NodeThreadExecutionService
38
38
  };
39
- //# sourceMappingURL=chunk-PXECEHH7.mjs.map
39
+ //# sourceMappingURL=chunk-E7FBXFXJ.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AbstractExecutionService
3
- } from "./chunk-6NYC5VNK.mjs";
3
+ } from "./chunk-XBGQ5PKQ.mjs";
4
4
  import {
5
5
  ProxyPostMessageStream
6
6
  } from "./chunk-ZVOYOZFT.mjs";
@@ -71,4 +71,4 @@ _stream = new WeakMap();
71
71
  export {
72
72
  ProxyExecutionService
73
73
  };
74
- //# sourceMappingURL=chunk-KF4PCKG7.mjs.map
74
+ //# sourceMappingURL=chunk-KEEKVE7E.mjs.map
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJDHKH5YUjs = require('./chunk-JDHKH5YU.js');
3
+ var _chunkVJZI4VSJjs = require('./chunk-VJZI4VSJ.js');
4
4
 
5
5
  // src/services/iframe/IframeExecutionService.ts
6
6
  var _postmessagestream = require('@metamask/post-message-stream');
7
7
  var _snapsutils = require('@metamask/snaps-utils');
8
- var IframeExecutionService = class extends _chunkJDHKH5YUjs.AbstractExecutionService {
8
+ var IframeExecutionService = class extends _chunkVJZI4VSJjs.AbstractExecutionService {
9
9
  constructor({
10
10
  iframeUrl,
11
11
  messenger,
@@ -35,4 +35,4 @@ var IframeExecutionService = class extends _chunkJDHKH5YUjs.AbstractExecutionSer
35
35
 
36
36
 
37
37
  exports.IframeExecutionService = IframeExecutionService;
38
- //# sourceMappingURL=chunk-FZY2Z5NP.js.map
38
+ //# sourceMappingURL=chunk-LAVQZHSH.js.map
@@ -3,7 +3,7 @@
3
3
  var _chunkC4D6GBMYjs = require('./chunk-C4D6GBMY.js');
4
4
 
5
5
 
6
- var _chunkU6T2MPXTjs = require('./chunk-U6T2MPXT.js');
6
+ var _chunkCFTCANAKjs = require('./chunk-CFTCANAK.js');
7
7
 
8
8
 
9
9
 
@@ -13,7 +13,7 @@ var _chunkEXN2TFDJjs = require('./chunk-EXN2TFDJ.js');
13
13
 
14
14
  // src/services/webview/WebViewExecutionService.ts
15
15
  var _getWebView, _ensureWebViewLoaded, ensureWebViewLoaded_fn;
16
- var WebViewExecutionService = class extends _chunkU6T2MPXTjs.ProxyExecutionService {
16
+ var WebViewExecutionService = class extends _chunkCFTCANAKjs.ProxyExecutionService {
17
17
  constructor({
18
18
  messenger,
19
19
  setupSnapProvider,
@@ -55,4 +55,4 @@ ensureWebViewLoaded_fn = async function() {
55
55
 
56
56
 
57
57
  exports.WebViewExecutionService = WebViewExecutionService;
58
- //# sourceMappingURL=chunk-KBVG3CL2.js.map
58
+ //# sourceMappingURL=chunk-MXCU2GFU.js.map
@@ -113,7 +113,7 @@ function truncateSnap(snap) {
113
113
  return truncatedSnap;
114
114
  }
115
115
  var name = "SnapController";
116
- var _closeAllConnections, _dynamicPermissions, _environmentEndowmentPermissions, _excludedPermissions, _featureFlags, _fetchFunction, _idleTimeCheckInterval, _maxIdleTime, _detectSnapLocation, _snapsRuntimeData, _rollbackSnapshots, _timeoutForLastRequestStatus, _statusMachine, _initializeStateMachine, initializeStateMachine_fn, _registerMessageHandlers, registerMessageHandlers_fn, _handlePreinstalledSnaps, handlePreinstalledSnaps_fn, _pollForLastRequestStatus, pollForLastRequestStatus_fn, _blockSnap, blockSnap_fn, _unblockSnap, unblockSnap_fn, _assertIsInstallAllowed, assertIsInstallAllowed_fn, _stopSnapsLastRequestPastMax, stopSnapsLastRequestPastMax_fn, _transition, transition_fn, _terminateSnap, terminateSnap_fn, _handleInitialConnections, handleInitialConnections_fn, _addSnapToSubject, addSnapToSubject_fn, _removeSnapFromSubjects, removeSnapFromSubjects_fn, _revokeAllSnapPermissions, revokeAllSnapPermissions_fn, _createApproval, createApproval_fn, _updateApproval, updateApproval_fn, _resolveAllowlistVersion, resolveAllowlistVersion_fn, _add, add_fn, _startSnap, startSnap_fn, _getEndowments, getEndowments_fn, _set, set_fn, _validateSnapPermissions, validateSnapPermissions_fn, _getExecutionTimeout, getExecutionTimeout_fn, _getRpcRequestHandler, getRpcRequestHandler_fn, _createInterface, createInterface_fn, _assertInterfaceExists, assertInterfaceExists_fn, _transformSnapRpcRequestResult, transformSnapRpcRequestResult_fn, _assertSnapRpcRequestResult, assertSnapRpcRequestResult_fn, _executeWithTimeout, executeWithTimeout_fn, _recordSnapRpcRequestStart, recordSnapRpcRequestStart_fn, _recordSnapRpcRequestFinish, recordSnapRpcRequestFinish_fn, _getRollbackSnapshot, getRollbackSnapshot_fn, _createRollbackSnapshot, createRollbackSnapshot_fn, _rollbackSnap, rollbackSnap_fn, _rollbackSnaps, rollbackSnaps_fn, _getRuntime, getRuntime_fn, _getRuntimeExpect, getRuntimeExpect_fn, _setupRuntime, setupRuntime_fn, _calculatePermissionsChange, calculatePermissionsChange_fn, _updatePermissions, updatePermissions_fn, _isValidUpdate, isValidUpdate_fn, _callLifecycleHook, callLifecycleHook_fn;
116
+ var _closeAllConnections, _dynamicPermissions, _environmentEndowmentPermissions, _excludedPermissions, _featureFlags, _fetchFunction, _idleTimeCheckInterval, _maxIdleTime, _maxInitTime, _detectSnapLocation, _snapsRuntimeData, _rollbackSnapshots, _timeoutForLastRequestStatus, _statusMachine, _initializeStateMachine, initializeStateMachine_fn, _registerMessageHandlers, registerMessageHandlers_fn, _handlePreinstalledSnaps, handlePreinstalledSnaps_fn, _pollForLastRequestStatus, pollForLastRequestStatus_fn, _blockSnap, blockSnap_fn, _unblockSnap, unblockSnap_fn, _assertIsInstallAllowed, assertIsInstallAllowed_fn, _stopSnapsLastRequestPastMax, stopSnapsLastRequestPastMax_fn, _transition, transition_fn, _terminateSnap, terminateSnap_fn, _handleInitialConnections, handleInitialConnections_fn, _addSnapToSubject, addSnapToSubject_fn, _removeSnapFromSubjects, removeSnapFromSubjects_fn, _revokeAllSnapPermissions, revokeAllSnapPermissions_fn, _createApproval, createApproval_fn, _updateApproval, updateApproval_fn, _resolveAllowlistVersion, resolveAllowlistVersion_fn, _add, add_fn, _startSnap, startSnap_fn, _getEndowments, getEndowments_fn, _set, set_fn, _validateSnapPermissions, validateSnapPermissions_fn, _getExecutionTimeout, getExecutionTimeout_fn, _getRpcRequestHandler, getRpcRequestHandler_fn, _createInterface, createInterface_fn, _assertInterfaceExists, assertInterfaceExists_fn, _transformSnapRpcRequestResult, transformSnapRpcRequestResult_fn, _assertSnapRpcRequestResult, assertSnapRpcRequestResult_fn, _recordSnapRpcRequestStart, recordSnapRpcRequestStart_fn, _recordSnapRpcRequestFinish, recordSnapRpcRequestFinish_fn, _getRollbackSnapshot, getRollbackSnapshot_fn, _createRollbackSnapshot, createRollbackSnapshot_fn, _rollbackSnap, rollbackSnap_fn, _rollbackSnaps, rollbackSnaps_fn, _getRuntime, getRuntime_fn, _getRuntimeExpect, getRuntimeExpect_fn, _setupRuntime, setupRuntime_fn, _calculatePermissionsChange, calculatePermissionsChange_fn, _updatePermissions, updatePermissions_fn, _isValidUpdate, isValidUpdate_fn, _callLifecycleHook, callLifecycleHook_fn;
117
117
  var SnapController = class extends BaseController {
118
118
  constructor({
119
119
  closeAllConnections,
@@ -125,6 +125,7 @@ var SnapController = class extends BaseController {
125
125
  idleTimeCheckInterval = inMilliseconds(5, Duration.Second),
126
126
  maxIdleTime = inMilliseconds(30, Duration.Second),
127
127
  maxRequestTime = inMilliseconds(60, Duration.Second),
128
+ maxInitTime = inMilliseconds(60, Duration.Second),
128
129
  fetchFunction = globalThis.fetch.bind(globalThis),
129
130
  featureFlags = {},
130
131
  detectSnapLocation: detectSnapLocationFunction = detectSnapLocation,
@@ -316,16 +317,6 @@ var SnapController = class extends BaseController {
316
317
  * @param result - The result of the RPC request.
317
318
  */
318
319
  __privateAdd(this, _assertSnapRpcRequestResult);
319
- /**
320
- * Awaits the specified promise and rejects if the promise doesn't resolve
321
- * before the timeout.
322
- *
323
- * @param promise - The promise to await.
324
- * @param timer - An optional timer object to control the timeout.
325
- * @returns The result of the promise or rejects if the promise times out.
326
- * @template PromiseValue - The value of the Promise.
327
- */
328
- __privateAdd(this, _executeWithTimeout);
329
320
  __privateAdd(this, _recordSnapRpcRequestStart);
330
321
  __privateAdd(this, _recordSnapRpcRequestFinish);
331
322
  /**
@@ -414,6 +405,7 @@ var SnapController = class extends BaseController {
414
405
  __privateAdd(this, _fetchFunction, void 0);
415
406
  __privateAdd(this, _idleTimeCheckInterval, void 0);
416
407
  __privateAdd(this, _maxIdleTime, void 0);
408
+ __privateAdd(this, _maxInitTime, void 0);
417
409
  __privateAdd(this, _detectSnapLocation, void 0);
418
410
  __privateAdd(this, _snapsRuntimeData, void 0);
419
411
  __privateAdd(this, _rollbackSnapshots, void 0);
@@ -428,6 +420,7 @@ var SnapController = class extends BaseController {
428
420
  __privateSet(this, _idleTimeCheckInterval, idleTimeCheckInterval);
429
421
  __privateSet(this, _maxIdleTime, maxIdleTime);
430
422
  this.maxRequestTime = maxRequestTime;
423
+ __privateSet(this, _maxInitTime, maxInitTime);
431
424
  __privateSet(this, _detectSnapLocation, detectSnapLocationFunction);
432
425
  this._onUnhandledSnapError = this._onUnhandledSnapError.bind(this);
433
426
  this._onOutboundRequest = this._onOutboundRequest.bind(this);
@@ -1364,6 +1357,7 @@ _featureFlags = new WeakMap();
1364
1357
  _fetchFunction = new WeakMap();
1365
1358
  _idleTimeCheckInterval = new WeakMap();
1366
1359
  _maxIdleTime = new WeakMap();
1360
+ _maxInitTime = new WeakMap();
1367
1361
  _detectSnapLocation = new WeakMap();
1368
1362
  _snapsRuntimeData = new WeakMap();
1369
1363
  _rollbackSnapshots = new WeakMap();
@@ -1813,10 +1807,16 @@ startSnap_fn = async function(snapData) {
1813
1807
  }
1814
1808
  try {
1815
1809
  const runtime = __privateMethod(this, _getRuntimeExpect, getRuntimeExpect_fn).call(this, snapId);
1816
- const result = await __privateMethod(this, _executeWithTimeout, executeWithTimeout_fn).call(this, this.messagingSystem.call("ExecutionService:executeSnap", {
1817
- ...snapData,
1818
- endowments: await __privateMethod(this, _getEndowments, getEndowments_fn).call(this, snapId)
1819
- }));
1810
+ const result = await withTimeout(
1811
+ this.messagingSystem.call("ExecutionService:executeSnap", {
1812
+ ...snapData,
1813
+ endowments: await __privateMethod(this, _getEndowments, getEndowments_fn).call(this, snapId)
1814
+ }),
1815
+ __privateGet(this, _maxInitTime)
1816
+ );
1817
+ if (result === hasTimedOut) {
1818
+ throw new Error(`${snapId} failed to start.`);
1819
+ }
1820
1820
  __privateMethod(this, _transition, transition_fn).call(this, snapId, SnapStatusEvents.Start);
1821
1821
  runtime.lastRequest = Date.now();
1822
1822
  return result;
@@ -2028,7 +2028,12 @@ getRpcRequestHandler_fn = function(snapId) {
2028
2028
  { origin, handler: handlerType, request }
2029
2029
  );
2030
2030
  try {
2031
- const result = await __privateMethod(this, _executeWithTimeout, executeWithTimeout_fn).call(this, handleRpcRequestPromise, timer);
2031
+ const result = await withTimeout(handleRpcRequestPromise, timer);
2032
+ if (result === hasTimedOut) {
2033
+ throw new Error(
2034
+ `${snapId} failed to respond to the request in time.`
2035
+ );
2036
+ }
2032
2037
  await __privateMethod(this, _assertSnapRpcRequestResult, assertSnapRpcRequestResult_fn).call(this, snapId, handlerType, result);
2033
2038
  return __privateMethod(this, _transformSnapRpcRequestResult, transformSnapRpcRequestResult_fn).call(this, snapId, handlerType, result);
2034
2039
  } catch (error) {
@@ -2111,14 +2116,6 @@ assertSnapRpcRequestResult_fn = async function(snapId, handlerType, result) {
2111
2116
  break;
2112
2117
  }
2113
2118
  };
2114
- _executeWithTimeout = new WeakSet();
2115
- executeWithTimeout_fn = async function(promise, timer) {
2116
- const result = await withTimeout(promise, timer ?? this.maxRequestTime);
2117
- if (result === hasTimedOut) {
2118
- throw new Error("The request timed out.");
2119
- }
2120
- return result;
2121
- };
2122
2119
  _recordSnapRpcRequestStart = new WeakSet();
2123
2120
  recordSnapRpcRequestStart_fn = function(snapId, requestId, timer) {
2124
2121
  const runtime = __privateMethod(this, _getRuntimeExpect, getRuntimeExpect_fn).call(this, snapId);
@@ -2304,4 +2301,4 @@ export {
2304
2301
  SNAP_APPROVAL_RESULT,
2305
2302
  SnapController
2306
2303
  };
2307
- //# sourceMappingURL=chunk-5R4ENIDN.mjs.map
2304
+ //# sourceMappingURL=chunk-PGQDHVHI.mjs.map