@metamask/snaps-jest 8.3.1 → 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 (296) hide show
  1. package/CHANGELOG.md +16 -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/environment.d.cts +1 -1
  27. package/dist/internals/environment.d.mts +1 -1
  28. package/dist/internals/index.cjs +0 -3
  29. package/dist/internals/index.cjs.map +1 -1
  30. package/dist/internals/index.d.cts +0 -3
  31. package/dist/internals/index.d.cts.map +1 -1
  32. package/dist/internals/index.d.mts +0 -3
  33. package/dist/internals/index.d.mts.map +1 -1
  34. package/dist/internals/index.mjs +0 -3
  35. package/dist/internals/index.mjs.map +1 -1
  36. package/dist/matchers.cjs +3 -3
  37. package/dist/matchers.cjs.map +1 -1
  38. package/dist/matchers.d.cts.map +1 -1
  39. package/dist/matchers.d.mts.map +1 -1
  40. package/dist/matchers.mjs +1 -1
  41. package/dist/matchers.mjs.map +1 -1
  42. package/dist/types/types.cjs.map +1 -1
  43. package/dist/types/types.d.cts +8 -1
  44. package/dist/types/types.d.cts.map +1 -1
  45. package/dist/types/types.d.mts +8 -1
  46. package/dist/types/types.d.mts.map +1 -1
  47. package/dist/types/types.mjs.map +1 -1
  48. package/package.json +7 -20
  49. package/dist/internals/request.cjs +0 -143
  50. package/dist/internals/request.cjs.map +0 -1
  51. package/dist/internals/request.d.cts +0 -56
  52. package/dist/internals/request.d.cts.map +0 -1
  53. package/dist/internals/request.d.mts +0 -56
  54. package/dist/internals/request.d.mts.map +0 -1
  55. package/dist/internals/request.mjs +0 -138
  56. package/dist/internals/request.mjs.map +0 -1
  57. package/dist/internals/simulation/constants.cjs +0 -21
  58. package/dist/internals/simulation/constants.cjs.map +0 -1
  59. package/dist/internals/simulation/constants.d.cts +0 -18
  60. package/dist/internals/simulation/constants.d.cts.map +0 -1
  61. package/dist/internals/simulation/constants.d.mts +0 -18
  62. package/dist/internals/simulation/constants.d.mts.map +0 -1
  63. package/dist/internals/simulation/constants.mjs +0 -18
  64. package/dist/internals/simulation/constants.mjs.map +0 -1
  65. package/dist/internals/simulation/controllers.cjs +0 -101
  66. package/dist/internals/simulation/controllers.cjs.map +0 -1
  67. package/dist/internals/simulation/controllers.d.cts +0 -41
  68. package/dist/internals/simulation/controllers.d.cts.map +0 -1
  69. package/dist/internals/simulation/controllers.d.mts +0 -41
  70. package/dist/internals/simulation/controllers.d.mts.map +0 -1
  71. package/dist/internals/simulation/controllers.mjs +0 -96
  72. package/dist/internals/simulation/controllers.mjs.map +0 -1
  73. package/dist/internals/simulation/files.cjs +0 -94
  74. package/dist/internals/simulation/files.cjs.map +0 -1
  75. package/dist/internals/simulation/files.d.cts +0 -49
  76. package/dist/internals/simulation/files.d.cts.map +0 -1
  77. package/dist/internals/simulation/files.d.mts +0 -49
  78. package/dist/internals/simulation/files.d.mts.map +0 -1
  79. package/dist/internals/simulation/files.mjs +0 -91
  80. package/dist/internals/simulation/files.mjs.map +0 -1
  81. package/dist/internals/simulation/index.cjs +0 -22
  82. package/dist/internals/simulation/index.cjs.map +0 -1
  83. package/dist/internals/simulation/index.d.cts +0 -6
  84. package/dist/internals/simulation/index.d.cts.map +0 -1
  85. package/dist/internals/simulation/index.d.mts +0 -6
  86. package/dist/internals/simulation/index.d.mts.map +0 -1
  87. package/dist/internals/simulation/index.mjs +0 -6
  88. package/dist/internals/simulation/index.mjs.map +0 -1
  89. package/dist/internals/simulation/interface.cjs +0 -527
  90. package/dist/internals/simulation/interface.cjs.map +0 -1
  91. package/dist/internals/simulation/interface.d.cts +0 -152
  92. package/dist/internals/simulation/interface.d.cts.map +0 -1
  93. package/dist/internals/simulation/interface.d.mts +0 -152
  94. package/dist/internals/simulation/interface.d.mts.map +0 -1
  95. package/dist/internals/simulation/interface.mjs +0 -513
  96. package/dist/internals/simulation/interface.mjs.map +0 -1
  97. package/dist/internals/simulation/methods/constants.cjs +0 -72
  98. package/dist/internals/simulation/methods/constants.cjs.map +0 -1
  99. package/dist/internals/simulation/methods/constants.d.cts +0 -11
  100. package/dist/internals/simulation/methods/constants.d.cts.map +0 -1
  101. package/dist/internals/simulation/methods/constants.d.mts +0 -11
  102. package/dist/internals/simulation/methods/constants.d.mts.map +0 -1
  103. package/dist/internals/simulation/methods/constants.mjs +0 -69
  104. package/dist/internals/simulation/methods/constants.mjs.map +0 -1
  105. package/dist/internals/simulation/methods/hooks/get-preferences.cjs +0 -18
  106. package/dist/internals/simulation/methods/hooks/get-preferences.cjs.map +0 -1
  107. package/dist/internals/simulation/methods/hooks/get-preferences.d.cts +0 -14
  108. package/dist/internals/simulation/methods/hooks/get-preferences.d.cts.map +0 -1
  109. package/dist/internals/simulation/methods/hooks/get-preferences.d.mts +0 -14
  110. package/dist/internals/simulation/methods/hooks/get-preferences.d.mts.map +0 -1
  111. package/dist/internals/simulation/methods/hooks/get-preferences.mjs +0 -14
  112. package/dist/internals/simulation/methods/hooks/get-preferences.mjs.map +0 -1
  113. package/dist/internals/simulation/methods/hooks/index.cjs +0 -22
  114. package/dist/internals/simulation/methods/hooks/index.cjs.map +0 -1
  115. package/dist/internals/simulation/methods/hooks/index.d.cts +0 -6
  116. package/dist/internals/simulation/methods/hooks/index.d.cts.map +0 -1
  117. package/dist/internals/simulation/methods/hooks/index.d.mts +0 -6
  118. package/dist/internals/simulation/methods/hooks/index.d.mts.map +0 -1
  119. package/dist/internals/simulation/methods/hooks/index.mjs +0 -6
  120. package/dist/internals/simulation/methods/hooks/index.mjs.map +0 -1
  121. package/dist/internals/simulation/methods/hooks/interface.cjs +0 -24
  122. package/dist/internals/simulation/methods/hooks/interface.cjs.map +0 -1
  123. package/dist/internals/simulation/methods/hooks/interface.d.cts +0 -17
  124. package/dist/internals/simulation/methods/hooks/interface.d.cts.map +0 -1
  125. package/dist/internals/simulation/methods/hooks/interface.d.mts +0 -17
  126. package/dist/internals/simulation/methods/hooks/interface.d.mts.map +0 -1
  127. package/dist/internals/simulation/methods/hooks/interface.mjs +0 -19
  128. package/dist/internals/simulation/methods/hooks/interface.mjs.map +0 -1
  129. package/dist/internals/simulation/methods/hooks/notifications.cjs +0 -58
  130. package/dist/internals/simulation/methods/hooks/notifications.cjs.map +0 -1
  131. package/dist/internals/simulation/methods/hooks/notifications.d.cts +0 -17
  132. package/dist/internals/simulation/methods/hooks/notifications.d.cts.map +0 -1
  133. package/dist/internals/simulation/methods/hooks/notifications.d.mts +0 -17
  134. package/dist/internals/simulation/methods/hooks/notifications.d.mts.map +0 -1
  135. package/dist/internals/simulation/methods/hooks/notifications.mjs +0 -55
  136. package/dist/internals/simulation/methods/hooks/notifications.mjs.map +0 -1
  137. package/dist/internals/simulation/methods/hooks/request-user-approval.cjs +0 -38
  138. package/dist/internals/simulation/methods/hooks/request-user-approval.cjs.map +0 -1
  139. package/dist/internals/simulation/methods/hooks/request-user-approval.d.cts +0 -16
  140. package/dist/internals/simulation/methods/hooks/request-user-approval.d.cts.map +0 -1
  141. package/dist/internals/simulation/methods/hooks/request-user-approval.d.mts +0 -16
  142. package/dist/internals/simulation/methods/hooks/request-user-approval.d.mts.map +0 -1
  143. package/dist/internals/simulation/methods/hooks/request-user-approval.mjs +0 -35
  144. package/dist/internals/simulation/methods/hooks/request-user-approval.mjs.map +0 -1
  145. package/dist/internals/simulation/methods/hooks/state.cjs +0 -84
  146. package/dist/internals/simulation/methods/hooks/state.cjs.map +0 -1
  147. package/dist/internals/simulation/methods/hooks/state.d.cts +0 -24
  148. package/dist/internals/simulation/methods/hooks/state.d.cts.map +0 -1
  149. package/dist/internals/simulation/methods/hooks/state.d.mts +0 -24
  150. package/dist/internals/simulation/methods/hooks/state.d.mts.map +0 -1
  151. package/dist/internals/simulation/methods/hooks/state.mjs +0 -79
  152. package/dist/internals/simulation/methods/hooks/state.mjs.map +0 -1
  153. package/dist/internals/simulation/methods/index.cjs +0 -18
  154. package/dist/internals/simulation/methods/index.cjs.map +0 -1
  155. package/dist/internals/simulation/methods/index.d.cts +0 -2
  156. package/dist/internals/simulation/methods/index.d.cts.map +0 -1
  157. package/dist/internals/simulation/methods/index.d.mts +0 -2
  158. package/dist/internals/simulation/methods/index.d.mts.map +0 -1
  159. package/dist/internals/simulation/methods/index.mjs +0 -2
  160. package/dist/internals/simulation/methods/index.mjs.map +0 -1
  161. package/dist/internals/simulation/methods/specifications.cjs +0 -85
  162. package/dist/internals/simulation/methods/specifications.cjs.map +0 -1
  163. package/dist/internals/simulation/methods/specifications.d.cts +0 -57
  164. package/dist/internals/simulation/methods/specifications.d.cts.map +0 -1
  165. package/dist/internals/simulation/methods/specifications.d.mts +0 -57
  166. package/dist/internals/simulation/methods/specifications.d.mts.map +0 -1
  167. package/dist/internals/simulation/methods/specifications.mjs +0 -78
  168. package/dist/internals/simulation/methods/specifications.mjs.map +0 -1
  169. package/dist/internals/simulation/middleware/engine.cjs +0 -37
  170. package/dist/internals/simulation/middleware/engine.cjs.map +0 -1
  171. package/dist/internals/simulation/middleware/engine.d.cts +0 -27
  172. package/dist/internals/simulation/middleware/engine.d.cts.map +0 -1
  173. package/dist/internals/simulation/middleware/engine.d.mts +0 -27
  174. package/dist/internals/simulation/middleware/engine.d.mts.map +0 -1
  175. package/dist/internals/simulation/middleware/engine.mjs +0 -34
  176. package/dist/internals/simulation/middleware/engine.mjs.map +0 -1
  177. package/dist/internals/simulation/middleware/index.cjs +0 -18
  178. package/dist/internals/simulation/middleware/index.cjs.map +0 -1
  179. package/dist/internals/simulation/middleware/index.d.cts +0 -2
  180. package/dist/internals/simulation/middleware/index.d.cts.map +0 -1
  181. package/dist/internals/simulation/middleware/index.d.mts +0 -2
  182. package/dist/internals/simulation/middleware/index.d.mts.map +0 -1
  183. package/dist/internals/simulation/middleware/index.mjs +0 -2
  184. package/dist/internals/simulation/middleware/index.mjs.map +0 -1
  185. package/dist/internals/simulation/middleware/internal-methods/accounts.cjs +0 -34
  186. package/dist/internals/simulation/middleware/internal-methods/accounts.cjs.map +0 -1
  187. package/dist/internals/simulation/middleware/internal-methods/accounts.d.cts +0 -20
  188. package/dist/internals/simulation/middleware/internal-methods/accounts.d.cts.map +0 -1
  189. package/dist/internals/simulation/middleware/internal-methods/accounts.d.mts +0 -20
  190. package/dist/internals/simulation/middleware/internal-methods/accounts.d.mts.map +0 -1
  191. package/dist/internals/simulation/middleware/internal-methods/accounts.mjs +0 -30
  192. package/dist/internals/simulation/middleware/internal-methods/accounts.mjs.map +0 -1
  193. package/dist/internals/simulation/middleware/internal-methods/index.cjs +0 -18
  194. package/dist/internals/simulation/middleware/internal-methods/index.cjs.map +0 -1
  195. package/dist/internals/simulation/middleware/internal-methods/index.d.cts +0 -2
  196. package/dist/internals/simulation/middleware/internal-methods/index.d.cts.map +0 -1
  197. package/dist/internals/simulation/middleware/internal-methods/index.d.mts +0 -2
  198. package/dist/internals/simulation/middleware/internal-methods/index.d.mts.map +0 -1
  199. package/dist/internals/simulation/middleware/internal-methods/index.mjs +0 -2
  200. package/dist/internals/simulation/middleware/internal-methods/index.mjs.map +0 -1
  201. package/dist/internals/simulation/middleware/internal-methods/middleware.cjs +0 -44
  202. package/dist/internals/simulation/middleware/internal-methods/middleware.cjs.map +0 -1
  203. package/dist/internals/simulation/middleware/internal-methods/middleware.d.cts +0 -23
  204. package/dist/internals/simulation/middleware/internal-methods/middleware.d.cts.map +0 -1
  205. package/dist/internals/simulation/middleware/internal-methods/middleware.d.mts +0 -23
  206. package/dist/internals/simulation/middleware/internal-methods/middleware.d.mts.map +0 -1
  207. package/dist/internals/simulation/middleware/internal-methods/middleware.mjs +0 -40
  208. package/dist/internals/simulation/middleware/internal-methods/middleware.mjs.map +0 -1
  209. package/dist/internals/simulation/middleware/internal-methods/provider-state.cjs +0 -28
  210. package/dist/internals/simulation/middleware/internal-methods/provider-state.cjs.map +0 -1
  211. package/dist/internals/simulation/middleware/internal-methods/provider-state.d.cts +0 -16
  212. package/dist/internals/simulation/middleware/internal-methods/provider-state.d.cts.map +0 -1
  213. package/dist/internals/simulation/middleware/internal-methods/provider-state.d.mts +0 -16
  214. package/dist/internals/simulation/middleware/internal-methods/provider-state.d.mts.map +0 -1
  215. package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs +0 -24
  216. package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs.map +0 -1
  217. package/dist/internals/simulation/middleware/mock.cjs +0 -22
  218. package/dist/internals/simulation/middleware/mock.cjs.map +0 -1
  219. package/dist/internals/simulation/middleware/mock.d.cts +0 -11
  220. package/dist/internals/simulation/middleware/mock.d.cts.map +0 -1
  221. package/dist/internals/simulation/middleware/mock.d.mts +0 -11
  222. package/dist/internals/simulation/middleware/mock.d.mts.map +0 -1
  223. package/dist/internals/simulation/middleware/mock.mjs +0 -18
  224. package/dist/internals/simulation/middleware/mock.mjs.map +0 -1
  225. package/dist/internals/simulation/options.cjs +0 -25
  226. package/dist/internals/simulation/options.cjs.map +0 -1
  227. package/dist/internals/simulation/options.d.cts +0 -40
  228. package/dist/internals/simulation/options.d.cts.map +0 -1
  229. package/dist/internals/simulation/options.d.mts +0 -40
  230. package/dist/internals/simulation/options.d.mts.map +0 -1
  231. package/dist/internals/simulation/options.mjs +0 -21
  232. package/dist/internals/simulation/options.mjs.map +0 -1
  233. package/dist/internals/simulation/simulation.cjs +0 -155
  234. package/dist/internals/simulation/simulation.cjs.map +0 -1
  235. package/dist/internals/simulation/simulation.d.cts +0 -103
  236. package/dist/internals/simulation/simulation.d.cts.map +0 -1
  237. package/dist/internals/simulation/simulation.d.mts +0 -103
  238. package/dist/internals/simulation/simulation.d.mts.map +0 -1
  239. package/dist/internals/simulation/simulation.mjs +0 -150
  240. package/dist/internals/simulation/simulation.mjs.map +0 -1
  241. package/dist/internals/simulation/store/index.cjs +0 -21
  242. package/dist/internals/simulation/store/index.cjs.map +0 -1
  243. package/dist/internals/simulation/store/index.d.cts +0 -5
  244. package/dist/internals/simulation/store/index.d.cts.map +0 -1
  245. package/dist/internals/simulation/store/index.d.mts +0 -5
  246. package/dist/internals/simulation/store/index.d.mts.map +0 -1
  247. package/dist/internals/simulation/store/index.mjs +0 -5
  248. package/dist/internals/simulation/store/index.mjs.map +0 -1
  249. package/dist/internals/simulation/store/mocks.cjs +0 -39
  250. package/dist/internals/simulation/store/mocks.cjs.map +0 -1
  251. package/dist/internals/simulation/store/mocks.d.cts +0 -36
  252. package/dist/internals/simulation/store/mocks.d.cts.map +0 -1
  253. package/dist/internals/simulation/store/mocks.d.mts +0 -36
  254. package/dist/internals/simulation/store/mocks.d.mts.map +0 -1
  255. package/dist/internals/simulation/store/mocks.mjs +0 -35
  256. package/dist/internals/simulation/store/mocks.mjs.map +0 -1
  257. package/dist/internals/simulation/store/notifications.cjs +0 -35
  258. package/dist/internals/simulation/store/notifications.cjs.map +0 -1
  259. package/dist/internals/simulation/store/notifications.d.cts +0 -45
  260. package/dist/internals/simulation/store/notifications.d.cts.map +0 -1
  261. package/dist/internals/simulation/store/notifications.d.mts +0 -45
  262. package/dist/internals/simulation/store/notifications.d.mts.map +0 -1
  263. package/dist/internals/simulation/store/notifications.mjs +0 -32
  264. package/dist/internals/simulation/store/notifications.mjs.map +0 -1
  265. package/dist/internals/simulation/store/state.cjs +0 -54
  266. package/dist/internals/simulation/store/state.cjs.map +0 -1
  267. package/dist/internals/simulation/store/state.d.cts +0 -56
  268. package/dist/internals/simulation/store/state.d.cts.map +0 -1
  269. package/dist/internals/simulation/store/state.d.mts +0 -56
  270. package/dist/internals/simulation/store/state.d.mts.map +0 -1
  271. package/dist/internals/simulation/store/state.mjs +0 -50
  272. package/dist/internals/simulation/store/state.mjs.map +0 -1
  273. package/dist/internals/simulation/store/store.cjs +0 -51
  274. package/dist/internals/simulation/store/store.cjs.map +0 -1
  275. package/dist/internals/simulation/store/store.d.cts +0 -22
  276. package/dist/internals/simulation/store/store.d.cts.map +0 -1
  277. package/dist/internals/simulation/store/store.d.mts +0 -22
  278. package/dist/internals/simulation/store/store.d.mts.map +0 -1
  279. package/dist/internals/simulation/store/store.mjs +0 -45
  280. package/dist/internals/simulation/store/store.mjs.map +0 -1
  281. package/dist/internals/simulation/store/ui.cjs +0 -24
  282. package/dist/internals/simulation/store/ui.cjs.map +0 -1
  283. package/dist/internals/simulation/store/ui.d.cts +0 -27
  284. package/dist/internals/simulation/store/ui.d.cts.map +0 -1
  285. package/dist/internals/simulation/store/ui.d.mts +0 -27
  286. package/dist/internals/simulation/store/ui.d.mts.map +0 -1
  287. package/dist/internals/simulation/store/ui.mjs +0 -21
  288. package/dist/internals/simulation/store/ui.mjs.map +0 -1
  289. package/dist/internals/structs.cjs +0 -157
  290. package/dist/internals/structs.cjs.map +0 -1
  291. package/dist/internals/structs.d.cts +0 -205
  292. package/dist/internals/structs.d.cts.map +0 -1
  293. package/dist/internals/structs.d.mts +0 -205
  294. package/dist/internals/structs.d.mts.map +0 -1
  295. package/dist/internals/structs.mjs +0 -154
  296. package/dist/internals/structs.mjs.map +0 -1
