@metamask/snaps-utils 7.8.1 → 8.0.1

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 (326) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/array.js +1 -1
  3. package/dist/array.mjs +1 -1
  4. package/dist/auxiliary-files.js +1 -1
  5. package/dist/auxiliary-files.mjs +1 -1
  6. package/dist/base64.js +1 -1
  7. package/dist/base64.mjs +1 -1
  8. package/dist/bytes.js +1 -1
  9. package/dist/bytes.mjs +1 -1
  10. package/dist/caveats.js +1 -1
  11. package/dist/caveats.mjs +1 -1
  12. package/dist/checksum.js +1 -1
  13. package/dist/checksum.mjs +1 -1
  14. package/dist/{chunk-5I5WPAVD.js → chunk-37EUH3KZ.js} +13 -13
  15. package/dist/{chunk-FLSK6ISS.mjs → chunk-3N27GIUS.mjs} +4 -1
  16. package/dist/chunk-3N27GIUS.mjs.map +1 -0
  17. package/dist/{chunk-SB43G2RI.js → chunk-3OXW5H4F.js} +5 -5
  18. package/dist/{chunk-K6BCBPXF.js → chunk-3RFGTBEP.js} +11 -11
  19. package/dist/{chunk-JMDSN227.mjs → chunk-3RUWAMJT.mjs} +7 -1
  20. package/dist/chunk-4BGZ2CHC.mjs +22 -0
  21. package/dist/chunk-4BGZ2CHC.mjs.map +1 -0
  22. package/dist/chunk-4RYTYEUQ.mjs +33 -0
  23. package/dist/chunk-4RYTYEUQ.mjs.map +1 -0
  24. package/dist/{chunk-VOPTAKVG.js → chunk-53QXTM77.js} +4 -1
  25. package/dist/chunk-53QXTM77.js.map +1 -0
  26. package/dist/chunk-5FTBWYCW.mjs +27 -0
  27. package/dist/chunk-5FTBWYCW.mjs.map +1 -0
  28. package/dist/chunk-5MABKEV7.mjs +66 -0
  29. package/dist/chunk-5MABKEV7.mjs.map +1 -0
  30. package/dist/chunk-5UAPBOKO.js +37 -0
  31. package/dist/chunk-5UAPBOKO.js.map +1 -0
  32. package/dist/chunk-6YJWU77L.js +19 -0
  33. package/dist/chunk-6YJWU77L.js.map +1 -0
  34. package/dist/chunk-7T7FYH77.mjs +37 -0
  35. package/dist/chunk-7T7FYH77.mjs.map +1 -0
  36. package/dist/chunk-BPK5BH7K.js +27 -0
  37. package/dist/chunk-BPK5BH7K.js.map +1 -0
  38. package/dist/chunk-CPG2UGAA.js +25 -0
  39. package/dist/chunk-CPG2UGAA.js.map +1 -0
  40. package/dist/chunk-DKO64Y4H.mjs +27 -0
  41. package/dist/chunk-DKO64Y4H.mjs.map +1 -0
  42. package/dist/chunk-EYWMVDCD.mjs +25 -0
  43. package/dist/chunk-EYWMVDCD.mjs.map +1 -0
  44. package/dist/chunk-FA4QIZH6.js +1 -0
  45. package/dist/chunk-GIVJAZ2Q.mjs +248 -0
  46. package/dist/chunk-GIVJAZ2Q.mjs.map +1 -0
  47. package/dist/chunk-GJAVOB7B.js +24 -0
  48. package/dist/chunk-GJAVOB7B.js.map +1 -0
  49. package/dist/{chunk-ZXHR322P.mjs → chunk-GXSTPU7D.mjs} +4 -4
  50. package/dist/chunk-HY4W6BUH.mjs +24 -0
  51. package/dist/chunk-HY4W6BUH.mjs.map +1 -0
  52. package/dist/{chunk-YNOZU43P.mjs → chunk-IPUL74MZ.mjs} +3 -3
  53. package/dist/chunk-IVDERT5W.js +22 -0
  54. package/dist/chunk-IVDERT5W.js.map +1 -0
  55. package/dist/chunk-JETPRED3.js +248 -0
  56. package/dist/chunk-JETPRED3.js.map +1 -0
  57. package/dist/chunk-L2DHOOBX.js +33 -0
  58. package/dist/chunk-L2DHOOBX.js.map +1 -0
  59. package/dist/chunk-LQSEBGOX.js +34 -0
  60. package/dist/chunk-LQSEBGOX.js.map +1 -0
  61. package/dist/chunk-MDOG3S4V.mjs +34 -0
  62. package/dist/chunk-MDOG3S4V.mjs.map +1 -0
  63. package/dist/chunk-MFGLB75H.mjs +22 -0
  64. package/dist/chunk-MFGLB75H.mjs.map +1 -0
  65. package/dist/chunk-MQURBEO4.mjs +16 -0
  66. package/dist/chunk-MQURBEO4.mjs.map +1 -0
  67. package/dist/{chunk-PZNIU23I.js → chunk-MWAZGSRO.js} +2 -22
  68. package/dist/chunk-MWAZGSRO.js.map +1 -0
  69. package/dist/{chunk-AJNKQYKP.mjs → chunk-N2JAYIUP.mjs} +2 -22
  70. package/dist/chunk-N2JAYIUP.mjs.map +1 -0
  71. package/dist/chunk-N4MA537G.js +22 -0
  72. package/dist/chunk-N4MA537G.js.map +1 -0
  73. package/dist/chunk-NNYGTNHP.mjs +1 -0
  74. package/dist/{chunk-H35ZUVQT.mjs → chunk-NSVVZNSD.mjs} +3 -13
  75. package/dist/chunk-NSVVZNSD.mjs.map +1 -0
  76. package/dist/chunk-PAOTMYIM.mjs +69 -0
  77. package/dist/chunk-PAOTMYIM.mjs.map +1 -0
  78. package/dist/chunk-PO5BBHHX.mjs +22 -0
  79. package/dist/chunk-PO5BBHHX.mjs.map +1 -0
  80. package/dist/{chunk-VWGXNUMD.mjs → chunk-PZF4KWU2.mjs} +2 -2
  81. package/dist/chunk-QD3LTING.js +34 -0
  82. package/dist/chunk-QD3LTING.js.map +1 -0
  83. package/dist/chunk-RNMJQSVQ.js +69 -0
  84. package/dist/chunk-RNMJQSVQ.js.map +1 -0
  85. package/dist/chunk-RRFKK45V.mjs +15 -0
  86. package/dist/chunk-RRFKK45V.mjs.map +1 -0
  87. package/dist/{chunk-PHUTP7NB.js → chunk-S3BWTUTZ.js} +9 -3
  88. package/dist/chunk-SKKANJ45.mjs +19 -0
  89. package/dist/chunk-SKKANJ45.mjs.map +1 -0
  90. package/dist/chunk-SYYDKPK3.js +15 -0
  91. package/dist/chunk-SYYDKPK3.js.map +1 -0
  92. package/dist/chunk-T5ZOOZ46.js +22 -0
  93. package/dist/chunk-T5ZOOZ46.js.map +1 -0
  94. package/dist/{chunk-RD6BN2TQ.js → chunk-TAMKWZ4E.js} +8 -18
  95. package/dist/chunk-TAMKWZ4E.js.map +1 -0
  96. package/dist/chunk-TYWGZIOF.mjs +34 -0
  97. package/dist/chunk-TYWGZIOF.mjs.map +1 -0
  98. package/dist/chunk-VBYSWMSU.js +66 -0
  99. package/dist/chunk-VBYSWMSU.js.map +1 -0
  100. package/dist/chunk-VEPYH26P.js +27 -0
  101. package/dist/chunk-VEPYH26P.js.map +1 -0
  102. package/dist/chunk-VWLBM7XM.js +1 -0
  103. package/dist/chunk-W7A3BYUP.mjs +1 -0
  104. package/dist/chunk-YL2EHYAA.js +16 -0
  105. package/dist/chunk-YL2EHYAA.js.map +1 -0
  106. package/dist/constants.js +1 -1
  107. package/dist/constants.mjs +1 -1
  108. package/dist/cronjob.js +1 -1
  109. package/dist/cronjob.mjs +1 -1
  110. package/dist/deep-clone.js +1 -1
  111. package/dist/deep-clone.mjs +1 -1
  112. package/dist/default-endowments.js +1 -1
  113. package/dist/default-endowments.mjs +1 -1
  114. package/dist/derivation-paths.js +1 -1
  115. package/dist/derivation-paths.mjs +1 -1
  116. package/dist/entropy.js +1 -1
  117. package/dist/entropy.mjs +1 -1
  118. package/dist/errors.js +3 -3
  119. package/dist/errors.mjs +2 -2
  120. package/dist/eval-worker.js +1 -1
  121. package/dist/eval-worker.mjs +1 -1
  122. package/dist/eval.js +1 -1
  123. package/dist/eval.mjs +1 -1
  124. package/dist/fs.js +1 -1
  125. package/dist/fs.mjs +1 -1
  126. package/dist/handler-types.js +1 -1
  127. package/dist/handler-types.mjs +1 -1
  128. package/dist/handlers.js +1 -1
  129. package/dist/handlers.mjs +1 -1
  130. package/dist/icon.js +1 -1
  131. package/dist/icon.mjs +1 -1
  132. package/dist/iframe.js +1 -1
  133. package/dist/iframe.mjs +1 -1
  134. package/dist/index.executionenv.js +5 -11
  135. package/dist/index.executionenv.mjs +9 -15
  136. package/dist/index.js +11 -18
  137. package/dist/index.mjs +15 -22
  138. package/dist/json-rpc.js +1 -1
  139. package/dist/json-rpc.mjs +1 -1
  140. package/dist/json.js +1 -1
  141. package/dist/json.mjs +1 -1
  142. package/dist/localization.js +1 -1
  143. package/dist/localization.mjs +1 -1
  144. package/dist/logging.js +1 -1
  145. package/dist/logging.mjs +1 -1
  146. package/dist/manifest/index.js +6 -6
  147. package/dist/manifest/index.mjs +5 -5
  148. package/dist/manifest/manifest.js +23 -9
  149. package/dist/manifest/manifest.mjs +24 -10
  150. package/dist/manifest/node.js +23 -9
  151. package/dist/manifest/node.mjs +24 -10
  152. package/dist/manifest/validation.js +6 -6
  153. package/dist/manifest/validation.mjs +5 -5
  154. package/dist/manifest/validator-types.js +1 -0
  155. package/dist/manifest/validator-types.js.map +1 -0
  156. package/dist/manifest/validator-types.mjs +1 -0
  157. package/dist/manifest/validator-types.mjs.map +1 -0
  158. package/dist/manifest/validator.js +44 -0
  159. package/dist/manifest/validator.js.map +1 -0
  160. package/dist/manifest/validator.mjs +44 -0
  161. package/dist/manifest/validator.mjs.map +1 -0
  162. package/dist/manifest/validators/checksum.js +15 -0
  163. package/dist/manifest/validators/checksum.js.map +1 -0
  164. package/dist/manifest/validators/checksum.mjs +15 -0
  165. package/dist/manifest/validators/checksum.mjs.map +1 -0
  166. package/dist/manifest/validators/expected-files.js +9 -0
  167. package/dist/manifest/validators/expected-files.js.map +1 -0
  168. package/dist/manifest/validators/expected-files.mjs +9 -0
  169. package/dist/manifest/validators/expected-files.mjs.map +1 -0
  170. package/dist/manifest/validators/icon-declared.js +8 -0
  171. package/dist/manifest/validators/icon-declared.js.map +1 -0
  172. package/dist/manifest/validators/icon-declared.mjs +8 -0
  173. package/dist/manifest/validators/icon-declared.mjs.map +1 -0
  174. package/dist/manifest/validators/icon-dimensions.js +10 -0
  175. package/dist/manifest/validators/icon-dimensions.js.map +1 -0
  176. package/dist/manifest/validators/icon-dimensions.mjs +10 -0
  177. package/dist/manifest/validators/icon-dimensions.mjs.map +1 -0
  178. package/dist/manifest/validators/icon-missing.js +8 -0
  179. package/dist/manifest/validators/icon-missing.js.map +1 -0
  180. package/dist/manifest/validators/icon-missing.mjs +8 -0
  181. package/dist/manifest/validators/icon-missing.mjs.map +1 -0
  182. package/dist/manifest/validators/index.js +80 -0
  183. package/dist/manifest/validators/index.js.map +1 -0
  184. package/dist/manifest/validators/index.mjs +80 -0
  185. package/dist/manifest/validators/index.mjs.map +1 -0
  186. package/dist/manifest/validators/is-localization-file.js +12 -0
  187. package/dist/manifest/validators/is-localization-file.js.map +1 -0
  188. package/dist/manifest/validators/is-localization-file.mjs +12 -0
  189. package/dist/manifest/validators/is-localization-file.mjs.map +1 -0
  190. package/dist/manifest/validators/is-package-json.js +11 -0
  191. package/dist/manifest/validators/is-package-json.js.map +1 -0
  192. package/dist/manifest/validators/is-package-json.mjs +11 -0
  193. package/dist/manifest/validators/is-package-json.mjs.map +1 -0
  194. package/dist/manifest/validators/is-snap-icon.js +10 -0
  195. package/dist/manifest/validators/is-snap-icon.js.map +1 -0
  196. package/dist/manifest/validators/is-snap-icon.mjs +10 -0
  197. package/dist/manifest/validators/is-snap-icon.mjs.map +1 -0
  198. package/dist/manifest/validators/is-snap-manifest.js +23 -0
  199. package/dist/manifest/validators/is-snap-manifest.js.map +1 -0
  200. package/dist/manifest/validators/is-snap-manifest.mjs +23 -0
  201. package/dist/manifest/validators/is-snap-manifest.mjs.map +1 -0
  202. package/dist/manifest/validators/manifest-localization.js +10 -0
  203. package/dist/manifest/validators/manifest-localization.js.map +1 -0
  204. package/dist/manifest/validators/manifest-localization.mjs +10 -0
  205. package/dist/manifest/validators/manifest-localization.mjs.map +1 -0
  206. package/dist/manifest/validators/package-json-recommended-fields.js +8 -0
  207. package/dist/manifest/validators/package-json-recommended-fields.js.map +1 -0
  208. package/dist/manifest/validators/package-json-recommended-fields.mjs +8 -0
  209. package/dist/manifest/validators/package-json-recommended-fields.mjs.map +1 -0
  210. package/dist/manifest/validators/package-name-match.js +9 -0
  211. package/dist/manifest/validators/package-name-match.js.map +1 -0
  212. package/dist/manifest/validators/package-name-match.mjs +9 -0
  213. package/dist/manifest/validators/package-name-match.mjs.map +1 -0
  214. package/dist/manifest/validators/repository-match.js +10 -0
  215. package/dist/manifest/validators/repository-match.js.map +1 -0
  216. package/dist/manifest/validators/repository-match.mjs +10 -0
  217. package/dist/manifest/validators/repository-match.mjs.map +1 -0
  218. package/dist/manifest/validators/version-match.js +9 -0
  219. package/dist/manifest/validators/version-match.js.map +1 -0
  220. package/dist/manifest/validators/version-match.mjs +9 -0
  221. package/dist/manifest/validators/version-match.mjs.map +1 -0
  222. package/dist/mock.js +1 -1
  223. package/dist/mock.mjs +1 -1
  224. package/dist/namespace.js +1 -1
  225. package/dist/namespace.mjs +1 -1
  226. package/dist/node.js +28 -27
  227. package/dist/node.mjs +34 -33
  228. package/dist/path.js +1 -1
  229. package/dist/path.mjs +1 -1
  230. package/dist/post-process.js +1 -1
  231. package/dist/post-process.mjs +1 -1
  232. package/dist/promise.js +2 -0
  233. package/dist/promise.js.map +1 -0
  234. package/dist/promise.mjs +2 -0
  235. package/dist/promise.mjs.map +1 -0
  236. package/dist/snaps.js +4 -6
  237. package/dist/snaps.mjs +3 -5
  238. package/dist/strings.js +1 -1
  239. package/dist/strings.mjs +1 -1
  240. package/dist/structs.js +3 -3
  241. package/dist/structs.mjs +2 -2
  242. package/dist/svg.js +1 -1
  243. package/dist/svg.mjs +1 -1
  244. package/dist/tsconfig.build.tsbuildinfo +1 -1
  245. package/dist/types/cronjob.d.ts +3 -3
  246. package/dist/types/derivation-paths.d.ts +1 -1
  247. package/dist/types/entropy.d.ts +1 -1
  248. package/dist/types/errors.d.ts +1 -1
  249. package/dist/types/eval.d.ts +1 -1
  250. package/dist/types/handler-types.d.ts +1 -1
  251. package/dist/types/handlers.d.ts +56 -7
  252. package/dist/types/index.d.ts +1 -0
  253. package/dist/types/json-rpc.d.ts +2 -2
  254. package/dist/types/localization.d.ts +1 -1
  255. package/dist/types/manifest/manifest.d.ts +30 -40
  256. package/dist/types/manifest/validation.d.ts +6 -6
  257. package/dist/types/manifest/validator-types.d.ts +34 -0
  258. package/dist/types/manifest/validator.d.ts +22 -0
  259. package/dist/types/manifest/validators/checksum.d.ts +5 -0
  260. package/dist/types/manifest/validators/expected-files.d.ts +5 -0
  261. package/dist/types/manifest/validators/icon-declared.d.ts +5 -0
  262. package/dist/types/manifest/validators/icon-dimensions.d.ts +5 -0
  263. package/dist/types/manifest/validators/icon-missing.d.ts +5 -0
  264. package/dist/types/manifest/validators/index.d.ts +14 -0
  265. package/dist/types/manifest/validators/is-localization-file.d.ts +5 -0
  266. package/dist/types/manifest/validators/is-package-json.d.ts +5 -0
  267. package/dist/types/manifest/validators/is-snap-icon.d.ts +5 -0
  268. package/dist/types/manifest/validators/is-snap-manifest.d.ts +5 -0
  269. package/dist/types/manifest/validators/manifest-localization.d.ts +5 -0
  270. package/dist/types/manifest/validators/package-json-recommended-fields.d.ts +5 -0
  271. package/dist/types/manifest/validators/package-name-match.d.ts +5 -0
  272. package/dist/types/manifest/validators/repository-match.d.ts +5 -0
  273. package/dist/types/manifest/validators/version-match.d.ts +5 -0
  274. package/dist/types/namespace.d.ts +5 -5
  275. package/dist/types/node.d.ts +0 -1
  276. package/dist/types/post-process.d.ts +3 -3
  277. package/dist/types/promise.d.ts +1 -0
  278. package/dist/types/snaps.d.ts +10 -18
  279. package/dist/types/structs.d.ts +2 -2
  280. package/dist/types/types.d.ts +9 -33
  281. package/dist/types/virtual-file/VirtualFile.d.ts +4 -4
  282. package/dist/types/virtual-file/toVirtualFile.d.ts +1 -1
  283. package/dist/types.js +3 -9
  284. package/dist/types.mjs +2 -8
  285. package/dist/ui.js +1 -1
  286. package/dist/ui.mjs +1 -1
  287. package/dist/validation.js +7 -7
  288. package/dist/validation.mjs +6 -6
  289. package/dist/versions.js +1 -1
  290. package/dist/versions.mjs +1 -1
  291. package/dist/virtual-file/VirtualFile.js +1 -1
  292. package/dist/virtual-file/VirtualFile.mjs +1 -1
  293. package/dist/virtual-file/index.js +1 -1
  294. package/dist/virtual-file/index.mjs +1 -1
  295. package/dist/virtual-file/node.js +1 -1
  296. package/dist/virtual-file/node.mjs +1 -1
  297. package/dist/virtual-file/toVirtualFile.js +1 -1
  298. package/dist/virtual-file/toVirtualFile.mjs +1 -1
  299. package/package.json +5 -5
  300. package/dist/chunk-25ESL4NL.js +0 -409
  301. package/dist/chunk-25ESL4NL.js.map +0 -1
  302. package/dist/chunk-AJNKQYKP.mjs.map +0 -1
  303. package/dist/chunk-F6G67XQ4.js +0 -1
  304. package/dist/chunk-FLSK6ISS.mjs.map +0 -1
  305. package/dist/chunk-H35ZUVQT.mjs.map +0 -1
  306. package/dist/chunk-KCECQM3L.mjs +0 -409
  307. package/dist/chunk-KCECQM3L.mjs.map +0 -1
  308. package/dist/chunk-OYZPBNHS.mjs +0 -1
  309. package/dist/chunk-PZNIU23I.js.map +0 -1
  310. package/dist/chunk-RD6BN2TQ.js.map +0 -1
  311. package/dist/chunk-VOPTAKVG.js.map +0 -1
  312. package/dist/npm.js +0 -35
  313. package/dist/npm.mjs +0 -35
  314. package/dist/types/npm.d.ts +0 -19
  315. /package/dist/{chunk-5I5WPAVD.js.map → chunk-37EUH3KZ.js.map} +0 -0
  316. /package/dist/{chunk-SB43G2RI.js.map → chunk-3OXW5H4F.js.map} +0 -0
  317. /package/dist/{chunk-K6BCBPXF.js.map → chunk-3RFGTBEP.js.map} +0 -0
  318. /package/dist/{chunk-JMDSN227.mjs.map → chunk-3RUWAMJT.mjs.map} +0 -0
  319. /package/dist/{chunk-F6G67XQ4.js.map → chunk-FA4QIZH6.js.map} +0 -0
  320. /package/dist/{chunk-ZXHR322P.mjs.map → chunk-GXSTPU7D.mjs.map} +0 -0
  321. /package/dist/{chunk-YNOZU43P.mjs.map → chunk-IPUL74MZ.mjs.map} +0 -0
  322. /package/dist/{chunk-OYZPBNHS.mjs.map → chunk-NNYGTNHP.mjs.map} +0 -0
  323. /package/dist/{chunk-VWGXNUMD.mjs.map → chunk-PZF4KWU2.mjs.map} +0 -0
  324. /package/dist/{chunk-PHUTP7NB.js.map → chunk-S3BWTUTZ.js.map} +0 -0
  325. /package/dist/{npm.js.map → chunk-VWLBM7XM.js.map} +0 -0
  326. /package/dist/{npm.mjs.map → chunk-W7A3BYUP.mjs.map} +0 -0
