@metamask/snaps-jest 5.0.0 → 6.0.0

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 (519) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/dist/chunk-2KLZ7GOW.js +15 -0
  3. package/dist/chunk-2KLZ7GOW.js.map +1 -0
  4. package/dist/chunk-2M7WQ26F.js +28 -0
  5. package/dist/chunk-2M7WQ26F.js.map +1 -0
  6. package/dist/chunk-34GS3AHA.js +33 -0
  7. package/dist/chunk-34GS3AHA.js.map +1 -0
  8. package/dist/chunk-3CC2NI7R.js +80 -0
  9. package/dist/chunk-3CC2NI7R.js.map +1 -0
  10. package/dist/chunk-3IUQA6YL.mjs +1 -0
  11. package/dist/chunk-3IUQA6YL.mjs.map +1 -0
  12. package/dist/chunk-3KCEPGJA.js +39 -0
  13. package/dist/chunk-3KCEPGJA.js.map +1 -0
  14. package/dist/chunk-3KQYPQZY.js +20 -0
  15. package/dist/chunk-3KQYPQZY.js.map +1 -0
  16. package/dist/chunk-3O5OISLU.js +16 -0
  17. package/dist/chunk-3O5OISLU.js.map +1 -0
  18. package/dist/chunk-3ZW2EE3B.js +1 -0
  19. package/dist/chunk-3ZW2EE3B.js.map +1 -0
  20. package/dist/chunk-4FCRZDOX.js +134 -0
  21. package/dist/chunk-4FCRZDOX.js.map +1 -0
  22. package/dist/chunk-4HY4SM3A.js +1 -0
  23. package/dist/chunk-4HY4SM3A.js.map +1 -0
  24. package/dist/chunk-4JUUFDTC.js +104 -0
  25. package/dist/chunk-4JUUFDTC.js.map +1 -0
  26. package/dist/chunk-4VCE3DRR.mjs +34 -0
  27. package/dist/chunk-4VCE3DRR.mjs.map +1 -0
  28. package/dist/chunk-4WCFXE73.js +48 -0
  29. package/dist/chunk-4WCFXE73.js.map +1 -0
  30. package/dist/chunk-5IUHGC5S.js +153 -0
  31. package/dist/chunk-5IUHGC5S.js.map +1 -0
  32. package/dist/chunk-5O6VBW42.js +42 -0
  33. package/dist/chunk-5O6VBW42.js.map +1 -0
  34. package/dist/chunk-6IMEYERE.js +137 -0
  35. package/dist/chunk-6IMEYERE.js.map +1 -0
  36. package/dist/chunk-6KNT4UMX.mjs +35 -0
  37. package/dist/chunk-6KNT4UMX.mjs.map +1 -0
  38. package/dist/chunk-6RDNSELT.mjs +39 -0
  39. package/dist/chunk-6RDNSELT.mjs.map +1 -0
  40. package/dist/chunk-72YN2D26.mjs +60 -0
  41. package/dist/chunk-72YN2D26.mjs.map +1 -0
  42. package/dist/chunk-7JLVQJK7.js +14 -0
  43. package/dist/chunk-7JLVQJK7.js.map +1 -0
  44. package/dist/chunk-AH7YNG6N.js +22 -0
  45. package/dist/chunk-AH7YNG6N.js.map +1 -0
  46. package/dist/chunk-AIZADBRK.mjs +36 -0
  47. package/dist/chunk-AIZADBRK.mjs.map +1 -0
  48. package/dist/chunk-AKFRQ5EJ.mjs +42 -0
  49. package/dist/chunk-AKFRQ5EJ.mjs.map +1 -0
  50. package/dist/chunk-AUB7XPDH.mjs +28 -0
  51. package/dist/chunk-AUB7XPDH.mjs.map +1 -0
  52. package/dist/chunk-BJMTD7H2.mjs +20 -0
  53. package/dist/chunk-BJMTD7H2.mjs.map +1 -0
  54. package/dist/chunk-BN5VBVT3.mjs +233 -0
  55. package/dist/chunk-BN5VBVT3.mjs.map +1 -0
  56. package/dist/chunk-CKOGTHM4.mjs +22 -0
  57. package/dist/chunk-CKOGTHM4.mjs.map +1 -0
  58. package/dist/chunk-CZQKOZLR.js +11 -0
  59. package/dist/chunk-CZQKOZLR.js.map +1 -0
  60. package/dist/chunk-D36QBJ35.js +24 -0
  61. package/dist/{cjs/internals/simulation/methods/hooks/show-dialog.js.map → chunk-D36QBJ35.js.map} +1 -1
  62. package/dist/chunk-DEFFA5IJ.mjs +24 -0
  63. package/dist/chunk-DEFFA5IJ.mjs.map +1 -0
  64. package/dist/chunk-EFB6AQPB.js +36 -0
  65. package/dist/chunk-EFB6AQPB.js.map +1 -0
  66. package/dist/chunk-EOCDSPT7.mjs +97 -0
  67. package/dist/chunk-EOCDSPT7.mjs.map +1 -0
  68. package/dist/chunk-FPFX5AKR.mjs +36 -0
  69. package/dist/chunk-FPFX5AKR.mjs.map +1 -0
  70. package/dist/chunk-HBT34TJ2.mjs +1 -0
  71. package/dist/chunk-HBT34TJ2.mjs.map +1 -0
  72. package/dist/chunk-HBVDXIVN.mjs +80 -0
  73. package/dist/chunk-HBVDXIVN.mjs.map +1 -0
  74. package/dist/chunk-HMF2CKYT.mjs +39 -0
  75. package/dist/chunk-HMF2CKYT.mjs.map +1 -0
  76. package/dist/chunk-HP56MLQ3.js +1 -0
  77. package/dist/chunk-HP56MLQ3.js.map +1 -0
  78. package/dist/chunk-I5LVU57H.mjs +69 -0
  79. package/dist/chunk-I5LVU57H.mjs.map +1 -0
  80. package/dist/chunk-I7FLOZU7.mjs +1 -0
  81. package/dist/chunk-I7FLOZU7.mjs.map +1 -0
  82. package/dist/chunk-J2ID3DS7.mjs +33 -0
  83. package/dist/chunk-J2ID3DS7.mjs.map +1 -0
  84. package/dist/chunk-JA7RJLI7.js +34 -0
  85. package/dist/chunk-JA7RJLI7.js.map +1 -0
  86. package/dist/chunk-JB2H2XEL.mjs +1 -0
  87. package/dist/chunk-JB2H2XEL.mjs.map +1 -0
  88. package/dist/chunk-JDN3VGMO.js +21 -0
  89. package/dist/chunk-JDN3VGMO.js.map +1 -0
  90. package/dist/chunk-JGQJFYU4.js +57 -0
  91. package/dist/chunk-JGQJFYU4.js.map +1 -0
  92. package/dist/chunk-JJCX335U.mjs +91 -0
  93. package/dist/chunk-JJCX335U.mjs.map +1 -0
  94. package/dist/chunk-JMDSN227.mjs +25 -0
  95. package/dist/chunk-JMDSN227.mjs.map +1 -0
  96. package/dist/chunk-JXOKRTEH.mjs +11 -0
  97. package/dist/chunk-JXOKRTEH.mjs.map +1 -0
  98. package/dist/chunk-JZJWUVD7.mjs +1 -0
  99. package/dist/chunk-JZJWUVD7.mjs.map +1 -0
  100. package/dist/chunk-K2KTKFLP.js +76 -0
  101. package/dist/chunk-K2KTKFLP.js.map +1 -0
  102. package/dist/chunk-KGIWSGTT.js +91 -0
  103. package/dist/chunk-KGIWSGTT.js.map +1 -0
  104. package/dist/chunk-KPXLJ6RH.js +60 -0
  105. package/dist/chunk-KPXLJ6RH.js.map +1 -0
  106. package/dist/chunk-LD5PSHHT.mjs +57 -0
  107. package/dist/chunk-LD5PSHHT.mjs.map +1 -0
  108. package/dist/chunk-LNNKGOHQ.mjs +16 -0
  109. package/dist/chunk-LNNKGOHQ.mjs.map +1 -0
  110. package/dist/chunk-MNDF32ZV.js +8 -0
  111. package/dist/chunk-MNDF32ZV.js.map +1 -0
  112. package/dist/chunk-MSQ7Q2VJ.mjs +13 -0
  113. package/dist/chunk-MSQ7Q2VJ.mjs.map +1 -0
  114. package/dist/chunk-O3VJYBFN.mjs +15 -0
  115. package/dist/chunk-O3VJYBFN.mjs.map +1 -0
  116. package/dist/chunk-O4MJRHZD.js +69 -0
  117. package/dist/chunk-O4MJRHZD.js.map +1 -0
  118. package/dist/chunk-OC64PNDU.mjs +21 -0
  119. package/dist/chunk-OC64PNDU.mjs.map +1 -0
  120. package/dist/chunk-ON6M4WG5.js +36 -0
  121. package/dist/chunk-ON6M4WG5.js.map +1 -0
  122. package/dist/chunk-P7JA42ZC.mjs +153 -0
  123. package/dist/chunk-P7JA42ZC.mjs.map +1 -0
  124. package/dist/chunk-PHUTP7NB.js +25 -0
  125. package/dist/chunk-PHUTP7NB.js.map +1 -0
  126. package/dist/chunk-QFPRGU5L.mjs +104 -0
  127. package/dist/chunk-QFPRGU5L.mjs.map +1 -0
  128. package/dist/chunk-QMHWGASM.js +1 -0
  129. package/dist/chunk-QMHWGASM.js.map +1 -0
  130. package/dist/chunk-QNDLJ2W7.js +1 -0
  131. package/dist/chunk-QNDLJ2W7.js.map +1 -0
  132. package/dist/chunk-QUUILTDY.mjs +137 -0
  133. package/dist/chunk-QUUILTDY.mjs.map +1 -0
  134. package/dist/chunk-R7ORBTUD.js +1 -0
  135. package/dist/chunk-R7ORBTUD.js.map +1 -0
  136. package/dist/chunk-RQBZLDXL.js +233 -0
  137. package/dist/chunk-RQBZLDXL.js.map +1 -0
  138. package/dist/chunk-S3DHQTXB.js +1 -0
  139. package/dist/chunk-S3DHQTXB.js.map +1 -0
  140. package/dist/chunk-SWSSV3LK.js +35 -0
  141. package/dist/chunk-SWSSV3LK.js.map +1 -0
  142. package/dist/chunk-T4TRX3ZR.js +22 -0
  143. package/dist/chunk-T4TRX3ZR.js.map +1 -0
  144. package/dist/chunk-UXHKMILA.mjs +1 -0
  145. package/dist/chunk-UXHKMILA.mjs.map +1 -0
  146. package/dist/chunk-VCXM6FKU.mjs +1 -0
  147. package/dist/chunk-VCXM6FKU.mjs.map +1 -0
  148. package/dist/chunk-VHTVUQWR.mjs +14 -0
  149. package/dist/chunk-VHTVUQWR.mjs.map +1 -0
  150. package/dist/chunk-VNQIROKZ.js +97 -0
  151. package/dist/chunk-VNQIROKZ.js.map +1 -0
  152. package/dist/chunk-VXQOXWRO.mjs +48 -0
  153. package/dist/chunk-VXQOXWRO.mjs.map +1 -0
  154. package/dist/chunk-VYKYQSUI.mjs +22 -0
  155. package/dist/chunk-VYKYQSUI.mjs.map +1 -0
  156. package/dist/chunk-WEI35OIM.mjs +8 -0
  157. package/dist/chunk-WEI35OIM.mjs.map +1 -0
  158. package/dist/chunk-WL2GRM5E.mjs +76 -0
  159. package/dist/chunk-WL2GRM5E.mjs.map +1 -0
  160. package/dist/chunk-XDZPH5WD.js +39 -0
  161. package/dist/chunk-XDZPH5WD.js.map +1 -0
  162. package/dist/chunk-Y5NWZU43.js +13 -0
  163. package/dist/chunk-Y5NWZU43.js.map +1 -0
  164. package/dist/chunk-YZFWCFMG.js +1 -0
  165. package/dist/chunk-YZFWCFMG.js.map +1 -0
  166. package/dist/chunk-ZCE26WZM.mjs +1 -0
  167. package/dist/chunk-ZCE26WZM.mjs.map +1 -0
  168. package/dist/chunk-ZZPKZRJQ.mjs +134 -0
  169. package/dist/chunk-ZZPKZRJQ.mjs.map +1 -0
  170. package/dist/environment.js +47 -0
  171. package/dist/environment.js.map +1 -0
  172. package/dist/environment.mjs +47 -0
  173. package/dist/environment.mjs.map +1 -0
  174. package/dist/helpers.js +44 -0
  175. package/dist/helpers.js.map +1 -0
  176. package/dist/helpers.mjs +44 -0
  177. package/dist/helpers.mjs.map +1 -0
  178. package/dist/index.js +54 -0
  179. package/dist/index.js.map +1 -0
  180. package/dist/index.mjs +54 -0
  181. package/dist/index.mjs.map +1 -0
  182. package/dist/internals/environment.js +8 -0
  183. package/dist/internals/environment.js.map +1 -0
  184. package/dist/internals/environment.mjs +8 -0
  185. package/dist/internals/environment.mjs.map +1 -0
  186. package/dist/internals/index.js +123 -0
  187. package/dist/internals/index.js.map +1 -0
  188. package/dist/internals/index.mjs +123 -0
  189. package/dist/internals/index.mjs.map +1 -0
  190. package/dist/internals/logger.js +8 -0
  191. package/dist/internals/logger.js.map +1 -0
  192. package/dist/internals/logger.mjs +8 -0
  193. package/dist/internals/logger.mjs.map +1 -0
  194. package/dist/internals/request.js +40 -0
  195. package/dist/internals/request.js.map +1 -0
  196. package/dist/internals/request.mjs +40 -0
  197. package/dist/internals/request.mjs.map +1 -0
  198. package/dist/internals/server.js +9 -0
  199. package/dist/internals/server.js.map +1 -0
  200. package/dist/internals/server.mjs +9 -0
  201. package/dist/internals/server.mjs.map +1 -0
  202. package/dist/internals/simulation/constants.js +12 -0
  203. package/dist/internals/simulation/constants.js.map +1 -0
  204. package/dist/internals/simulation/constants.mjs +12 -0
  205. package/dist/internals/simulation/constants.mjs.map +1 -0
  206. package/dist/internals/simulation/controllers.js +26 -0
  207. package/dist/internals/simulation/controllers.js.map +1 -0
  208. package/dist/internals/simulation/controllers.mjs +26 -0
  209. package/dist/internals/simulation/controllers.mjs.map +1 -0
  210. package/dist/internals/simulation/files.js +8 -0
  211. package/dist/internals/simulation/files.js.map +1 -0
  212. package/dist/internals/simulation/files.mjs +8 -0
  213. package/dist/internals/simulation/files.mjs.map +1 -0
  214. package/dist/internals/simulation/index.js +90 -0
  215. package/dist/internals/simulation/index.js.map +1 -0
  216. package/dist/internals/simulation/index.mjs +90 -0
  217. package/dist/internals/simulation/index.mjs.map +1 -0
  218. package/dist/internals/simulation/interface.js +16 -0
  219. package/dist/internals/simulation/interface.js.map +1 -0
  220. package/dist/internals/simulation/interface.mjs +16 -0
  221. package/dist/internals/simulation/interface.mjs.map +1 -0
  222. package/dist/internals/simulation/methods/constants.js +12 -0
  223. package/dist/internals/simulation/methods/constants.js.map +1 -0
  224. package/dist/internals/simulation/methods/constants.mjs +12 -0
  225. package/dist/internals/simulation/methods/constants.mjs.map +1 -0
  226. package/dist/internals/simulation/methods/hooks/encryption.js +10 -0
  227. package/dist/internals/simulation/methods/hooks/encryption.js.map +1 -0
  228. package/dist/internals/simulation/methods/hooks/encryption.mjs +10 -0
  229. package/dist/internals/simulation/methods/hooks/encryption.mjs.map +1 -0
  230. package/dist/internals/simulation/methods/hooks/get-locale.js +8 -0
  231. package/dist/internals/simulation/methods/hooks/get-locale.js.map +1 -0
  232. package/dist/internals/simulation/methods/hooks/get-locale.mjs +8 -0
  233. package/dist/internals/simulation/methods/hooks/get-locale.mjs.map +1 -0
  234. package/dist/internals/simulation/methods/hooks/index.js +45 -0
  235. package/dist/internals/simulation/methods/hooks/index.js.map +1 -0
  236. package/dist/internals/simulation/methods/hooks/index.mjs +45 -0
  237. package/dist/internals/simulation/methods/hooks/index.mjs.map +1 -0
  238. package/dist/internals/simulation/methods/hooks/interface.js +10 -0
  239. package/dist/internals/simulation/methods/hooks/interface.js.map +1 -0
  240. package/dist/internals/simulation/methods/hooks/interface.mjs +10 -0
  241. package/dist/internals/simulation/methods/hooks/interface.mjs.map +1 -0
  242. package/dist/internals/simulation/methods/hooks/notifications.js +16 -0
  243. package/dist/internals/simulation/methods/hooks/notifications.js.map +1 -0
  244. package/dist/internals/simulation/methods/hooks/notifications.mjs +16 -0
  245. package/dist/internals/simulation/methods/hooks/notifications.mjs.map +1 -0
  246. package/dist/internals/simulation/methods/hooks/show-dialog.js +14 -0
  247. package/dist/internals/simulation/methods/hooks/show-dialog.js.map +1 -0
  248. package/dist/internals/simulation/methods/hooks/show-dialog.mjs +14 -0
  249. package/dist/internals/simulation/methods/hooks/show-dialog.mjs.map +1 -0
  250. package/dist/internals/simulation/methods/hooks/state.js +18 -0
  251. package/dist/internals/simulation/methods/hooks/state.js.map +1 -0
  252. package/dist/internals/simulation/methods/hooks/state.mjs +18 -0
  253. package/dist/internals/simulation/methods/hooks/state.mjs.map +1 -0
  254. package/dist/internals/simulation/methods/index.js +29 -0
  255. package/dist/internals/simulation/methods/index.js.map +1 -0
  256. package/dist/internals/simulation/methods/index.mjs +29 -0
  257. package/dist/internals/simulation/methods/index.mjs.map +1 -0
  258. package/dist/internals/simulation/methods/specifications.js +28 -0
  259. package/dist/internals/simulation/methods/specifications.js.map +1 -0
  260. package/dist/internals/simulation/methods/specifications.mjs +28 -0
  261. package/dist/internals/simulation/methods/specifications.mjs.map +1 -0
  262. package/dist/internals/simulation/middleware/engine.js +15 -0
  263. package/dist/internals/simulation/middleware/engine.js.map +1 -0
  264. package/dist/internals/simulation/middleware/engine.mjs +15 -0
  265. package/dist/internals/simulation/middleware/engine.mjs.map +1 -0
  266. package/dist/internals/simulation/middleware/index.js +16 -0
  267. package/dist/internals/simulation/middleware/index.js.map +1 -0
  268. package/dist/internals/simulation/middleware/index.mjs +16 -0
  269. package/dist/internals/simulation/middleware/index.mjs.map +1 -0
  270. package/dist/internals/simulation/middleware/internal-methods/accounts.js +8 -0
  271. package/dist/internals/simulation/middleware/internal-methods/accounts.js.map +1 -0
  272. package/dist/internals/simulation/middleware/internal-methods/accounts.mjs +8 -0
  273. package/dist/internals/simulation/middleware/internal-methods/accounts.mjs.map +1 -0
  274. package/dist/internals/simulation/middleware/internal-methods/index.js +11 -0
  275. package/dist/internals/simulation/middleware/internal-methods/index.js.map +1 -0
  276. package/dist/internals/simulation/middleware/internal-methods/index.mjs +11 -0
  277. package/dist/internals/simulation/middleware/internal-methods/index.mjs.map +1 -0
  278. package/dist/internals/simulation/middleware/internal-methods/middleware.js +10 -0
  279. package/dist/internals/simulation/middleware/internal-methods/middleware.js.map +1 -0
  280. package/dist/internals/simulation/middleware/internal-methods/middleware.mjs +10 -0
  281. package/dist/internals/simulation/middleware/internal-methods/middleware.mjs.map +1 -0
  282. package/dist/internals/simulation/middleware/internal-methods/provider-state.js +8 -0
  283. package/dist/internals/simulation/middleware/internal-methods/provider-state.js.map +1 -0
  284. package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs +8 -0
  285. package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs.map +1 -0
  286. package/dist/internals/simulation/middleware/mock.js +9 -0
  287. package/dist/internals/simulation/middleware/mock.js.map +1 -0
  288. package/dist/internals/simulation/middleware/mock.mjs +9 -0
  289. package/dist/internals/simulation/middleware/mock.mjs.map +1 -0
  290. package/dist/internals/simulation/options.js +9 -0
  291. package/dist/internals/simulation/options.js.map +1 -0
  292. package/dist/internals/simulation/options.mjs +9 -0
  293. package/dist/internals/simulation/options.mjs.map +1 -0
  294. package/dist/internals/simulation/simulation.js +39 -0
  295. package/dist/internals/simulation/simulation.js.map +1 -0
  296. package/dist/internals/simulation/simulation.mjs +39 -0
  297. package/dist/internals/simulation/simulation.mjs.map +1 -0
  298. package/dist/internals/simulation/store/index.js +44 -0
  299. package/dist/internals/simulation/store/index.js.map +1 -0
  300. package/dist/internals/simulation/store/index.mjs +44 -0
  301. package/dist/internals/simulation/store/index.mjs.map +1 -0
  302. package/dist/internals/simulation/store/mocks.js +16 -0
  303. package/dist/internals/simulation/store/mocks.js.map +1 -0
  304. package/dist/internals/simulation/store/mocks.mjs +16 -0
  305. package/dist/internals/simulation/store/mocks.mjs.map +1 -0
  306. package/dist/internals/simulation/store/notifications.js +16 -0
  307. package/dist/internals/simulation/store/notifications.js.map +1 -0
  308. package/dist/internals/simulation/store/notifications.mjs +16 -0
  309. package/dist/internals/simulation/store/notifications.mjs.map +1 -0
  310. package/dist/internals/simulation/store/state.js +14 -0
  311. package/dist/internals/simulation/store/state.js.map +1 -0
  312. package/dist/internals/simulation/store/state.mjs +14 -0
  313. package/dist/internals/simulation/store/state.mjs.map +1 -0
  314. package/dist/internals/simulation/store/store.js +12 -0
  315. package/dist/internals/simulation/store/store.js.map +1 -0
  316. package/dist/internals/simulation/store/store.mjs +12 -0
  317. package/dist/internals/simulation/store/store.mjs.map +1 -0
  318. package/dist/internals/simulation/store/ui.js +16 -0
  319. package/dist/internals/simulation/store/ui.js.map +1 -0
  320. package/dist/internals/simulation/store/ui.mjs +16 -0
  321. package/dist/internals/simulation/store/ui.mjs.map +1 -0
  322. package/dist/internals/structs.js +18 -0
  323. package/dist/internals/structs.js.map +1 -0
  324. package/dist/internals/structs.mjs +18 -0
  325. package/dist/internals/structs.mjs.map +1 -0
  326. package/dist/matchers.js +50 -0
  327. package/dist/matchers.js.map +1 -0
  328. package/dist/matchers.mjs +50 -0
  329. package/dist/matchers.mjs.map +1 -0
  330. package/dist/options.js +8 -0
  331. package/dist/options.js.map +1 -0
  332. package/dist/options.mjs +8 -0
  333. package/dist/options.mjs.map +1 -0
  334. package/dist/setup.js +39 -0
  335. package/dist/setup.js.map +1 -0
  336. package/dist/setup.mjs +39 -0
  337. package/dist/setup.mjs.map +1 -0
  338. package/dist/tsconfig.build.tsbuildinfo +1 -0
  339. package/dist/types/vendor/readable-stream.d.js +1 -0
  340. package/dist/types/vendor/readable-stream.d.js.map +1 -0
  341. package/dist/types/vendor/readable-stream.d.mjs +1 -0
  342. package/dist/types/vendor/readable-stream.d.mjs.map +1 -0
  343. package/dist/types.js +2 -0
  344. package/dist/types.js.map +1 -0
  345. package/dist/types.mjs +2 -0
  346. package/dist/types.mjs.map +1 -0
  347. package/jest-preset.js +1 -1
  348. package/package.json +24 -20
  349. package/dist/cjs/environment.js +0 -144
  350. package/dist/cjs/environment.js.map +0 -1
  351. package/dist/cjs/helpers.js +0 -142
  352. package/dist/cjs/helpers.js.map +0 -1
  353. package/dist/cjs/index.js +0 -42
  354. package/dist/cjs/index.js.map +0 -1
  355. package/dist/cjs/internals/environment.js +0 -19
  356. package/dist/cjs/internals/environment.js.map +0 -1
  357. package/dist/cjs/internals/index.js +0 -25
  358. package/dist/cjs/internals/index.js.map +0 -1
  359. package/dist/cjs/internals/logger.js +0 -14
  360. package/dist/cjs/internals/logger.js.map +0 -1
  361. package/dist/cjs/internals/request.js +0 -69
  362. package/dist/cjs/internals/request.js.map +0 -1
  363. package/dist/cjs/internals/server.js +0 -71
  364. package/dist/cjs/internals/server.js.map +0 -1
  365. package/dist/cjs/internals/simulation/constants.js +0 -29
  366. package/dist/cjs/internals/simulation/constants.js.map +0 -1
  367. package/dist/cjs/internals/simulation/controllers.js +0 -95
  368. package/dist/cjs/internals/simulation/controllers.js.map +0 -1
  369. package/dist/cjs/internals/simulation/files.js +0 -22
  370. package/dist/cjs/internals/simulation/files.js.map +0 -1
  371. package/dist/cjs/internals/simulation/index.js +0 -24
  372. package/dist/cjs/internals/simulation/index.js.map +0 -1
  373. package/dist/cjs/internals/simulation/interface.js +0 -98
  374. package/dist/cjs/internals/simulation/interface.js.map +0 -1
  375. package/dist/cjs/internals/simulation/methods/constants.js +0 -84
  376. package/dist/cjs/internals/simulation/methods/constants.js.map +0 -1
  377. package/dist/cjs/internals/simulation/methods/hooks/encryption.js +0 -33
  378. package/dist/cjs/internals/simulation/methods/hooks/encryption.js.map +0 -1
  379. package/dist/cjs/internals/simulation/methods/hooks/get-locale.js +0 -17
  380. package/dist/cjs/internals/simulation/methods/hooks/get-locale.js.map +0 -1
  381. package/dist/cjs/internals/simulation/methods/hooks/index.js +0 -25
  382. package/dist/cjs/internals/simulation/methods/hooks/index.js.map +0 -1
  383. package/dist/cjs/internals/simulation/methods/hooks/interface.js +0 -26
  384. package/dist/cjs/internals/simulation/methods/hooks/interface.js.map +0 -1
  385. package/dist/cjs/internals/simulation/methods/hooks/notifications.js +0 -66
  386. package/dist/cjs/internals/simulation/methods/hooks/notifications.js.map +0 -1
  387. package/dist/cjs/internals/simulation/methods/hooks/show-dialog.js +0 -43
  388. package/dist/cjs/internals/simulation/methods/hooks/state.js +0 -80
  389. package/dist/cjs/internals/simulation/methods/hooks/state.js.map +0 -1
  390. package/dist/cjs/internals/simulation/methods/index.js +0 -20
  391. package/dist/cjs/internals/simulation/methods/index.js.map +0 -1
  392. package/dist/cjs/internals/simulation/methods/specifications.js +0 -81
  393. package/dist/cjs/internals/simulation/methods/specifications.js.map +0 -1
  394. package/dist/cjs/internals/simulation/middleware/engine.js +0 -31
  395. package/dist/cjs/internals/simulation/middleware/engine.js.map +0 -1
  396. package/dist/cjs/internals/simulation/middleware/index.js +0 -20
  397. package/dist/cjs/internals/simulation/middleware/index.js.map +0 -1
  398. package/dist/cjs/internals/simulation/middleware/internal-methods/accounts.js +0 -30
  399. package/dist/cjs/internals/simulation/middleware/internal-methods/accounts.js.map +0 -1
  400. package/dist/cjs/internals/simulation/middleware/internal-methods/index.js +0 -20
  401. package/dist/cjs/internals/simulation/middleware/internal-methods/index.js.map +0 -1
  402. package/dist/cjs/internals/simulation/middleware/internal-methods/middleware.js +0 -37
  403. package/dist/cjs/internals/simulation/middleware/internal-methods/middleware.js.map +0 -1
  404. package/dist/cjs/internals/simulation/middleware/internal-methods/provider-state.js +0 -23
  405. package/dist/cjs/internals/simulation/middleware/internal-methods/provider-state.js.map +0 -1
  406. package/dist/cjs/internals/simulation/middleware/mock.js +0 -23
  407. package/dist/cjs/internals/simulation/middleware/mock.js.map +0 -1
  408. package/dist/cjs/internals/simulation/options.js +0 -24
  409. package/dist/cjs/internals/simulation/options.js.map +0 -1
  410. package/dist/cjs/internals/simulation/simulation.js +0 -124
  411. package/dist/cjs/internals/simulation/simulation.js.map +0 -1
  412. package/dist/cjs/internals/simulation/store/index.js +0 -23
  413. package/dist/cjs/internals/simulation/store/index.js.map +0 -1
  414. package/dist/cjs/internals/simulation/store/mocks.js +0 -52
  415. package/dist/cjs/internals/simulation/store/mocks.js.map +0 -1
  416. package/dist/cjs/internals/simulation/store/notifications.js +0 -52
  417. package/dist/cjs/internals/simulation/store/notifications.js.map +0 -1
  418. package/dist/cjs/internals/simulation/store/state.js +0 -64
  419. package/dist/cjs/internals/simulation/store/state.js.map +0 -1
  420. package/dist/cjs/internals/simulation/store/store.js +0 -57
  421. package/dist/cjs/internals/simulation/store/store.js.map +0 -1
  422. package/dist/cjs/internals/simulation/store/ui.js +0 -48
  423. package/dist/cjs/internals/simulation/store/ui.js.map +0 -1
  424. package/dist/cjs/internals/structs.js +0 -165
  425. package/dist/cjs/internals/structs.js.map +0 -1
  426. package/dist/cjs/matchers.js +0 -120
  427. package/dist/cjs/matchers.js.map +0 -1
  428. package/dist/cjs/options.js +0 -23
  429. package/dist/cjs/options.js.map +0 -1
  430. package/dist/cjs/setup.js +0 -10
  431. package/dist/cjs/setup.js.map +0 -1
  432. package/dist/cjs/types.js +0 -6
  433. package/dist/cjs/types.js.map +0 -1
  434. package/dist/esm/environment.js +0 -121
  435. package/dist/esm/environment.js.map +0 -1
  436. package/dist/esm/helpers.js +0 -163
  437. package/dist/esm/helpers.js.map +0 -1
  438. package/dist/esm/index.js +0 -6
  439. package/dist/esm/index.js.map +0 -1
  440. package/dist/esm/internals/environment.js +0 -14
  441. package/dist/esm/internals/environment.js.map +0 -1
  442. package/dist/esm/internals/index.js +0 -8
  443. package/dist/esm/internals/index.js.map +0 -1
  444. package/dist/esm/internals/logger.js +0 -4
  445. package/dist/esm/internals/logger.js.map +0 -1
  446. package/dist/esm/internals/request.js +0 -77
  447. package/dist/esm/internals/request.js.map +0 -1
  448. package/dist/esm/internals/server.js +0 -64
  449. package/dist/esm/internals/server.js.map +0 -1
  450. package/dist/esm/internals/simulation/constants.js +0 -12
  451. package/dist/esm/internals/simulation/constants.js.map +0 -1
  452. package/dist/esm/internals/simulation/controllers.js +0 -90
  453. package/dist/esm/internals/simulation/controllers.js.map +0 -1
  454. package/dist/esm/internals/simulation/files.js +0 -19
  455. package/dist/esm/internals/simulation/files.js.map +0 -1
  456. package/dist/esm/internals/simulation/index.js +0 -7
  457. package/dist/esm/internals/simulation/index.js.map +0 -1
  458. package/dist/esm/internals/simulation/interface.js +0 -95
  459. package/dist/esm/internals/simulation/interface.js.map +0 -1
  460. package/dist/esm/internals/simulation/methods/constants.js +0 -69
  461. package/dist/esm/internals/simulation/methods/constants.js.map +0 -1
  462. package/dist/esm/internals/simulation/methods/hooks/encryption.js +0 -39
  463. package/dist/esm/internals/simulation/methods/hooks/encryption.js.map +0 -1
  464. package/dist/esm/internals/simulation/methods/hooks/get-locale.js +0 -13
  465. package/dist/esm/internals/simulation/methods/hooks/get-locale.js.map +0 -1
  466. package/dist/esm/internals/simulation/methods/hooks/index.js +0 -8
  467. package/dist/esm/internals/simulation/methods/hooks/index.js.map +0 -1
  468. package/dist/esm/internals/simulation/methods/hooks/interface.js +0 -18
  469. package/dist/esm/internals/simulation/methods/hooks/interface.js.map +0 -1
  470. package/dist/esm/internals/simulation/methods/hooks/notifications.js +0 -58
  471. package/dist/esm/internals/simulation/methods/hooks/notifications.js.map +0 -1
  472. package/dist/esm/internals/simulation/methods/hooks/show-dialog.js +0 -38
  473. package/dist/esm/internals/simulation/methods/hooks/show-dialog.js.map +0 -1
  474. package/dist/esm/internals/simulation/methods/hooks/state.js +0 -74
  475. package/dist/esm/internals/simulation/methods/hooks/state.js.map +0 -1
  476. package/dist/esm/internals/simulation/methods/index.js +0 -3
  477. package/dist/esm/internals/simulation/methods/index.js.map +0 -1
  478. package/dist/esm/internals/simulation/methods/specifications.js +0 -84
  479. package/dist/esm/internals/simulation/methods/specifications.js.map +0 -1
  480. package/dist/esm/internals/simulation/middleware/engine.js +0 -33
  481. package/dist/esm/internals/simulation/middleware/engine.js.map +0 -1
  482. package/dist/esm/internals/simulation/middleware/index.js +0 -3
  483. package/dist/esm/internals/simulation/middleware/index.js.map +0 -1
  484. package/dist/esm/internals/simulation/middleware/internal-methods/accounts.js +0 -31
  485. package/dist/esm/internals/simulation/middleware/internal-methods/accounts.js.map +0 -1
  486. package/dist/esm/internals/simulation/middleware/internal-methods/index.js +0 -3
  487. package/dist/esm/internals/simulation/middleware/internal-methods/index.js.map +0 -1
  488. package/dist/esm/internals/simulation/middleware/internal-methods/middleware.js +0 -37
  489. package/dist/esm/internals/simulation/middleware/internal-methods/middleware.js.map +0 -1
  490. package/dist/esm/internals/simulation/middleware/internal-methods/provider-state.js +0 -23
  491. package/dist/esm/internals/simulation/middleware/internal-methods/provider-state.js.map +0 -1
  492. package/dist/esm/internals/simulation/middleware/mock.js +0 -18
  493. package/dist/esm/internals/simulation/middleware/mock.js.map +0 -1
  494. package/dist/esm/internals/simulation/options.js +0 -20
  495. package/dist/esm/internals/simulation/options.js.map +0 -1
  496. package/dist/esm/internals/simulation/simulation.js +0 -128
  497. package/dist/esm/internals/simulation/simulation.js.map +0 -1
  498. package/dist/esm/internals/simulation/store/index.js +0 -6
  499. package/dist/esm/internals/simulation/store/index.js.map +0 -1
  500. package/dist/esm/internals/simulation/store/mocks.js +0 -32
  501. package/dist/esm/internals/simulation/store/mocks.js.map +0 -1
  502. package/dist/esm/internals/simulation/store/notifications.js +0 -30
  503. package/dist/esm/internals/simulation/store/notifications.js.map +0 -1
  504. package/dist/esm/internals/simulation/store/state.js +0 -47
  505. package/dist/esm/internals/simulation/store/state.js.map +0 -1
  506. package/dist/esm/internals/simulation/store/store.js +0 -50
  507. package/dist/esm/internals/simulation/store/store.js.map +0 -1
  508. package/dist/esm/internals/simulation/store/ui.js +0 -21
  509. package/dist/esm/internals/simulation/store/ui.js.map +0 -1
  510. package/dist/esm/internals/structs.js +0 -135
  511. package/dist/esm/internals/structs.js.map +0 -1
  512. package/dist/esm/matchers.js +0 -111
  513. package/dist/esm/matchers.js.map +0 -1
  514. package/dist/esm/options.js +0 -20
  515. package/dist/esm/options.js.map +0 -1
  516. package/dist/esm/setup.js +0 -6
  517. package/dist/esm/setup.js.map +0 -1
  518. package/dist/esm/types.js +0 -3
  519. package/dist/esm/types.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internals/server.ts"],"sourcesContent":["import type { SnapManifest } from '@metamask/snaps-utils';\nimport {\n assertIsSnapManifest,\n isDirectory,\n isFile,\n} from '@metamask/snaps-utils/node';\nimport { createModuleLogger } from '@metamask/utils';\nimport express from 'express';\nimport { promises as fs } from 'fs';\nimport type { Server } from 'http';\nimport { createServer } from 'http';\nimport { resolve as pathResolve } from 'path';\n\nimport type { SnapsEnvironmentOptions } from '../options';\nimport { rootLogger } from './logger';\n\nexport type ServerOptions = Required<\n // We need a double `Required` for the type to be inferred correctly.\n Required<SnapsEnvironmentOptions>['server']\n>;\n\n/**\n * Check that:\n *\n * - The root directory exists.\n * - The root directory contains a `snap.manifest.json` file.\n * - The file path in the manifest exists.\n *\n * @param root - The root directory.\n * @throws If any of the checks fail.\n */\nasync function assertRoot(root: string) {\n if (!root) {\n throw new Error('You must specify a root directory.');\n }\n\n if (!(await isDirectory(root, false))) {\n throw new Error(`Root directory \"${root}\" is not a directory.`);\n }\n\n const manifestPath = pathResolve(root, 'snap.manifest.json');\n const manifest: SnapManifest = await fs\n .readFile(manifestPath, 'utf8')\n .then(JSON.parse);\n\n assertIsSnapManifest(manifest);\n const filePath = pathResolve(root, manifest.source.location.npm.filePath);\n\n if (!(await isFile(filePath))) {\n throw new Error(\n `File \"${filePath}\" does not exist, or is not a file. Did you forget to build your snap?`,\n );\n }\n}\n\n/**\n * Start an HTTP server on `localhost` with a random port. This is used to serve\n * the static files for the environment.\n *\n * @param options - The options to use.\n * @param options.port - The port to use for the server.\n * @param options.root - The root directory to serve from the server.\n * @returns The HTTP server.\n */\nexport async function startServer(options: ServerOptions) {\n await assertRoot(options.root);\n\n const log = createModuleLogger(rootLogger, 'server');\n const app = express();\n\n app.use((_request, response, next) => {\n response.header('Access-Control-Allow-Origin', '*');\n response.header('Access-Control-Allow-Credentials', 'true');\n response.header('Access-Control-Allow-Methods', 'GET, OPTIONS');\n response.header('Access-Control-Allow-Headers', 'Content-Type');\n\n next();\n });\n\n app.use(express.static(pathResolve(process.cwd(), options.root)));\n\n const server = createServer(app);\n return await new Promise<Server>((resolve, reject) => {\n server.listen(options.port, () => {\n resolve(server);\n });\n\n server.on('error', (error) => {\n log(error);\n reject(error);\n });\n });\n}\n"],"mappings":";;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AACnC,OAAO,aAAa;AACpB,SAAS,YAAY,UAAU;AAE/B,SAAS,oBAAoB;AAC7B,SAAS,WAAW,mBAAmB;AAoBvC,eAAe,WAAW,MAAc;AACtC,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,oCAAoC;AAAA,EACtD;AAEA,MAAI,CAAE,MAAM,YAAY,MAAM,KAAK,GAAI;AACrC,UAAM,IAAI,MAAM,mBAAmB,IAAI,uBAAuB;AAAA,EAChE;AAEA,QAAM,eAAe,YAAY,MAAM,oBAAoB;AAC3D,QAAM,WAAyB,MAAM,GAClC,SAAS,cAAc,MAAM,EAC7B,KAAK,KAAK,KAAK;AAElB,uBAAqB,QAAQ;AAC7B,QAAM,WAAW,YAAY,MAAM,SAAS,OAAO,SAAS,IAAI,QAAQ;AAExE,MAAI,CAAE,MAAM,OAAO,QAAQ,GAAI;AAC7B,UAAM,IAAI;AAAA,MACR,SAAS,QAAQ;AAAA,IACnB;AAAA,EACF;AACF;AAWA,eAAsB,YAAY,SAAwB;AACxD,QAAM,WAAW,QAAQ,IAAI;AAE7B,QAAM,MAAM,mBAAmB,YAAY,QAAQ;AACnD,QAAM,MAAM,QAAQ;AAEpB,MAAI,IAAI,CAAC,UAAU,UAAU,SAAS;AACpC,aAAS,OAAO,+BAA+B,GAAG;AAClD,aAAS,OAAO,oCAAoC,MAAM;AAC1D,aAAS,OAAO,gCAAgC,cAAc;AAC9D,aAAS,OAAO,gCAAgC,cAAc;AAE9D,SAAK;AAAA,EACP,CAAC;AAED,MAAI,IAAI,QAAQ,OAAO,YAAY,QAAQ,IAAI,GAAG,QAAQ,IAAI,CAAC,CAAC;AAEhE,QAAM,SAAS,aAAa,GAAG;AAC/B,SAAO,MAAM,IAAI,QAAgB,CAAC,SAAS,WAAW;AACpD,WAAO,OAAO,QAAQ,MAAM,MAAM;AAChC,cAAQ,MAAM;AAAA,IAChB,CAAC;AAED,WAAO,GAAG,SAAS,CAAC,UAAU;AAC5B,UAAI,KAAK;AACT,aAAO,KAAK;AAAA,IACd,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/internals/environment.ts
