@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,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.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"structs.d.mts","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"}
@@ -1,154 +0,0 @@
1
- import { NotificationType, enumValue } from "@metamask/snaps-sdk";
2
- import { JSXElementStruct } from "@metamask/snaps-sdk/jsx";
3
- import { array, assign, bigint, coerce, defaulted, instance, literal, number, object, optional, string, union, record, any, func, type } from "@metamask/superstruct";
4
- import { bytesToHex, JsonStruct, StrictHexStruct, valueToBytes } from "@metamask/utils";
5
- import { randomBytes } from "crypto";
6
- // TODO: Export this from `@metamask/utils` instead.
7
- const BytesLikeStruct = union([
8
- bigint(),
9
- number(),
10
- string(),
11
- instance(Uint8Array),
12
- ]);
13
- export const TransactionOptionsStruct = object({
14
- /**
15
- * The CAIP-2 chain ID to send the transaction on. Defaults to `eip155:1`.
16
- */
17
- chainId: defaulted(string(), 'eip155:1'),
18
- /**
19
- * The origin to send the transaction from. Defaults to `metamask.io`.
20
- */
21
- origin: defaulted(string(), 'metamask.io'),
22
- /**
23
- * The address to send the transaction from. Defaults to a randomly generated
24
- * address.
25
- */
26
- // TODO: Move this coercer to `@metamask/utils`.
27
- from: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {
28
- if (value) {
29
- return bytesToHex(valueToBytes(value));
30
- }
31
- return bytesToHex(randomBytes(20));
32
- }),
33
- /**
34
- * The address to send the transaction to. Defaults to a randomly generated
35
- * address.
36
- */
37
- // TODO: Move this coercer to `@metamask/utils`.
38
- to: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {
39
- if (value) {
40
- return bytesToHex(valueToBytes(value));
41
- }
42
- return bytesToHex(randomBytes(20));
43
- }),
44
- /**
45
- * The value to send with the transaction. The value may be specified as a
46
- * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.
47
- */
48
- value: defaulted(coerce(StrictHexStruct, BytesLikeStruct, (value) => bytesToHex(valueToBytes(value))), '0x0'),
49
- /**
50
- * The gas limit to use for the transaction. The gas limit may be specified
51
- * as a `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `21_000`.
52
- */
53
- gasLimit: defaulted(coerce(StrictHexStruct, BytesLikeStruct, (value) => bytesToHex(valueToBytes(value))), valueToBytes(21000)),
54
- /**
55
- * The max fee per gas (in Wei) to use for the transaction. The max fee per
56
- * gas may be specified as a `number`, `bigint`, `string`, or `Uint8Array`.
57
- * Defaults to `1`.
58
- */
59
- maxFeePerGas: defaulted(coerce(StrictHexStruct, BytesLikeStruct, (value) => bytesToHex(valueToBytes(value))), valueToBytes(1)),
60
- /**
61
- * The max priority fee per gas (in Wei) to use for the transaction. The max
62
- * priority fee per gas may be specified as a `number`, `bigint`, `string`,
63
- * or `Uint8Array`. Defaults to `1`.
64
- */
65
- maxPriorityFeePerGas: defaulted(coerce(StrictHexStruct, BytesLikeStruct, (value) => bytesToHex(valueToBytes(value))), valueToBytes(1)),
66
- /**
67
- * The nonce to use for the transaction. The nonce may be specified as a
68
- * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.
69
- */
70
- nonce: defaulted(coerce(StrictHexStruct, BytesLikeStruct, (value) => bytesToHex(valueToBytes(value))), valueToBytes(0)),
71
- /**
72
- * The data to send with the transaction. The data may be specified as a
73
- * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0x`.
74
- */
75
- data: defaulted(coerce(union([StrictHexStruct, literal('0x')]), BytesLikeStruct, (value) => bytesToHex(valueToBytes(value))), '0x'),
76
- });
77
- export const SignatureOptionsStruct = object({
78
- /**
79
- * The origin making the signature request.
80
- */
81
- origin: defaulted(string(), 'metamask.io'),
82
- /**
83
- * The address signing the signature request. Defaults to a randomly generated
84
- * address.
85
- */
86
- from: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {
87
- if (value) {
88
- return bytesToHex(valueToBytes(value));
89
- }
90
- return bytesToHex(randomBytes(20));
91
- }),
92
- /**
93
- * The data to send with the transaction. The data may be specified as a
94
- * `string`, an object, or an array of objects. This covers the data types
95
- * for the supported signature methods. Defaults to `0x`.
96
- */
97
- data: defaulted(union([
98
- StrictHexStruct,
99
- literal('0x'),
100
- record(string(), any()),
101
- array(record(string(), any())),
102
- ]), '0x'),
103
- /**
104
- * The signature method being used.
105
- */
106
- signatureMethod: defaulted(union([
107
- literal('eth_sign'),
108
- literal('personal_sign'),
109
- literal('eth_signTypedData'),
110
- literal('eth_signTypedData_v3'),
111
- literal('eth_signTypedData_v4'),
112
- ]), 'personal_sign'),
113
- });
114
- export const SnapOptionsStruct = object({
115
- /**
116
- * The timeout in milliseconds to use for requests to the snap. Defaults to
117
- * `1000`.
118
- */
119
- timeout: defaulted(optional(number()), 1000),
120
- });
121
- export const JsonRpcMockOptionsStruct = object({
122
- method: string(),
123
- result: JsonStruct,
124
- });
125
- export const InterfaceStruct = type({
126
- content: optional(JSXElementStruct),
127
- });
128
- export const SnapResponseWithoutInterfaceStruct = object({
129
- id: string(),
130
- response: union([
131
- object({
132
- result: JsonStruct,
133
- }),
134
- object({
135
- error: JsonStruct,
136
- }),
137
- ]),
138
- notifications: array(object({
139
- id: string(),
140
- message: string(),
141
- type: union([
142
- enumValue(NotificationType.InApp),
143
- enumValue(NotificationType.Native),
144
- ]),
145
- })),
146
- });
147
- export const SnapResponseWithInterfaceStruct = assign(SnapResponseWithoutInterfaceStruct, object({
148
- getInterface: func(),
149
- }));
150
- export const SnapResponseStruct = union([
151
- SnapResponseWithoutInterfaceStruct,
152
- SnapResponseWithInterfaceStruct,
153
- ]);
154
- //# sourceMappingURL=structs.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"structs.mjs","sourceRoot":"","sources":["../../src/internals/structs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,4BAA4B;AAClE,OAAO,EAAE,gBAAgB,EAAE,gCAAgC;AAC3D,OAAO,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,SAAS,EACT,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,MAAM,EACN,GAAG,EACH,IAA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,EAAE,KAAK,CAAC;QACd,MAAM,CAAC;YACL,MAAM,EAAE,UAAU;SACnB,CAAC;QACF,MAAM,CAAC;YACL,KAAK,EAAE,UAAU;SAClB,CAAC;KACH,CAAC;IAEF,aAAa,EAAE,KAAK,CAClB,MAAM,CAAC;QACL,EAAE,EAAE,MAAM,EAAE;QACZ,OAAO,EAAE,MAAM,EAAE;QACjB,IAAI,EAAE,KAAK,CAAC;YACV,SAAS,CAAC,gBAAgB,CAAC,KAAK,CAAC;YACjC,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC;SACnC,CAAC;KACH,CAAC,CACH;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CACnD,kCAAkC,EAClC,MAAM,CAAC;IACL,YAAY,EAAE,IAAI,EAAE;CACrB,CAAC,CACH,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;IACtC,kCAAkC;IAClC,+BAA+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"]}