@@ -10,9 +10,9 @@ export declare const CronjobRpcRequestStruct: import("@metamask/superstruct").St
10
10
  method: import("@metamask/superstruct").Struct<string, null>;
11
11
  params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | undefined, null>;
12
12
  }>;
13
- export declare type CronjobRpcRequest = Infer<typeof CronjobRpcRequestStruct>;
13
+ export type CronjobRpcRequest = Infer<typeof CronjobRpcRequestStruct>;
14
14
  export declare const CronExpressionStruct: import("@metamask/superstruct").Struct<string, null>;
15
- export declare type CronExpression = Infer<typeof CronExpressionStruct>;
15
+ export type CronExpression = Infer<typeof CronExpressionStruct>;
16
16
  /**
17
17
  * Parses a cron expression.
18
18
  *
@@ -42,7 +42,7 @@ export declare const CronjobSpecificationStruct: import("@metamask/superstruct")
42
42
  params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | undefined, null>;
43
43
  }>;
44
44
  }>;
45
- export declare type CronjobSpecification = Infer<typeof CronjobSpecificationStruct>;
45
+ export type CronjobSpecification = Infer<typeof CronjobSpecificationStruct>;
46
46
  /**
47
47
  * Check if the given value is a {@link CronjobSpecification} object.
48
48
  *
@@ -1,5 +1,5 @@
1
1
  import type { SupportedCurve } from '@metamask/key-tree';
2
- export declare type SnapsDerivationPath = {
2
+ export type SnapsDerivationPath = {
3
3
  path: ['m', ...string[]];
4
4
  curve: SupportedCurve;
5
5
  name: string;
@@ -1,3 +1,3 @@
1
1
  export declare const SIP_6_MAGIC_VALUE: `${number}'`;
2
2
  export declare const STATE_ENCRYPTION_MAGIC_VALUE: `${number}'`;
3
- export declare type MagicValue = typeof SIP_6_MAGIC_VALUE | typeof STATE_ENCRYPTION_MAGIC_VALUE;
3
+ export type MagicValue = typeof SIP_6_MAGIC_VALUE | typeof STATE_ENCRYPTION_MAGIC_VALUE;
@@ -4,7 +4,7 @@ import type { SerializedSnapError, SnapError } from '@metamask/snaps-sdk';
4
4
  import type { Json, JsonRpcError } from '@metamask/utils';
5
5
  export declare const SNAP_ERROR_WRAPPER_CODE = -31001;
6
6
  export declare const SNAP_ERROR_WRAPPER_MESSAGE = "Wrapped Snap Error";
7
- export declare type SerializedSnapErrorWrapper = {
7
+ export type SerializedSnapErrorWrapper = {
8
8
  code: typeof SNAP_ERROR_WRAPPER_CODE;
9
9
  message: typeof SNAP_ERROR_WRAPPER_MESSAGE;
10
10
  data: {
@@ -1,4 +1,4 @@
1
- export declare type EvalOutput = {
1
+ export type EvalOutput = {
2
2
  stdout: string;
3
3
  stderr: string;
4
4
  };
@@ -10,7 +10,7 @@ export declare enum HandlerType {
10
10
  OnHomePage = "onHomePage",
11
11
  OnUserInput = "onUserInput"
12
12
  }
13
- export declare type SnapHandler = {
13
+ export type SnapHandler = {
14
14
  /**
15
15
  * The type of handler.
16
16
  */