@@ -1,27 +0,0 @@
1
- import type { DialogApprovalTypes } from "@metamask/snaps-rpc-methods";
2
- import type { DialogType } from "@metamask/snaps-sdk";
3
- import type { PayloadAction } from "@reduxjs/toolkit";
4
- export type Interface = {
5
- type: DialogApprovalTypes[DialogType | 'default'];
6
- id: string;
7
- };
8
- export type UiState = {
9
- current?: Interface | null;
10
- };
11
- export declare const uiSlice: import("@reduxjs/toolkit").Slice<UiState, {
12
- setInterface(state: import("immer/dist/internal.js").WritableDraft<UiState>, action: PayloadAction<Interface>): void;
13
- closeInterface(state: import("immer/dist/internal.js").WritableDraft<UiState>): void;
14
- }, "ui">;
15
- export declare const resolveInterface: import("@reduxjs/toolkit").ActionCreatorWithNonInferrablePayload<string>;
16
- export declare const setInterface: import("@reduxjs/toolkit").ActionCreatorWithPayload<Interface, "ui/setInterface">, closeInterface: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"ui/closeInterface">;
17
- export declare const getCurrentInterface: ((state: {
18
- mocks: import("./mocks").MocksState;
19
- notifications: import("./notifications").NotificationsState;
20
- state: import("./state").State;
21
- ui: UiState;
22
- }) => Interface | null | undefined) & import("reselect").OutputSelectorFields<(args_0: UiState) => Interface | null | undefined, {
23
- clearCache: () => void;
24
- }> & {
25
- clearCache: () => void;
26
- };
27
- //# sourceMappingURL=ui.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ui.d.cts","sourceRoot":"","sources":["../../../../src/internals/simulation/store/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAoC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,4BAA4B;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB;AAKtD,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,mBAAmB,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IAClD,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC5B,CAAC;AAMF,eAAO,MAAM,OAAO;yFAIY,cAAc,SAAS,CAAC;;QAOtD,CAAC;AAEH,eAAO,MAAM,gBAAgB,0EAE5B,CAAC;AAEF,eAAO,MAAQ,YAAY,qFAAE,cAAc,6EAAoB,CAAC;AAEhE,eAAO,MAAM,mBAAmB;;;;;;;;;CAG/B,CAAC"}
@@ -1,27 +0,0 @@
1
- import type { DialogApprovalTypes } from "@metamask/snaps-rpc-methods";
2
- import type { DialogType } from "@metamask/snaps-sdk";
3
- import type { PayloadAction } from "@reduxjs/toolkit";
4
- export type Interface = {
5
- type: DialogApprovalTypes[DialogType | 'default'];
6
- id: string;
7
- };
8
- export type UiState = {
9
- current?: Interface | null;
10
- };
11
- export declare const uiSlice: import("@reduxjs/toolkit").Slice<UiState, {
12
- setInterface(state: import("immer/dist/internal.js").WritableDraft<UiState>, action: PayloadAction<Interface>): void;
13
- closeInterface(state: import("immer/dist/internal.js").WritableDraft<UiState>): void;
14
- }, "ui">;
15
- export declare const resolveInterface: import("@reduxjs/toolkit").ActionCreatorWithNonInferrablePayload<string>;
16
- export declare const setInterface: import("@reduxjs/toolkit").ActionCreatorWithPayload<Interface, "ui/setInterface">, closeInterface: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"ui/closeInterface">;
17
- export declare const getCurrentInterface: ((state: {
18
- mocks: import("./mocks").MocksState;
19
- notifications: import("./notifications").NotificationsState;
20
- state: import("./state").State;
21
- ui: UiState;
22
- }) => Interface | null | undefined) & import("reselect").OutputSelectorFields<(args_0: UiState) => Interface | null | undefined, {
23
- clearCache: () => void;
24
- }> & {
25
- clearCache: () => void;
26
- };
27
- //# sourceMappingURL=ui.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ui.d.mts","sourceRoot":"","sources":["../../../../src/internals/simulation/store/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAoC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,4BAA4B;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB;AAKtD,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,mBAAmB,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IAClD,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC5B,CAAC;AAMF,eAAO,MAAM,OAAO;yFAIY,cAAc,SAAS,CAAC;;QAOtD,CAAC;AAEH,eAAO,MAAM,gBAAgB,0EAE5B,CAAC;AAEF,eAAO,MAAQ,YAAY,qFAAE,cAAc,6EAAoB,CAAC;AAEhE,eAAO,MAAM,mBAAmB;;;;;;;;;CAG/B,CAAC"}
@@ -1,21 +0,0 @@
1
- import $reduxjstoolkit from "@reduxjs/toolkit";
2
- const { createAction, createSelector, createSlice } = $reduxjstoolkit;
3
- const INITIAL_STATE = {
4
- current: null,
5
- };
6
- export const uiSlice = createSlice({
7
- name: 'ui',
8
- initialState: INITIAL_STATE,
9
- reducers: {
10
- setInterface(state, action) {
11
- state.current = action.payload;
12
- },
13
- closeInterface(state) {
14
- state.current = null;
15
- },
16
- },
17
- });
18
- export const resolveInterface = createAction(`${uiSlice.name}/resolveInterface`);
19
- export const { setInterface, closeInterface } = uiSlice.actions;
20
- export const getCurrentInterface = createSelector((state) => state.ui, (ui) => ui.current);
21
- //# sourceMappingURL=ui.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ui.mjs","sourceRoot":"","sources":["../../../../src/internals/simulation/store/ui.ts"],"names":[],"mappings":";;AAgBA,MAAM,aAAa,GAAY;IAC7B,OAAO,EAAE,IAAI;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAAC;IACjC,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,aAAa;IAC3B,QAAQ,EAAE;QACR,YAAY,CAAC,KAAK,EAAE,MAAgC;YAClD,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QACjC,CAAC;QACD,cAAc,CAAC,KAAK;YAClB,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QACvB,CAAC;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAC1C,GAAG,OAAO,CAAC,IAAI,mBAAmB,CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;AAEhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAC/C,CAAC,KAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,EACrC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CACnB,CAAC","sourcesContent":["import type { DialogApprovalTypes } from '@metamask/snaps-rpc-methods';\nimport type { DialogType } from '@metamask/snaps-sdk';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createAction, createSelector, createSlice } from '@reduxjs/toolkit';\n\nimport type { ApplicationState } from './store';\n\nexport type Interface = {\n type: DialogApprovalTypes[DialogType | 'default'];\n id: string;\n};\n\nexport type UiState = {\n current?: Interface | null;\n};\n\nconst INITIAL_STATE: UiState = {\n current: null,\n};\n\nexport const uiSlice = createSlice({\n name: 'ui',\n initialState: INITIAL_STATE,\n reducers: {\n setInterface(state, action: PayloadAction<Interface>) {\n state.current = action.payload;\n },\n closeInterface(state) {\n state.current = null;\n },\n },\n});\n\nexport const resolveInterface = createAction<unknown>(\n `${uiSlice.name}/resolveInterface`,\n);\n\nexport const { setInterface, closeInterface } = uiSlice.actions;\n\nexport const getCurrentInterface = createSelector(\n (state: ApplicationState) => state.ui,\n (ui) => ui.current,\n);\n"]}
@@ -1,157 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SnapResponseStruct = exports.SnapResponseWithInterfaceStruct = exports.SnapResponseWithoutInterfaceStruct = exports.InterfaceStruct = exports.JsonRpcMockOptionsStruct = exports.SnapOptionsStruct = exports.SignatureOptionsStruct = exports.TransactionOptionsStruct = void 0;
4
- const snaps_sdk_1 = require("@metamask/snaps-sdk");
5
- const jsx_1 = require("@metamask/snaps-sdk/jsx");
6
- const superstruct_1 = require("@metamask/superstruct");
7
- const utils_1 = require("@metamask/utils");
8
- const crypto_1 = require("crypto");
9
- // TODO: Export this from `@metamask/utils` instead.
10
- const BytesLikeStruct = (0, superstruct_1.union)([
11
- (0, superstruct_1.bigint)(),
12
- (0, superstruct_1.number)(),
13
- (0, superstruct_1.string)(),
14
- (0, superstruct_1.instance)(Uint8Array),
15
- ]);
16
- exports.TransactionOptionsStruct = (0, superstruct_1.object)({
17
- /**
18
- * The CAIP-2 chain ID to send the transaction on. Defaults to `eip155:1`.
19
- */
20
- chainId: (0, superstruct_1.defaulted)((0, superstruct_1.string)(), 'eip155:1'),
21
- /**
22
- * The origin to send the transaction from. Defaults to `metamask.io`.
23
- */
24
- origin: (0, superstruct_1.defaulted)((0, superstruct_1.string)(), 'metamask.io'),
25
- /**
26
- * The address to send the transaction from. Defaults to a randomly generated
27
- * address.
28
- */
29
- // TODO: Move this coercer to `@metamask/utils`.
30
- from: (0, superstruct_1.coerce)(utils_1.StrictHexStruct, (0, superstruct_1.optional)(BytesLikeStruct), (value) => {
31
- if (value) {
32
- return (0, utils_1.bytesToHex)((0, utils_1.valueToBytes)(value));
33
- }
34
- return (0, utils_1.bytesToHex)((0, crypto_1.randomBytes)(20));
35
- }),
36
- /**
37
- * The address to send the transaction to. Defaults to a randomly generated
38
- * address.
39
- */
40
- // TODO: Move this coercer to `@metamask/utils`.
41
- to: (0, superstruct_1.coerce)(utils_1.StrictHexStruct, (0, superstruct_1.optional)(BytesLikeStruct), (value) => {
42
- if (value) {
43
- return (0, utils_1.bytesToHex)((0, utils_1.valueToBytes)(value));
44
- }
45
- return (0, utils_1.bytesToHex)((0, crypto_1.randomBytes)(20));
46
- }),
47
- /**
48
- * The value to send with the transaction. The value may be specified as a
49
- * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.
50
- */
51
- value: (0, superstruct_1.defaulted)((0, superstruct_1.coerce)(utils_1.StrictHexStruct, BytesLikeStruct, (value) => (0, utils_1.bytesToHex)((0, utils_1.valueToBytes)(value))), '0x0'),
52
- /**
53
- * The gas limit to use for the transaction. The gas limit may be specified
54
- * as a `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `21_000`.
55
- */
56
- gasLimit: (0, superstruct_1.defaulted)((0, superstruct_1.coerce)(utils_1.StrictHexStruct, BytesLikeStruct, (value) => (0, utils_1.bytesToHex)((0, utils_1.valueToBytes)(value))), (0, utils_1.valueToBytes)(21000)),
57
- /**
58
- * The max fee per gas (in Wei) to use for the transaction. The max fee per
59
- * gas may be specified as a `number`, `bigint`, `string`, or `Uint8Array`.
60
- * Defaults to `1`.
61
- */
62
- maxFeePerGas: (0, superstruct_1.defaulted)((0, superstruct_1.coerce)(utils_1.StrictHexStruct, BytesLikeStruct, (value) => (0, utils_1.bytesToHex)((0, utils_1.valueToBytes)(value))), (0, utils_1.valueToBytes)(1)),
63
- /**
64
- * The max priority fee per gas (in Wei) to use for the transaction. The max
65
- * priority fee per gas may be specified as a `number`, `bigint`, `string`,
66
- * or `Uint8Array`. Defaults to `1`.
67
- */
68
- maxPriorityFeePerGas: (0, superstruct_1.defaulted)((0, superstruct_1.coerce)(utils_1.StrictHexStruct, BytesLikeStruct, (value) => (0, utils_1.bytesToHex)((0, utils_1.valueToBytes)(value))), (0, utils_1.valueToBytes)(1)),
69
- /**
70
- * The nonce to use for the transaction. The nonce may be specified as a
71
- * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.
72
- */
73
- nonce: (0, superstruct_1.defaulted)((0, superstruct_1.coerce)(utils_1.StrictHexStruct, BytesLikeStruct, (value) => (0, utils_1.bytesToHex)((0, utils_1.valueToBytes)(value))), (0, utils_1.valueToBytes)(0)),
74
- /**
75
- * The data to send with the transaction. The data may be specified as a
76
- * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0x`.
77
- */
78
- data: (0, superstruct_1.defaulted)((0, superstruct_1.coerce)((0, superstruct_1.union)([utils_1.StrictHexStruct, (0, superstruct_1.literal)('0x')]), BytesLikeStruct, (value) => (0, utils_1.bytesToHex)((0, utils_1.valueToBytes)(value))), '0x'),
79
- });
80
- exports.SignatureOptionsStruct = (0, superstruct_1.object)({
81
- /**
82
- * The origin making the signature request.
83
- */
84
- origin: (0, superstruct_1.defaulted)((0, superstruct_1.string)(), 'metamask.io'),
85
- /**
86
- * The address signing the signature request. Defaults to a randomly generated
87
- * address.
88
- */
89
- from: (0, superstruct_1.coerce)(utils_1.StrictHexStruct, (0, superstruct_1.optional)(BytesLikeStruct), (value) => {
90
- if (value) {
91
- return (0, utils_1.bytesToHex)((0, utils_1.valueToBytes)(value));
92
- }
93
- return (0, utils_1.bytesToHex)((0, crypto_1.randomBytes)(20));
94
- }),
95
- /**
96
- * The data to send with the transaction. The data may be specified as a
97
- * `string`, an object, or an array of objects. This covers the data types
98
- * for the supported signature methods. Defaults to `0x`.
99
- */
100
- data: (0, superstruct_1.defaulted)((0, superstruct_1.union)([
101
- utils_1.StrictHexStruct,
102
- (0, superstruct_1.literal)('0x'),
103
- (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.any)()),
104
- (0, superstruct_1.array)((0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.any)())),
105
- ]), '0x'),
106
- /**
107
- * The signature method being used.
108
- */
109
- signatureMethod: (0, superstruct_1.defaulted)((0, superstruct_1.union)([
110
- (0, superstruct_1.literal)('eth_sign'),
111
- (0, superstruct_1.literal)('personal_sign'),
112
- (0, superstruct_1.literal)('eth_signTypedData'),
113
- (0, superstruct_1.literal)('eth_signTypedData_v3'),
114
- (0, superstruct_1.literal)('eth_signTypedData_v4'),
115
- ]), 'personal_sign'),
116
- });
117
- exports.SnapOptionsStruct = (0, superstruct_1.object)({
118
- /**
119
- * The timeout in milliseconds to use for requests to the snap. Defaults to
120
- * `1000`.
121
- */
122
- timeout: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.number)()), 1000),
123
- });
124
- exports.JsonRpcMockOptionsStruct = (0, superstruct_1.object)({
125
- method: (0, superstruct_1.string)(),
126
- result: utils_1.JsonStruct,
127
- });
128
- exports.InterfaceStruct = (0, superstruct_1.type)({
129
- content: (0, superstruct_1.optional)(jsx_1.JSXElementStruct),
130
- });
131
- exports.SnapResponseWithoutInterfaceStruct = (0, superstruct_1.object)({
132
- id: (0, superstruct_1.string)(),
133
- response: (0, superstruct_1.union)([
134
- (0, superstruct_1.object)({
135
- result: utils_1.JsonStruct,
136
- }),
137
- (0, superstruct_1.object)({
138
- error: utils_1.JsonStruct,
139
- }),
140
- ]),
141
- notifications: (0, superstruct_1.array)((0, superstruct_1.object)({
142
- id: (0, superstruct_1.string)(),
143
- message: (0, superstruct_1.string)(),
144
- type: (0, superstruct_1.union)([
145
- (0, snaps_sdk_1.enumValue)(snaps_sdk_1.NotificationType.InApp),
146
- (0, snaps_sdk_1.enumValue)(snaps_sdk_1.NotificationType.Native),
147
- ]),
148
- })),
149
- });
150
- exports.SnapResponseWithInterfaceStruct = (0, superstruct_1.assign)(exports.SnapResponseWithoutInterfaceStruct, (0, superstruct_1.object)({
151
- getInterface: (0, superstruct_1.func)(),
152
- }));
153
- exports.SnapResponseStruct = (0, superstruct_1.union)([
154
- exports.SnapResponseWithoutInterfaceStruct,
155
- exports.SnapResponseWithInterfaceStruct,
156
- ]);
157
- //# sourceMappingURL=structs.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"structs.cjs","sourceRoot":"","sources":["../../src/internals/structs.ts"],"names":[],"mappings":";;;AAAA,mDAAkE;AAClE,iDAA2D;AAC3D,uDAiB+B;AAC/B,2CAKyB;AACzB,mCAAqC;AAErC,oDAAoD;AACpD,MAAM,eAAe,GAAG,IAAA,mBAAK,EAAC;IAC5B,IAAA,oBAAM,GAAE;IACR,IAAA,oBAAM,GAAE;IACR,IAAA,oBAA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,GAAG,IAAA,oBAAM,EAAC;IAC7C,MAAM,EAAE,IAAA,oBAAM,GAAE;IAChB,MAAM,EAAE,kBAAU;CACnB,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,IAAA,kBAAI,EAAC;IAClC,OAAO,EAAE,IAAA,sBAAQ,EAAC,sBAAgB,CAAC;CACpC,CAAC,CAAC;AAEU,QAAA,kCAAkC,GAAG,IAAA,oBAAM,EAAC;IACvD,EAAE,EAAE,IAAA,oBAAM,GAAE;IAEZ,QAAQ,EAAE,IAAA,mBAAK,EAAC;QACd,IAAA,oBAAM,EAAC;YACL,MAAM,EAAE,kBAAU;SACnB,CAAC;QACF,IAAA,oBAAM,EAAC;YACL,KAAK,EAAE,kBAAU;SAClB,CAAC;KACH,CAAC;IAEF,aAAa,EAAE,IAAA,mBAAK,EAClB,IAAA,oBAAM,EAAC;QACL,EAAE,EAAE,IAAA,oBAAM,GAAE;QACZ,OAAO,EAAE,IAAA,oBAAM,GAAE;QACjB,IAAI,EAAE,IAAA,mBAAK,EAAC;YACV,IAAA,qBAAS,EAAC,4BAAgB,CAAC,KAAK,CAAC;YACjC,IAAA,qBAAS,EAAC,4BAAgB,CAAC,MAAM,CAAC;SACnC,CAAC;KACH,CAAC,CACH;CACF,CAAC,CAAC;AAEU,QAAA,+BAA+B,GAAG,IAAA,oBAAM,EACnD,0CAAkC,EAClC,IAAA,oBAAM,EAAC;IACL,YAAY,EAAE,IAAA,kBAAI,GAAE;CACrB,CAAC,CACH,CAAC;AAEW,QAAA,kBAAkB,GAAG,IAAA,mBAAK,EAAC;IACtC,0CAAkC;IAClC,uCAA+B;CAChC,CAAC,CAAC","sourcesContent":["import { NotificationType, enumValue } from '@metamask/snaps-sdk';\nimport { JSXElementStruct } from '@metamask/snaps-sdk/jsx';\nimport {\n array,\n assign,\n bigint,\n coerce,\n defaulted,\n instance,\n literal,\n number,\n object,\n optional,\n string,\n union,\n record,\n any,\n func,\n type,\n} from '@metamask/superstruct';\nimport {\n bytesToHex,\n JsonStruct,\n StrictHexStruct,\n valueToBytes,\n} from '@metamask/utils';\nimport { randomBytes } from 'crypto';\n\n// TODO: Export this from `@metamask/utils` instead.\nconst BytesLikeStruct = union([\n bigint(),\n number(),\n string(),\n instance(Uint8Array),\n]);\n\nexport const TransactionOptionsStruct = object({\n /**\n * The CAIP-2 chain ID to send the transaction on. Defaults to `eip155:1`.\n */\n chainId: defaulted(string(), 'eip155:1'),\n\n /**\n * The origin to send the transaction from. Defaults to `metamask.io`.\n */\n origin: defaulted(string(), 'metamask.io'),\n\n /**\n * The address to send the transaction from. Defaults to a randomly generated\n * address.\n */\n // TODO: Move this coercer to `@metamask/utils`.\n from: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {\n if (value) {\n return bytesToHex(valueToBytes(value));\n }\n\n return bytesToHex(randomBytes(20));\n }),\n\n /**\n * The address to send the transaction to. Defaults to a randomly generated\n * address.\n */\n // TODO: Move this coercer to `@metamask/utils`.\n to: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {\n if (value) {\n return bytesToHex(valueToBytes(value));\n }\n\n return bytesToHex(randomBytes(20));\n }),\n\n /**\n * The value to send with the transaction. The value may be specified as a\n * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.\n */\n value: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n '0x0',\n ),\n\n /**\n * The gas limit to use for the transaction. The gas limit may be specified\n * as a `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `21_000`.\n */\n gasLimit: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(21_000),\n ),\n\n /**\n * The max fee per gas (in Wei) to use for the transaction. The max fee per\n * gas may be specified as a `number`, `bigint`, `string`, or `Uint8Array`.\n * Defaults to `1`.\n */\n maxFeePerGas: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(1),\n ),\n\n /**\n * The max priority fee per gas (in Wei) to use for the transaction. The max\n * priority fee per gas may be specified as a `number`, `bigint`, `string`,\n * or `Uint8Array`. Defaults to `1`.\n */\n maxPriorityFeePerGas: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(1),\n ),\n\n /**\n * The nonce to use for the transaction. The nonce may be specified as a\n * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.\n */\n nonce: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(0),\n ),\n\n /**\n * The data to send with the transaction. The data may be specified as a\n * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0x`.\n */\n data: defaulted(\n coerce(union([StrictHexStruct, literal('0x')]), BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n '0x',\n ),\n});\n\nexport const SignatureOptionsStruct = object({\n /**\n * The origin making the signature request.\n */\n origin: defaulted(string(), 'metamask.io'),\n\n /**\n * The address signing the signature request. Defaults to a randomly generated\n * address.\n */\n from: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {\n if (value) {\n return bytesToHex(valueToBytes(value));\n }\n\n return bytesToHex(randomBytes(20));\n }),\n\n /**\n * The data to send with the transaction. The data may be specified as a\n * `string`, an object, or an array of objects. This covers the data types\n * for the supported signature methods. Defaults to `0x`.\n */\n data: defaulted(\n union([\n StrictHexStruct,\n literal('0x'),\n record(string(), any()),\n array(record(string(), any())),\n ]),\n '0x',\n ),\n\n /**\n * The signature method being used.\n */\n signatureMethod: defaulted(\n union([\n literal('eth_sign'),\n literal('personal_sign'),\n literal('eth_signTypedData'),\n literal('eth_signTypedData_v3'),\n literal('eth_signTypedData_v4'),\n ]),\n 'personal_sign',\n ),\n});\n\nexport const SnapOptionsStruct = object({\n /**\n * The timeout in milliseconds to use for requests to the snap. Defaults to\n * `1000`.\n */\n timeout: defaulted(optional(number()), 1000),\n});\n\nexport const JsonRpcMockOptionsStruct = object({\n method: string(),\n result: JsonStruct,\n});\n\nexport const InterfaceStruct = type({\n content: optional(JSXElementStruct),\n});\n\nexport const SnapResponseWithoutInterfaceStruct = object({\n id: string(),\n\n response: union([\n object({\n result: JsonStruct,\n }),\n object({\n error: JsonStruct,\n }),\n ]),\n\n notifications: array(\n object({\n id: string(),\n message: string(),\n type: union([\n enumValue(NotificationType.InApp),\n enumValue(NotificationType.Native),\n ]),\n }),\n ),\n});\n\nexport const SnapResponseWithInterfaceStruct = assign(\n SnapResponseWithoutInterfaceStruct,\n object({\n getInterface: func(),\n }),\n);\n\nexport const SnapResponseStruct = union([\n SnapResponseWithoutInterfaceStruct,\n SnapResponseWithInterfaceStruct,\n]);\n"]}
@@ -1,205 +0,0 @@
1
- export declare const TransactionOptionsStruct: import("@metamask/superstruct").Struct<{
2
- data: `0x${string}`;
3
- origin: string;
4
- value: `0x${string}`;
5
- nonce: `0x${string}`;
6
- from: `0x${string}`;
7
- chainId: string;
8
- to: `0x${string}`;
9
- gasLimit: `0x${string}`;
10
- maxFeePerGas: `0x${string}`;
11
- maxPriorityFeePerGas: `0x${string}`;
12
- }, {
13
- /**
14
- * The CAIP-2 chain ID to send the transaction on. Defaults to `eip155:1`.
15
- */
16
- chainId: import("@metamask/superstruct").Struct<string, null>;
17
- /**
18
- * The origin to send the transaction from. Defaults to `metamask.io`.
19
- */
20
- origin: import("@metamask/superstruct").Struct<string, null>;
21
- /**
22
- * The address to send the transaction from. Defaults to a randomly generated
23
- * address.
24
- */
25
- from: import("@metamask/superstruct").Struct<`0x${string}`, null>;
26
- /**
27
- * The address to send the transaction to. Defaults to a randomly generated
28
- * address.
29
- */
30
- to: import("@metamask/superstruct").Struct<`0x${string}`, null>;
31
- /**
32
- * The value to send with the transaction. The value may be specified as a
33
- * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.
34
- */
35
- value: import("@metamask/superstruct").Struct<`0x${string}`, null>;
36
- /**
37
- * The gas limit to use for the transaction. The gas limit may be specified
38
- * as a `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `21_000`.
39
- */
40
- gasLimit: import("@metamask/superstruct").Struct<`0x${string}`, null>;
41
- /**
42
- * The max fee per gas (in Wei) to use for the transaction. The max fee per
43
- * gas may be specified as a `number`, `bigint`, `string`, or `Uint8Array`.
44
- * Defaults to `1`.
45
- */
46
- maxFeePerGas: import("@metamask/superstruct").Struct<`0x${string}`, null>;
47
- /**
48
- * The max priority fee per gas (in Wei) to use for the transaction. The max
49
- * priority fee per gas may be specified as a `number`, `bigint`, `string`,
50
- * or `Uint8Array`. Defaults to `1`.
51
- */
52
- maxPriorityFeePerGas: import("@metamask/superstruct").Struct<`0x${string}`, null>;
53
- /**
54
- * The nonce to use for the transaction. The nonce may be specified as a
55
- * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.
56
- */
57
- nonce: import("@metamask/superstruct").Struct<`0x${string}`, null>;
58
- /**
59
- * The data to send with the transaction. The data may be specified as a
60
- * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0x`.
61
- */
62
- data: import("@metamask/superstruct").Struct<`0x${string}`, null>;
63
- }>;
64
- export declare const SignatureOptionsStruct: import("@metamask/superstruct").Struct<{
65
- data: `0x${string}` | Record<string, any> | Record<string, any>[];
66
- origin: string;
67
- from: `0x${string}`;
68
- signatureMethod: "eth_sign" | "personal_sign" | "eth_signTypedData" | "eth_signTypedData_v3" | "eth_signTypedData_v4";
69
- }, {
70
- /**
71
- * The origin making the signature request.
72
- */
73
- origin: import("@metamask/superstruct").Struct<string, null>;
74
- /**
75
- * The address signing the signature request. Defaults to a randomly generated
76
- * address.
77
- */
78
- from: import("@metamask/superstruct").Struct<`0x${string}`, null>;
79
- /**
80
- * The data to send with the transaction. The data may be specified as a
81
- * `string`, an object, or an array of objects. This covers the data types
82
- * for the supported signature methods. Defaults to `0x`.
83
- */
84
- data: import("@metamask/superstruct").Struct<`0x${string}` | Record<string, any> | Record<string, any>[], null>;
85
- /**
86
- * The signature method being used.
87
- */
88
- signatureMethod: import("@metamask/superstruct").Struct<"eth_sign" | "personal_sign" | "eth_signTypedData" | "eth_signTypedData_v3" | "eth_signTypedData_v4", null>;
89
- }>;
90
- export declare const SnapOptionsStruct: import("@metamask/superstruct").Struct<{
91
- timeout?: number | undefined;
92
- }, {
93
- /**
94
- * The timeout in milliseconds to use for requests to the snap. Defaults to
95
- * `1000`.
96
- */
97
- timeout: import("@metamask/superstruct").Struct<number | undefined, null>;
98
- }>;
99
- export declare const JsonRpcMockOptionsStruct: import("@metamask/superstruct").Struct<{
100
- method: string;
101
- result: import("@metamask/snaps-sdk").Json;
102
- }, {
103
- method: import("@metamask/superstruct").Struct<string, null>;
104
- result: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").Json, unknown>;
105
- }>;
106
- export declare const InterfaceStruct: import("@metamask/superstruct").Struct<{
107
- content?: import("@metamask/snaps-sdk/jsx").JSXElement | undefined;
108
- }, {
109
- content: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk/jsx").JSXElement | undefined, null>;
110
- }>;
111
- export declare const SnapResponseWithoutInterfaceStruct: import("@metamask/superstruct").Struct<{
112
- id: string;
113
- notifications: {
114
- type: "native" | "inApp";
115
- message: string;
116
- id: string;
117
- }[];
118
- response: {
119
- result: import("@metamask/snaps-sdk").Json;
120
- } | {
121
- error: import("@metamask/snaps-sdk").Json;
122
- };
123
- }, {
124
- id: import("@metamask/superstruct").Struct<string, null>;
125
- response: import("@metamask/superstruct").Struct<{
126
- result: import("@metamask/snaps-sdk").Json;
127
- } | {
128
- error: import("@metamask/snaps-sdk").Json;
129
- }, null>;
130
- notifications: import("@metamask/superstruct").Struct<{
131
- type: "native" | "inApp";
132
- message: string;
133
- id: string;
134
- }[], import("@metamask/superstruct").Struct<{
135
- type: "native" | "inApp";
136
- message: string;
137
- id: string;
138
- }, {
139
- id: import("@metamask/superstruct").Struct<string, null>;
140
- message: import("@metamask/superstruct").Struct<string, null>;
141
- type: import("@metamask/superstruct").Struct<"native" | "inApp", null>;
142
- }>>;
143
- }>;
144
- export declare const SnapResponseWithInterfaceStruct: import("@metamask/superstruct").Struct<{
145
- id: string;
146
- notifications: {
147
- type: "native" | "inApp";
148
- message: string;
149
- id: string;
150
- }[];
151
- response: {
152
- result: import("@metamask/snaps-sdk").Json;
153
- } | {
154
- error: import("@metamask/snaps-sdk").Json;
155
- };
156
- getInterface: Function;
157
- }, {
158
- getInterface: import("@metamask/superstruct").Struct<Function, null>;
159
- id: import("@metamask/superstruct").Struct<string, null>;
160
- notifications: import("@metamask/superstruct").Struct<{
161
- type: "native" | "inApp";
162
- message: string;
163
- id: string;
164
- }[], import("@metamask/superstruct").Struct<{
165
- type: "native" | "inApp";
166
- message: string;
167
- id: string;
168
- }, {
169
- id: import("@metamask/superstruct").Struct<string, null>;
170
- message: import("@metamask/superstruct").Struct<string, null>;
171
- type: import("@metamask/superstruct").Struct<"native" | "inApp", null>;
172
- }>>;
173
- response: import("@metamask/superstruct").Struct<{
174
- result: import("@metamask/snaps-sdk").Json;
175
- } | {
176
- error: import("@metamask/snaps-sdk").Json;
177
- }, null>;
178
- }>;
179
- export declare const SnapResponseStruct: import("@metamask/superstruct").Struct<{
180
- id: string;
181
- notifications: {
182
- type: "native" | "inApp";
183
- message: string;
184
- id: string;
185
- }[];
186
- response: {
187
- result: import("@metamask/snaps-sdk").Json;
188
- } | {
189
- error: import("@metamask/snaps-sdk").Json;
190
- };
191
- } | {
192
- id: string;
193
- notifications: {
194
- type: "native" | "inApp";
195
- message: string;
196
- id: string;
197
- }[];
198
- response: {
199
- result: import("@metamask/snaps-sdk").Json;
200
- } | {
201
- error: import("@metamask/snaps-sdk").Json;
202
- };
203
- getInterface: Function;
204
- }, null>;
205
- //# sourceMappingURL=structs.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"structs.d.cts","sourceRoot":"","sources":["../../src/internals/structs.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;IACnC;;OAEG;;IAGH;;OAEG;;IAGH;;;OAGG;;IAUH;;;OAGG;;IAUH;;;OAGG;;IAQH;;;OAGG;;IAQH;;;;OAIG;;IAQH;;;;OAIG;;IAQH;;;OAGG;;IAQH;;;OAGG;;EAOH,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;IACjC;;OAEG;;IAGH;;;OAGG;;IASH;;;;OAIG;;IAWH;;OAEG;;EAWH,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;IAC5B;;;OAGG;;EAEH,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;EAGnC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;EAE1B,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsB7C,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK3C,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;QAG7B,CAAC"}