@metamask/snaps-jest 8.3.2 → 8.4.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 (294) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/dist/environment.cjs +2 -1
  3. package/dist/environment.cjs.map +1 -1
  4. package/dist/environment.d.cts +1 -1
  5. package/dist/environment.d.cts.map +1 -1
  6. package/dist/environment.d.mts +1 -1
  7. package/dist/environment.d.mts.map +1 -1
  8. package/dist/environment.mjs +3 -2
  9. package/dist/environment.mjs.map +1 -1
  10. package/dist/helpers.cjs +13 -80
  11. package/dist/helpers.cjs.map +1 -1
  12. package/dist/helpers.d.cts +2 -44
  13. package/dist/helpers.d.cts.map +1 -1
  14. package/dist/helpers.d.mts +2 -44
  15. package/dist/helpers.d.mts.map +1 -1
  16. package/dist/helpers.mjs +4 -64
  17. package/dist/helpers.mjs.map +1 -1
  18. package/dist/index.cjs +8 -1
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +1 -0
  21. package/dist/index.d.cts.map +1 -1
  22. package/dist/index.d.mts +1 -0
  23. package/dist/index.d.mts.map +1 -1
  24. package/dist/index.mjs +1 -0
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/internals/index.cjs +0 -3
  27. package/dist/internals/index.cjs.map +1 -1
  28. package/dist/internals/index.d.cts +0 -3
  29. package/dist/internals/index.d.cts.map +1 -1
  30. package/dist/internals/index.d.mts +0 -3
  31. package/dist/internals/index.d.mts.map +1 -1
  32. package/dist/internals/index.mjs +0 -3
  33. package/dist/internals/index.mjs.map +1 -1
  34. package/dist/matchers.cjs +3 -3
  35. package/dist/matchers.cjs.map +1 -1
  36. package/dist/matchers.d.cts.map +1 -1
  37. package/dist/matchers.d.mts.map +1 -1
  38. package/dist/matchers.mjs +1 -1
  39. package/dist/matchers.mjs.map +1 -1
  40. package/dist/types/types.cjs.map +1 -1
  41. package/dist/types/types.d.cts +8 -1
  42. package/dist/types/types.d.cts.map +1 -1
  43. package/dist/types/types.d.mts +8 -1
  44. package/dist/types/types.d.mts.map +1 -1
  45. package/dist/types/types.mjs.map +1 -1
  46. package/package.json +4 -17
  47. package/dist/internals/request.cjs +0 -143
  48. package/dist/internals/request.cjs.map +0 -1
  49. package/dist/internals/request.d.cts +0 -56
  50. package/dist/internals/request.d.cts.map +0 -1
  51. package/dist/internals/request.d.mts +0 -56
  52. package/dist/internals/request.d.mts.map +0 -1
  53. package/dist/internals/request.mjs +0 -138
  54. package/dist/internals/request.mjs.map +0 -1
  55. package/dist/internals/simulation/constants.cjs +0 -21
  56. package/dist/internals/simulation/constants.cjs.map +0 -1
  57. package/dist/internals/simulation/constants.d.cts +0 -18
  58. package/dist/internals/simulation/constants.d.cts.map +0 -1
  59. package/dist/internals/simulation/constants.d.mts +0 -18
  60. package/dist/internals/simulation/constants.d.mts.map +0 -1
  61. package/dist/internals/simulation/constants.mjs +0 -18
  62. package/dist/internals/simulation/constants.mjs.map +0 -1
  63. package/dist/internals/simulation/controllers.cjs +0 -101
  64. package/dist/internals/simulation/controllers.cjs.map +0 -1
  65. package/dist/internals/simulation/controllers.d.cts +0 -41
  66. package/dist/internals/simulation/controllers.d.cts.map +0 -1
  67. package/dist/internals/simulation/controllers.d.mts +0 -41
  68. package/dist/internals/simulation/controllers.d.mts.map +0 -1
  69. package/dist/internals/simulation/controllers.mjs +0 -96
  70. package/dist/internals/simulation/controllers.mjs.map +0 -1
  71. package/dist/internals/simulation/files.cjs +0 -94
  72. package/dist/internals/simulation/files.cjs.map +0 -1
  73. package/dist/internals/simulation/files.d.cts +0 -49
  74. package/dist/internals/simulation/files.d.cts.map +0 -1
  75. package/dist/internals/simulation/files.d.mts +0 -49
  76. package/dist/internals/simulation/files.d.mts.map +0 -1
  77. package/dist/internals/simulation/files.mjs +0 -91
  78. package/dist/internals/simulation/files.mjs.map +0 -1
  79. package/dist/internals/simulation/index.cjs +0 -22
  80. package/dist/internals/simulation/index.cjs.map +0 -1
  81. package/dist/internals/simulation/index.d.cts +0 -6
  82. package/dist/internals/simulation/index.d.cts.map +0 -1
  83. package/dist/internals/simulation/index.d.mts +0 -6
  84. package/dist/internals/simulation/index.d.mts.map +0 -1
  85. package/dist/internals/simulation/index.mjs +0 -6
  86. package/dist/internals/simulation/index.mjs.map +0 -1
  87. package/dist/internals/simulation/interface.cjs +0 -527
  88. package/dist/internals/simulation/interface.cjs.map +0 -1
  89. package/dist/internals/simulation/interface.d.cts +0 -152
  90. package/dist/internals/simulation/interface.d.cts.map +0 -1
  91. package/dist/internals/simulation/interface.d.mts +0 -152
  92. package/dist/internals/simulation/interface.d.mts.map +0 -1
  93. package/dist/internals/simulation/interface.mjs +0 -513
  94. package/dist/internals/simulation/interface.mjs.map +0 -1
  95. package/dist/internals/simulation/methods/constants.cjs +0 -72
  96. package/dist/internals/simulation/methods/constants.cjs.map +0 -1
  97. package/dist/internals/simulation/methods/constants.d.cts +0 -11
  98. package/dist/internals/simulation/methods/constants.d.cts.map +0 -1
  99. package/dist/internals/simulation/methods/constants.d.mts +0 -11
  100. package/dist/internals/simulation/methods/constants.d.mts.map +0 -1
  101. package/dist/internals/simulation/methods/constants.mjs +0 -69
  102. package/dist/internals/simulation/methods/constants.mjs.map +0 -1
  103. package/dist/internals/simulation/methods/hooks/get-preferences.cjs +0 -18
  104. package/dist/internals/simulation/methods/hooks/get-preferences.cjs.map +0 -1
  105. package/dist/internals/simulation/methods/hooks/get-preferences.d.cts +0 -14
  106. package/dist/internals/simulation/methods/hooks/get-preferences.d.cts.map +0 -1
  107. package/dist/internals/simulation/methods/hooks/get-preferences.d.mts +0 -14
  108. package/dist/internals/simulation/methods/hooks/get-preferences.d.mts.map +0 -1
  109. package/dist/internals/simulation/methods/hooks/get-preferences.mjs +0 -14
  110. package/dist/internals/simulation/methods/hooks/get-preferences.mjs.map +0 -1
  111. package/dist/internals/simulation/methods/hooks/index.cjs +0 -22
  112. package/dist/internals/simulation/methods/hooks/index.cjs.map +0 -1
  113. package/dist/internals/simulation/methods/hooks/index.d.cts +0 -6
  114. package/dist/internals/simulation/methods/hooks/index.d.cts.map +0 -1
  115. package/dist/internals/simulation/methods/hooks/index.d.mts +0 -6
  116. package/dist/internals/simulation/methods/hooks/index.d.mts.map +0 -1
  117. package/dist/internals/simulation/methods/hooks/index.mjs +0 -6
  118. package/dist/internals/simulation/methods/hooks/index.mjs.map +0 -1
  119. package/dist/internals/simulation/methods/hooks/interface.cjs +0 -24
  120. package/dist/internals/simulation/methods/hooks/interface.cjs.map +0 -1
  121. package/dist/internals/simulation/methods/hooks/interface.d.cts +0 -17
  122. package/dist/internals/simulation/methods/hooks/interface.d.cts.map +0 -1
  123. package/dist/internals/simulation/methods/hooks/interface.d.mts +0 -17
  124. package/dist/internals/simulation/methods/hooks/interface.d.mts.map +0 -1
  125. package/dist/internals/simulation/methods/hooks/interface.mjs +0 -19
  126. package/dist/internals/simulation/methods/hooks/interface.mjs.map +0 -1
  127. package/dist/internals/simulation/methods/hooks/notifications.cjs +0 -58
  128. package/dist/internals/simulation/methods/hooks/notifications.cjs.map +0 -1
  129. package/dist/internals/simulation/methods/hooks/notifications.d.cts +0 -17
  130. package/dist/internals/simulation/methods/hooks/notifications.d.cts.map +0 -1
  131. package/dist/internals/simulation/methods/hooks/notifications.d.mts +0 -17
  132. package/dist/internals/simulation/methods/hooks/notifications.d.mts.map +0 -1
  133. package/dist/internals/simulation/methods/hooks/notifications.mjs +0 -55
  134. package/dist/internals/simulation/methods/hooks/notifications.mjs.map +0 -1
  135. package/dist/internals/simulation/methods/hooks/request-user-approval.cjs +0 -38
  136. package/dist/internals/simulation/methods/hooks/request-user-approval.cjs.map +0 -1
  137. package/dist/internals/simulation/methods/hooks/request-user-approval.d.cts +0 -16
  138. package/dist/internals/simulation/methods/hooks/request-user-approval.d.cts.map +0 -1
  139. package/dist/internals/simulation/methods/hooks/request-user-approval.d.mts +0 -16
  140. package/dist/internals/simulation/methods/hooks/request-user-approval.d.mts.map +0 -1
  141. package/dist/internals/simulation/methods/hooks/request-user-approval.mjs +0 -35
  142. package/dist/internals/simulation/methods/hooks/request-user-approval.mjs.map +0 -1
  143. package/dist/internals/simulation/methods/hooks/state.cjs +0 -84
  144. package/dist/internals/simulation/methods/hooks/state.cjs.map +0 -1
  145. package/dist/internals/simulation/methods/hooks/state.d.cts +0 -24
  146. package/dist/internals/simulation/methods/hooks/state.d.cts.map +0 -1
  147. package/dist/internals/simulation/methods/hooks/state.d.mts +0 -24
  148. package/dist/internals/simulation/methods/hooks/state.d.mts.map +0 -1
  149. package/dist/internals/simulation/methods/hooks/state.mjs +0 -79
  150. package/dist/internals/simulation/methods/hooks/state.mjs.map +0 -1
  151. package/dist/internals/simulation/methods/index.cjs +0 -18
  152. package/dist/internals/simulation/methods/index.cjs.map +0 -1
  153. package/dist/internals/simulation/methods/index.d.cts +0 -2
  154. package/dist/internals/simulation/methods/index.d.cts.map +0 -1
  155. package/dist/internals/simulation/methods/index.d.mts +0 -2
  156. package/dist/internals/simulation/methods/index.d.mts.map +0 -1
  157. package/dist/internals/simulation/methods/index.mjs +0 -2
  158. package/dist/internals/simulation/methods/index.mjs.map +0 -1
  159. package/dist/internals/simulation/methods/specifications.cjs +0 -85
  160. package/dist/internals/simulation/methods/specifications.cjs.map +0 -1
  161. package/dist/internals/simulation/methods/specifications.d.cts +0 -57
  162. package/dist/internals/simulation/methods/specifications.d.cts.map +0 -1
  163. package/dist/internals/simulation/methods/specifications.d.mts +0 -57
  164. package/dist/internals/simulation/methods/specifications.d.mts.map +0 -1
  165. package/dist/internals/simulation/methods/specifications.mjs +0 -78
  166. package/dist/internals/simulation/methods/specifications.mjs.map +0 -1
  167. package/dist/internals/simulation/middleware/engine.cjs +0 -37
  168. package/dist/internals/simulation/middleware/engine.cjs.map +0 -1
  169. package/dist/internals/simulation/middleware/engine.d.cts +0 -27
  170. package/dist/internals/simulation/middleware/engine.d.cts.map +0 -1
  171. package/dist/internals/simulation/middleware/engine.d.mts +0 -27
  172. package/dist/internals/simulation/middleware/engine.d.mts.map +0 -1
  173. package/dist/internals/simulation/middleware/engine.mjs +0 -34
  174. package/dist/internals/simulation/middleware/engine.mjs.map +0 -1
  175. package/dist/internals/simulation/middleware/index.cjs +0 -18
  176. package/dist/internals/simulation/middleware/index.cjs.map +0 -1
  177. package/dist/internals/simulation/middleware/index.d.cts +0 -2
  178. package/dist/internals/simulation/middleware/index.d.cts.map +0 -1
  179. package/dist/internals/simulation/middleware/index.d.mts +0 -2
  180. package/dist/internals/simulation/middleware/index.d.mts.map +0 -1
  181. package/dist/internals/simulation/middleware/index.mjs +0 -2
  182. package/dist/internals/simulation/middleware/index.mjs.map +0 -1
  183. package/dist/internals/simulation/middleware/internal-methods/accounts.cjs +0 -34
  184. package/dist/internals/simulation/middleware/internal-methods/accounts.cjs.map +0 -1
  185. package/dist/internals/simulation/middleware/internal-methods/accounts.d.cts +0 -20
  186. package/dist/internals/simulation/middleware/internal-methods/accounts.d.cts.map +0 -1
  187. package/dist/internals/simulation/middleware/internal-methods/accounts.d.mts +0 -20
  188. package/dist/internals/simulation/middleware/internal-methods/accounts.d.mts.map +0 -1
  189. package/dist/internals/simulation/middleware/internal-methods/accounts.mjs +0 -30
  190. package/dist/internals/simulation/middleware/internal-methods/accounts.mjs.map +0 -1
  191. package/dist/internals/simulation/middleware/internal-methods/index.cjs +0 -18
  192. package/dist/internals/simulation/middleware/internal-methods/index.cjs.map +0 -1
  193. package/dist/internals/simulation/middleware/internal-methods/index.d.cts +0 -2
  194. package/dist/internals/simulation/middleware/internal-methods/index.d.cts.map +0 -1
  195. package/dist/internals/simulation/middleware/internal-methods/index.d.mts +0 -2
  196. package/dist/internals/simulation/middleware/internal-methods/index.d.mts.map +0 -1
  197. package/dist/internals/simulation/middleware/internal-methods/index.mjs +0 -2
  198. package/dist/internals/simulation/middleware/internal-methods/index.mjs.map +0 -1
  199. package/dist/internals/simulation/middleware/internal-methods/middleware.cjs +0 -44
  200. package/dist/internals/simulation/middleware/internal-methods/middleware.cjs.map +0 -1
  201. package/dist/internals/simulation/middleware/internal-methods/middleware.d.cts +0 -23
  202. package/dist/internals/simulation/middleware/internal-methods/middleware.d.cts.map +0 -1
  203. package/dist/internals/simulation/middleware/internal-methods/middleware.d.mts +0 -23
  204. package/dist/internals/simulation/middleware/internal-methods/middleware.d.mts.map +0 -1
  205. package/dist/internals/simulation/middleware/internal-methods/middleware.mjs +0 -40
  206. package/dist/internals/simulation/middleware/internal-methods/middleware.mjs.map +0 -1
  207. package/dist/internals/simulation/middleware/internal-methods/provider-state.cjs +0 -28
  208. package/dist/internals/simulation/middleware/internal-methods/provider-state.cjs.map +0 -1
  209. package/dist/internals/simulation/middleware/internal-methods/provider-state.d.cts +0 -16
  210. package/dist/internals/simulation/middleware/internal-methods/provider-state.d.cts.map +0 -1
  211. package/dist/internals/simulation/middleware/internal-methods/provider-state.d.mts +0 -16
  212. package/dist/internals/simulation/middleware/internal-methods/provider-state.d.mts.map +0 -1
  213. package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs +0 -24
  214. package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs.map +0 -1
  215. package/dist/internals/simulation/middleware/mock.cjs +0 -22
  216. package/dist/internals/simulation/middleware/mock.cjs.map +0 -1
  217. package/dist/internals/simulation/middleware/mock.d.cts +0 -11
  218. package/dist/internals/simulation/middleware/mock.d.cts.map +0 -1
  219. package/dist/internals/simulation/middleware/mock.d.mts +0 -11
  220. package/dist/internals/simulation/middleware/mock.d.mts.map +0 -1
  221. package/dist/internals/simulation/middleware/mock.mjs +0 -18
  222. package/dist/internals/simulation/middleware/mock.mjs.map +0 -1
  223. package/dist/internals/simulation/options.cjs +0 -25
  224. package/dist/internals/simulation/options.cjs.map +0 -1
  225. package/dist/internals/simulation/options.d.cts +0 -40
  226. package/dist/internals/simulation/options.d.cts.map +0 -1
  227. package/dist/internals/simulation/options.d.mts +0 -40
  228. package/dist/internals/simulation/options.d.mts.map +0 -1
  229. package/dist/internals/simulation/options.mjs +0 -21
  230. package/dist/internals/simulation/options.mjs.map +0 -1
  231. package/dist/internals/simulation/simulation.cjs +0 -155
  232. package/dist/internals/simulation/simulation.cjs.map +0 -1
  233. package/dist/internals/simulation/simulation.d.cts +0 -103
  234. package/dist/internals/simulation/simulation.d.cts.map +0 -1
  235. package/dist/internals/simulation/simulation.d.mts +0 -103
  236. package/dist/internals/simulation/simulation.d.mts.map +0 -1
  237. package/dist/internals/simulation/simulation.mjs +0 -150
  238. package/dist/internals/simulation/simulation.mjs.map +0 -1
  239. package/dist/internals/simulation/store/index.cjs +0 -21
  240. package/dist/internals/simulation/store/index.cjs.map +0 -1
  241. package/dist/internals/simulation/store/index.d.cts +0 -5
  242. package/dist/internals/simulation/store/index.d.cts.map +0 -1
  243. package/dist/internals/simulation/store/index.d.mts +0 -5
  244. package/dist/internals/simulation/store/index.d.mts.map +0 -1
  245. package/dist/internals/simulation/store/index.mjs +0 -5
  246. package/dist/internals/simulation/store/index.mjs.map +0 -1
  247. package/dist/internals/simulation/store/mocks.cjs +0 -39
  248. package/dist/internals/simulation/store/mocks.cjs.map +0 -1
  249. package/dist/internals/simulation/store/mocks.d.cts +0 -36
  250. package/dist/internals/simulation/store/mocks.d.cts.map +0 -1
  251. package/dist/internals/simulation/store/mocks.d.mts +0 -36
  252. package/dist/internals/simulation/store/mocks.d.mts.map +0 -1
  253. package/dist/internals/simulation/store/mocks.mjs +0 -35
  254. package/dist/internals/simulation/store/mocks.mjs.map +0 -1
  255. package/dist/internals/simulation/store/notifications.cjs +0 -35
  256. package/dist/internals/simulation/store/notifications.cjs.map +0 -1
  257. package/dist/internals/simulation/store/notifications.d.cts +0 -45
  258. package/dist/internals/simulation/store/notifications.d.cts.map +0 -1
  259. package/dist/internals/simulation/store/notifications.d.mts +0 -45
  260. package/dist/internals/simulation/store/notifications.d.mts.map +0 -1
  261. package/dist/internals/simulation/store/notifications.mjs +0 -32
  262. package/dist/internals/simulation/store/notifications.mjs.map +0 -1
  263. package/dist/internals/simulation/store/state.cjs +0 -54
  264. package/dist/internals/simulation/store/state.cjs.map +0 -1
  265. package/dist/internals/simulation/store/state.d.cts +0 -56
  266. package/dist/internals/simulation/store/state.d.cts.map +0 -1
  267. package/dist/internals/simulation/store/state.d.mts +0 -56
  268. package/dist/internals/simulation/store/state.d.mts.map +0 -1
  269. package/dist/internals/simulation/store/state.mjs +0 -50
  270. package/dist/internals/simulation/store/state.mjs.map +0 -1
  271. package/dist/internals/simulation/store/store.cjs +0 -51
  272. package/dist/internals/simulation/store/store.cjs.map +0 -1
  273. package/dist/internals/simulation/store/store.d.cts +0 -22
  274. package/dist/internals/simulation/store/store.d.cts.map +0 -1
  275. package/dist/internals/simulation/store/store.d.mts +0 -22
  276. package/dist/internals/simulation/store/store.d.mts.map +0 -1
  277. package/dist/internals/simulation/store/store.mjs +0 -45
  278. package/dist/internals/simulation/store/store.mjs.map +0 -1
  279. package/dist/internals/simulation/store/ui.cjs +0 -24
  280. package/dist/internals/simulation/store/ui.cjs.map +0 -1
  281. package/dist/internals/simulation/store/ui.d.cts +0 -27
  282. package/dist/internals/simulation/store/ui.d.cts.map +0 -1
  283. package/dist/internals/simulation/store/ui.d.mts +0 -27
  284. package/dist/internals/simulation/store/ui.d.mts.map +0 -1
  285. package/dist/internals/simulation/store/ui.mjs +0 -21
  286. package/dist/internals/simulation/store/ui.mjs.map +0 -1
  287. package/dist/internals/structs.cjs +0 -157
  288. package/dist/internals/structs.cjs.map +0 -1
  289. package/dist/internals/structs.d.cts +0 -205
  290. package/dist/internals/structs.d.cts.map +0 -1
  291. package/dist/internals/structs.d.mts +0 -205
  292. package/dist/internals/structs.d.mts.map +0 -1
  293. package/dist/internals/structs.mjs +0 -154
  294. package/dist/internals/structs.mjs.map +0 -1