@@ -2,7 +2,7 @@ import type { OnCronjobHandler, OnHomePageHandler, OnKeyringRequestHandler, OnNa
2
2
  import { SeverityLevel } from '@metamask/snaps-sdk';
3
3
  import type { SnapHandler } from './handler-types';
4
4
  import { HandlerType } from './handler-types';
5
- export declare type SnapRpcHookArgs = {
5
+ export type SnapRpcHookArgs = {
6
6
  origin: string;
7
7
  handler: HandlerType;
8
8
  request: Record<string, unknown>;
@@ -11,7 +11,7 @@ export declare const SNAP_EXPORTS: {
11
11
  readonly onRpcRequest: {
12
12
  readonly type: HandlerType.OnRpcRequest;
13
13
  readonly required: true;
14
- readonly validator: (snapExport: unknown) => snapExport is OnRpcRequestHandler<import("@metamask/snaps-sdk").JsonRpcParams>;
14
+ readonly validator: (snapExport: unknown) => snapExport is OnRpcRequestHandler;
15
15
  };
16
16
  readonly onTransaction: {
17
17
  readonly type: HandlerType.OnTransaction;
@@ -21,7 +21,7 @@ export declare const SNAP_EXPORTS: {
21
21
  readonly onCronjob: {
22
22
  readonly type: HandlerType.OnCronjob;
23
23
  readonly required: true;
24
- readonly validator: (snapExport: unknown) => snapExport is OnCronjobHandler<import("@metamask/snaps-sdk").JsonRpcParams>;
24
+ readonly validator: (snapExport: unknown) => snapExport is OnCronjobHandler;
25
25
  };
26
26
  readonly onNameLookup: {
27
27
  readonly type: HandlerType.OnNameLookup;
@@ -41,7 +41,7 @@ export declare const SNAP_EXPORTS: {
41
41
  readonly onKeyringRequest: {
42
42
  readonly type: HandlerType.OnKeyringRequest;
43
43
  readonly required: true;
44
- readonly validator: (snapExport: unknown) => snapExport is OnKeyringRequestHandler<import("@metamask/snaps-sdk").JsonRpcParams>;
44
+ readonly validator: (snapExport: unknown) => snapExport is OnKeyringRequestHandler;
45
45
  };
46
46
  readonly onHomePage: {
47
47
  readonly type: HandlerType.OnHomePage;
@@ -141,6 +141,13 @@ export declare const OnTransactionResponseWithContentStruct: import("@metamask/s
141
141
  buttonType?: "button" | "submit" | undefined;
142
142
  })[];
143
143
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
144
+ name: string;
145
+ value?: string | undefined;
146
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
147
+ value: string;
148
+ children: string;
149
+ }, "Radio">>;
150
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
144
151
  children: import("@metamask/snaps-sdk/jsx").StringElement;
145
152
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
146
153
  src: string;
@@ -217,6 +224,13 @@ export declare const OnTransactionResponseWithContentStruct: import("@metamask/s
217
224
  buttonType?: "button" | "submit" | undefined;
218
225
  })[];
219
226
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
227
+ name: string;
228
+ value?: string | undefined;
229
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
230
+ value: string;
231
+ children: string;
232
+ }, "Radio">>;
233
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
220
234
  children: import("@metamask/snaps-sdk/jsx").StringElement;
221
235
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
222
236
  src: string;
@@ -297,6 +311,13 @@ export declare const OnTransactionResponseStruct: import("@metamask/superstruct"
297
311
  buttonType?: "button" | "submit" | undefined;
298
312
  })[];
299
313
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
314
+ name: string;
315
+ value?: string | undefined;
316
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
317
+ value: string;
318
+ children: string;
319
+ }, "Radio">>;
320
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
300
321
  children: import("@metamask/snaps-sdk/jsx").StringElement;
301
322
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
302
323
  src: string;
@@ -377,6 +398,13 @@ export declare const OnSignatureResponseStruct: import("@metamask/superstruct").
377
398
  buttonType?: "button" | "submit" | undefined;
378
399
  })[];
379
400
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
401
+ name: string;
402
+ value?: string | undefined;
403
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
404
+ value: string;
405
+ children: string;
406
+ }, "Radio">>;
407
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
380
408
  children: import("@metamask/snaps-sdk/jsx").StringElement;
