@metamask/snaps-rpc-methods 10.0.1 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (698) hide show
  1. package/CHANGELOG.md +20 -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} +5 -4
  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} +12 -11
  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} +8 -7
  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 -121
  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 -42
  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 -47
  165. package/dist/permitted/createInterface.d.cts.map +1 -0
  166. package/dist/permitted/createInterface.d.mts +181 -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} +5 -4
  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} +5 -4
  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} +6 -5
  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} +6 -5
  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} +5 -4
  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/{types/permitted/handlers.d.ts → permitted/handlers.d.cts} +1 -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} +5 -4
  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} +6 -5
  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} +5 -4
  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} +8 -7
  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} +62 -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 +432 -0
  309. package/dist/restricted/dialog.d.cts.map +1 -0
  310. package/dist/restricted/dialog.d.mts +432 -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} +8 -7
  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} +9 -8
  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} +8 -7
  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} +10 -9
  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} +13 -11
  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/restricted/getPreferences.d.cts +49 -0
  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 +41 -0
  361. package/dist/restricted/getPreferences.mjs.map +1 -0
  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} +31 -16
  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 -34
  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} +14 -12
  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} +10 -9
  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} +10 -9
  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} +11 -10
  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} +9 -7
  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-4TUORIA6.js +0 -59
  437. package/dist/chunk-4TUORIA6.js.map +0 -1
  438. package/dist/chunk-57BL7O2P.mjs +0 -69
  439. package/dist/chunk-57BL7O2P.mjs.map +0 -1
  440. package/dist/chunk-62URQ5VS.mjs +0 -18
  441. package/dist/chunk-62URQ5VS.mjs.map +0 -1
  442. package/dist/chunk-6VJVURH5.js +0 -43
  443. package/dist/chunk-6VJVURH5.js.map +0 -1
  444. package/dist/chunk-756OQVOC.js +0 -67
  445. package/dist/chunk-756OQVOC.js.map +0 -1
  446. package/dist/chunk-7CV677MM.js +0 -42
  447. package/dist/chunk-7CV677MM.js.map +0 -1
  448. package/dist/chunk-7HVABE5R.js +0 -74
  449. package/dist/chunk-7HVABE5R.js.map +0 -1
  450. package/dist/chunk-7P6TF6CE.mjs +0 -55
  451. package/dist/chunk-7P6TF6CE.mjs.map +0 -1
  452. package/dist/chunk-7TVJV425.js +0 -1
  453. package/dist/chunk-7TVJV425.js.map +0 -1
  454. package/dist/chunk-A6H6I4VH.js +0 -61
  455. package/dist/chunk-A6H6I4VH.js.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-BSAXPL2T.mjs +0 -59
  461. package/dist/chunk-BSAXPL2T.mjs.map +0 -1
  462. package/dist/chunk-CD4OUHO5.mjs +0 -20
  463. package/dist/chunk-CD4OUHO5.mjs.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-FNUO7MQ4.mjs +0 -43
  482. package/dist/chunk-FNUO7MQ4.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-GPV4ETUH.mjs +0 -47
  486. package/dist/chunk-GPV4ETUH.mjs.map +0 -1
  487. package/dist/chunk-H6X3CWWQ.js +0 -54
  488. package/dist/chunk-H6X3CWWQ.js.map +0 -1
  489. package/dist/chunk-HOECEYMT.mjs +0 -70
  490. package/dist/chunk-HOECEYMT.mjs.map +0 -1
  491. package/dist/chunk-HZQ34FQT.js +0 -49
  492. package/dist/chunk-HZQ34FQT.js.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-IZYMBIBD.mjs +0 -32
  500. package/dist/chunk-IZYMBIBD.mjs.map +0 -1
  501. package/dist/chunk-JWDQUKKU.mjs +0 -80
  502. package/dist/chunk-JWDQUKKU.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-LR7UR4YU.mjs +0 -52
  508. package/dist/chunk-LR7UR4YU.mjs.map +0 -1
  509. package/dist/chunk-LXJBBRQ4.mjs +0 -57
  510. package/dist/chunk-LXJBBRQ4.mjs.map +0 -1
  511. package/dist/chunk-M2JQCKR7.js +0 -143
  512. package/dist/chunk-M2JQCKR7.js.map +0 -1
  513. package/dist/chunk-MC2Z4NF6.mjs +0 -45
  514. package/dist/chunk-MC2Z4NF6.mjs.map +0 -1
  515. package/dist/chunk-MXPVC2XP.mjs +0 -105
  516. package/dist/chunk-MXPVC2XP.mjs.map +0 -1
  517. package/dist/chunk-NU4NAAFG.js +0 -1
  518. package/dist/chunk-NU4NAAFG.js.map +0 -1
  519. package/dist/chunk-NWT2EXFD.js +0 -18
  520. package/dist/chunk-NWT2EXFD.js.map +0 -1
  521. package/dist/chunk-O66NZFSD.mjs +0 -23
  522. package/dist/chunk-O66NZFSD.mjs.map +0 -1
  523. package/dist/chunk-ODN35VOK.mjs +0 -119
  524. package/dist/chunk-ODN35VOK.mjs.map +0 -1
  525. package/dist/chunk-OI33OL7K.js +0 -47
  526. package/dist/chunk-OI33OL7K.js.map +0 -1
  527. package/dist/chunk-PIAWDTWO.mjs +0 -68
  528. package/dist/chunk-PIAWDTWO.mjs.map +0 -1
  529. package/dist/chunk-PIRQCNBJ.mjs +0 -78
  530. package/dist/chunk-PIRQCNBJ.mjs.map +0 -1
  531. package/dist/chunk-PS6OEQXL.js +0 -105
  532. package/dist/chunk-PS6OEQXL.js.map +0 -1
  533. package/dist/chunk-PXU6PORA.js +0 -119
  534. package/dist/chunk-PXU6PORA.js.map +0 -1
  535. package/dist/chunk-Q27K2I6Z.js +0 -23
  536. package/dist/chunk-Q27K2I6Z.js.map +0 -1
  537. package/dist/chunk-QDZAWH6F.js +0 -80
  538. package/dist/chunk-QDZAWH6F.js.map +0 -1
  539. package/dist/chunk-QMULJEYN.js +0 -35
  540. package/dist/chunk-QMULJEYN.js.map +0 -1
  541. package/dist/chunk-SYB5TG5O.mjs +0 -49
  542. package/dist/chunk-SYB5TG5O.mjs.map +0 -1
  543. package/dist/chunk-SYUGPLEP.js +0 -32
  544. package/dist/chunk-SYUGPLEP.js.map +0 -1
  545. package/dist/chunk-T56DKVFS.js +0 -70
  546. package/dist/chunk-T56DKVFS.js.map +0 -1
  547. package/dist/chunk-TAXLFFV4.mjs +0 -115
  548. package/dist/chunk-TAXLFFV4.mjs.map +0 -1
  549. package/dist/chunk-TE4W25CA.mjs +0 -143
  550. package/dist/chunk-TE4W25CA.mjs.map +0 -1
  551. package/dist/chunk-TG63GBK3.mjs +0 -1
  552. package/dist/chunk-TG63GBK3.mjs.map +0 -1
  553. package/dist/chunk-TNENASGX.mjs +0 -1
  554. package/dist/chunk-TNENASGX.mjs.map +0 -1
  555. package/dist/chunk-TQCUJQHY.mjs +0 -196
  556. package/dist/chunk-TQCUJQHY.mjs.map +0 -1
  557. package/dist/chunk-TT4DP2YW.mjs +0 -35
  558. package/dist/chunk-TT4DP2YW.mjs.map +0 -1
  559. package/dist/chunk-TVC3E5LI.mjs +0 -42
  560. package/dist/chunk-TVC3E5LI.mjs.map +0 -1
  561. package/dist/chunk-U6TJQLNV.js +0 -45
  562. package/dist/chunk-U6TJQLNV.js.map +0 -1
  563. package/dist/chunk-UB3733UY.mjs +0 -23
  564. package/dist/chunk-UB3733UY.mjs.map +0 -1
  565. package/dist/chunk-UCWANXBZ.js +0 -45
  566. package/dist/chunk-UCWANXBZ.js.map +0 -1
  567. package/dist/chunk-UF3UJTY3.js +0 -55
  568. package/dist/chunk-UF3UJTY3.js.map +0 -1
  569. package/dist/chunk-UY4DUF53.mjs +0 -45
  570. package/dist/chunk-UY4DUF53.mjs.map +0 -1
  571. package/dist/chunk-VUA6ICJO.js +0 -52
  572. package/dist/chunk-VUA6ICJO.js.map +0 -1
  573. package/dist/chunk-VVBTXSID.mjs +0 -82
  574. package/dist/chunk-VVBTXSID.mjs.map +0 -1
  575. package/dist/chunk-VYII7C3J.mjs +0 -79
  576. package/dist/chunk-VYII7C3J.mjs.map +0 -1
  577. package/dist/chunk-W33UWNA2.mjs +0 -90
  578. package/dist/chunk-W33UWNA2.mjs.map +0 -1
  579. package/dist/chunk-XGMYBPQR.mjs +0 -47
  580. package/dist/chunk-XGMYBPQR.mjs.map +0 -1
  581. package/dist/chunk-YGKFOOWI.js +0 -20
  582. package/dist/chunk-YGKFOOWI.js.map +0 -1
  583. package/dist/chunk-YOHE52XB.js +0 -23
  584. package/dist/chunk-YOHE52XB.js.map +0 -1
  585. package/dist/chunk-YT2Q3W5C.js +0 -69
  586. package/dist/chunk-YT2Q3W5C.js.map +0 -1
  587. package/dist/chunk-YZMFLB67.js +0 -75
  588. package/dist/chunk-YZMFLB67.js.map +0 -1
  589. package/dist/chunk-Z6YFGWHN.mjs +0 -61
  590. package/dist/chunk-Z6YFGWHN.mjs.map +0 -1
  591. package/dist/chunk-ZH3FC55E.mjs +0 -21
  592. package/dist/chunk-ZH3FC55E.mjs.map +0 -1
  593. package/dist/chunk-ZKISN6YP.js +0 -67
  594. package/dist/chunk-ZKISN6YP.js.map +0 -1
  595. package/dist/chunk-ZXDCQWMJ.mjs +0 -39
  596. package/dist/chunk-ZXDCQWMJ.mjs.map +0 -1
  597. package/dist/endowments/caveats/generic.js +0 -7
  598. package/dist/endowments/caveats/generic.js.map +0 -1
  599. package/dist/endowments/caveats/index.js +0 -18
  600. package/dist/endowments/caveats/index.js.map +0 -1
  601. package/dist/endowments/caveats/requestTime.js +0 -13
  602. package/dist/endowments/caveats/requestTime.js.map +0 -1
  603. package/dist/endowments/cronjob.js +0 -16
  604. package/dist/endowments/cronjob.js.map +0 -1
  605. package/dist/endowments/enum.js +0 -7
  606. package/dist/endowments/enum.js.map +0 -1
  607. package/dist/endowments/ethereum-provider.js +0 -8
  608. package/dist/endowments/ethereum-provider.js.map +0 -1
  609. package/dist/endowments/home-page.js +0 -8
  610. package/dist/endowments/home-page.js.map +0 -1
  611. package/dist/endowments/index.js +0 -54
  612. package/dist/endowments/index.js.map +0 -1
  613. package/dist/endowments/keyring.js +0 -17
  614. package/dist/endowments/keyring.js.map +0 -1
  615. package/dist/endowments/lifecycle-hooks.js +0 -8
  616. package/dist/endowments/lifecycle-hooks.js.map +0 -1
  617. package/dist/endowments/name-lookup.js +0 -19
  618. package/dist/endowments/name-lookup.js.map +0 -1
  619. package/dist/endowments/network-access.js +0 -8
  620. package/dist/endowments/network-access.js.map +0 -1
  621. package/dist/endowments/rpc.js +0 -17
  622. package/dist/endowments/rpc.js.map +0 -1
  623. package/dist/endowments/signature-insight.js +0 -17
  624. package/dist/endowments/signature-insight.js.map +0 -1
  625. package/dist/endowments/transaction-insight.js +0 -17
  626. package/dist/endowments/transaction-insight.js.map +0 -1
  627. package/dist/endowments/web-assembly.js +0 -8
  628. package/dist/endowments/web-assembly.js.map +0 -1
  629. package/dist/index.js +0 -122
  630. package/dist/index.js.map +0 -1
  631. package/dist/permissions.js +0 -43
  632. package/dist/permissions.js.map +0 -1
  633. package/dist/permitted/createInterface.js +0 -7
  634. package/dist/permitted/createInterface.js.map +0 -1
  635. package/dist/permitted/getAllSnaps.js +0 -7
  636. package/dist/permitted/getAllSnaps.js.map +0 -1
  637. package/dist/permitted/getClientStatus.js +0 -7
  638. package/dist/permitted/getClientStatus.js.map +0 -1
  639. package/dist/permitted/getFile.js +0 -9
  640. package/dist/permitted/getFile.js.map +0 -1
  641. package/dist/permitted/getInterfaceState.js +0 -7
  642. package/dist/permitted/getInterfaceState.js.map +0 -1
  643. package/dist/permitted/getSnaps.js +0 -7
  644. package/dist/permitted/getSnaps.js.map +0 -1
  645. package/dist/permitted/handlers.js +0 -21
  646. package/dist/permitted/handlers.js.map +0 -1
  647. package/dist/permitted/index.js +0 -27
  648. package/dist/permitted/index.js.map +0 -1
  649. package/dist/permitted/invokeKeyring.js +0 -8
  650. package/dist/permitted/invokeKeyring.js.map +0 -1
  651. package/dist/permitted/invokeSnapSugar.js +0 -11
  652. package/dist/permitted/invokeSnapSugar.js.map +0 -1
  653. package/dist/permitted/middleware.js +0 -21
  654. package/dist/permitted/middleware.js.map +0 -1
  655. package/dist/permitted/requestSnaps.js +0 -12
  656. package/dist/permitted/requestSnaps.js.map +0 -1
  657. package/dist/permitted/resolveInterface.js +0 -7
  658. package/dist/permitted/resolveInterface.js.map +0 -1
  659. package/dist/permitted/updateInterface.js +0 -7
  660. package/dist/permitted/updateInterface.js.map +0 -1
  661. package/dist/restricted/caveats/index.js +0 -17
  662. package/dist/restricted/caveats/index.js.map +0 -1
  663. package/dist/restricted/caveats/permittedCoinTypes.js +0 -13
  664. package/dist/restricted/caveats/permittedCoinTypes.js.map +0 -1
  665. package/dist/restricted/caveats/permittedDerivationPaths.js +0 -13
  666. package/dist/restricted/caveats/permittedDerivationPaths.js.map +0 -1
  667. package/dist/restricted/caveats/snapIds.js +0 -11
  668. package/dist/restricted/caveats/snapIds.js.map +0 -1
  669. package/dist/restricted/dialog.js +0 -11
  670. package/dist/restricted/dialog.js.map +0 -1
  671. package/dist/restricted/getBip32Entropy.js +0 -10
  672. package/dist/restricted/getBip32Entropy.js.map +0 -1
  673. package/dist/restricted/getBip32PublicKey.js +0 -12
  674. package/dist/restricted/getBip32PublicKey.js.map +0 -1
  675. package/dist/restricted/getBip44Entropy.js +0 -9
  676. package/dist/restricted/getBip44Entropy.js.map +0 -1
  677. package/dist/restricted/getEntropy.js +0 -10
  678. package/dist/restricted/getEntropy.js.map +0 -1
  679. package/dist/restricted/getLocale.js +0 -11
  680. package/dist/restricted/getLocale.js.map +0 -1
  681. package/dist/restricted/index.js +0 -36
  682. package/dist/restricted/index.js.map +0 -1
  683. package/dist/restricted/invokeSnap.js +0 -13
  684. package/dist/restricted/invokeSnap.js.map +0 -1
  685. package/dist/restricted/manageAccounts.js +0 -13
  686. package/dist/restricted/manageAccounts.js.map +0 -1
  687. package/dist/restricted/manageState.js +0 -20
  688. package/dist/restricted/manageState.js.map +0 -1
  689. package/dist/restricted/notify.js +0 -13
  690. package/dist/restricted/notify.js.map +0 -1
  691. package/dist/tsconfig.build.tsbuildinfo +0 -1
  692. package/dist/types/__fixtures__/index.d.ts +0 -1
  693. package/dist/types/endowments/caveats/index.d.ts +0 -2
  694. package/dist/types/index.d.ts +0 -7
  695. package/dist/types/permitted/index.d.ts +0 -11
  696. package/dist/types/restricted/dialog.d.ts +0 -1351
  697. package/dist/utils.js +0 -13
  698. package/dist/utils.js.map +0 -1
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.DIALOG_APPROVAL_TYPES = exports.restrictedMethodPermissionBuilders = exports.getEncryptionEntropy = exports.WALLET_SNAP_PERMISSION_KEY = void 0;
18
+ const dialog_1 = require("./dialog.cjs");
19
+ const getBip32Entropy_1 = require("./getBip32Entropy.cjs");
20
+ const getBip32PublicKey_1 = require("./getBip32PublicKey.cjs");
21
+ const getBip44Entropy_1 = require("./getBip44Entropy.cjs");
22
+ const getEntropy_1 = require("./getEntropy.cjs");
23
+ const getLocale_1 = require("./getLocale.cjs");
24
+ const getPreferences_1 = require("./getPreferences.cjs");
25
+ const invokeSnap_1 = require("./invokeSnap.cjs");
26
+ const manageAccounts_1 = require("./manageAccounts.cjs");
27
+ const manageState_1 = require("./manageState.cjs");
28
+ const notify_1 = require("./notify.cjs");
29
+ var invokeSnap_2 = require("./invokeSnap.cjs");
30
+ Object.defineProperty(exports, "WALLET_SNAP_PERMISSION_KEY", { enumerable: true, get: function () { return invokeSnap_2.WALLET_SNAP_PERMISSION_KEY; } });
31
+ var manageState_2 = require("./manageState.cjs");
32
+ Object.defineProperty(exports, "getEncryptionEntropy", { enumerable: true, get: function () { return manageState_2.getEncryptionEntropy; } });
33
+ exports.restrictedMethodPermissionBuilders = {
34
+ [dialog_1.dialogBuilder.targetName]: dialog_1.dialogBuilder,
35
+ [getBip32Entropy_1.getBip32EntropyBuilder.targetName]: getBip32Entropy_1.getBip32EntropyBuilder,
36
+ [getBip32PublicKey_1.getBip32PublicKeyBuilder.targetName]: getBip32PublicKey_1.getBip32PublicKeyBuilder,
37
+ [getBip44Entropy_1.getBip44EntropyBuilder.targetName]: getBip44Entropy_1.getBip44EntropyBuilder,
38
+ [getEntropy_1.getEntropyBuilder.targetName]: getEntropy_1.getEntropyBuilder,
39
+ [invokeSnap_1.invokeSnapBuilder.targetName]: invokeSnap_1.invokeSnapBuilder,
40
+ [manageState_1.manageStateBuilder.targetName]: manageState_1.manageStateBuilder,
41
+ [notify_1.notifyBuilder.targetName]: notify_1.notifyBuilder,
42
+ [manageAccounts_1.manageAccountsBuilder.targetName]: manageAccounts_1.manageAccountsBuilder,
43
+ [getLocale_1.getLocaleBuilder.targetName]: getLocale_1.getLocaleBuilder,
44
+ [getPreferences_1.getPreferencesBuilder.targetName]: getPreferences_1.getPreferencesBuilder,
45
+ };
46
+ __exportStar(require("./caveats/index.cjs"), exports);
47
+ var dialog_2 = require("./dialog.cjs");
48
+ Object.defineProperty(exports, "DIALOG_APPROVAL_TYPES", { enumerable: true, get: function () { return dialog_2.DIALOG_APPROVAL_TYPES; } });
49
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/restricted/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,yCAAyC;AAEzC,2DAA2D;AAE3D,+DAA+D;AAE/D,2DAA2D;AAE3D,iDAAiD;AAEjD,+CAA+C;AAE/C,yDAAyD;AAEzD,iDAAiD;AAEjD,yDAAyD;AAEzD,mDAAmD;AAEnD,yCAAyC;AAEzC,+CAA0D;AAAjD,wHAAA,0BAA0B,OAAA;AACnC,iDAAqD;AAA5C,mHAAA,oBAAoB,OAAA;AAchB,QAAA,kCAAkC,GAAG;IAChD,CAAC,sBAAa,CAAC,UAAU,CAAC,EAAE,sBAAa;IACzC,CAAC,wCAAsB,CAAC,UAAU,CAAC,EAAE,wCAAsB;IAC3D,CAAC,4CAAwB,CAAC,UAAU,CAAC,EAAE,4CAAwB;IAC/D,CAAC,wCAAsB,CAAC,UAAU,CAAC,EAAE,wCAAsB;IAC3D,CAAC,8BAAiB,CAAC,UAAU,CAAC,EAAE,8BAAiB;IACjD,CAAC,8BAAiB,CAAC,UAAU,CAAC,EAAE,8BAAiB;IACjD,CAAC,gCAAkB,CAAC,UAAU,CAAC,EAAE,gCAAkB;IACnD,CAAC,sBAAa,CAAC,UAAU,CAAC,EAAE,sBAAa;IACzC,CAAC,sCAAqB,CAAC,UAAU,CAAC,EAAE,sCAAqB;IACzD,CAAC,4BAAgB,CAAC,UAAU,CAAC,EAAE,4BAAgB;IAC/C,CAAC,sCAAqB,CAAC,UAAU,CAAC,EAAE,sCAAqB;CACjD,CAAC;AAEX,sDAA0B;AAE1B,uCAAiD;AAAxC,+GAAA,qBAAqB,OAAA","sourcesContent":["import type { DialogMethodHooks } from './dialog';\nimport { dialogBuilder } from './dialog';\nimport type { GetBip32EntropyMethodHooks } from './getBip32Entropy';\nimport { getBip32EntropyBuilder } from './getBip32Entropy';\nimport type { GetBip32PublicKeyMethodHooks } from './getBip32PublicKey';\nimport { getBip32PublicKeyBuilder } from './getBip32PublicKey';\nimport type { GetBip44EntropyMethodHooks } from './getBip44Entropy';\nimport { getBip44EntropyBuilder } from './getBip44Entropy';\nimport type { GetEntropyHooks } from './getEntropy';\nimport { getEntropyBuilder } from './getEntropy';\nimport type { GetLocaleMethodHooks } from './getLocale';\nimport { getLocaleBuilder } from './getLocale';\nimport type { GetPreferencesMethodHooks } from './getPreferences';\nimport { getPreferencesBuilder } from './getPreferences';\nimport type { InvokeSnapMethodHooks } from './invokeSnap';\nimport { invokeSnapBuilder } from './invokeSnap';\nimport type { ManageAccountsMethodHooks } from './manageAccounts';\nimport { manageAccountsBuilder } from './manageAccounts';\nimport type { ManageStateMethodHooks } from './manageState';\nimport { manageStateBuilder } from './manageState';\nimport type { NotifyMethodHooks } from './notify';\nimport { notifyBuilder } from './notify';\n\nexport { WALLET_SNAP_PERMISSION_KEY } from './invokeSnap';\nexport { getEncryptionEntropy } from './manageState';\n\nexport type RestrictedMethodHooks = DialogMethodHooks &\n GetBip32EntropyMethodHooks &\n GetBip32PublicKeyMethodHooks &\n GetBip44EntropyMethodHooks &\n GetEntropyHooks &\n InvokeSnapMethodHooks &\n ManageStateMethodHooks &\n NotifyMethodHooks &\n ManageAccountsMethodHooks &\n GetLocaleMethodHooks &\n GetPreferencesMethodHooks;\n\nexport const restrictedMethodPermissionBuilders = {\n [dialogBuilder.targetName]: dialogBuilder,\n [getBip32EntropyBuilder.targetName]: getBip32EntropyBuilder,\n [getBip32PublicKeyBuilder.targetName]: getBip32PublicKeyBuilder,\n [getBip44EntropyBuilder.targetName]: getBip44EntropyBuilder,\n [getEntropyBuilder.targetName]: getEntropyBuilder,\n [invokeSnapBuilder.targetName]: invokeSnapBuilder,\n [manageStateBuilder.targetName]: manageStateBuilder,\n [notifyBuilder.targetName]: notifyBuilder,\n [manageAccountsBuilder.targetName]: manageAccountsBuilder,\n [getLocaleBuilder.targetName]: getLocaleBuilder,\n [getPreferencesBuilder.targetName]: getPreferencesBuilder,\n} as const;\n\nexport * from './caveats';\nexport type { DialogApprovalTypes } from './dialog';\nexport { DIALOG_APPROVAL_TYPES } from './dialog';\n"]}
@@ -1,16 +1,17 @@
1
- import type { DialogMethodHooks } from './dialog';
2
- import type { GetBip32EntropyMethodHooks } from './getBip32Entropy';
3
- import type { GetBip32PublicKeyMethodHooks } from './getBip32PublicKey';
4
- import type { GetBip44EntropyMethodHooks } from './getBip44Entropy';
5
- import type { GetEntropyHooks } from './getEntropy';
6
- import type { GetLocaleMethodHooks } from './getLocale';
7
- import type { InvokeSnapMethodHooks } from './invokeSnap';
8
- import type { ManageAccountsMethodHooks } from './manageAccounts';
9
- import type { ManageStateMethodHooks } from './manageState';
10
- import type { NotifyMethodHooks } from './notify';
11
- export { WALLET_SNAP_PERMISSION_KEY } from './invokeSnap';
12
- export { getEncryptionEntropy } from './manageState';
13
- export declare type RestrictedMethodHooks = DialogMethodHooks & GetBip32EntropyMethodHooks & GetBip32PublicKeyMethodHooks & GetBip44EntropyMethodHooks & GetEntropyHooks & InvokeSnapMethodHooks & ManageStateMethodHooks & NotifyMethodHooks & ManageAccountsMethodHooks & GetLocaleMethodHooks;
1
+ import type { DialogMethodHooks } from "./dialog.cjs";
2
+ import type { GetBip32EntropyMethodHooks } from "./getBip32Entropy.cjs";
3
+ import type { GetBip32PublicKeyMethodHooks } from "./getBip32PublicKey.cjs";
4
+ import type { GetBip44EntropyMethodHooks } from "./getBip44Entropy.cjs";
5
+ import type { GetEntropyHooks } from "./getEntropy.cjs";
6
+ import type { GetLocaleMethodHooks } from "./getLocale.cjs";
7
+ import type { GetPreferencesMethodHooks } from "./getPreferences.cjs";
8
+ import type { InvokeSnapMethodHooks } from "./invokeSnap.cjs";
9
+ import type { ManageAccountsMethodHooks } from "./manageAccounts.cjs";
10
+ import type { ManageStateMethodHooks } from "./manageState.cjs";
11
+ import type { NotifyMethodHooks } from "./notify.cjs";
12
+ export { WALLET_SNAP_PERMISSION_KEY } from "./invokeSnap.cjs";
13
+ export { getEncryptionEntropy } from "./manageState.cjs";
14
+ export type RestrictedMethodHooks = DialogMethodHooks & GetBip32EntropyMethodHooks & GetBip32PublicKeyMethodHooks & GetBip44EntropyMethodHooks & GetEntropyHooks & InvokeSnapMethodHooks & ManageStateMethodHooks & NotifyMethodHooks & ManageAccountsMethodHooks & GetLocaleMethodHooks & GetPreferencesMethodHooks;
14
15
  export declare const restrictedMethodPermissionBuilders: {
15
16
  readonly snap_dialog: Readonly<{
16
17
  readonly targetName: "snap_dialog";
@@ -148,7 +149,21 @@ export declare const restrictedMethodPermissionBuilders: {
148
149
  }>;
149
150
  readonly methodHooks: import("../utils").MethodHooksObject<GetLocaleMethodHooks>;
150
151
  }>;
152
+ readonly snap_getPreferences: Readonly<{
153
+ readonly targetName: "snap_getPreferences";
154
+ readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
155
+ allowedCaveats?: readonly [string, ...string[]] | null | undefined;
156
+ methodHooks: GetPreferencesMethodHooks;
157
+ }, {
158
+ permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
159
+ targetName: "snap_getPreferences";
160
+ methodImplementation: (_args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/permission-controller").RestrictedMethodParameters>) => Promise<import("@metamask/snaps-sdk").GetPreferencesResult>;
161
+ allowedCaveats: readonly [string, ...string[]] | null;
162
+ }>;
163
+ readonly methodHooks: import("../utils").MethodHooksObject<GetPreferencesMethodHooks>;
164
+ }>;
151
165
  };
