@metamask/snaps-execution-environments 4.0.1 → 5.0.1

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 (438) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/browserify/iframe/bundle.js +4 -4
  3. package/dist/browserify/node-process/bundle.js +3 -3
  4. package/dist/browserify/node-thread/bundle.js +3 -3
  5. package/dist/browserify/webview/bundle.js +4 -4
  6. package/dist/browserify/worker-executor/bundle.js +4 -4
  7. package/dist/browserify/worker-pool/bundle.js +4 -4
  8. package/dist/chunk-2VA6RAEE.js +30 -0
  9. package/dist/chunk-2VA6RAEE.js.map +1 -0
  10. package/dist/chunk-3JCT4MWT.js +108 -0
  11. package/dist/chunk-3JCT4MWT.js.map +1 -0
  12. package/dist/chunk-3Y4ZRKNE.js +33 -0
  13. package/dist/chunk-3Y4ZRKNE.js.map +1 -0
  14. package/dist/chunk-44XYIN4N.js +86 -0
  15. package/dist/chunk-44XYIN4N.js.map +1 -0
  16. package/dist/chunk-4CGJF3BT.mjs +262 -0
  17. package/dist/chunk-4CGJF3BT.mjs.map +1 -0
  18. package/dist/chunk-4XRZLEKU.js +49 -0
  19. package/dist/chunk-4XRZLEKU.js.map +1 -0
  20. package/dist/chunk-53ZULHPK.mjs +16 -0
  21. package/dist/chunk-53ZULHPK.mjs.map +1 -0
  22. package/dist/chunk-5DEV3QQU.mjs +12 -0
  23. package/dist/chunk-5DEV3QQU.mjs.map +1 -0
  24. package/dist/chunk-5FG5IBYT.mjs +33 -0
  25. package/dist/chunk-5FG5IBYT.mjs.map +1 -0
  26. package/dist/chunk-5STN3QCA.js +183 -0
  27. package/dist/chunk-5STN3QCA.js.map +1 -0
  28. package/dist/chunk-7AJWXSDQ.mjs +73 -0
  29. package/dist/chunk-7AJWXSDQ.mjs.map +1 -0
  30. package/dist/chunk-ACK2JBSO.mjs +49 -0
  31. package/dist/chunk-ACK2JBSO.mjs.map +1 -0
  32. package/dist/chunk-B3JZNNZD.js +48 -0
  33. package/dist/chunk-B3JZNNZD.js.map +1 -0
  34. package/dist/chunk-BCBKEUCG.mjs +38 -0
  35. package/dist/chunk-BCBKEUCG.mjs.map +1 -0
  36. package/dist/chunk-BTEAZZKP.mjs +24 -0
  37. package/dist/chunk-BTEAZZKP.mjs.map +1 -0
  38. package/dist/chunk-CV5LC4PP.js +24 -0
  39. package/dist/chunk-CV5LC4PP.js.map +1 -0
  40. package/dist/chunk-CWCVTRNZ.mjs +48 -0
  41. package/dist/chunk-CWCVTRNZ.mjs.map +1 -0
  42. package/dist/chunk-CWIFVPLR.js +262 -0
  43. package/dist/chunk-CWIFVPLR.js.map +1 -0
  44. package/dist/chunk-DFPM46ZF.js +147 -0
  45. package/dist/chunk-DFPM46ZF.js.map +1 -0
  46. package/dist/chunk-DLLLH5HN.js +26 -0
  47. package/dist/chunk-DLLLH5HN.js.map +1 -0
  48. package/dist/chunk-DTF6YTIS.js +484 -0
  49. package/dist/chunk-DTF6YTIS.js.map +1 -0
  50. package/dist/chunk-ERB7OLAB.mjs +86 -0
  51. package/dist/chunk-ERB7OLAB.mjs.map +1 -0
  52. package/dist/chunk-EXN2TFDJ.js +38 -0
  53. package/dist/chunk-EXN2TFDJ.js.map +1 -0
  54. package/dist/chunk-F37LPBJS.js +33 -0
  55. package/dist/chunk-F37LPBJS.js.map +1 -0
  56. package/dist/chunk-FOEAIF5U.js +16 -0
  57. package/dist/chunk-FOEAIF5U.js.map +1 -0
  58. package/dist/chunk-HGLRZZ56.js +32 -0
  59. package/dist/chunk-HGLRZZ56.js.map +1 -0
  60. package/dist/chunk-HKHW6TTX.js +49 -0
  61. package/dist/chunk-HKHW6TTX.js.map +1 -0
  62. package/dist/chunk-HWS4QSOC.mjs +16 -0
  63. package/dist/chunk-HWS4QSOC.mjs.map +1 -0
  64. package/dist/chunk-I5G4YFHM.js +73 -0
  65. package/dist/chunk-I5G4YFHM.js.map +1 -0
  66. package/dist/chunk-IX5S3V47.mjs +26 -0
  67. package/dist/chunk-IX5S3V47.mjs.map +1 -0
  68. package/dist/chunk-JW3JHJ7S.js +45 -0
  69. package/dist/chunk-JW3JHJ7S.js.map +1 -0
  70. package/dist/chunk-LO5ORVRC.js +16 -0
  71. package/dist/chunk-LO5ORVRC.js.map +1 -0
  72. package/dist/chunk-MCXWFCGV.js +1 -0
  73. package/dist/chunk-MCXWFCGV.js.map +1 -0
  74. package/dist/chunk-MIWGLICQ.mjs +108 -0
  75. package/dist/chunk-MIWGLICQ.mjs.map +1 -0
  76. package/dist/chunk-MM6ZSW4E.mjs +81 -0
  77. package/dist/chunk-MM6ZSW4E.mjs.map +1 -0
  78. package/dist/chunk-MOXNHXPG.js +67 -0
  79. package/dist/chunk-MOXNHXPG.js.map +1 -0
  80. package/dist/chunk-MS2LQQYH.js +38 -0
  81. package/dist/chunk-MS2LQQYH.js.map +1 -0
  82. package/dist/chunk-MXNMMTJW.mjs +51 -0
  83. package/dist/chunk-MXNMMTJW.mjs.map +1 -0
  84. package/dist/chunk-OBT45IWW.js +92 -0
  85. package/dist/chunk-OBT45IWW.js.map +1 -0
  86. package/dist/chunk-OCNPLHS2.js +51 -0
  87. package/dist/chunk-OCNPLHS2.js.map +1 -0
  88. package/dist/chunk-OLASO3O4.js +81 -0
  89. package/dist/chunk-OLASO3O4.js.map +1 -0
  90. package/dist/chunk-PTCQ2I47.mjs +147 -0
  91. package/dist/chunk-PTCQ2I47.mjs.map +1 -0
  92. package/dist/chunk-Q42NNJFY.mjs +32 -0
  93. package/dist/chunk-Q42NNJFY.mjs.map +1 -0
  94. package/dist/chunk-QJB4J7WL.mjs +67 -0
  95. package/dist/chunk-QJB4J7WL.mjs.map +1 -0
  96. package/dist/chunk-QVIHE3WB.mjs +484 -0
  97. package/dist/chunk-QVIHE3WB.mjs.map +1 -0
  98. package/dist/chunk-QZC2X6NG.js +44 -0
  99. package/dist/chunk-QZC2X6NG.js.map +1 -0
  100. package/dist/chunk-RZNKZRAD.js +40 -0
  101. package/dist/chunk-RZNKZRAD.js.map +1 -0
  102. package/dist/chunk-S7257EN3.mjs +49 -0
  103. package/dist/chunk-S7257EN3.mjs.map +1 -0
  104. package/dist/chunk-TSEAPB7L.mjs +1 -0
  105. package/dist/chunk-TSEAPB7L.mjs.map +1 -0
  106. package/dist/chunk-UOPIRTJX.mjs +44 -0
  107. package/dist/chunk-UOPIRTJX.mjs.map +1 -0
  108. package/dist/chunk-USHNZDGV.mjs +33 -0
  109. package/dist/chunk-USHNZDGV.mjs.map +1 -0
  110. package/dist/chunk-V76DI2XM.mjs +183 -0
  111. package/dist/chunk-V76DI2XM.mjs.map +1 -0
  112. package/dist/chunk-VKFZ4EB5.mjs +40 -0
  113. package/dist/chunk-VKFZ4EB5.mjs.map +1 -0
  114. package/dist/chunk-W7EDURT5.mjs +92 -0
  115. package/dist/chunk-W7EDURT5.mjs.map +1 -0
  116. package/dist/chunk-WV3CXIKN.mjs +147 -0
  117. package/dist/chunk-WV3CXIKN.mjs.map +1 -0
  118. package/dist/chunk-Y7MVNOPY.mjs +45 -0
  119. package/dist/chunk-Y7MVNOPY.mjs.map +1 -0
  120. package/dist/chunk-YRZVIDCF.mjs +38 -0
  121. package/dist/chunk-YRZVIDCF.mjs.map +1 -0
  122. package/dist/chunk-Z4WSS7YZ.js +147 -0
  123. package/dist/chunk-Z4WSS7YZ.js.map +1 -0
  124. package/dist/chunk-Z7BOREC4.js +12 -0
  125. package/dist/chunk-Z7BOREC4.js.map +1 -0
  126. package/dist/chunk-ZNTCZK7J.mjs +30 -0
  127. package/dist/chunk-ZNTCZK7J.mjs.map +1 -0
  128. package/dist/common/BaseSnapExecutor.js +26 -0
  129. package/dist/common/BaseSnapExecutor.js.map +1 -0
  130. package/dist/common/BaseSnapExecutor.mjs +26 -0
  131. package/dist/common/BaseSnapExecutor.mjs.map +1 -0
  132. package/dist/common/commands.js +11 -0
  133. package/dist/common/commands.js.map +1 -0
  134. package/dist/common/commands.mjs +11 -0
  135. package/dist/common/commands.mjs.map +1 -0
  136. package/dist/common/endowments/commonEndowmentFactory.js +20 -0
  137. package/dist/common/endowments/commonEndowmentFactory.js.map +1 -0
  138. package/dist/common/endowments/commonEndowmentFactory.mjs +20 -0
  139. package/dist/common/endowments/commonEndowmentFactory.mjs.map +1 -0
  140. package/dist/common/endowments/console.js +13 -0
  141. package/dist/common/endowments/console.js.map +1 -0
  142. package/dist/common/endowments/console.mjs +13 -0
  143. package/dist/common/endowments/console.mjs.map +1 -0
  144. package/dist/common/endowments/crypto.js +11 -0
  145. package/dist/common/endowments/crypto.js.map +1 -0
  146. package/dist/common/endowments/crypto.mjs +11 -0
  147. package/dist/common/endowments/crypto.mjs.map +1 -0
  148. package/dist/common/endowments/date.js +9 -0
  149. package/dist/common/endowments/date.js.map +1 -0
  150. package/dist/common/endowments/date.mjs +9 -0
  151. package/dist/common/endowments/date.mjs.map +1 -0
  152. package/dist/common/endowments/index.js +21 -0
  153. package/dist/common/endowments/index.js.map +1 -0
  154. package/dist/common/endowments/index.mjs +21 -0
  155. package/dist/common/endowments/index.mjs.map +1 -0
  156. package/dist/common/endowments/interval.js +8 -0
  157. package/dist/common/endowments/interval.js.map +1 -0
  158. package/dist/common/endowments/interval.mjs +8 -0
  159. package/dist/common/endowments/interval.mjs.map +1 -0
  160. package/dist/common/endowments/math.js +10 -0
  161. package/dist/common/endowments/math.js.map +1 -0
  162. package/dist/common/endowments/math.mjs +10 -0
  163. package/dist/common/endowments/math.mjs.map +1 -0
  164. package/dist/common/endowments/network.js +10 -0
  165. package/dist/common/endowments/network.js.map +1 -0
  166. package/dist/common/endowments/network.mjs +10 -0
  167. package/dist/common/endowments/network.mjs.map +1 -0
  168. package/dist/common/endowments/textDecoder.js +8 -0
  169. package/dist/common/endowments/textDecoder.js.map +1 -0
  170. package/dist/common/endowments/textDecoder.mjs +8 -0
  171. package/dist/common/endowments/textDecoder.mjs.map +1 -0
  172. package/dist/common/endowments/textEncoder.js +8 -0
  173. package/dist/common/endowments/textEncoder.js.map +1 -0
  174. package/dist/common/endowments/textEncoder.mjs +8 -0
  175. package/dist/common/endowments/textEncoder.mjs.map +1 -0
  176. package/dist/common/endowments/timeout.js +8 -0
  177. package/dist/common/endowments/timeout.js.map +1 -0
  178. package/dist/common/endowments/timeout.mjs +8 -0
  179. package/dist/common/endowments/timeout.mjs.map +1 -0
  180. package/dist/common/globalEvents.js +11 -0
  181. package/dist/common/globalEvents.js.map +1 -0
  182. package/dist/common/globalEvents.mjs +11 -0
  183. package/dist/common/globalEvents.mjs.map +1 -0
  184. package/dist/common/globalObject.js +10 -0
  185. package/dist/common/globalObject.js.map +1 -0
  186. package/dist/common/globalObject.mjs +10 -0
  187. package/dist/common/globalObject.mjs.map +1 -0
  188. package/dist/common/lockdown/lockdown-events.js +8 -0
  189. package/dist/common/lockdown/lockdown-events.js.map +1 -0
  190. package/dist/common/lockdown/lockdown-events.mjs +8 -0
  191. package/dist/common/lockdown/lockdown-events.mjs.map +1 -0
  192. package/dist/common/lockdown/lockdown-more.js +8 -0
  193. package/dist/common/lockdown/lockdown-more.js.map +1 -0
  194. package/dist/common/lockdown/lockdown-more.mjs +8 -0
  195. package/dist/common/lockdown/lockdown-more.mjs.map +1 -0
  196. package/dist/common/lockdown/lockdown.js +22 -0
  197. package/dist/common/lockdown/lockdown.js.map +1 -0
  198. package/dist/common/lockdown/lockdown.mjs +22 -0
  199. package/dist/common/lockdown/lockdown.mjs.map +1 -0
  200. package/dist/common/sortParams.js +8 -0
  201. package/dist/common/sortParams.js.map +1 -0
  202. package/dist/common/sortParams.mjs +8 -0
  203. package/dist/common/sortParams.mjs.map +1 -0
  204. package/dist/common/utils.js +21 -0
  205. package/dist/common/utils.js.map +1 -0
  206. package/dist/common/utils.mjs +21 -0
  207. package/dist/common/utils.mjs.map +1 -0
  208. package/dist/common/validation.js +38 -0
  209. package/dist/common/validation.js.map +1 -0
  210. package/dist/common/validation.mjs +38 -0
  211. package/dist/common/validation.mjs.map +1 -0
  212. package/dist/globals.d.js +1 -0
  213. package/dist/globals.d.js.map +1 -0
  214. package/dist/globals.d.mjs +1 -0
  215. package/dist/globals.d.mjs.map +1 -0
  216. package/dist/iframe/IFrameSnapExecutor.js +27 -0
  217. package/dist/iframe/IFrameSnapExecutor.js.map +1 -0
  218. package/dist/iframe/IFrameSnapExecutor.mjs +27 -0
  219. package/dist/iframe/IFrameSnapExecutor.mjs.map +1 -0
  220. package/dist/iframe/index.js +35 -0
  221. package/dist/iframe/index.js.map +1 -0
  222. package/dist/iframe/index.mjs +35 -0
  223. package/dist/iframe/index.mjs.map +1 -0
  224. package/dist/index.js +9 -0
  225. package/dist/index.js.map +1 -0
  226. package/dist/index.mjs +9 -0
  227. package/dist/index.mjs.map +1 -0
  228. package/dist/logging.js +8 -0
  229. package/dist/logging.js.map +1 -0
  230. package/dist/logging.mjs +8 -0
  231. package/dist/logging.mjs.map +1 -0
  232. package/dist/node-process/ChildProcessSnapExecutor.js +27 -0
  233. package/dist/node-process/ChildProcessSnapExecutor.js.map +1 -0
  234. package/dist/node-process/ChildProcessSnapExecutor.mjs +27 -0
  235. package/dist/node-process/ChildProcessSnapExecutor.mjs.map +1 -0
  236. package/dist/node-process/index.js +31 -0
  237. package/dist/node-process/index.js.map +1 -0
  238. package/dist/node-process/index.mjs +31 -0
  239. package/dist/node-process/index.mjs.map +1 -0
  240. package/dist/node-thread/ThreadSnapExecutor.js +27 -0
  241. package/dist/node-thread/ThreadSnapExecutor.js.map +1 -0
  242. package/dist/node-thread/ThreadSnapExecutor.mjs +27 -0
  243. package/dist/node-thread/ThreadSnapExecutor.mjs.map +1 -0
  244. package/dist/node-thread/index.js +31 -0
  245. package/dist/node-thread/index.js.map +1 -0
  246. package/dist/node-thread/index.mjs +31 -0
  247. package/dist/node-thread/index.mjs.map +1 -0
  248. package/dist/proxy/ProxySnapExecutor.js +8 -0
  249. package/dist/proxy/ProxySnapExecutor.js.map +1 -0
  250. package/dist/proxy/ProxySnapExecutor.mjs +8 -0
  251. package/dist/proxy/ProxySnapExecutor.mjs.map +1 -0
  252. package/dist/proxy/index.js +9 -0
  253. package/dist/proxy/index.js.map +1 -0
  254. package/dist/proxy/index.mjs +9 -0
  255. package/dist/proxy/index.mjs.map +1 -0
  256. package/dist/tsconfig.build.tsbuildinfo +1 -0
  257. package/dist/types/common/utils.d.ts +7 -0
  258. package/dist/types/vendor/global.d.js +1 -0
  259. package/dist/types/vendor/global.d.js.map +1 -0
  260. package/dist/types/vendor/global.d.mjs +1 -0
  261. package/dist/types/vendor/global.d.mjs.map +1 -0
  262. package/dist/types/vendor/readable-stream.d.js +1 -0
  263. package/dist/types/vendor/readable-stream.d.js.map +1 -0
  264. package/dist/types/vendor/readable-stream.d.mjs +1 -0
  265. package/dist/types/vendor/readable-stream.d.mjs.map +1 -0
  266. package/dist/webview/WebViewExecutorStream.js +8 -0
  267. package/dist/webview/WebViewExecutorStream.js.map +1 -0
  268. package/dist/webview/WebViewExecutorStream.mjs +8 -0
  269. package/dist/webview/WebViewExecutorStream.mjs.map +1 -0
  270. package/dist/webview/index.js +26 -0
  271. package/dist/webview/index.js.map +1 -0
  272. package/dist/webview/index.mjs +26 -0
  273. package/dist/webview/index.mjs.map +1 -0
  274. package/dist/webworker/executor/WebWorkerSnapExecutor.js +27 -0
  275. package/dist/webworker/executor/WebWorkerSnapExecutor.js.map +1 -0
  276. package/dist/webworker/executor/WebWorkerSnapExecutor.mjs +27 -0
  277. package/dist/webworker/executor/WebWorkerSnapExecutor.mjs.map +1 -0
  278. package/dist/webworker/executor/index.js +35 -0
  279. package/dist/webworker/executor/index.js.map +1 -0
  280. package/dist/webworker/executor/index.mjs +35 -0
  281. package/dist/webworker/executor/index.mjs.map +1 -0
  282. package/dist/webworker/pool/WebWorkerPool.js +8 -0
  283. package/dist/webworker/pool/WebWorkerPool.js.map +1 -0
  284. package/dist/webworker/pool/WebWorkerPool.mjs +8 -0
  285. package/dist/webworker/pool/WebWorkerPool.mjs.map +1 -0
  286. package/dist/webworker/pool/index.js +16 -0
  287. package/dist/webworker/pool/index.js.map +1 -0
  288. package/dist/webworker/pool/index.mjs +16 -0
  289. package/dist/webworker/pool/index.mjs.map +1 -0
  290. package/package.json +25 -18
  291. package/dist/cjs/common/BaseSnapExecutor.js +0 -496
  292. package/dist/cjs/common/BaseSnapExecutor.js.map +0 -1
  293. package/dist/cjs/common/commands.js +0 -102
  294. package/dist/cjs/common/commands.js.map +0 -1
  295. package/dist/cjs/common/endowments/commonEndowmentFactory.js +0 -147
  296. package/dist/cjs/common/endowments/commonEndowmentFactory.js.map +0 -1
  297. package/dist/cjs/common/endowments/console.js +0 -134
  298. package/dist/cjs/common/endowments/console.js.map +0 -1
  299. package/dist/cjs/common/endowments/crypto.js +0 -44
  300. package/dist/cjs/common/endowments/crypto.js.map +0 -1
  301. package/dist/cjs/common/endowments/date.js +0 -53
  302. package/dist/cjs/common/endowments/date.js.map +0 -1
  303. package/dist/cjs/common/endowments/index.js +0 -93
  304. package/dist/cjs/common/endowments/index.js.map +0 -1
  305. package/dist/cjs/common/endowments/interval.js +0 -62
  306. package/dist/cjs/common/endowments/interval.js.map +0 -1
  307. package/dist/cjs/common/endowments/math.js +0 -67
  308. package/dist/cjs/common/endowments/math.js.map +0 -1
  309. package/dist/cjs/common/endowments/network.js +0 -303
  310. package/dist/cjs/common/endowments/network.js.map +0 -1
  311. package/dist/cjs/common/endowments/textDecoder.js +0 -28
  312. package/dist/cjs/common/endowments/textDecoder.js.map +0 -1
  313. package/dist/cjs/common/endowments/textEncoder.js +0 -28
  314. package/dist/cjs/common/endowments/textEncoder.js.map +0 -1
  315. package/dist/cjs/common/endowments/timeout.js +0 -64
  316. package/dist/cjs/common/endowments/timeout.js.map +0 -1
  317. package/dist/cjs/common/globalEvents.js +0 -40
  318. package/dist/cjs/common/globalEvents.js.map +0 -1
  319. package/dist/cjs/common/globalObject.js +0 -53
  320. package/dist/cjs/common/globalObject.js.map +0 -1
  321. package/dist/cjs/common/lockdown/lockdown-events.js +0 -74
  322. package/dist/cjs/common/lockdown/lockdown-events.js.map +0 -1
  323. package/dist/cjs/common/lockdown/lockdown-more.js +0 -73
  324. package/dist/cjs/common/lockdown/lockdown-more.js.map +0 -1
  325. package/dist/cjs/common/lockdown/lockdown.js +0 -30
  326. package/dist/cjs/common/lockdown/lockdown.js.map +0 -1
  327. package/dist/cjs/common/sortParams.js +0 -26
  328. package/dist/cjs/common/sortParams.js.map +0 -1
  329. package/dist/cjs/common/utils.js +0 -128
  330. package/dist/cjs/common/utils.js.map +0 -1
  331. package/dist/cjs/common/validation.js +0 -149
  332. package/dist/cjs/common/validation.js.map +0 -1
  333. package/dist/cjs/iframe/IFrameSnapExecutor.js +0 -50
  334. package/dist/cjs/iframe/IFrameSnapExecutor.js.map +0 -1
  335. package/dist/cjs/iframe/index.js +0 -13
  336. package/dist/cjs/iframe/index.js.map +0 -1
  337. package/dist/cjs/index.js +0 -20
  338. package/dist/cjs/index.js.map +0 -1
  339. package/dist/cjs/logging.js +0 -15
  340. package/dist/cjs/logging.js.map +0 -1
  341. package/dist/cjs/node-process/ChildProcessSnapExecutor.js +0 -39
  342. package/dist/cjs/node-process/ChildProcessSnapExecutor.js.map +0 -1
  343. package/dist/cjs/node-process/index.js +0 -11
  344. package/dist/cjs/node-process/index.js.map +0 -1
  345. package/dist/cjs/node-thread/ThreadSnapExecutor.js +0 -39
  346. package/dist/cjs/node-thread/ThreadSnapExecutor.js.map +0 -1
  347. package/dist/cjs/node-thread/index.js +0 -11
  348. package/dist/cjs/node-thread/index.js.map +0 -1
  349. package/dist/cjs/proxy/ProxySnapExecutor.js +0 -183
  350. package/dist/cjs/proxy/ProxySnapExecutor.js.map +0 -1
  351. package/dist/cjs/proxy/index.js +0 -20
  352. package/dist/cjs/proxy/index.js.map +0 -1
  353. package/dist/cjs/webview/WebViewExecutorStream.js +0 -121
  354. package/dist/cjs/webview/WebViewExecutorStream.js.map +0 -1
  355. package/dist/cjs/webview/index.js +0 -19
  356. package/dist/cjs/webview/index.js.map +0 -1
  357. package/dist/cjs/webworker/executor/WebWorkerSnapExecutor.js +0 -45
  358. package/dist/cjs/webworker/executor/WebWorkerSnapExecutor.js.map +0 -1
  359. package/dist/cjs/webworker/executor/index.js +0 -13
  360. package/dist/cjs/webworker/executor/index.js.map +0 -1
  361. package/dist/cjs/webworker/pool/WebWorkerPool.js +0 -248
  362. package/dist/cjs/webworker/pool/WebWorkerPool.js.map +0 -1
  363. package/dist/cjs/webworker/pool/index.js +0 -13
  364. package/dist/cjs/webworker/pool/index.js.map +0 -1
  365. package/dist/esm/common/BaseSnapExecutor.js +0 -486
  366. package/dist/esm/common/BaseSnapExecutor.js.map +0 -1
  367. package/dist/esm/common/commands.js +0 -101
  368. package/dist/esm/common/commands.js.map +0 -1
  369. package/dist/esm/common/endowments/commonEndowmentFactory.js +0 -132
  370. package/dist/esm/common/endowments/commonEndowmentFactory.js.map +0 -1
  371. package/dist/esm/common/endowments/console.js +0 -116
  372. package/dist/esm/common/endowments/console.js.map +0 -1
  373. package/dist/esm/common/endowments/crypto.js +0 -26
  374. package/dist/esm/common/endowments/crypto.js.map +0 -1
  375. package/dist/esm/common/endowments/date.js +0 -43
  376. package/dist/esm/common/endowments/date.js.map +0 -1
  377. package/dist/esm/common/endowments/index.js +0 -92
  378. package/dist/esm/common/endowments/index.js.map +0 -1
  379. package/dist/esm/common/endowments/interval.js +0 -52
  380. package/dist/esm/common/endowments/interval.js.map +0 -1
  381. package/dist/esm/common/endowments/math.js +0 -57
  382. package/dist/esm/common/endowments/math.js.map +0 -1
  383. package/dist/esm/common/endowments/network.js +0 -293
  384. package/dist/esm/common/endowments/network.js.map +0 -1
  385. package/dist/esm/common/endowments/textDecoder.js +0 -18
  386. package/dist/esm/common/endowments/textDecoder.js.map +0 -1
  387. package/dist/esm/common/endowments/textEncoder.js +0 -18
  388. package/dist/esm/common/endowments/textEncoder.js.map +0 -1
  389. package/dist/esm/common/endowments/timeout.js +0 -54
  390. package/dist/esm/common/endowments/timeout.js.map +0 -1
  391. package/dist/esm/common/globalEvents.js +0 -36
  392. package/dist/esm/common/globalEvents.js.map +0 -1
  393. package/dist/esm/common/globalObject.js +0 -36
  394. package/dist/esm/common/globalObject.js.map +0 -1
  395. package/dist/esm/common/lockdown/lockdown-events.js +0 -66
  396. package/dist/esm/common/lockdown/lockdown-events.js.map +0 -1
  397. package/dist/esm/common/lockdown/lockdown-more.js +0 -82
  398. package/dist/esm/common/lockdown/lockdown-more.js.map +0 -1
  399. package/dist/esm/common/lockdown/lockdown.js +0 -24
  400. package/dist/esm/common/lockdown/lockdown.js.map +0 -1
  401. package/dist/esm/common/sortParams.js +0 -29
  402. package/dist/esm/common/sortParams.js.map +0 -1
  403. package/dist/esm/common/utils.js +0 -128
  404. package/dist/esm/common/utils.js.map +0 -1
  405. package/dist/esm/common/validation.js +0 -127
  406. package/dist/esm/common/validation.js.map +0 -1
  407. package/dist/esm/iframe/IFrameSnapExecutor.js +0 -35
  408. package/dist/esm/iframe/IFrameSnapExecutor.js.map +0 -1
  409. package/dist/esm/iframe/index.js +0 -9
  410. package/dist/esm/iframe/index.js.map +0 -1
  411. package/dist/esm/index.js +0 -3
  412. package/dist/esm/index.js.map +0 -1
  413. package/dist/esm/logging.js +0 -10
  414. package/dist/esm/logging.js.map +0 -1
  415. package/dist/esm/node-process/ChildProcessSnapExecutor.js +0 -24
  416. package/dist/esm/node-process/ChildProcessSnapExecutor.js.map +0 -1
  417. package/dist/esm/node-process/index.js +0 -7
  418. package/dist/esm/node-process/index.js.map +0 -1
  419. package/dist/esm/node-thread/ThreadSnapExecutor.js +0 -24
  420. package/dist/esm/node-thread/ThreadSnapExecutor.js.map +0 -1
  421. package/dist/esm/node-thread/index.js +0 -7
  422. package/dist/esm/node-thread/index.js.map +0 -1
  423. package/dist/esm/proxy/ProxySnapExecutor.js +0 -181
  424. package/dist/esm/proxy/ProxySnapExecutor.js.map +0 -1
  425. package/dist/esm/proxy/index.js +0 -3
  426. package/dist/esm/proxy/index.js.map +0 -1
  427. package/dist/esm/webview/WebViewExecutorStream.js +0 -111
  428. package/dist/esm/webview/WebViewExecutorStream.js.map +0 -1
  429. package/dist/esm/webview/index.js +0 -15
  430. package/dist/esm/webview/index.js.map +0 -1
  431. package/dist/esm/webworker/executor/WebWorkerSnapExecutor.js +0 -30
  432. package/dist/esm/webworker/executor/WebWorkerSnapExecutor.js.map +0 -1
  433. package/dist/esm/webworker/executor/index.js +0 -9
  434. package/dist/esm/webworker/executor/index.js.map +0 -1
  435. package/dist/esm/webworker/pool/WebWorkerPool.js +0 -245
  436. package/dist/esm/webworker/pool/WebWorkerPool.js.map +0 -1
  437. package/dist/esm/webworker/pool/index.js +0 -9
  438. package/dist/esm/webworker/pool/index.js.map +0 -1
