@metamask/snaps-rpc-methods 11.0.0 → 11.1.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 (705) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/dist/__fixtures__/entropy.cjs +31 -0
  3. package/dist/__fixtures__/entropy.cjs.map +1 -0
  4. package/dist/{types/__fixtures__/entropy.d.ts → __fixtures__/entropy.d.cts} +1 -0
  5. package/dist/__fixtures__/entropy.d.cts.map +1 -0
  6. package/dist/__fixtures__/entropy.d.mts +15 -0
  7. package/dist/__fixtures__/entropy.d.mts.map +1 -0
  8. package/dist/__fixtures__/entropy.mjs +28 -0
  9. package/dist/__fixtures__/entropy.mjs.map +1 -0
  10. package/dist/__fixtures__/index.cjs +18 -0
  11. package/dist/__fixtures__/index.cjs.map +1 -0
  12. package/dist/__fixtures__/index.d.cts +2 -0
  13. package/dist/__fixtures__/index.d.cts.map +1 -0
  14. package/dist/__fixtures__/index.d.mts +2 -0
  15. package/dist/__fixtures__/index.d.mts.map +1 -0
  16. package/dist/__fixtures__/index.mjs +2 -0
  17. package/dist/__fixtures__/index.mjs.map +1 -0
  18. package/dist/endowments/caveats/generic.cjs +50 -0
  19. package/dist/endowments/caveats/generic.cjs.map +1 -0
  20. package/dist/{types/endowments/caveats/generic.d.ts → endowments/caveats/generic.d.cts} +3 -2
  21. package/dist/endowments/caveats/generic.d.cts.map +1 -0
  22. package/dist/endowments/caveats/generic.d.mts +20 -0
  23. package/dist/endowments/caveats/generic.d.mts.map +1 -0
  24. package/dist/endowments/caveats/generic.mjs +45 -6
  25. package/dist/endowments/caveats/generic.mjs.map +1 -1
  26. package/dist/endowments/caveats/index.cjs +19 -0
  27. package/dist/endowments/caveats/index.cjs.map +1 -0
  28. package/dist/endowments/caveats/index.d.cts +3 -0
  29. package/dist/endowments/caveats/index.d.cts.map +1 -0
  30. package/dist/endowments/caveats/index.d.mts +3 -0
  31. package/dist/endowments/caveats/index.d.mts.map +1 -0
  32. package/dist/endowments/caveats/index.mjs +2 -17
  33. package/dist/endowments/caveats/index.mjs.map +1 -1
  34. package/dist/endowments/caveats/requestTime.cjs +104 -0
  35. package/dist/{chunk-FCVWU5XH.js.map → endowments/caveats/requestTime.cjs.map} +1 -1
  36. package/dist/{types/endowments/caveats/requestTime.d.ts → endowments/caveats/requestTime.d.cts} +5 -4
  37. package/dist/endowments/caveats/requestTime.d.cts.map +1 -0
  38. package/dist/endowments/caveats/requestTime.d.mts +30 -0
  39. package/dist/endowments/caveats/requestTime.d.mts.map +1 -0
  40. package/dist/endowments/caveats/requestTime.mjs +96 -11
  41. package/dist/endowments/caveats/requestTime.mjs.map +1 -1
  42. package/dist/endowments/cronjob.cjs +105 -0
  43. package/dist/endowments/cronjob.cjs.map +1 -0
  44. package/dist/{types/endowments/cronjob.d.ts → endowments/cronjob.d.cts} +7 -6
  45. package/dist/endowments/cronjob.d.cts.map +1 -0
  46. package/dist/endowments/cronjob.d.mts +52 -0
  47. package/dist/endowments/cronjob.d.mts.map +1 -0
  48. package/dist/endowments/cronjob.mjs +97 -14
  49. package/dist/endowments/cronjob.mjs.map +1 -1
  50. package/dist/endowments/enum.cjs +18 -0
  51. package/dist/endowments/enum.cjs.map +1 -0
  52. package/dist/{types/endowments/enum.d.ts → endowments/enum.d.cts} +1 -0
  53. package/dist/endowments/enum.d.cts.map +1 -0
  54. package/dist/endowments/enum.d.mts +14 -0
  55. package/dist/endowments/enum.d.mts.map +1 -0
  56. package/dist/endowments/enum.mjs +14 -6
  57. package/dist/endowments/enum.mjs.map +1 -1
  58. package/dist/endowments/ethereum-provider.cjs +32 -0
  59. package/dist/endowments/ethereum-provider.cjs.map +1 -0
  60. package/dist/{types/endowments/ethereum-provider.d.ts → endowments/ethereum-provider.d.cts} +4 -3
  61. package/dist/endowments/ethereum-provider.d.cts.map +1 -0
  62. package/dist/endowments/ethereum-provider.d.mts +15 -0
  63. package/dist/endowments/ethereum-provider.d.mts.map +1 -0
  64. package/dist/endowments/ethereum-provider.mjs +27 -6
  65. package/dist/endowments/ethereum-provider.mjs.map +1 -1
  66. package/dist/endowments/home-page.cjs +28 -0
  67. package/dist/{chunk-2SFH57UV.js.map → endowments/home-page.cjs.map} +1 -1
  68. package/dist/{types/endowments/home-page.d.ts → endowments/home-page.d.cts} +5 -4
  69. package/dist/endowments/home-page.d.cts.map +1 -0
  70. package/dist/endowments/home-page.d.mts +16 -0
  71. package/dist/endowments/home-page.d.mts.map +1 -0
  72. package/dist/endowments/home-page.mjs +23 -6
  73. package/dist/endowments/home-page.mjs.map +1 -1
  74. package/dist/endowments/index.cjs +92 -0
  75. package/dist/endowments/index.cjs.map +1 -0
  76. package/dist/{types/endowments/index.d.ts → endowments/index.d.cts} +34 -33
  77. package/dist/endowments/index.d.cts.map +1 -0
  78. package/dist/endowments/index.d.mts +132 -0
  79. package/dist/endowments/index.d.mts.map +1 -0
  80. package/dist/endowments/index.mjs +65 -52
  81. package/dist/endowments/index.mjs.map +1 -1
  82. package/dist/endowments/keyring.cjs +96 -0
  83. package/dist/endowments/keyring.cjs.map +1 -0
  84. package/dist/{types/endowments/keyring.d.ts → endowments/keyring.d.cts} +7 -6
  85. package/dist/endowments/keyring.d.cts.map +1 -0
  86. package/dist/endowments/keyring.d.mts +40 -0
  87. package/dist/endowments/keyring.d.mts.map +1 -0
  88. package/dist/endowments/keyring.mjs +89 -15
  89. package/dist/endowments/keyring.mjs.map +1 -1
  90. package/dist/endowments/lifecycle-hooks.cjs +28 -0
  91. package/dist/endowments/lifecycle-hooks.cjs.map +1 -0
  92. package/dist/{types/endowments/lifecycle-hooks.d.ts → endowments/lifecycle-hooks.d.cts} +5 -4
  93. package/dist/endowments/lifecycle-hooks.d.cts.map +1 -0
  94. package/dist/endowments/lifecycle-hooks.d.mts +16 -0
  95. package/dist/endowments/lifecycle-hooks.d.mts.map +1 -0
  96. package/dist/endowments/lifecycle-hooks.mjs +23 -6
  97. package/dist/endowments/lifecycle-hooks.mjs.map +1 -1
  98. package/dist/endowments/name-lookup.cjs +141 -0
  99. package/dist/endowments/name-lookup.cjs.map +1 -0
  100. package/dist/{types/endowments/name-lookup.d.ts → endowments/name-lookup.d.cts} +6 -5
  101. package/dist/endowments/name-lookup.d.cts.map +1 -0
  102. package/dist/endowments/name-lookup.d.mts +50 -0
  103. package/dist/endowments/name-lookup.d.mts.map +1 -0
  104. package/dist/endowments/name-lookup.mjs +133 -17
  105. package/dist/endowments/name-lookup.mjs.map +1 -1
  106. package/dist/endowments/network-access.cjs +30 -0
  107. package/dist/endowments/network-access.cjs.map +1 -0
  108. package/dist/{types/endowments/network-access.d.ts → endowments/network-access.d.cts} +4 -3
  109. package/dist/endowments/network-access.d.cts.map +1 -0
  110. package/dist/endowments/network-access.d.mts +15 -0
  111. package/dist/endowments/network-access.d.mts.map +1 -0
  112. package/dist/endowments/network-access.mjs +25 -6
  113. package/dist/endowments/network-access.mjs.map +1 -1
  114. package/dist/endowments/rpc.cjs +90 -0
  115. package/dist/endowments/rpc.cjs.map +1 -0
  116. package/dist/{types/endowments/rpc.d.ts → endowments/rpc.d.cts} +7 -6
  117. package/dist/endowments/rpc.d.cts.map +1 -0
  118. package/dist/endowments/rpc.d.mts +39 -0
  119. package/dist/endowments/rpc.d.mts.map +1 -0
  120. package/dist/endowments/rpc.mjs +83 -15
  121. package/dist/endowments/rpc.mjs.map +1 -1
  122. package/dist/endowments/signature-insight.cjs +102 -0
  123. package/dist/endowments/signature-insight.cjs.map +1 -0
  124. package/dist/{types/endowments/signature-insight.d.ts → endowments/signature-insight.d.cts} +6 -5
  125. package/dist/endowments/signature-insight.d.cts.map +1 -0
  126. package/dist/endowments/signature-insight.d.mts +40 -0
  127. package/dist/endowments/signature-insight.d.mts.map +1 -0
  128. package/dist/endowments/signature-insight.mjs +95 -15
  129. package/dist/endowments/signature-insight.mjs.map +1 -1
  130. package/dist/endowments/transaction-insight.cjs +105 -0
  131. package/dist/endowments/transaction-insight.cjs.map +1 -0
  132. package/dist/{types/endowments/transaction-insight.d.ts → endowments/transaction-insight.d.cts} +6 -5
  133. package/dist/endowments/transaction-insight.d.cts.map +1 -0
  134. package/dist/endowments/transaction-insight.d.mts +40 -0
  135. package/dist/endowments/transaction-insight.d.mts.map +1 -0
  136. package/dist/endowments/transaction-insight.mjs +98 -15
  137. package/dist/endowments/transaction-insight.mjs.map +1 -1
  138. package/dist/endowments/web-assembly.cjs +31 -0
  139. package/dist/endowments/web-assembly.cjs.map +1 -0
  140. package/dist/{types/endowments/web-assembly.d.ts → endowments/web-assembly.d.cts} +4 -3
  141. package/dist/endowments/web-assembly.d.cts.map +1 -0
  142. package/dist/endowments/web-assembly.d.mts +15 -0
  143. package/dist/endowments/web-assembly.d.mts.map +1 -0
  144. package/dist/endowments/web-assembly.mjs +26 -6
  145. package/dist/endowments/web-assembly.mjs.map +1 -1
  146. package/dist/index.cjs +28 -0
  147. package/dist/index.cjs.map +1 -0
  148. package/dist/index.d.cts +8 -0
  149. package/dist/index.d.cts.map +1 -0
  150. package/dist/index.d.mts +8 -0
  151. package/dist/index.d.mts.map +1 -0
  152. package/dist/index.mjs +6 -122
  153. package/dist/index.mjs.map +1 -1
  154. package/dist/permissions.cjs +55 -0
  155. package/dist/permissions.cjs.map +1 -0
  156. package/dist/{types/permissions.d.ts → permissions.d.cts} +3 -2
  157. package/dist/permissions.d.cts.map +1 -0
  158. package/dist/permissions.d.mts +17 -0
  159. package/dist/permissions.d.mts.map +1 -0
  160. package/dist/permissions.mjs +48 -43
  161. package/dist/permissions.mjs.map +1 -1
  162. package/dist/permitted/createInterface.cjs +64 -0
  163. package/dist/permitted/createInterface.cjs.map +1 -0
  164. package/dist/{types/permitted/createInterface.d.ts → permitted/createInterface.d.cts} +62 -49
  165. package/dist/permitted/createInterface.d.cts.map +1 -0
  166. package/dist/permitted/createInterface.d.mts +193 -0
  167. package/dist/permitted/createInterface.d.mts.map +1 -0
  168. package/dist/permitted/createInterface.mjs +59 -5
  169. package/dist/permitted/createInterface.mjs.map +1 -1
  170. package/dist/permitted/getAllSnaps.cjs +39 -0
  171. package/dist/permitted/getAllSnaps.cjs.map +1 -0
  172. package/dist/{types/permitted/getAllSnaps.d.ts → permitted/getAllSnaps.d.cts} +4 -3
  173. package/dist/permitted/getAllSnaps.d.cts.map +1 -0
  174. package/dist/permitted/getAllSnaps.d.mts +15 -0
  175. package/dist/permitted/getAllSnaps.d.mts.map +1 -0
  176. package/dist/permitted/getAllSnaps.mjs +34 -5
  177. package/dist/permitted/getAllSnaps.mjs.map +1 -1
  178. package/dist/permitted/getClientStatus.cjs +32 -0
  179. package/dist/permitted/getClientStatus.cjs.map +1 -0
  180. package/dist/{types/permitted/getClientStatus.d.ts → permitted/getClientStatus.d.cts} +4 -3
  181. package/dist/permitted/getClientStatus.d.cts.map +1 -0
  182. package/dist/permitted/getClientStatus.d.mts +14 -0
  183. package/dist/permitted/getClientStatus.d.mts.map +1 -0
  184. package/dist/permitted/getClientStatus.mjs +27 -5
  185. package/dist/permitted/getClientStatus.mjs.map +1 -1
  186. package/dist/permitted/getFile.cjs +47 -0
  187. package/dist/permitted/getFile.cjs.map +1 -0
  188. package/dist/{types/permitted/getFile.d.ts → permitted/getFile.d.cts} +4 -3
  189. package/dist/permitted/getFile.d.cts.map +1 -0
  190. package/dist/permitted/getFile.d.mts +16 -0
  191. package/dist/permitted/getFile.d.mts.map +1 -0
  192. package/dist/permitted/getFile.mjs +42 -7
  193. package/dist/permitted/getFile.mjs.map +1 -1
  194. package/dist/permitted/getInterfaceState.cjs +62 -0
  195. package/dist/permitted/getInterfaceState.cjs.map +1 -0
  196. package/dist/{types/permitted/getInterfaceState.d.ts → permitted/getInterfaceState.d.cts} +4 -3
  197. package/dist/permitted/getInterfaceState.d.cts.map +1 -0
  198. package/dist/permitted/getInterfaceState.d.mts +19 -0
  199. package/dist/permitted/getInterfaceState.d.mts.map +1 -0
  200. package/dist/permitted/getInterfaceState.mjs +57 -5
  201. package/dist/permitted/getInterfaceState.mjs.map +1 -1
  202. package/dist/permitted/getSnaps.cjs +33 -0
  203. package/dist/permitted/getSnaps.cjs.map +1 -0
  204. package/dist/{types/permitted/getSnaps.d.ts → permitted/getSnaps.d.cts} +4 -3
  205. package/dist/permitted/getSnaps.d.cts.map +1 -0
  206. package/dist/permitted/getSnaps.d.mts +14 -0
  207. package/dist/permitted/getSnaps.d.mts.map +1 -0
  208. package/dist/permitted/getSnaps.mjs +28 -5
  209. package/dist/permitted/getSnaps.mjs.map +1 -1
  210. package/dist/permitted/handlers.cjs +31 -0
  211. package/dist/permitted/handlers.cjs.map +1 -0
  212. package/dist/permitted/handlers.d.cts +35 -0
  213. package/dist/permitted/handlers.d.cts.map +1 -0
  214. package/dist/permitted/handlers.d.mts +35 -0
  215. package/dist/permitted/handlers.d.mts.map +1 -0
  216. package/dist/permitted/handlers.mjs +26 -19
  217. package/dist/permitted/handlers.mjs.map +1 -1
  218. package/dist/permitted/index.cjs +19 -0
  219. package/dist/permitted/index.cjs.map +1 -0
  220. package/dist/permitted/index.d.cts +12 -0
  221. package/dist/permitted/index.d.cts.map +1 -0
  222. package/dist/permitted/index.d.mts +12 -0
  223. package/dist/permitted/index.d.mts.map +1 -0
  224. package/dist/permitted/index.mjs +2 -26
  225. package/dist/permitted/index.mjs.map +1 -1
  226. package/dist/permitted/invokeKeyring.cjs +83 -0
  227. package/dist/permitted/invokeKeyring.cjs.map +1 -0
  228. package/dist/{types/permitted/invokeKeyring.d.ts → permitted/invokeKeyring.d.cts} +4 -3
  229. package/dist/permitted/invokeKeyring.d.cts.map +1 -0
  230. package/dist/permitted/invokeKeyring.d.mts +16 -0
  231. package/dist/permitted/invokeKeyring.d.mts.map +1 -0
  232. package/dist/permitted/invokeKeyring.mjs +78 -6
  233. package/dist/permitted/invokeKeyring.mjs.map +1 -1
  234. package/dist/permitted/invokeSnapSugar.cjs +68 -0
  235. package/dist/permitted/invokeSnapSugar.cjs.map +1 -0
  236. package/dist/{types/permitted/invokeSnapSugar.d.ts → permitted/invokeSnapSugar.d.cts} +5 -4
  237. package/dist/permitted/invokeSnapSugar.d.cts.map +1 -0
  238. package/dist/permitted/invokeSnapSugar.d.mts +35 -0
  239. package/dist/permitted/invokeSnapSugar.d.mts.map +1 -0
  240. package/dist/permitted/invokeSnapSugar.mjs +61 -9
  241. package/dist/permitted/invokeSnapSugar.mjs.map +1 -1
  242. package/dist/permitted/middleware.cjs +40 -0
  243. package/dist/permitted/middleware.cjs.map +1 -0
  244. package/dist/{types/permitted/middleware.d.ts → permitted/middleware.d.cts} +3 -2
  245. package/dist/permitted/middleware.d.cts.map +1 -0
  246. package/dist/permitted/middleware.d.mts +11 -0
  247. package/dist/permitted/middleware.d.mts.map +1 -0
  248. package/dist/permitted/middleware.mjs +35 -20
  249. package/dist/permitted/middleware.mjs.map +1 -1
  250. package/dist/permitted/requestSnaps.cjs +121 -0
  251. package/dist/permitted/requestSnaps.cjs.map +1 -0
  252. package/dist/{types/permitted/requestSnaps.d.ts → permitted/requestSnaps.d.cts} +4 -3
  253. package/dist/permitted/requestSnaps.d.cts.map +1 -0
  254. package/dist/permitted/requestSnaps.d.mts +51 -0
  255. package/dist/permitted/requestSnaps.d.mts.map +1 -0
  256. package/dist/permitted/requestSnaps.mjs +114 -10
  257. package/dist/permitted/requestSnaps.mjs.map +1 -1
  258. package/dist/permitted/resolveInterface.cjs +65 -0
  259. package/dist/permitted/resolveInterface.cjs.map +1 -0
  260. package/dist/{types/permitted/resolveInterface.d.ts → permitted/resolveInterface.d.cts} +6 -5
  261. package/dist/permitted/resolveInterface.d.cts.map +1 -0
  262. package/dist/permitted/resolveInterface.d.mts +22 -0
  263. package/dist/permitted/resolveInterface.d.mts.map +1 -0
  264. package/dist/permitted/resolveInterface.mjs +60 -5
  265. package/dist/permitted/resolveInterface.mjs.map +1 -1
  266. package/dist/permitted/updateInterface.cjs +65 -0
  267. package/dist/permitted/updateInterface.cjs.map +1 -0
  268. package/dist/{types/permitted/updateInterface.d.ts → permitted/updateInterface.d.cts} +48 -47
  269. package/dist/permitted/updateInterface.d.cts.map +1 -0
  270. package/dist/permitted/updateInterface.d.mts +181 -0
  271. package/dist/permitted/updateInterface.d.mts.map +1 -0
  272. package/dist/permitted/updateInterface.mjs +60 -5
  273. package/dist/permitted/updateInterface.mjs.map +1 -1
  274. package/dist/restricted/caveats/index.cjs +22 -0
  275. package/dist/restricted/caveats/index.cjs.map +1 -0
  276. package/dist/{types/restricted/caveats/index.d.ts → restricted/caveats/index.d.cts} +3 -2
  277. package/dist/restricted/caveats/index.d.cts.map +1 -0
  278. package/dist/restricted/caveats/index.d.mts +9 -0
  279. package/dist/restricted/caveats/index.d.mts.map +1 -0
  280. package/dist/restricted/caveats/index.mjs +17 -15
  281. package/dist/restricted/caveats/index.mjs.map +1 -1
  282. package/dist/restricted/caveats/permittedCoinTypes.cjs +90 -0
  283. package/dist/restricted/caveats/permittedCoinTypes.cjs.map +1 -0
  284. package/dist/{types/restricted/caveats/permittedCoinTypes.d.ts → restricted/caveats/permittedCoinTypes.d.cts} +5 -4
  285. package/dist/restricted/caveats/permittedCoinTypes.d.cts.map +1 -0
  286. package/dist/restricted/caveats/permittedCoinTypes.d.mts +30 -0
  287. package/dist/restricted/caveats/permittedCoinTypes.d.mts.map +1 -0
  288. package/dist/restricted/caveats/permittedCoinTypes.mjs +82 -11
  289. package/dist/restricted/caveats/permittedCoinTypes.mjs.map +1 -1
  290. package/dist/restricted/caveats/permittedDerivationPaths.cjs +70 -0
  291. package/dist/restricted/caveats/permittedDerivationPaths.cjs.map +1 -0
  292. package/dist/{types/restricted/caveats/permittedDerivationPaths.d.ts → restricted/caveats/permittedDerivationPaths.d.cts} +5 -4
  293. package/dist/restricted/caveats/permittedDerivationPaths.d.cts.map +1 -0
  294. package/dist/restricted/caveats/permittedDerivationPaths.d.mts +33 -0
  295. package/dist/restricted/caveats/permittedDerivationPaths.d.mts.map +1 -0
  296. package/dist/restricted/caveats/permittedDerivationPaths.mjs +62 -11
  297. package/dist/restricted/caveats/permittedDerivationPaths.mjs.map +1 -1
  298. package/dist/restricted/caveats/snapIds.cjs +56 -0
  299. package/dist/restricted/caveats/snapIds.cjs.map +1 -0
  300. package/dist/{types/restricted/caveats/snapIds.d.ts → restricted/caveats/snapIds.d.cts} +5 -4
  301. package/dist/restricted/caveats/snapIds.d.cts.map +1 -0
  302. package/dist/restricted/caveats/snapIds.d.mts +22 -0
  303. package/dist/restricted/caveats/snapIds.d.mts.map +1 -0
  304. package/dist/restricted/caveats/snapIds.mjs +49 -9
  305. package/dist/restricted/caveats/snapIds.mjs.map +1 -1
  306. package/dist/restricted/dialog.cjs +222 -0
  307. package/dist/restricted/dialog.cjs.map +1 -0
  308. package/dist/restricted/dialog.d.cts +488 -0
  309. package/dist/restricted/dialog.d.cts.map +1 -0
  310. package/dist/restricted/dialog.d.mts +488 -0
  311. package/dist/restricted/dialog.d.mts.map +1 -0
  312. package/dist/restricted/dialog.mjs +216 -9
  313. package/dist/restricted/dialog.mjs.map +1 -1
  314. package/dist/restricted/getBip32Entropy.cjs +69 -0
  315. package/dist/restricted/getBip32Entropy.cjs.map +1 -0
  316. package/dist/{types/restricted/getBip32Entropy.d.ts → restricted/getBip32Entropy.d.cts} +6 -5
  317. package/dist/restricted/getBip32Entropy.d.cts.map +1 -0
  318. package/dist/restricted/getBip32Entropy.d.mts +45 -0
  319. package/dist/restricted/getBip32Entropy.d.mts.map +1 -0
  320. package/dist/restricted/getBip32Entropy.mjs +63 -8
  321. package/dist/restricted/getBip32Entropy.mjs.map +1 -1
  322. package/dist/restricted/getBip32PublicKey.cjs +78 -0
  323. package/dist/restricted/getBip32PublicKey.cjs.map +1 -0
  324. package/dist/{types/restricted/getBip32PublicKey.d.ts → restricted/getBip32PublicKey.d.cts} +7 -6
  325. package/dist/restricted/getBip32PublicKey.d.cts.map +1 -0
  326. package/dist/restricted/getBip32PublicKey.d.mts +54 -0
  327. package/dist/restricted/getBip32PublicKey.d.mts.map +1 -0
  328. package/dist/restricted/getBip32PublicKey.mjs +72 -10
  329. package/dist/restricted/getBip32PublicKey.mjs.map +1 -1
  330. package/dist/restricted/getBip44Entropy.cjs +71 -0
  331. package/dist/restricted/getBip44Entropy.cjs.map +1 -0
  332. package/dist/{types/restricted/getBip44Entropy.d.ts → restricted/getBip44Entropy.d.cts} +6 -5
  333. package/dist/restricted/getBip44Entropy.d.cts.map +1 -0
  334. package/dist/restricted/getBip44Entropy.d.mts +47 -0
  335. package/dist/restricted/getBip44Entropy.d.mts.map +1 -0
  336. package/dist/restricted/getBip44Entropy.mjs +65 -7
  337. package/dist/restricted/getBip44Entropy.mjs.map +1 -1
  338. package/dist/restricted/getEntropy.cjs +59 -0
  339. package/dist/restricted/getEntropy.cjs.map +1 -0
  340. package/dist/{types/restricted/getEntropy.d.ts → restricted/getEntropy.d.cts} +7 -6
  341. package/dist/restricted/getEntropy.d.cts.map +1 -0
  342. package/dist/restricted/getEntropy.d.mts +62 -0
  343. package/dist/restricted/getEntropy.d.mts.map +1 -0
  344. package/dist/restricted/getEntropy.mjs +54 -8
  345. package/dist/restricted/getEntropy.mjs.map +1 -1
  346. package/dist/restricted/getLocale.cjs +47 -0
  347. package/dist/restricted/getLocale.cjs.map +1 -0
  348. package/dist/{types/restricted/getLocale.d.ts → restricted/getLocale.d.cts} +6 -5
  349. package/dist/restricted/getLocale.d.cts.map +1 -0
  350. package/dist/restricted/getLocale.d.mts +50 -0
  351. package/dist/restricted/getLocale.d.mts.map +1 -0
  352. package/dist/restricted/getLocale.mjs +40 -9
  353. package/dist/restricted/getLocale.mjs.map +1 -1
  354. package/dist/restricted/getPreferences.cjs +46 -0
  355. package/dist/restricted/getPreferences.cjs.map +1 -0
  356. package/dist/{types/restricted/getPreferences.d.ts → restricted/getPreferences.d.cts} +6 -5
  357. package/dist/restricted/getPreferences.d.cts.map +1 -0
  358. package/dist/restricted/getPreferences.d.mts +49 -0
  359. package/dist/restricted/getPreferences.d.mts.map +1 -0
  360. package/dist/restricted/getPreferences.mjs +39 -9
  361. package/dist/restricted/getPreferences.mjs.map +1 -1
  362. package/dist/restricted/index.cjs +49 -0
  363. package/dist/restricted/index.cjs.map +1 -0
  364. package/dist/{types/restricted/index.d.ts → restricted/index.d.cts} +29 -28
  365. package/dist/restricted/index.d.cts.map +1 -0
  366. package/dist/restricted/index.d.mts +169 -0
  367. package/dist/restricted/index.d.mts.map +1 -0
  368. package/dist/restricted/index.mjs +27 -35
  369. package/dist/restricted/index.mjs.map +1 -1
  370. package/dist/restricted/invokeSnap.cjs +96 -0
  371. package/dist/restricted/invokeSnap.cjs.map +1 -0
  372. package/dist/{types/restricted/invokeSnap.d.ts → restricted/invokeSnap.d.cts} +8 -6
  373. package/dist/restricted/invokeSnap.d.cts.map +1 -0
  374. package/dist/restricted/invokeSnap.d.mts +65 -0
  375. package/dist/restricted/invokeSnap.d.mts.map +1 -0
  376. package/dist/restricted/invokeSnap.mjs +89 -11
  377. package/dist/restricted/invokeSnap.mjs.map +1 -1
  378. package/dist/restricted/manageAccounts.cjs +61 -0
  379. package/dist/restricted/manageAccounts.cjs.map +1 -0
  380. package/dist/{types/restricted/manageAccounts.d.ts → restricted/manageAccounts.d.cts} +6 -5
  381. package/dist/restricted/manageAccounts.d.cts.map +1 -0
  382. package/dist/restricted/manageAccounts.d.mts +65 -0
  383. package/dist/restricted/manageAccounts.d.mts.map +1 -0
  384. package/dist/restricted/manageAccounts.mjs +54 -11
  385. package/dist/restricted/manageAccounts.mjs.map +1 -1
  386. package/dist/restricted/manageState.cjs +175 -0
  387. package/dist/restricted/manageState.cjs.map +1 -0
  388. package/dist/{types/restricted/manageState.d.ts → restricted/manageState.d.cts} +6 -5
  389. package/dist/restricted/manageState.d.cts.map +1 -0
  390. package/dist/restricted/manageState.d.mts +111 -0
  391. package/dist/restricted/manageState.d.mts.map +1 -0
  392. package/dist/restricted/manageState.mjs +166 -18
  393. package/dist/restricted/manageState.mjs.map +1 -1
  394. package/dist/restricted/notify.cjs +108 -0
  395. package/dist/restricted/notify.cjs.map +1 -0
  396. package/dist/{types/restricted/notify.d.ts → restricted/notify.d.cts} +7 -6
  397. package/dist/restricted/notify.d.cts.map +1 -0
  398. package/dist/restricted/notify.d.mts +83 -0
  399. package/dist/restricted/notify.d.mts.map +1 -0
  400. package/dist/restricted/notify.mjs +100 -11
  401. package/dist/restricted/notify.mjs.map +1 -1
  402. package/dist/utils.cjs +140 -0
  403. package/dist/utils.cjs.map +1 -0
  404. package/dist/{types/utils.d.ts → utils.d.cts} +6 -4
  405. package/dist/utils.d.cts.map +1 -0
  406. package/dist/utils.d.mts +98 -0
  407. package/dist/utils.d.mts.map +1 -0
  408. package/dist/utils.mjs +132 -12
  409. package/dist/utils.mjs.map +1 -1
  410. package/package.json +20 -19
  411. package/dist/chunk-23XDKQW2.mjs +0 -73
  412. package/dist/chunk-23XDKQW2.mjs.map +0 -1
  413. package/dist/chunk-2CTOCP34.mjs +0 -45
  414. package/dist/chunk-2CTOCP34.mjs.map +0 -1
  415. package/dist/chunk-2L2ATCIK.mjs +0 -78
  416. package/dist/chunk-2L2ATCIK.mjs.map +0 -1
  417. package/dist/chunk-2RDYC42U.mjs +0 -67
  418. package/dist/chunk-2RDYC42U.mjs.map +0 -1
  419. package/dist/chunk-2SFH57UV.js +0 -21
  420. package/dist/chunk-33LLA2MH.mjs +0 -75
  421. package/dist/chunk-33LLA2MH.mjs.map +0 -1
  422. package/dist/chunk-33MTKZ4H.js +0 -90
  423. package/dist/chunk-33MTKZ4H.js.map +0 -1
  424. package/dist/chunk-3UAWEHMF.js +0 -18
  425. package/dist/chunk-3UAWEHMF.js.map +0 -1
  426. package/dist/chunk-3WCLDJAS.mjs +0 -74
  427. package/dist/chunk-3WCLDJAS.mjs.map +0 -1
  428. package/dist/chunk-3WKIKYUH.js +0 -78
  429. package/dist/chunk-3WKIKYUH.js.map +0 -1
  430. package/dist/chunk-4D2B2UQ6.mjs +0 -23
  431. package/dist/chunk-4D2B2UQ6.mjs.map +0 -1
  432. package/dist/chunk-4LSOS7SM.js +0 -23
  433. package/dist/chunk-4LSOS7SM.js.map +0 -1
  434. package/dist/chunk-4PWFZPJC.js +0 -79
  435. package/dist/chunk-4PWFZPJC.js.map +0 -1
  436. package/dist/chunk-57BL7O2P.mjs +0 -69
  437. package/dist/chunk-57BL7O2P.mjs.map +0 -1
  438. package/dist/chunk-62URQ5VS.mjs +0 -18
  439. package/dist/chunk-62URQ5VS.mjs.map +0 -1
  440. package/dist/chunk-6XKVFSC2.js +0 -32
  441. package/dist/chunk-6XKVFSC2.js.map +0 -1
  442. package/dist/chunk-756OQVOC.js +0 -67
  443. package/dist/chunk-756OQVOC.js.map +0 -1
  444. package/dist/chunk-7CV677MM.js +0 -42
  445. package/dist/chunk-7CV677MM.js.map +0 -1
  446. package/dist/chunk-7HVABE5R.js +0 -74
  447. package/dist/chunk-7HVABE5R.js.map +0 -1
  448. package/dist/chunk-7P6TF6CE.mjs +0 -55
  449. package/dist/chunk-7P6TF6CE.mjs.map +0 -1
  450. package/dist/chunk-7TVJV425.js +0 -1
  451. package/dist/chunk-7TVJV425.js.map +0 -1
  452. package/dist/chunk-A6H6I4VH.js +0 -61
  453. package/dist/chunk-A6H6I4VH.js.map +0 -1
  454. package/dist/chunk-AMMJ744B.mjs +0 -32
  455. package/dist/chunk-AMMJ744B.mjs.map +0 -1
  456. package/dist/chunk-ATBKAX2S.js +0 -39
  457. package/dist/chunk-ATBKAX2S.js.map +0 -1
  458. package/dist/chunk-B3NIHNXW.js +0 -23
  459. package/dist/chunk-B3NIHNXW.js.map +0 -1
  460. package/dist/chunk-CD4OUHO5.mjs +0 -20
  461. package/dist/chunk-CD4OUHO5.mjs.map +0 -1
  462. package/dist/chunk-CDAVFOUS.js +0 -53
  463. package/dist/chunk-CDAVFOUS.js.map +0 -1
  464. package/dist/chunk-CH5O2YCX.mjs +0 -18
  465. package/dist/chunk-CH5O2YCX.mjs.map +0 -1
  466. package/dist/chunk-DLVPMPRZ.js +0 -45
  467. package/dist/chunk-DLVPMPRZ.js.map +0 -1
  468. package/dist/chunk-DTZF746A.mjs +0 -21
  469. package/dist/chunk-DTZF746A.mjs.map +0 -1
  470. package/dist/chunk-E27BGHCR.js +0 -78
  471. package/dist/chunk-E27BGHCR.js.map +0 -1
  472. package/dist/chunk-ELCOEVKA.js +0 -196
  473. package/dist/chunk-ELCOEVKA.js.map +0 -1
  474. package/dist/chunk-EOXTZF5U.js +0 -47
  475. package/dist/chunk-EOXTZF5U.js.map +0 -1
  476. package/dist/chunk-FCVWU5XH.js +0 -73
  477. package/dist/chunk-FFHVA6PP.js +0 -82
  478. package/dist/chunk-FFHVA6PP.js.map +0 -1
  479. package/dist/chunk-FJ7COFRJ.mjs +0 -54
  480. package/dist/chunk-FJ7COFRJ.mjs.map +0 -1
  481. package/dist/chunk-FM4LNQR7.mjs +0 -34
  482. package/dist/chunk-FM4LNQR7.mjs.map +0 -1
  483. package/dist/chunk-GE5XFDUE.js +0 -21
  484. package/dist/chunk-GE5XFDUE.js.map +0 -1
  485. package/dist/chunk-GEJDXRTL.mjs +0 -59
  486. package/dist/chunk-GEJDXRTL.mjs.map +0 -1
  487. package/dist/chunk-GPV4ETUH.mjs +0 -47
  488. package/dist/chunk-GPV4ETUH.mjs.map +0 -1
  489. package/dist/chunk-H6X3CWWQ.js +0 -54
  490. package/dist/chunk-H6X3CWWQ.js.map +0 -1
  491. package/dist/chunk-HOECEYMT.mjs +0 -70
  492. package/dist/chunk-HOECEYMT.mjs.map +0 -1
  493. package/dist/chunk-I2P65KBQ.mjs +0 -67
  494. package/dist/chunk-I2P65KBQ.mjs.map +0 -1
  495. package/dist/chunk-I3G6S6MJ.js +0 -68
  496. package/dist/chunk-I3G6S6MJ.js.map +0 -1
  497. package/dist/chunk-IE6EHYEG.js +0 -57
  498. package/dist/chunk-IE6EHYEG.js.map +0 -1
  499. package/dist/chunk-JWDQUKKU.mjs +0 -80
  500. package/dist/chunk-JWDQUKKU.mjs.map +0 -1
  501. package/dist/chunk-K3UL5RVN.mjs +0 -43
  502. package/dist/chunk-K3UL5RVN.mjs.map +0 -1
  503. package/dist/chunk-KRSIAVUJ.js +0 -115
  504. package/dist/chunk-KRSIAVUJ.js.map +0 -1
  505. package/dist/chunk-KSTF5JYB.mjs +0 -23
  506. package/dist/chunk-KSTF5JYB.mjs.map +0 -1
  507. package/dist/chunk-LP3RWEDJ.js +0 -43
  508. package/dist/chunk-LP3RWEDJ.js.map +0 -1
  509. package/dist/chunk-LR7UR4YU.mjs +0 -52
  510. package/dist/chunk-LR7UR4YU.mjs.map +0 -1
  511. package/dist/chunk-LXJBBRQ4.mjs +0 -57
  512. package/dist/chunk-LXJBBRQ4.mjs.map +0 -1
  513. package/dist/chunk-M2JQCKR7.js +0 -143
  514. package/dist/chunk-M2JQCKR7.js.map +0 -1
  515. package/dist/chunk-MC2Z4NF6.mjs +0 -45
  516. package/dist/chunk-MC2Z4NF6.mjs.map +0 -1
  517. package/dist/chunk-MXPVC2XP.mjs +0 -105
  518. package/dist/chunk-MXPVC2XP.mjs.map +0 -1
  519. package/dist/chunk-NU4NAAFG.js +0 -1
  520. package/dist/chunk-NU4NAAFG.js.map +0 -1
  521. package/dist/chunk-NWT2EXFD.js +0 -18
  522. package/dist/chunk-NWT2EXFD.js.map +0 -1
  523. package/dist/chunk-O66NZFSD.mjs +0 -23
  524. package/dist/chunk-O66NZFSD.mjs.map +0 -1
  525. package/dist/chunk-ODN35VOK.mjs +0 -119
  526. package/dist/chunk-ODN35VOK.mjs.map +0 -1
  527. package/dist/chunk-OI33OL7K.js +0 -47
  528. package/dist/chunk-OI33OL7K.js.map +0 -1
  529. package/dist/chunk-PIAWDTWO.mjs +0 -68
  530. package/dist/chunk-PIAWDTWO.mjs.map +0 -1
  531. package/dist/chunk-PIRQCNBJ.mjs +0 -78
  532. package/dist/chunk-PIRQCNBJ.mjs.map +0 -1
  533. package/dist/chunk-PK2RPAXI.js +0 -59
  534. package/dist/chunk-PK2RPAXI.js.map +0 -1
  535. package/dist/chunk-PS6OEQXL.js +0 -105
  536. package/dist/chunk-PS6OEQXL.js.map +0 -1
  537. package/dist/chunk-PXU6PORA.js +0 -119
  538. package/dist/chunk-PXU6PORA.js.map +0 -1
  539. package/dist/chunk-Q27K2I6Z.js +0 -23
  540. package/dist/chunk-Q27K2I6Z.js.map +0 -1
  541. package/dist/chunk-QDZAWH6F.js +0 -80
  542. package/dist/chunk-QDZAWH6F.js.map +0 -1
  543. package/dist/chunk-QMULJEYN.js +0 -35
  544. package/dist/chunk-QMULJEYN.js.map +0 -1
  545. package/dist/chunk-RHPSYX7X.js +0 -34
  546. package/dist/chunk-RHPSYX7X.js.map +0 -1
  547. package/dist/chunk-T56DKVFS.js +0 -70
  548. package/dist/chunk-T56DKVFS.js.map +0 -1
  549. package/dist/chunk-TAXLFFV4.mjs +0 -115
  550. package/dist/chunk-TAXLFFV4.mjs.map +0 -1
  551. package/dist/chunk-TE4W25CA.mjs +0 -143
  552. package/dist/chunk-TE4W25CA.mjs.map +0 -1
  553. package/dist/chunk-TG63GBK3.mjs +0 -1
  554. package/dist/chunk-TG63GBK3.mjs.map +0 -1
  555. package/dist/chunk-TNENASGX.mjs +0 -1
  556. package/dist/chunk-TNENASGX.mjs.map +0 -1
  557. package/dist/chunk-TQCUJQHY.mjs +0 -196
  558. package/dist/chunk-TQCUJQHY.mjs.map +0 -1
  559. package/dist/chunk-TT4DP2YW.mjs +0 -35
  560. package/dist/chunk-TT4DP2YW.mjs.map +0 -1
  561. package/dist/chunk-TVC3E5LI.mjs +0 -42
  562. package/dist/chunk-TVC3E5LI.mjs.map +0 -1
  563. package/dist/chunk-U6TJQLNV.js +0 -45
  564. package/dist/chunk-U6TJQLNV.js.map +0 -1
  565. package/dist/chunk-UB3733UY.mjs +0 -23
  566. package/dist/chunk-UB3733UY.mjs.map +0 -1
  567. package/dist/chunk-UCWANXBZ.js +0 -45
  568. package/dist/chunk-UCWANXBZ.js.map +0 -1
  569. package/dist/chunk-UF3UJTY3.js +0 -55
  570. package/dist/chunk-UF3UJTY3.js.map +0 -1
  571. package/dist/chunk-UY4DUF53.mjs +0 -45
  572. package/dist/chunk-UY4DUF53.mjs.map +0 -1
  573. package/dist/chunk-V3KRSCUK.mjs +0 -53
  574. package/dist/chunk-V3KRSCUK.mjs.map +0 -1
  575. package/dist/chunk-VUA6ICJO.js +0 -52
  576. package/dist/chunk-VUA6ICJO.js.map +0 -1
  577. package/dist/chunk-VVBTXSID.mjs +0 -82
  578. package/dist/chunk-VVBTXSID.mjs.map +0 -1
  579. package/dist/chunk-VYII7C3J.mjs +0 -79
  580. package/dist/chunk-VYII7C3J.mjs.map +0 -1
  581. package/dist/chunk-W33UWNA2.mjs +0 -90
  582. package/dist/chunk-W33UWNA2.mjs.map +0 -1
  583. package/dist/chunk-XGMYBPQR.mjs +0 -47
  584. package/dist/chunk-XGMYBPQR.mjs.map +0 -1
  585. package/dist/chunk-YGKFOOWI.js +0 -20
  586. package/dist/chunk-YGKFOOWI.js.map +0 -1
  587. package/dist/chunk-YOHE52XB.js +0 -23
  588. package/dist/chunk-YOHE52XB.js.map +0 -1
  589. package/dist/chunk-YT2Q3W5C.js +0 -69
  590. package/dist/chunk-YT2Q3W5C.js.map +0 -1
  591. package/dist/chunk-YZMFLB67.js +0 -75
  592. package/dist/chunk-YZMFLB67.js.map +0 -1
  593. package/dist/chunk-Z6YFGWHN.mjs +0 -61
  594. package/dist/chunk-Z6YFGWHN.mjs.map +0 -1
  595. package/dist/chunk-ZH3FC55E.mjs +0 -21
  596. package/dist/chunk-ZH3FC55E.mjs.map +0 -1
  597. package/dist/chunk-ZKISN6YP.js +0 -67
  598. package/dist/chunk-ZKISN6YP.js.map +0 -1
  599. package/dist/chunk-ZXDCQWMJ.mjs +0 -39
  600. package/dist/chunk-ZXDCQWMJ.mjs.map +0 -1
  601. package/dist/endowments/caveats/generic.js +0 -7
  602. package/dist/endowments/caveats/generic.js.map +0 -1
  603. package/dist/endowments/caveats/index.js +0 -18
  604. package/dist/endowments/caveats/index.js.map +0 -1
  605. package/dist/endowments/caveats/requestTime.js +0 -13
  606. package/dist/endowments/caveats/requestTime.js.map +0 -1
  607. package/dist/endowments/cronjob.js +0 -16
  608. package/dist/endowments/cronjob.js.map +0 -1
  609. package/dist/endowments/enum.js +0 -7
  610. package/dist/endowments/enum.js.map +0 -1
  611. package/dist/endowments/ethereum-provider.js +0 -8
  612. package/dist/endowments/ethereum-provider.js.map +0 -1
  613. package/dist/endowments/home-page.js +0 -8
  614. package/dist/endowments/home-page.js.map +0 -1
  615. package/dist/endowments/index.js +0 -54
  616. package/dist/endowments/index.js.map +0 -1
  617. package/dist/endowments/keyring.js +0 -17
  618. package/dist/endowments/keyring.js.map +0 -1
  619. package/dist/endowments/lifecycle-hooks.js +0 -8
  620. package/dist/endowments/lifecycle-hooks.js.map +0 -1
  621. package/dist/endowments/name-lookup.js +0 -19
  622. package/dist/endowments/name-lookup.js.map +0 -1
  623. package/dist/endowments/network-access.js +0 -8
  624. package/dist/endowments/network-access.js.map +0 -1
  625. package/dist/endowments/rpc.js +0 -17
  626. package/dist/endowments/rpc.js.map +0 -1
  627. package/dist/endowments/signature-insight.js +0 -17
  628. package/dist/endowments/signature-insight.js.map +0 -1
  629. package/dist/endowments/transaction-insight.js +0 -17
  630. package/dist/endowments/transaction-insight.js.map +0 -1
  631. package/dist/endowments/web-assembly.js +0 -8
  632. package/dist/endowments/web-assembly.js.map +0 -1
  633. package/dist/index.js +0 -123
  634. package/dist/index.js.map +0 -1
  635. package/dist/permissions.js +0 -44
  636. package/dist/permissions.js.map +0 -1
  637. package/dist/permitted/createInterface.js +0 -7
  638. package/dist/permitted/createInterface.js.map +0 -1
  639. package/dist/permitted/getAllSnaps.js +0 -7
  640. package/dist/permitted/getAllSnaps.js.map +0 -1
  641. package/dist/permitted/getClientStatus.js +0 -7
  642. package/dist/permitted/getClientStatus.js.map +0 -1
  643. package/dist/permitted/getFile.js +0 -9
  644. package/dist/permitted/getFile.js.map +0 -1
  645. package/dist/permitted/getInterfaceState.js +0 -7
  646. package/dist/permitted/getInterfaceState.js.map +0 -1
  647. package/dist/permitted/getSnaps.js +0 -7
  648. package/dist/permitted/getSnaps.js.map +0 -1
  649. package/dist/permitted/handlers.js +0 -21
  650. package/dist/permitted/handlers.js.map +0 -1
  651. package/dist/permitted/index.js +0 -27
  652. package/dist/permitted/index.js.map +0 -1
  653. package/dist/permitted/invokeKeyring.js +0 -8
  654. package/dist/permitted/invokeKeyring.js.map +0 -1
  655. package/dist/permitted/invokeSnapSugar.js +0 -11
  656. package/dist/permitted/invokeSnapSugar.js.map +0 -1
  657. package/dist/permitted/middleware.js +0 -21
  658. package/dist/permitted/middleware.js.map +0 -1
  659. package/dist/permitted/requestSnaps.js +0 -12
  660. package/dist/permitted/requestSnaps.js.map +0 -1
  661. package/dist/permitted/resolveInterface.js +0 -7
  662. package/dist/permitted/resolveInterface.js.map +0 -1
  663. package/dist/permitted/updateInterface.js +0 -7
  664. package/dist/permitted/updateInterface.js.map +0 -1
  665. package/dist/restricted/caveats/index.js +0 -17
  666. package/dist/restricted/caveats/index.js.map +0 -1
  667. package/dist/restricted/caveats/permittedCoinTypes.js +0 -13
  668. package/dist/restricted/caveats/permittedCoinTypes.js.map +0 -1
  669. package/dist/restricted/caveats/permittedDerivationPaths.js +0 -13
  670. package/dist/restricted/caveats/permittedDerivationPaths.js.map +0 -1
  671. package/dist/restricted/caveats/snapIds.js +0 -11
  672. package/dist/restricted/caveats/snapIds.js.map +0 -1
  673. package/dist/restricted/dialog.js +0 -11
  674. package/dist/restricted/dialog.js.map +0 -1
  675. package/dist/restricted/getBip32Entropy.js +0 -10
  676. package/dist/restricted/getBip32Entropy.js.map +0 -1
  677. package/dist/restricted/getBip32PublicKey.js +0 -12
  678. package/dist/restricted/getBip32PublicKey.js.map +0 -1
  679. package/dist/restricted/getBip44Entropy.js +0 -9
  680. package/dist/restricted/getBip44Entropy.js.map +0 -1
  681. package/dist/restricted/getEntropy.js +0 -10
  682. package/dist/restricted/getEntropy.js.map +0 -1
  683. package/dist/restricted/getLocale.js +0 -11
  684. package/dist/restricted/getLocale.js.map +0 -1
  685. package/dist/restricted/getPreferences.js +0 -11
  686. package/dist/restricted/getPreferences.js.map +0 -1
  687. package/dist/restricted/index.js +0 -37
  688. package/dist/restricted/index.js.map +0 -1
  689. package/dist/restricted/invokeSnap.js +0 -13
  690. package/dist/restricted/invokeSnap.js.map +0 -1
  691. package/dist/restricted/manageAccounts.js +0 -13
  692. package/dist/restricted/manageAccounts.js.map +0 -1
  693. package/dist/restricted/manageState.js +0 -20
  694. package/dist/restricted/manageState.js.map +0 -1
  695. package/dist/restricted/notify.js +0 -13
  696. package/dist/restricted/notify.js.map +0 -1
  697. package/dist/tsconfig.build.tsbuildinfo +0 -1
  698. package/dist/types/__fixtures__/index.d.ts +0 -1
  699. package/dist/types/endowments/caveats/index.d.ts +0 -2
  700. package/dist/types/index.d.ts +0 -7
  701. package/dist/types/permitted/handlers.d.ts +0 -34
  702. package/dist/types/permitted/index.d.ts +0 -11
  703. package/dist/types/restricted/dialog.d.ts +0 -1463
  704. package/dist/utils.js +0 -13
  705. package/dist/utils.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/permitted/invokeKeyring.ts"],"names":[],"mappings":";;;;;AAEA,SAAS,iBAAiB;AAO1B,SAAS,aAAa,kCAAkC;AAExD,SAAS,mBAA8B;AAKvC,IAAM,YAAmD;AAAA,EACvD,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,SAAS;AAAA,EACT,0BAA0B;AAC5B;AAKO,IAAM,uBAIT;AAAA,EACF,aAAa,CAAC,sBAAsB;AAAA,EACpC,gBAAgB;AAAA,EAChB;AACF;AAiCA,eAAe,4BACb,KACA,KACA,OACA,KACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GACe;AACf,MAAI;AACJ,MAAI;AACF,aAAS,mBAAmB,IAAI,MAAM;AAAA,EACxC,SAAS,OAAO;AACd,WAAO,IAAI,KAAK;AAAA,EAClB;AAGA,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,EAAE,QAAQ,QAAQ,IAAI;AAE5B,MAAI,CAAC,UAAU,CAAC,cAAc,0BAA0B,GAAG;AACzD,WAAO;AAAA,MACL,UAAU,eAAe;AAAA,QACvB,SAAS,aAAa,MAAM,0BAA0B,MAAM;AAAA,MAC9D,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,QAAQ,MAAM,GAAG;AACpB,WAAO;AAAA,MACL,UAAU,eAAe;AAAA,QACvB,SAAS,aAAa,MAAM;AAAA,MAC9B,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,YAAY,SAAS,QAAQ,KAAK,OAAO,QAAQ,WAAW,UAAU;AACzE,WAAO;AAAA,MACL,UAAU,eAAe;AAAA,QACvB,SAAS;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF;AAEA,QAAM,iBAAiB,yBAAyB;AAChD,MAAI,CAAC,eAAe,SAAS,QAAQ,MAAM,GAAG;AAC5C,WAAO;AAAA,MACL,UAAU,eAAe;AAAA,QACvB,SAAS,eAAe,MAAM,0CAA0C,QAAQ,MAAM;AAAA,MACxF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI;AACF,QAAI,SAAU,MAAM,qBAAqB;AAAA,MACvC;AAAA,MACA;AAAA,MACA,SAAS,YAAY;AAAA,IACvB,CAAC;AAAA,EACH,SAAS,OAAO;AACd,WAAO,IAAI,KAAK;AAAA,EAClB;AAEA,SAAO,IAAI;AACb","sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type {\n InvokeKeyringParams,\n InvokeKeyringResult,\n InvokeSnapParams,\n} from '@metamask/snaps-sdk';\nimport type { Snap, SnapRpcHookArgs } from '@metamask/snaps-utils';\nimport { HandlerType, WALLET_SNAP_PERMISSION_KEY } from '@metamask/snaps-utils';\nimport type { PendingJsonRpcResponse, JsonRpcRequest } from '@metamask/utils';\nimport { hasProperty, type Json } from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\nimport { getValidatedParams } from './invokeSnapSugar';\n\nconst hookNames: MethodHooksObject<InvokeKeyringHooks> = {\n hasPermission: true,\n handleSnapRpcRequest: true,\n getSnap: true,\n getAllowedKeyringMethods: true,\n};\n\n/**\n * `wallet_invokeKeyring` gets the requester's permitted and installed Snaps.\n */\nexport const invokeKeyringHandler: PermittedHandlerExport<\n InvokeKeyringHooks,\n InvokeSnapParams,\n InvokeKeyringResult\n> = {\n methodNames: ['wallet_invokeKeyring'],\n implementation: invokeKeyringImplementation,\n hookNames,\n};\n\nexport type InvokeKeyringHooks = {\n hasPermission: (permissionName: string) => boolean;\n\n handleSnapRpcRequest: ({\n snapId,\n handler,\n request,\n }: Omit<SnapRpcHookArgs, 'origin'> & { snapId: string }) => Promise<unknown>;\n\n getSnap: (snapId: string) => Snap | undefined;\n\n getAllowedKeyringMethods: () => string[];\n};\n\n/**\n * The `wallet_invokeKeyring` method implementation.\n * Invokes onKeyringRequest if the snap requested is installed and connected to the dapp.\n *\n * @param req - The JSON-RPC request object.\n * @param res - The JSON-RPC response object.\n * @param _next - The `json-rpc-engine` \"next\" callback. Not used by this\n * function.\n * @param end - The `json-rpc-engine` \"end\" callback.\n * @param hooks - The RPC method hooks.\n * @param hooks.handleSnapRpcRequest - Invokes a snap with a given RPC request.\n * @param hooks.hasPermission - Checks whether a given origin has a given permission.\n * @param hooks.getSnap - Gets information about a given snap.\n * @param hooks.getAllowedKeyringMethods - Get the list of allowed Keyring\n * methods for a given origin.\n * @returns Nothing.\n */\nasync function invokeKeyringImplementation(\n req: JsonRpcRequest<InvokeKeyringParams>,\n res: PendingJsonRpcResponse<InvokeKeyringResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n {\n handleSnapRpcRequest,\n hasPermission,\n getSnap,\n getAllowedKeyringMethods,\n }: InvokeKeyringHooks,\n): Promise<void> {\n let params: InvokeSnapParams;\n try {\n params = getValidatedParams(req.params);\n } catch (error) {\n return end(error);\n }\n\n // We expect the MM middleware stack to always add the origin to requests\n const { origin } = req as JsonRpcRequest & { origin: string };\n const { snapId, request } = params;\n\n if (!origin || !hasPermission(WALLET_SNAP_PERMISSION_KEY)) {\n return end(\n rpcErrors.invalidRequest({\n message: `The snap \"${snapId}\" is not connected to \"${origin}\". Please connect before invoking the snap.`,\n }),\n );\n }\n\n if (!getSnap(snapId)) {\n return end(\n rpcErrors.invalidRequest({\n message: `The snap \"${snapId}\" is not installed. Please install it first, before invoking the snap.`,\n }),\n );\n }\n\n if (!hasProperty(request, 'method') || typeof request.method !== 'string') {\n return end(\n rpcErrors.invalidRequest({\n message: 'The request must have a method.',\n }),\n );\n }\n\n const allowedMethods = getAllowedKeyringMethods();\n if (!allowedMethods.includes(request.method)) {\n return end(\n rpcErrors.invalidRequest({\n message: `The origin \"${origin}\" is not allowed to invoke the method \"${request.method}\".`,\n }),\n );\n }\n\n try {\n res.result = (await handleSnapRpcRequest({\n snapId,\n request,\n handler: HandlerType.OnKeyringRequest,\n })) as Json;\n } catch (error) {\n return end(error);\n }\n\n return end();\n}\n"]}
@@ -1,196 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/restricted/dialog.ts
2
- var _permissioncontroller = require('@metamask/permission-controller');
3
- var _rpcerrors = require('@metamask/rpc-errors');
4
-
5
-
6
-
7
-
8
-
9
- var _snapssdk = require('@metamask/snaps-sdk');
10
- var _snapsutils = require('@metamask/snaps-utils');
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
- var _superstruct = require('@metamask/superstruct');
20
- var _utils = require('@metamask/utils');
21
- var methodName = "snap_dialog";
22
- var DIALOG_APPROVAL_TYPES = {
23
- [_snapssdk.DialogType.Alert]: `${methodName}:alert`,
24
- [_snapssdk.DialogType.Confirmation]: `${methodName}:confirmation`,
25
- [_snapssdk.DialogType.Prompt]: `${methodName}:prompt`,
26
- default: methodName
27
- };
28
- var PlaceholderStruct = _superstruct.optional.call(void 0, _superstruct.size.call(void 0, _superstruct.string.call(void 0, ), 1, 40));
29
- var specificationBuilder = ({
30
- allowedCaveats = null,
31
- methodHooks: methodHooks2
32
- }) => {
33
- return {
34
- permissionType: _permissioncontroller.PermissionType.RestrictedMethod,
35
- targetName: methodName,
36
- allowedCaveats,
37
- methodImplementation: getDialogImplementation(methodHooks2),
38
- subjectTypes: [_permissioncontroller.SubjectType.Snap]
39
- };
40
- };
41
- var methodHooks = {
42
- requestUserApproval: true,
43
- createInterface: true,
44
- getInterface: true
45
- };
46
- var dialogBuilder = Object.freeze({
47
- targetName: methodName,
48
- specificationBuilder,
49
- methodHooks
50
- });
51
- var BaseParamsStruct = _superstruct.type.call(void 0, {
52
- type: _superstruct.optional.call(void 0,
53
- _superstruct.enums.call(void 0, [_snapssdk.DialogType.Alert, _snapssdk.DialogType.Confirmation, _snapssdk.DialogType.Prompt])
54
- )
55
- });
56
- var AlertParametersWithContentStruct = _superstruct.object.call(void 0, {
57
- type: _snapssdk.enumValue.call(void 0, _snapssdk.DialogType.Alert),
58
- content: _snapssdk.ComponentOrElementStruct
59
- });
60
- var AlertParametersWithIdStruct = _superstruct.object.call(void 0, {
61
- type: _snapssdk.enumValue.call(void 0, _snapssdk.DialogType.Alert),
62
- id: _superstruct.string.call(void 0, )
63
- });
64
- var AlertParametersStruct = _snapssdk.union.call(void 0, [
65
- AlertParametersWithContentStruct,
66
- AlertParametersWithIdStruct
67
- ]);
68
- var ConfirmationParametersWithContentStruct = _superstruct.object.call(void 0, {
69
- type: _snapssdk.enumValue.call(void 0, _snapssdk.DialogType.Confirmation),
70
- content: _snapssdk.ComponentOrElementStruct
71
- });
72
- var ConfirmationParametersWithIdStruct = _superstruct.object.call(void 0, {
73
- type: _snapssdk.enumValue.call(void 0, _snapssdk.DialogType.Confirmation),
74
- id: _superstruct.string.call(void 0, )
75
- });
76
- var ConfirmationParametersStruct = _snapssdk.union.call(void 0, [
77
- ConfirmationParametersWithContentStruct,
78
- ConfirmationParametersWithIdStruct
79
- ]);
80
- var PromptParametersWithContentStruct = _superstruct.object.call(void 0, {
81
- type: _snapssdk.enumValue.call(void 0, _snapssdk.DialogType.Prompt),
82
- content: _snapssdk.ComponentOrElementStruct,
83
- placeholder: PlaceholderStruct
84
- });
85
- var PromptParametersWithIdStruct = _superstruct.object.call(void 0, {
86
- type: _snapssdk.enumValue.call(void 0, _snapssdk.DialogType.Prompt),
87
- id: _superstruct.string.call(void 0, ),
88
- placeholder: PlaceholderStruct
89
- });
90
- var PromptParametersStruct = _snapssdk.union.call(void 0, [
91
- PromptParametersWithContentStruct,
92
- PromptParametersWithIdStruct
93
- ]);
94
- var DefaultParametersWithContentStruct = _superstruct.object.call(void 0, {
95
- content: _snapssdk.ComponentOrElementStruct
96
- });
97
- var DefaultParametersWithIdStruct = _superstruct.object.call(void 0, {
98
- id: _superstruct.string.call(void 0, )
99
- });
100
- var DefaultParametersStruct = _snapssdk.union.call(void 0, [
101
- DefaultParametersWithContentStruct,
102
- DefaultParametersWithIdStruct
103
- ]);
104
- var DialogParametersStruct = _snapssdk.union.call(void 0, [
105
- AlertParametersStruct,
106
- ConfirmationParametersStruct,
107
- PromptParametersStruct,
108
- DefaultParametersStruct
109
- ]);
110
- var structs = {
111
- [_snapssdk.DialogType.Alert]: AlertParametersStruct,
112
- [_snapssdk.DialogType.Confirmation]: ConfirmationParametersStruct,
113
- [_snapssdk.DialogType.Prompt]: PromptParametersStruct
114
- };
115
- function getDialogImplementation({
116
- requestUserApproval,
117
- createInterface,
118
- getInterface
119
- }) {
120
- return async function dialogImplementation(args) {
121
- const {
122
- params,
123
- context: { origin }
124
- } = args;
125
- if (!_utils.isObject.call(void 0, params)) {
126
- throw _rpcerrors.rpcErrors.invalidParams({
127
- message: "Invalid params: Expected params to be a single object."
128
- });
129
- }
130
- const validatedType = getValidatedType(params);
131
- const approvalType = validatedType ? DIALOG_APPROVAL_TYPES[validatedType] : DIALOG_APPROVAL_TYPES.default;
132
- const validatedParams = getValidatedParams(params, validatedType);
133
- const placeholder = isPromptDialog(validatedParams) ? validatedParams.placeholder : void 0;
134
- if (_utils.hasProperty.call(void 0, validatedParams, "content")) {
135
- const id = await createInterface(
136
- origin,
137
- validatedParams.content
138
- );
139
- return requestUserApproval({
140
- id: validatedType ? void 0 : id,
141
- origin,
142
- type: approvalType,
143
- requestData: { id, placeholder }
144
- });
145
- }
146
- validateInterface(origin, validatedParams.id, getInterface);
147
- return requestUserApproval({
148
- id: validatedType ? void 0 : validatedParams.id,
149
- origin,
150
- type: approvalType,
151
- requestData: { id: validatedParams.id, placeholder }
152
- });
153
- };
154
- }
155
- function validateInterface(origin, id, getInterface) {
156
- try {
157
- getInterface(origin, id);
158
- } catch (error) {
159
- throw _rpcerrors.rpcErrors.invalidParams({
160
- message: `Invalid params: ${error.message}`
161
- });
162
- }
163
- }
164
- function getDialogType(params) {
165
- return _utils.hasProperty.call(void 0, params, "type") ? params.type : void 0;
166
- }
167
- function getValidatedType(params) {
168
- try {
169
- return _superstruct.create.call(void 0, params, BaseParamsStruct).type;
170
- } catch (error) {
171
- throw _rpcerrors.rpcErrors.invalidParams({
172
- message: `The "type" property must be one of: ${Object.values(
173
- _snapssdk.DialogType
174
- ).join(", ")}.`
175
- });
176
- }
177
- }
178
- function isPromptDialog(params) {
179
- return getDialogType(params) === _snapssdk.DialogType.Prompt;
180
- }
181
- function getValidatedParams(params, validatedType) {
182
- try {
183
- return validatedType ? _snapsutils.createUnion.call(void 0, params, structs[validatedType], "type") : _superstruct.create.call(void 0, params, DefaultParametersStruct);
184
- } catch (error) {
185
- throw _rpcerrors.rpcErrors.invalidParams({
186
- message: `Invalid params: ${error.message}`
187
- });
188
- }
189
- }
190
-
191
-
192
-
193
-
194
-
195
- exports.DIALOG_APPROVAL_TYPES = DIALOG_APPROVAL_TYPES; exports.dialogBuilder = dialogBuilder; exports.getDialogImplementation = getDialogImplementation;
196
- //# sourceMappingURL=chunk-ELCOEVKA.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/restricted/dialog.ts"],"names":["methodHooks"],"mappings":";AAKA,SAAS,gBAAgB,mBAAmB;AAC5C,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUP,SAAS,mBAAmB;AAE5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,aAAa,gBAAgB;AAItC,IAAM,aAAa;AAMZ,IAAM,wBAAwB;AAAA,EACnC,CAAC,WAAW,KAAK,GAAG,GAAG,UAAU;AAAA,EACjC,CAAC,WAAW,YAAY,GAAG,GAAG,UAAU;AAAA,EACxC,CAAC,WAAW,MAAM,GAAG,GAAG,UAAU;AAAA,EAClC,SAAS;AACX;AAEA,IAAM,oBAAoB,SAAS,KAAK,OAAO,GAAG,GAAG,EAAE,CAAC;AA8ExD,IAAM,uBAIF,CAAC;AAAA,EACH,iBAAiB;AAAA,EACjB,aAAAA;AACF,MAAyC;AACvC,SAAO;AAAA,IACL,gBAAgB,eAAe;AAAA,IAC/B,YAAY;AAAA,IACZ;AAAA,IACA,sBAAsB,wBAAwBA,YAAW;AAAA,IACzD,cAAc,CAAC,YAAY,IAAI;AAAA,EACjC;AACF;AAEA,IAAM,cAAoD;AAAA,EACxD,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,cAAc;AAChB;AAEO,IAAM,gBAAgB,OAAO,OAAO;AAAA,EACzC,YAAY;AAAA,EACZ;AAAA,EACA;AACF,CAAU;AAIV,IAAM,mBAAmB,KAAK;AAAA,EAC5B,MAAM;AAAA,IACJ,MAAM,CAAC,WAAW,OAAO,WAAW,cAAc,WAAW,MAAM,CAAC;AAAA,EACtE;AACF,CAAC;AAED,IAAM,mCAAmC,OAAO;AAAA,EAC9C,MAAM,UAAU,WAAW,KAAK;AAAA,EAChC,SAAS;AACX,CAAC;AACD,IAAM,8BAA8B,OAAO;AAAA,EACzC,MAAM,UAAU,WAAW,KAAK;AAAA,EAChC,IAAI,OAAO;AACb,CAAC;AAED,IAAM,wBAAwB,MAAM;AAAA,EAClC;AAAA,EACA;AACF,CAAC;AAED,IAAM,0CAA0C,OAAO;AAAA,EACrD,MAAM,UAAU,WAAW,YAAY;AAAA,EACvC,SAAS;AACX,CAAC;AAED,IAAM,qCAAqC,OAAO;AAAA,EAChD,MAAM,UAAU,WAAW,YAAY;AAAA,EACvC,IAAI,OAAO;AACb,CAAC;AAED,IAAM,+BAA+B,MAAM;AAAA,EACzC;AAAA,EACA;AACF,CAAC;AAED,IAAM,oCAAoC,OAAO;AAAA,EAC/C,MAAM,UAAU,WAAW,MAAM;AAAA,EACjC,SAAS;AAAA,EACT,aAAa;AACf,CAAC;AAED,IAAM,+BAA+B,OAAO;AAAA,EAC1C,MAAM,UAAU,WAAW,MAAM;AAAA,EACjC,IAAI,OAAO;AAAA,EACX,aAAa;AACf,CAAC;AAED,IAAM,yBAAyB,MAAM;AAAA,EACnC;AAAA,EACA;AACF,CAAC;AAED,IAAM,qCAAqC,OAAO;AAAA,EAChD,SAAS;AACX,CAAC;AAED,IAAM,gCAAgC,OAAO;AAAA,EAC3C,IAAI,OAAO;AACb,CAAC;AAED,IAAM,0BAA0B,MAAM;AAAA,EACpC;AAAA,EACA;AACF,CAAC;AAED,IAAM,yBAAyB,MAAM;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAOD,IAAM,UAAgD;AAAA,EACpD,CAAC,WAAW,KAAK,GAAG;AAAA,EACpB,CAAC,WAAW,YAAY,GAAG;AAAA,EAC3B,CAAC,WAAW,MAAM,GAAG;AACvB;AAaO,SAAS,wBAAwB;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AACF,GAAsB;AACpB,SAAO,eAAe,qBACpB,MACyC;AACzC,UAAM;AAAA,MACJ;AAAA,MACA,SAAS,EAAE,OAAO;AAAA,IACpB,IAAI;AAEJ,QAAI,CAAC,SAAS,MAAM,GAAG;AACrB,YAAM,UAAU,cAAc;AAAA,QAC5B,SAAS;AAAA,MACX,CAAC;AAAA,IACH;AAEA,UAAM,gBAAgB,iBAAiB,MAAM;AAE7C,UAAM,eAAe,gBACjB,sBAAsB,aAAa,IACnC,sBAAsB;AAE1B,UAAM,kBAAkB,mBAAmB,QAAQ,aAAa;AAChE,UAAM,cAAc,eAAe,eAAe,IAC9C,gBAAgB,cAChB;AAEJ,QAAI,YAAY,iBAAiB,SAAS,GAAG;AAC3C,YAAM,KAAK,MAAM;AAAA,QACf;AAAA,QACA,gBAAgB;AAAA,MAClB;AAEA,aAAO,oBAAoB;AAAA,QACzB,IAAI,gBAAgB,SAAY;AAAA,QAChC;AAAA,QACA,MAAM;AAAA,QACN,aAAa,EAAE,IAAI,YAAY;AAAA,MACjC,CAAC;AAAA,IACH;AAEA,sBAAkB,QAAQ,gBAAgB,IAAI,YAAY;AAE1D,WAAO,oBAAoB;AAAA,MACzB,IAAI,gBAAgB,SAAY,gBAAgB;AAAA,MAChD;AAAA,MACA,MAAM;AAAA,MACN,aAAa,EAAE,IAAI,gBAAgB,IAAI,YAAY;AAAA,IACrD,CAAC;AAAA,EACH;AACF;AAQA,SAAS,kBACP,QACA,IACA,cACA;AACA,MAAI;AACF,iBAAa,QAAQ,EAAE;AAAA,EACzB,SAAS,OAAO;AACd,UAAM,UAAU,cAAc;AAAA,MAC5B,SAAS,mBAAmB,MAAM,OAAO;AAAA,IAC3C,CAAC;AAAA,EACH;AACF;AAQA,SAAS,cAAc,QAAkD;AACvE,SAAO,YAAY,QAAQ,MAAM,IAAK,OAAO,OAAsB;AACrE;AASA,SAAS,iBAAiB,QAAyC;AACjE,MAAI;AACF,WAAO,OAAO,QAAQ,gBAAgB,EAAE;AAAA,EAC1C,SAAS,OAAO;AACd,UAAM,UAAU,cAAc;AAAA,MAC5B,SAAS,uCAAuC,OAAO;AAAA,QACrD;AAAA,MACF,EAAE,KAAK,IAAI,CAAC;AAAA,IACd,CAAC;AAAA,EACH;AACF;AAQA,SAAS,eAAe,QAAkD;AACxE,SAAO,cAAc,MAAM,MAAM,WAAW;AAC9C;AAUA,SAAS,mBACP,QACA,eACkB;AAClB,MAAI;AACF,WAAO,gBACH,YAAY,QAAQ,QAAQ,aAAa,GAAG,MAAM,IAClD,OAAO,QAAQ,uBAAuB;AAAA,EAC5C,SAAS,OAAO;AACd,UAAM,UAAU,cAAc;AAAA,MAC5B,SAAS,mBAAmB,MAAM,OAAO;AAAA,IAC3C,CAAC;AAAA,EACH;AACF","sourcesContent":["import type {\n PermissionSpecificationBuilder,\n RestrictedMethodOptions,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport {\n DialogType,\n enumValue,\n union,\n ComponentOrElementStruct,\n} from '@metamask/snaps-sdk';\nimport type {\n DialogParams,\n Component,\n InterfaceState,\n SnapId,\n PromptDialog,\n ComponentOrElement,\n} from '@metamask/snaps-sdk';\nimport type { InferMatching } from '@metamask/snaps-utils';\nimport { createUnion } from '@metamask/snaps-utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n create,\n enums,\n object,\n optional,\n size,\n string,\n type,\n} from '@metamask/superstruct';\nimport type { Json, NonEmptyArray } from '@metamask/utils';\nimport { hasProperty, isObject } from '@metamask/utils';\n\nimport { type MethodHooksObject } from '../utils';\n\nconst methodName = 'snap_dialog';\n\nexport type DialogApprovalTypes = Record<DialogType, string> & {\n default: string;\n};\n\nexport const DIALOG_APPROVAL_TYPES = {\n [DialogType.Alert]: `${methodName}:alert`,\n [DialogType.Confirmation]: `${methodName}:confirmation`,\n [DialogType.Prompt]: `${methodName}:prompt`,\n default: methodName,\n};\n\nconst PlaceholderStruct = optional(size(string(), 1, 40));\n\nexport type Placeholder = Infer<typeof PlaceholderStruct>;\n\ntype RequestUserApprovalOptions = {\n id?: string;\n origin: string;\n type: string;\n requestData: {\n id: string;\n placeholder?: string;\n };\n};\n\ntype RequestUserApproval = (\n opts: RequestUserApprovalOptions,\n) => Promise<boolean | null | string | Json>;\n\ntype CreateInterface = (\n snapId: string,\n content: ComponentOrElement,\n) => Promise<string>;\n\ntype GetInterface = (\n snapId: string,\n id: string,\n) => { content: ComponentOrElement; snapId: SnapId; state: InterfaceState };\n\nexport type DialogMethodHooks = {\n /**\n * @param opts - The `requestUserApproval` options.\n * @param opts.id - The approval ID. If not provided, a new approval ID will be generated.\n * @param opts.origin - The origin of the request. In this case, the Snap ID.\n * @param opts.type - The type of the approval request.\n * @param opts.requestData - The data of the approval request.\n * @param opts.requestData.id - The ID of the interface.\n * @param opts.requestData.placeholder - The placeholder of the `Prompt` dialog.\n */\n requestUserApproval: RequestUserApproval;\n\n /**\n * @param snapId - The Snap ID creating the interface.\n * @param content - The content of the interface.\n */\n createInterface: CreateInterface;\n /**\n * @param snapId - The SnapId requesting the interface.\n * @param id - The interface ID.\n */\n getInterface: GetInterface;\n};\n\ntype DialogSpecificationBuilderOptions = {\n allowedCaveats?: Readonly<NonEmptyArray<string>> | null;\n methodHooks: DialogMethodHooks;\n};\n\ntype DialogSpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof methodName;\n methodImplementation: ReturnType<typeof getDialogImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n}>;\n\n/**\n * The specification builder for the `snap_dialog` permission. `snap_dialog`\n * lets the Snap display one of the following dialogs to the user:\n * - An alert, for displaying information.\n * - A confirmation, for accepting or rejecting some action.\n * - A prompt, for inputting some information.\n *\n * @param options - The specification builder options.\n * @param options.allowedCaveats - The optional allowed caveats for the\n * permission.\n * @param options.methodHooks - The RPC method hooks needed by the method\n * implementation.\n * @returns The specification for the `snap_dialog` permission.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n DialogSpecificationBuilderOptions,\n DialogSpecification\n> = ({\n allowedCaveats = null,\n methodHooks,\n}: DialogSpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName: methodName,\n allowedCaveats,\n methodImplementation: getDialogImplementation(methodHooks),\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nconst methodHooks: MethodHooksObject<DialogMethodHooks> = {\n requestUserApproval: true,\n createInterface: true,\n getInterface: true,\n};\n\nexport const dialogBuilder = Object.freeze({\n targetName: methodName,\n specificationBuilder,\n methodHooks,\n} as const);\n\n// Note: We use `type` here instead of `object` because `type` does not validate\n// the keys of the object, which is what we want.\nconst BaseParamsStruct = type({\n type: optional(\n enums([DialogType.Alert, DialogType.Confirmation, DialogType.Prompt]),\n ),\n});\n\nconst AlertParametersWithContentStruct = object({\n type: enumValue(DialogType.Alert),\n content: ComponentOrElementStruct,\n});\nconst AlertParametersWithIdStruct = object({\n type: enumValue(DialogType.Alert),\n id: string(),\n});\n\nconst AlertParametersStruct = union([\n AlertParametersWithContentStruct,\n AlertParametersWithIdStruct,\n]);\n\nconst ConfirmationParametersWithContentStruct = object({\n type: enumValue(DialogType.Confirmation),\n content: ComponentOrElementStruct,\n});\n\nconst ConfirmationParametersWithIdStruct = object({\n type: enumValue(DialogType.Confirmation),\n id: string(),\n});\n\nconst ConfirmationParametersStruct = union([\n ConfirmationParametersWithContentStruct,\n ConfirmationParametersWithIdStruct,\n]);\n\nconst PromptParametersWithContentStruct = object({\n type: enumValue(DialogType.Prompt),\n content: ComponentOrElementStruct,\n placeholder: PlaceholderStruct,\n});\n\nconst PromptParametersWithIdStruct = object({\n type: enumValue(DialogType.Prompt),\n id: string(),\n placeholder: PlaceholderStruct,\n});\n\nconst PromptParametersStruct = union([\n PromptParametersWithContentStruct,\n PromptParametersWithIdStruct,\n]);\n\nconst DefaultParametersWithContentStruct = object({\n content: ComponentOrElementStruct,\n});\n\nconst DefaultParametersWithIdStruct = object({\n id: string(),\n});\n\nconst DefaultParametersStruct = union([\n DefaultParametersWithContentStruct,\n DefaultParametersWithIdStruct,\n]);\n\nconst DialogParametersStruct = union([\n AlertParametersStruct,\n ConfirmationParametersStruct,\n PromptParametersStruct,\n DefaultParametersStruct,\n]);\n\nexport type DialogParameters = InferMatching<\n typeof DialogParametersStruct,\n DialogParams\n>;\n\nconst structs: Record<DialogType, Struct<any, any>> = {\n [DialogType.Alert]: AlertParametersStruct,\n [DialogType.Confirmation]: ConfirmationParametersStruct,\n [DialogType.Prompt]: PromptParametersStruct,\n};\n\n/**\n * Builds the method implementation for `snap_dialog`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.requestUserApproval - A function that creates a new Approval in the ApprovalController.\n * This function should return a Promise that resolves with the appropriate value when the user has approved or rejected the request.\n * @param hooks.createInterface - A function that creates the interface in SnapInterfaceController.\n * @param hooks.getInterface - A function that gets an interface from SnapInterfaceController.\n * @returns The method implementation which return value depends on the dialog\n * type, valid return types are: string, boolean, null.\n */\nexport function getDialogImplementation({\n requestUserApproval,\n createInterface,\n getInterface,\n}: DialogMethodHooks) {\n return async function dialogImplementation(\n args: RestrictedMethodOptions<DialogParameters>,\n ): Promise<boolean | null | string | Json> {\n const {\n params,\n context: { origin },\n } = args;\n\n if (!isObject(params)) {\n throw rpcErrors.invalidParams({\n message: 'Invalid params: Expected params to be a single object.',\n });\n }\n\n const validatedType = getValidatedType(params);\n\n const approvalType = validatedType\n ? DIALOG_APPROVAL_TYPES[validatedType]\n : DIALOG_APPROVAL_TYPES.default;\n\n const validatedParams = getValidatedParams(params, validatedType);\n const placeholder = isPromptDialog(validatedParams)\n ? validatedParams.placeholder\n : undefined;\n\n if (hasProperty(validatedParams, 'content')) {\n const id = await createInterface(\n origin,\n validatedParams.content as Component,\n );\n\n return requestUserApproval({\n id: validatedType ? undefined : id,\n origin,\n type: approvalType,\n requestData: { id, placeholder },\n });\n }\n\n validateInterface(origin, validatedParams.id, getInterface);\n\n return requestUserApproval({\n id: validatedType ? undefined : validatedParams.id,\n origin,\n type: approvalType,\n requestData: { id: validatedParams.id, placeholder },\n });\n };\n}\n/**\n * Validate that the interface ID is valid.\n *\n * @param origin - The origin of the request.\n * @param id - The interface ID.\n * @param getInterface - The function to get the interface.\n */\nfunction validateInterface(\n origin: string,\n id: string,\n getInterface: GetInterface,\n) {\n try {\n getInterface(origin, id);\n } catch (error) {\n throw rpcErrors.invalidParams({\n message: `Invalid params: ${error.message}`,\n });\n }\n}\n\n/**\n * Gets the dialog type from the dialog parameters.\n *\n * @param params - The dialog parameters.\n * @returns The dialog type.\n */\nfunction getDialogType(params: DialogParameters): DialogType | undefined {\n return hasProperty(params, 'type') ? (params.type as DialogType) : undefined;\n}\n\n/**\n * Get the validated type of the dialog parameters. Throws an error if the type\n * is invalid.\n *\n * @param params - The parameters to validate.\n * @returns The validated type of the dialog parameters.\n */\nfunction getValidatedType(params: unknown): DialogType | undefined {\n try {\n return create(params, BaseParamsStruct).type;\n } catch (error) {\n throw rpcErrors.invalidParams({\n message: `The \"type\" property must be one of: ${Object.values(\n DialogType,\n ).join(', ')}.`,\n });\n }\n}\n\n/**\n * Checks if the dialog parameters are for a prompt dialog.\n *\n * @param params - The dialog parameters.\n * @returns `true` if the dialog parameters are for a prompt dialog, `false` otherwise.\n */\nfunction isPromptDialog(params: DialogParameters): params is PromptDialog {\n return getDialogType(params) === DialogType.Prompt;\n}\n\n/**\n * Validates the confirm method `params` and returns them cast to the correct\n * type. Throws if validation fails.\n *\n * @param params - The unvalidated params object from the method request.\n * @param validatedType - The validated dialog type.\n * @returns The validated confirm method parameter object.\n */\nfunction getValidatedParams(\n params: unknown,\n validatedType: DialogType | undefined,\n): DialogParameters {\n try {\n return validatedType\n ? createUnion(params, structs[validatedType], 'type')\n : create(params, DefaultParametersStruct);\n } catch (error) {\n throw rpcErrors.invalidParams({\n message: `Invalid params: ${error.message}`,\n });\n }\n}\n"]}
@@ -1,47 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/permitted/getFile.ts
2
- var _rpcerrors = require('@metamask/rpc-errors');
3
- var _snapssdk = require('@metamask/snaps-sdk');
4
- var _superstruct = require('@metamask/superstruct');
5
- var _utils = require('@metamask/utils');
6
- var GetFileArgsStruct = _superstruct.object.call(void 0, {
7
- path: _superstruct.string.call(void 0, ),
8
- encoding: _superstruct.optional.call(void 0,
9
- _superstruct.union.call(void 0, [
10
- _snapssdk.enumValue.call(void 0, _snapssdk.AuxiliaryFileEncoding.Base64),
11
- _snapssdk.enumValue.call(void 0, _snapssdk.AuxiliaryFileEncoding.Hex),
12
- _snapssdk.enumValue.call(void 0, _snapssdk.AuxiliaryFileEncoding.Utf8)
13
- ])
14
- )
15
- });
16
- var hookNames = {
17
- getSnapFile: true
18
- };
19
- var getFileHandler = {
20
- methodNames: ["snap_getFile"],
21
- implementation,
22
- hookNames
23
- };
24
- async function implementation(req, res, _next, end, { getSnapFile }) {
25
- const { params } = req;
26
- _utils.assertStruct.call(void 0,
27
- params,
28
- GetFileArgsStruct,
29
- 'Invalid "snap_getFile" parameters',
30
- _rpcerrors.rpcErrors.invalidParams
31
- );
32
- try {
33
- res.result = await getSnapFile(
34
- params.path,
35
- params.encoding ?? _snapssdk.AuxiliaryFileEncoding.Base64
36
- );
37
- } catch (error) {
38
- return end(error);
39
- }
40
- return end();
41
- }
42
-
43
-
44
-
45
-
46
- exports.GetFileArgsStruct = GetFileArgsStruct; exports.getFileHandler = getFileHandler;
47
- //# sourceMappingURL=chunk-EOXTZF5U.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/permitted/getFile.ts"],"names":[],"mappings":";AAEA,SAAS,iBAAiB;AAE1B,SAAS,uBAAuB,iBAAiB;AAEjD,SAAS,QAAQ,UAAU,QAAQ,aAAa;AAEhD,SAAS,oBAAoB;AAItB,IAAM,oBAAoB,OAAO;AAAA,EACtC,MAAM,OAAO;AAAA,EACb,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,UAAU,sBAAsB,MAAM;AAAA,MACtC,UAAU,sBAAsB,GAAG;AAAA,MACnC,UAAU,sBAAsB,IAAI;AAAA,IACtC,CAAC;AAAA,EACH;AACF,CAAC;AAOD,IAAM,YAA6C;AAAA,EACjD,aAAa;AACf;AAEO,IAAM,iBAIT;AAAA,EACF,aAAa,CAAC,cAAc;AAAA,EAC5B;AAAA,EACA;AACF;AAqBA,eAAe,eACb,KACA,KACA,OACA,KACA,EAAE,YAAY,GACC;AACf,QAAM,EAAE,OAAO,IAAI;AAEnB;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,EACZ;AAEA,MAAI;AACF,QAAI,SAAS,MAAM;AAAA,MACjB,OAAO;AAAA,MACP,OAAO,YAAY,sBAAsB;AAAA,IAC3C;AAAA,EACF,SAAS,OAAO;AACd,WAAO,IAAI,KAAK;AAAA,EAClB;AAEA,SAAO,IAAI;AACb","sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { GetFileParams, GetFileResult } from '@metamask/snaps-sdk';\nimport { AuxiliaryFileEncoding, enumValue } from '@metamask/snaps-sdk';\nimport type { InferMatching } from '@metamask/snaps-utils';\nimport { object, optional, string, union } from '@metamask/superstruct';\nimport type { PendingJsonRpcResponse, JsonRpcRequest } from '@metamask/utils';\nimport { assertStruct } from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\n\nexport const GetFileArgsStruct = object({\n path: string(),\n encoding: optional(\n union([\n enumValue(AuxiliaryFileEncoding.Base64),\n enumValue(AuxiliaryFileEncoding.Hex),\n enumValue(AuxiliaryFileEncoding.Utf8),\n ]),\n ),\n});\n\nexport type InferredGetFileParams = InferMatching<\n typeof GetFileArgsStruct,\n GetFileParams\n>;\n\nconst hookNames: MethodHooksObject<GetFileHooks> = {\n getSnapFile: true,\n};\n\nexport const getFileHandler: PermittedHandlerExport<\n GetFileHooks,\n InferredGetFileParams,\n string\n> = {\n methodNames: ['snap_getFile'],\n implementation,\n hookNames,\n};\n\nexport type GetFileHooks = {\n getSnapFile: (\n path: InferredGetFileParams['path'],\n encoding: InferredGetFileParams['encoding'],\n ) => Promise<string>;\n};\n\n/**\n * The `snap_getFile` method implementation.\n *\n * @param req - The JSON-RPC request object.\n * @param res - The JSON-RPC response object.\n * @param _next - The `json-rpc-engine` \"next\" callback. Not used by this\n * function.\n * @param end - The `json-rpc-engine` \"end\" callback.\n * @param hooks - The RPC method hooks.\n * @param hooks.getSnapFile - The function to load a static snap file.\n * @returns Nothing.\n */\nasync function implementation(\n req: JsonRpcRequest<InferredGetFileParams>,\n res: PendingJsonRpcResponse<GetFileResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n { getSnapFile }: GetFileHooks,\n): Promise<void> {\n const { params } = req;\n\n assertStruct(\n params,\n GetFileArgsStruct,\n 'Invalid \"snap_getFile\" parameters',\n rpcErrors.invalidParams,\n );\n\n try {\n res.result = await getSnapFile(\n params.path,\n params.encoding ?? AuxiliaryFileEncoding.Base64,\n );\n } catch (error) {\n return end(error);\n }\n\n return end();\n}\n"]}
@@ -1,73 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/endowments/caveats/requestTime.ts
2
- var _rpcerrors = require('@metamask/rpc-errors');
3
- var _snapsutils = require('@metamask/snaps-utils');
4
- var _utils = require('@metamask/utils');
5
- function assertIsMaxRequestTime(value, ErrorWrapper) {
6
- _utils.assertStruct.call(void 0,
7
- value,
8
- _snapsutils.MaxRequestTimeStruct,
9
- "Invalid maxRequestTime",
10
- ErrorWrapper
11
- );
12
- }
13
- function validateMaxRequestTimeCaveat(caveat) {
14
- if (!_utils.hasProperty.call(void 0, caveat, "value")) {
15
- throw _rpcerrors.rpcErrors.invalidParams({
16
- message: "Invalid maxRequestTime caveat."
17
- });
18
- }
19
- const { value } = caveat;
20
- assertIsMaxRequestTime(value, _rpcerrors.rpcErrors.invalidParams);
21
- }
22
- function getMaxRequestTimeCaveatMapper(value) {
23
- if (!value || !_utils.isObject.call(void 0, value) || _utils.isObject.call(void 0, value) && !_utils.hasProperty.call(void 0, value, "maxRequestTime")) {
24
- return { caveats: null };
25
- }
26
- return {
27
- caveats: [
28
- {
29
- type: _snapsutils.SnapCaveatType.MaxRequestTime,
30
- value: value.maxRequestTime
31
- }
32
- ]
33
- };
34
- }
35
- function createMaxRequestTimeMapper(mapper) {
36
- return function(value) {
37
- const { maxRequestTime, ...rest } = value;
38
- const mapperResult = mapper(rest);
39
- if (!maxRequestTime) {
40
- return mapperResult;
41
- }
42
- return {
43
- ...mapperResult,
44
- caveats: [
45
- ...mapperResult.caveats ?? [],
46
- {
47
- type: _snapsutils.SnapCaveatType.MaxRequestTime,
48
- value: maxRequestTime
49
- }
50
- ]
51
- };
52
- };
53
- }
54
- function getMaxRequestTimeCaveat(permission) {
55
- const foundCaveat = permission?.caveats?.find(
56
- (caveat) => caveat.type === _snapsutils.SnapCaveatType.MaxRequestTime
57
- );
58
- return foundCaveat?.value ?? null;
59
- }
60
- var maxRequestTimeCaveatSpecifications = {
61
- [_snapsutils.SnapCaveatType.MaxRequestTime]: Object.freeze({
62
- type: _snapsutils.SnapCaveatType.MaxRequestTime,
63
- validator: (caveat) => validateMaxRequestTimeCaveat(caveat)
64
- })
65
- };
66
-
67
-
68
-
69
-
70
-
71
-
72
- exports.getMaxRequestTimeCaveatMapper = getMaxRequestTimeCaveatMapper; exports.createMaxRequestTimeMapper = createMaxRequestTimeMapper; exports.getMaxRequestTimeCaveat = getMaxRequestTimeCaveat; exports.maxRequestTimeCaveatSpecifications = maxRequestTimeCaveatSpecifications;
73
- //# sourceMappingURL=chunk-FCVWU5XH.js.map
@@ -1,82 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/restricted/invokeSnap.ts
2
- var _permissioncontroller = require('@metamask/permission-controller');
3
- var _rpcerrors = require('@metamask/rpc-errors');
4
- var _snapsutils = require('@metamask/snaps-utils');
5
- var WALLET_SNAP_PERMISSION_KEY = "wallet_snap";
6
- var handleSnapInstall = async ({ requestData, messagingSystem }) => {
7
- const snaps = requestData.permissions[WALLET_SNAP_PERMISSION_KEY].caveats?.[0].value;
8
- const permittedSnaps = messagingSystem.call(
9
- `SnapController:getPermitted`,
10
- requestData.metadata.origin
11
- );
12
- const dedupedSnaps = Object.keys(snaps).reduce(
13
- (filteredSnaps, snap) => {
14
- if (!permittedSnaps[snap]) {
15
- filteredSnaps[snap] = snaps[snap];
16
- }
17
- return filteredSnaps;
18
- },
19
- {}
20
- );
21
- return messagingSystem.call(
22
- `SnapController:install`,
23
- requestData.metadata.origin,
24
- dedupedSnaps
25
- );
26
- };
27
- var specificationBuilder = ({ methodHooks: methodHooks2 }) => {
28
- return {
29
- permissionType: _permissioncontroller.PermissionType.RestrictedMethod,
30
- targetName: WALLET_SNAP_PERMISSION_KEY,
31
- allowedCaveats: [_snapsutils.SnapCaveatType.SnapIds],
32
- methodImplementation: getInvokeSnapImplementation(methodHooks2),
33
- validator: ({ caveats }) => {
34
- if (caveats?.length !== 1 || caveats[0].type !== _snapsutils.SnapCaveatType.SnapIds) {
35
- throw _rpcerrors.rpcErrors.invalidParams({
36
- message: `Expected a single "${_snapsutils.SnapCaveatType.SnapIds}" caveat.`
37
- });
38
- }
39
- },
40
- sideEffect: {
41
- onPermitted: handleSnapInstall
42
- }
43
- };
44
- };
45
- var methodHooks = {
46
- getSnap: true,
47
- handleSnapRpcRequest: true
48
- };
49
- var invokeSnapBuilder = Object.freeze({
50
- targetName: WALLET_SNAP_PERMISSION_KEY,
51
- specificationBuilder,
52
- methodHooks
53
- });
54
- function getInvokeSnapImplementation({
55
- getSnap,
56
- handleSnapRpcRequest
57
- }) {
58
- return async function invokeSnap(options) {
59
- const { params = {}, context } = options;
60
- const { snapId, request } = params;
61
- if (!getSnap(snapId)) {
62
- throw _rpcerrors.rpcErrors.invalidRequest({
63
- message: `The snap "${snapId}" is not installed. Please install it first, before invoking the snap.`
64
- });
65
- }
66
- const { origin } = context;
67
- return await handleSnapRpcRequest({
68
- snapId,
69
- origin,
70
- request,
71
- handler: _snapsutils.HandlerType.OnRpcRequest
72
- });
73
- };
74
- }
75
-
76
-
77
-
78
-
79
-
80
-
81
- exports.WALLET_SNAP_PERMISSION_KEY = WALLET_SNAP_PERMISSION_KEY; exports.handleSnapInstall = handleSnapInstall; exports.invokeSnapBuilder = invokeSnapBuilder; exports.getInvokeSnapImplementation = getInvokeSnapImplementation;
82
- //# sourceMappingURL=chunk-FFHVA6PP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/restricted/invokeSnap.ts"],"names":["methodHooks"],"mappings":";AAOA,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAO1B,SAAS,aAAa,sBAAsB;AAKrC,IAAM,6BAA6B;AAwDnC,IAAM,oBAGM,OAAO,EAAE,aAAa,gBAAgB,MAAM;AAC7D,QAAM,QAAQ,YAAY,YAAY,0BAA0B,EAAE,UAAU,CAAC,EAC1E;AAEH,QAAM,iBAAiB,gBAAgB;AAAA,IACrC;AAAA,IACA,YAAY,SAAS;AAAA,EACvB;AAEA,QAAM,eAAe,OAAO,KAAK,KAAK,EAAE;AAAA,IACtC,CAAC,eAAe,SAAS;AACvB,UAAI,CAAC,eAAe,IAAI,GAAG;AACzB,sBAAc,IAAI,IAAI,MAAM,IAAI;AAAA,MAClC;AACA,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AAEA,SAAO,gBAAgB;AAAA,IACrB;AAAA,IACA,YAAY,SAAS;AAAA,IACrB;AAAA,EACF;AACF;AAaA,IAAM,uBAIF,CAAC,EAAE,aAAAA,aAAY,MAA6C;AAC9D,SAAO;AAAA,IACL,gBAAgB,eAAe;AAAA,IAC/B,YAAY;AAAA,IACZ,gBAAgB,CAAC,eAAe,OAAO;AAAA,IACvC,sBAAsB,4BAA4BA,YAAW;AAAA,IAC7D,WAAW,CAAC,EAAE,QAAQ,MAAM;AAC1B,UAAI,SAAS,WAAW,KAAK,QAAQ,CAAC,EAAE,SAAS,eAAe,SAAS;AACvE,cAAM,UAAU,cAAc;AAAA,UAC5B,SAAS,sBAAsB,eAAe,OAAO;AAAA,QACvD,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV,aAAa;AAAA,IACf;AAAA,EACF;AACF;AAEA,IAAM,cAAwD;AAAA,EAC5D,SAAS;AAAA,EACT,sBAAsB;AACxB;AAEO,IAAM,oBAAoB,OAAO,OAAO;AAAA,EAC7C,YAAY;AAAA,EACZ;AAAA,EACA;AACF,CAAU;AAWH,SAAS,4BAA4B;AAAA,EAC1C;AAAA,EACA;AACF,GAA0B;AACxB,SAAO,eAAe,WACpB,SAC2B;AAC3B,UAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,IAAI;AAEjC,UAAM,EAAE,QAAQ,QAAQ,IAAI;AAE5B,QAAI,CAAC,QAAQ,MAAM,GAAG;AACpB,YAAM,UAAU,eAAe;AAAA,QAC7B,SAAS,aAAa,MAAM;AAAA,MAC9B,CAAC;AAAA,IACH;AAEA,UAAM,EAAE,OAAO,IAAI;AAEnB,WAAQ,MAAM,qBAAqB;AAAA,MACjC;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,YAAY;AAAA,IACvB,CAAC;AAAA,EACH;AACF","sourcesContent":["import type {\n PermissionSpecificationBuilder,\n RestrictedMethodOptions,\n ValidPermissionSpecification,\n PermissionValidatorConstraint,\n PermissionSideEffect,\n} from '@metamask/permission-controller';\nimport { PermissionType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type {\n InvokeSnapResult,\n RequestSnapsParams,\n RequestSnapsResult,\n} from '@metamask/snaps-sdk';\nimport type { Snap, SnapRpcHookArgs } from '@metamask/snaps-utils';\nimport { HandlerType, SnapCaveatType } from '@metamask/snaps-utils';\nimport type { Json, NonEmptyArray } from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\n\nexport const WALLET_SNAP_PERMISSION_KEY = 'wallet_snap';\n\n// Redeclare installSnaps action type to avoid circular dependencies\nexport type InstallSnaps = {\n type: `SnapController:install`;\n handler: (\n origin: string,\n requestedSnaps: RequestSnapsParams,\n ) => Promise<RequestSnapsResult>;\n};\n\nexport type GetPermittedSnaps = {\n type: `SnapController:getPermitted`;\n handler: (origin: string) => RequestSnapsResult;\n};\n\ntype AllowedActions = InstallSnaps | GetPermittedSnaps;\n\nexport type InvokeSnapMethodHooks = {\n getSnap: (snapId: string) => Snap | undefined;\n handleSnapRpcRequest: ({\n snapId,\n origin,\n handler,\n request,\n }: SnapRpcHookArgs & { snapId: string }) => Promise<unknown>;\n};\n\ntype InvokeSnapSpecificationBuilderOptions = {\n allowedCaveats?: Readonly<NonEmptyArray<string>> | null;\n methodHooks: InvokeSnapMethodHooks;\n};\n\ntype InvokeSnapSpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof WALLET_SNAP_PERMISSION_KEY;\n methodImplementation: ReturnType<typeof getInvokeSnapImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n validator: PermissionValidatorConstraint;\n sideEffect: {\n onPermitted: PermissionSideEffect<AllowedActions, never>['onPermitted'];\n };\n}>;\n\nexport type InvokeSnapParams = {\n snapId: string;\n request: Record<string, Json>;\n};\n\n/**\n * The side-effect method to handle the snap install.\n *\n * @param params - The side-effect params.\n * @param params.requestData - The request data associated to the requested permission.\n * @param params.messagingSystem - The messenger to call an action.\n */\nexport const handleSnapInstall: PermissionSideEffect<\n AllowedActions,\n never\n>['onPermitted'] = async ({ requestData, messagingSystem }) => {\n const snaps = requestData.permissions[WALLET_SNAP_PERMISSION_KEY].caveats?.[0]\n .value as RequestSnapsParams;\n\n const permittedSnaps = messagingSystem.call(\n `SnapController:getPermitted`,\n requestData.metadata.origin,\n );\n\n const dedupedSnaps = Object.keys(snaps).reduce<RequestSnapsParams>(\n (filteredSnaps, snap) => {\n if (!permittedSnaps[snap]) {\n filteredSnaps[snap] = snaps[snap];\n }\n return filteredSnaps;\n },\n {},\n );\n\n return messagingSystem.call(\n `SnapController:install`,\n requestData.metadata.origin,\n dedupedSnaps,\n );\n};\n/**\n * The specification builder for the `wallet_snap_*` permission.\n *\n * `wallet_snap_*` attempts to invoke an RPC method of the specified Snap.\n *\n * Requesting its corresponding permission will attempt to connect to the Snap,\n * and install it if it's not available yet.\n *\n * @param options - The specification builder options.\n * @param options.methodHooks - The RPC method hooks needed by the method implementation.\n * @returns The specification for the `wallet_snap_*` permission.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n InvokeSnapSpecificationBuilderOptions,\n InvokeSnapSpecification\n> = ({ methodHooks }: InvokeSnapSpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName: WALLET_SNAP_PERMISSION_KEY,\n allowedCaveats: [SnapCaveatType.SnapIds],\n methodImplementation: getInvokeSnapImplementation(methodHooks),\n validator: ({ caveats }) => {\n if (caveats?.length !== 1 || caveats[0].type !== SnapCaveatType.SnapIds) {\n throw rpcErrors.invalidParams({\n message: `Expected a single \"${SnapCaveatType.SnapIds}\" caveat.`,\n });\n }\n },\n sideEffect: {\n onPermitted: handleSnapInstall,\n },\n };\n};\n\nconst methodHooks: MethodHooksObject<InvokeSnapMethodHooks> = {\n getSnap: true,\n handleSnapRpcRequest: true,\n};\n\nexport const invokeSnapBuilder = Object.freeze({\n targetName: WALLET_SNAP_PERMISSION_KEY,\n specificationBuilder,\n methodHooks,\n} as const);\n\n/**\n * Builds the method implementation for `wallet_snap_*`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.getSnap - A function that retrieves all information stored about a snap.\n * @param hooks.handleSnapRpcRequest - A function that sends an RPC request to a snap's RPC handler or throws if that fails.\n * @returns The method implementation which returns the result of `handleSnapRpcRequest`.\n * @throws If the params are invalid.\n */\nexport function getInvokeSnapImplementation({\n getSnap,\n handleSnapRpcRequest,\n}: InvokeSnapMethodHooks) {\n return async function invokeSnap(\n options: RestrictedMethodOptions<InvokeSnapParams>,\n ): Promise<InvokeSnapResult> {\n const { params = {}, context } = options;\n\n const { snapId, request } = params as InvokeSnapParams;\n\n if (!getSnap(snapId)) {\n throw rpcErrors.invalidRequest({\n message: `The snap \"${snapId}\" is not installed. Please install it first, before invoking the snap.`,\n });\n }\n\n const { origin } = context;\n\n return (await handleSnapRpcRequest({\n snapId,\n origin,\n request,\n handler: HandlerType.OnRpcRequest,\n })) as Json;\n };\n}\n"]}
@@ -1,54 +0,0 @@
1
- // src/restricted/caveats/snapIds.ts
2
- import { rpcErrors } from "@metamask/rpc-errors";
3
- import { SnapCaveatType, SnapIdsStruct } from "@metamask/snaps-utils";
4
- import { type } from "@metamask/superstruct";
5
- import { hasProperty, assertStruct } from "@metamask/utils";
6
- function snapIdsCaveatMapper(value) {
7
- return {
8
- caveats: [
9
- {
10
- type: SnapCaveatType.SnapIds,
11
- value
12
- }
13
- ]
14
- };
15
- }
16
- function validateSnapIdsCaveat(caveat) {
17
- assertStruct(
18
- caveat,
19
- type({
20
- value: SnapIdsStruct
21
- }),
22
- "Expected caveat to have a value property of a non-empty object of snap IDs.",
23
- rpcErrors.invalidParams
24
- );
25
- }
26
- var SnapIdsCaveatSpecification = {
27
- [SnapCaveatType.SnapIds]: Object.freeze({
28
- type: SnapCaveatType.SnapIds,
29
- validator: (caveat) => validateSnapIdsCaveat(caveat),
30
- decorator: (method, caveat) => {
31
- return async (args) => {
32
- const {
33
- params,
34
- context: { origin }
35
- } = args;
36
- const snapIds = caveat.value;
37
- const { snapId } = params;
38
- if (!hasProperty(snapIds, snapId)) {
39
- throw new Error(
40
- `${origin} does not have permission to invoke ${snapId} snap.`
41
- );
42
- }
43
- return await method(args);
44
- };
45
- }
46
- })
47
- };
48
-
49
- export {
50
- snapIdsCaveatMapper,
51
- validateSnapIdsCaveat,
52
- SnapIdsCaveatSpecification
53
- };
54
- //# sourceMappingURL=chunk-FJ7COFRJ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/restricted/caveats/snapIds.ts"],"sourcesContent":["import type {\n Caveat,\n RestrictedMethodOptions,\n RestrictedMethodParameters,\n RestrictedMethodCaveatSpecificationConstraint,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { SnapIds } from '@metamask/snaps-utils';\nimport { SnapCaveatType, SnapIdsStruct } from '@metamask/snaps-utils';\nimport { type } from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\nimport { hasProperty, assertStruct } from '@metamask/utils';\n\nimport type { InvokeSnapParams } from '../invokeSnap';\n\n/**\n * Map a raw value from the `initialPermissions` to a caveat specification.\n * Note that this function does not do any validation, that's handled by the\n * PermissionsController when the permission is requested.\n *\n * @param value - The raw value from the `initialPermissions`.\n * @returns The caveat specification.\n */\nexport function snapIdsCaveatMapper(\n value: Json,\n): Pick<PermissionConstraint, 'caveats'> {\n return {\n caveats: [\n {\n type: SnapCaveatType.SnapIds,\n value,\n },\n ],\n };\n}\n\n/**\n * Validates that the caveat value exists and is a non-empty object.\n *\n * @param caveat - The caveat to validate.\n * @throws If the caveat is invalid.\n */\nexport function validateSnapIdsCaveat(\n caveat: Caveat<string, any>,\n): asserts caveat is Caveat<string, SnapIds> {\n assertStruct(\n caveat,\n type({\n value: SnapIdsStruct,\n }),\n 'Expected caveat to have a value property of a non-empty object of snap IDs.',\n rpcErrors.invalidParams,\n );\n}\n\nexport const SnapIdsCaveatSpecification: Record<\n SnapCaveatType.SnapIds,\n RestrictedMethodCaveatSpecificationConstraint\n> = {\n [SnapCaveatType.SnapIds]: Object.freeze({\n type: SnapCaveatType.SnapIds,\n validator: (caveat) => validateSnapIdsCaveat(caveat),\n decorator: (method, caveat) => {\n return async (args) => {\n const {\n params,\n context: { origin },\n }: RestrictedMethodOptions<RestrictedMethodParameters> = args;\n const snapIds = caveat.value as SnapIds;\n const { snapId } = params as InvokeSnapParams;\n if (!hasProperty(snapIds, snapId)) {\n throw new Error(\n `${origin} does not have permission to invoke ${snapId} snap.`,\n );\n }\n return await method(args);\n };\n },\n }),\n};\n"],"mappings":";AAOA,SAAS,iBAAiB;AAE1B,SAAS,gBAAgB,qBAAqB;AAC9C,SAAS,YAAY;AAErB,SAAS,aAAa,oBAAoB;AAYnC,SAAS,oBACd,OACuC;AACvC,SAAO;AAAA,IACL,SAAS;AAAA,MACP;AAAA,QACE,MAAM,eAAe;AAAA,QACrB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAQO,SAAS,sBACd,QAC2C;AAC3C;AAAA,IACE;AAAA,IACA,KAAK;AAAA,MACH,OAAO;AAAA,IACT,CAAC;AAAA,IACD;AAAA,IACA,UAAU;AAAA,EACZ;AACF;AAEO,IAAM,6BAGT;AAAA,EACF,CAAC,eAAe,OAAO,GAAG,OAAO,OAAO;AAAA,IACtC,MAAM,eAAe;AAAA,IACrB,WAAW,CAAC,WAAW,sBAAsB,MAAM;AAAA,IACnD,WAAW,CAAC,QAAQ,WAAW;AAC7B,aAAO,OAAO,SAAS;AACrB,cAAM;AAAA,UACJ;AAAA,UACA,SAAS,EAAE,OAAO;AAAA,QACpB,IAAyD;AACzD,cAAM,UAAU,OAAO;AACvB,cAAM,EAAE,OAAO,IAAI;AACnB,YAAI,CAAC,YAAY,SAAS,MAAM,GAAG;AACjC,gBAAM,IAAI;AAAA,YACR,GAAG,MAAM,uCAAuC,MAAM;AAAA,UACxD;AAAA,QACF;AACA,eAAO,MAAM,OAAO,IAAI;AAAA,MAC1B;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -1,34 +0,0 @@
1
- // src/restricted/getPreferences.ts
2
- import { PermissionType, SubjectType } from "@metamask/permission-controller";
3
- var methodName = "snap_getPreferences";
4
- var specificationBuilder = ({ allowedCaveats = null, methodHooks: methodHooks2 }) => {
5
- return {
6
- permissionType: PermissionType.RestrictedMethod,
7
- targetName: methodName,
8
- allowedCaveats,
9
- methodImplementation: getImplementation(methodHooks2),
10
- subjectTypes: [SubjectType.Snap]
11
- };
12
- };
13
- var methodHooks = {
14
- getPreferences: true
15
- };
16
- var getPreferencesBuilder = Object.freeze({
17
- targetName: methodName,
18
- specificationBuilder,
19
- methodHooks
20
- });
21
- function getImplementation({
22
- getPreferences
23
- }) {
24
- return async function implementation(_args) {
25
- return getPreferences();
26
- };
27
- }
28
-
29
- export {
30
- specificationBuilder,
31
- getPreferencesBuilder,
32
- getImplementation
33
- };
34
- //# sourceMappingURL=chunk-FM4LNQR7.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/restricted/getPreferences.ts"],"sourcesContent":["import type {\n PermissionSpecificationBuilder,\n ValidPermissionSpecification,\n RestrictedMethodOptions,\n RestrictedMethodParameters,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport type { GetPreferencesResult } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\n\nconst methodName = 'snap_getPreferences';\n\nexport type GetPreferencesMethodHooks = {\n getPreferences: () => GetPreferencesResult;\n};\n\ntype SpecificationBuilderOptions = {\n allowedCaveats?: Readonly<NonEmptyArray<string>> | null;\n methodHooks: GetPreferencesMethodHooks;\n};\n\ntype Specification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof methodName;\n methodImplementation: ReturnType<typeof getImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n}>;\n\n/**\n * The specification builder for the `snap_getPreferences` permission.\n * `snap_getPreferences` allows snaps to access user preferences.\n *\n * @param options - The specification builder options.\n * @param options.allowedCaveats - The optional allowed caveats for the permission.\n * @param options.methodHooks - The RPC method hooks needed by the method implementation.\n * @returns The specification for the `snap_getPreferences` permission.\n */\nexport const specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n SpecificationBuilderOptions,\n Specification\n> = ({ allowedCaveats = null, methodHooks }: SpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName: methodName,\n allowedCaveats,\n methodImplementation: getImplementation(methodHooks),\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nconst methodHooks: MethodHooksObject<GetPreferencesMethodHooks> = {\n getPreferences: true,\n};\n\nexport const getPreferencesBuilder = Object.freeze({\n targetName: methodName,\n specificationBuilder,\n methodHooks,\n} as const);\n\n/**\n * Builds the method implementation for `snap_getPreferences`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.getPreferences - A function that returns the user selected preferences.\n * @returns The user preferences.\n */\nexport function getImplementation({\n getPreferences,\n}: GetPreferencesMethodHooks) {\n return async function implementation(\n _args: RestrictedMethodOptions<RestrictedMethodParameters>,\n ): Promise<GetPreferencesResult> {\n return getPreferences();\n };\n}\n"],"mappings":";AAMA,SAAS,gBAAgB,mBAAmB;AAM5C,IAAM,aAAa;AA2BZ,IAAM,uBAIT,CAAC,EAAE,iBAAiB,MAAM,aAAAA,aAAY,MAAmC;AAC3E,SAAO;AAAA,IACL,gBAAgB,eAAe;AAAA,IAC/B,YAAY;AAAA,IACZ;AAAA,IACA,sBAAsB,kBAAkBA,YAAW;AAAA,IACnD,cAAc,CAAC,YAAY,IAAI;AAAA,EACjC;AACF;AAEA,IAAM,cAA4D;AAAA,EAChE,gBAAgB;AAClB;AAEO,IAAM,wBAAwB,OAAO,OAAO;AAAA,EACjD,YAAY;AAAA,EACZ;AAAA,EACA;AACF,CAAU;AASH,SAAS,kBAAkB;AAAA,EAChC;AACF,GAA8B;AAC5B,SAAO,eAAe,eACpB,OAC+B;AAC/B,WAAO,eAAe;AAAA,EACxB;AACF;","names":["methodHooks"]}
@@ -1,21 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/endowments/lifecycle-hooks.ts
2
- var _permissioncontroller = require('@metamask/permission-controller');
3
- var permissionName = "endowment:lifecycle-hooks" /* LifecycleHooks */;
4
- var specificationBuilder = (_builderOptions) => {
5
- return {
6
- permissionType: _permissioncontroller.PermissionType.Endowment,
7
- targetName: permissionName,
8
- allowedCaveats: null,
9
- endowmentGetter: (_getterOptions) => null,
10
- subjectTypes: [_permissioncontroller.SubjectType.Snap]
11
- };
12
- };
13
- var lifecycleHooksEndowmentBuilder = Object.freeze({
14
- targetName: permissionName,
15
- specificationBuilder
16
- });
17
-
18
-
19
-
20
- exports.lifecycleHooksEndowmentBuilder = lifecycleHooksEndowmentBuilder;
21
- //# sourceMappingURL=chunk-GE5XFDUE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/endowments/lifecycle-hooks.ts"],"names":[],"mappings":";AAKA,SAAS,gBAAgB,mBAAmB;AAK5C,IAAM;AAiBN,IAAM,uBAIF,CAAC,oBAA8B;AACjC,SAAO;AAAA,IACL,gBAAgB,eAAe;AAAA,IAC/B,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,iBAAiB,CAAC,mBAA2C;AAAA,IAC7D,cAAc,CAAC,YAAY,IAAI;AAAA,EACjC;AACF;AAEO,IAAM,iCAAiC,OAAO,OAAO;AAAA,EAC1D,YAAY;AAAA,EACZ;AACF,CAAU","sourcesContent":["import type {\n PermissionSpecificationBuilder,\n EndowmentGetterParams,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport type { NonEmptyArray } from '@metamask/utils';\n\nimport { SnapEndowments } from './enum';\n\nconst permissionName = SnapEndowments.LifecycleHooks;\n\ntype LifecycleHooksEndowmentSpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.Endowment;\n targetName: typeof permissionName;\n endowmentGetter: (_options?: EndowmentGetterParams) => null;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n}>;\n\n/**\n * `endowment:lifecycle-hooks` returns nothing; it is intended to be used as a\n * flag by the snap controller to detect whether the snap has the capability to\n * use lifecycle hooks.\n *\n * @param _builderOptions - Optional specification builder options.\n * @returns The specification for the `lifecycle-hooks` endowment.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.Endowment,\n any,\n LifecycleHooksEndowmentSpecification\n> = (_builderOptions?: unknown) => {\n return {\n permissionType: PermissionType.Endowment,\n targetName: permissionName,\n allowedCaveats: null,\n endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nexport const lifecycleHooksEndowmentBuilder = Object.freeze({\n targetName: permissionName,\n specificationBuilder,\n} as const);\n"]}