381
409
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
382
410
  src: string;
@@ -454,6 +482,13 @@ export declare const OnHomePageResponseWithContentStruct: import("@metamask/supe
454
482
  buttonType?: "button" | "submit" | undefined;
455
483
  })[];
456
484
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
485
+ name: string;
486
+ value?: string | undefined;
487
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
488
+ value: string;
489
+ children: string;
490
+ }, "Radio">>;
491
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
457
492
  children: import("@metamask/snaps-sdk/jsx").StringElement;
458
493
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
459
494
  src: string;
@@ -529,6 +564,13 @@ export declare const OnHomePageResponseWithContentStruct: import("@metamask/supe
529
564
  buttonType?: "button" | "submit" | undefined;
530
565
  })[];
531
566
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
567
+ name: string;
568
+ value?: string | undefined;
569
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
570
+ value: string;
571
+ children: string;
572
+ }, "Radio">>;
573
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
532
574
  children: import("@metamask/snaps-sdk/jsx").StringElement;
533
575
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
534
576
  src: string;
@@ -610,6 +652,13 @@ export declare const OnHomePageResponseStruct: import("@metamask/superstruct").S
610
652
  buttonType?: "button" | "submit" | undefined;
611
653
  })[];
612
654
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
655
+ name: string;
656
+ value?: string | undefined;
657
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
658
+ value: string;
659
+ children: string;
660
+ }, "Radio">>;
661
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
613
662
  children: import("@metamask/snaps-sdk/jsx").StringElement;