152
- export * from './caveats';
153
- export type { DialogApprovalTypes } from './dialog';
154
- export { DIALOG_APPROVAL_TYPES } from './dialog';
166
+ export * from "./caveats/index.cjs";
167
+ export type { DialogApprovalTypes } from "./dialog.cjs";
168
+ export { DIALOG_APPROVAL_TYPES } from "./dialog.cjs";
169
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/restricted/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAiB;AAElD,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AAEpE,OAAO,KAAK,EAAE,4BAA4B,EAAE,gCAA4B;AAExE,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AAEpE,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AAEpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAoB;AAExD,OAAO,KAAK,EAAE,yBAAyB,EAAE,6BAAyB;AAElE,OAAO,KAAK,EAAE,qBAAqB,EAAE,yBAAqB;AAE1D,OAAO,KAAK,EAAE,yBAAyB,EAAE,6BAAyB;AAElE,OAAO,KAAK,EAAE,sBAAsB,EAAE,0BAAsB;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAiB;AAGlD,OAAO,EAAE,0BAA0B,EAAE,yBAAqB;AAC1D,OAAO,EAAE,oBAAoB,EAAE,0BAAsB;AAErD,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GACnD,0BAA0B,GAC1B,4BAA4B,GAC5B,0BAA0B,GAC1B,eAAe,GACf,qBAAqB,GACrB,sBAAsB,GACtB,iBAAiB,GACjB,yBAAyB,GACzB,oBAAoB,GACpB,yBAAyB,CAAC;AAE5B,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYrC,CAAC;AAEX,oCAA0B;AAC1B,YAAY,EAAE,mBAAmB,EAAE,qBAAiB;AACpD,OAAO,EAAE,qBAAqB,EAAE,qBAAiB"}
@@ -0,0 +1,169 @@
1
+ import type { DialogMethodHooks } from "./dialog.mjs";
2
+ import type { GetBip32EntropyMethodHooks } from "./getBip32Entropy.mjs";
3
+ import type { GetBip32PublicKeyMethodHooks } from "./getBip32PublicKey.mjs";
4
+ import type { GetBip44EntropyMethodHooks } from "./getBip44Entropy.mjs";
5
+ import type { GetEntropyHooks } from "./getEntropy.mjs";
6
+ import type { GetLocaleMethodHooks } from "./getLocale.mjs";
7
+ import type { GetPreferencesMethodHooks } from "./getPreferences.mjs";
8
+ import type { InvokeSnapMethodHooks } from "./invokeSnap.mjs";
9
+ import type { ManageAccountsMethodHooks } from "./manageAccounts.mjs";
10
+ import type { ManageStateMethodHooks } from "./manageState.mjs";
11
+ import type { NotifyMethodHooks } from "./notify.mjs";
12
+ export { WALLET_SNAP_PERMISSION_KEY } from "./invokeSnap.mjs";
13
+ export { getEncryptionEntropy } from "./manageState.mjs";
14
+ export type RestrictedMethodHooks = DialogMethodHooks & GetBip32EntropyMethodHooks & GetBip32PublicKeyMethodHooks & GetBip44EntropyMethodHooks & GetEntropyHooks & InvokeSnapMethodHooks & ManageStateMethodHooks & NotifyMethodHooks & ManageAccountsMethodHooks & GetLocaleMethodHooks & GetPreferencesMethodHooks;
15
+ export declare const restrictedMethodPermissionBuilders: {
16
+ readonly snap_dialog: Readonly<{
17
+ readonly targetName: "snap_dialog";
18
+ readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
19
+ allowedCaveats?: readonly [string, ...string[]] | null | undefined;
20
+ methodHooks: DialogMethodHooks;
21
+ }, {
22
+ permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
23
+ targetName: "snap_dialog";
24
+ methodImplementation: (args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").DialogParams>) => Promise<import("@metamask/utils").Json>;
25
+ allowedCaveats: readonly [string, ...string[]] | null;
26
+ }>;
27
+ readonly methodHooks: import("../utils").MethodHooksObject<DialogMethodHooks>;
28
+ }>;
29
+ readonly snap_getBip32Entropy: Readonly<{
30
+ readonly targetName: "snap_getBip32Entropy";
31
+ readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
32
+ methodHooks: GetBip32EntropyMethodHooks;
33
+ }, {
34
+ permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
35
+ targetName: "snap_getBip32Entropy";
36
+ methodImplementation: (args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").Bip32Entropy>) => Promise<import("@metamask/key-tree").JsonSLIP10Node>;
37
+ allowedCaveats: readonly [string, ...string[]] | null;
38
+ validator: import("@metamask/permission-controller").PermissionValidatorConstraint;
39
+ }>;
40
+ readonly methodHooks: import("../utils").MethodHooksObject<GetBip32EntropyMethodHooks>;
41
+ }>;
42
+ readonly snap_getBip32PublicKey: Readonly<{
43
+ readonly targetName: "snap_getBip32PublicKey";
44
+ readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
45
+ methodHooks: GetBip32PublicKeyMethodHooks;
46
+ }, {
47
+ permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
48
+ targetName: "snap_getBip32PublicKey";
49
+ methodImplementation: (args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").GetBip32PublicKeyParams>) => Promise<string>;
50
+ allowedCaveats: readonly [string, ...string[]] | null;
51
+ validator: import("@metamask/permission-controller").PermissionValidatorConstraint;
52
+ }>;
53
+ readonly methodHooks: import("../utils").MethodHooksObject<GetBip32PublicKeyMethodHooks>;
54
+ }>;
55
+ readonly snap_getBip44Entropy: Readonly<{
56
+ readonly targetName: "snap_getBip44Entropy";
57
+ readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
58
+ methodHooks: GetBip44EntropyMethodHooks;
59
+ }, {
60
+ permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
61
+ targetName: "snap_getBip44Entropy";
62
+ methodImplementation: (args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").Bip44Entropy>) => Promise<import("@metamask/key-tree").JsonBIP44CoinTypeNode>;
63
+ allowedCaveats: readonly [string, ...string[]] | null;
64
+ validator: import("@metamask/permission-controller").PermissionValidatorConstraint;
65
+ }>;
66
+ readonly methodHooks: import("../utils").MethodHooksObject<GetBip44EntropyMethodHooks>;
67
+ }>;
68
+ readonly snap_getEntropy: Readonly<{
69
+ readonly targetName: "snap_getEntropy";
70
+ readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
71
+ allowedCaveats?: readonly [string, ...string[]] | null | undefined;
72
+ methodHooks: GetEntropyHooks;
73
+ }, {
74
+ permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
75
+ targetName: "snap_getEntropy";
76
+ methodImplementation: (options: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").GetEntropyParams>) => Promise<`0x${string}`>;
77
+ allowedCaveats: readonly [string, ...string[]] | null;
78
+ }>;
79
+ readonly methodHooks: import("../utils").MethodHooksObject<GetEntropyHooks>;
80
+ }>;
81
+ readonly wallet_snap: Readonly<{
82
+ readonly targetName: "wallet_snap";
83
+ readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
84
+ allowedCaveats?: readonly [string, ...string[]] | null | undefined;
85
+ methodHooks: InvokeSnapMethodHooks;
86
+ }, {
87
+ permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
88
+ targetName: "wallet_snap";
89
+ methodImplementation: (options: import("@metamask/permission-controller").RestrictedMethodOptions<import("./invokeSnap").InvokeSnapParams>) => Promise<import("@metamask/utils").Json>;
90
+ allowedCaveats: readonly [string, ...string[]] | null;
91
+ validator: import("@metamask/permission-controller").PermissionValidatorConstraint;
92
+ sideEffect: {
93
+ onPermitted: import("@metamask/permission-controller").SideEffectHandler<import("./invokeSnap").InstallSnaps | import("./invokeSnap").GetPermittedSnaps, never>;
94
+ };
95
+ }>;
96
+ readonly methodHooks: import("../utils").MethodHooksObject<InvokeSnapMethodHooks>;
97
+ }>;
98
+ readonly snap_manageState: Readonly<{
99
+ readonly targetName: "snap_manageState";
100
+ readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
101
+ allowedCaveats?: readonly [string, ...string[]] | null | undefined;
102
+ methodHooks: ManageStateMethodHooks;
103
+ }, {
104
+ permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
105
+ targetName: "snap_manageState";
106
+ methodImplementation: (options: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").ManageStateParams>) => Promise<import("@metamask/snaps-sdk").ManageStateResult>;
107
+ allowedCaveats: readonly [string, ...string[]] | null;
108
+ }>;
109
+ readonly methodHooks: import("../utils").MethodHooksObject<ManageStateMethodHooks>;
110
+ }>;
111
+ readonly snap_notify: Readonly<{
112
+ readonly targetName: "snap_notify";
113
+ readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
114
+ allowedCaveats?: readonly [string, ...string[]] | null | undefined;
115
+ methodHooks: NotifyMethodHooks;
116
+ }, {
117
+ permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
118
+ targetName: "snap_notify";
119
+ methodImplementation: (args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").NotifyParams>) => Promise<null>;
120
+ allowedCaveats: readonly [string, ...string[]] | null;
121
+ }>;
122
+ readonly methodHooks: import("../utils").MethodHooksObject<NotifyMethodHooks>;
123
+ }>;
124
+ readonly snap_manageAccounts: Readonly<{
125
+ readonly targetName: "snap_manageAccounts";
126
+ readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
127
+ allowedCaveats?: readonly [string, ...string[]] | null | undefined;
128
+ methodHooks: ManageAccountsMethodHooks;
129
+ }, {
130
+ permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
131
+ targetName: "snap_manageAccounts";
132
+ methodImplementation: (options: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").ManageAccountsParams>) => Promise<import("@metamask/utils").Json>;
133
+ allowedCaveats: readonly [string, ...string[]] | null;
134
+ }>;
135
+ readonly methodHooks: {
136
+ readonly getSnapKeyring: true;
137
+ };
138
+ }>;
139
+ readonly snap_getLocale: Readonly<{
140
+ readonly targetName: "snap_getLocale";
141
+ readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
142
+ allowedCaveats?: readonly [string, ...string[]] | null | undefined;
143
+ methodHooks: GetLocaleMethodHooks;
144
+ }, {
145
+ permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
146
+ targetName: "snap_getLocale";
147
+ methodImplementation: (_args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/permission-controller").RestrictedMethodParameters>) => Promise<string>;
148
+ allowedCaveats: readonly [string, ...string[]] | null;
149
+ }>;
150
+ readonly methodHooks: import("../utils").MethodHooksObject<GetLocaleMethodHooks>;
151
+ }>;
152
+ readonly snap_getPreferences: Readonly<{
153
+ readonly targetName: "snap_getPreferences";
154
+ readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
155
+ allowedCaveats?: readonly [string, ...string[]] | null | undefined;
156
+ methodHooks: GetPreferencesMethodHooks;
157
+ }, {
158
+ permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
159
+ targetName: "snap_getPreferences";
160
+ methodImplementation: (_args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/permission-controller").RestrictedMethodParameters>) => Promise<import("@metamask/snaps-sdk").GetPreferencesResult>;
161
+ allowedCaveats: readonly [string, ...string[]] | null;
162
+ }>;
163
+ readonly methodHooks: import("../utils").MethodHooksObject<GetPreferencesMethodHooks>;
164
+ }>;
165
+ };
166
+ export * from "./caveats/index.mjs";
167
+ export type { DialogApprovalTypes } from "./dialog.mjs";
168
+ export { DIALOG_APPROVAL_TYPES } from "./dialog.mjs";
169
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/restricted/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAiB;AAElD,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AAEpE,OAAO,KAAK,EAAE,4BAA4B,EAAE,gCAA4B;AAExE,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AAEpE,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AAEpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAoB;AAExD,OAAO,KAAK,EAAE,yBAAyB,EAAE,6BAAyB;AAElE,OAAO,KAAK,EAAE,qBAAqB,EAAE,yBAAqB;AAE1D,OAAO,KAAK,EAAE,yBAAyB,EAAE,6BAAyB;AAElE,OAAO,KAAK,EAAE,sBAAsB,EAAE,0BAAsB;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAiB;AAGlD,OAAO,EAAE,0BAA0B,EAAE,yBAAqB;AAC1D,OAAO,EAAE,oBAAoB,EAAE,0BAAsB;AAErD,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GACnD,0BAA0B,GAC1B,4BAA4B,GAC5B,0BAA0B,GAC1B,eAAe,GACf,qBAAqB,GACrB,sBAAsB,GACtB,iBAAiB,GACjB,yBAAyB,GACzB,oBAAoB,GACpB,yBAAyB,CAAC;AAE5B,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYrC,CAAC;AAEX,oCAA0B;AAC1B,YAAY,EAAE,mBAAmB,EAAE,qBAAiB;AACpD,OAAO,EAAE,qBAAqB,EAAE,qBAAiB"}
@@ -1,36 +1,29 @@
1
- import {
2
- restrictedMethodPermissionBuilders
3
- } from "../chunk-SYB5TG5O.mjs";
4
- import "../chunk-JWDQUKKU.mjs";
5
- import {
6
- caveatMappers,
7
- caveatSpecifications
8
- } from "../chunk-FNUO7MQ4.mjs";
9
- import "../chunk-PIAWDTWO.mjs";
10
- import "../chunk-I2P65KBQ.mjs";
11
- import "../chunk-FJ7COFRJ.mjs";
12
- import "../chunk-VYII7C3J.mjs";
13
- import "../chunk-LR7UR4YU.mjs";
14
- import "../chunk-2RDYC42U.mjs";
15
- import "../chunk-IZYMBIBD.mjs";
16
- import "../chunk-Z6YFGWHN.mjs";
17
- import {
18
- getEncryptionEntropy
19
- } from "../chunk-TE4W25CA.mjs";
20
- import {
21
- DIALOG_APPROVAL_TYPES
22
- } from "../chunk-TQCUJQHY.mjs";
23
- import "../chunk-LXJBBRQ4.mjs";
24
- import {
25
- WALLET_SNAP_PERMISSION_KEY
26
- } from "../chunk-VVBTXSID.mjs";
27
- import "../chunk-W33UWNA2.mjs";
28
- export {
29
- DIALOG_APPROVAL_TYPES,
30
- WALLET_SNAP_PERMISSION_KEY,
31
- caveatMappers,
32
- caveatSpecifications,
33
- getEncryptionEntropy,
34
- restrictedMethodPermissionBuilders
1
+ import { dialogBuilder } from "./dialog.mjs";
2
+ import { getBip32EntropyBuilder } from "./getBip32Entropy.mjs";
3
+ import { getBip32PublicKeyBuilder } from "./getBip32PublicKey.mjs";
4
+ import { getBip44EntropyBuilder } from "./getBip44Entropy.mjs";
5
+ import { getEntropyBuilder } from "./getEntropy.mjs";
6
+ import { getLocaleBuilder } from "./getLocale.mjs";
7
+ import { getPreferencesBuilder } from "./getPreferences.mjs";
8
+ import { invokeSnapBuilder } from "./invokeSnap.mjs";
9
+ import { manageAccountsBuilder } from "./manageAccounts.mjs";
10
+ import { manageStateBuilder } from "./manageState.mjs";
11
+ import { notifyBuilder } from "./notify.mjs";
12
+ export { WALLET_SNAP_PERMISSION_KEY } from "./invokeSnap.mjs";
13
+ export { getEncryptionEntropy } from "./manageState.mjs";
14
+ export const restrictedMethodPermissionBuilders = {
15
+ [dialogBuilder.targetName]: dialogBuilder,
16
+ [getBip32EntropyBuilder.targetName]: getBip32EntropyBuilder,
17
+ [getBip32PublicKeyBuilder.targetName]: getBip32PublicKeyBuilder,
18
+ [getBip44EntropyBuilder.targetName]: getBip44EntropyBuilder,
19
+ [getEntropyBuilder.targetName]: getEntropyBuilder,
20
+ [invokeSnapBuilder.targetName]: invokeSnapBuilder,
21
+ [manageStateBuilder.targetName]: manageStateBuilder,
22
+ [notifyBuilder.targetName]: notifyBuilder,
23
+ [manageAccountsBuilder.targetName]: manageAccountsBuilder,
24
+ [getLocaleBuilder.targetName]: getLocaleBuilder,
25
+ [getPreferencesBuilder.targetName]: getPreferencesBuilder,
35
26
  };
27
+ export * from "./caveats/index.mjs";
28
+ export { DIALOG_APPROVAL_TYPES } from "./dialog.mjs";
36
29
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/restricted/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,qBAAiB;AAEzC,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAE3D,OAAO,EAAE,wBAAwB,EAAE,gCAA4B;AAE/D,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAE3D,OAAO,EAAE,iBAAiB,EAAE,yBAAqB;AAEjD,OAAO,EAAE,gBAAgB,EAAE,wBAAoB;AAE/C,OAAO,EAAE,qBAAqB,EAAE,6BAAyB;AAEzD,OAAO,EAAE,iBAAiB,EAAE,yBAAqB;AAEjD,OAAO,EAAE,qBAAqB,EAAE,6BAAyB;AAEzD,OAAO,EAAE,kBAAkB,EAAE,0BAAsB;AAEnD,OAAO,EAAE,aAAa,EAAE,qBAAiB;AAEzC,OAAO,EAAE,0BAA0B,EAAE,yBAAqB;AAC1D,OAAO,EAAE,oBAAoB,EAAE,0BAAsB;AAcrD,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,aAAa;IACzC,CAAC,sBAAsB,CAAC,UAAU,CAAC,EAAE,sBAAsB;IAC3D,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,wBAAwB;IAC/D,CAAC,sBAAsB,CAAC,UAAU,CAAC,EAAE,sBAAsB;IAC3D,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,iBAAiB;IACjD,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,iBAAiB;IACjD,CAAC,kBAAkB,CAAC,UAAU,CAAC,EAAE,kBAAkB;IACnD,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,aAAa;IACzC,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,qBAAqB;IACzD,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,gBAAgB;IAC/C,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,qBAAqB;CACjD,CAAC;AAEX,oCAA0B;AAE1B,OAAO,EAAE,qBAAqB,EAAE,qBAAiB","sourcesContent":["import type { DialogMethodHooks } from './dialog';\nimport { dialogBuilder } from './dialog';\nimport type { GetBip32EntropyMethodHooks } from './getBip32Entropy';\nimport { getBip32EntropyBuilder } from './getBip32Entropy';\nimport type { GetBip32PublicKeyMethodHooks } from './getBip32PublicKey';\nimport { getBip32PublicKeyBuilder } from './getBip32PublicKey';\nimport type { GetBip44EntropyMethodHooks } from './getBip44Entropy';\nimport { getBip44EntropyBuilder } from './getBip44Entropy';\nimport type { GetEntropyHooks } from './getEntropy';\nimport { getEntropyBuilder } from './getEntropy';\nimport type { GetLocaleMethodHooks } from './getLocale';\nimport { getLocaleBuilder } from './getLocale';\nimport type { GetPreferencesMethodHooks } from './getPreferences';\nimport { getPreferencesBuilder } from './getPreferences';\nimport type { InvokeSnapMethodHooks } from './invokeSnap';\nimport { invokeSnapBuilder } from './invokeSnap';\nimport type { ManageAccountsMethodHooks } from './manageAccounts';\nimport { manageAccountsBuilder } from './manageAccounts';\nimport type { ManageStateMethodHooks } from './manageState';\nimport { manageStateBuilder } from './manageState';\nimport type { NotifyMethodHooks } from './notify';\nimport { notifyBuilder } from './notify';\n\nexport { WALLET_SNAP_PERMISSION_KEY } from './invokeSnap';\nexport { getEncryptionEntropy } from './manageState';\n\nexport type RestrictedMethodHooks = DialogMethodHooks &\n GetBip32EntropyMethodHooks &\n GetBip32PublicKeyMethodHooks &\n GetBip44EntropyMethodHooks &\n GetEntropyHooks &\n InvokeSnapMethodHooks &\n ManageStateMethodHooks &\n NotifyMethodHooks &\n ManageAccountsMethodHooks &\n GetLocaleMethodHooks &\n GetPreferencesMethodHooks;\n\nexport const restrictedMethodPermissionBuilders = {\n [dialogBuilder.targetName]: dialogBuilder,\n [getBip32EntropyBuilder.targetName]: getBip32EntropyBuilder,\n [getBip32PublicKeyBuilder.targetName]: getBip32PublicKeyBuilder,\n [getBip44EntropyBuilder.targetName]: getBip44EntropyBuilder,\n [getEntropyBuilder.targetName]: getEntropyBuilder,\n [invokeSnapBuilder.targetName]: invokeSnapBuilder,\n [manageStateBuilder.targetName]: manageStateBuilder,\n [notifyBuilder.targetName]: notifyBuilder,\n [manageAccountsBuilder.targetName]: manageAccountsBuilder,\n [getLocaleBuilder.targetName]: getLocaleBuilder,\n [getPreferencesBuilder.targetName]: getPreferencesBuilder,\n} as const;\n\nexport * from './caveats';\nexport type { DialogApprovalTypes } from './dialog';\nexport { DIALOG_APPROVAL_TYPES } from './dialog';\n"]}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInvokeSnapImplementation = exports.invokeSnapBuilder = exports.handleSnapInstall = exports.WALLET_SNAP_PERMISSION_KEY = void 0;
4
+ const permission_controller_1 = require("@metamask/permission-controller");
5
+ const rpc_errors_1 = require("@metamask/rpc-errors");
6
+ const snaps_utils_1 = require("@metamask/snaps-utils");
7
+ exports.WALLET_SNAP_PERMISSION_KEY = 'wallet_snap';
8
+ /**
9
+ * The side-effect method to handle the snap install.
10
+ *
11
+ * @param params - The side-effect params.
12
+ * @param params.requestData - The request data associated to the requested permission.
13
+ * @param params.messagingSystem - The messenger to call an action.
14
+ * @returns The result of the Snap installation.
15
+ */
16
+ const handleSnapInstall = async ({ requestData, messagingSystem }) => {
17
+ const snaps = requestData.permissions[exports.WALLET_SNAP_PERMISSION_KEY].caveats?.[0]
18
+ .value;
19
+ const permittedSnaps = messagingSystem.call(`SnapController:getPermitted`, requestData.metadata.origin);
20
+ const dedupedSnaps = Object.keys(snaps).reduce((filteredSnaps, snap) => {
21
+ if (!permittedSnaps[snap]) {
22
+ filteredSnaps[snap] = snaps[snap];
23
+ }
24
+ return filteredSnaps;
25
+ }, {});
26
+ return messagingSystem.call(`SnapController:install`, requestData.metadata.origin, dedupedSnaps);
27
+ };
28
+ exports.handleSnapInstall = handleSnapInstall;
29
+ /**
30
+ * The specification builder for the `wallet_snap_*` permission.
31
+ *
32
+ * `wallet_snap_*` attempts to invoke an RPC method of the specified Snap.
33
+ *
34
+ * Requesting its corresponding permission will attempt to connect to the Snap,
35
+ * and install it if it's not available yet.
36
+ *
37
+ * @param options - The specification builder options.
38
+ * @param options.methodHooks - The RPC method hooks needed by the method implementation.
39
+ * @returns The specification for the `wallet_snap_*` permission.
40
+ */
41
+ const specificationBuilder = ({ methodHooks }) => {
42
+ return {
43
+ permissionType: permission_controller_1.PermissionType.RestrictedMethod,
44
+ targetName: exports.WALLET_SNAP_PERMISSION_KEY,
45
+ allowedCaveats: [snaps_utils_1.SnapCaveatType.SnapIds],
46
+ methodImplementation: getInvokeSnapImplementation(methodHooks),
47
+ validator: ({ caveats }) => {
48
+ if (caveats?.length !== 1 || caveats[0].type !== snaps_utils_1.SnapCaveatType.SnapIds) {
49
+ throw rpc_errors_1.rpcErrors.invalidParams({
50
+ message: `Expected a single "${snaps_utils_1.SnapCaveatType.SnapIds}" caveat.`,
51
+ });
52
+ }
53
+ },
54
+ sideEffect: {
55
+ onPermitted: exports.handleSnapInstall,
56
+ },
57
+ };
58
+ };
59
+ const methodHooks = {
60
+ getSnap: true,
61
+ handleSnapRpcRequest: true,
62
+ };
63
+ exports.invokeSnapBuilder = Object.freeze({
64
+ targetName: exports.WALLET_SNAP_PERMISSION_KEY,
65
+ specificationBuilder,
66
+ methodHooks,
67
+ });
68
+ /**
69
+ * Builds the method implementation for `wallet_snap_*`.
70
+ *
71
+ * @param hooks - The RPC method hooks.
72
+ * @param hooks.getSnap - A function that retrieves all information stored about a snap.
73
+ * @param hooks.handleSnapRpcRequest - A function that sends an RPC request to a snap's RPC handler or throws if that fails.
74
+ * @returns The method implementation which returns the result of `handleSnapRpcRequest`.
75
+ * @throws If the params are invalid.
76
+ */
77
+ function getInvokeSnapImplementation({ getSnap, handleSnapRpcRequest, }) {
78
+ return async function invokeSnap(options) {
79
+ const { params = {}, context } = options;
80
+ const { snapId, request } = params;
81
+ if (!getSnap(snapId)) {
82
+ throw rpc_errors_1.rpcErrors.invalidRequest({
83
+ message: `The snap "${snapId}" is not installed. Please install it first, before invoking the snap.`,
84
+ });
85
+ }
86
+ const { origin } = context;
87
+ return (await handleSnapRpcRequest({
88
+ snapId,
89
+ origin,
90
+ request,
91
+ handler: snaps_utils_1.HandlerType.OnRpcRequest,
92
+ }));
93
+ };
94
+ }
95
+ exports.getInvokeSnapImplementation = getInvokeSnapImplementation;
96
+ //# sourceMappingURL=invokeSnap.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invokeSnap.cjs","sourceRoot":"","sources":["../../src/restricted/invokeSnap.ts"],"names":[],"mappings":";;;AAOA,2EAAiE;AACjE,qDAAiD;AAOjD,uDAAoE;AAKvD,QAAA,0BAA0B,GAAG,aAAa,CAAC;AAiDxD;;;;;;;GAOG;AACI,MAAM,iBAAiB,GAGX,KAAK,EAAE,EAAE,WAAW,EAAE,eAAe,EAAE,EAAE,EAAE;IAC5D,MAAM,KAAK,GAAG,WAAW,CAAC,WAAW,CAAC,kCAA0B,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;SAC3E,KAA2B,CAAC;IAE/B,MAAM,cAAc,GAAG,eAAe,CAAC,IAAI,CACzC,6BAA6B,EAC7B,WAAW,CAAC,QAAQ,CAAC,MAAM,CAC5B,CAAC;IAEF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAC5C,CAAC,aAAa,EAAE,IAAI,EAAE,EAAE;QACtB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,aAAa,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,aAAa,CAAC;IACvB,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO,eAAe,CAAC,IAAI,CACzB,wBAAwB,EACxB,WAAW,CAAC,QAAQ,CAAC,MAAM,EAC3B,YAAY,CACb,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,iBAAiB,qBA2B5B;AACF;;;;;;;;;;;GAWG;AACH,MAAM,oBAAoB,GAItB,CAAC,EAAE,WAAW,EAAyC,EAAE,EAAE;IAC7D,OAAO;QACL,cAAc,EAAE,sCAAc,CAAC,gBAAgB;QAC/C,UAAU,EAAE,kCAA0B;QACtC,cAAc,EAAE,CAAC,4BAAc,CAAC,OAAO,CAAC;QACxC,oBAAoB,EAAE,2BAA2B,CAAC,WAAW,CAAC;QAC9D,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;YACzB,IAAI,OAAO,EAAE,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,4BAAc,CAAC,OAAO,EAAE,CAAC;gBACxE,MAAM,sBAAS,CAAC,aAAa,CAAC;oBAC5B,OAAO,EAAE,sBAAsB,4BAAc,CAAC,OAAO,WAAW;iBACjE,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,UAAU,EAAE;YACV,WAAW,EAAE,yBAAiB;SAC/B;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAA6C;IAC5D,OAAO,EAAE,IAAI;IACb,oBAAoB,EAAE,IAAI;CAC3B,CAAC;AAEW,QAAA,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7C,UAAU,EAAE,kCAA0B;IACtC,oBAAoB;IACpB,WAAW;CACH,CAAC,CAAC;AAEZ;;;;;;;;GAQG;AACH,SAAgB,2BAA2B,CAAC,EAC1C,OAAO,EACP,oBAAoB,GACE;IACtB,OAAO,KAAK,UAAU,UAAU,CAC9B,OAAkD;QAElD,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAEzC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAA0B,CAAC;QAEvD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,MAAM,sBAAS,CAAC,cAAc,CAAC;gBAC7B,OAAO,EAAE,aAAa,MAAM,wEAAwE;aACrG,CAAC,CAAC;QACL,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE3B,OAAO,CAAC,MAAM,oBAAoB,CAAC;YACjC,MAAM;YACN,MAAM;YACN,OAAO;YACP,OAAO,EAAE,yBAAW,CAAC,YAAY;SAClC,CAAC,CAAS,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AA1BD,kEA0BC","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 * @returns The result of the Snap installation.\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,30 +1,30 @@
1
- import type { PermissionSpecificationBuilder, RestrictedMethodOptions, PermissionValidatorConstraint, PermissionSideEffect } from '@metamask/permission-controller';
2
- import { PermissionType } from '@metamask/permission-controller';
3
- import type { InvokeSnapResult, RequestSnapsParams, RequestSnapsResult } from '@metamask/snaps-sdk';
4
- import type { Snap, SnapRpcHookArgs } from '@metamask/snaps-utils';
5
- import type { Json, NonEmptyArray } from '@metamask/utils';
6
- import type { MethodHooksObject } from '../utils';
1
+ import type { PermissionSpecificationBuilder, RestrictedMethodOptions, PermissionValidatorConstraint, PermissionSideEffect } from "@metamask/permission-controller";
2
+ import { PermissionType } from "@metamask/permission-controller";
3
+ import type { InvokeSnapResult, RequestSnapsParams, RequestSnapsResult } from "@metamask/snaps-sdk";
4
+ import type { Snap, SnapRpcHookArgs } from "@metamask/snaps-utils";
5
+ import type { Json, NonEmptyArray } from "@metamask/utils";
6
+ import type { MethodHooksObject } from "../utils.cjs";
7
7
  export declare const WALLET_SNAP_PERMISSION_KEY = "wallet_snap";
8
- export declare type InstallSnaps = {
8
+ export type InstallSnaps = {
9
9
  type: `SnapController:install`;
10
10
  handler: (origin: string, requestedSnaps: RequestSnapsParams) => Promise<RequestSnapsResult>;
11
11
  };
12
- export declare type GetPermittedSnaps = {
12
+ export type GetPermittedSnaps = {
13
13
  type: `SnapController:getPermitted`;
14
14
  handler: (origin: string) => RequestSnapsResult;
15
15
  };
16
- declare type AllowedActions = InstallSnaps | GetPermittedSnaps;
17
- export declare type InvokeSnapMethodHooks = {
16
+ type AllowedActions = InstallSnaps | GetPermittedSnaps;
17
+ export type InvokeSnapMethodHooks = {
18
18
  getSnap: (snapId: string) => Snap | undefined;
19
19
  handleSnapRpcRequest: ({ snapId, origin, handler, request, }: SnapRpcHookArgs & {
20
20
  snapId: string;
21
21
  }) => Promise<unknown>;
22
22
  };
23
- declare type InvokeSnapSpecificationBuilderOptions = {
23
+ type InvokeSnapSpecificationBuilderOptions = {
24
24
  allowedCaveats?: Readonly<NonEmptyArray<string>> | null;
25
25
  methodHooks: InvokeSnapMethodHooks;
26
26
  };
27
- export declare type InvokeSnapParams = {
27
+ export type InvokeSnapParams = {
28
28
  snapId: string;
29
29
  request: Record<string, Json>;
30
30
  };
@@ -34,6 +34,7 @@ export declare type InvokeSnapParams = {
34
34
  * @param params - The side-effect params.
35
35
  * @param params.requestData - The request data associated to the requested permission.
36
36
  * @param params.messagingSystem - The messenger to call an action.
37
+ * @returns The result of the Snap installation.
37
38
  */
38
39
  export declare const handleSnapInstall: PermissionSideEffect<AllowedActions, never>['onPermitted'];
39
40
  export declare const invokeSnapBuilder: Readonly<{
@@ -61,3 +62,4 @@ export declare const invokeSnapBuilder: Readonly<{
61
62
  */
62
63
  export declare function getInvokeSnapImplementation({ getSnap, handleSnapRpcRequest, }: InvokeSnapMethodHooks): (options: RestrictedMethodOptions<InvokeSnapParams>) => Promise<InvokeSnapResult>;
63
64
  export {};
65
+ //# sourceMappingURL=invokeSnap.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invokeSnap.d.cts","sourceRoot":"","sources":["../../src/restricted/invokeSnap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8BAA8B,EAC9B,uBAAuB,EAEvB,6BAA6B,EAC7B,oBAAoB,EACrB,wCAAwC;AACzC,OAAO,EAAE,cAAc,EAAE,wCAAwC;AAEjE,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EACnB,4BAA4B;AAC7B,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,8BAA8B;AAEnE,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,wBAAwB;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAiB;AAElD,eAAO,MAAM,0BAA0B,gBAAgB,CAAC;AAGxD,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,CACP,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,kBAAkB,KAC/B,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,6BAA6B,CAAC;IACpC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,kBAAkB,CAAC;CACjD,CAAC;AAEF,KAAK,cAAc,GAAG,YAAY,GAAG,iBAAiB,CAAC;AAEvD,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,SAAS,CAAC;IAC9C,oBAAoB,EAAE,CAAC,EACrB,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,GACR,EAAE,eAAe,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9D,CAAC;AAEF,KAAK,qCAAqC,GAAG;IAC3C,cAAc,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IACxD,WAAW,EAAE,qBAAqB,CAAC;CACpC,CAAC;AAaF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC/B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,oBAAoB,CAClD,cAAc,EACd,KAAK,CACN,CAAC,aAAa,CAwBd,CAAC;AAyCF,eAAO,MAAM,iBAAiB;;;wBA3FZ,eAAe,gBAAgB;oBACnC,iCAAiC;8BACvB,WAAW,kCAAkC,CAAC;wBACpD,SAAS,cAAc,MAAM,CAAC,CAAC,GAAG,IAAI;mBAC3C,6BAA6B;oBAC5B;YACV,WAAW,EAAE,qBAAqB,cAAc,EAAE,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC;SACzE;;;EAwFQ,CAAC;AAEZ;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,OAAO,EACP,oBAAoB,GACrB,EAAE,qBAAqB,aAEX,wBAAwB,gBAAgB,CAAC,KACjD,QAAQ,gBAAgB,CAAC,CAoB7B"}
@@ -0,0 +1,65 @@
1
+ import type { PermissionSpecificationBuilder, RestrictedMethodOptions, PermissionValidatorConstraint, PermissionSideEffect } from "@metamask/permission-controller";
2
+ import { PermissionType } from "@metamask/permission-controller";
3
+ import type { InvokeSnapResult, RequestSnapsParams, RequestSnapsResult } from "@metamask/snaps-sdk";
4
+ import type { Snap, SnapRpcHookArgs } from "@metamask/snaps-utils";
5
+ import type { Json, NonEmptyArray } from "@metamask/utils";
6
+ import type { MethodHooksObject } from "../utils.mjs";
7
+ export declare const WALLET_SNAP_PERMISSION_KEY = "wallet_snap";
8
+ export type InstallSnaps = {
9
+ type: `SnapController:install`;
10
+ handler: (origin: string, requestedSnaps: RequestSnapsParams) => Promise<RequestSnapsResult>;
11
+ };
12
+ export type GetPermittedSnaps = {
13
+ type: `SnapController:getPermitted`;
14
+ handler: (origin: string) => RequestSnapsResult;
15
+ };
16
+ type AllowedActions = InstallSnaps | GetPermittedSnaps;
17
+ export type InvokeSnapMethodHooks = {
18
+ getSnap: (snapId: string) => Snap | undefined;
19
+ handleSnapRpcRequest: ({ snapId, origin, handler, request, }: SnapRpcHookArgs & {
20
+ snapId: string;
21
+ }) => Promise<unknown>;
22
+ };
23
+ type InvokeSnapSpecificationBuilderOptions = {
24
+ allowedCaveats?: Readonly<NonEmptyArray<string>> | null;
25
+ methodHooks: InvokeSnapMethodHooks;
26
+ };
27
+ export type InvokeSnapParams = {
28
+ snapId: string;
29
+ request: Record<string, Json>;
30
+ };
31
+ /**
32
+ * The side-effect method to handle the snap install.
33
+ *
34
+ * @param params - The side-effect params.
35
+ * @param params.requestData - The request data associated to the requested permission.
36
+ * @param params.messagingSystem - The messenger to call an action.
37
+ * @returns The result of the Snap installation.
38
+ */
39
+ export declare const handleSnapInstall: PermissionSideEffect<AllowedActions, never>['onPermitted'];
40
+ export declare const invokeSnapBuilder: Readonly<{
41
+ readonly targetName: "wallet_snap";
42
+ readonly specificationBuilder: PermissionSpecificationBuilder<PermissionType.RestrictedMethod, InvokeSnapSpecificationBuilderOptions, {
43
+ permissionType: PermissionType.RestrictedMethod;
44
+ targetName: typeof WALLET_SNAP_PERMISSION_KEY;
45
+ methodImplementation: ReturnType<typeof getInvokeSnapImplementation>;
46
+ allowedCaveats: Readonly<NonEmptyArray<string>> | null;
47
+ validator: PermissionValidatorConstraint;
48
+ sideEffect: {
49
+ onPermitted: PermissionSideEffect<AllowedActions, never>['onPermitted'];
50
+ };
51
+ }>;
52
+ readonly methodHooks: MethodHooksObject<InvokeSnapMethodHooks>;
53
+ }>;
54
+ /**
55
+ * Builds the method implementation for `wallet_snap_*`.
56
+ *
57
+ * @param hooks - The RPC method hooks.
58
+ * @param hooks.getSnap - A function that retrieves all information stored about a snap.
59
+ * @param hooks.handleSnapRpcRequest - A function that sends an RPC request to a snap's RPC handler or throws if that fails.
60
+ * @returns The method implementation which returns the result of `handleSnapRpcRequest`.
61
+ * @throws If the params are invalid.
62
+ */
63
+ export declare function getInvokeSnapImplementation({ getSnap, handleSnapRpcRequest, }: InvokeSnapMethodHooks): (options: RestrictedMethodOptions<InvokeSnapParams>) => Promise<InvokeSnapResult>;
64
+ export {};
65
+ //# sourceMappingURL=invokeSnap.d.mts.map