2
+ var _utils = require('@metamask/utils');
3
+ function getEnvironment() {
4
+ _utils.assert.call(void 0,
5
+ typeof snapsEnvironment !== "undefined",
6
+ "Snaps environment not found. Make sure you have configured the environment correctly."
7
+ );
8
+ return snapsEnvironment;
9
+ }
10
+
11
+
12
+
13
+ exports.getEnvironment = getEnvironment;
14
+ //# sourceMappingURL=chunk-7JLVQJK7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internals/environment.ts"],"names":[],"mappings":";AAAA,SAAS,cAAc;AAQhB,SAAS,iBAAiB;AAG/B;AAAA,IACE,OAAO,qBAAqB;AAAA,IAC5B;AAAA,EACF;AAEA,SAAO;AACT","sourcesContent":["import { assert } from '@metamask/utils';\n\n/**\n * Get the Snaps environment. This asserts that the environment has been\n * configured.\n *\n * @returns The Snaps environment.\n */\nexport function getEnvironment() {\n // `snapsEnvironment` is a global variable that is set by the Jest\n // environment.\n assert(\n typeof snapsEnvironment !== 'undefined',\n 'Snaps environment not found. Make sure you have configured the environment correctly.',\n );\n\n return snapsEnvironment;\n}\n"]}
@@ -0,0 +1,22 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/internals/simulation/methods/hooks/encryption.ts
2
+ function encryptImplementation(password, value) {
3
+ return JSON.stringify({
4
+ password,
5
+ value
6
+ });
7
+ }
8
+ function decryptImplementation(password, value) {
9
+ const decryptedValue = JSON.parse(value);
10
+ if (decryptedValue.password !== password) {
11
+ throw new Error(
12
+ "Incorrect password. This is a bug in `@metamask/snaps-jest`, please report it."
13
+ );
14
+ }
15
+ return decryptedValue.value;
16
+ }
17
+
18
+
19
+
20
+
21
+ exports.encryptImplementation = encryptImplementation; exports.decryptImplementation = decryptImplementation;
22
+ //# sourceMappingURL=chunk-AH7YNG6N.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internals/simulation/methods/hooks/encryption.ts"],"names":[],"mappings":";AAeO,SAAS,sBAAsB,UAAkB,OAAa;AACnE,SAAO,KAAK,UAAU;AAAA,IACpB;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAeO,SAAS,sBAAsB,UAAkB,OAAe;AACrE,QAAM,iBAAiB,KAAK,MAAM,KAAK;AACvC,MAAI,eAAe,aAAa,UAAU;AACxC,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,eAAe;AACxB","sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * Mocks encrypting a value using a password. This is not a real encryption\n * method, but rather is used to simulate encryption in the tests.\n *\n * Ideally we would use a real encryption method, such as\n * `@metamask/browser-passworder`, but it doesn't seem to work with Node.js 18\n * without some mocking. We can switch to a real encryption method once we\n * drop support for Node.js 18.\n *\n * @param password - The password to use.\n * @param value - The value to encrypt.\n * @returns The \"encrypted\" value.\n */\nexport function encryptImplementation(password: string, value: Json) {\n return JSON.stringify({\n password,\n value,\n });\n}\n\n/**\n * Mocks decrypting a value using a password. This is not a real encryption\n * method, but rather is used to simulate encryption in the tests.\n *\n * Ideally we would use a real decryption method, such as\n * `@metamask/browser-passworder`, but it doesn't seem to work with Node.js 18\n * without some mocking. We can switch to a real encryption method once we\n * drop support for Node.js 18.\n *\n * @param password - The password to use.\n * @param value - The value to decrypt.\n * @returns The \"decrypted\" value.\n */\nexport function decryptImplementation(password: string, value: string) {\n const decryptedValue = JSON.parse(value);\n if (decryptedValue.password !== password) {\n throw new Error(\n 'Incorrect password. This is a bug in `@metamask/snaps-jest`, please report it.',\n );\n }\n\n return decryptedValue.value;\n}\n"]}
@@ -0,0 +1,36 @@
1
+ // src/internals/simulation/store/notifications.ts
2
+ import { createSelector, createSlice } from "@reduxjs/toolkit";
3
+ var INITIAL_STATE = {
4
+ notifications: []
5
+ };
6
+ var notificationsSlice = createSlice({
7
+ name: "notifications",
8
+ initialState: INITIAL_STATE,
9
+ reducers: {
10
+ addNotification: (state, action) => {
11
+ state.notifications.push(action.payload);
12
+ },
13
+ removeNotification: (state, action) => {
14
+ state.notifications = state.notifications.filter(
15
+ (notification) => notification.id !== action.payload
16
+ );
17
+ },
18
+ clearNotifications: (state) => {
19
+ state.notifications = [];
20
+ }
21
+ }
22
+ });
23
+ var { addNotification, removeNotification, clearNotifications } = notificationsSlice.actions;
24
+ var getNotifications = createSelector(
25
+ (state) => state.notifications,
26
+ ({ notifications }) => notifications
27
+ );
28
+
29
+ export {
30
+ notificationsSlice,
31
+ addNotification,
32
+ removeNotification,
33
+ clearNotifications,
34
+ getNotifications
35
+ };
36
+ //# sourceMappingURL=chunk-AIZADBRK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internals/simulation/store/notifications.ts"],"sourcesContent":["import type { NotificationType } from '@metamask/snaps-sdk';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSelector, createSlice } from '@reduxjs/toolkit';\n\nimport type { ApplicationState } from './store';\n\n/**\n * A notification object.\n *\n * @property id - A unique ID for the notification.\n * @property message - The notification message.\n * @property type - The notification type.\n */\nexport type Notification = {\n id: string;\n message: string;\n type: NotificationType;\n};\n\n/**\n * The notifications state.\n *\n * @property notifications - An array of notifications.\n */\nexport type NotificationsState = {\n notifications: Notification[];\n};\n\n/**\n * The initial notifications state.\n */\nconst INITIAL_STATE: NotificationsState = {\n notifications: [],\n};\n\nexport const notificationsSlice = createSlice({\n name: 'notifications',\n initialState: INITIAL_STATE,\n reducers: {\n addNotification: (state, action: PayloadAction<Notification>) => {\n state.notifications.push(action.payload);\n },\n removeNotification: (state, action: PayloadAction<string>) => {\n state.notifications = state.notifications.filter(\n (notification) => notification.id !== action.payload,\n );\n },\n clearNotifications: (state) => {\n state.notifications = [];\n },\n },\n});\n\nexport const { addNotification, removeNotification, clearNotifications } =\n notificationsSlice.actions;\n\n/**\n * Get the notifications from the state.\n *\n * @param state - The application state.\n * @returns An array of notifications.\n */\nexport const getNotifications = createSelector(\n (state: ApplicationState) => state.notifications,\n ({ notifications }) => notifications,\n);\n"],"mappings":";AAEA,SAAS,gBAAgB,mBAAmB;AA6B5C,IAAM,gBAAoC;AAAA,EACxC,eAAe,CAAC;AAClB;AAEO,IAAM,qBAAqB,YAAY;AAAA,EAC5C,MAAM;AAAA,EACN,cAAc;AAAA,EACd,UAAU;AAAA,IACR,iBAAiB,CAAC,OAAO,WAAwC;AAC/D,YAAM,cAAc,KAAK,OAAO,OAAO;AAAA,IACzC;AAAA,IACA,oBAAoB,CAAC,OAAO,WAAkC;AAC5D,YAAM,gBAAgB,MAAM,cAAc;AAAA,QACxC,CAAC,iBAAiB,aAAa,OAAO,OAAO;AAAA,MAC/C;AAAA,IACF;AAAA,IACA,oBAAoB,CAAC,UAAU;AAC7B,YAAM,gBAAgB,CAAC;AAAA,IACzB;AAAA,EACF;AACF,CAAC;AAEM,IAAM,EAAE,iBAAiB,oBAAoB,mBAAmB,IACrE,mBAAmB;AAQd,IAAM,mBAAmB;AAAA,EAC9B,CAAC,UAA4B,MAAM;AAAA,EACnC,CAAC,EAAE,cAAc,MAAM;AACzB;","names":[]}
@@ -0,0 +1,42 @@
1
+ import {
2
+ addNotification
3
+ } from "./chunk-AIZADBRK.mjs";
4
+
5
+ // src/internals/simulation/methods/hooks/notifications.ts
6
+ import { NotificationType } from "@metamask/snaps-sdk";
7
+ import { nanoid } from "@reduxjs/toolkit";
8
+ import { put } from "redux-saga/effects";
9
+ function* showNativeNotificationImplementation(_snapId, { message }) {
10
+ yield put(
11
+ addNotification({ id: nanoid(), type: NotificationType.Native, message })
12
+ );
13
+ return null;
14
+ }
15
+ function getShowNativeNotificationImplementation(runSaga) {
16
+ return async (...args) => {
17
+ return await runSaga(
18
+ showNativeNotificationImplementation,
19
+ ...args
20
+ ).toPromise();
21
+ };
22
+ }
23
+ function* showInAppNotificationImplementation(_snapId, { message }) {
24
+ yield put(
25
+ addNotification({ id: nanoid(), type: NotificationType.InApp, message })
26
+ );
27
+ return null;
28
+ }
29
+ function getShowInAppNotificationImplementation(runSaga) {
30
+ return async (...args) => {
31
+ return await runSaga(
32
+ showInAppNotificationImplementation,
33
+ ...args
34
+ ).toPromise();
35
+ };
36
+ }
37
+
38
+ export {
39
+ getShowNativeNotificationImplementation,
40
+ getShowInAppNotificationImplementation
41
+ };
42
+ //# sourceMappingURL=chunk-AKFRQ5EJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internals/simulation/methods/hooks/notifications.ts"],"sourcesContent":["import type { NotifyParams } from '@metamask/snaps-sdk';\nimport { NotificationType } from '@metamask/snaps-sdk';\nimport { nanoid } from '@reduxjs/toolkit';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { addNotification } from '../../store';\n\n/**\n * Show a native notification to the user.\n *\n * @param _snapId - The ID of the Snap that created the notification.\n * @param options - The notification options.\n * @param options.message - The message to show in the notification.\n * @yields Adds the notification to the store.\n * @returns `null`.\n */\nfunction* showNativeNotificationImplementation(\n _snapId: string,\n { message }: NotifyParams,\n): SagaIterator {\n yield put(\n addNotification({ id: nanoid(), type: NotificationType.Native, message }),\n );\n\n return null;\n}\n\n/**\n * Get a method that can be used to show a native notification.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to show a native notification.\n */\nexport function getShowNativeNotificationImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (\n ...args: Parameters<typeof showNativeNotificationImplementation>\n ) => {\n return await runSaga(\n showNativeNotificationImplementation,\n ...args,\n ).toPromise();\n };\n}\n\n/**\n * Show an in-app notification to the user.\n *\n * @param _snapId - The ID of the Snap that created the notification.\n * @param options - The notification options.\n * @param options.message - The message to show in the notification.\n * @yields Adds the notification to the store.\n * @returns `null`.\n */\nfunction* showInAppNotificationImplementation(\n _snapId: string,\n { message }: NotifyParams,\n): SagaIterator<null> {\n yield put(\n addNotification({ id: nanoid(), type: NotificationType.InApp, message }),\n );\n\n return null;\n}\n\n/**\n * Get a method that can be used to show an in-app notification.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to show an in-app notification.\n */\nexport function getShowInAppNotificationImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (\n ...args: Parameters<typeof showInAppNotificationImplementation>\n ) => {\n return await runSaga(\n showInAppNotificationImplementation,\n ...args,\n ).toPromise();\n };\n}\n"],"mappings":";;;;;AACA,SAAS,wBAAwB;AACjC,SAAS,cAAc;AAEvB,SAAS,WAAW;AAcpB,UAAU,qCACR,SACA,EAAE,QAAQ,GACI;AACd,QAAM;AAAA,IACJ,gBAAgB,EAAE,IAAI,OAAO,GAAG,MAAM,iBAAiB,QAAQ,QAAQ,CAAC;AAAA,EAC1E;AAEA,SAAO;AACT;AAQO,SAAS,wCACd,SACA;AACA,SAAO,UACF,SACA;AACH,WAAO,MAAM;AAAA,MACX;AAAA,MACA,GAAG;AAAA,IACL,EAAE,UAAU;AAAA,EACd;AACF;AAWA,UAAU,oCACR,SACA,EAAE,QAAQ,GACU;AACpB,QAAM;AAAA,IACJ,gBAAgB,EAAE,IAAI,OAAO,GAAG,MAAM,iBAAiB,OAAO,QAAQ,CAAC;AAAA,EACzE;AAEA,SAAO;AACT;AAQO,SAAS,uCACd,SACA;AACA,SAAO,UACF,SACA;AACH,WAAO,MAAM;AAAA,MACX;AAAA,MACA,GAAG;AAAA,IACL,EAAE,UAAU;AAAA,EACd;AACF;","names":[]}
@@ -0,0 +1,28 @@
1
+ // src/options.ts
2
+ import {
3
+ boolean,
4
+ create,
5
+ defaulted,
6
+ number,
7
+ object,
8
+ string,
9
+ type
10
+ } from "superstruct";
11
+ var SnapsEnvironmentOptionsStruct = type({
12
+ server: defaulted(
13
+ object({
14
+ enabled: defaulted(boolean(), true),
15
+ port: defaulted(number(), 0),
16
+ root: defaulted(string(), process.cwd())
17
+ }),
18
+ {}
19
+ )
20
+ });
21
+ function getOptions(testEnvironmentOptions) {
22
+ return create(testEnvironmentOptions, SnapsEnvironmentOptionsStruct);
23
+ }
24
+
25
+ export {
26
+ getOptions
27
+ };
28
+ //# sourceMappingURL=chunk-AUB7XPDH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/options.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport {\n boolean,\n create,\n defaulted,\n number,\n object,\n string,\n type,\n} from 'superstruct';\n\nconst SnapsEnvironmentOptionsStruct = type({\n server: defaulted(\n object({\n enabled: defaulted(boolean(), true),\n port: defaulted(number(), 0),\n root: defaulted(string(), process.cwd()),\n }),\n {},\n ),\n});\n\n/**\n * The options for the environment. These can be specified in the Jest\n * configuration under `testEnvironmentOptions`.\n *\n * @example\n * {\n * \"testEnvironment\": \"@metamask/snaps-jest\",\n * \"testEnvironmentOptions\": {\n * \"executionEnvironmentUrl\": \"http://localhost:8080\",\n * \"server\": {\n * \"port\": 8080,\n * /* ... *\\/\n * }\n * }\n * }\n * @property server - The options for the built-in HTTP server.\n * @property server.enabled - Whether to run the built-in HTTP server. Defaults\n * to `true`.\n * @property server.port - The port to use for the built-in HTTP server. If this\n * is not provided, a random available port will be used.\n * @property server.root - The root directory to serve from the built-in HTTP\n * server. Defaults to the current working directory. This is assumed to be the\n * directory containing the snap manifest and `dist` files. If this is a\n * relative path, it will be resolved relative to the current working directory.\n */\nexport type SnapsEnvironmentOptions = Infer<\n typeof SnapsEnvironmentOptionsStruct\n>;\n\n/**\n * Get the environment options. This validates the options, and returns the\n * default options if none are provided.\n *\n * @param testEnvironmentOptions - The test environment options as defined in\n * the Jest configuration.\n * @returns The environment options.\n */\nexport function getOptions(testEnvironmentOptions: Record<string, unknown>) {\n return create(testEnvironmentOptions, SnapsEnvironmentOptionsStruct);\n}\n"],"mappings":";AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,IAAM,gCAAgC,KAAK;AAAA,EACzC,QAAQ;AAAA,IACN,OAAO;AAAA,MACL,SAAS,UAAU,QAAQ,GAAG,IAAI;AAAA,MAClC,MAAM,UAAU,OAAO,GAAG,CAAC;AAAA,MAC3B,MAAM,UAAU,OAAO,GAAG,QAAQ,IAAI,CAAC;AAAA,IACzC,CAAC;AAAA,IACD,CAAC;AAAA,EACH;AACF,CAAC;AAuCM,SAAS,WAAW,wBAAiD;AAC1E,SAAO,OAAO,wBAAwB,6BAA6B;AACrE;","names":[]}
@@ -0,0 +1,20 @@
1
+ import {
2
+ getJsonRpcMock
3
+ } from "./chunk-J2ID3DS7.mjs";
4
+
5
+ // src/internals/simulation/middleware/mock.ts
6
+ function createMockMiddleware(store) {
7
+ return function mockMiddleware(request, response, next, end) {
8
+ const result = getJsonRpcMock(store.getState(), request.method);
9
+ if (result) {
10
+ response.result = result;
11
+ return end();
12
+ }
13
+ return next();
14
+ };
15
+ }
16
+
17
+ export {
18
+ createMockMiddleware
19
+ };
20
+ //# sourceMappingURL=chunk-BJMTD7H2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internals/simulation/middleware/mock.ts"],"sourcesContent":["import type { JsonRpcMiddleware } from '@metamask/json-rpc-engine';\nimport type { Json, JsonRpcParams } from '@metamask/utils';\n\nimport type { Store } from '../store';\nimport { getJsonRpcMock } from '../store/mocks';\n\n/**\n * Create a middleware for handling JSON-RPC methods that have been mocked.\n *\n * @param store - The Redux store to use.\n * @returns A middleware function.\n */\nexport function createMockMiddleware(\n store: Store,\n): JsonRpcMiddleware<JsonRpcParams, Json> {\n return function mockMiddleware(request, response, next, end) {\n const result = getJsonRpcMock(store.getState(), request.method);\n if (result) {\n response.result = result;\n return end();\n }\n\n return next();\n };\n}\n"],"mappings":";;;;;AAYO,SAAS,qBACd,OACwC;AACxC,SAAO,SAAS,eAAe,SAAS,UAAU,MAAM,KAAK;AAC3D,UAAM,SAAS,eAAe,MAAM,SAAS,GAAG,QAAQ,MAAM;AAC9D,QAAI,QAAQ;AACV,eAAS,SAAS;AAClB,aAAO,IAAI;AAAA,IACb;AAEA,WAAO,KAAK;AAAA,EACd;AACF;","names":[]}
@@ -0,0 +1,233 @@
1
+ // src/internals/structs.ts
2
+ import {
3
+ NotificationType,
4
+ ComponentStruct,
5
+ enumValue
6
+ } from "@metamask/snaps-sdk";
7
+ import {
8
+ bytesToHex,
9
+ JsonStruct,
10
+ StrictHexStruct,
11
+ valueToBytes
12
+ } from "@metamask/utils";
13
+ import { randomBytes } from "crypto";
14
+ import {
15
+ array,
16
+ assign,
17
+ bigint,
18
+ coerce,
19
+ defaulted,
20
+ instance,
21
+ literal,
22
+ number,
23
+ object,
24
+ optional,
25
+ string,
26
+ type,
27
+ union,
28
+ record,
29
+ any
30
+ } from "superstruct";
31
+ var BytesLikeStruct = union([
32
+ bigint(),
33
+ number(),
34
+ string(),
35
+ instance(Uint8Array)
36
+ ]);
37
+ var TransactionOptionsStruct = object({
38
+ /**
39
+ * The CAIP-2 chain ID to send the transaction on. Defaults to `eip155:1`.
40
+ */
41
+ chainId: defaulted(string(), "eip155:1"),
42
+ /**
43
+ * The origin to send the transaction from. Defaults to `metamask.io`.
44
+ */
45
+ origin: defaulted(string(), "metamask.io"),
46
+ /**
47
+ * The address to send the transaction from. Defaults to a randomly generated
48
+ * address.
49
+ */
50
+ // TODO: Move this coercer to `@metamask/utils`.
51
+ from: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {
52
+ if (value) {
53
+ return bytesToHex(valueToBytes(value));
54
+ }
55
+ return bytesToHex(randomBytes(20));
56
+ }),
57
+ /**
58
+ * The address to send the transaction to. Defaults to a randomly generated
59
+ * address.
60
+ */
61
+ // TODO: Move this coercer to `@metamask/utils`.
62
+ to: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {
63
+ if (value) {
64
+ return bytesToHex(valueToBytes(value));
65
+ }
66
+ return bytesToHex(randomBytes(20));
67
+ }),
68
+ /**
69
+ * The value to send with the transaction. The value may be specified as a
70
+ * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.
71
+ */
72
+ value: defaulted(
73
+ coerce(
74
+ StrictHexStruct,
75
+ BytesLikeStruct,
76
+ (value) => bytesToHex(valueToBytes(value))
77
+ ),
78
+ "0x0"
79
+ ),
80
+ /**
81
+ * The gas limit to use for the transaction. The gas limit may be specified
82
+ * as a `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `21_000`.
83
+ */
84
+ gasLimit: defaulted(
85
+ coerce(
86
+ StrictHexStruct,
87
+ BytesLikeStruct,
88
+ (value) => bytesToHex(valueToBytes(value))
89
+ ),
90
+ valueToBytes(21e3)
91
+ ),
92
+ /**
93
+ * The max fee per gas (in Wei) to use for the transaction. The max fee per
94
+ * gas may be specified as a `number`, `bigint`, `string`, or `Uint8Array`.
95
+ * Defaults to `1`.
96
+ */
97
+ maxFeePerGas: defaulted(
98
+ coerce(
99
+ StrictHexStruct,
100
+ BytesLikeStruct,
101
+ (value) => bytesToHex(valueToBytes(value))
102
+ ),
103
+ valueToBytes(1)
104
+ ),
105
+ /**
106
+ * The max priority fee per gas (in Wei) to use for the transaction. The max
107
+ * priority fee per gas may be specified as a `number`, `bigint`, `string`,
108
+ * or `Uint8Array`. Defaults to `1`.
109
+ */
110
+ maxPriorityFeePerGas: defaulted(
111
+ coerce(
112
+ StrictHexStruct,
113
+ BytesLikeStruct,
114
+ (value) => bytesToHex(valueToBytes(value))
115
+ ),
116
+ valueToBytes(1)
117
+ ),
118
+ /**
119
+ * The nonce to use for the transaction. The nonce may be specified as a
120
+ * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.
121
+ */
122
+ nonce: defaulted(
123
+ coerce(
124
+ StrictHexStruct,
125
+ BytesLikeStruct,
126
+ (value) => bytesToHex(valueToBytes(value))
127
+ ),
128
+ valueToBytes(0)
129
+ ),
130
+ /**
131
+ * The data to send with the transaction. The data may be specified as a
132
+ * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0x`.
133
+ */
134
+ data: defaulted(
135
+ coerce(
136
+ union([StrictHexStruct, literal("0x")]),
137
+ BytesLikeStruct,
138
+ (value) => bytesToHex(valueToBytes(value))
139
+ ),
140
+ "0x"
141
+ )
142
+ });
143
+ var SignatureOptionsStruct = object({
144
+ /**
145
+ * The origin making the signature request.
146
+ */
147
+ origin: defaulted(string(), "metamask.io"),
148
+ /**
149
+ * The address signing the signature request. Defaults to a randomly generated
150
+ * address.
151
+ */
152
+ from: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {
153
+ if (value) {
154
+ return bytesToHex(valueToBytes(value));
155
+ }
156
+ return bytesToHex(randomBytes(20));
157
+ }),
158
+ /**
159
+ * The data to send with the transaction. The data may be specified as a
160
+ * `string`, an object, or an array of objects. This covers the data types
161
+ * for the supported signature methods. Defaults to `0x`.
162
+ */
163
+ data: defaulted(
164
+ union([
165
+ StrictHexStruct,
166
+ literal("0x"),
167
+ record(string(), any()),
168
+ array(record(string(), any()))
169
+ ]),
170
+ "0x"
171
+ ),
172
+ /**
173
+ * The signature method being used.
174
+ */
175
+ signatureMethod: defaulted(
176
+ union([
177
+ literal("eth_sign"),
178
+ literal("personal_sign"),
179
+ literal("eth_signTypedData"),
180
+ literal("eth_signTypedData_v3"),
181
+ literal("eth_signTypedData_v4")
182
+ ]),
183
+ "personal_sign"
184
+ )
185
+ });
186
+ var SnapOptionsStruct = object({
187
+ /**
188
+ * The timeout in milliseconds to use for requests to the snap. Defaults to
189
+ * `1000`.
190
+ */
191
+ timeout: defaulted(optional(number()), 1e3)
192
+ });
193
+ var JsonRpcMockOptionsStruct = object({
194
+ method: string(),
195
+ result: JsonStruct
196
+ });
197
+ var InterfaceStruct = type({
198
+ content: optional(ComponentStruct)
199
+ });
200
+ var SnapResponseStruct = assign(
201
+ InterfaceStruct,
202
+ object({
203
+ id: string(),
204
+ response: union([
205
+ object({
206
+ result: JsonStruct
207
+ }),
208
+ object({
209
+ error: JsonStruct
210
+ })
211
+ ]),
212
+ notifications: array(
213
+ object({
214
+ id: string(),
215
+ message: string(),
216
+ type: union([
217
+ enumValue(NotificationType.InApp),
218
+ enumValue(NotificationType.Native)
219
+ ])
220
+ })
221
+ )
222
+ })
223
+ );
224
+
225
+ export {
226
+ TransactionOptionsStruct,
227
+ SignatureOptionsStruct,
228
+ SnapOptionsStruct,
229
+ JsonRpcMockOptionsStruct,
230
+ InterfaceStruct,
231
+ SnapResponseStruct
232
+ };
233
+ //# sourceMappingURL=chunk-BN5VBVT3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internals/structs.ts"],"sourcesContent":["import {\n NotificationType,\n ComponentStruct,\n enumValue,\n} from '@metamask/snaps-sdk';\nimport {\n bytesToHex,\n JsonStruct,\n StrictHexStruct,\n valueToBytes,\n} from '@metamask/utils';\nimport { randomBytes } from 'crypto';\nimport {\n array,\n assign,\n bigint,\n coerce,\n defaulted,\n instance,\n literal,\n number,\n object,\n optional,\n string,\n type,\n union,\n record,\n any,\n} from 'superstruct';\n\n// TODO: Export this from `@metamask/utils` instead.\nconst BytesLikeStruct = union([\n bigint(),\n number(),\n string(),\n instance(Uint8Array),\n]);\n\nexport const TransactionOptionsStruct = object({\n /**\n * The CAIP-2 chain ID to send the transaction on. Defaults to `eip155:1`.\n */\n chainId: defaulted(string(), 'eip155:1'),\n\n /**\n * The origin to send the transaction from. Defaults to `metamask.io`.\n */\n origin: defaulted(string(), 'metamask.io'),\n\n /**\n * The address to send the transaction from. Defaults to a randomly generated\n * address.\n */\n // TODO: Move this coercer to `@metamask/utils`.\n from: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {\n if (value) {\n return bytesToHex(valueToBytes(value));\n }\n\n return bytesToHex(randomBytes(20));\n }),\n\n /**\n * The address to send the transaction to. Defaults to a randomly generated\n * address.\n */\n // TODO: Move this coercer to `@metamask/utils`.\n to: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {\n if (value) {\n return bytesToHex(valueToBytes(value));\n }\n\n return bytesToHex(randomBytes(20));\n }),\n\n /**\n * The value to send with the transaction. The value may be specified as a\n * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.\n */\n value: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n '0x0',\n ),\n\n /**\n * The gas limit to use for the transaction. The gas limit may be specified\n * as a `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `21_000`.\n */\n gasLimit: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(21_000),\n ),\n\n /**\n * The max fee per gas (in Wei) to use for the transaction. The max fee per\n * gas may be specified as a `number`, `bigint`, `string`, or `Uint8Array`.\n * Defaults to `1`.\n */\n maxFeePerGas: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(1),\n ),\n\n /**\n * The max priority fee per gas (in Wei) to use for the transaction. The max\n * priority fee per gas may be specified as a `number`, `bigint`, `string`,\n * or `Uint8Array`. Defaults to `1`.\n */\n maxPriorityFeePerGas: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(1),\n ),\n\n /**\n * The nonce to use for the transaction. The nonce may be specified as a\n * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.\n */\n nonce: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(0),\n ),\n\n /**\n * The data to send with the transaction. The data may be specified as a\n * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0x`.\n */\n data: defaulted(\n coerce(union([StrictHexStruct, literal('0x')]), BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n '0x',\n ),\n});\n\nexport const SignatureOptionsStruct = object({\n /**\n * The origin making the signature request.\n */\n origin: defaulted(string(), 'metamask.io'),\n\n /**\n * The address signing the signature request. Defaults to a randomly generated\n * address.\n */\n from: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {\n if (value) {\n return bytesToHex(valueToBytes(value));\n }\n\n return bytesToHex(randomBytes(20));\n }),\n\n /**\n * The data to send with the transaction. The data may be specified as a\n * `string`, an object, or an array of objects. This covers the data types\n * for the supported signature methods. Defaults to `0x`.\n */\n data: defaulted(\n union([\n StrictHexStruct,\n literal('0x'),\n record(string(), any()),\n array(record(string(), any())),\n ]),\n '0x',\n ),\n\n /**\n * The signature method being used.\n */\n signatureMethod: defaulted(\n union([\n literal('eth_sign'),\n literal('personal_sign'),\n literal('eth_signTypedData'),\n literal('eth_signTypedData_v3'),\n literal('eth_signTypedData_v4'),\n ]),\n 'personal_sign',\n ),\n});\n\nexport const SnapOptionsStruct = object({\n /**\n * The timeout in milliseconds to use for requests to the snap. Defaults to\n * `1000`.\n */\n timeout: defaulted(optional(number()), 1000),\n});\n\nexport const JsonRpcMockOptionsStruct = object({\n method: string(),\n result: JsonStruct,\n});\n\nexport const InterfaceStruct = type({\n content: optional(ComponentStruct),\n});\n\nexport const SnapResponseStruct = assign(\n InterfaceStruct,\n object({\n id: string(),\n\n response: union([\n object({\n result: JsonStruct,\n }),\n object({\n error: JsonStruct,\n }),\n ]),\n\n notifications: array(\n object({\n id: string(),\n message: string(),\n type: union([\n enumValue(NotificationType.InApp),\n enumValue(NotificationType.Native),\n ]),\n }),\n ),\n }),\n);\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B;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,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,IAAM,kBAAkB,MAAM;AAAA,EAC5B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS,UAAU;AACrB,CAAC;AAEM,IAAM,2BAA2B,OAAO;AAAA;AAAA;AAAA;AAAA,EAI7C,SAAS,UAAU,OAAO,GAAG,UAAU;AAAA;AAAA;AAAA;AAAA,EAKvC,QAAQ,UAAU,OAAO,GAAG,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOzC,MAAM,OAAO,iBAAiB,SAAS,eAAe,GAAG,CAAC,UAAU;AAClE,QAAI,OAAO;AACT,aAAO,WAAW,aAAa,KAAK,CAAC;AAAA,IACvC;AAEA,WAAO,WAAW,YAAY,EAAE,CAAC;AAAA,EACnC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOD,IAAI,OAAO,iBAAiB,SAAS,eAAe,GAAG,CAAC,UAAU;AAChE,QAAI,OAAO;AACT,aAAO,WAAW,aAAa,KAAK,CAAC;AAAA,IACvC;AAEA,WAAO,WAAW,YAAY,EAAE,CAAC;AAAA,EACnC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMD,OAAO;AAAA,IACL;AAAA,MAAO;AAAA,MAAiB;AAAA,MAAiB,CAAC,UACxC,WAAW,aAAa,KAAK,CAAC;AAAA,IAChC;AAAA,IACA;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU;AAAA,IACR;AAAA,MAAO;AAAA,MAAiB;AAAA,MAAiB,CAAC,UACxC,WAAW,aAAa,KAAK,CAAC;AAAA,IAChC;AAAA,IACA,aAAa,IAAM;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,cAAc;AAAA,IACZ;AAAA,MAAO;AAAA,MAAiB;AAAA,MAAiB,CAAC,UACxC,WAAW,aAAa,KAAK,CAAC;AAAA,IAChC;AAAA,IACA,aAAa,CAAC;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,sBAAsB;AAAA,IACpB;AAAA,MAAO;AAAA,MAAiB;AAAA,MAAiB,CAAC,UACxC,WAAW,aAAa,KAAK,CAAC;AAAA,IAChC;AAAA,IACA,aAAa,CAAC;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO;AAAA,IACL;AAAA,MAAO;AAAA,MAAiB;AAAA,MAAiB,CAAC,UACxC,WAAW,aAAa,KAAK,CAAC;AAAA,IAChC;AAAA,IACA,aAAa,CAAC;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM;AAAA,IACJ;AAAA,MAAO,MAAM,CAAC,iBAAiB,QAAQ,IAAI,CAAC,CAAC;AAAA,MAAG;AAAA,MAAiB,CAAC,UAChE,WAAW,aAAa,KAAK,CAAC;AAAA,IAChC;AAAA,IACA;AAAA,EACF;AACF,CAAC;AAEM,IAAM,yBAAyB,OAAO;AAAA;AAAA;AAAA;AAAA,EAI3C,QAAQ,UAAU,OAAO,GAAG,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,EAMzC,MAAM,OAAO,iBAAiB,SAAS,eAAe,GAAG,CAAC,UAAU;AAClE,QAAI,OAAO;AACT,aAAO,WAAW,aAAa,KAAK,CAAC;AAAA,IACvC;AAEA,WAAO,WAAW,YAAY,EAAE,CAAC;AAAA,EACnC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOD,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ;AAAA,MACA,QAAQ,IAAI;AAAA,MACZ,OAAO,OAAO,GAAG,IAAI,CAAC;AAAA,MACtB,MAAM,OAAO,OAAO,GAAG,IAAI,CAAC,CAAC;AAAA,IAC/B,CAAC;AAAA,IACD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,iBAAiB;AAAA,IACf,MAAM;AAAA,MACJ,QAAQ,UAAU;AAAA,MAClB,QAAQ,eAAe;AAAA,MACvB,QAAQ,mBAAmB;AAAA,MAC3B,QAAQ,sBAAsB;AAAA,MAC9B,QAAQ,sBAAsB;AAAA,IAChC,CAAC;AAAA,IACD;AAAA,EACF;AACF,CAAC;AAEM,IAAM,oBAAoB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtC,SAAS,UAAU,SAAS,OAAO,CAAC,GAAG,GAAI;AAC7C,CAAC;AAEM,IAAM,2BAA2B,OAAO;AAAA,EAC7C,QAAQ,OAAO;AAAA,EACf,QAAQ;AACV,CAAC;AAEM,IAAM,kBAAkB,KAAK;AAAA,EAClC,SAAS,SAAS,eAAe;AACnC,CAAC;AAEM,IAAM,qBAAqB;AAAA,EAChC;AAAA,EACA,OAAO;AAAA,IACL,IAAI,OAAO;AAAA,IAEX,UAAU,MAAM;AAAA,MACd,OAAO;AAAA,QACL,QAAQ;AAAA,MACV,CAAC;AAAA,MACD,OAAO;AAAA,QACL,OAAO;AAAA,MACT,CAAC;AAAA,IACH,CAAC;AAAA,IAED,eAAe;AAAA,MACb,OAAO;AAAA,QACL,IAAI,OAAO;AAAA,QACX,SAAS,OAAO;AAAA,QAChB,MAAM,MAAM;AAAA,UACV,UAAU,iBAAiB,KAAK;AAAA,UAChC,UAAU,iBAAiB,MAAM;AAAA,QACnC,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -0,0 +1,22 @@
1
+ // src/internals/simulation/middleware/internal-methods/accounts.ts
2
+ import { BIP44Node } from "@metamask/key-tree";
3
+ async function getAccountsHandler(_request, response, _next, end, hooks) {
4
+ const { getMnemonic } = hooks;
5
+ const node = await BIP44Node.fromDerivationPath({
6
+ derivationPath: [
7
+ await getMnemonic(),
8
+ `bip32:44'`,
9
+ `bip32:60'`,
10
+ `bip32:0'`,
11
+ `bip32:0`,
12
+ `bip32:0`
13
+ ]
14
+ });
15
+ response.result = [node.address];
16
+ return end();
17
+ }
18
+
19
+ export {
20
+ getAccountsHandler
21
+ };
22
+ //# sourceMappingURL=chunk-CKOGTHM4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internals/simulation/middleware/internal-methods/accounts.ts"],"sourcesContent":["import type {\n JsonRpcEngineEndCallback,\n JsonRpcEngineNextCallback,\n} from '@metamask/json-rpc-engine';\nimport { BIP44Node } from '@metamask/key-tree';\nimport type {\n Json,\n JsonRpcRequest,\n PendingJsonRpcResponse,\n} from '@metamask/utils';\n\nexport type GetAccountsHandlerHooks = {\n getMnemonic: () => Promise<Uint8Array>;\n};\n\n/**\n * A mock handler for account related methods that always returns the first\n * address for the selected secret recovery phrase.\n *\n * @param _request - Incoming JSON-RPC request. This is ignored for this\n * specific handler.\n * @param response - The outgoing JSON-RPC response, modified to return the\n * result.\n * @param _next - The `json-rpc-engine` middleware next handler.\n * @param end - The `json-rpc-engine` middleware end handler.\n * @param hooks - Any hooks required by this handler.\n */\nexport async function getAccountsHandler(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse<Json>,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n hooks: GetAccountsHandlerHooks,\n) {\n const { getMnemonic } = hooks;\n\n const node = await BIP44Node.fromDerivationPath({\n derivationPath: [\n await getMnemonic(),\n `bip32:44'`,\n `bip32:60'`,\n `bip32:0'`,\n `bip32:0`,\n `bip32:0`,\n ],\n });\n\n response.result = [node.address];\n return end();\n}\n"],"mappings":";AAIA,SAAS,iBAAiB;AAuB1B,eAAsB,mBACpB,UACA,UACA,OACA,KACA,OACA;AACA,QAAM,EAAE,YAAY,IAAI;AAExB,QAAM,OAAO,MAAM,UAAU,mBAAmB;AAAA,IAC9C,gBAAgB;AAAA,MACd,MAAM,YAAY;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAED,WAAS,SAAS,CAAC,KAAK,OAAO;AAC/B,SAAO,IAAI;AACb;","names":[]}
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/internals/simulation/constants.ts
2
+ var DEFAULT_SRP = "test test test test test test test test test test test ball";
3
+ var DEFAULT_LOCALE = "en";
4
+ var DEFAULT_JSON_RPC_ENDPOINT = "https://cloudflare-eth.com/";
5
+
6
+
7
+
8
+
9
+
10
+ exports.DEFAULT_SRP = DEFAULT_SRP; exports.DEFAULT_LOCALE = DEFAULT_LOCALE; exports.DEFAULT_JSON_RPC_ENDPOINT = DEFAULT_JSON_RPC_ENDPOINT;
11
+ //# sourceMappingURL=chunk-CZQKOZLR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internals/simulation/constants.ts"],"names":[],"mappings":";AAIO,IAAM,cACX;AAKK,IAAM,iBAAiB;AAKvB,IAAM,4BAA4B","sourcesContent":["/**\n * A secret recovery phrase that is used for testing purposes. Do not use this\n * to store any real funds!\n */\nexport const DEFAULT_SRP =\n 'test test test test test test test test test test test ball';\n\n/**\n * The default locale.\n */\nexport const DEFAULT_LOCALE = 'en';\n\n/**\n * The default JSON-RPC endpoint for Ethereum requests.\n */\nexport const DEFAULT_JSON_RPC_ENDPOINT = 'https://cloudflare-eth.com/';\n"]}
@@ -0,0 +1,24 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunkJA7RJLI7js = require('./chunk-JA7RJLI7.js');
6
+
7
+ // src/internals/simulation/methods/hooks/show-dialog.ts
8
+ var _effects = require('redux-saga/effects');
9
+ function* showDialogImplementation(_snapId, type, id, _placeholder) {
10
+ yield _effects.put.call(void 0, _chunkJA7RJLI7js.setInterface.call(void 0, { type, id }));
11
+ const { payload } = yield _effects.take.call(void 0, _chunkJA7RJLI7js.resolveInterface.type);
12
+ yield _effects.put.call(void 0, _chunkJA7RJLI7js.closeInterface.call(void 0, ));
13
+ return payload;
14
+ }
15
+ function getShowDialogImplementation(runSaga) {
16
+ return async (...args) => {
17
+ return await runSaga(showDialogImplementation, ...args).toPromise();
18
+ };
19
+ }
20
+
21
+
22
+
23
+ exports.getShowDialogImplementation = getShowDialogImplementation;
24
+ //# sourceMappingURL=chunk-D36QBJ35.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/internals/simulation/methods/hooks/show-dialog.ts"],"sourcesContent":["import type { DialogType } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put, take } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { resolveInterface, setInterface, closeInterface } from '../../store';\n\n/**\n * Show a dialog to the user. This will wait for `resolveUserInterface` to be\n * dispatched before returning.\n *\n * @param _snapId - The ID of the Snap that created the dialog. This is ignored\n * because the simulator only supports one Snap.\n * @param type - The type of dialog to show.\n * @param id - The interface ID.\n * @param _placeholder - The placeholder text to show in the dialog. This is\n * not implemented yet.\n * @yields Sets the dialog in the store, waits for the user to resolve the\n * dialog, and closes the dialog.\n * @returns The result of the dialog.\n */\nfunction* showDialogImplementation(\n _snapId: string,\n type: DialogType,\n id: string,\n _placeholder?: string,\n): SagaIterator<unknown> {\n yield put(setInterface({ type, id }));\n\n // We use `take` to wait for `resolveUserInterface` to be dispatched, which\n // indicates that the user has resolved the dialog.\n const { payload } = yield take(resolveInterface.type);\n yield put(closeInterface());\n\n return payload;\n}\n\n/**\n * Get the implementation of the `showDialog` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `showDialog` hook.\n */\nexport function getShowDialogImplementation(runSaga: RunSagaFunction) {\n return async (...args: Parameters<typeof showDialogImplementation>) => {\n return await runSaga(showDialogImplementation, ...args).toPromise();\n };\n}\n"],"names":["getShowDialogImplementation","showDialogImplementation","_snapId","type","id","_placeholder","put","setInterface","payload","take","resolveInterface","closeInterface","runSaga","args","toPromise"],"mappings":";;;;+BA2CgBA;;;eAAAA;;;yBAzCU;uBAGqC;AAE/D;;;;;;;;;;;;;CAaC,GACD,UAAUC,yBACRC,OAAe,EACfC,IAAgB,EAChBC,EAAU,EACVC,YAAqB;IAErB,MAAMC,IAAAA,YAAG,EAACC,IAAAA,mBAAY,EAAC;QAAEJ;QAAMC;IAAG;IAElC,2EAA2E;IAC3E,mDAAmD;IACnD,MAAM,EAAEI,OAAO,EAAE,GAAG,MAAMC,IAAAA,aAAI,EAACC,uBAAgB,CAACP,IAAI;IACpD,MAAMG,IAAAA,YAAG,EAACK,IAAAA,qBAAc;IAExB,OAAOH;AACT;AAQO,SAASR,4BAA4BY,OAAwB;IAClE,OAAO,OAAO,GAAGC;QACf,OAAO,MAAMD,QAAQX,6BAA6BY,MAAMC,SAAS;IACnE;AACF"}
1
+ {"version":3,"sources":["../src/internals/simulation/methods/hooks/show-dialog.ts"],"names":[],"mappings":";;;;;;;AAEA,SAAS,KAAK,YAAY;AAmB1B,UAAU,yBACR,SACA,MACA,IACA,cACuB;AACvB,QAAM,IAAI,aAAa,EAAE,MAAM,GAAG,CAAC,CAAC;AAIpC,QAAM,EAAE,QAAQ,IAAI,MAAM,KAAK,iBAAiB,IAAI;AACpD,QAAM,IAAI,eAAe,CAAC;AAE1B,SAAO;AACT;AAQO,SAAS,4BAA4B,SAA0B;AACpE,SAAO,UAAU,SAAsD;AACrE,WAAO,MAAM,QAAQ,0BAA0B,GAAG,IAAI,EAAE,UAAU;AAAA,EACpE;AACF","sourcesContent":["import type { DialogType } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put, take } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { resolveInterface, setInterface, closeInterface } from '../../store';\n\n/**\n * Show a dialog to the user. This will wait for `resolveUserInterface` to be\n * dispatched before returning.\n *\n * @param _snapId - The ID of the Snap that created the dialog. This is ignored\n * because the simulator only supports one Snap.\n * @param type - The type of dialog to show.\n * @param id - The interface ID.\n * @param _placeholder - The placeholder text to show in the dialog. This is\n * not implemented yet.\n * @yields Sets the dialog in the store, waits for the user to resolve the\n * dialog, and closes the dialog.\n * @returns The result of the dialog.\n */\nfunction* showDialogImplementation(\n _snapId: string,\n type: DialogType,\n id: string,\n _placeholder?: string,\n): SagaIterator<unknown> {\n yield put(setInterface({ type, id }));\n\n // We use `take` to wait for `resolveUserInterface` to be dispatched, which\n // indicates that the user has resolved the dialog.\n const { payload } = yield take(resolveInterface.type);\n yield put(closeInterface());\n\n return payload;\n}\n\n/**\n * Get the implementation of the `showDialog` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `showDialog` hook.\n */\nexport function getShowDialogImplementation(runSaga: RunSagaFunction) {\n return async (...args: Parameters<typeof showDialogImplementation>) => {\n return await runSaga(showDialogImplementation, ...args).toPromise();\n };\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import {
2
+ closeInterface,
3
+ resolveInterface,
4
+ setInterface
5
+ } from "./chunk-4VCE3DRR.mjs";
6
+
7
+ // src/internals/simulation/methods/hooks/show-dialog.ts
8
+ import { put, take } from "redux-saga/effects";
9
+ function* showDialogImplementation(_snapId, type, id, _placeholder) {
10
+ yield put(setInterface({ type, id }));
11
+ const { payload } = yield take(resolveInterface.type);
12
+ yield put(closeInterface());
13
+ return payload;
14
+ }
15
+ function getShowDialogImplementation(runSaga) {
16
+ return async (...args) => {
17
+ return await runSaga(showDialogImplementation, ...args).toPromise();
18
+ };
19
+ }
20
+
21
+ export {
22
+ getShowDialogImplementation
23
+ };
24
+ //# sourceMappingURL=chunk-DEFFA5IJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internals/simulation/methods/hooks/show-dialog.ts"],"sourcesContent":["import type { DialogType } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put, take } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { resolveInterface, setInterface, closeInterface } from '../../store';\n\n/**\n * Show a dialog to the user. This will wait for `resolveUserInterface` to be\n * dispatched before returning.\n *\n * @param _snapId - The ID of the Snap that created the dialog. This is ignored\n * because the simulator only supports one Snap.\n * @param type - The type of dialog to show.\n * @param id - The interface ID.\n * @param _placeholder - The placeholder text to show in the dialog. This is\n * not implemented yet.\n * @yields Sets the dialog in the store, waits for the user to resolve the\n * dialog, and closes the dialog.\n * @returns The result of the dialog.\n */\nfunction* showDialogImplementation(\n _snapId: string,\n type: DialogType,\n id: string,\n _placeholder?: string,\n): SagaIterator<unknown> {\n yield put(setInterface({ type, id }));\n\n // We use `take` to wait for `resolveUserInterface` to be dispatched, which\n // indicates that the user has resolved the dialog.\n const { payload } = yield take(resolveInterface.type);\n yield put(closeInterface());\n\n return payload;\n}\n\n/**\n * Get the implementation of the `showDialog` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `showDialog` hook.\n */\nexport function getShowDialogImplementation(runSaga: RunSagaFunction) {\n return async (...args: Parameters<typeof showDialogImplementation>) => {\n return await runSaga(showDialogImplementation, ...args).toPromise();\n };\n}\n"],"mappings":";;;;;;;AAEA,SAAS,KAAK,YAAY;AAmB1B,UAAU,yBACR,SACA,MACA,IACA,cACuB;AACvB,QAAM,IAAI,aAAa,EAAE,MAAM,GAAG,CAAC,CAAC;AAIpC,QAAM,EAAE,QAAQ,IAAI,MAAM,KAAK,iBAAiB,IAAI;AACpD,QAAM,IAAI,eAAe,CAAC;AAE1B,SAAO;AACT;AAQO,SAAS,4BAA4B,SAA0B;AACpE,SAAO,UAAU,SAAsD;AACrE,WAAO,MAAM,QAAQ,0BAA0B,GAAG,IAAI,EAAE,UAAU;AAAA,EACpE;AACF;","names":[]}
@@ -0,0 +1,36 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkCZQKOZLRjs = require('./chunk-CZQKOZLR.js');
5
+
6
+ // src/internals/simulation/options.ts
7
+ var _utils = require('@metamask/utils');
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+ var _superstruct = require('superstruct');
17
+ var SimulationOptionsStruct = _superstruct.object.call(void 0, {
18
+ secretRecoveryPhrase: _superstruct.defaulted.call(void 0, _superstruct.optional.call(void 0, _superstruct.string.call(void 0, )), _chunkCZQKOZLRjs.DEFAULT_SRP),
19
+ locale: _superstruct.defaulted.call(void 0, _superstruct.optional.call(void 0, _superstruct.string.call(void 0, )), _chunkCZQKOZLRjs.DEFAULT_LOCALE),
20
+ state: _superstruct.defaulted.call(void 0, _superstruct.optional.call(void 0, _superstruct.nullable.call(void 0, _superstruct.record.call(void 0, _superstruct.string.call(void 0, ), _utils.JsonStruct))), null),
21
+ unencryptedState: _superstruct.defaulted.call(void 0,
22
+ _superstruct.optional.call(void 0, _superstruct.nullable.call(void 0, _superstruct.record.call(void 0, _superstruct.string.call(void 0, ), _utils.JsonStruct))),
23
+ null
24
+ )
25
+ });
26
+ function getOptions(options) {
27
+ return _superstruct.create.call(void 0,
28
+ options,
29
+ SimulationOptionsStruct
30
+ );
31
+ }
32
+
33
+
34
+
35
+ exports.getOptions = getOptions;
36
+ //# sourceMappingURL=chunk-EFB6AQPB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internals/simulation/options.ts"],"names":[],"mappings":";;;;;;AAAA,SAAS,kBAAkB;AAE3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,IAAM,0BAA0B,OAAO;AAAA,EACrC,sBAAsB,UAAU,SAAS,OAAO,CAAC,GAAG,WAAW;AAAA,EAC/D,QAAQ,UAAU,SAAS,OAAO,CAAC,GAAG,cAAc;AAAA,EACpD,OAAO,UAAU,SAAS,SAAS,OAAO,OAAO,GAAG,UAAU,CAAC,CAAC,GAAG,IAAI;AAAA,EACvE,kBAAkB;AAAA,IAChB,SAAS,SAAS,OAAO,OAAO,GAAG,UAAU,CAAC,CAAC;AAAA,IAC/C;AAAA,EACF;AACF,CAAC;AA2BM,SAAS,WAAW,SAAmD;AAC5E,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF","sourcesContent":["import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport {\n create,\n defaulted,\n nullable,\n object,\n optional,\n record,\n string,\n} from 'superstruct';\n\nimport { DEFAULT_LOCALE, DEFAULT_SRP } from './constants';\n\nconst SimulationOptionsStruct = object({\n secretRecoveryPhrase: defaulted(optional(string()), DEFAULT_SRP),\n locale: defaulted(optional(string()), DEFAULT_LOCALE),\n state: defaulted(optional(nullable(record(string(), JsonStruct))), null),\n unencryptedState: defaulted(\n optional(nullable(record(string(), JsonStruct))),\n null,\n ),\n});\n\n/**\n * Options for the simulation.\n *\n * @property secretRecoveryPhrase - The secret recovery phrase to use. This is\n * used to derive addresses and private keys. Defaults to a test recovery\n * phrase.\n * @property locale - The locale to use. Defaults to `en`.\n * @property state - The initial state of the Snap, if any. Defaults to `null`.\n */\nexport type SimulationUserOptions = Infer<typeof SimulationOptionsStruct>;\n\n/**\n * Options for the simulation, with defaults filled in.\n *\n * See {@link SimulationUserOptions} for documentation.\n */\nexport type SimulationOptions = Required<SimulationUserOptions>;\n\n/**\n * Get the options for the simulation.\n *\n * @param options - The user options. Any options not specified will be filled\n * in with default values.\n * @returns The simulation options.\n */\nexport function getOptions(options: SimulationUserOptions): SimulationOptions {\n return create(\n options,\n SimulationOptionsStruct,\n ) as Required<SimulationUserOptions>;\n}\n"]}