@metamask/snaps-simulation 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +15 -0
  3. package/README.md +14 -0
  4. package/dist/constants.cjs +21 -0
  5. package/dist/constants.cjs.map +1 -0
  6. package/dist/constants.d.cts +18 -0
  7. package/dist/constants.d.cts.map +1 -0
  8. package/dist/constants.d.mts +18 -0
  9. package/dist/constants.d.mts.map +1 -0
  10. package/dist/constants.mjs +18 -0
  11. package/dist/constants.mjs.map +1 -0
  12. package/dist/controllers.cjs +101 -0
  13. package/dist/controllers.cjs.map +1 -0
  14. package/dist/controllers.d.cts +41 -0
  15. package/dist/controllers.d.cts.map +1 -0
  16. package/dist/controllers.d.mts +41 -0
  17. package/dist/controllers.d.mts.map +1 -0
  18. package/dist/controllers.mjs +96 -0
  19. package/dist/controllers.mjs.map +1 -0
  20. package/dist/files.cjs +94 -0
  21. package/dist/files.cjs.map +1 -0
  22. package/dist/files.d.cts +49 -0
  23. package/dist/files.d.cts.map +1 -0
  24. package/dist/files.d.mts +49 -0
  25. package/dist/files.d.mts.map +1 -0
  26. package/dist/files.mjs +91 -0
  27. package/dist/files.mjs.map +1 -0
  28. package/dist/index.cjs +27 -0
  29. package/dist/index.cjs.map +1 -0
  30. package/dist/index.d.cts +11 -0
  31. package/dist/index.d.cts.map +1 -0
  32. package/dist/index.d.mts +11 -0
  33. package/dist/index.d.mts.map +1 -0
  34. package/dist/index.mjs +11 -0
  35. package/dist/index.mjs.map +1 -0
  36. package/dist/interface.cjs +569 -0
  37. package/dist/interface.cjs.map +1 -0
  38. package/dist/interface.d.cts +163 -0
  39. package/dist/interface.d.cts.map +1 -0
  40. package/dist/interface.d.mts +163 -0
  41. package/dist/interface.d.mts.map +1 -0
  42. package/dist/interface.mjs +554 -0
  43. package/dist/interface.mjs.map +1 -0
  44. package/dist/methods/constants.cjs +72 -0
  45. package/dist/methods/constants.cjs.map +1 -0
  46. package/dist/methods/constants.d.cts +11 -0
  47. package/dist/methods/constants.d.cts.map +1 -0
  48. package/dist/methods/constants.d.mts +11 -0
  49. package/dist/methods/constants.d.mts.map +1 -0
  50. package/dist/methods/constants.mjs +69 -0
  51. package/dist/methods/constants.mjs.map +1 -0
  52. package/dist/methods/hooks/get-preferences.cjs +18 -0
  53. package/dist/methods/hooks/get-preferences.cjs.map +1 -0
  54. package/dist/methods/hooks/get-preferences.d.cts +14 -0
  55. package/dist/methods/hooks/get-preferences.d.cts.map +1 -0
  56. package/dist/methods/hooks/get-preferences.d.mts +14 -0
  57. package/dist/methods/hooks/get-preferences.d.mts.map +1 -0
  58. package/dist/methods/hooks/get-preferences.mjs +14 -0
  59. package/dist/methods/hooks/get-preferences.mjs.map +1 -0
  60. package/dist/methods/hooks/index.cjs +22 -0
  61. package/dist/methods/hooks/index.cjs.map +1 -0
  62. package/dist/methods/hooks/index.d.cts +6 -0
  63. package/dist/methods/hooks/index.d.cts.map +1 -0
  64. package/dist/methods/hooks/index.d.mts +6 -0
  65. package/dist/methods/hooks/index.d.mts.map +1 -0
  66. package/dist/methods/hooks/index.mjs +6 -0
  67. package/dist/methods/hooks/index.mjs.map +1 -0
  68. package/dist/methods/hooks/interface.cjs +24 -0
  69. package/dist/methods/hooks/interface.cjs.map +1 -0
  70. package/dist/methods/hooks/interface.d.cts +17 -0
  71. package/dist/methods/hooks/interface.d.cts.map +1 -0
  72. package/dist/methods/hooks/interface.d.mts +17 -0
  73. package/dist/methods/hooks/interface.d.mts.map +1 -0
  74. package/dist/methods/hooks/interface.mjs +19 -0
  75. package/dist/methods/hooks/interface.mjs.map +1 -0
  76. package/dist/methods/hooks/notifications.cjs +58 -0
  77. package/dist/methods/hooks/notifications.cjs.map +1 -0
  78. package/dist/methods/hooks/notifications.d.cts +17 -0
  79. package/dist/methods/hooks/notifications.d.cts.map +1 -0
  80. package/dist/methods/hooks/notifications.d.mts +17 -0
  81. package/dist/methods/hooks/notifications.d.mts.map +1 -0
  82. package/dist/methods/hooks/notifications.mjs +55 -0
  83. package/dist/methods/hooks/notifications.mjs.map +1 -0
  84. package/dist/methods/hooks/request-user-approval.cjs +38 -0
  85. package/dist/methods/hooks/request-user-approval.cjs.map +1 -0
  86. package/dist/methods/hooks/request-user-approval.d.cts +16 -0
  87. package/dist/methods/hooks/request-user-approval.d.cts.map +1 -0
  88. package/dist/methods/hooks/request-user-approval.d.mts +16 -0
  89. package/dist/methods/hooks/request-user-approval.d.mts.map +1 -0
  90. package/dist/methods/hooks/request-user-approval.mjs +35 -0
  91. package/dist/methods/hooks/request-user-approval.mjs.map +1 -0
  92. package/dist/methods/hooks/state.cjs +84 -0
  93. package/dist/methods/hooks/state.cjs.map +1 -0
  94. package/dist/methods/hooks/state.d.cts +24 -0
  95. package/dist/methods/hooks/state.d.cts.map +1 -0
  96. package/dist/methods/hooks/state.d.mts +24 -0
  97. package/dist/methods/hooks/state.d.mts.map +1 -0
  98. package/dist/methods/hooks/state.mjs +79 -0
  99. package/dist/methods/hooks/state.mjs.map +1 -0
  100. package/dist/methods/index.cjs +18 -0
  101. package/dist/methods/index.cjs.map +1 -0
  102. package/dist/methods/index.d.cts +2 -0
  103. package/dist/methods/index.d.cts.map +1 -0
  104. package/dist/methods/index.d.mts +2 -0
  105. package/dist/methods/index.d.mts.map +1 -0
  106. package/dist/methods/index.mjs +2 -0
  107. package/dist/methods/index.mjs.map +1 -0
  108. package/dist/methods/specifications.cjs +85 -0
  109. package/dist/methods/specifications.cjs.map +1 -0
  110. package/dist/methods/specifications.d.cts +57 -0
  111. package/dist/methods/specifications.d.cts.map +1 -0
  112. package/dist/methods/specifications.d.mts +57 -0
  113. package/dist/methods/specifications.d.mts.map +1 -0
  114. package/dist/methods/specifications.mjs +78 -0
  115. package/dist/methods/specifications.mjs.map +1 -0
  116. package/dist/middleware/engine.cjs +37 -0
  117. package/dist/middleware/engine.cjs.map +1 -0
  118. package/dist/middleware/engine.d.cts +27 -0
  119. package/dist/middleware/engine.d.cts.map +1 -0
  120. package/dist/middleware/engine.d.mts +27 -0
  121. package/dist/middleware/engine.d.mts.map +1 -0
  122. package/dist/middleware/engine.mjs +34 -0
  123. package/dist/middleware/engine.mjs.map +1 -0
  124. package/dist/middleware/index.cjs +18 -0
  125. package/dist/middleware/index.cjs.map +1 -0
  126. package/dist/middleware/index.d.cts +2 -0
  127. package/dist/middleware/index.d.cts.map +1 -0
  128. package/dist/middleware/index.d.mts +2 -0
  129. package/dist/middleware/index.d.mts.map +1 -0
  130. package/dist/middleware/index.mjs +2 -0
  131. package/dist/middleware/index.mjs.map +1 -0
  132. package/dist/middleware/internal-methods/accounts.cjs +34 -0
  133. package/dist/middleware/internal-methods/accounts.cjs.map +1 -0
  134. package/dist/middleware/internal-methods/accounts.d.cts +20 -0
  135. package/dist/middleware/internal-methods/accounts.d.cts.map +1 -0
  136. package/dist/middleware/internal-methods/accounts.d.mts +20 -0
  137. package/dist/middleware/internal-methods/accounts.d.mts.map +1 -0
  138. package/dist/middleware/internal-methods/accounts.mjs +30 -0
  139. package/dist/middleware/internal-methods/accounts.mjs.map +1 -0
  140. package/dist/middleware/internal-methods/index.cjs +18 -0
  141. package/dist/middleware/internal-methods/index.cjs.map +1 -0
  142. package/dist/middleware/internal-methods/index.d.cts +2 -0
  143. package/dist/middleware/internal-methods/index.d.cts.map +1 -0
  144. package/dist/middleware/internal-methods/index.d.mts +2 -0
  145. package/dist/middleware/internal-methods/index.d.mts.map +1 -0
  146. package/dist/middleware/internal-methods/index.mjs +2 -0
  147. package/dist/middleware/internal-methods/index.mjs.map +1 -0
  148. package/dist/middleware/internal-methods/middleware.cjs +44 -0
  149. package/dist/middleware/internal-methods/middleware.cjs.map +1 -0
  150. package/dist/middleware/internal-methods/middleware.d.cts +23 -0
  151. package/dist/middleware/internal-methods/middleware.d.cts.map +1 -0
  152. package/dist/middleware/internal-methods/middleware.d.mts +23 -0
  153. package/dist/middleware/internal-methods/middleware.d.mts.map +1 -0
  154. package/dist/middleware/internal-methods/middleware.mjs +40 -0
  155. package/dist/middleware/internal-methods/middleware.mjs.map +1 -0
  156. package/dist/middleware/internal-methods/provider-state.cjs +28 -0
  157. package/dist/middleware/internal-methods/provider-state.cjs.map +1 -0
  158. package/dist/middleware/internal-methods/provider-state.d.cts +16 -0
  159. package/dist/middleware/internal-methods/provider-state.d.cts.map +1 -0
  160. package/dist/middleware/internal-methods/provider-state.d.mts +16 -0
  161. package/dist/middleware/internal-methods/provider-state.d.mts.map +1 -0
  162. package/dist/middleware/internal-methods/provider-state.mjs +24 -0
  163. package/dist/middleware/internal-methods/provider-state.mjs.map +1 -0
  164. package/dist/middleware/mock.cjs +22 -0
  165. package/dist/middleware/mock.cjs.map +1 -0
  166. package/dist/middleware/mock.d.cts +11 -0
  167. package/dist/middleware/mock.d.cts.map +1 -0
  168. package/dist/middleware/mock.d.mts +11 -0
  169. package/dist/middleware/mock.d.mts.map +1 -0
  170. package/dist/middleware/mock.mjs +18 -0
  171. package/dist/middleware/mock.mjs.map +1 -0
  172. package/dist/options.cjs +25 -0
  173. package/dist/options.cjs.map +1 -0
  174. package/dist/options.d.cts +40 -0
  175. package/dist/options.d.cts.map +1 -0
  176. package/dist/options.d.mts +40 -0
  177. package/dist/options.d.mts.map +1 -0
  178. package/dist/options.mjs +21 -0
  179. package/dist/options.mjs.map +1 -0
  180. package/dist/request.cjs +144 -0
  181. package/dist/request.cjs.map +1 -0
  182. package/dist/request.d.cts +56 -0
  183. package/dist/request.d.cts.map +1 -0
  184. package/dist/request.d.mts +56 -0
  185. package/dist/request.d.mts.map +1 -0
  186. package/dist/request.mjs +139 -0
  187. package/dist/request.mjs.map +1 -0
  188. package/dist/simulation.cjs +155 -0
  189. package/dist/simulation.cjs.map +1 -0
  190. package/dist/simulation.d.cts +103 -0
  191. package/dist/simulation.d.cts.map +1 -0
  192. package/dist/simulation.d.mts +103 -0
  193. package/dist/simulation.d.mts.map +1 -0
  194. package/dist/simulation.mjs +150 -0
  195. package/dist/simulation.mjs.map +1 -0
  196. package/dist/store/index.cjs +22 -0
  197. package/dist/store/index.cjs.map +1 -0
  198. package/dist/store/index.d.cts +6 -0
  199. package/dist/store/index.d.cts.map +1 -0
  200. package/dist/store/index.d.mts +6 -0
  201. package/dist/store/index.d.mts.map +1 -0
  202. package/dist/store/index.mjs +6 -0
  203. package/dist/store/index.mjs.map +1 -0
  204. package/dist/store/mocks.cjs +39 -0
  205. package/dist/store/mocks.cjs.map +1 -0
  206. package/dist/store/mocks.d.cts +36 -0
  207. package/dist/store/mocks.d.cts.map +1 -0
  208. package/dist/store/mocks.d.mts +36 -0
  209. package/dist/store/mocks.d.mts.map +1 -0
  210. package/dist/store/mocks.mjs +35 -0
  211. package/dist/store/mocks.mjs.map +1 -0
  212. package/dist/store/notifications.cjs +35 -0
  213. package/dist/store/notifications.cjs.map +1 -0
  214. package/dist/store/notifications.d.cts +45 -0
  215. package/dist/store/notifications.d.cts.map +1 -0
  216. package/dist/store/notifications.d.mts +45 -0
  217. package/dist/store/notifications.d.mts.map +1 -0
  218. package/dist/store/notifications.mjs +32 -0
  219. package/dist/store/notifications.mjs.map +1 -0
  220. package/dist/store/state.cjs +54 -0
  221. package/dist/store/state.cjs.map +1 -0
  222. package/dist/store/state.d.cts +56 -0
  223. package/dist/store/state.d.cts.map +1 -0
  224. package/dist/store/state.d.mts +56 -0
  225. package/dist/store/state.d.mts.map +1 -0
  226. package/dist/store/state.mjs +50 -0
  227. package/dist/store/state.mjs.map +1 -0
  228. package/dist/store/store.cjs +51 -0
  229. package/dist/store/store.cjs.map +1 -0
  230. package/dist/store/store.d.cts +22 -0
  231. package/dist/store/store.d.cts.map +1 -0
  232. package/dist/store/store.d.mts +22 -0
  233. package/dist/store/store.d.mts.map +1 -0
  234. package/dist/store/store.mjs +45 -0
  235. package/dist/store/store.mjs.map +1 -0
  236. package/dist/store/ui.cjs +24 -0
  237. package/dist/store/ui.cjs.map +1 -0
  238. package/dist/store/ui.d.cts +27 -0
  239. package/dist/store/ui.d.cts.map +1 -0
  240. package/dist/store/ui.d.mts +27 -0
  241. package/dist/store/ui.d.mts.map +1 -0
  242. package/dist/store/ui.mjs +21 -0
  243. package/dist/store/ui.mjs.map +1 -0
  244. package/dist/structs.cjs +157 -0
  245. package/dist/structs.cjs.map +1 -0
  246. package/dist/structs.d.cts +205 -0
  247. package/dist/structs.d.cts.map +1 -0
  248. package/dist/structs.d.mts +205 -0
  249. package/dist/structs.d.mts.map +1 -0
  250. package/dist/structs.mjs +154 -0
  251. package/dist/structs.mjs.map +1 -0
  252. package/dist/types.cjs +3 -0
  253. package/dist/types.cjs.map +1 -0
  254. package/dist/types.d.cts +393 -0
  255. package/dist/types.d.cts.map +1 -0
  256. package/dist/types.d.mts +393 -0
  257. package/dist/types.d.mts.map +1 -0
  258. package/dist/types.mjs +2 -0
  259. package/dist/types.mjs.map +1 -0
  260. package/dist/validation.cjs +74 -0
  261. package/dist/validation.cjs.map +1 -0
  262. package/dist/validation.d.cts +44 -0
  263. package/dist/validation.d.cts.map +1 -0
  264. package/dist/validation.d.mts +44 -0
  265. package/dist/validation.d.mts.map +1 -0
  266. package/dist/validation.mjs +64 -0
  267. package/dist/validation.mjs.map +1 -0
  268. package/package.json +101 -0
@@ -0,0 +1,157 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.cjs","sourceRoot":"","sources":["../src/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,oBAAM,GAAE;IACR,IAAA,sBAAQ,EAAC,UAAU,CAAC;CACrB,CAAC,CAAC;AAEU,QAAA,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,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"]}
@@ -0,0 +1,205 @@
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_signTypedData" | "personal_sign" | "eth_sign" | "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_signTypedData" | "personal_sign" | "eth_sign" | "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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.d.cts","sourceRoot":"","sources":["../src/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"}
@@ -0,0 +1,205 @@
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_signTypedData" | "personal_sign" | "eth_sign" | "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_signTypedData" | "personal_sign" | "eth_sign" | "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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.d.mts","sourceRoot":"","sources":["../src/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"}