@@ -0,0 +1,147 @@
1
+ // src/common/validation.ts
2
+ import { rpcErrors } from "@metamask/rpc-errors";
3
+ import { UserInputEventStruct } from "@metamask/snaps-sdk";
4
+ import { ChainIdStruct, HandlerType } from "@metamask/snaps-utils";
5
+ import {
6
+ assertStruct,
7
+ JsonRpcIdStruct,
8
+ JsonRpcParamsStruct,
9
+ JsonRpcSuccessStruct,
10
+ JsonRpcVersionStruct,
11
+ JsonStruct
12
+ } from "@metamask/utils";
13
+ import {
14
+ array,
15
+ assign,
16
+ enums,
17
+ is,
18
+ literal,
19
+ nullable,
20
+ object,
21
+ optional,
22
+ record,
23
+ string,
24
+ tuple,
25
+ union
26
+ } from "superstruct";
27
+ var JsonRpcRequestWithoutIdStruct = object({
28
+ jsonrpc: optional(JsonRpcVersionStruct),
29
+ id: optional(JsonRpcIdStruct),
30
+ method: string(),
31
+ params: optional(JsonRpcParamsStruct)
32
+ });
33
+ var EndowmentStruct = string();
34
+ function isEndowment(value) {
35
+ return is(value, EndowmentStruct);
36
+ }
37
+ function isEndowmentsArray(value) {
38
+ return Array.isArray(value) && value.every(isEndowment);
39
+ }
40
+ var OkStruct = literal("OK");
41
+ var PingRequestArgumentsStruct = optional(
42
+ union([literal(void 0), array()])
43
+ );
44
+ var TerminateRequestArgumentsStruct = union([
45
+ literal(void 0),
46
+ array()
47
+ ]);
48
+ var ExecuteSnapRequestArgumentsStruct = tuple([
49
+ string(),
50
+ string(),
51
+ array(EndowmentStruct)
52
+ ]);
53
+ var SnapRpcRequestArgumentsStruct = tuple([
54
+ string(),
55
+ enums(Object.values(HandlerType)),
56
+ string(),
57
+ assign(
58
+ JsonRpcRequestWithoutIdStruct,
59
+ object({
60
+ params: optional(record(string(), JsonStruct))
61
+ })
62
+ )
63
+ ]);
64
+ var OnTransactionRequestArgumentsStruct = object({
65
+ // TODO: Improve `transaction` type.
66
+ transaction: record(string(), JsonStruct),
67
+ chainId: ChainIdStruct,
68
+ transactionOrigin: nullable(string())
69
+ });
70
+ function assertIsOnTransactionRequestArguments(value) {
71
+ assertStruct(
72
+ value,
73
+ OnTransactionRequestArgumentsStruct,
74
+ "Invalid request params",
75
+ rpcErrors.invalidParams
76
+ );
77
+ }
78
+ var OnSignatureRequestArgumentsStruct = object({
79
+ signature: record(string(), JsonStruct),
80
+ signatureOrigin: nullable(string())
81
+ });
82
+ function assertIsOnSignatureRequestArguments(value) {
83
+ assertStruct(
84
+ value,
85
+ OnSignatureRequestArgumentsStruct,
86
+ "Invalid request params",
87
+ rpcErrors.invalidParams
88
+ );
89
+ }
90
+ var baseNameLookupArgs = { chainId: ChainIdStruct };
91
+ var domainRequestStruct = object({
92
+ ...baseNameLookupArgs,
93
+ address: string()
94
+ });
95
+ var addressRequestStruct = object({
96
+ ...baseNameLookupArgs,
97
+ domain: string()
98
+ });
99
+ var OnNameLookupRequestArgumentsStruct = union([
100
+ domainRequestStruct,
101
+ addressRequestStruct
102
+ ]);
103
+ function assertIsOnNameLookupRequestArguments(value) {
104
+ assertStruct(
105
+ value,
106
+ OnNameLookupRequestArgumentsStruct,
107
+ "Invalid request params",
108
+ rpcErrors.invalidParams
109
+ );
110
+ }
111
+ var OnUserInputArgumentsStruct = object({
112
+ id: string(),
113
+ event: UserInputEventStruct
114
+ });
115
+ function assertIsOnUserInputRequestArguments(value) {
116
+ assertStruct(
117
+ value,
118
+ OnUserInputArgumentsStruct,
119
+ "Invalid request params",
120
+ rpcErrors.invalidParams
121
+ );
122
+ }
123
+ var OkResponseStruct = object({
124
+ id: JsonRpcIdStruct,
125
+ jsonrpc: JsonRpcVersionStruct,
126
+ result: OkStruct
127
+ });
128
+
129
+ export {
130
+ JsonRpcRequestWithoutIdStruct,
131
+ EndowmentStruct,
132
+ isEndowment,
133
+ isEndowmentsArray,
134
+ PingRequestArgumentsStruct,
135
+ TerminateRequestArgumentsStruct,
136
+ ExecuteSnapRequestArgumentsStruct,
137
+ SnapRpcRequestArgumentsStruct,
138
+ OnTransactionRequestArgumentsStruct,
139
+ assertIsOnTransactionRequestArguments,
140
+ OnSignatureRequestArgumentsStruct,
141
+ assertIsOnSignatureRequestArguments,
142
+ OnNameLookupRequestArgumentsStruct,
143
+ assertIsOnNameLookupRequestArguments,
144
+ OnUserInputArgumentsStruct,
145
+ assertIsOnUserInputRequestArguments
146
+ };
147
+ //# sourceMappingURL=chunk-WV3CXIKN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/common/validation.ts"],"sourcesContent":["import { rpcErrors } from '@metamask/rpc-errors';\nimport { UserInputEventStruct } from '@metamask/snaps-sdk';\nimport { ChainIdStruct, HandlerType } from '@metamask/snaps-utils';\nimport type { Json, JsonRpcSuccess } from '@metamask/utils';\nimport {\n assertStruct,\n JsonRpcIdStruct,\n JsonRpcParamsStruct,\n JsonRpcSuccessStruct,\n JsonRpcVersionStruct,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport {\n array,\n assign,\n enums,\n is,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n tuple,\n union,\n} from 'superstruct';\n\nexport const JsonRpcRequestWithoutIdStruct = object({\n jsonrpc: optional(JsonRpcVersionStruct),\n id: optional(JsonRpcIdStruct),\n method: string(),\n params: optional(JsonRpcParamsStruct),\n});\n\nexport type JsonRpcRequestWithoutId = Infer<\n typeof JsonRpcRequestWithoutIdStruct\n>;\n\nexport const EndowmentStruct = string();\nexport type Endowment = Infer<typeof EndowmentStruct>;\n\n/**\n * Check if the given value is an endowment.\n *\n * @param value - The value to check.\n * @returns Whether the value is an endowment.\n */\nexport function isEndowment(value: unknown): value is Endowment {\n return is(value, EndowmentStruct);\n}\n\n/**\n * Check if the given value is an array of endowments.\n *\n * @param value - The value to check.\n * @returns Whether the value is an array of endowments.\n */\nexport function isEndowmentsArray(value: unknown): value is Endowment[] {\n return Array.isArray(value) && value.every(isEndowment);\n}\n\nconst OkStruct = literal('OK');\n\nexport const PingRequestArgumentsStruct = optional(\n union([literal(undefined), array()]),\n);\n\nexport const TerminateRequestArgumentsStruct = union([\n literal(undefined),\n array(),\n]);\n\nexport const ExecuteSnapRequestArgumentsStruct = tuple([\n string(),\n string(),\n array(EndowmentStruct),\n]);\n\nexport const SnapRpcRequestArgumentsStruct = tuple([\n string(),\n enums(Object.values(HandlerType)),\n string(),\n assign(\n JsonRpcRequestWithoutIdStruct,\n object({\n params: optional(record(string(), JsonStruct)),\n }),\n ),\n]);\n\nexport type PingRequestArguments = Infer<typeof PingRequestArgumentsStruct>;\nexport type TerminateRequestArguments = Infer<\n typeof TerminateRequestArgumentsStruct\n>;\n\nexport type ExecuteSnapRequestArguments = Infer<\n typeof ExecuteSnapRequestArgumentsStruct\n>;\n\nexport type SnapRpcRequestArguments = Infer<\n typeof SnapRpcRequestArgumentsStruct\n>;\n\nexport type RequestArguments =\n | PingRequestArguments\n | TerminateRequestArguments\n | ExecuteSnapRequestArguments\n | SnapRpcRequestArguments;\n\nexport const OnTransactionRequestArgumentsStruct = object({\n // TODO: Improve `transaction` type.\n transaction: record(string(), JsonStruct),\n chainId: ChainIdStruct,\n transactionOrigin: nullable(string()),\n});\n\nexport type OnTransactionRequestArguments = Infer<\n typeof OnTransactionRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnTransactionRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnTransactionRequestArguments}\n * object.\n */\nexport function assertIsOnTransactionRequestArguments(\n value: unknown,\n): asserts value is OnTransactionRequestArguments {\n assertStruct(\n value,\n OnTransactionRequestArgumentsStruct,\n 'Invalid request params',\n rpcErrors.invalidParams,\n );\n}\n\nexport const OnSignatureRequestArgumentsStruct = object({\n signature: record(string(), JsonStruct),\n signatureOrigin: nullable(string()),\n});\n\nexport type OnSignatureRequestArguments = Infer<\n typeof OnSignatureRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnSignatureRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnSignatureRequestArguments}\n * object.\n */\nexport function assertIsOnSignatureRequestArguments(\n value: unknown,\n): asserts value is OnSignatureRequestArguments {\n assertStruct(\n value,\n OnSignatureRequestArgumentsStruct,\n 'Invalid request params',\n rpcErrors.invalidParams,\n );\n}\n\nconst baseNameLookupArgs = { chainId: ChainIdStruct };\nconst domainRequestStruct = object({\n ...baseNameLookupArgs,\n address: string(),\n});\nconst addressRequestStruct = object({\n ...baseNameLookupArgs,\n domain: string(),\n});\n\nexport const OnNameLookupRequestArgumentsStruct = union([\n domainRequestStruct,\n addressRequestStruct,\n]);\n\nexport type OnNameLookupRequestArguments = Infer<\n typeof OnNameLookupRequestArgumentsStruct\n>;\n\nexport type PossibleLookupRequestArgs = typeof baseNameLookupArgs & {\n address?: string;\n domain?: string;\n};\n\n/**\n * Asserts that the given value is a valid {@link OnNameLookupRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnNameLookupRequestArguments}\n * object.\n */\nexport function assertIsOnNameLookupRequestArguments(\n value: unknown,\n): asserts value is OnNameLookupRequestArguments {\n assertStruct(\n value,\n OnNameLookupRequestArgumentsStruct,\n 'Invalid request params',\n rpcErrors.invalidParams,\n );\n}\n\nexport const OnUserInputArgumentsStruct = object({\n id: string(),\n event: UserInputEventStruct,\n});\n\nexport type OnUserInputArguments = Infer<typeof OnUserInputArgumentsStruct>;\n\n/**\n * Asserts that the given value is a valid {@link OnUserInputArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnUserInputArguments}\n * object.\n */\nexport function assertIsOnUserInputRequestArguments(\n value: unknown,\n): asserts value is OnUserInputArguments {\n assertStruct(\n value,\n OnUserInputArgumentsStruct,\n 'Invalid request params',\n rpcErrors.invalidParams,\n );\n}\n\nconst OkResponseStruct = object({\n id: JsonRpcIdStruct,\n jsonrpc: JsonRpcVersionStruct,\n result: OkStruct,\n});\n\nconst SnapRpcResponse = JsonRpcSuccessStruct;\n\nexport type OkResponse = Infer<typeof OkResponseStruct>;\nexport type SnapRpcResponse = Infer<typeof SnapRpcResponse>;\n\nexport type Response = OkResponse | SnapRpcResponse;\n\ntype RequestParams<Params extends unknown[] | undefined> =\n Params extends undefined ? [] : Params;\n\ntype RequestFunction<\n Args extends RequestArguments,\n ResponseType extends JsonRpcSuccess<Json>,\n> = (...args: RequestParams<Args>) => Promise<ResponseType['result']>;\n\nexport type Ping = RequestFunction<PingRequestArguments, OkResponse>;\nexport type Terminate = RequestFunction<TerminateRequestArguments, OkResponse>;\nexport type ExecuteSnap = RequestFunction<\n ExecuteSnapRequestArguments,\n OkResponse\n>;\nexport type SnapRpc = RequestFunction<SnapRpcRequestArguments, SnapRpcResponse>;\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,eAAe,mBAAmB;AAE3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,IAAM,gCAAgC,OAAO;AAAA,EAClD,SAAS,SAAS,oBAAoB;AAAA,EACtC,IAAI,SAAS,eAAe;AAAA,EAC5B,QAAQ,OAAO;AAAA,EACf,QAAQ,SAAS,mBAAmB;AACtC,CAAC;AAMM,IAAM,kBAAkB,OAAO;AAS/B,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC;AAQO,SAAS,kBAAkB,OAAsC;AACtE,SAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,MAAM,WAAW;AACxD;AAEA,IAAM,WAAW,QAAQ,IAAI;AAEtB,IAAM,6BAA6B;AAAA,EACxC,MAAM,CAAC,QAAQ,MAAS,GAAG,MAAM,CAAC,CAAC;AACrC;AAEO,IAAM,kCAAkC,MAAM;AAAA,EACnD,QAAQ,MAAS;AAAA,EACjB,MAAM;AACR,CAAC;AAEM,IAAM,oCAAoC,MAAM;AAAA,EACrD,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM,eAAe;AACvB,CAAC;AAEM,IAAM,gCAAgC,MAAM;AAAA,EACjD,OAAO;AAAA,EACP,MAAM,OAAO,OAAO,WAAW,CAAC;AAAA,EAChC,OAAO;AAAA,EACP;AAAA,IACE;AAAA,IACA,OAAO;AAAA,MACL,QAAQ,SAAS,OAAO,OAAO,GAAG,UAAU,CAAC;AAAA,IAC/C,CAAC;AAAA,EACH;AACF,CAAC;AAqBM,IAAM,sCAAsC,OAAO;AAAA;AAAA,EAExD,aAAa,OAAO,OAAO,GAAG,UAAU;AAAA,EACxC,SAAS;AAAA,EACT,mBAAmB,SAAS,OAAO,CAAC;AACtC,CAAC;AAcM,SAAS,sCACd,OACgD;AAChD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,EACZ;AACF;AAEO,IAAM,oCAAoC,OAAO;AAAA,EACtD,WAAW,OAAO,OAAO,GAAG,UAAU;AAAA,EACtC,iBAAiB,SAAS,OAAO,CAAC;AACpC,CAAC;AAcM,SAAS,oCACd,OAC8C;AAC9C;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,EACZ;AACF;AAEA,IAAM,qBAAqB,EAAE,SAAS,cAAc;AACpD,IAAM,sBAAsB,OAAO;AAAA,EACjC,GAAG;AAAA,EACH,SAAS,OAAO;AAClB,CAAC;AACD,IAAM,uBAAuB,OAAO;AAAA,EAClC,GAAG;AAAA,EACH,QAAQ,OAAO;AACjB,CAAC;AAEM,IAAM,qCAAqC,MAAM;AAAA,EACtD;AAAA,EACA;AACF,CAAC;AAmBM,SAAS,qCACd,OAC+C;AAC/C;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,EACZ;AACF;AAEO,IAAM,6BAA6B,OAAO;AAAA,EAC/C,IAAI,OAAO;AAAA,EACX,OAAO;AACT,CAAC;AAYM,SAAS,oCACd,OACuC;AACvC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,EACZ;AACF;AAEA,IAAM,mBAAmB,OAAO;AAAA,EAC9B,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,QAAQ;AACV,CAAC;","names":[]}
@@ -0,0 +1,45 @@
1
+ import {
2
+ BaseSnapExecutor
3
+ } from "./chunk-QVIHE3WB.mjs";
4
+ import {
5
+ log
6
+ } from "./chunk-5DEV3QQU.mjs";
7
+
8
+ // src/iframe/IFrameSnapExecutor.ts
9
+ import ObjectMultiplex from "@metamask/object-multiplex";
10
+ import { WindowPostMessageStream } from "@metamask/post-message-stream";
11
+ import { logError, SNAP_STREAM_NAMES } from "@metamask/snaps-utils";
12
+ import { pipeline } from "readable-stream";
13
+ var IFrameSnapExecutor = class _IFrameSnapExecutor extends BaseSnapExecutor {
14
+ /**
15
+ * Initialize the IFrameSnapExecutor. This creates a post message stream from
16
+ * and to the parent window, for two-way communication with the iframe.
17
+ *
18
+ * @param stream - The stream to use for communication.
19
+ * @returns An instance of `IFrameSnapExecutor`, with the initialized post
20
+ * message streams.
21
+ */
22
+ static initialize(stream = new WindowPostMessageStream({
23
+ name: "child",
24
+ target: "parent",
25
+ targetWindow: self.parent,
26
+ targetOrigin: "*"
27
+ })) {
28
+ log("Worker: Connecting to parent.");
29
+ const mux = new ObjectMultiplex();
30
+ pipeline(stream, mux, stream, (error) => {
31
+ if (error) {
32
+ logError(`Parent stream failure, closing worker.`, error);
33
+ }
34
+ self.close();
35
+ });
36
+ const commandStream = mux.createStream(SNAP_STREAM_NAMES.COMMAND);
37
+ const rpcStream = mux.createStream(SNAP_STREAM_NAMES.JSON_RPC);
38
+ return new _IFrameSnapExecutor(commandStream, rpcStream);
39
+ }
40
+ };
41
+
42
+ export {
43
+ IFrameSnapExecutor
44
+ };
45
+ //# sourceMappingURL=chunk-Y7MVNOPY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iframe/IFrameSnapExecutor.ts"],"sourcesContent":["import ObjectMultiplex from '@metamask/object-multiplex';\nimport type { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { WindowPostMessageStream } from '@metamask/post-message-stream';\nimport { logError, SNAP_STREAM_NAMES } from '@metamask/snaps-utils';\nimport { pipeline } from 'readable-stream';\n\nimport { BaseSnapExecutor } from '../common/BaseSnapExecutor';\nimport { log } from '../logging';\n\nexport class IFrameSnapExecutor extends BaseSnapExecutor {\n /**\n * Initialize the IFrameSnapExecutor. This creates a post message stream from\n * and to the parent window, for two-way communication with the iframe.\n *\n * @param stream - The stream to use for communication.\n * @returns An instance of `IFrameSnapExecutor`, with the initialized post\n * message streams.\n */\n static initialize(\n stream: BasePostMessageStream = new WindowPostMessageStream({\n name: 'child',\n target: 'parent',\n targetWindow: self.parent,\n targetOrigin: '*',\n }),\n ) {\n log('Worker: Connecting to parent.');\n\n const mux = new ObjectMultiplex();\n pipeline(stream, mux, stream, (error) => {\n if (error) {\n logError(`Parent stream failure, closing worker.`, error);\n }\n self.close();\n });\n\n const commandStream = mux.createStream(SNAP_STREAM_NAMES.COMMAND);\n const rpcStream = mux.createStream(SNAP_STREAM_NAMES.JSON_RPC);\n\n return new IFrameSnapExecutor(commandStream, rpcStream);\n }\n}\n"],"mappings":";;;;;;;;AAAA,OAAO,qBAAqB;AAE5B,SAAS,+BAA+B;AACxC,SAAS,UAAU,yBAAyB;AAC5C,SAAS,gBAAgB;AAKlB,IAAM,qBAAN,MAAM,4BAA2B,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASvD,OAAO,WACL,SAAgC,IAAI,wBAAwB;AAAA,IAC1D,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,cAAc,KAAK;AAAA,IACnB,cAAc;AAAA,EAChB,CAAC,GACD;AACA,QAAI,+BAA+B;AAEnC,UAAM,MAAM,IAAI,gBAAgB;AAChC,aAAS,QAAQ,KAAK,QAAQ,CAAC,UAAU;AACvC,UAAI,OAAO;AACT,iBAAS,0CAA0C,KAAK;AAAA,MAC1D;AACA,WAAK,MAAM;AAAA,IACb,CAAC;AAED,UAAM,gBAAgB,IAAI,aAAa,kBAAkB,OAAO;AAChE,UAAM,YAAY,IAAI,aAAa,kBAAkB,QAAQ;AAE7D,WAAO,IAAI,oBAAmB,eAAe,SAAS;AAAA,EACxD;AACF;","names":[]}
@@ -0,0 +1,38 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+ var __accessCheck = (obj, member, msg) => {
9
+ if (!member.has(obj))
10
+ throw TypeError("Cannot " + msg);
11
+ };
12
+ var __privateGet = (obj, member, getter) => {
13
+ __accessCheck(obj, member, "read from private field");
14
+ return getter ? getter.call(obj) : member.get(obj);
15
+ };
16
+ var __privateAdd = (obj, member, value) => {
17
+ if (member.has(obj))
18
+ throw TypeError("Cannot add the same private member more than once");
19
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
20
+ };
21
+ var __privateSet = (obj, member, value, setter) => {
22
+ __accessCheck(obj, member, "write to private field");
23
+ setter ? setter.call(obj, value) : member.set(obj, value);
24
+ return value;
25
+ };
26
+ var __privateMethod = (obj, member, method) => {
27
+ __accessCheck(obj, member, "access private method");
28
+ return method;
29
+ };
30
+
31
+ export {
32
+ __require,
33
+ __privateGet,
34
+ __privateAdd,
35
+ __privateSet,
36
+ __privateMethod
37
+ };
38
+ //# sourceMappingURL=chunk-YRZVIDCF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,147 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkZ7BOREC4js = require('./chunk-Z7BOREC4.js');
4
+
5
+ // src/common/utils.ts
6
+ var _rpcerrors = require('@metamask/rpc-errors');
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+ var _utils = require('@metamask/utils');
15
+ var MAX_RESPONSE_JSON_SIZE = 64e6;
16
+ async function withTeardown(originalPromise, teardownRef) {
17
+ const myTeardown = teardownRef.lastTeardown;
18
+ return new Promise((resolve, reject) => {
19
+ originalPromise.then((value) => {
20
+ if (teardownRef.lastTeardown === myTeardown) {
21
+ resolve(value);
22
+ } else {
23
+ _chunkZ7BOREC4js.log.call(void 0,
24
+ "Late promise received after Snap finished execution. Promise will be dropped."
25
+ );
26
+ }
27
+ }).catch((reason) => {
28
+ if (teardownRef.lastTeardown === myTeardown) {
29
+ reject(reason);
30
+ } else {
31
+ _chunkZ7BOREC4js.log.call(void 0,
32
+ "Late promise received after Snap finished execution. Promise will be dropped."
33
+ );
34
+ }
35
+ });
36
+ });
37
+ }
38
+ function proxyStreamProvider(provider, request) {
39
+ const proxy = new Proxy(
40
+ {},
41
+ {
42
+ has(_target, prop) {
43
+ return typeof prop === "string" && ["request", "on", "removeListener"].includes(prop);
44
+ },
45
+ get(_target, prop) {
46
+ if (prop === "request") {
47
+ return request;
48
+ } else if (["on", "removeListener"].includes(prop)) {
49
+ return provider[prop];
50
+ }
51
+ return void 0;
52
+ }
53
+ }
54
+ );
55
+ return proxy;
56
+ }
57
+ var BLOCKED_RPC_METHODS = Object.freeze([
58
+ "wallet_requestSnaps",
59
+ "wallet_requestPermissions",
60
+ "wallet_revokePermissions",
61
+ // We disallow all of these confirmations for now, since the screens are not ready for Snaps.
62
+ "eth_sendRawTransaction",
63
+ "eth_sendTransaction",
64
+ "eth_sign",
65
+ "eth_signTypedData",
66
+ "eth_signTypedData_v1",
67
+ "eth_signTypedData_v3",
68
+ "eth_signTypedData_v4",
69
+ "eth_decrypt",
70
+ "eth_getEncryptionPublicKey",
71
+ "wallet_addEthereumChain",
72
+ "wallet_switchEthereumChain",
73
+ "wallet_watchAsset",
74
+ "wallet_registerOnboarding",
75
+ "wallet_scanQRCode"
76
+ ]);
77
+ function assertSnapOutboundRequest(args) {
78
+ _utils.assert.call(void 0,
79
+ String.prototype.startsWith.call(args.method, "wallet_") || String.prototype.startsWith.call(args.method, "snap_"),
80
+ "The global Snap API only allows RPC methods starting with `wallet_*` and `snap_*`.",
81
+ _rpcerrors.rpcErrors.methodNotSupported
82
+ );
83
+ _utils.assert.call(void 0,
84
+ !BLOCKED_RPC_METHODS.includes(args.method),
85
+ _rpcerrors.rpcErrors.methodNotFound({
86
+ data: {
87
+ method: args.method
88
+ }
89
+ })
90
+ );
91
+ _utils.assertStruct.call(void 0,
92
+ args,
93
+ _utils.JsonStruct,
94
+ "Provided value is not JSON-RPC compatible",
95
+ _rpcerrors.rpcErrors.invalidParams
96
+ );
97
+ }
98
+ function assertEthereumOutboundRequest(args) {
99
+ _utils.assert.call(void 0,
100
+ !String.prototype.startsWith.call(args.method, "snap_"),
101
+ _rpcerrors.rpcErrors.methodNotFound({
102
+ data: {
103
+ method: args.method
104
+ }
105
+ })
106
+ );
107
+ _utils.assert.call(void 0,
108
+ !BLOCKED_RPC_METHODS.includes(args.method),
109
+ _rpcerrors.rpcErrors.methodNotFound({
110
+ data: {
111
+ method: args.method
112
+ }
113
+ })
114
+ );
115
+ _utils.assertStruct.call(void 0,
116
+ args,
117
+ _utils.JsonStruct,
118
+ "Provided value is not JSON-RPC compatible",
119
+ _rpcerrors.rpcErrors.invalidParams
120
+ );
121
+ }
122
+ function sanitizeRequestArguments(value) {
123
+ const json = JSON.parse(JSON.stringify(value));
124
+ return _utils.getSafeJson.call(void 0, json);
125
+ }
126
+ function isValidResponse(response) {
127
+ if (!_utils.isObject.call(void 0, response)) {
128
+ return false;
129
+ }
130
+ try {
131
+ const size = _utils.getJsonSize.call(void 0, response);
132
+ return size < MAX_RESPONSE_JSON_SIZE;
133
+ } catch {
134
+ return false;
135
+ }
136
+ }
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ exports.withTeardown = withTeardown; exports.proxyStreamProvider = proxyStreamProvider; exports.BLOCKED_RPC_METHODS = BLOCKED_RPC_METHODS; exports.assertSnapOutboundRequest = assertSnapOutboundRequest; exports.assertEthereumOutboundRequest = assertEthereumOutboundRequest; exports.sanitizeRequestArguments = sanitizeRequestArguments; exports.isValidResponse = isValidResponse;
147
+ //# sourceMappingURL=chunk-Z4WSS7YZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/common/utils.ts"],"names":[],"mappings":";;;;;AAEA,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMP,IAAM,yBAAyB;AAY/B,eAAsB,aACpB,iBACA,aACe;AACf,QAAM,aAAa,YAAY;AAC/B,SAAO,IAAI,QAAc,CAAC,SAAS,WAAW;AAC5C,oBACG,KAAK,CAAC,UAAU;AACf,UAAI,YAAY,iBAAiB,YAAY;AAC3C,gBAAQ,KAAK;AAAA,MACf,OAAO;AACL;AAAA,UACE;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC,EACA,MAAM,CAAC,WAAW;AACjB,UAAI,YAAY,iBAAiB,YAAY;AAC3C,eAAO,MAAM;AAAA,MACf,OAAO;AACL;AAAA,UACE;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACL,CAAC;AACH;AAUO,SAAS,oBACd,UACA,SACgB;AAGhB,QAAM,QAAQ,IAAI;AAAA,IAChB,CAAC;AAAA,IACD;AAAA,MACE,IAAI,SAAiB,MAAuB;AAC1C,eACE,OAAO,SAAS,YAChB,CAAC,WAAW,MAAM,gBAAgB,EAAE,SAAS,IAAI;AAAA,MAErD;AAAA,MACA,IAAI,SAAS,MAA4B;AACvC,YAAI,SAAS,WAAW;AACtB,iBAAO;AAAA,QACT,WAAW,CAAC,MAAM,gBAAgB,EAAE,SAAS,IAAI,GAAG;AAClD,iBAAO,SAAS,IAAI;AAAA,QACtB;AAEA,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAGO,IAAM,sBAAsB,OAAO,OAAO;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAOM,SAAS,0BAA0B,MAAwB;AAEhE;AAAA,IACE,OAAO,UAAU,WAAW,KAAK,KAAK,QAAQ,SAAS,KACrD,OAAO,UAAU,WAAW,KAAK,KAAK,QAAQ,OAAO;AAAA,IACvD;AAAA,IACA,UAAU;AAAA,EACZ;AACA;AAAA,IACE,CAAC,oBAAoB,SAAS,KAAK,MAAM;AAAA,IACzC,UAAU,eAAe;AAAA,MACvB,MAAM;AAAA,QACJ,QAAQ,KAAK;AAAA,MACf;AAAA,IACF,CAAC;AAAA,EACH;AACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,EACZ;AACF;AAOO,SAAS,8BAA8B,MAAwB;AAEpE;AAAA,IACE,CAAC,OAAO,UAAU,WAAW,KAAK,KAAK,QAAQ,OAAO;AAAA,IACtD,UAAU,eAAe;AAAA,MACvB,MAAM;AAAA,QACJ,QAAQ,KAAK;AAAA,MACf;AAAA,IACF,CAAC;AAAA,EACH;AACA;AAAA,IACE,CAAC,oBAAoB,SAAS,KAAK,MAAM;AAAA,IACzC,UAAU,eAAe;AAAA,MACvB,MAAM;AAAA,QACJ,QAAQ,KAAK;AAAA,MACf;AAAA,IACF,CAAC;AAAA,EACH;AACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,EACZ;AACF;AAQO,SAAS,yBAAyB,OAAkC;AAGzE,QAAM,OAAO,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC;AAC7C,SAAO,YAAY,IAAI;AACzB;AAQO,SAAS,gBAAgB,UAAmC;AACjE,MAAI,CAAC,SAAS,QAAQ,GAAG;AACvB,WAAO;AAAA,EACT;AAEA,MAAI;AAEF,UAAM,OAAO,YAAY,QAAQ;AACjC,WAAO,OAAO;AAAA,EAChB,QAAQ;AACN,WAAO;AAAA,EACT;AACF","sourcesContent":["import type { StreamProvider } from '@metamask/providers';\nimport type { RequestArguments } from '@metamask/providers/dist/BaseProvider';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport {\n assert,\n assertStruct,\n getJsonSize,\n getSafeJson,\n isObject,\n JsonStruct,\n} from '@metamask/utils';\n\nimport { log } from '../logging';\n\n// 64 MB - we chose this number because it is the size limit for postMessage\n// between the extension and the dapp enforced by Chrome.\nconst MAX_RESPONSE_JSON_SIZE = 64_000_000;\n\n/**\n * Make proxy for Promise and handle the teardown process properly.\n * If the teardown is called in the meanwhile, Promise result will not be\n * exposed to the snap anymore and warning will be logged to the console.\n *\n * @param originalPromise - Original promise.\n * @param teardownRef - Reference containing teardown count.\n * @param teardownRef.lastTeardown - Number of the last teardown.\n * @returns New proxy promise.\n */\nexport async function withTeardown<Type>(\n originalPromise: Promise<Type>,\n teardownRef: { lastTeardown: number },\n): Promise<Type> {\n const myTeardown = teardownRef.lastTeardown;\n return new Promise<Type>((resolve, reject) => {\n originalPromise\n .then((value) => {\n if (teardownRef.lastTeardown === myTeardown) {\n resolve(value);\n } else {\n log(\n 'Late promise received after Snap finished execution. Promise will be dropped.',\n );\n }\n })\n .catch((reason) => {\n if (teardownRef.lastTeardown === myTeardown) {\n reject(reason);\n } else {\n log(\n 'Late promise received after Snap finished execution. Promise will be dropped.',\n );\n }\n });\n });\n}\n\n/**\n * Returns a Proxy that narrows down (attenuates) the fields available on\n * the StreamProvider and replaces the request implementation.\n *\n * @param provider - Instance of a StreamProvider to be limited.\n * @param request - Custom attenuated request object.\n * @returns Proxy to the StreamProvider instance.\n */\nexport function proxyStreamProvider(\n provider: StreamProvider,\n request: unknown,\n): StreamProvider {\n // Proxy target is intentionally set to be an empty object, to ensure\n // that access to the prototype chain is not possible.\n const proxy = new Proxy(\n {},\n {\n has(_target: object, prop: string | symbol) {\n return (\n typeof prop === 'string' &&\n ['request', 'on', 'removeListener'].includes(prop)\n );\n },\n get(_target, prop: keyof StreamProvider) {\n if (prop === 'request') {\n return request;\n } else if (['on', 'removeListener'].includes(prop)) {\n return provider[prop];\n }\n\n return undefined;\n },\n },\n );\n\n return proxy as StreamProvider;\n}\n\n// We're blocking these RPC methods for v1, will revisit later.\nexport const BLOCKED_RPC_METHODS = Object.freeze([\n 'wallet_requestSnaps',\n 'wallet_requestPermissions',\n 'wallet_revokePermissions',\n // We disallow all of these confirmations for now, since the screens are not ready for Snaps.\n 'eth_sendRawTransaction',\n 'eth_sendTransaction',\n 'eth_sign',\n 'eth_signTypedData',\n 'eth_signTypedData_v1',\n 'eth_signTypedData_v3',\n 'eth_signTypedData_v4',\n 'eth_decrypt',\n 'eth_getEncryptionPublicKey',\n 'wallet_addEthereumChain',\n 'wallet_switchEthereumChain',\n 'wallet_watchAsset',\n 'wallet_registerOnboarding',\n 'wallet_scanQRCode',\n]);\n\n/**\n * Asserts the validity of request arguments for a snap outbound request using the `snap.request` API.\n *\n * @param args - The arguments to validate.\n */\nexport function assertSnapOutboundRequest(args: RequestArguments) {\n // Disallow any non `wallet_` or `snap_` methods for separation of concerns.\n assert(\n String.prototype.startsWith.call(args.method, 'wallet_') ||\n String.prototype.startsWith.call(args.method, 'snap_'),\n 'The global Snap API only allows RPC methods starting with `wallet_*` and `snap_*`.',\n rpcErrors.methodNotSupported,\n );\n assert(\n !BLOCKED_RPC_METHODS.includes(args.method),\n rpcErrors.methodNotFound({\n data: {\n method: args.method,\n },\n }),\n );\n assertStruct(\n args,\n JsonStruct,\n 'Provided value is not JSON-RPC compatible',\n rpcErrors.invalidParams,\n );\n}\n\n/**\n * Asserts the validity of request arguments for an ethereum outbound request using the `ethereum.request` API.\n *\n * @param args - The arguments to validate.\n */\nexport function assertEthereumOutboundRequest(args: RequestArguments) {\n // Disallow snaps methods for separation of concerns.\n assert(\n !String.prototype.startsWith.call(args.method, 'snap_'),\n rpcErrors.methodNotFound({\n data: {\n method: args.method,\n },\n }),\n );\n assert(\n !BLOCKED_RPC_METHODS.includes(args.method),\n rpcErrors.methodNotFound({\n data: {\n method: args.method,\n },\n }),\n );\n assertStruct(\n args,\n JsonStruct,\n 'Provided value is not JSON-RPC compatible',\n rpcErrors.invalidParams,\n );\n}\n\n/**\n * Gets a sanitized value to be used for passing to the underlying MetaMask provider.\n *\n * @param value - An unsanitized value from a snap.\n * @returns A sanitized value ready to be passed to a MetaMask provider.\n */\nexport function sanitizeRequestArguments(value: unknown): RequestArguments {\n // Before passing to getSafeJson we run the value through JSON serialization.\n // This lets request arguments contain undefined which is normally disallowed.\n const json = JSON.parse(JSON.stringify(value));\n return getSafeJson(json) as RequestArguments;\n}\n\n/**\n * Check if the input is a valid response.\n *\n * @param response - The response.\n * @returns True if the response is valid, otherwise false.\n */\nexport function isValidResponse(response: Record<string, unknown>) {\n if (!isObject(response)) {\n return false;\n }\n\n try {\n // If the JSON is invalid this will throw and we should return false.\n const size = getJsonSize(response);\n return size < MAX_RESPONSE_JSON_SIZE;\n } catch {\n return false;\n }\n}\n"]}
@@ -0,0 +1,12 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/logging.ts
2
+ var _snapsutils = require('@metamask/snaps-utils');
3
+ var _utils = require('@metamask/utils');
4
+ var log = _utils.createModuleLogger.call(void 0,
5
+ _snapsutils.snapsLogger,
6
+ "snaps-execution-environments"
7
+ );
8
+
9
+
10
+
11
+ exports.log = log;
12
+ //# sourceMappingURL=chunk-Z7BOREC4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/logging.ts"],"names":[],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AAQ5B,IAAM,MAAM;AAAA,EACjB;AAAA,EACA;AACF","sourcesContent":["import { snapsLogger } from '@metamask/snaps-utils';\nimport { createModuleLogger } from '@metamask/utils';\n\n/**\n * A logging function specific to this package. The log messages don't show up\n * by default, but they can be enabled by setting the environment variable:\n * - `DEBUG=metamask:snaps:snaps-execution-environments`, or\n * - `DEBUG=metamask:snaps:*` to enable all logs from `@metamask/snaps-*`.\n */\nexport const log = createModuleLogger(\n snapsLogger,\n 'snaps-execution-environments',\n);\n"]}
@@ -0,0 +1,30 @@
1
+ import {
2
+ rootRealmGlobal
3
+ } from "./chunk-IX5S3V47.mjs";
4
+
5
+ // src/common/globalEvents.ts
6
+ import { rpcErrors } from "@metamask/rpc-errors";
7
+ function addEventListener(event, listener) {
8
+ if ("addEventListener" in rootRealmGlobal && typeof rootRealmGlobal.addEventListener === "function") {
9
+ return rootRealmGlobal.addEventListener(event.toLowerCase(), listener);
10
+ }
11
+ if (rootRealmGlobal.process && "on" in rootRealmGlobal.process && typeof rootRealmGlobal.process.on === "function") {
12
+ return rootRealmGlobal.process.on(event, listener);
13
+ }
14
+ throw rpcErrors.internal("Platform agnostic addEventListener failed.");
15
+ }
16
+ function removeEventListener(event, listener) {
17
+ if ("removeEventListener" in rootRealmGlobal && typeof rootRealmGlobal.removeEventListener === "function") {
18
+ return rootRealmGlobal.removeEventListener(event.toLowerCase(), listener);
19
+ }
20
+ if (rootRealmGlobal.process && "removeListener" in rootRealmGlobal.process && typeof rootRealmGlobal.process.removeListener === "function") {
21
+ return rootRealmGlobal.process.removeListener(event, listener);
22
+ }
23
+ throw new Error("Platform agnostic removeEventListener failed");
24
+ }
25
+
26
+ export {
27
+ addEventListener,
28
+ removeEventListener
29
+ };
30
+ //# sourceMappingURL=chunk-ZNTCZK7J.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/common/globalEvents.ts"],"sourcesContent":["import { rpcErrors } from '@metamask/rpc-errors';\n\nimport { rootRealmGlobal } from './globalObject';\n\n/**\n * Adds an event listener platform agnostically, trying both `globalThis.addEventListener` and `globalThis.process.on`\n *\n * @param event - The event to listen for.\n * @param listener - The listener to be triggered when the event occurs.\n * @returns The result of the platform agnostic operation if any.\n * @throws If none of the platform options are present.\n */\nexport function addEventListener(\n event: string,\n listener: (...args: any[]) => void,\n) {\n if (\n 'addEventListener' in rootRealmGlobal &&\n typeof rootRealmGlobal.addEventListener === 'function'\n ) {\n return rootRealmGlobal.addEventListener(event.toLowerCase(), listener);\n }\n\n if (\n rootRealmGlobal.process &&\n 'on' in rootRealmGlobal.process &&\n typeof rootRealmGlobal.process.on === 'function'\n ) {\n return rootRealmGlobal.process.on(event, listener);\n }\n\n throw rpcErrors.internal('Platform agnostic addEventListener failed.');\n}\n\n/**\n * Removes an event listener platform agnostically, trying both `globalThis.removeEventListener` and `globalThis.process.removeListener`\n *\n * @param event - The event to remove the listener for.\n * @param listener - The currently attached listener.\n * @returns The result of the platform agnostic operation if any.\n * @throws If none of the platform options are present.\n */\nexport function removeEventListener(\n event: string,\n listener: (...args: any[]) => void,\n) {\n if (\n 'removeEventListener' in rootRealmGlobal &&\n typeof rootRealmGlobal.removeEventListener === 'function'\n ) {\n return rootRealmGlobal.removeEventListener(event.toLowerCase(), listener);\n }\n\n if (\n rootRealmGlobal.process &&\n 'removeListener' in rootRealmGlobal.process &&\n typeof rootRealmGlobal.process.removeListener === 'function'\n ) {\n return rootRealmGlobal.process.removeListener(event, listener);\n }\n\n throw new Error('Platform agnostic removeEventListener failed');\n}\n"],"mappings":";;;;;AAAA,SAAS,iBAAiB;AAYnB,SAAS,iBACd,OACA,UACA;AACA,MACE,sBAAsB,mBACtB,OAAO,gBAAgB,qBAAqB,YAC5C;AACA,WAAO,gBAAgB,iBAAiB,MAAM,YAAY,GAAG,QAAQ;AAAA,EACvE;AAEA,MACE,gBAAgB,WAChB,QAAQ,gBAAgB,WACxB,OAAO,gBAAgB,QAAQ,OAAO,YACtC;AACA,WAAO,gBAAgB,QAAQ,GAAG,OAAO,QAAQ;AAAA,EACnD;AAEA,QAAM,UAAU,SAAS,4CAA4C;AACvE;AAUO,SAAS,oBACd,OACA,UACA;AACA,MACE,yBAAyB,mBACzB,OAAO,gBAAgB,wBAAwB,YAC/C;AACA,WAAO,gBAAgB,oBAAoB,MAAM,YAAY,GAAG,QAAQ;AAAA,EAC1E;AAEA,MACE,gBAAgB,WAChB,oBAAoB,gBAAgB,WACpC,OAAO,gBAAgB,QAAQ,mBAAmB,YAClD;AACA,WAAO,gBAAgB,QAAQ,eAAe,OAAO,QAAQ;AAAA,EAC/D;AAEA,QAAM,IAAI,MAAM,8CAA8C;AAChE;","names":[]}
@@ -0,0 +1,26 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkDTF6YTISjs = require('../chunk-DTF6YTIS.js');
4
+ require('../chunk-MOXNHXPG.js');
5
+ require('../chunk-44XYIN4N.js');
6
+ require('../chunk-HKHW6TTX.js');
7
+ require('../chunk-MS2LQQYH.js');
8
+ require('../chunk-CWIFVPLR.js');
9
+ require('../chunk-FOEAIF5U.js');
10
+ require('../chunk-LO5ORVRC.js');
11
+ require('../chunk-B3JZNNZD.js');
12
+ require('../chunk-OBT45IWW.js');
13
+ require('../chunk-HGLRZZ56.js');
14
+ require('../chunk-QZC2X6NG.js');
15
+ require('../chunk-Z4WSS7YZ.js');
16
+ require('../chunk-Z7BOREC4.js');
17
+ require('../chunk-OLASO3O4.js');
18
+ require('../chunk-DFPM46ZF.js');
19
+ require('../chunk-2VA6RAEE.js');
20
+ require('../chunk-DLLLH5HN.js');
21
+ require('../chunk-CV5LC4PP.js');
22
+ require('../chunk-EXN2TFDJ.js');
23
+
24
+
25
+ exports.BaseSnapExecutor = _chunkDTF6YTISjs.BaseSnapExecutor;
26
+ //# sourceMappingURL=BaseSnapExecutor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import {
2
+ BaseSnapExecutor
3
+ } from "../chunk-QVIHE3WB.mjs";
4
+ import "../chunk-QJB4J7WL.mjs";
5
+ import "../chunk-ERB7OLAB.mjs";
6
+ import "../chunk-ACK2JBSO.mjs";
7
+ import "../chunk-BCBKEUCG.mjs";
8
+ import "../chunk-4CGJF3BT.mjs";
9
+ import "../chunk-53ZULHPK.mjs";
10
+ import "../chunk-HWS4QSOC.mjs";
11
+ import "../chunk-CWCVTRNZ.mjs";
12
+ import "../chunk-W7EDURT5.mjs";
13
+ import "../chunk-Q42NNJFY.mjs";
14
+ import "../chunk-UOPIRTJX.mjs";
15
+ import "../chunk-PTCQ2I47.mjs";
16
+ import "../chunk-5DEV3QQU.mjs";
17
+ import "../chunk-MM6ZSW4E.mjs";
18
+ import "../chunk-WV3CXIKN.mjs";
19
+ import "../chunk-ZNTCZK7J.mjs";
20
+ import "../chunk-IX5S3V47.mjs";
21
+ import "../chunk-BTEAZZKP.mjs";
22
+ import "../chunk-YRZVIDCF.mjs";
23
+ export {
24
+ BaseSnapExecutor
25
+ };
26
+ //# sourceMappingURL=BaseSnapExecutor.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkOLASO3O4js = require('../chunk-OLASO3O4.js');
5
+ require('../chunk-DFPM46ZF.js');
6
+ require('../chunk-EXN2TFDJ.js');
7
+
8
+
9
+
10
+ exports.getCommandMethodImplementations = _chunkOLASO3O4js.getCommandMethodImplementations; exports.getHandlerArguments = _chunkOLASO3O4js.getHandlerArguments;
11
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import {
2
+ getCommandMethodImplementations,
3
+ getHandlerArguments
4
+ } from "../chunk-MM6ZSW4E.mjs";
5
+ import "../chunk-WV3CXIKN.mjs";
6
+ import "../chunk-YRZVIDCF.mjs";
7
+ export {
8
+ getCommandMethodImplementations,
9
+ getHandlerArguments
10
+ };
11
+ //# sourceMappingURL=commands.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,20 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk44XYIN4Njs = require('../../chunk-44XYIN4N.js');
4
+ require('../../chunk-HKHW6TTX.js');
5
+ require('../../chunk-MS2LQQYH.js');
6
+ require('../../chunk-CWIFVPLR.js');
7
+ require('../../chunk-FOEAIF5U.js');
8
+ require('../../chunk-LO5ORVRC.js');
9
+ require('../../chunk-B3JZNNZD.js');
10
+ require('../../chunk-OBT45IWW.js');
11
+ require('../../chunk-HGLRZZ56.js');
12
+ require('../../chunk-QZC2X6NG.js');
13
+ require('../../chunk-Z4WSS7YZ.js');
14
+ require('../../chunk-Z7BOREC4.js');
15
+ require('../../chunk-DLLLH5HN.js');
16
+ require('../../chunk-EXN2TFDJ.js');
17
+
18
+
19
+ exports.default = _chunk44XYIN4Njs.commonEndowmentFactory_default;
20
+ //# sourceMappingURL=commonEndowmentFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import {
2
+ commonEndowmentFactory_default
3
+ } from "../../chunk-ERB7OLAB.mjs";
4
+ import "../../chunk-ACK2JBSO.mjs";
5
+ import "../../chunk-BCBKEUCG.mjs";
6
+ import "../../chunk-4CGJF3BT.mjs";
7
+ import "../../chunk-53ZULHPK.mjs";
8
+ import "../../chunk-HWS4QSOC.mjs";
9
+ import "../../chunk-CWCVTRNZ.mjs";
10
+ import "../../chunk-W7EDURT5.mjs";
11
+ import "../../chunk-Q42NNJFY.mjs";
12
+ import "../../chunk-UOPIRTJX.mjs";
13
+ import "../../chunk-PTCQ2I47.mjs";
14
+ import "../../chunk-5DEV3QQU.mjs";
15
+ import "../../chunk-IX5S3V47.mjs";
16
+ import "../../chunk-YRZVIDCF.mjs";
17
+ export {
18
+ commonEndowmentFactory_default as default
19
+ };
20
+ //# sourceMappingURL=commonEndowmentFactory.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunkOBT45IWWjs = require('../../chunk-OBT45IWW.js');
6
+ require('../../chunk-DLLLH5HN.js');
7
+ require('../../chunk-EXN2TFDJ.js');
8
+
9
+
10
+
11
+
12
+ exports.consoleAttenuatedMethods = _chunkOBT45IWWjs.consoleAttenuatedMethods; exports.consoleMethods = _chunkOBT45IWWjs.consoleMethods; exports.default = _chunkOBT45IWWjs.console_default;
13
+ //# sourceMappingURL=console.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}