@metamask/snaps-jest 8.3.2 → 8.5.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 (305) hide show
  1. package/CHANGELOG.md +80 -1
  2. package/LICENSE +15 -0
  3. package/dist/environment.cjs +2 -1
  4. package/dist/environment.cjs.map +1 -1
  5. package/dist/environment.d.cts +2 -2
  6. package/dist/environment.d.cts.map +1 -1
  7. package/dist/environment.d.mts +2 -2
  8. package/dist/environment.d.mts.map +1 -1
  9. package/dist/environment.mjs +3 -2
  10. package/dist/environment.mjs.map +1 -1
  11. package/dist/helpers.cjs +9 -176
  12. package/dist/helpers.cjs.map +1 -1
  13. package/dist/helpers.d.cts +1 -44
  14. package/dist/helpers.d.cts.map +1 -1
  15. package/dist/helpers.d.mts +1 -44
  16. package/dist/helpers.d.mts.map +1 -1
  17. package/dist/helpers.mjs +11 -171
  18. package/dist/helpers.mjs.map +1 -1
  19. package/dist/index.cjs +8 -2
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +2 -1
  22. package/dist/index.d.cts.map +1 -1
  23. package/dist/index.d.mts +2 -1
  24. package/dist/index.d.mts.map +1 -1
  25. package/dist/index.mjs +1 -1
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/internals/index.cjs +0 -3
  28. package/dist/internals/index.cjs.map +1 -1
  29. package/dist/internals/index.d.cts +0 -3
  30. package/dist/internals/index.d.cts.map +1 -1
  31. package/dist/internals/index.d.mts +0 -3
  32. package/dist/internals/index.d.mts.map +1 -1
  33. package/dist/internals/index.mjs +0 -3
  34. package/dist/internals/index.mjs.map +1 -1
  35. package/dist/matchers.cjs +3 -3
  36. package/dist/matchers.cjs.map +1 -1
  37. package/dist/matchers.d.cts.map +1 -1
  38. package/dist/matchers.d.mts.map +1 -1
  39. package/dist/matchers.mjs +1 -1
  40. package/dist/matchers.mjs.map +1 -1
  41. package/package.json +38 -33
  42. package/dist/internals/request.cjs +0 -143
  43. package/dist/internals/request.cjs.map +0 -1
  44. package/dist/internals/request.d.cts +0 -56
  45. package/dist/internals/request.d.cts.map +0 -1
  46. package/dist/internals/request.d.mts +0 -56
  47. package/dist/internals/request.d.mts.map +0 -1
  48. package/dist/internals/request.mjs +0 -138
  49. package/dist/internals/request.mjs.map +0 -1
  50. package/dist/internals/simulation/constants.cjs +0 -21
  51. package/dist/internals/simulation/constants.cjs.map +0 -1
  52. package/dist/internals/simulation/constants.d.cts +0 -18
  53. package/dist/internals/simulation/constants.d.cts.map +0 -1
  54. package/dist/internals/simulation/constants.d.mts +0 -18
  55. package/dist/internals/simulation/constants.d.mts.map +0 -1
  56. package/dist/internals/simulation/constants.mjs +0 -18
  57. package/dist/internals/simulation/constants.mjs.map +0 -1
  58. package/dist/internals/simulation/controllers.cjs +0 -101
  59. package/dist/internals/simulation/controllers.cjs.map +0 -1
  60. package/dist/internals/simulation/controllers.d.cts +0 -41
  61. package/dist/internals/simulation/controllers.d.cts.map +0 -1
  62. package/dist/internals/simulation/controllers.d.mts +0 -41
  63. package/dist/internals/simulation/controllers.d.mts.map +0 -1
  64. package/dist/internals/simulation/controllers.mjs +0 -96
  65. package/dist/internals/simulation/controllers.mjs.map +0 -1
  66. package/dist/internals/simulation/files.cjs +0 -94
  67. package/dist/internals/simulation/files.cjs.map +0 -1
  68. package/dist/internals/simulation/files.d.cts +0 -49
  69. package/dist/internals/simulation/files.d.cts.map +0 -1
  70. package/dist/internals/simulation/files.d.mts +0 -49
  71. package/dist/internals/simulation/files.d.mts.map +0 -1
  72. package/dist/internals/simulation/files.mjs +0 -91
  73. package/dist/internals/simulation/files.mjs.map +0 -1
  74. package/dist/internals/simulation/index.cjs +0 -22
  75. package/dist/internals/simulation/index.cjs.map +0 -1
  76. package/dist/internals/simulation/index.d.cts +0 -6
  77. package/dist/internals/simulation/index.d.cts.map +0 -1
  78. package/dist/internals/simulation/index.d.mts +0 -6
  79. package/dist/internals/simulation/index.d.mts.map +0 -1
  80. package/dist/internals/simulation/index.mjs +0 -6
  81. package/dist/internals/simulation/index.mjs.map +0 -1
  82. package/dist/internals/simulation/interface.cjs +0 -527
  83. package/dist/internals/simulation/interface.cjs.map +0 -1
  84. package/dist/internals/simulation/interface.d.cts +0 -152
  85. package/dist/internals/simulation/interface.d.cts.map +0 -1
  86. package/dist/internals/simulation/interface.d.mts +0 -152
  87. package/dist/internals/simulation/interface.d.mts.map +0 -1
  88. package/dist/internals/simulation/interface.mjs +0 -513
  89. package/dist/internals/simulation/interface.mjs.map +0 -1
  90. package/dist/internals/simulation/methods/constants.cjs +0 -72
  91. package/dist/internals/simulation/methods/constants.cjs.map +0 -1
  92. package/dist/internals/simulation/methods/constants.d.cts +0 -11
  93. package/dist/internals/simulation/methods/constants.d.cts.map +0 -1
  94. package/dist/internals/simulation/methods/constants.d.mts +0 -11
  95. package/dist/internals/simulation/methods/constants.d.mts.map +0 -1
  96. package/dist/internals/simulation/methods/constants.mjs +0 -69
  97. package/dist/internals/simulation/methods/constants.mjs.map +0 -1
  98. package/dist/internals/simulation/methods/hooks/get-preferences.cjs +0 -18
  99. package/dist/internals/simulation/methods/hooks/get-preferences.cjs.map +0 -1
  100. package/dist/internals/simulation/methods/hooks/get-preferences.d.cts +0 -14
  101. package/dist/internals/simulation/methods/hooks/get-preferences.d.cts.map +0 -1
  102. package/dist/internals/simulation/methods/hooks/get-preferences.d.mts +0 -14
  103. package/dist/internals/simulation/methods/hooks/get-preferences.d.mts.map +0 -1
  104. package/dist/internals/simulation/methods/hooks/get-preferences.mjs +0 -14
  105. package/dist/internals/simulation/methods/hooks/get-preferences.mjs.map +0 -1
  106. package/dist/internals/simulation/methods/hooks/index.cjs +0 -22
  107. package/dist/internals/simulation/methods/hooks/index.cjs.map +0 -1
  108. package/dist/internals/simulation/methods/hooks/index.d.cts +0 -6
  109. package/dist/internals/simulation/methods/hooks/index.d.cts.map +0 -1
  110. package/dist/internals/simulation/methods/hooks/index.d.mts +0 -6
  111. package/dist/internals/simulation/methods/hooks/index.d.mts.map +0 -1
  112. package/dist/internals/simulation/methods/hooks/index.mjs +0 -6
  113. package/dist/internals/simulation/methods/hooks/index.mjs.map +0 -1
  114. package/dist/internals/simulation/methods/hooks/interface.cjs +0 -24
  115. package/dist/internals/simulation/methods/hooks/interface.cjs.map +0 -1
  116. package/dist/internals/simulation/methods/hooks/interface.d.cts +0 -17
  117. package/dist/internals/simulation/methods/hooks/interface.d.cts.map +0 -1
  118. package/dist/internals/simulation/methods/hooks/interface.d.mts +0 -17
  119. package/dist/internals/simulation/methods/hooks/interface.d.mts.map +0 -1
  120. package/dist/internals/simulation/methods/hooks/interface.mjs +0 -19
  121. package/dist/internals/simulation/methods/hooks/interface.mjs.map +0 -1
  122. package/dist/internals/simulation/methods/hooks/notifications.cjs +0 -58
  123. package/dist/internals/simulation/methods/hooks/notifications.cjs.map +0 -1
  124. package/dist/internals/simulation/methods/hooks/notifications.d.cts +0 -17
  125. package/dist/internals/simulation/methods/hooks/notifications.d.cts.map +0 -1
  126. package/dist/internals/simulation/methods/hooks/notifications.d.mts +0 -17
  127. package/dist/internals/simulation/methods/hooks/notifications.d.mts.map +0 -1
  128. package/dist/internals/simulation/methods/hooks/notifications.mjs +0 -55
  129. package/dist/internals/simulation/methods/hooks/notifications.mjs.map +0 -1
  130. package/dist/internals/simulation/methods/hooks/request-user-approval.cjs +0 -38
  131. package/dist/internals/simulation/methods/hooks/request-user-approval.cjs.map +0 -1
  132. package/dist/internals/simulation/methods/hooks/request-user-approval.d.cts +0 -16
  133. package/dist/internals/simulation/methods/hooks/request-user-approval.d.cts.map +0 -1
  134. package/dist/internals/simulation/methods/hooks/request-user-approval.d.mts +0 -16
  135. package/dist/internals/simulation/methods/hooks/request-user-approval.d.mts.map +0 -1
  136. package/dist/internals/simulation/methods/hooks/request-user-approval.mjs +0 -35
  137. package/dist/internals/simulation/methods/hooks/request-user-approval.mjs.map +0 -1
  138. package/dist/internals/simulation/methods/hooks/state.cjs +0 -84
  139. package/dist/internals/simulation/methods/hooks/state.cjs.map +0 -1
  140. package/dist/internals/simulation/methods/hooks/state.d.cts +0 -24
  141. package/dist/internals/simulation/methods/hooks/state.d.cts.map +0 -1
  142. package/dist/internals/simulation/methods/hooks/state.d.mts +0 -24
  143. package/dist/internals/simulation/methods/hooks/state.d.mts.map +0 -1
  144. package/dist/internals/simulation/methods/hooks/state.mjs +0 -79
  145. package/dist/internals/simulation/methods/hooks/state.mjs.map +0 -1
  146. package/dist/internals/simulation/methods/index.cjs +0 -18
  147. package/dist/internals/simulation/methods/index.cjs.map +0 -1
  148. package/dist/internals/simulation/methods/index.d.cts +0 -2
  149. package/dist/internals/simulation/methods/index.d.cts.map +0 -1
  150. package/dist/internals/simulation/methods/index.d.mts +0 -2
  151. package/dist/internals/simulation/methods/index.d.mts.map +0 -1
  152. package/dist/internals/simulation/methods/index.mjs +0 -2
  153. package/dist/internals/simulation/methods/index.mjs.map +0 -1
  154. package/dist/internals/simulation/methods/specifications.cjs +0 -85
  155. package/dist/internals/simulation/methods/specifications.cjs.map +0 -1
  156. package/dist/internals/simulation/methods/specifications.d.cts +0 -57
  157. package/dist/internals/simulation/methods/specifications.d.cts.map +0 -1
  158. package/dist/internals/simulation/methods/specifications.d.mts +0 -57
  159. package/dist/internals/simulation/methods/specifications.d.mts.map +0 -1
  160. package/dist/internals/simulation/methods/specifications.mjs +0 -78
  161. package/dist/internals/simulation/methods/specifications.mjs.map +0 -1
  162. package/dist/internals/simulation/middleware/engine.cjs +0 -37
  163. package/dist/internals/simulation/middleware/engine.cjs.map +0 -1
  164. package/dist/internals/simulation/middleware/engine.d.cts +0 -27
  165. package/dist/internals/simulation/middleware/engine.d.cts.map +0 -1
  166. package/dist/internals/simulation/middleware/engine.d.mts +0 -27
  167. package/dist/internals/simulation/middleware/engine.d.mts.map +0 -1
  168. package/dist/internals/simulation/middleware/engine.mjs +0 -34
  169. package/dist/internals/simulation/middleware/engine.mjs.map +0 -1
  170. package/dist/internals/simulation/middleware/index.cjs +0 -18
  171. package/dist/internals/simulation/middleware/index.cjs.map +0 -1
  172. package/dist/internals/simulation/middleware/index.d.cts +0 -2
  173. package/dist/internals/simulation/middleware/index.d.cts.map +0 -1
  174. package/dist/internals/simulation/middleware/index.d.mts +0 -2
  175. package/dist/internals/simulation/middleware/index.d.mts.map +0 -1
  176. package/dist/internals/simulation/middleware/index.mjs +0 -2
  177. package/dist/internals/simulation/middleware/index.mjs.map +0 -1
  178. package/dist/internals/simulation/middleware/internal-methods/accounts.cjs +0 -34
  179. package/dist/internals/simulation/middleware/internal-methods/accounts.cjs.map +0 -1
  180. package/dist/internals/simulation/middleware/internal-methods/accounts.d.cts +0 -20
  181. package/dist/internals/simulation/middleware/internal-methods/accounts.d.cts.map +0 -1
  182. package/dist/internals/simulation/middleware/internal-methods/accounts.d.mts +0 -20
  183. package/dist/internals/simulation/middleware/internal-methods/accounts.d.mts.map +0 -1
  184. package/dist/internals/simulation/middleware/internal-methods/accounts.mjs +0 -30
  185. package/dist/internals/simulation/middleware/internal-methods/accounts.mjs.map +0 -1
  186. package/dist/internals/simulation/middleware/internal-methods/index.cjs +0 -18
  187. package/dist/internals/simulation/middleware/internal-methods/index.cjs.map +0 -1
  188. package/dist/internals/simulation/middleware/internal-methods/index.d.cts +0 -2
  189. package/dist/internals/simulation/middleware/internal-methods/index.d.cts.map +0 -1
  190. package/dist/internals/simulation/middleware/internal-methods/index.d.mts +0 -2
  191. package/dist/internals/simulation/middleware/internal-methods/index.d.mts.map +0 -1
  192. package/dist/internals/simulation/middleware/internal-methods/index.mjs +0 -2
  193. package/dist/internals/simulation/middleware/internal-methods/index.mjs.map +0 -1
  194. package/dist/internals/simulation/middleware/internal-methods/middleware.cjs +0 -44
  195. package/dist/internals/simulation/middleware/internal-methods/middleware.cjs.map +0 -1
  196. package/dist/internals/simulation/middleware/internal-methods/middleware.d.cts +0 -23
  197. package/dist/internals/simulation/middleware/internal-methods/middleware.d.cts.map +0 -1
  198. package/dist/internals/simulation/middleware/internal-methods/middleware.d.mts +0 -23
  199. package/dist/internals/simulation/middleware/internal-methods/middleware.d.mts.map +0 -1
  200. package/dist/internals/simulation/middleware/internal-methods/middleware.mjs +0 -40
  201. package/dist/internals/simulation/middleware/internal-methods/middleware.mjs.map +0 -1
  202. package/dist/internals/simulation/middleware/internal-methods/provider-state.cjs +0 -28
  203. package/dist/internals/simulation/middleware/internal-methods/provider-state.cjs.map +0 -1
  204. package/dist/internals/simulation/middleware/internal-methods/provider-state.d.cts +0 -16
  205. package/dist/internals/simulation/middleware/internal-methods/provider-state.d.cts.map +0 -1
  206. package/dist/internals/simulation/middleware/internal-methods/provider-state.d.mts +0 -16
  207. package/dist/internals/simulation/middleware/internal-methods/provider-state.d.mts.map +0 -1
  208. package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs +0 -24
  209. package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs.map +0 -1
  210. package/dist/internals/simulation/middleware/mock.cjs +0 -22
  211. package/dist/internals/simulation/middleware/mock.cjs.map +0 -1
  212. package/dist/internals/simulation/middleware/mock.d.cts +0 -11
  213. package/dist/internals/simulation/middleware/mock.d.cts.map +0 -1
  214. package/dist/internals/simulation/middleware/mock.d.mts +0 -11
  215. package/dist/internals/simulation/middleware/mock.d.mts.map +0 -1
  216. package/dist/internals/simulation/middleware/mock.mjs +0 -18
  217. package/dist/internals/simulation/middleware/mock.mjs.map +0 -1
  218. package/dist/internals/simulation/options.cjs +0 -25
  219. package/dist/internals/simulation/options.cjs.map +0 -1
  220. package/dist/internals/simulation/options.d.cts +0 -40
  221. package/dist/internals/simulation/options.d.cts.map +0 -1
  222. package/dist/internals/simulation/options.d.mts +0 -40
  223. package/dist/internals/simulation/options.d.mts.map +0 -1
  224. package/dist/internals/simulation/options.mjs +0 -21
  225. package/dist/internals/simulation/options.mjs.map +0 -1
  226. package/dist/internals/simulation/simulation.cjs +0 -155
  227. package/dist/internals/simulation/simulation.cjs.map +0 -1
  228. package/dist/internals/simulation/simulation.d.cts +0 -103
  229. package/dist/internals/simulation/simulation.d.cts.map +0 -1
  230. package/dist/internals/simulation/simulation.d.mts +0 -103
  231. package/dist/internals/simulation/simulation.d.mts.map +0 -1
  232. package/dist/internals/simulation/simulation.mjs +0 -150
  233. package/dist/internals/simulation/simulation.mjs.map +0 -1
  234. package/dist/internals/simulation/store/index.cjs +0 -21
  235. package/dist/internals/simulation/store/index.cjs.map +0 -1
  236. package/dist/internals/simulation/store/index.d.cts +0 -5
  237. package/dist/internals/simulation/store/index.d.cts.map +0 -1
  238. package/dist/internals/simulation/store/index.d.mts +0 -5
  239. package/dist/internals/simulation/store/index.d.mts.map +0 -1
  240. package/dist/internals/simulation/store/index.mjs +0 -5
  241. package/dist/internals/simulation/store/index.mjs.map +0 -1
  242. package/dist/internals/simulation/store/mocks.cjs +0 -39
  243. package/dist/internals/simulation/store/mocks.cjs.map +0 -1
  244. package/dist/internals/simulation/store/mocks.d.cts +0 -36
  245. package/dist/internals/simulation/store/mocks.d.cts.map +0 -1
  246. package/dist/internals/simulation/store/mocks.d.mts +0 -36
  247. package/dist/internals/simulation/store/mocks.d.mts.map +0 -1
  248. package/dist/internals/simulation/store/mocks.mjs +0 -35
  249. package/dist/internals/simulation/store/mocks.mjs.map +0 -1
  250. package/dist/internals/simulation/store/notifications.cjs +0 -35
  251. package/dist/internals/simulation/store/notifications.cjs.map +0 -1
  252. package/dist/internals/simulation/store/notifications.d.cts +0 -45
  253. package/dist/internals/simulation/store/notifications.d.cts.map +0 -1
  254. package/dist/internals/simulation/store/notifications.d.mts +0 -45
  255. package/dist/internals/simulation/store/notifications.d.mts.map +0 -1
  256. package/dist/internals/simulation/store/notifications.mjs +0 -32
  257. package/dist/internals/simulation/store/notifications.mjs.map +0 -1
  258. package/dist/internals/simulation/store/state.cjs +0 -54
  259. package/dist/internals/simulation/store/state.cjs.map +0 -1
  260. package/dist/internals/simulation/store/state.d.cts +0 -56
  261. package/dist/internals/simulation/store/state.d.cts.map +0 -1
  262. package/dist/internals/simulation/store/state.d.mts +0 -56
  263. package/dist/internals/simulation/store/state.d.mts.map +0 -1
  264. package/dist/internals/simulation/store/state.mjs +0 -50
  265. package/dist/internals/simulation/store/state.mjs.map +0 -1
  266. package/dist/internals/simulation/store/store.cjs +0 -51
  267. package/dist/internals/simulation/store/store.cjs.map +0 -1
  268. package/dist/internals/simulation/store/store.d.cts +0 -22
  269. package/dist/internals/simulation/store/store.d.cts.map +0 -1
  270. package/dist/internals/simulation/store/store.d.mts +0 -22
  271. package/dist/internals/simulation/store/store.d.mts.map +0 -1
  272. package/dist/internals/simulation/store/store.mjs +0 -45
  273. package/dist/internals/simulation/store/store.mjs.map +0 -1
  274. package/dist/internals/simulation/store/ui.cjs +0 -24
  275. package/dist/internals/simulation/store/ui.cjs.map +0 -1
  276. package/dist/internals/simulation/store/ui.d.cts +0 -27
  277. package/dist/internals/simulation/store/ui.d.cts.map +0 -1
  278. package/dist/internals/simulation/store/ui.d.mts +0 -27
  279. package/dist/internals/simulation/store/ui.d.mts.map +0 -1
  280. package/dist/internals/simulation/store/ui.mjs +0 -21
  281. package/dist/internals/simulation/store/ui.mjs.map +0 -1
  282. package/dist/internals/structs.cjs +0 -157
  283. package/dist/internals/structs.cjs.map +0 -1
  284. package/dist/internals/structs.d.cts +0 -205
  285. package/dist/internals/structs.d.cts.map +0 -1
  286. package/dist/internals/structs.d.mts +0 -205
  287. package/dist/internals/structs.d.mts.map +0 -1
  288. package/dist/internals/structs.mjs +0 -154
  289. package/dist/internals/structs.mjs.map +0 -1
  290. package/dist/types/index.cjs +0 -18
  291. package/dist/types/index.cjs.map +0 -1
  292. package/dist/types/index.d.cts +0 -2
  293. package/dist/types/index.d.cts.map +0 -1
  294. package/dist/types/index.d.mts +0 -2
  295. package/dist/types/index.d.mts.map +0 -1
  296. package/dist/types/index.mjs +0 -2
  297. package/dist/types/index.mjs.map +0 -1
  298. package/dist/types/types.cjs +0 -3
  299. package/dist/types/types.cjs.map +0 -1
  300. package/dist/types/types.d.cts +0 -386
  301. package/dist/types/types.d.cts.map +0 -1
  302. package/dist/types/types.d.mts +0 -386
  303. package/dist/types/types.d.mts.map +0 -1
  304. package/dist/types/types.mjs +0 -2
  305. package/dist/types/types.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.cjs","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;AAEA,mDAAiD;AAEjD,uDAA6E;AAC7E,uDAA+C;AAC/C,2CAKyB;AAEzB,qDASqB;AAErB,kEAG4C;AAmB5C,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,sBAAU,EAAE,SAAS,CAAC,CAAC;AAEtD;;;;;;GAMG;AACH,SAAS,UAAU,CAKjB,MAAiE,EACjE,OAA6C;IAE7C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,SAAS,6BAA6B,CACpC,QAAsB;IAEtB,IAAA,oBAAY,EAAC,QAAQ,EAAE,2CAA+B,CAAC,CAAC;AAC1D,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CACjC,EAAiB;IAEjB,IAAA,cAAM,EAAC,IAAA,mBAAW,EAAC,EAAE,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,sBAAU,CAAC,KAAK,CAAC,CAAC;AAClE,CAAC;AAJD,kDAIC;AAED;;;;GAIG;AACH,SAAgB,0BAA0B,CACxC,EAAiB;IAEjB,IAAA,cAAM,EAAC,IAAA,mBAAW,EAAC,EAAE,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,sBAAU,CAAC,YAAY,CAAC,CAAC;AACzE,CAAC;AAJD,gEAIC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAClC,EAAiB;IAEjB,IAAA,cAAM,EAAC,IAAA,mBAAW,EAA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AE,MAAM,EAAE,GAAG,IAAA,oBAAM,EAAC,IAAI,EAAE,oCAAwB,CAAC,CAAC;YAClE,KAAK,CAAC,QAAQ,CAAC,IAAA,sBAAc,EAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;YAEnD,OAAO;gBACL,MAAM;oBACJ,GAAG,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;oBAE5C,KAAK,CAAC,QAAQ,CAAC,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC,CAAC;gBAC5C,CAAC;aACF,CAAC;QACJ,CAAC;QAED,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,GAAG,CAAC,4BAA4B,CAAC,CAAC;YAClC,IAAA,qBAAO,EACL,uIAAuI,CACxI,CAAC;YAEF,MAAM,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;QAC7C,CAAC;KACF,CAAC;AACJ,CAAC;AAhKD,kCAgKC","sourcesContent":["import type { AbstractExecutionService } from '@metamask/snaps-controllers';\nimport type { SnapId } from '@metamask/snaps-sdk';\nimport { DialogType } from '@metamask/snaps-sdk';\nimport type { FooterElement } from '@metamask/snaps-sdk/jsx';\nimport { HandlerType, getJsxChildren, logInfo } from '@metamask/snaps-utils';\nimport { create } from '@metamask/superstruct';\nimport {\n assert,\n assertStruct,\n createModuleLogger,\n hasProperty,\n} from '@metamask/utils';\n\nimport {\n rootLogger,\n handleRequest,\n TransactionOptionsStruct,\n getEnvironment,\n JsonRpcMockOptionsStruct,\n SignatureOptionsStruct,\n SnapResponseWithInterfaceStruct,\n getElementByType,\n} from './internals';\nimport type { InstallSnapOptions } from './internals';\nimport {\n addJsonRpcMock,\n removeJsonRpcMock,\n} from './internals/simulation/store/mocks';\nimport type {\n SnapResponseWithInterface,\n CronjobOptions,\n JsonRpcMockOptions,\n Snap,\n SnapResponse,\n TransactionOptions,\n SnapInterface,\n SnapAlertInterface,\n SnapInterfaceActions,\n SnapConfirmationInterface,\n SnapPromptInterface,\n DefaultSnapInterface,\n DefaultSnapInterfaceWithFooter,\n DefaultSnapInterfaceWithPartialFooter,\n DefaultSnapInterfaceWithoutFooter,\n} from './types';\n\nconst log = createModuleLogger(rootLogger, 'helpers');\n\n/**\n * Get the options for {@link installSnap}.\n *\n * @param snapId - The ID of the Snap, or the options.\n * @param options - The options, if any.\n * @returns The options.\n */\nfunction getOptions<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId: SnapId | Partial<InstallSnapOptions<Service>> | undefined,\n options: Partial<InstallSnapOptions<Service>>,\n): [SnapId | undefined, Partial<InstallSnapOptions<Service>>] {\n if (typeof snapId === 'object') {\n return [undefined, snapId];\n }\n\n return [snapId, options];\n}\n\n/**\n * Ensure that the actual response contains `getInterface`.\n *\n * @param response - The response of the handler.\n */\nfunction assertIsResponseWithInterface(\n response: SnapResponse,\n): asserts response is SnapResponseWithInterface {\n assertStruct(response, SnapResponseWithInterfaceStruct);\n}\n\n/**\n * Ensure that the actual interface is an alert dialog.\n *\n * @param ui - The interface to verify.\n */\nexport function assertIsAlertDialog(\n ui: SnapInterface,\n): asserts ui is SnapAlertInterface & SnapInterfaceActions {\n assert(hasProperty(ui, 'type') && ui.type === DialogType.Alert);\n}\n\n/**\n * Ensure that the actual interface is a confirmation dialog.\n *\n * @param ui - The interface to verify.\n */\nexport function assertIsConfirmationDialog(\n ui: SnapInterface,\n): asserts ui is SnapConfirmationInterface & SnapInterfaceActions {\n assert(hasProperty(ui, 'type') && ui.type === DialogType.Confirmation);\n}\n\n/**\n * Ensure that the actual interface is a Prompt dialog.\n *\n * @param ui - The interface to verify.\n */\nexport function assertIsPromptDialog(\n ui: SnapInterface,\n): asserts ui is SnapPromptInterface & SnapInterfaceActions {\n assert(hasProperty(ui, 'type') && ui.type === DialogType.Prompt);\n}\n\n/**\n * Ensure that the actual interface is a custom dialog.\n *\n * @param ui - The interface to verify.\n */\nexport function assertIsCustomDialog(\n ui: SnapInterface,\n): asserts ui is DefaultSnapInterface & SnapInterfaceActions {\n assert(!hasProperty(ui, 'type'));\n}\n\n/**\n * Ensure that the actual interface is a custom dialog with a complete footer.\n *\n * @param ui - The interface to verify.\n */\nexport function assertCustomDialogHasFooter(\n ui: DefaultSnapInterface & SnapInterfaceActions,\n): asserts ui is DefaultSnapInterfaceWithFooter & SnapInterfaceActions {\n const footer = getElementByType<FooterElement>(ui.content, 'Footer');\n\n assert(footer && getJsxChildren(footer).length === 2);\n}\n\n/**\n * Ensure that the actual interface is a custom dialog with a partial footer.\n *\n * @param ui - The interface to verify.\n */\nexport function assertCustomDialogHasPartialFooter(\n ui: DefaultSnapInterface & SnapInterfaceActions,\n): asserts ui is DefaultSnapInterfaceWithPartialFooter & SnapInterfaceActions {\n const footer = getElementByType<FooterElement>(ui.content, 'Footer');\n\n assert(footer && getJsxChildren(footer).length === 1);\n}\n\n/**\n * Ensure that the actual interface is a custom dialog without a footer.\n *\n * @param ui - The interface to verify.\n */\nexport function assertCustomDialogHasNoFooter(\n ui: DefaultSnapInterface & SnapInterfaceActions,\n): asserts ui is DefaultSnapInterfaceWithoutFooter & SnapInterfaceActions {\n const footer = getElementByType<FooterElement>(ui.content, 'Footer');\n\n assert(!footer);\n}\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap(): Promise<Snap>;\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @param options - The options to use.\n * @param options.executionService - The execution service to use. Defaults to\n * {@link NodeThreadExecutionService}. You do not need to provide this unless\n * you are testing a custom execution service.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(options: Partial<InstallSnapOptions<Service>>): Promise<Snap>;\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @param snapId - The ID of the snap, including the prefix (`local:`). Defaults\n * to the URL of the built-in server, if it is running. This supports both\n * local snap IDs and NPM snap IDs.\n * @param options - The options to use.\n * @param options.executionService - The execution service to use. Defaults to\n * {@link NodeThreadExecutionService}. You do not need to provide this unless\n * you are testing a custom execution service.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId: SnapId,\n options?: Partial<InstallSnapOptions<Service>>,\n): Promise<Snap>;\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @param snapId - The ID of the snap, including the prefix (`local:`). Defaults\n * to the URL of the built-in server, if it is running. This supports both\n * local snap IDs and NPM snap IDs.\n * @param options - The options to use.\n * @param options.executionService - The execution service to use. Defaults to\n * {@link NodeThreadExecutionService}. You do not need to provide this unless\n * you are testing a custom execution service.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId?: SnapId | Partial<InstallSnapOptions<Service>>,\n options: Partial<InstallSnapOptions<Service>> = {},\n): Promise<Snap> {\n const resolvedOptions = getOptions(snapId, options);\n const {\n snapId: installedSnapId,\n store,\n executionService,\n runSaga,\n controllerMessenger,\n } = await getEnvironment().installSnap(...resolvedOptions);\n\n const onTransaction = async (\n request: TransactionOptions,\n ): Promise<SnapResponseWithInterface> => {\n log('Sending transaction %o.', request);\n\n const {\n origin: transactionOrigin,\n chainId,\n ...transaction\n } = create(request, TransactionOptionsStruct);\n\n const response = await handleRequest({\n snapId: installedSnapId,\n store,\n executionService,\n runSaga,\n controllerMessenger,\n handler: HandlerType.OnTransaction,\n request: {\n method: '',\n params: {\n chainId,\n transaction,\n transactionOrigin,\n },\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n };\n\n const onCronjob = (request: CronjobOptions) => {\n log('Running cronjob %o.', options);\n\n return handleRequest({\n snapId: installedSnapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnCronjob,\n request,\n });\n };\n\n return {\n request: (request) => {\n log('Sending request %o.', request);\n\n return handleRequest({\n snapId: installedSnapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnRpcRequest,\n request,\n });\n },\n\n onTransaction,\n sendTransaction: onTransaction,\n\n onSignature: async (\n request: unknown,\n ): Promise<SnapResponseWithInterface> => {\n log('Requesting signature %o.', request);\n\n const { origin: signatureOrigin, ...signature } = create(\n request,\n SignatureOptionsStruct,\n );\n\n const response = await handleRequest({\n snapId: installedSnapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnSignature,\n request: {\n method: '',\n params: {\n signature,\n signatureOrigin,\n },\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n },\n\n onCronjob,\n runCronjob: onCronjob,\n\n onHomePage: async (): Promise<SnapResponseWithInterface> => {\n log('Rendering home page.');\n\n const response = await handleRequest({\n snapId: installedSnapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnHomePage,\n request: {\n method: '',\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n },\n\n mockJsonRpc(mock: JsonRpcMockOptions) {\n log('Mocking JSON-RPC request %o.', mock);\n\n const { method, result } = create(mock, JsonRpcMockOptionsStruct);\n store.dispatch(addJsonRpcMock({ method, result }));\n\n return {\n unmock() {\n log('Unmocking JSON-RPC request %o.', mock);\n\n store.dispatch(removeJsonRpcMock(method));\n },\n };\n },\n\n close: async () => {\n log('Closing execution service.');\n logInfo(\n 'Calling `snap.close()` is deprecated, and will be removed in a future release. Snaps are now automatically closed when the test ends.',\n );\n\n await executionService.terminateAllSnaps();\n },\n };\n}\n"]}
1
+ {"version":3,"file":"helpers.cjs","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;AAGA,uDAAgD;AAChD,2CAAqD;AAErD,qDAAyD;AAEzD,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,sBAAU,EAAE,SAAS,CAAC,CAAC;AAEtD;;;;;;GAMG;AACH,SAAS,UAAU,CAKjB,MAAiE,EACjE,OAA6C;IAE7C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3B,CAAC;AAqGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACI,KAAK,UAAU,WAAW,CAK/B,MAAsD,EACtD,UAAgD,EAAE;IAElD,MAAM,eAAe,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,MAAM,EACJ,OAAO,EACP,aAAa,EACb,eAAe,EACf,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACX,KAAK,GACN,GAAG,MAAM,IAAA,0BAAc,GAAE,CAAC,WAAW,CAAC,GAAG,eAAe,CAAC,CAAC;IAE3D,OAAO;QACL,OAAO;QACP,aAAa;QACb,eAAe;QACf,WAAW;QACX,SAAS;QACT,UAAU;QACV,UAAU;QACV,WAAW;QACX,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,GAAG,CAAC,4BAA4B,CAAC,CAAC;YAClC,IAAA,qBAAO,EACL,uIAAuI,CACxI,CAAC;YAEF,MAAM,KAAK,EAAE,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC;AAvCD,kCAuCC","sourcesContent":["import type { AbstractExecutionService } from '@metamask/snaps-controllers';\nimport type { SnapId } from '@metamask/snaps-sdk';\nimport type { InstallSnapOptions, Snap } from '@metamask/snaps-simulation';\nimport { logInfo } from '@metamask/snaps-utils';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { rootLogger, getEnvironment } from './internals';\n\nconst log = createModuleLogger(rootLogger, 'helpers');\n\n/**\n * Get the options for {@link installSnap}.\n *\n * @param snapId - The ID of the Snap, or the options.\n * @param options - The options, if any.\n * @returns The options.\n */\nfunction getOptions<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId: SnapId | Partial<InstallSnapOptions<Service>> | undefined,\n options: Partial<InstallSnapOptions<Service>>,\n): [SnapId | undefined, Partial<InstallSnapOptions<Service>>] {\n if (typeof snapId === 'object') {\n return [undefined, snapId];\n }\n\n return [snapId, options];\n}\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap(): Promise<Snap>;\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @param options - The options to use.\n * @param options.executionService - The execution service to use. Defaults to\n * {@link NodeThreadExecutionService}. You do not need to provide this unless\n * you are testing a custom execution service.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(options: Partial<InstallSnapOptions<Service>>): Promise<Snap>;\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @param snapId - The ID of the snap, including the prefix (`local:`). Defaults\n * to the URL of the built-in server, if it is running. This supports both\n * local snap IDs and NPM snap IDs.\n * @param options - The options to use.\n * @param options.executionService - The execution service to use. Defaults to\n * {@link NodeThreadExecutionService}. You do not need to provide this unless\n * you are testing a custom execution service.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId: SnapId,\n options?: Partial<InstallSnapOptions<Service>>,\n): Promise<Snap>;\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @param snapId - The ID of the snap, including the prefix (`local:`). Defaults\n * to the URL of the built-in server, if it is running. This supports both\n * local snap IDs and NPM snap IDs.\n * @param options - The options to use.\n * @param options.executionService - The execution service to use. Defaults to\n * {@link NodeThreadExecutionService}. You do not need to provide this unless\n * you are testing a custom execution service.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId?: SnapId | Partial<InstallSnapOptions<Service>>,\n options: Partial<InstallSnapOptions<Service>> = {},\n): Promise<Snap> {\n const resolvedOptions = getOptions(snapId, options);\n const {\n request,\n onTransaction,\n sendTransaction,\n onSignature,\n onCronjob,\n runCronjob,\n onHomePage,\n mockJsonRpc,\n close,\n } = await getEnvironment().installSnap(...resolvedOptions);\n\n return {\n request,\n onTransaction,\n sendTransaction,\n onSignature,\n onCronjob,\n runCronjob,\n onHomePage,\n mockJsonRpc,\n close: async () => {\n log('Closing execution service.');\n logInfo(\n 'Calling `snap.close()` is deprecated, and will be removed in a future release. Snaps are now automatically closed when the test ends.',\n );\n\n await close();\n },\n };\n}\n"]}
@@ -1,49 +1,6 @@
1
1
  import type { AbstractExecutionService } from "@metamask/snaps-controllers";
2
2
  import type { SnapId } from "@metamask/snaps-sdk";
3
- import type { InstallSnapOptions } from "./internals/index.cjs";
4
- import type { Snap, SnapInterface, SnapAlertInterface, SnapInterfaceActions, SnapConfirmationInterface, SnapPromptInterface, DefaultSnapInterface, DefaultSnapInterfaceWithFooter, DefaultSnapInterfaceWithPartialFooter, DefaultSnapInterfaceWithoutFooter } from "./types/index.cjs";
5
- /**
6
- * Ensure that the actual interface is an alert dialog.
7
- *
8
- * @param ui - The interface to verify.
9
- */
10
- export declare function assertIsAlertDialog(ui: SnapInterface): asserts ui is SnapAlertInterface & SnapInterfaceActions;
11
- /**
12
- * Ensure that the actual interface is a confirmation dialog.
13
- *
14
- * @param ui - The interface to verify.
15
- */
16
- export declare function assertIsConfirmationDialog(ui: SnapInterface): asserts ui is SnapConfirmationInterface & SnapInterfaceActions;
17
- /**
18
- * Ensure that the actual interface is a Prompt dialog.
19
- *
20
- * @param ui - The interface to verify.
21
- */
22
- export declare function assertIsPromptDialog(ui: SnapInterface): asserts ui is SnapPromptInterface & SnapInterfaceActions;
23
- /**
24
- * Ensure that the actual interface is a custom dialog.
25
- *
26
- * @param ui - The interface to verify.
27
- */
28
- export declare function assertIsCustomDialog(ui: SnapInterface): asserts ui is DefaultSnapInterface & SnapInterfaceActions;
29
- /**
30
- * Ensure that the actual interface is a custom dialog with a complete footer.
31
- *
32
- * @param ui - The interface to verify.
33
- */
34
- export declare function assertCustomDialogHasFooter(ui: DefaultSnapInterface & SnapInterfaceActions): asserts ui is DefaultSnapInterfaceWithFooter & SnapInterfaceActions;
35
- /**
36
- * Ensure that the actual interface is a custom dialog with a partial footer.
37
- *
38
- * @param ui - The interface to verify.
39
- */
40
- export declare function assertCustomDialogHasPartialFooter(ui: DefaultSnapInterface & SnapInterfaceActions): asserts ui is DefaultSnapInterfaceWithPartialFooter & SnapInterfaceActions;
41
- /**
42
- * Ensure that the actual interface is a custom dialog without a footer.
43
- *
44
- * @param ui - The interface to verify.
45
- */
46
- export declare function assertCustomDialogHasNoFooter(ui: DefaultSnapInterface & SnapInterfaceActions): asserts ui is DefaultSnapInterfaceWithoutFooter & SnapInterfaceActions;
3
+ import type { InstallSnapOptions, Snap } from "@metamask/snaps-simulation";
47
4
  /**
48
5
  * Load a snap into the environment. This is the main entry point for testing
49
6
  * snaps: It returns a {@link Snap} object that can be used to interact with the
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.cts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,oCAAoC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAsBlD,OAAO,KAAK,EAAE,kBAAkB,EAAE,8BAAoB;AAKtD,OAAO,KAAK,EAIV,IAAI,EAGJ,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,8BAA8B,EAC9B,qCAAqC,EACrC,iCAAiC,EAClC,0BAAgB;AAqCjB;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,aAAa,GAChB,OAAO,CAAC,EAAE,IAAI,kBAAkB,GAAG,oBAAoB,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,aAAa,GAChB,OAAO,CAAC,EAAE,IAAI,yBAAyB,GAAG,oBAAoB,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,E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C,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"helpers.d.cts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,oCAAoC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,mCAAmC;AA8B3E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,WAAW,CAC/B,OAAO,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,YAAY,CAClD,OAAO,wBAAwB,CAChC,EACD,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,WAAW,CAC/B,OAAO,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,YAAY,CAClD,OAAO,wBAAwB,CAChC,EAED,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,GAC7C,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -1,49 +1,6 @@
1
1
  import type { AbstractExecutionService } from "@metamask/snaps-controllers";
2
2
  import type { SnapId } from "@metamask/snaps-sdk";
3
- import type { InstallSnapOptions } from "./internals/index.mjs";
4
- import type { Snap, SnapInterface, SnapAlertInterface, SnapInterfaceActions, SnapConfirmationInterface, SnapPromptInterface, DefaultSnapInterface, DefaultSnapInterfaceWithFooter, DefaultSnapInterfaceWithPartialFooter, DefaultSnapInterfaceWithoutFooter } from "./types/index.mjs";
5
- /**
6
- * Ensure that the actual interface is an alert dialog.
7
- *
8
- * @param ui - The interface to verify.
9
- */
10
- export declare function assertIsAlertDialog(ui: SnapInterface): asserts ui is SnapAlertInterface & SnapInterfaceActions;
11
- /**
12
- * Ensure that the actual interface is a confirmation dialog.
13
- *
14
- * @param ui - The interface to verify.
15
- */
16
- export declare function assertIsConfirmationDialog(ui: SnapInterface): asserts ui is SnapConfirmationInterface & SnapInterfaceActions;
17
- /**
18
- * Ensure that the actual interface is a Prompt dialog.
19
- *
20
- * @param ui - The interface to verify.
21
- */
22
- export declare function assertIsPromptDialog(ui: SnapInterface): asserts ui is SnapPromptInterface & SnapInterfaceActions;
23
- /**
24
- * Ensure that the actual interface is a custom dialog.
25
- *
26
- * @param ui - The interface to verify.
27
- */
28
- export declare function assertIsCustomDialog(ui: SnapInterface): asserts ui is DefaultSnapInterface & SnapInterfaceActions;
29
- /**
30
- * Ensure that the actual interface is a custom dialog with a complete footer.
31
- *
32
- * @param ui - The interface to verify.
33
- */
34
- export declare function assertCustomDialogHasFooter(ui: DefaultSnapInterface & SnapInterfaceActions): asserts ui is DefaultSnapInterfaceWithFooter & SnapInterfaceActions;
35
- /**
36
- * Ensure that the actual interface is a custom dialog with a partial footer.
37
- *
38
- * @param ui - The interface to verify.
39
- */
40
- export declare function assertCustomDialogHasPartialFooter(ui: DefaultSnapInterface & SnapInterfaceActions): asserts ui is DefaultSnapInterfaceWithPartialFooter & SnapInterfaceActions;
41
- /**
42
- * Ensure that the actual interface is a custom dialog without a footer.
43
- *
44
- * @param ui - The interface to verify.
45
- */
46
- export declare function assertCustomDialogHasNoFooter(ui: DefaultSnapInterface & SnapInterfaceActions): asserts ui is DefaultSnapInterfaceWithoutFooter & SnapInterfaceActions;
3
+ import type { InstallSnapOptions, Snap } from "@metamask/snaps-simulation";
47
4
  /**
48
5
  * Load a snap into the environment. This is the main entry point for testing
49
6
  * snaps: It returns a {@link Snap} object that can be used to interact with the
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.mts","sourceRoot":"","sources":["../src/helpers.ts"],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;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,WAAW,CAC/B,OAAO,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,YAAY,CAClD,OAAO,wBAAwB,CAChC,EAED,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,GAC7C,OAAO,CAAC,IAAI,CAAC,CAAC"}
package/dist/helpers.mjs CHANGED
@@ -1,9 +1,6 @@
1
- import { DialogType } from "@metamask/snaps-sdk";
2
- import { HandlerType, getJsxChildren, logInfo } from "@metamask/snaps-utils";
3
- import { create } from "@metamask/superstruct";
4
- import { assert, assertStruct, createModuleLogger, hasProperty } from "@metamask/utils";
5
- import { rootLogger, handleRequest, TransactionOptionsStruct, getEnvironment, JsonRpcMockOptionsStruct, SignatureOptionsStruct, SnapResponseWithInterfaceStruct, getElementByType } from "./internals/index.mjs";
6
- import { addJsonRpcMock, removeJsonRpcMock } from "./internals/simulation/store/mocks.mjs";
1
+ import { logInfo } from "@metamask/snaps-utils";
2
+ import { createModuleLogger } from "@metamask/utils";
3
+ import { rootLogger, getEnvironment } from "./internals/index.mjs";
7
4
  const log = createModuleLogger(rootLogger, 'helpers');
8
5
  /**
9
6
  * Get the options for {@link installSnap}.
@@ -18,73 +15,6 @@ function getOptions(snapId, options) {
18
15
  }
19
16
  return [snapId, options];
20
17
  }
21
- /**
22
- * Ensure that the actual response contains `getInterface`.
23
- *
24
- * @param response - The response of the handler.
25
- */
26
- function assertIsResponseWithInterface(response) {
27
- assertStruct(response, SnapResponseWithInterfaceStruct);
28
- }
29
- /**
30
- * Ensure that the actual interface is an alert dialog.
31
- *
32
- * @param ui - The interface to verify.
33
- */
34
- export function assertIsAlertDialog(ui) {
35
- assert(hasProperty(ui, 'type') && ui.type === DialogType.Alert);
36
- }
37
- /**
38
- * Ensure that the actual interface is a confirmation dialog.
39
- *
40
- * @param ui - The interface to verify.
41
- */
42
- export function assertIsConfirmationDialog(ui) {
43
- assert(hasProperty(ui, 'type') && ui.type === DialogType.Confirmation);
44
- }
45
- /**
46
- * Ensure that the actual interface is a Prompt dialog.
47
- *
48
- * @param ui - The interface to verify.
49
- */
50
- export function assertIsPromptDialog(ui) {
51
- assert(hasProperty(ui, 'type') && ui.type === DialogType.Prompt);
52
- }
53
- /**
54
- * Ensure that the actual interface is a custom dialog.
55
- *
56
- * @param ui - The interface to verify.
57
- */
58
- export function assertIsCustomDialog(ui) {
59
- assert(!hasProperty(ui, 'type'));
60
- }
61
- /**
62
- * Ensure that the actual interface is a custom dialog with a complete footer.
63
- *
64
- * @param ui - The interface to verify.
65
- */
66
- export function assertCustomDialogHasFooter(ui) {
67
- const footer = getElementByType(ui.content, 'Footer');
68
- assert(footer && getJsxChildren(footer).length === 2);
69
- }
70
- /**
71
- * Ensure that the actual interface is a custom dialog with a partial footer.
72
- *
73
- * @param ui - The interface to verify.
74
- */
75
- export function assertCustomDialogHasPartialFooter(ui) {
76
- const footer = getElementByType(ui.content, 'Footer');
77
- assert(footer && getJsxChildren(footer).length === 1);
78
- }
79
- /**
80
- * Ensure that the actual interface is a custom dialog without a footer.
81
- *
82
- * @param ui - The interface to verify.
83
- */
84
- export function assertCustomDialogHasNoFooter(ui) {
85
- const footer = getElementByType(ui.content, 'Footer');
86
- assert(!footer);
87
- }
88
18
  /**
89
19
  * Load a snap into the environment. This is the main entry point for testing
90
20
  * snaps: It returns a {@link Snap} object that can be used to interact with the
@@ -119,110 +49,20 @@ export function assertCustomDialogHasNoFooter(ui) {
119
49
  */
120
50
  export async function installSnap(snapId, options = {}) {
121
51
  const resolvedOptions = getOptions(snapId, options);
122
- const { snapId: installedSnapId, store, executionService, runSaga, controllerMessenger, } = await getEnvironment().installSnap(...resolvedOptions);
123
- const onTransaction = async (request) => {
124
- log('Sending transaction %o.', request);
125
- const { origin: transactionOrigin, chainId, ...transaction } = create(request, TransactionOptionsStruct);
126
- const response = await handleRequest({
127
- snapId: installedSnapId,
128
- store,
129
- executionService,
130
- runSaga,
131
- controllerMessenger,
132
- handler: HandlerType.OnTransaction,
133
- request: {
134
- method: '',
135
- params: {
136
- chainId,
137
- transaction,
138
- transactionOrigin,
139
- },
140
- },
141
- });
142
- assertIsResponseWithInterface(response);
143
- return response;
144
- };
145
- const onCronjob = (request) => {
146
- log('Running cronjob %o.', options);
147
- return handleRequest({
148
- snapId: installedSnapId,
149
- store,
150
- executionService,
151
- controllerMessenger,
152
- runSaga,
153
- handler: HandlerType.OnCronjob,
154
- request,
155
- });
156
- };
52
+ const { request, onTransaction, sendTransaction, onSignature, onCronjob, runCronjob, onHomePage, mockJsonRpc, close, } = await getEnvironment().installSnap(...resolvedOptions);
157
53
  return {
158
- request: (request) => {
159
- log('Sending request %o.', request);
160
- return handleRequest({
161
- snapId: installedSnapId,
162
- store,
163
- executionService,
164
- controllerMessenger,
165
- runSaga,
166
- handler: HandlerType.OnRpcRequest,
167
- request,
168
- });
169
- },
54
+ request,
170
55
  onTransaction,
171
- sendTransaction: onTransaction,
172
- onSignature: async (request) => {
173
- log('Requesting signature %o.', request);
174
- const { origin: signatureOrigin, ...signature } = create(request, SignatureOptionsStruct);
175
- const response = await handleRequest({
176
- snapId: installedSnapId,
177
- store,
178
- executionService,
179
- controllerMessenger,
180
- runSaga,
181
- handler: HandlerType.OnSignature,
182
- request: {
183
- method: '',
184
- params: {
185
- signature,
186
- signatureOrigin,
187
- },
188
- },
189
- });
190
- assertIsResponseWithInterface(response);
191
- return response;
192
- },
56
+ sendTransaction,
57
+ onSignature,
193
58
  onCronjob,
194
- runCronjob: onCronjob,
195
- onHomePage: async () => {
196
- log('Rendering home page.');
197
- const response = await handleRequest({
198
- snapId: installedSnapId,
199
- store,
200
- executionService,
201
- controllerMessenger,
202
- runSaga,
203
- handler: HandlerType.OnHomePage,
204
- request: {
205
- method: '',
206
- },
207
- });
208
- assertIsResponseWithInterface(response);
209
- return response;
210
- },
211
- mockJsonRpc(mock) {
212
- log('Mocking JSON-RPC request %o.', mock);
213
- const { method, result } = create(mock, JsonRpcMockOptionsStruct);
214
- store.dispatch(addJsonRpcMock({ method, result }));
215
- return {
216
- unmock() {
217
- log('Unmocking JSON-RPC request %o.', mock);
218
- store.dispatch(removeJsonRpcMock(method));
219
- },
220
- };
221
- },
59
+ runCronjob,
60
+ onHomePage,
61
+ mockJsonRpc,
222
62
  close: async () => {
223
63
  log('Closing execution service.');
224
64
  logInfo('Calling `snap.close()` is deprecated, and will be removed in a future release. Snaps are now automatically closed when the test ends.');
225
- await executionService.terminateAllSnaps();
65
+ await close();
226
66
  },
227
67
  };
228
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.mjs","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,4BAA4B;AAEjD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,8BAA8B;AAC7E,OAAO,EAAE,MAAM,EAAE,8BAA8B;AAC/C,OAAO,EACL,MAAM,EACN,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACZ,wBAAwB;AAEzB,OAAO,EACL,UAAU,EACV,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,wBAAwB,EACxB,sBAAsB,EACtB,+BAA+B,EAC/B,gBAAgB,EACjB,8BAAoB;AAErB,OAAO,EACL,cAAc,EACd,iBAAiB,EAClB,+CAA2C;AAmB5C,MAAM,GAAG,GAAG,kBAAkB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAEtD;;;;;;GAMG;AACH,SAAS,UAAU,CAKjB,MAAiE,EACjE,OAA6C;IAE7C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,SAAS,6BAA6B,CACpC,QAAsB;IAEtB,YAA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BACvB,KAAK;gBACL,gBAAgB;gBAChB,mBAAmB;gBACnB,OAAO;gBACP,OAAO,EAAE,WAAW,CAAC,UAAU;gBAC/B,OAAO,EAAE;oBACP,MAAM,EAAE,EAAE;iBACX;aACF,CAAC,CAAC;YAEH,6BAA6B,CAAC,QAAQ,CAAC,CAAC;YAExC,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,WAAW,CAAC,IAAwB;YAClC,GAAG,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;YAE1C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,wBAAwB,CAAC,CAAC;YAClE,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;YAEnD,OAAO;gBACL,MAAM;oBACJ,GAAG,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;oBAE5C,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC5C,CAAC;aACF,CAAC;QACJ,CAAC;QAED,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,GAAG,CAAC,4BAA4B,CAAC,CAAC;YAClC,OAAO,CACL,uIAAuI,CACxI,CAAC;YAEF,MAAM,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;QAC7C,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { AbstractExecutionService } from '@metamask/snaps-controllers';\nimport type { SnapId } from '@metamask/snaps-sdk';\nimport { DialogType } from '@metamask/snaps-sdk';\nimport type { FooterElement } from '@metamask/snaps-sdk/jsx';\nimport { HandlerType, getJsxChildren, logInfo } from '@metamask/snaps-utils';\nimport { create } from '@metamask/superstruct';\nimport {\n assert,\n assertStruct,\n createModuleLogger,\n hasProperty,\n} from '@metamask/utils';\n\nimport {\n rootLogger,\n handleRequest,\n TransactionOptionsStruct,\n getEnvironment,\n JsonRpcMockOptionsStruct,\n SignatureOptionsStruct,\n SnapResponseWithInterfaceStruct,\n getElementByType,\n} from './internals';\nimport type { InstallSnapOptions } from './internals';\nimport {\n addJsonRpcMock,\n removeJsonRpcMock,\n} from './internals/simulation/store/mocks';\nimport type {\n SnapResponseWithInterface,\n CronjobOptions,\n JsonRpcMockOptions,\n Snap,\n SnapResponse,\n TransactionOptions,\n SnapInterface,\n SnapAlertInterface,\n SnapInterfaceActions,\n SnapConfirmationInterface,\n SnapPromptInterface,\n DefaultSnapInterface,\n DefaultSnapInterfaceWithFooter,\n DefaultSnapInterfaceWithPartialFooter,\n DefaultSnapInterfaceWithoutFooter,\n} from './types';\n\nconst log = createModuleLogger(rootLogger, 'helpers');\n\n/**\n * Get the options for {@link installSnap}.\n *\n * @param snapId - The ID of the Snap, or the options.\n * @param options - The options, if any.\n * @returns The options.\n */\nfunction getOptions<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId: SnapId | Partial<InstallSnapOptions<Service>> | undefined,\n options: Partial<InstallSnapOptions<Service>>,\n): [SnapId | undefined, Partial<InstallSnapOptions<Service>>] {\n if (typeof snapId === 'object') {\n return [undefined, snapId];\n }\n\n return [snapId, options];\n}\n\n/**\n * Ensure that the actual response contains `getInterface`.\n *\n * @param response - The response of the handler.\n */\nfunction assertIsResponseWithInterface(\n response: SnapResponse,\n): asserts response is SnapResponseWithInterface {\n assertStruct(response, SnapResponseWithInterfaceStruct);\n}\n\n/**\n * Ensure that the actual interface is an alert dialog.\n *\n * @param ui - The interface to verify.\n */\nexport function assertIsAlertDialog(\n ui: SnapInterface,\n): asserts ui is SnapAlertInterface & SnapInterfaceActions {\n assert(hasProperty(ui, 'type') && ui.type === DialogType.Alert);\n}\n\n/**\n * Ensure that the actual interface is a confirmation dialog.\n *\n * @param ui - The interface to verify.\n */\nexport function assertIsConfirmationDialog(\n ui: SnapInterface,\n): asserts ui is SnapConfirmationInterface & SnapInterfaceActions {\n assert(hasProperty(ui, 'type') && ui.type === DialogType.Confirmation);\n}\n\n/**\n * Ensure that the actual interface is a Prompt dialog.\n *\n * @param ui - The interface to verify.\n */\nexport function assertIsPromptDialog(\n ui: SnapInterface,\n): asserts ui is SnapPromptInterface & SnapInterfaceActions {\n assert(hasProperty(ui, 'type') && ui.type === DialogType.Prompt);\n}\n\n/**\n * Ensure that the actual interface is a custom dialog.\n *\n * @param ui - The interface to verify.\n */\nexport function assertIsCustomDialog(\n ui: SnapInterface,\n): asserts ui is DefaultSnapInterface & SnapInterfaceActions {\n assert(!hasProperty(ui, 'type'));\n}\n\n/**\n * Ensure that the actual interface is a custom dialog with a complete footer.\n *\n * @param ui - The interface to verify.\n */\nexport function assertCustomDialogHasFooter(\n ui: DefaultSnapInterface & SnapInterfaceActions,\n): asserts ui is DefaultSnapInterfaceWithFooter & SnapInterfaceActions {\n const footer = getElementByType<FooterElement>(ui.content, 'Footer');\n\n assert(footer && getJsxChildren(footer).length === 2);\n}\n\n/**\n * Ensure that the actual interface is a custom dialog with a partial footer.\n *\n * @param ui - The interface to verify.\n */\nexport function assertCustomDialogHasPartialFooter(\n ui: DefaultSnapInterface & SnapInterfaceActions,\n): asserts ui is DefaultSnapInterfaceWithPartialFooter & SnapInterfaceActions {\n const footer = getElementByType<FooterElement>(ui.content, 'Footer');\n\n assert(footer && getJsxChildren(footer).length === 1);\n}\n\n/**\n * Ensure that the actual interface is a custom dialog without a footer.\n *\n * @param ui - The interface to verify.\n */\nexport function assertCustomDialogHasNoFooter(\n ui: DefaultSnapInterface & SnapInterfaceActions,\n): asserts ui is DefaultSnapInterfaceWithoutFooter & SnapInterfaceActions {\n const footer = getElementByType<FooterElement>(ui.content, 'Footer');\n\n assert(!footer);\n}\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap(): Promise<Snap>;\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @param options - The options to use.\n * @param options.executionService - The execution service to use. Defaults to\n * {@link NodeThreadExecutionService}. You do not need to provide this unless\n * you are testing a custom execution service.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(options: Partial<InstallSnapOptions<Service>>): Promise<Snap>;\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @param snapId - The ID of the snap, including the prefix (`local:`). Defaults\n * to the URL of the built-in server, if it is running. This supports both\n * local snap IDs and NPM snap IDs.\n * @param options - The options to use.\n * @param options.executionService - The execution service to use. Defaults to\n * {@link NodeThreadExecutionService}. You do not need to provide this unless\n * you are testing a custom execution service.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId: SnapId,\n options?: Partial<InstallSnapOptions<Service>>,\n): Promise<Snap>;\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @param snapId - The ID of the snap, including the prefix (`local:`). Defaults\n * to the URL of the built-in server, if it is running. This supports both\n * local snap IDs and NPM snap IDs.\n * @param options - The options to use.\n * @param options.executionService - The execution service to use. Defaults to\n * {@link NodeThreadExecutionService}. You do not need to provide this unless\n * you are testing a custom execution service.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId?: SnapId | Partial<InstallSnapOptions<Service>>,\n options: Partial<InstallSnapOptions<Service>> = {},\n): Promise<Snap> {\n const resolvedOptions = getOptions(snapId, options);\n const {\n snapId: installedSnapId,\n store,\n executionService,\n runSaga,\n controllerMessenger,\n } = await getEnvironment().installSnap(...resolvedOptions);\n\n const onTransaction = async (\n request: TransactionOptions,\n ): Promise<SnapResponseWithInterface> => {\n log('Sending transaction %o.', request);\n\n const {\n origin: transactionOrigin,\n chainId,\n ...transaction\n } = create(request, TransactionOptionsStruct);\n\n const response = await handleRequest({\n snapId: installedSnapId,\n store,\n executionService,\n runSaga,\n controllerMessenger,\n handler: HandlerType.OnTransaction,\n request: {\n method: '',\n params: {\n chainId,\n transaction,\n transactionOrigin,\n },\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n };\n\n const onCronjob = (request: CronjobOptions) => {\n log('Running cronjob %o.', options);\n\n return handleRequest({\n snapId: installedSnapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnCronjob,\n request,\n });\n };\n\n return {\n request: (request) => {\n log('Sending request %o.', request);\n\n return handleRequest({\n snapId: installedSnapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnRpcRequest,\n request,\n });\n },\n\n onTransaction,\n sendTransaction: onTransaction,\n\n onSignature: async (\n request: unknown,\n ): Promise<SnapResponseWithInterface> => {\n log('Requesting signature %o.', request);\n\n const { origin: signatureOrigin, ...signature } = create(\n request,\n SignatureOptionsStruct,\n );\n\n const response = await handleRequest({\n snapId: installedSnapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnSignature,\n request: {\n method: '',\n params: {\n signature,\n signatureOrigin,\n },\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n },\n\n onCronjob,\n runCronjob: onCronjob,\n\n onHomePage: async (): Promise<SnapResponseWithInterface> => {\n log('Rendering home page.');\n\n const response = await handleRequest({\n snapId: installedSnapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnHomePage,\n request: {\n method: '',\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n },\n\n mockJsonRpc(mock: JsonRpcMockOptions) {\n log('Mocking JSON-RPC request %o.', mock);\n\n const { method, result } = create(mock, JsonRpcMockOptionsStruct);\n store.dispatch(addJsonRpcMock({ method, result }));\n\n return {\n unmock() {\n log('Unmocking JSON-RPC request %o.', mock);\n\n store.dispatch(removeJsonRpcMock(method));\n },\n };\n },\n\n close: async () => {\n log('Closing execution service.');\n logInfo(\n 'Calling `snap.close()` is deprecated, and will be removed in a future release. Snaps are now automatically closed when the test ends.',\n );\n\n await executionService.terminateAllSnaps();\n },\n };\n}\n"]}
1
+ {"version":3,"file":"helpers.mjs","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,8BAA8B;AAChD,OAAO,EAAE,kBAAkB,EAAE,wBAAwB;AAErD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,8BAAoB;AAEzD,MAAM,GAAG,GAAG,kBAAkB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAEtD;;;;;;GAMG;AACH,SAAS,UAAU,CAKjB,MAAiE,EACjE,OAA6C;IAE7C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3B,CAAC;AAqGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAK/B,MAAsD,EACtD,UAAgD,EAAE;IAElD,MAAM,eAAe,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,MAAM,EACJ,OAAO,EACP,aAAa,EACb,eAAe,EACf,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACX,KAAK,GACN,GAAG,MAAM,cAAc,EAAE,CAAC,WAAW,CAAC,GAAG,eAAe,CAAC,CAAC;IAE3D,OAAO;QACL,OAAO;QACP,aAAa;QACb,eAAe;QACf,WAAW;QACX,SAAS;QACT,UAAU;QACV,UAAU;QACV,WAAW;QACX,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,GAAG,CAAC,4BAA4B,CAAC,CAAC;YAClC,OAAO,CACL,uIAAuI,CACxI,CAAC;YAEF,MAAM,KAAK,EAAE,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { AbstractExecutionService } from '@metamask/snaps-controllers';\nimport type { SnapId } from '@metamask/snaps-sdk';\nimport type { InstallSnapOptions, Snap } from '@metamask/snaps-simulation';\nimport { logInfo } from '@metamask/snaps-utils';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { rootLogger, getEnvironment } from './internals';\n\nconst log = createModuleLogger(rootLogger, 'helpers');\n\n/**\n * Get the options for {@link installSnap}.\n *\n * @param snapId - The ID of the Snap, or the options.\n * @param options - The options, if any.\n * @returns The options.\n */\nfunction getOptions<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId: SnapId | Partial<InstallSnapOptions<Service>> | undefined,\n options: Partial<InstallSnapOptions<Service>>,\n): [SnapId | undefined, Partial<InstallSnapOptions<Service>>] {\n if (typeof snapId === 'object') {\n return [undefined, snapId];\n }\n\n return [snapId, options];\n}\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap(): Promise<Snap>;\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @param options - The options to use.\n * @param options.executionService - The execution service to use. Defaults to\n * {@link NodeThreadExecutionService}. You do not need to provide this unless\n * you are testing a custom execution service.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(options: Partial<InstallSnapOptions<Service>>): Promise<Snap>;\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @param snapId - The ID of the snap, including the prefix (`local:`). Defaults\n * to the URL of the built-in server, if it is running. This supports both\n * local snap IDs and NPM snap IDs.\n * @param options - The options to use.\n * @param options.executionService - The execution service to use. Defaults to\n * {@link NodeThreadExecutionService}. You do not need to provide this unless\n * you are testing a custom execution service.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId: SnapId,\n options?: Partial<InstallSnapOptions<Service>>,\n): Promise<Snap>;\n\n/**\n * Load a snap into the environment. This is the main entry point for testing\n * snaps: It returns a {@link Snap} object that can be used to interact with the\n * snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * describe('My Snap', () => {\n * it('should do something', async () => {\n * const { request } = await installSnap('local:my-snap');\n * const response = await request({\n * method: 'foo',\n * params: ['bar'],\n * });\n * expect(response).toRespondWith('bar');\n * });\n * });\n * @param snapId - The ID of the snap, including the prefix (`local:`). Defaults\n * to the URL of the built-in server, if it is running. This supports both\n * local snap IDs and NPM snap IDs.\n * @param options - The options to use.\n * @param options.executionService - The execution service to use. Defaults to\n * {@link NodeThreadExecutionService}. You do not need to provide this unless\n * you are testing a custom execution service.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @returns The snap.\n * @throws If the built-in server is not running, and no snap ID is provided.\n */\nexport async function installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId?: SnapId | Partial<InstallSnapOptions<Service>>,\n options: Partial<InstallSnapOptions<Service>> = {},\n): Promise<Snap> {\n const resolvedOptions = getOptions(snapId, options);\n const {\n request,\n onTransaction,\n sendTransaction,\n onSignature,\n onCronjob,\n runCronjob,\n onHomePage,\n mockJsonRpc,\n close,\n } = await getEnvironment().installSnap(...resolvedOptions);\n\n return {\n request,\n onTransaction,\n sendTransaction,\n onSignature,\n onCronjob,\n runCronjob,\n onHomePage,\n mockJsonRpc,\n close: async () => {\n log('Closing execution service.');\n logInfo(\n 'Calling `snap.close()` is deprecated, and will be removed in a future release. Snaps are now automatically closed when the test ends.',\n );\n\n await close();\n },\n };\n}\n"]}
package/dist/index.cjs CHANGED
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.TestEnvironment = exports.default = void 0;
20
+ exports.assertIsPromptDialog = exports.assertIsCustomDialog = exports.assertIsConfirmationDialog = exports.assertIsAlertDialog = exports.assertCustomDialogHasPartialFooter = exports.assertCustomDialogHasNoFooter = exports.TestEnvironment = exports.default = void 0;
21
21
  // eslint-disable-next-line import/no-unassigned-import
22
22
  require("./global.cjs");
23
23
  var environment_1 = require("./environment.cjs");
@@ -25,5 +25,11 @@ Object.defineProperty(exports, "default", { enumerable: true, get: function () {
25
25
  Object.defineProperty(exports, "TestEnvironment", { enumerable: true, get: function () { return __importDefault(environment_1).default; } });
26
26
  __exportStar(require("./helpers.cjs"), exports);
27
27
  __exportStar(require("./options.cjs"), exports);
28
- __exportStar(require("./types/index.cjs"), exports);
28
+ var snaps_simulation_1 = require("@metamask/snaps-simulation");
29
+ Object.defineProperty(exports, "assertCustomDialogHasNoFooter", { enumerable: true, get: function () { return snaps_simulation_1.assertCustomDialogHasNoFooter; } });
30
+ Object.defineProperty(exports, "assertCustomDialogHasPartialFooter", { enumerable: true, get: function () { return snaps_simulation_1.assertCustomDialogHasPartialFooter; } });
31
+ Object.defineProperty(exports, "assertIsAlertDialog", { enumerable: true, get: function () { return snaps_simulation_1.assertIsAlertDialog; } });
32
+ Object.defineProperty(exports, "assertIsConfirmationDialog", { enumerable: true, get: function () { return snaps_simulation_1.assertIsConfirmationDialog; } });
33
+ Object.defineProperty(exports, "assertIsCustomDialog", { enumerable: true, get: function () { return snaps_simulation_1.assertIsCustomDialog; } });
34
+ Object.defineProperty(exports, "assertIsPromptDialog", { enumerable: true, get: function () { return snaps_simulation_1.assertIsPromptDialog; } });
29
35
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,wBAAkB;AAElB,iDAAoE;AAA3D,uHAAA,OAAO,OAAA;AAAE,+HAAA,OAAO,OAAmB;AAC5C,gDAA0B;AAC1B,gDAA0B;AAC1B,oDAAwB","sourcesContent":["// eslint-disable-next-line import/no-unassigned-import\nimport './global';\n\nexport { default, default as TestEnvironment } from './environment';\nexport * from './helpers';\nexport * from './options';\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,wBAAkB;AAElB,iDAAoE;AAA3D,uHAAA,OAAO,OAAA;AAAE,+HAAA,OAAO,OAAmB;AAC5C,gDAA0B;AAC1B,gDAA0B;AAE1B,+DAOoC;AANlC,iIAAA,6BAA6B,OAAA;AAC7B,sIAAA,kCAAkC,OAAA;AAClC,uHAAA,mBAAmB,OAAA;AACnB,8HAAA,0BAA0B,OAAA;AAC1B,wHAAA,oBAAoB,OAAA;AACpB,wHAAA,oBAAoB,OAAA","sourcesContent":["// eslint-disable-next-line import/no-unassigned-import\nimport './global';\n\nexport { default, default as TestEnvironment } from './environment';\nexport * from './helpers';\nexport * from './options';\n\nexport {\n assertCustomDialogHasNoFooter,\n assertCustomDialogHasPartialFooter,\n assertIsAlertDialog,\n assertIsConfirmationDialog,\n assertIsCustomDialog,\n assertIsPromptDialog,\n} from '@metamask/snaps-simulation';\n\nexport type {\n CronjobOptions,\n DefaultSnapInterface,\n DefaultSnapInterfaceWithFooter,\n DefaultSnapInterfaceWithPartialFooter,\n DefaultSnapInterfaceWithoutFooter,\n FileOptions,\n RequestOptions,\n SignatureOptions,\n Snap,\n SnapAlertInterface,\n SnapConfirmationInterface,\n SnapHandlerInterface,\n SnapInterface,\n SnapInterfaceActions,\n SnapOptions,\n SnapPromptInterface,\n SnapResponse,\n SnapResponseType,\n SnapResponseWithInterface,\n SnapResponseWithoutInterface,\n SnapRequest,\n SnapRequestObject,\n TransactionOptions,\n} from '@metamask/snaps-simulation';\n"]}
package/dist/index.d.cts CHANGED
@@ -2,5 +2,6 @@ import "./global.cjs";
2
2
  export { default, default as TestEnvironment } from "./environment.cjs";
3
3
  export * from "./helpers.cjs";
4
4
  export * from "./options.cjs";
5
- export * from "./types/index.cjs";
5
+ export { assertCustomDialogHasNoFooter, assertCustomDialogHasPartialFooter, assertIsAlertDialog, assertIsConfirmationDialog, assertIsCustomDialog, assertIsPromptDialog, } from "@metamask/snaps-simulation";
6
+ export type { CronjobOptions, DefaultSnapInterface, DefaultSnapInterfaceWithFooter, DefaultSnapInterfaceWithPartialFooter, DefaultSnapInterfaceWithoutFooter, FileOptions, RequestOptions, SignatureOptions, Snap, SnapAlertInterface, SnapConfirmationInterface, SnapHandlerInterface, SnapInterface, SnapInterfaceActions, SnapOptions, SnapPromptInterface, SnapResponse, SnapResponseType, SnapResponseWithInterface, SnapResponseWithoutInterface, SnapRequest, SnapRequestObject, TransactionOptions, } from "@metamask/snaps-simulation";
6
7
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,sBAAkB;AAElB,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,0BAAsB;AACpE,8BAA0B;AAC1B,8BAA0B;AAC1B,kCAAwB"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,sBAAkB;AAElB,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,0BAAsB;AACpE,8BAA0B;AAC1B,8BAA0B;AAE1B,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,EAClC,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,GACrB,mCAAmC;AAEpC,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,8BAA8B,EAC9B,qCAAqC,EACrC,iCAAiC,EACjC,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,IAAI,EACJ,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,yBAAyB,EACzB,4BAA4B,EAC5B,WAAW,EACX,iBAAiB,EACjB,kBAAkB,GACnB,mCAAmC"}
package/dist/index.d.mts CHANGED
@@ -2,5 +2,6 @@ import "./global.mjs";
2
2
  export { default, default as TestEnvironment } from "./environment.mjs";
3
3
  export * from "./helpers.mjs";
4
4
  export * from "./options.mjs";
5
- export * from "./types/index.mjs";
5
+ export { assertCustomDialogHasNoFooter, assertCustomDialogHasPartialFooter, assertIsAlertDialog, assertIsConfirmationDialog, assertIsCustomDialog, assertIsPromptDialog, } from "@metamask/snaps-simulation";
6
+ export type { CronjobOptions, DefaultSnapInterface, DefaultSnapInterfaceWithFooter, DefaultSnapInterfaceWithPartialFooter, DefaultSnapInterfaceWithoutFooter, FileOptions, RequestOptions, SignatureOptions, Snap, SnapAlertInterface, SnapConfirmationInterface, SnapHandlerInterface, SnapInterface, SnapInterfaceActions, SnapOptions, SnapPromptInterface, SnapResponse, SnapResponseType, SnapResponseWithInterface, SnapResponseWithoutInterface, SnapRequest, SnapRequestObject, TransactionOptions, } from "@metamask/snaps-simulation";
6
7
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,sBAAkB;AAElB,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,0BAAsB;AACpE,8BAA0B;AAC1B,8BAA0B;AAC1B,kCAAwB"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,sBAAkB;AAElB,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,0BAAsB;AACpE,8BAA0B;AAC1B,8BAA0B;AAE1B,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,EAClC,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,GACrB,mCAAmC;AAEpC,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,8BAA8B,EAC9B,qCAAqC,EACrC,iCAAiC,EACjC,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,IAAI,EACJ,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,yBAAyB,EACzB,4BAA4B,EAC5B,WAAW,EACX,iBAAiB,EACjB,kBAAkB,GACnB,mCAAmC"}
package/dist/index.mjs CHANGED
@@ -3,5 +3,5 @@ import "./global.mjs";
3
3
  export { default, default as TestEnvironment } from "./environment.mjs";
4
4
  export * from "./helpers.mjs";
5
5
  export * from "./options.mjs";
6
- export * from "./types/index.mjs";
6
+ export { assertCustomDialogHasNoFooter, assertCustomDialogHasPartialFooter, assertIsAlertDialog, assertIsConfirmationDialog, assertIsCustomDialog, assertIsPromptDialog } from "@metamask/snaps-simulation";
7
7
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,sBAAkB;AAElB,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,0BAAsB;AACpE,8BAA0B;AAC1B,8BAA0B;AAC1B,kCAAwB","sourcesContent":["// eslint-disable-next-line import/no-unassigned-import\nimport './global';\n\nexport { default, default as TestEnvironment } from './environment';\nexport * from './helpers';\nexport * from './options';\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,sBAAkB;AAElB,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,0BAAsB;AACpE,8BAA0B;AAC1B,8BAA0B;AAE1B,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,EAClC,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACrB,mCAAmC","sourcesContent":["// eslint-disable-next-line import/no-unassigned-import\nimport './global';\n\nexport { default, default as TestEnvironment } from './environment';\nexport * from './helpers';\nexport * from './options';\n\nexport {\n assertCustomDialogHasNoFooter,\n assertCustomDialogHasPartialFooter,\n assertIsAlertDialog,\n assertIsConfirmationDialog,\n assertIsCustomDialog,\n assertIsPromptDialog,\n} from '@metamask/snaps-simulation';\n\nexport type {\n CronjobOptions,\n DefaultSnapInterface,\n DefaultSnapInterfaceWithFooter,\n DefaultSnapInterfaceWithPartialFooter,\n DefaultSnapInterfaceWithoutFooter,\n FileOptions,\n RequestOptions,\n SignatureOptions,\n Snap,\n SnapAlertInterface,\n SnapConfirmationInterface,\n SnapHandlerInterface,\n SnapInterface,\n SnapInterfaceActions,\n SnapOptions,\n SnapPromptInterface,\n SnapResponse,\n SnapResponseType,\n SnapResponseWithInterface,\n SnapResponseWithoutInterface,\n SnapRequest,\n SnapRequestObject,\n TransactionOptions,\n} from '@metamask/snaps-simulation';\n"]}
@@ -16,8 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./environment.cjs"), exports);
18
18
  __exportStar(require("./logger.cjs"), exports);
19
- __exportStar(require("./request.cjs"), exports);
20
19
  __exportStar(require("./server.cjs"), exports);
21
- __exportStar(require("./simulation/index.cjs"), exports);
22
- __exportStar(require("./structs.cjs"), exports);
23
20
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/internals/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAA8B;AAC9B,+CAAyB;AACzB,gDAA0B;AAC1B,+CAAyB;AACzB,yDAA6B;AAC7B,gDAA0B","sourcesContent":["export * from './environment';\nexport * from './logger';\nexport * from './request';\nexport * from './server';\nexport * from './simulation';\nexport * from './structs';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/internals/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAA8B;AAC9B,+CAAyB;AACzB,+CAAyB","sourcesContent":["export * from './environment';\nexport * from './logger';\nexport * from './server';\n"]}
@@ -1,7 +1,4 @@
1
1
  export * from "./environment.cjs";
2
2
  export * from "./logger.cjs";
3
- export * from "./request.cjs";
4
3
  export * from "./server.cjs";
5
- export * from "./simulation/index.cjs";
6
- export * from "./structs.cjs";
7
4
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/internals/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,6BAAyB;AACzB,8BAA0B;AAC1B,6BAAyB;AACzB,uCAA6B;AAC7B,8BAA0B"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/internals/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,6BAAyB;AACzB,6BAAyB"}
@@ -1,7 +1,4 @@
1
1
  export * from "./environment.mjs";
2
2
  export * from "./logger.mjs";
3
- export * from "./request.mjs";
4
3
  export * from "./server.mjs";
5
- export * from "./simulation/index.mjs";
6
- export * from "./structs.mjs";
7
4
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/internals/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,6BAAyB;AACzB,8BAA0B;AAC1B,6BAAyB;AACzB,uCAA6B;AAC7B,8BAA0B"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/internals/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,6BAAyB;AACzB,6BAAyB"}
@@ -1,7 +1,4 @@
1
1
  export * from "./environment.mjs";
2
2
  export * from "./logger.mjs";
3
- export * from "./request.mjs";
4
3
  export * from "./server.mjs";
5
- export * from "./simulation/index.mjs";
6
- export * from "./structs.mjs";
7
4
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/internals/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,6BAAyB;AACzB,8BAA0B;AAC1B,6BAAyB;AACzB,uCAA6B;AAC7B,8BAA0B","sourcesContent":["export * from './environment';\nexport * from './logger';\nexport * from './request';\nexport * from './server';\nexport * from './simulation';\nexport * from './structs';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/internals/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,6BAAyB;AACzB,6BAAyB","sourcesContent":["export * from './environment';\nexport * from './logger';\nexport * from './server';\n"]}