614
663
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
615
664
  src: string;
@@ -687,14 +736,14 @@ export declare const OnNameLookupResponseStruct: import("@metamask/superstruct")
687
736
  /**
688
737
  * Utility type for getting the handler function type from a handler type.
689
738
  */
690
- export declare type HandlerFunction<Type extends SnapHandler> = Type['validator'] extends (snapExport: unknown) => snapExport is infer Handler ? Handler : never;
739
+ export type HandlerFunction<Type extends SnapHandler> = Type['validator'] extends (snapExport: unknown) => snapExport is infer Handler ? Handler : never;
691
740
  /**
692
741
  * All the function-based handlers that a snap can implement.
693
742
  */
694
- export declare type SnapFunctionExports = {
743
+ export type SnapFunctionExports = {
695
744
  [Key in keyof typeof SNAP_EXPORTS]?: HandlerFunction<(typeof SNAP_EXPORTS)[Key]>;
696
745
  };
697
746
  /**
698
747
  * All handlers that a snap can implement.
699
748
  */
700
- export declare type SnapExports = SnapFunctionExports;
749
+ export type SnapExports = SnapFunctionExports;
@@ -29,3 +29,4 @@ export * from './ui';
29
29
  export * from './validation';
30
30
  export * from './versions';
31
31
  export * from './virtual-file';
32
+ export * from './promise';
@@ -10,7 +10,7 @@ export declare const RpcOriginsStruct: import("@metamask/superstruct").Struct<{
10
10
  snaps: import("@metamask/superstruct").Struct<boolean | undefined, null>;
11
11
  allowedOrigins: import("@metamask/superstruct").Struct<string[] | undefined, import("@metamask/superstruct").Struct<string, null>>;
12
12
  }>;
13
- export declare type RpcOrigins = Infer<typeof RpcOriginsStruct>;
13
+ export type RpcOrigins = Infer<typeof RpcOriginsStruct>;
14
14
  /**
15
15
  * Asserts that the given value is a valid {@link RpcOrigins} object.
16
16
  *
@@ -25,7 +25,7 @@ export declare const KeyringOriginsStruct: import("@metamask/superstruct").Struc
25
25
  }, {
26
26
  allowedOrigins: import("@metamask/superstruct").Struct<string[] | undefined, import("@metamask/superstruct").Struct<string, null>>;
27
27
  }>;
28
- export declare type KeyringOrigins = Infer<typeof KeyringOriginsStruct>;
28
+ export type KeyringOrigins = Infer<typeof KeyringOriginsStruct>;
29
29
  /**
30
30
  * Assert that the given value is a valid {@link KeyringOrigins} object.
31
31
  *
@@ -15,7 +15,7 @@ export declare const LocalizationFileStruct: import("@metamask/superstruct").Str
15
15
  description?: string | undefined;
16
16
  }>, null>;
17
17
  }>;
18
- export declare type LocalizationFile = Infer<typeof LocalizationFileStruct>;
18
+ export type LocalizationFile = Infer<typeof LocalizationFileStruct>;
19
19
  /**
20
20
  * Validate a list of localization files.
21
21
  *
@@ -1,53 +1,56 @@
1
1
  /// <reference types="node" />
2
2
  import type { Json } from '@metamask/utils';
3
- import { ProgrammaticallyFixableSnapError } from '../snaps';
4
3
  import type { SnapFiles } from '../types';
5
4
  import { VirtualFile } from '../virtual-file/node';
6
5
  import type { SnapManifest } from './validation';
6
+ import type { ValidatorResults } from './validator';
7
+ import type { ValidatorMeta, ValidatorReport } from './validator-types';
8
+ export type CheckManifestReport = Omit<ValidatorReport, 'fix'> & {
9
+ wasFixed?: boolean;
10
+ };
7
11
  /**
8
12
  * The result from the `checkManifest` function.
9
13
  *
10
14
  * @property manifest - The fixed manifest object.
11
- * @property updated - Whether the manifest was updated.
12
- * @property warnings - An array of warnings that were encountered during
13
- * processing of the manifest files. These warnings are not logged to the
14
- * console automatically, so depending on the environment the function is called
15
- * in, a different method for logging can be used.
16
- * @property errors - An array of errors that were encountered during
17
- * processing of the manifest files. These errors are not logged to the
18
- * console automatically, so depending on the environment the function is called
19
- * in, a different method for logging can be used.
15
+ * @property updated - Whether the manifest was written and updated.
20
16
  */
21
- export declare type CheckManifestResult = {
22
- manifest: SnapManifest;
23
- updated?: boolean;
24
- warnings: string[];
25
- errors: string[];
17
+ export type CheckManifestResult = {
18
+ files?: SnapFiles;
19
+ updated: boolean;
20
+ reports: CheckManifestReport[];
26
21
  };
27
- export declare type WriteFileFunction = (path: string, data: string) => Promise<void>;
22
+ export type WriteFileFunction = (path: string, data: string) => Promise<void>;
28
23
  /**
29
24
  * Validates a snap.manifest.json file. Attempts to fix the manifest and write
30
25
  * the fixed version to disk if `writeManifest` is true. Throws if validation
31
26
  * fails.
32
27
  *
33
28
  * @param basePath - The path to the folder with the manifest files.
34
- * @param writeManifest - Whether to write the fixed manifest to disk.
35
- * @param sourceCode - The source code of the Snap.
36
- * @param writeFileFn - The function to use to write the manifest to disk.
29
+ * @param options - Additional options for the function.
30
+ * @param options.sourceCode - The source code of the Snap.
31
+ * @param options.writeFileFn - The function to use to write the manifest to disk.
32
+ * @param options.updateAndWriteManifest - Whether to auto-magically try to fix errors and then write the manifest to disk.
37
33
  * @returns Whether the manifest was updated, and an array of warnings that
38
34
  * were encountered during processing of the manifest files.
39
35
  */
40
- export declare function checkManifest(basePath: string, writeManifest?: boolean, sourceCode?: string, writeFileFn?: WriteFileFunction): Promise<CheckManifestResult>;
36
+ export declare function checkManifest(basePath: string, { updateAndWriteManifest, sourceCode, writeFileFn, }?: {
37
+ updateAndWriteManifest?: boolean;
38
+ sourceCode?: string;
39
+ writeFileFn?: WriteFileFunction;
40
+ }): Promise<CheckManifestResult>;
41
41
  /**
42
- * Given the relevant Snap files (manifest, `package.json`, and bundle) and a
43
- * Snap manifest validation error, fixes the fault in the manifest that caused
44
- * the error.
42
+ * Run the algorithm for automatically fixing errors in manifest.
43
+ *
44
+ * The algorithm updates the manifest by fixing all fixable problems,
45
+ * and then run validation again to check if the new manifest is now correct.
46
+ * If not correct, the algorithm will use the manifest from previous iteration
47
+ * and try again `MAX_ATTEMPTS` times to update it before bailing and
48
+ * resulting in failure.
45
49
  *
46
- * @param snapFiles - The contents of all Snap files.
47
- * @param error - The {@link ProgrammaticallyFixableSnapError} that was thrown.
48
- * @returns A copy of the manifest file where the cause of the error is fixed.
50
+ * @param results - Results of the initial run of validation.
51
+ * @param rules - Optional list of rules to run the fixes with.
49
52
  */
50
- export declare function fixManifest(snapFiles: SnapFiles, error: ProgrammaticallyFixableSnapError): Promise<VirtualFile<SnapManifest>>;
53
+ export declare function runFixes(results: ValidatorResults, rules?: ValidatorMeta[]): Promise<CheckManifestResult>;
51
54
  /**
52
55
  * Given an unvalidated Snap manifest, attempts to extract the location of the
53
56
  * bundle source file location and read the file.
@@ -93,16 +96,3 @@ export declare function getSnapFiles(basePath: string, paths: string[] | undefin
93
96
  * @returns The disk-ready manifest.
94
97
  */
95
98
  export declare function getWritableManifest(manifest: SnapManifest): SnapManifest;
96
- /**
97
- * Validates the fields of an NPM Snap manifest that has already passed JSON
98
- * Schema validation.
99
- *
100
- * @param snapFiles - The relevant snap files to validate.
101
- * @param snapFiles.manifest - The npm Snap manifest to validate.
102
- * @param snapFiles.packageJson - The npm Snap's `package.json`.
103
- * @param snapFiles.sourceCode - The Snap's source code.
104
- * @param snapFiles.svgIcon - The Snap's optional icon.
105
- * @param snapFiles.auxiliaryFiles - Any auxiliary files required by the snap at runtime.
106
- * @param snapFiles.localizationFiles - The Snap's localization files.
107
- */
108
- export declare function validateNpmSnapManifest({ manifest, packageJson, sourceCode, svgIcon, auxiliaryFiles, localizationFiles, }: SnapFiles): Promise<void>;
@@ -16,7 +16,7 @@ export declare const Bip32EntropyStruct: Struct<{
16
16
  path: Struct<string[], Struct<string, null>>;
17
17
  curve: Describe<"ed25519" | "ed25519Bip32" | "secp256k1">;
18
18
  }>;
19
- export declare type Bip32Entropy = Infer<typeof Bip32EntropyStruct>;
19
+ export type Bip32Entropy = Infer<typeof Bip32EntropyStruct>;
20
20
  export declare const SnapGetBip32EntropyPermissionsStruct: Struct<{
21
21
  path: string[];
22
22
  curve: "ed25519" | "ed25519Bip32" | "secp256k1";
@@ -31,7 +31,7 @@ export declare const SemVerRangeStruct: Struct<string, null>;
31
31
  export declare const SnapIdsStruct: Struct<Record<string, {
32
32
  version?: string | undefined;
33
33
  }>, null>;
34
- export declare type SnapIds = Infer<typeof SnapIdsStruct>;
34
+ export type SnapIds = Infer<typeof SnapIdsStruct>;
35
35
  export declare const ChainIdsStruct: Struct<`${string}:${string}`[], Struct<`${string}:${string}`, null>>;
36
36
  export declare const LookupMatchersStruct: Struct<{
37
37
  tlds: string[];
@@ -49,13 +49,13 @@ export declare const HandlerCaveatsStruct: Struct<{
49
49
  }, {
50
50
  maxRequestTime: Struct<number | undefined, null>;
51
51
  }>;
52
- export declare type HandlerCaveats = Infer<typeof HandlerCaveatsStruct>;
52
+ export type HandlerCaveats = Infer<typeof HandlerCaveatsStruct>;
53
53
  export declare const EmptyObjectStruct: Struct<EmptyObject, null>;
54
54
  export declare const PermissionsStruct: Describe<InitialPermissions>;
55
- export declare type SnapPermissions = InferMatching<typeof PermissionsStruct, InitialPermissions>;
55
+ export type SnapPermissions = InferMatching<typeof PermissionsStruct, InitialPermissions>;
56
56
  export declare const SnapAuxilaryFilesStruct: Struct<string[], Struct<string, null>>;
57
57
  export declare const InitialConnectionsStruct: Struct<Record<string & URL, {}>, null>;
58
- export declare type InitialConnections = Infer<typeof InitialConnectionsStruct>;
58
+ export type InitialConnections = Infer<typeof InitialConnectionsStruct>;
59
59
  export declare const SnapManifestStruct: Struct<{
60
60
  description: string;
61
61
  version: import("@metamask/utils").SemVerVersion;
@@ -228,7 +228,7 @@ export declare const SnapManifestStruct: Struct<{
228
228
  manifestVersion: Struct<"0.1", "0.1">;
229
229
  $schema: Struct<string | undefined, null>;
230
230
  }>;
231
- export declare type SnapManifest = Infer<typeof SnapManifestStruct>;
231
+ export type SnapManifest = Infer<typeof SnapManifestStruct>;
232
232
  /**
233
233
  * Check if the given value is a valid {@link SnapManifest} object.
234
234
  *
@@ -0,0 +1,34 @@
1
+ import type { Promisable } from '../promise';
2
+ import type { SnapFiles, UnvalidatedSnapFiles } from '../types';
3
+ import type { SnapManifest } from './validation';
4
+ export type ValidatorFix = (files: {
5
+ manifest: SnapManifest;
6
+ }) => Promisable<{
7
+ manifest: SnapManifest;
8
+ }>;
9
+ export type ValidatorSeverity = 'error' | 'warning';
10
+ export type ValidatorContext = {
11
+ report: (message: string, fix?: ValidatorFix) => void;
12
+ };
13
+ export type ValidatorReport = {
14
+ severity: ValidatorSeverity;
15
+ message: string;
16
+ fix?: ValidatorFix;
17
+ };
18
+ export type ValidatorMeta = {
19
+ severity: ValidatorSeverity;
20
+ /**
21
+ * 1. Run the validator on unverified files to ensure that the files are structurally sound.
22
+ *
23
+ * @param files - Files to be verified
24
+ * @param context - Validator context to report errors
25
+ */
26
+ structureCheck?: (files: UnvalidatedSnapFiles, context: ValidatorContext) => void | Promise<void>;
27
+ /**
28
+ * 2. Run the validator after the files were checked to be structurally sound.
29
+ *
30
+ * @param files - Files to be verified
31
+ * @param context - Validator context to report errors
32
+ */
33
+ semanticCheck?: (files: SnapFiles, context: ValidatorContext) => void | Promise<void>;
34
+ };
@@ -0,0 +1,22 @@
1
+ import type { SnapFiles, UnvalidatedSnapFiles } from '../types';
2
+ import type { ValidatorMeta, ValidatorReport } from './validator-types';
3
+ export type ValidatorResults = {
4
+ files?: SnapFiles;
5
+ reports: ValidatorReport[];
6
+ };
7
+ /**
8
+ * Verify that snap files are completely valid.
9
+ * First it runs validators on unparsed files to check structure.
10
+ * Secondly it runs validators on parsed files to check semantics.
11
+ *
12
+ * @param files - All files required to run a snap.
13
+ * @param rules - Validators to run.
14
+ */
15
+ export declare function runValidators(files: UnvalidatedSnapFiles, rules?: ValidatorMeta[]): Promise<ValidatorResults>;
16
+ /**
17
+ * Get whether any reports has pending fixes.
18
+ *
19
+ * @param results - Results of the validation run.
20
+ * @returns Whether there are fixes pending.
21
+ */
22
+ export declare function hasFixes(results: ValidatorResults): boolean;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Check if the checksum in manifest matches computed value.
4
+ */
5
+ export declare const checksum: ValidatorMeta;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Check if all the required files are included.
4
+ */
5
+ export declare const expectedFiles: ValidatorMeta;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Suggest including an icon if not found in manifest.
4
+ */
5
+ export declare const iconDeclared: ValidatorMeta;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Verify the icon is square.
4
+ */
5
+ export declare const iconDimensions: ValidatorMeta;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Check if declared icon exists on filesystem.
4
+ */
5
+ export declare const iconMissing: ValidatorMeta;
@@ -0,0 +1,14 @@
1
+ export * from './checksum';
2
+ export * from './expected-files';
3
+ export * from './icon-dimensions';
4
+ export * from './is-localization-file';
5
+ export * from './is-package-json';
6
+ export * from './is-snap-icon';
7
+ export * from './is-snap-manifest';
8
+ export * from './manifest-localization';
9
+ export * from './package-json-recommended-fields';
10
+ export * from './package-name-match';
11
+ export * from './repository-match';
12
+ export * from './version-match';
13
+ export * from './icon-declared';
14
+ export * from './icon-missing';
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Verify the structure of localization files.
4
+ */
5
+ export declare const isLocalizationFile: ValidatorMeta;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Verify the structure of package.json.
4
+ */
5
+ export declare const isPackageJson: ValidatorMeta;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Verify the structure of the snap icon.
4
+ */
5
+ export declare const isSnapIcon: ValidatorMeta;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Verify the structure of snap.manifest.json.
4
+ */
5
+ export declare const isSnapManifest: ValidatorMeta;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Verify whether the localization files localize the manifest correctly.
4
+ */
5
+ export declare const manifestLocalization: ValidatorMeta;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Check if package.json contains recommended fields.
4
+ */
5
+ export declare const packageJsonRecommendedFields: ValidatorMeta;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Check if the package name in manifest matches package.json name.
4
+ */
5
+ export declare const packageNameMatch: ValidatorMeta;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Check if the repository object in manifest is the same as in package.json.
4
+ */
5
+ export declare const repositoryMatch: ValidatorMeta;
@@ -0,0 +1,5 @@
1
+ import type { ValidatorMeta } from '../validator-types';
2
+ /**
3
+ * Check if the version in manifest is the same as in package.json.
4
+ */
5
+ export declare const versionMatch: ValidatorMeta;
@@ -40,11 +40,11 @@ export declare const ChainIdStringStruct: import("@metamask/superstruct").Struct
40
40
  * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.
41
41
  */
42
42
  export declare const ChainIdStruct: import("@metamask/superstruct").Struct<`${string}:${string}`, null>;
43
- export declare type Caip2ChainId = InferMatching<typeof ChainIdStruct, ChainId>;
43
+ export type Caip2ChainId = InferMatching<typeof ChainIdStruct, ChainId>;
44
44
  export declare const AccountIdStruct: import("@metamask/superstruct").Struct<string, null>;
45
45
  export declare const AccountIdArrayStruct: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
46
46
  export declare const AccountAddressStruct: import("@metamask/superstruct").Struct<string, null>;
47
- export declare type AccountAddress = Infer<typeof AccountAddressStruct>;
47
+ export type AccountAddress = Infer<typeof AccountAddressStruct>;
48
48
  /**
49
49
  * A chain descriptor.
50
50
  */
@@ -55,7 +55,7 @@ export declare const ChainStruct: import("@metamask/superstruct").Struct<{
55
55
  id: import("@metamask/superstruct").Struct<`${string}:${string}`, null>;
56
56
  name: import("@metamask/superstruct").Struct<string, null>;
57
57
  }>;
58
- export declare type Chain = Infer<typeof ChainStruct>;
58
+ export type Chain = Infer<typeof ChainStruct>;
59
59
  export declare const NamespaceStruct: import("@metamask/superstruct").Struct<{
60
60
  chains: {
61
61
  name: string;
@@ -86,12 +86,12 @@ export declare const NamespaceStruct: import("@metamask/superstruct").Struct<{
86
86
  */
87
87
  events: import("@metamask/superstruct").Struct<string[] | undefined, import("@metamask/superstruct").Struct<string, null>>;
88
88
  }>;
89
- export declare type Namespace = Infer<typeof NamespaceStruct>;
89
+ export type Namespace = Infer<typeof NamespaceStruct>;
90
90
  /**
91
91
  * A CAIP-2 namespace, i.e., the first part of a chain ID.
92
92
  */
93
93
  export declare const NamespaceIdStruct: import("@metamask/superstruct").Struct<string, null>;
94
- export declare type NamespaceId = Infer<typeof NamespaceIdStruct>;
94
+ export type NamespaceId = Infer<typeof NamespaceIdStruct>;
95
95
  /**
96
96
  * Check if the given value is a CAIP-2 namespace ID.
97
97
  *
@@ -3,6 +3,5 @@ export * from './eval';
3
3
  export * from './fs';
4
4
  export * from './manifest/node';
5
5
  export * from './mock';
6
- export * from './npm';
7
6
  export * from './post-process';
8
7
  export * from './virtual-file/node';
@@ -2,7 +2,7 @@
2
2
  * Source map declaration taken from `@babel/core`. Babel doesn't export the
3
3
  * type for this, so it's copied from the source code instead here.
4
4
  */
5
- export declare type SourceMap = {
5
+ export type SourceMap = {
6
6
  version: number;
7
7
  sources: string[];
8
8
  names: string[];
@@ -23,7 +23,7 @@ export declare type SourceMap = {
23
23
  * points to the original source. If not provided, a new source map will be
24
24
  * generated instead.
25
25
  */
26
- export declare type PostProcessOptions = {
26
+ export type PostProcessOptions = {
27
27
  stripComments?: boolean;
28
28
  sourceMap?: boolean | 'inline';
29
29
  inputSourceMap?: SourceMap;
@@ -36,7 +36,7 @@ export declare type PostProcessOptions = {
36
36
  * option was enabled.
37
37
  * @property warnings - Any warnings that occurred during the post-processing.
38
38
  */
39
- export declare type PostProcessedBundle = {
39
+ export type PostProcessedBundle = {
40
40
  code: string;
41
41
  sourceMap?: SourceMap | null;
42
42
  warnings: PostProcessWarning[];