@@ -1,152 +0,0 @@
1
- import type { DialogApprovalTypes } from "@metamask/snaps-rpc-methods";
2
- import type { InterfaceState, SnapId, File } from "@metamask/snaps-sdk";
3
- import { DialogType } from "@metamask/snaps-sdk";
4
- import { type JSXElement } from "@metamask/snaps-sdk/jsx";
5
- import { type SagaIterator } from "redux-saga";
6
- import type { FileOptions, SnapInterface, SnapInterfaceActions } from "../../types/index.cjs";
7
- import type { RootControllerMessenger } from "./controllers.cjs";
8
- import type { Interface, RunSagaFunction } from "./store/index.cjs";
9
- /**
10
- * Get a user interface object from a type and content object.
11
- *
12
- * @param runSaga - A function to run a saga outside the usual Redux flow.
13
- * @param type - The type of the interface.
14
- * @param content - The content to show in the interface.
15
- * @param interfaceActions - The actions to interact with the interface.
16
- * @returns The user interface object.
17
- */
18
- export declare function getInterfaceResponse(runSaga: RunSagaFunction, type: DialogApprovalTypes[DialogType | 'default'], content: JSXElement, interfaceActions: SnapInterfaceActions): SnapInterface;
19
- /**
20
- * Resolve the current user interface with the given value.
21
- *
22
- * @param value - The value to resolve the user interface with.
23
- * @yields Puts the resolve user interface action.
24
- */
25
- export declare function resolveWithSaga(value: unknown): SagaIterator;
26
- /**
27
- * A JSX element with a name.
28
- */
29
- export type NamedJSXElement = JSXElement & {
30
- props: {
31
- name: string;
32
- };
33
- };
34
- /**
35
- * Get an element from a JSX tree with the given name.
36
- *
37
- * @param content - The interface content.
38
- * @param name - The element name.
39
- * @returns An object containing the element and the form name if it's contained
40
- * in a form, otherwise undefined.
41
- */
42
- export declare function getElement(content: JSXElement, name: string): {
43
- element: NamedJSXElement;
44
- form?: string;
45
- } | undefined;
46
- /**
47
- * Get an element from a JSX tree with the given type.
48
- *
49
- * @param content - The interface content.
50
- * @param type - The element type.
51
- * @returns The element with the given type.
52
- */
53
- export declare function getElementByType<Element extends JSXElement>(content: JSXElement, type: string): Element | undefined;
54
- /**
55
- * Click on an element of the Snap interface.
56
- *
57
- * @param controllerMessenger - The controller messenger used to call actions.
58
- * @param id - The interface ID.
59
- * @param content - The interface content.
60
- * @param snapId - The Snap ID.
61
- * @param name - The element name.
62
- */
63
- export declare function clickElement(controllerMessenger: RootControllerMessenger, id: string, content: JSXElement, snapId: SnapId, name: string): Promise<void>;
64
- /**
65
- * Merge a value in the interface state.
66
- *
67
- * @param state - The actual interface state.
68
- * @param name - The component name that changed value.
69
- * @param value - The new value.
70
- * @param form - The form name if the element is in one.
71
- * @returns The state with the merged value.
72
- */
73
- export declare function mergeValue(state: InterfaceState, name: string, value: string | File | boolean | null, form?: string): InterfaceState;
74
- /**
75
- * Type a value in an interface element.
76
- *
77
- * @param controllerMessenger - The controller messenger used to call actions.
78
- * @param id - The interface ID.
79
- * @param content - The interface Components.
80
- * @param snapId - The Snap ID.
81
- * @param name - The element name.
82
- * @param value - The value to type in the element.
83
- */
84
- export declare function typeInField(controllerMessenger: RootControllerMessenger, id: string, content: JSXElement, snapId: SnapId, name: string, value: string): Promise<void>;
85
- /**
86
- * Type a value in an interface element.
87
- *
88
- * @param controllerMessenger - The controller messenger used to call actions.
89
- * @param id - The interface ID.
90
- * @param content - The interface Components.
91
- * @param snapId - The Snap ID.
92
- * @param name - The element name.
93
- * @param value - The value to type in the element.
94
- */
95
- export declare function selectInDropdown(controllerMessenger: RootControllerMessenger, id: string, content: JSXElement, snapId: SnapId, name: string, value: string): Promise<void>;
96
- /**
97
- * Choose an option with value from radio group interface element.
98
- *
99
- * @param controllerMessenger - The controller messenger used to call actions.
100
- * @param id - The interface ID.
101
- * @param content - The interface Components.
102
- * @param snapId - The Snap ID.
103
- * @param name - The element name.
104
- * @param value - The value to type in the element.
105
- */
106
- export declare function selectFromRadioGroup(controllerMessenger: RootControllerMessenger, id: string, content: JSXElement, snapId: SnapId, name: string, value: string): Promise<void>;
107
- /**
108
- * Upload a file to an interface element.
109
- *
110
- * @param controllerMessenger - The controller messenger used to call actions.
111
- * @param id - The interface ID.
112
- * @param content - The interface Components.
113
- * @param snapId - The Snap ID.
114
- * @param name - The element name.
115
- * @param file - The file to upload. This can be a path to a file or a
116
- * `Uint8Array` containing the file contents. If this is a path, the file is
117
- * resolved relative to the current working directory.
118
- * @param options - The file options.
119
- * @param options.fileName - The name of the file. By default, this is
120
- * inferred from the file path if it's a path, and defaults to an empty string
121
- * if it's a `Uint8Array`.
122
- * @param options.contentType - The content type of the file. By default, this
123
- * is inferred from the file name if it's a path, and defaults to
124
- * `application/octet-stream` if it's a `Uint8Array` or the content type
125
- * cannot be inferred from the file name.
126
- */
127
- export declare function uploadFile(controllerMessenger: RootControllerMessenger, id: string, content: JSXElement, snapId: SnapId, name: string, file: string | Uint8Array, options?: FileOptions): Promise<void>;
128
- /**
129
- * Get the user interface actions for a Snap interface. These actions can be
130
- * used to interact with the interface.
131
- *
132
- * @param snapId - The Snap ID.
133
- * @param controllerMessenger - The controller messenger used to call actions.
134
- * @param interface - The interface object.
135
- * @param interface.content - The interface content.
136
- * @param interface.id - The interface ID.
137
- * @returns The user interface actions.
138
- */
139
- export declare function getInterfaceActions(snapId: SnapId, controllerMessenger: RootControllerMessenger, { content, id }: Omit<Interface, 'type'> & {
140
- content: JSXElement;
141
- }): SnapInterfaceActions;
142
- /**
143
- * Get a user interface object from a Snap.
144
- *
145
- * @param runSaga - A function to run a saga outside the usual Redux flow.
146
- * @param snapId - The Snap ID.
147
- * @param controllerMessenger - The controller messenger used to call actions.
148
- * @yields Takes the set interface action.
149
- * @returns The user interface object.
150
- */
151
- export declare function getInterface(runSaga: RunSagaFunction, snapId: SnapId, controllerMessenger: RootControllerMessenger): SagaIterator;
152
- //# sourceMappingURL=interface.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interface.d.cts","sourceRoot":"","sources":["../../../src/internals/simulation/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAoC;AAEvE,OAAO,KAAK,EAGV,cAAc,EACd,MAAM,EAEN,IAAI,EACL,4BAA4B;AAC7B,OAAO,EAAE,UAAU,EAA8B,4BAA4B;AAE7E,OAAO,EAAoB,KAAK,UAAU,EAAE,gCAAgC;AAS5E,OAAO,EAAE,KAAK,YAAY,EAAE,mBAAmB;AAG/C,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,oBAAoB,EACrB,8BAA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ApprovalTypes } from "@metamask/snaps-rpc-methods";
2
- import type { InterfaceState, SnapId, File } from "@metamask/snaps-sdk";
3
- import { DialogType } from "@metamask/snaps-sdk";
4
- import { type JSXElement } from "@metamask/snaps-sdk/jsx";
5
- import { type SagaIterator } from "redux-saga";
6
- import type { FileOptions, SnapInterface, SnapInterfaceActions } from "../../types/index.mjs";
7
- import type { RootControllerMessenger } from "./controllers.mjs";
8
- import type { Interface, RunSagaFunction } from "./store/index.mjs";
9
- /**
10
- * Get a user interface object from a type and content object.
11
- *
12
- * @param runSaga - A function to run a saga outside the usual Redux flow.
13
- * @param type - The type of the interface.
14
- * @param content - The content to show in the interface.
15
- * @param interfaceActions - The actions to interact with the interface.
16
- * @returns The user interface object.
17
- */
18
- export declare function getInterfaceResponse(runSaga: RunSagaFunction, type: DialogApprovalTypes[DialogType | 'default'], content: JSXElement, interfaceActions: SnapInterfaceActions): SnapInterface;
19
- /**
20
- * Resolve the current user interface with the given value.
21
- *
22
- * @param value - The value to resolve the user interface with.
23
- * @yields Puts the resolve user interface action.
24
- */
25
- export declare function resolveWithSaga(value: unknown): SagaIterator;
26
- /**
27
- * A JSX element with a name.
28
- */
29
- export type NamedJSXElement = JSXElement & {
30
- props: {
31
- name: string;
32
- };
33
- };
34
- /**
35
- * Get an element from a JSX tree with the given name.
36
- *
37
- * @param content - The interface content.
38
- * @param name - The element name.
39
- * @returns An object containing the element and the form name if it's contained
40
- * in a form, otherwise undefined.
41
- */
42
- export declare function getElement(content: JSXElement, name: string): {
43
- element: NamedJSXElement;
44
- form?: string;
45
- } | undefined;
46
- /**
47
- * Get an element from a JSX tree with the given type.
48
- *
49
- * @param content - The interface content.
50
- * @param type - The element type.
51
- * @returns The element with the given type.
52
- */
53
- export declare function getElementByType<Element extends JSXElement>(content: JSXElement, type: string): Element | undefined;
54
- /**
55
- * Click on an element of the Snap interface.
56
- *
57
- * @param controllerMessenger - The controller messenger used to call actions.
58
- * @param id - The interface ID.
59
- * @param content - The interface content.
60
- * @param snapId - The Snap ID.
61
- * @param name - The element name.
62
- */
63
- export declare function clickElement(controllerMessenger: RootControllerMessenger, id: string, content: JSXElement, snapId: SnapId, name: string): Promise<void>;
64
- /**
65
- * Merge a value in the interface state.
66
- *
67
- * @param state - The actual interface state.
68
- * @param name - The component name that changed value.
69
- * @param value - The new value.
70
- * @param form - The form name if the element is in one.
71
- * @returns The state with the merged value.
72
- */
73
- export declare function mergeValue(state: InterfaceState, name: string, value: string | File | boolean | null, form?: string): InterfaceState;
74
- /**
75
- * Type a value in an interface element.
76
- *
77
- * @param controllerMessenger - The controller messenger used to call actions.
78
- * @param id - The interface ID.
79
- * @param content - The interface Components.
80
- * @param snapId - The Snap ID.
81
- * @param name - The element name.
82
- * @param value - The value to type in the element.
83
- */
84
- export declare function typeInField(controllerMessenger: RootControllerMessenger, id: string, content: JSXElement, snapId: SnapId, name: string, value: string): Promise<void>;
85
- /**
86
- * Type a value in an interface element.
87
- *
88
- * @param controllerMessenger - The controller messenger used to call actions.
89
- * @param id - The interface ID.
90
- * @param content - The interface Components.
91
- * @param snapId - The Snap ID.
92
- * @param name - The element name.
93
- * @param value - The value to type in the element.
94
- */
95
- export declare function selectInDropdown(controllerMessenger: RootControllerMessenger, id: string, content: JSXElement, snapId: SnapId, name: string, value: string): Promise<void>;
96
- /**
97
- * Choose an option with value from radio group interface element.
98
- *
99
- * @param controllerMessenger - The controller messenger used to call actions.
100
- * @param id - The interface ID.
101
- * @param content - The interface Components.
102
- * @param snapId - The Snap ID.
103
- * @param name - The element name.
104
- * @param value - The value to type in the element.
105
- */
106
- export declare function selectFromRadioGroup(controllerMessenger: RootControllerMessenger, id: string, content: JSXElement, snapId: SnapId, name: string, value: string): Promise<void>;
107
- /**
108
- * Upload a file to an interface element.
109
- *
110
- * @param controllerMessenger - The controller messenger used to call actions.
111
- * @param id - The interface ID.
112
- * @param content - The interface Components.
113
- * @param snapId - The Snap ID.
114
- * @param name - The element name.
115
- * @param file - The file to upload. This can be a path to a file or a
116
- * `Uint8Array` containing the file contents. If this is a path, the file is
117
- * resolved relative to the current working directory.
118
- * @param options - The file options.
119
- * @param options.fileName - The name of the file. By default, this is
120
- * inferred from the file path if it's a path, and defaults to an empty string
121
- * if it's a `Uint8Array`.
122
- * @param options.contentType - The content type of the file. By default, this
123
- * is inferred from the file name if it's a path, and defaults to
124
- * `application/octet-stream` if it's a `Uint8Array` or the content type
125
- * cannot be inferred from the file name.
126
- */
127
- export declare function uploadFile(controllerMessenger: RootControllerMessenger, id: string, content: JSXElement, snapId: SnapId, name: string, file: string | Uint8Array, options?: FileOptions): Promise<void>;
128
- /**
129
- * Get the user interface actions for a Snap interface. These actions can be
130
- * used to interact with the interface.
131
- *
132
- * @param snapId - The Snap ID.
133
- * @param controllerMessenger - The controller messenger used to call actions.
134
- * @param interface - The interface object.
135
- * @param interface.content - The interface content.
136
- * @param interface.id - The interface ID.
137
- * @returns The user interface actions.
138
- */
139
- export declare function getInterfaceActions(snapId: SnapId, controllerMessenger: RootControllerMessenger, { content, id }: Omit<Interface, 'type'> & {
140
- content: JSXElement;
141
- }): SnapInterfaceActions;
142
- /**
143
- * Get a user interface object from a Snap.
144
- *
145
- * @param runSaga - A function to run a saga outside the usual Redux flow.
146
- * @param snapId - The Snap ID.
147
- * @param controllerMessenger - The controller messenger used to call actions.
148
- * @yields Takes the set interface action.
149
- * @returns The user interface object.
150
- */
151
- export declare function getInterface(runSaga: RunSagaFunction, snapId: SnapId, controllerMessenger: RootControllerMessenger): SagaIterator;
152
- //# sourceMappingURL=interface.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interface.d.mts","sourceRoot":"","sources":["../../../src/internals/simulation/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAoC;AAEvE,OAAO,KAAK,EAGV,cAAc,EACd,MAAM,EAEN,IAAI,EACL,4BAA4B;AAC7B,OAAO,EAAE,UAAU,EAA8B,4BAA4B;AAE7E,OAAO,EAAoB,KAAK,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