@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
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/restricted/caveats/permittedDerivationPaths.ts"],"sourcesContent":["import type {\n Caveat,\n PermissionConstraint,\n RestrictedMethodCaveatSpecificationConstraint,\n} from '@metamask/permission-controller';\nimport { providerErrors, rpcErrors } from '@metamask/rpc-errors';\nimport type { Bip32Entropy } from '@metamask/snaps-utils';\nimport {\n SnapCaveatType,\n Bip32EntropyStruct,\n isEqual,\n} from '@metamask/snaps-utils';\nimport { array, size, type } from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\nimport { assertStruct } from '@metamask/utils';\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 permittedDerivationPathsCaveatMapper(\n value: Json,\n): Pick<PermissionConstraint, 'caveats'> {\n return {\n caveats: [\n {\n type: SnapCaveatType.PermittedDerivationPaths,\n value,\n },\n ],\n };\n}\n\n/**\n * Validate a caveat path object. The object must consist of a `path` array and\n * a `curve` string. Paths must start with `m`, and must contain at\n * least two indices. If `ed25519` is used, this checks if all the path indices\n * are hardened.\n *\n * @param value - The value to validate.\n * @throws If the value is invalid.\n */\nexport function validateBIP32Path(\n value: unknown,\n): asserts value is Bip32Entropy {\n assertStruct(\n value,\n Bip32EntropyStruct,\n 'Invalid BIP-32 entropy path definition',\n rpcErrors.invalidParams,\n );\n}\n\n/**\n * Validate the path values associated with a caveat. This validates that the\n * value is a non-empty array with valid derivation paths and curves.\n *\n * @param caveat - The caveat to validate.\n * @throws If the value is invalid.\n */\nexport function validateBIP32CaveatPaths(\n caveat: Caveat<string, any>,\n): asserts caveat is Caveat<string, Bip32Entropy[]> {\n assertStruct(\n caveat,\n type({ value: size(array(Bip32EntropyStruct), 1, Infinity) }),\n 'Invalid BIP-32 entropy caveat',\n rpcErrors.internal,\n );\n}\n\nexport const PermittedDerivationPathsCaveatSpecification: Record<\n SnapCaveatType.PermittedDerivationPaths,\n RestrictedMethodCaveatSpecificationConstraint\n> = {\n [SnapCaveatType.PermittedDerivationPaths]: Object.freeze({\n type: SnapCaveatType.PermittedDerivationPaths,\n decorator: (method, caveat) => {\n return async (args) => {\n const { params } = args;\n validateBIP32Path(params);\n\n const path = (caveat.value as Bip32Entropy[]).find(\n (caveatPath) =>\n isEqual(\n params.path.slice(0, caveatPath.path.length),\n caveatPath.path,\n ) && caveatPath.curve === params.curve,\n );\n\n if (!path) {\n throw providerErrors.unauthorized({\n message:\n 'The requested path is not permitted. Allowed paths must be specified in the snap manifest.',\n });\n }\n\n return await method(args);\n };\n },\n validator: (caveat) => validateBIP32CaveatPaths(caveat),\n }),\n};\n"],"mappings":";AAKA,SAAS,gBAAgB,iBAAiB;AAE1C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,OAAO,MAAM,YAAY;AAElC,SAAS,oBAAoB;AAUtB,SAAS,qCACd,OACuC;AACvC,SAAO;AAAA,IACL,SAAS;AAAA,MACP;AAAA,QACE,MAAM,eAAe;AAAA,QACrB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAWO,SAAS,kBACd,OAC+B;AAC/B;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,EACZ;AACF;AASO,SAAS,yBACd,QACkD;AAClD;AAAA,IACE;AAAA,IACA,KAAK,EAAE,OAAO,KAAK,MAAM,kBAAkB,GAAG,GAAG,QAAQ,EAAE,CAAC;AAAA,IAC5D;AAAA,IACA,UAAU;AAAA,EACZ;AACF;AAEO,IAAM,8CAGT;AAAA,EACF,CAAC,eAAe,wBAAwB,GAAG,OAAO,OAAO;AAAA,IACvD,MAAM,eAAe;AAAA,IACrB,WAAW,CAAC,QAAQ,WAAW;AAC7B,aAAO,OAAO,SAAS;AACrB,cAAM,EAAE,OAAO,IAAI;AACnB,0BAAkB,MAAM;AAExB,cAAM,OAAQ,OAAO,MAAyB;AAAA,UAC5C,CAAC,eACC;AAAA,YACE,OAAO,KAAK,MAAM,GAAG,WAAW,KAAK,MAAM;AAAA,YAC3C,WAAW;AAAA,UACb,KAAK,WAAW,UAAU,OAAO;AAAA,QACrC;AAEA,YAAI,CAAC,MAAM;AACT,gBAAM,eAAe,aAAa;AAAA,YAChC,SACE;AAAA,UACJ,CAAC;AAAA,QACH;AAEA,eAAO,MAAM,OAAO,IAAI;AAAA,MAC1B;AAAA,IACF;AAAA,IACA,WAAW,CAAC,WAAW,yBAAyB,MAAM;AAAA,EACxD,CAAC;AACH;","names":[]}
@@ -1,68 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/restricted/caveats/permittedCoinTypes.ts
2
- var _rpcerrors = require('@metamask/rpc-errors');
3
- var _snapsutils = require('@metamask/snaps-utils');
4
- var _utils = require('@metamask/utils');
5
- function permittedCoinTypesCaveatMapper(value) {
6
- return {
7
- caveats: [
8
- {
9
- type: _snapsutils.SnapCaveatType.PermittedCoinTypes,
10
- value
11
- }
12
- ]
13
- };
14
- }
15
- function validateBIP44Params(value) {
16
- if (!_utils.isPlainObject.call(void 0, value) || !_utils.hasProperty.call(void 0, value, "coinType")) {
17
- throw _rpcerrors.rpcErrors.invalidParams({
18
- message: "Expected a plain object containing a coin type."
19
- });
20
- }
21
- if (typeof value.coinType !== "number" || !Number.isInteger(value.coinType) || value.coinType < 0 || value.coinType > 2147483647) {
22
- throw _rpcerrors.rpcErrors.invalidParams({
23
- message: 'Invalid "coinType" parameter. Coin type must be a non-negative integer.'
24
- });
25
- }
26
- if (_snapsutils.FORBIDDEN_COIN_TYPES.includes(value.coinType)) {
27
- throw _rpcerrors.rpcErrors.invalidParams({
28
- message: `Coin type ${value.coinType} is forbidden.`
29
- });
30
- }
31
- }
32
- function validateBIP44Caveat(caveat) {
33
- if (!_utils.hasProperty.call(void 0, caveat, "value") || !Array.isArray(caveat.value) || caveat.value.length === 0) {
34
- throw _rpcerrors.rpcErrors.invalidParams({
35
- message: "Expected non-empty array of coin types."
36
- });
37
- }
38
- caveat.value.forEach(validateBIP44Params);
39
- }
40
- var PermittedCoinTypesCaveatSpecification = {
41
- [_snapsutils.SnapCaveatType.PermittedCoinTypes]: Object.freeze({
42
- type: _snapsutils.SnapCaveatType.PermittedCoinTypes,
43
- decorator: (method, caveat) => {
44
- return async (args) => {
45
- const { params } = args;
46
- validateBIP44Params(params);
47
- const coinType = caveat.value.find(
48
- (caveatValue) => caveatValue.coinType === params.coinType
49
- );
50
- if (!coinType) {
51
- throw _rpcerrors.providerErrors.unauthorized({
52
- message: "The requested coin type is not permitted. Allowed coin types must be specified in the snap manifest."
53
- });
54
- }
55
- return await method(args);
56
- };
57
- },
58
- validator: (caveat) => validateBIP44Caveat(caveat)
59
- })
60
- };
61
-
62
-
63
-
64
-
65
-
66
-
67
- exports.permittedCoinTypesCaveatMapper = permittedCoinTypesCaveatMapper; exports.validateBIP44Params = validateBIP44Params; exports.validateBIP44Caveat = validateBIP44Caveat; exports.PermittedCoinTypesCaveatSpecification = PermittedCoinTypesCaveatSpecification;
68
- //# sourceMappingURL=chunk-I3G6S6MJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/restricted/caveats/permittedCoinTypes.ts"],"names":[],"mappings":";AAKA,SAAS,gBAAgB,iBAAiB;AAE1C,SAAS,sBAAsB,sBAAsB;AAErD,SAAS,aAAa,qBAAqB;AAUpC,SAAS,+BACd,OACuC;AACvC,SAAO;AAAA,IACL,SAAS;AAAA,MACP;AAAA,QACE,MAAM,eAAe;AAAA,QACrB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAQO,SAAS,oBACd,OACwC;AACxC,MAAI,CAAC,cAAc,KAAK,KAAK,CAAC,YAAY,OAAO,UAAU,GAAG;AAC5D,UAAM,UAAU,cAAc;AAAA,MAC5B,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAEA,MACE,OAAO,MAAM,aAAa,YAC1B,CAAC,OAAO,UAAU,MAAM,QAAQ,KAChC,MAAM,WAAW,KACjB,MAAM,WAAW,YACjB;AACA,UAAM,UAAU,cAAc;AAAA,MAC5B,SACE;AAAA,IACJ,CAAC;AAAA,EACH;AAEA,MAAI,qBAAqB,SAAS,MAAM,QAAQ,GAAG;AACjD,UAAM,UAAU,cAAc;AAAA,MAC5B,SAAS,aAAa,MAAM,QAAQ;AAAA,IACtC,CAAC;AAAA,EACH;AACF;AASO,SAAS,oBAAoB,QAA6B;AAC/D,MACE,CAAC,YAAY,QAAQ,OAAO,KAC5B,CAAC,MAAM,QAAQ,OAAO,KAAK,KAC3B,OAAO,MAAM,WAAW,GACxB;AACA,UAAM,UAAU,cAAc;AAAA,MAC5B,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAEA,SAAO,MAAM,QAAQ,mBAAmB;AAC1C;AAEO,IAAM,wCAGT;AAAA,EACF,CAAC,eAAe,kBAAkB,GAAG,OAAO,OAAO;AAAA,IACjD,MAAM,eAAe;AAAA,IACrB,WAAW,CAAC,QAAQ,WAAW;AAC7B,aAAO,OAAO,SAAS;AACrB,cAAM,EAAE,OAAO,IAAI;AACnB,4BAAoB,MAAM;AAE1B,cAAM,WAAY,OAAO,MAAkC;AAAA,UACzD,CAAC,gBAAgB,YAAY,aAAa,OAAO;AAAA,QACnD;AAEA,YAAI,CAAC,UAAU;AACb,gBAAM,eAAe,aAAa;AAAA,YAChC,SACE;AAAA,UACJ,CAAC;AAAA,QACH;AAEA,eAAO,MAAM,OAAO,IAAI;AAAA,MAC1B;AAAA,IACF;AAAA,IACA,WAAW,CAAC,WAAW,oBAAoB,MAAM;AAAA,EACnD,CAAC;AACH","sourcesContent":["import type {\n PermissionConstraint,\n RestrictedMethodCaveatSpecificationConstraint,\n Caveat,\n} from '@metamask/permission-controller';\nimport { providerErrors, rpcErrors } from '@metamask/rpc-errors';\nimport type { GetBip44EntropyParams } from '@metamask/snaps-sdk';\nimport { FORBIDDEN_COIN_TYPES, SnapCaveatType } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\nimport { hasProperty, isPlainObject } from '@metamask/utils';\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 permittedCoinTypesCaveatMapper(\n value: Json,\n): Pick<PermissionConstraint, 'caveats'> {\n return {\n caveats: [\n {\n type: SnapCaveatType.PermittedCoinTypes,\n value,\n },\n ],\n };\n}\n\n/**\n * Validate the params for `snap_getBip44Entropy`.\n *\n * @param value - The params to validate.\n * @throws If the params are invalid.\n */\nexport function validateBIP44Params(\n value: unknown,\n): asserts value is GetBip44EntropyParams {\n if (!isPlainObject(value) || !hasProperty(value, 'coinType')) {\n throw rpcErrors.invalidParams({\n message: 'Expected a plain object containing a coin type.',\n });\n }\n\n if (\n typeof value.coinType !== 'number' ||\n !Number.isInteger(value.coinType) ||\n value.coinType < 0 ||\n value.coinType > 0x7fffffff\n ) {\n throw rpcErrors.invalidParams({\n message:\n 'Invalid \"coinType\" parameter. Coin type must be a non-negative integer.',\n });\n }\n\n if (FORBIDDEN_COIN_TYPES.includes(value.coinType)) {\n throw rpcErrors.invalidParams({\n message: `Coin type ${value.coinType} is forbidden.`,\n });\n }\n}\n\n/**\n * Validate the coin types values associated with a caveat. This checks if the\n * values are non-negative integers (>= 0).\n *\n * @param caveat - The caveat to validate.\n * @throws If the caveat is invalid.\n */\nexport function validateBIP44Caveat(caveat: Caveat<string, any>) {\n if (\n !hasProperty(caveat, 'value') ||\n !Array.isArray(caveat.value) ||\n caveat.value.length === 0\n ) {\n throw rpcErrors.invalidParams({\n message: 'Expected non-empty array of coin types.',\n });\n }\n\n caveat.value.forEach(validateBIP44Params);\n}\n\nexport const PermittedCoinTypesCaveatSpecification: Record<\n SnapCaveatType.PermittedCoinTypes,\n RestrictedMethodCaveatSpecificationConstraint\n> = {\n [SnapCaveatType.PermittedCoinTypes]: Object.freeze({\n type: SnapCaveatType.PermittedCoinTypes,\n decorator: (method, caveat) => {\n return async (args) => {\n const { params } = args;\n validateBIP44Params(params);\n\n const coinType = (caveat.value as GetBip44EntropyParams[]).find(\n (caveatValue) => caveatValue.coinType === params.coinType,\n );\n\n if (!coinType) {\n throw providerErrors.unauthorized({\n message:\n 'The requested coin type is not permitted. Allowed coin types must be specified in the snap manifest.',\n });\n }\n\n return await method(args);\n };\n },\n validator: (caveat) => validateBIP44Caveat(caveat),\n }),\n};\n"]}
@@ -1,57 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunk33MTKZ4Hjs = require('./chunk-33MTKZ4H.js');
4
-
5
- // src/restricted/getBip32Entropy.ts
6
- var _permissioncontroller = require('@metamask/permission-controller');
7
- var _rpcerrors = require('@metamask/rpc-errors');
8
- var _snapsutils = require('@metamask/snaps-utils');
9
- var _utils = require('@metamask/utils');
10
- var targetName = "snap_getBip32Entropy";
11
- var specificationBuilder = ({ methodHooks: methodHooks2 }) => {
12
- return {
13
- permissionType: _permissioncontroller.PermissionType.RestrictedMethod,
14
- targetName,
15
- allowedCaveats: [_snapsutils.SnapCaveatType.PermittedDerivationPaths],
16
- methodImplementation: getBip32EntropyImplementation(methodHooks2),
17
- validator: ({ caveats }) => {
18
- if (caveats?.length !== 1 || caveats[0].type !== _snapsutils.SnapCaveatType.PermittedDerivationPaths) {
19
- throw _rpcerrors.rpcErrors.invalidParams({
20
- message: `Expected a single "${_snapsutils.SnapCaveatType.PermittedDerivationPaths}" caveat.`
21
- });
22
- }
23
- },
24
- subjectTypes: [_permissioncontroller.SubjectType.Snap]
25
- };
26
- };
27
- var methodHooks = {
28
- getMnemonic: true,
29
- getUnlockPromise: true
30
- };
31
- var getBip32EntropyBuilder = Object.freeze({
32
- targetName,
33
- specificationBuilder,
34
- methodHooks
35
- });
36
- function getBip32EntropyImplementation({
37
- getMnemonic,
38
- getUnlockPromise
39
- }) {
40
- return async function getBip32Entropy(args) {
41
- await getUnlockPromise(true);
42
- const { params } = args;
43
- _utils.assert.call(void 0, params);
44
- const node = await _chunk33MTKZ4Hjs.getNode.call(void 0, {
45
- curve: params.curve,
46
- path: params.path,
47
- secretRecoveryPhrase: await getMnemonic()
48
- });
49
- return node.toJSON();
50
- };
51
- }
52
-
53
-
54
-
55
-
56
- exports.getBip32EntropyBuilder = getBip32EntropyBuilder; exports.getBip32EntropyImplementation = getBip32EntropyImplementation;
57
- //# sourceMappingURL=chunk-IE6EHYEG.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/restricted/getBip32Entropy.ts"],"names":["methodHooks"],"mappings":";;;;;AAMA,SAAS,gBAAgB,mBAAmB;AAC5C,SAAS,iBAAiB;AAK1B,SAAS,sBAAsB;AAE/B,SAAS,cAAc;AAKvB,IAAM,aAAa;AAqCnB,IAAM,uBAIF,CAAC,EAAE,aAAAA,aAAY,MAAkD;AACnE,SAAO;AAAA,IACL,gBAAgB,eAAe;AAAA,IAC/B;AAAA,IACA,gBAAgB,CAAC,eAAe,wBAAwB;AAAA,IACxD,sBAAsB,8BAA8BA,YAAW;AAAA,IAC/D,WAAW,CAAC,EAAE,QAAQ,MAAM;AAC1B,UACE,SAAS,WAAW,KACpB,QAAQ,CAAC,EAAE,SAAS,eAAe,0BACnC;AACA,cAAM,UAAU,cAAc;AAAA,UAC5B,SAAS,sBAAsB,eAAe,wBAAwB;AAAA,QACxE,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,cAAc,CAAC,YAAY,IAAI;AAAA,EACjC;AACF;AAEA,IAAM,cAA6D;AAAA,EACjE,aAAa;AAAA,EACb,kBAAkB;AACpB;AAEO,IAAM,yBAAyB,OAAO,OAAO;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAYH,SAAS,8BAA8B;AAAA,EAC5C;AAAA,EACA;AACF,GAA+B;AAC7B,SAAO,eAAe,gBACpB,MACgC;AAChC,UAAM,iBAAiB,IAAI;AAE3B,UAAM,EAAE,OAAO,IAAI;AACnB,WAAO,MAAM;AAEb,UAAM,OAAO,MAAM,QAAQ;AAAA,MACzB,OAAO,OAAO;AAAA,MACd,MAAM,OAAO;AAAA,MACb,sBAAsB,MAAM,YAAY;AAAA,IAC1C,CAAC;AAED,WAAO,KAAK,OAAO;AAAA,EACrB;AACF","sourcesContent":["import type {\n PermissionSpecificationBuilder,\n PermissionValidatorConstraint,\n RestrictedMethodOptions,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type {\n GetBip32EntropyParams,\n GetBip32EntropyResult,\n} from '@metamask/snaps-sdk';\nimport { SnapCaveatType } from '@metamask/snaps-utils';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert } from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\nimport { getNode } from '../utils';\n\nconst targetName = 'snap_getBip32Entropy';\n\nexport type GetBip32EntropyMethodHooks = {\n /**\n * @returns The mnemonic of the user's primary keyring.\n */\n getMnemonic: () => Promise<Uint8Array>;\n\n /**\n * Waits for the extension to be unlocked.\n *\n * @returns A promise that resolves once the extension is unlocked.\n */\n getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;\n};\n\ntype GetBip32EntropySpecificationBuilderOptions = {\n methodHooks: GetBip32EntropyMethodHooks;\n};\n\ntype GetBip32EntropySpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof targetName;\n methodImplementation: ReturnType<typeof getBip32EntropyImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n validator: PermissionValidatorConstraint;\n}>;\n\n/**\n * The specification builder for the `snap_getBip32Entropy` permission.\n * `snap_getBip32Entropy` lets the Snap control private keys for a particular\n * BIP-32 node.\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 `snap_getBip32Entropy` permission.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n GetBip32EntropySpecificationBuilderOptions,\n GetBip32EntropySpecification\n> = ({ methodHooks }: GetBip32EntropySpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName,\n allowedCaveats: [SnapCaveatType.PermittedDerivationPaths],\n methodImplementation: getBip32EntropyImplementation(methodHooks),\n validator: ({ caveats }) => {\n if (\n caveats?.length !== 1 ||\n caveats[0].type !== SnapCaveatType.PermittedDerivationPaths\n ) {\n throw rpcErrors.invalidParams({\n message: `Expected a single \"${SnapCaveatType.PermittedDerivationPaths}\" caveat.`,\n });\n }\n },\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nconst methodHooks: MethodHooksObject<GetBip32EntropyMethodHooks> = {\n getMnemonic: true,\n getUnlockPromise: true,\n};\n\nexport const getBip32EntropyBuilder = Object.freeze({\n targetName,\n specificationBuilder,\n methodHooks,\n} as const);\n\n/**\n * Builds the method implementation for `snap_getBip32Entropy`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.getMnemonic - A function to retrieve the Secret Recovery Phrase of the user.\n * @param hooks.getUnlockPromise - A function that resolves once the MetaMask extension is unlocked\n * and prompts the user to unlock their MetaMask if it is locked.\n * @returns The method implementation which returns a `JsonSLIP10Node`.\n * @throws If the params are invalid.\n */\nexport function getBip32EntropyImplementation({\n getMnemonic,\n getUnlockPromise,\n}: GetBip32EntropyMethodHooks) {\n return async function getBip32Entropy(\n args: RestrictedMethodOptions<GetBip32EntropyParams>,\n ): Promise<GetBip32EntropyResult> {\n await getUnlockPromise(true);\n\n const { params } = args;\n assert(params);\n\n const node = await getNode({\n curve: params.curve,\n path: params.path,\n secretRecoveryPhrase: await getMnemonic(),\n });\n\n return node.toJSON();\n };\n}\n"]}
@@ -1,32 +0,0 @@
1
- // src/restricted/getLocale.ts
2
- import { PermissionType, SubjectType } from "@metamask/permission-controller";
3
- var methodName = "snap_getLocale";
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
- getLocale: true
15
- };
16
- var getLocaleBuilder = Object.freeze({
17
- targetName: methodName,
18
- specificationBuilder,
19
- methodHooks
20
- });
21
- function getImplementation({ getLocale }) {
22
- return async function implementation(_args) {
23
- return getLocale();
24
- };
25
- }
26
-
27
- export {
28
- specificationBuilder,
29
- getLocaleBuilder,
30
- getImplementation
31
- };
32
- //# sourceMappingURL=chunk-IZYMBIBD.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/restricted/getLocale.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 { GetLocaleResult } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\n\nconst methodName = 'snap_getLocale';\n\nexport type GetLocaleMethodHooks = {\n getLocale: () => Promise<string>;\n};\n\ntype SpecificationBuilderOptions = {\n allowedCaveats?: Readonly<NonEmptyArray<string>> | null;\n methodHooks: GetLocaleMethodHooks;\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_getLocale` permission.\n * `snap_getLocale` allows snaps to get the user selected locale.\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_getLocale` 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<GetLocaleMethodHooks> = {\n getLocale: true,\n};\n\nexport const getLocaleBuilder = Object.freeze({\n targetName: methodName,\n specificationBuilder,\n methodHooks,\n} as const);\n\n/**\n * Builds the method implementation for `snap_getLocale`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.getLocale - A function that returns the user selected locale.\n * @returns The user selected locale.\n */\nexport function getImplementation({ getLocale }: GetLocaleMethodHooks) {\n return async function implementation(\n _args: RestrictedMethodOptions<RestrictedMethodParameters>,\n ): Promise<GetLocaleResult> {\n return getLocale();\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,cAAuD;AAAA,EAC3D,WAAW;AACb;AAEO,IAAM,mBAAmB,OAAO,OAAO;AAAA,EAC5C,YAAY;AAAA,EACZ;AAAA,EACA;AACF,CAAU;AASH,SAAS,kBAAkB,EAAE,UAAU,GAAyB;AACrE,SAAO,eAAe,eACpB,OAC0B;AAC1B,WAAO,UAAU;AAAA,EACnB;AACF;","names":["methodHooks"]}
@@ -1,80 +0,0 @@
1
- // src/restricted/notify.ts
2
- import { PermissionType, SubjectType } from "@metamask/permission-controller";
3
- import { rpcErrors } from "@metamask/rpc-errors";
4
- import { NotificationType } from "@metamask/snaps-sdk";
5
- import { validateTextLinks } from "@metamask/snaps-utils";
6
- import { isObject } from "@metamask/utils";
7
- var methodName = "snap_notify";
8
- var specificationBuilder = ({ allowedCaveats = null, methodHooks: methodHooks2 }) => {
9
- return {
10
- permissionType: PermissionType.RestrictedMethod,
11
- targetName: methodName,
12
- allowedCaveats,
13
- methodImplementation: getImplementation(methodHooks2),
14
- subjectTypes: [SubjectType.Snap]
15
- };
16
- };
17
- var methodHooks = {
18
- showNativeNotification: true,
19
- showInAppNotification: true,
20
- isOnPhishingList: true,
21
- maybeUpdatePhishingList: true
22
- };
23
- var notifyBuilder = Object.freeze({
24
- targetName: methodName,
25
- specificationBuilder,
26
- methodHooks
27
- });
28
- function getImplementation({
29
- showNativeNotification,
30
- showInAppNotification,
31
- isOnPhishingList,
32
- maybeUpdatePhishingList
33
- }) {
34
- return async function implementation(args) {
35
- const {
36
- params,
37
- context: { origin }
38
- } = args;
39
- const validatedParams = getValidatedParams(params);
40
- await maybeUpdatePhishingList();
41
- validateTextLinks(validatedParams.message, isOnPhishingList);
42
- switch (validatedParams.type) {
43
- case NotificationType.Native:
44
- return await showNativeNotification(origin, validatedParams);
45
- case NotificationType.InApp:
46
- return await showInAppNotification(origin, validatedParams);
47
- default:
48
- throw rpcErrors.invalidParams({
49
- message: 'Must specify a valid notification "type".'
50
- });
51
- }
52
- };
53
- }
54
- function getValidatedParams(params) {
55
- if (!isObject(params)) {
56
- throw rpcErrors.invalidParams({
57
- message: "Expected params to be a single object."
58
- });
59
- }
60
- const { type, message } = params;
61
- if (!type || typeof type !== "string" || !Object.values(NotificationType).includes(type)) {
62
- throw rpcErrors.invalidParams({
63
- message: 'Must specify a valid notification "type".'
64
- });
65
- }
66
- if (!message || typeof message !== "string" || message.length >= 50) {
67
- throw rpcErrors.invalidParams({
68
- message: 'Must specify a non-empty string "message" less than 50 characters long.'
69
- });
70
- }
71
- return params;
72
- }
73
-
74
- export {
75
- specificationBuilder,
76
- notifyBuilder,
77
- getImplementation,
78
- getValidatedParams
79
- };
80
- //# sourceMappingURL=chunk-JWDQUKKU.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/restricted/notify.ts"],"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 { NotificationType } from '@metamask/snaps-sdk';\nimport type {\n NotifyParams,\n NotifyResult,\n EnumToUnion,\n} from '@metamask/snaps-sdk';\nimport { validateTextLinks } from '@metamask/snaps-utils';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { isObject } from '@metamask/utils';\n\nimport { type MethodHooksObject } from '../utils';\n\nconst methodName = 'snap_notify';\n\nexport type NotificationArgs = {\n /**\n * Enum type to determine notification type.\n */\n type: EnumToUnion<NotificationType>;\n\n /**\n * A message to show on the notification.\n */\n message: string;\n};\n\nexport type NotifyMethodHooks = {\n /**\n * @param snapId - The ID of the Snap that created the notification.\n * @param args - The notification arguments.\n */\n showNativeNotification: (\n snapId: string,\n args: NotificationArgs,\n ) => Promise<null>;\n\n /**\n * @param snapId - The ID of the Snap that created the notification.\n * @param args - The notification arguments.\n */\n showInAppNotification: (\n snapId: string,\n args: NotificationArgs,\n ) => Promise<null>;\n\n isOnPhishingList: (url: string) => boolean;\n\n maybeUpdatePhishingList: () => Promise<void>;\n};\n\ntype SpecificationBuilderOptions = {\n allowedCaveats?: Readonly<NonEmptyArray<string>> | null;\n methodHooks: NotifyMethodHooks;\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_notify` permission.\n * `snap_notify` allows snaps to send multiple types of notifications to its users.\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_notify` 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<NotifyMethodHooks> = {\n showNativeNotification: true,\n showInAppNotification: true,\n isOnPhishingList: true,\n maybeUpdatePhishingList: true,\n};\n\nexport const notifyBuilder = Object.freeze({\n targetName: methodName,\n specificationBuilder,\n methodHooks,\n} as const);\n\n/**\n * Builds the method implementation for `snap_notify`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.showNativeNotification - A function that shows a native browser notification.\n * @param hooks.showInAppNotification - A function that shows a notification in the MetaMask UI.\n * @param hooks.isOnPhishingList - A function that checks for links against the phishing list.\n * @param hooks.maybeUpdatePhishingList - A function that updates the phishing list if needed.\n * @returns The method implementation which returns `null` on success.\n * @throws If the params are invalid.\n */\nexport function getImplementation({\n showNativeNotification,\n showInAppNotification,\n isOnPhishingList,\n maybeUpdatePhishingList,\n}: NotifyMethodHooks) {\n return async function implementation(\n args: RestrictedMethodOptions<NotifyParams>,\n ): Promise<NotifyResult> {\n const {\n params,\n context: { origin },\n } = args;\n\n const validatedParams = getValidatedParams(params);\n\n await maybeUpdatePhishingList();\n\n validateTextLinks(validatedParams.message, isOnPhishingList);\n\n switch (validatedParams.type) {\n case NotificationType.Native:\n return await showNativeNotification(origin, validatedParams);\n case NotificationType.InApp:\n return await showInAppNotification(origin, validatedParams);\n default:\n throw rpcErrors.invalidParams({\n message: 'Must specify a valid notification \"type\".',\n });\n }\n };\n}\n\n/**\n * Validates the notify 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 * @returns The validated method parameter object.\n */\nexport function getValidatedParams(params: unknown): NotifyParams {\n if (!isObject(params)) {\n throw rpcErrors.invalidParams({\n message: 'Expected params to be a single object.',\n });\n }\n\n const { type, message } = params;\n\n if (\n !type ||\n typeof type !== 'string' ||\n !Object.values(NotificationType).includes(type as NotificationType)\n ) {\n throw rpcErrors.invalidParams({\n message: 'Must specify a valid notification \"type\".',\n });\n }\n\n // Set to the max message length on a Mac notification for now.\n if (!message || typeof message !== 'string' || message.length >= 50) {\n throw rpcErrors.invalidParams({\n message:\n 'Must specify a non-empty string \"message\" less than 50 characters long.',\n });\n }\n\n return params as NotificationArgs;\n}\n"],"mappings":";AAKA,SAAS,gBAAgB,mBAAmB;AAC5C,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AAMjC,SAAS,yBAAyB;AAElC,SAAS,gBAAgB;AAIzB,IAAM,aAAa;AA2DZ,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,cAAoD;AAAA,EACxD,wBAAwB;AAAA,EACxB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,yBAAyB;AAC3B;AAEO,IAAM,gBAAgB,OAAO,OAAO;AAAA,EACzC,YAAY;AAAA,EACZ;AAAA,EACA;AACF,CAAU;AAaH,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAsB;AACpB,SAAO,eAAe,eACpB,MACuB;AACvB,UAAM;AAAA,MACJ;AAAA,MACA,SAAS,EAAE,OAAO;AAAA,IACpB,IAAI;AAEJ,UAAM,kBAAkB,mBAAmB,MAAM;AAEjD,UAAM,wBAAwB;AAE9B,sBAAkB,gBAAgB,SAAS,gBAAgB;AAE3D,YAAQ,gBAAgB,MAAM;AAAA,MAC5B,KAAK,iBAAiB;AACpB,eAAO,MAAM,uBAAuB,QAAQ,eAAe;AAAA,MAC7D,KAAK,iBAAiB;AACpB,eAAO,MAAM,sBAAsB,QAAQ,eAAe;AAAA,MAC5D;AACE,cAAM,UAAU,cAAc;AAAA,UAC5B,SAAS;AAAA,QACX,CAAC;AAAA,IACL;AAAA,EACF;AACF;AASO,SAAS,mBAAmB,QAA+B;AAChE,MAAI,CAAC,SAAS,MAAM,GAAG;AACrB,UAAM,UAAU,cAAc;AAAA,MAC5B,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAEA,QAAM,EAAE,MAAM,QAAQ,IAAI;AAE1B,MACE,CAAC,QACD,OAAO,SAAS,YAChB,CAAC,OAAO,OAAO,gBAAgB,EAAE,SAAS,IAAwB,GAClE;AACA,UAAM,UAAU,cAAc;AAAA,MAC5B,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAGA,MAAI,CAAC,WAAW,OAAO,YAAY,YAAY,QAAQ,UAAU,IAAI;AACnE,UAAM,UAAU,cAAc;AAAA,MAC5B,SACE;AAAA,IACJ,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":["methodHooks"]}
@@ -1,115 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
- var _chunkT56DKVFSjs = require('./chunk-T56DKVFS.js');
6
-
7
-
8
- var _chunkGE5XFDUEjs = require('./chunk-GE5XFDUE.js');
9
-
10
-
11
-
12
-
13
- var _chunkPXU6PORAjs = require('./chunk-PXU6PORA.js');
14
-
15
-
16
- var _chunkYOHE52XBjs = require('./chunk-YOHE52XB.js');
17
-
18
-
19
-
20
-
21
- var _chunkYT2Q3W5Cjs = require('./chunk-YT2Q3W5C.js');
22
-
23
-
24
-
25
-
26
- var _chunkYZMFLB67js = require('./chunk-YZMFLB67.js');
27
-
28
-
29
-
30
-
31
- var _chunk3WKIKYUHjs = require('./chunk-3WKIKYUH.js');
32
-
33
-
34
-
35
-
36
- var _chunkFCVWU5XHjs = require('./chunk-FCVWU5XH.js');
37
-
38
-
39
- var _chunkQ27K2I6Zjs = require('./chunk-Q27K2I6Z.js');
40
-
41
-
42
-
43
-
44
- var _chunk7HVABE5Rjs = require('./chunk-7HVABE5R.js');
45
-
46
-
47
- var _chunkB3NIHNXWjs = require('./chunk-B3NIHNXW.js');
48
-
49
-
50
- var _chunk2SFH57UVjs = require('./chunk-2SFH57UV.js');
51
-
52
- // src/endowments/index.ts
53
- var _snapsutils = require('@metamask/snaps-utils');
54
- var endowmentPermissionBuilders = {
55
- [_chunkYOHE52XBjs.networkAccessEndowmentBuilder.targetName]: _chunkYOHE52XBjs.networkAccessEndowmentBuilder,
56
- [_chunk3WKIKYUHjs.transactionInsightEndowmentBuilder.targetName]: _chunk3WKIKYUHjs.transactionInsightEndowmentBuilder,
57
- [_chunk7HVABE5Rjs.cronjobEndowmentBuilder.targetName]: _chunk7HVABE5Rjs.cronjobEndowmentBuilder,
58
- [_chunkB3NIHNXWjs.ethereumProviderEndowmentBuilder.targetName]: _chunkB3NIHNXWjs.ethereumProviderEndowmentBuilder,
59
- [_chunkYT2Q3W5Cjs.rpcEndowmentBuilder.targetName]: _chunkYT2Q3W5Cjs.rpcEndowmentBuilder,
60
- [_chunkQ27K2I6Zjs.webAssemblyEndowmentBuilder.targetName]: _chunkQ27K2I6Zjs.webAssemblyEndowmentBuilder,
61
- [_chunkPXU6PORAjs.nameLookupEndowmentBuilder.targetName]: _chunkPXU6PORAjs.nameLookupEndowmentBuilder,
62
- [_chunkGE5XFDUEjs.lifecycleHooksEndowmentBuilder.targetName]: _chunkGE5XFDUEjs.lifecycleHooksEndowmentBuilder,
63
- [_chunkT56DKVFSjs.keyringEndowmentBuilder.targetName]: _chunkT56DKVFSjs.keyringEndowmentBuilder,
64
- [_chunk2SFH57UVjs.homePageEndowmentBuilder.targetName]: _chunk2SFH57UVjs.homePageEndowmentBuilder,
65
- [_chunkYZMFLB67js.signatureInsightEndowmentBuilder.targetName]: _chunkYZMFLB67js.signatureInsightEndowmentBuilder
66
- };
67
- var endowmentCaveatSpecifications = {
68
- ..._chunk7HVABE5Rjs.cronjobCaveatSpecifications,
69
- ..._chunk3WKIKYUHjs.transactionInsightCaveatSpecifications,
70
- ..._chunkYT2Q3W5Cjs.rpcCaveatSpecifications,
71
- ..._chunkPXU6PORAjs.nameLookupCaveatSpecifications,
72
- ..._chunkT56DKVFSjs.keyringCaveatSpecifications,
73
- ..._chunkYZMFLB67js.signatureInsightCaveatSpecifications,
74
- ..._chunkFCVWU5XHjs.maxRequestTimeCaveatSpecifications
75
- };
76
- var endowmentCaveatMappers = {
77
- [_chunk7HVABE5Rjs.cronjobEndowmentBuilder.targetName]: _chunkFCVWU5XHjs.createMaxRequestTimeMapper.call(void 0,
78
- _chunk7HVABE5Rjs.getCronjobCaveatMapper
79
- ),
80
- [_chunk3WKIKYUHjs.transactionInsightEndowmentBuilder.targetName]: _chunkFCVWU5XHjs.createMaxRequestTimeMapper.call(void 0,
81
- _chunk3WKIKYUHjs.getTransactionInsightCaveatMapper
82
- ),
83
- [_chunkYT2Q3W5Cjs.rpcEndowmentBuilder.targetName]: _chunkFCVWU5XHjs.createMaxRequestTimeMapper.call(void 0, _chunkYT2Q3W5Cjs.getRpcCaveatMapper),
84
- [_chunkPXU6PORAjs.nameLookupEndowmentBuilder.targetName]: _chunkFCVWU5XHjs.createMaxRequestTimeMapper.call(void 0,
85
- _chunkPXU6PORAjs.getNameLookupCaveatMapper
86
- ),
87
- [_chunkT56DKVFSjs.keyringEndowmentBuilder.targetName]: _chunkFCVWU5XHjs.createMaxRequestTimeMapper.call(void 0,
88
- _chunkT56DKVFSjs.getKeyringCaveatMapper
89
- ),
90
- [_chunkYZMFLB67js.signatureInsightEndowmentBuilder.targetName]: _chunkFCVWU5XHjs.createMaxRequestTimeMapper.call(void 0,
91
- _chunkYZMFLB67js.getSignatureInsightCaveatMapper
92
- ),
93
- [_chunkGE5XFDUEjs.lifecycleHooksEndowmentBuilder.targetName]: _chunkFCVWU5XHjs.getMaxRequestTimeCaveatMapper,
94
- [_chunk2SFH57UVjs.homePageEndowmentBuilder.targetName]: _chunkFCVWU5XHjs.getMaxRequestTimeCaveatMapper
95
- };
96
- var handlerEndowments = {
97
- [_snapsutils.HandlerType.OnRpcRequest]: _chunkYT2Q3W5Cjs.rpcEndowmentBuilder.targetName,
98
- [_snapsutils.HandlerType.OnTransaction]: _chunk3WKIKYUHjs.transactionInsightEndowmentBuilder.targetName,
99
- [_snapsutils.HandlerType.OnCronjob]: _chunk7HVABE5Rjs.cronjobEndowmentBuilder.targetName,
100
- [_snapsutils.HandlerType.OnNameLookup]: _chunkPXU6PORAjs.nameLookupEndowmentBuilder.targetName,
101
- [_snapsutils.HandlerType.OnInstall]: _chunkGE5XFDUEjs.lifecycleHooksEndowmentBuilder.targetName,
102
- [_snapsutils.HandlerType.OnUpdate]: _chunkGE5XFDUEjs.lifecycleHooksEndowmentBuilder.targetName,
103
- [_snapsutils.HandlerType.OnKeyringRequest]: _chunkT56DKVFSjs.keyringEndowmentBuilder.targetName,
104
- [_snapsutils.HandlerType.OnHomePage]: _chunk2SFH57UVjs.homePageEndowmentBuilder.targetName,
105
- [_snapsutils.HandlerType.OnSignature]: _chunkYZMFLB67js.signatureInsightEndowmentBuilder.targetName,
106
- [_snapsutils.HandlerType.OnUserInput]: null
107
- };
108
-
109
-
110
-
111
-
112
-
113
-
114
- exports.endowmentPermissionBuilders = endowmentPermissionBuilders; exports.endowmentCaveatSpecifications = endowmentCaveatSpecifications; exports.endowmentCaveatMappers = endowmentCaveatMappers; exports.handlerEndowments = handlerEndowments;
115
- //# sourceMappingURL=chunk-KRSIAVUJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/endowments/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,mBAAmB;AA4CrB,IAAM,8BAA8B;AAAA,EACzC,CAAC,8BAA8B,UAAU,GAAG;AAAA,EAC5C,CAAC,mCAAmC,UAAU,GAC5C;AAAA,EACF,CAAC,wBAAwB,UAAU,GAAG;AAAA,EACtC,CAAC,iCAAiC,UAAU,GAC1C;AAAA,EACF,CAAC,oBAAoB,UAAU,GAAG;AAAA,EAClC,CAAC,4BAA4B,UAAU,GAAG;AAAA,EAC1C,CAAC,2BAA2B,UAAU,GAAG;AAAA,EACzC,CAAC,+BAA+B,UAAU,GAAG;AAAA,EAC7C,CAAC,wBAAwB,UAAU,GAAG;AAAA,EACtC,CAAC,yBAAyB,UAAU,GAAG;AAAA,EACvC,CAAC,iCAAiC,UAAU,GAC1C;AACJ;AAEO,IAAM,gCAAgC;AAAA,EAC3C,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,IAAM,yBAGT;AAAA,EACF,CAAC,wBAAwB,UAAU,GAAG;AAAA,IACpC;AAAA,EACF;AAAA,EACA,CAAC,mCAAmC,UAAU,GAAG;AAAA,IAC/C;AAAA,EACF;AAAA,EACA,CAAC,oBAAoB,UAAU,GAC7B,2BAA2B,kBAAkB;AAAA,EAC/C,CAAC,2BAA2B,UAAU,GAAG;AAAA,IACvC;AAAA,EACF;AAAA,EACA,CAAC,wBAAwB,UAAU,GAAG;AAAA,IACpC;AAAA,EACF;AAAA,EACA,CAAC,iCAAiC,UAAU,GAAG;AAAA,IAC7C;AAAA,EACF;AAAA,EACA,CAAC,+BAA+B,UAAU,GAAG;AAAA,EAC7C,CAAC,yBAAyB,UAAU,GAAG;AACzC;AAGO,IAAM,oBAAwD;AAAA,EACnE,CAAC,YAAY,YAAY,GAAG,oBAAoB;AAAA,EAChD,CAAC,YAAY,aAAa,GAAG,mCAAmC;AAAA,EAChE,CAAC,YAAY,SAAS,GAAG,wBAAwB;AAAA,EACjD,CAAC,YAAY,YAAY,GAAG,2BAA2B;AAAA,EACvD,CAAC,YAAY,SAAS,GAAG,+BAA+B;AAAA,EACxD,CAAC,YAAY,QAAQ,GAAG,+BAA+B;AAAA,EACvD,CAAC,YAAY,gBAAgB,GAAG,wBAAwB;AAAA,EACxD,CAAC,YAAY,UAAU,GAAG,yBAAyB;AAAA,EACnD,CAAC,YAAY,WAAW,GAAG,iCAAiC;AAAA,EAC5D,CAAC,YAAY,WAAW,GAAG;AAC7B","sourcesContent":["import type { PermissionConstraint } from '@metamask/permission-controller';\nimport { HandlerType } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\n\nimport {\n createMaxRequestTimeMapper,\n getMaxRequestTimeCaveatMapper,\n maxRequestTimeCaveatSpecifications,\n} from './caveats';\nimport {\n cronjobCaveatSpecifications,\n cronjobEndowmentBuilder,\n getCronjobCaveatMapper,\n} from './cronjob';\nimport { ethereumProviderEndowmentBuilder } from './ethereum-provider';\nimport { homePageEndowmentBuilder } from './home-page';\nimport {\n getKeyringCaveatMapper,\n keyringCaveatSpecifications,\n keyringEndowmentBuilder,\n} from './keyring';\nimport { lifecycleHooksEndowmentBuilder } from './lifecycle-hooks';\nimport {\n getNameLookupCaveatMapper,\n nameLookupCaveatSpecifications,\n nameLookupEndowmentBuilder,\n} from './name-lookup';\nimport { networkAccessEndowmentBuilder } from './network-access';\nimport {\n getRpcCaveatMapper,\n rpcCaveatSpecifications,\n rpcEndowmentBuilder,\n} from './rpc';\nimport {\n getSignatureInsightCaveatMapper,\n signatureInsightCaveatSpecifications,\n signatureInsightEndowmentBuilder,\n} from './signature-insight';\nimport {\n getTransactionInsightCaveatMapper,\n transactionInsightCaveatSpecifications,\n transactionInsightEndowmentBuilder,\n} from './transaction-insight';\nimport { webAssemblyEndowmentBuilder } from './web-assembly';\n\nexport const endowmentPermissionBuilders = {\n [networkAccessEndowmentBuilder.targetName]: networkAccessEndowmentBuilder,\n [transactionInsightEndowmentBuilder.targetName]:\n transactionInsightEndowmentBuilder,\n [cronjobEndowmentBuilder.targetName]: cronjobEndowmentBuilder,\n [ethereumProviderEndowmentBuilder.targetName]:\n ethereumProviderEndowmentBuilder,\n [rpcEndowmentBuilder.targetName]: rpcEndowmentBuilder,\n [webAssemblyEndowmentBuilder.targetName]: webAssemblyEndowmentBuilder,\n [nameLookupEndowmentBuilder.targetName]: nameLookupEndowmentBuilder,\n [lifecycleHooksEndowmentBuilder.targetName]: lifecycleHooksEndowmentBuilder,\n [keyringEndowmentBuilder.targetName]: keyringEndowmentBuilder,\n [homePageEndowmentBuilder.targetName]: homePageEndowmentBuilder,\n [signatureInsightEndowmentBuilder.targetName]:\n signatureInsightEndowmentBuilder,\n} as const;\n\nexport const endowmentCaveatSpecifications = {\n ...cronjobCaveatSpecifications,\n ...transactionInsightCaveatSpecifications,\n ...rpcCaveatSpecifications,\n ...nameLookupCaveatSpecifications,\n ...keyringCaveatSpecifications,\n ...signatureInsightCaveatSpecifications,\n ...maxRequestTimeCaveatSpecifications,\n};\n\nexport const endowmentCaveatMappers: Record<\n string,\n (value: Json) => Pick<PermissionConstraint, 'caveats'>\n> = {\n [cronjobEndowmentBuilder.targetName]: createMaxRequestTimeMapper(\n getCronjobCaveatMapper,\n ),\n [transactionInsightEndowmentBuilder.targetName]: createMaxRequestTimeMapper(\n getTransactionInsightCaveatMapper,\n ),\n [rpcEndowmentBuilder.targetName]:\n createMaxRequestTimeMapper(getRpcCaveatMapper),\n [nameLookupEndowmentBuilder.targetName]: createMaxRequestTimeMapper(\n getNameLookupCaveatMapper,\n ),\n [keyringEndowmentBuilder.targetName]: createMaxRequestTimeMapper(\n getKeyringCaveatMapper,\n ),\n [signatureInsightEndowmentBuilder.targetName]: createMaxRequestTimeMapper(\n getSignatureInsightCaveatMapper,\n ),\n [lifecycleHooksEndowmentBuilder.targetName]: getMaxRequestTimeCaveatMapper,\n [homePageEndowmentBuilder.targetName]: getMaxRequestTimeCaveatMapper,\n};\n\n// We allow null because a permitted handler does not have an endowment\nexport const handlerEndowments: Record<HandlerType, string | null> = {\n [HandlerType.OnRpcRequest]: rpcEndowmentBuilder.targetName,\n [HandlerType.OnTransaction]: transactionInsightEndowmentBuilder.targetName,\n [HandlerType.OnCronjob]: cronjobEndowmentBuilder.targetName,\n [HandlerType.OnNameLookup]: nameLookupEndowmentBuilder.targetName,\n [HandlerType.OnInstall]: lifecycleHooksEndowmentBuilder.targetName,\n [HandlerType.OnUpdate]: lifecycleHooksEndowmentBuilder.targetName,\n [HandlerType.OnKeyringRequest]: keyringEndowmentBuilder.targetName,\n [HandlerType.OnHomePage]: homePageEndowmentBuilder.targetName,\n [HandlerType.OnSignature]: signatureInsightEndowmentBuilder.targetName,\n [HandlerType.OnUserInput]: null,\n};\n\nexport * from './enum';\nexport { getRpcCaveatOrigins } from './rpc';\nexport { getSignatureOriginCaveat } from './signature-insight';\nexport { getTransactionOriginCaveat } from './transaction-insight';\nexport { getChainIdsCaveat, getLookupMatchersCaveat } from './name-lookup';\nexport { getKeyringCaveatOrigins } from './keyring';\nexport { getMaxRequestTimeCaveat } from './caveats';\nexport { getCronjobCaveatJobs } from './cronjob';\n"]}
@@ -1,23 +0,0 @@
1
- // src/endowments/ethereum-provider.ts
2
- import { PermissionType, SubjectType } from "@metamask/permission-controller";
3
- var permissionName = "endowment:ethereum-provider" /* EthereumProvider */;
4
- var specificationBuilder = (_builderOptions) => {
5
- return {
6
- permissionType: PermissionType.Endowment,
7
- targetName: permissionName,
8
- allowedCaveats: null,
9
- endowmentGetter: (_getterOptions) => {
10
- return ["ethereum"];
11
- },
12
- subjectTypes: [SubjectType.Snap]
13
- };
14
- };
15
- var ethereumProviderEndowmentBuilder = Object.freeze({
16
- targetName: permissionName,
17
- specificationBuilder
18
- });
19
-
20
- export {
21
- ethereumProviderEndowmentBuilder
22
- };
23
- //# sourceMappingURL=chunk-KSTF5JYB.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/endowments/ethereum-provider.ts"],"sourcesContent":["import type {\n EndowmentGetterParams,\n PermissionSpecificationBuilder,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\n\nimport { SnapEndowments } from './enum';\n\nconst permissionName = SnapEndowments.EthereumProvider;\n\ntype EthereumProviderEndowmentSpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.Endowment;\n targetName: typeof permissionName;\n endowmentGetter: (_options?: any) => ['ethereum'];\n allowedCaveats: null;\n}>;\n\n/**\n * `endowment:ethereum-provider` returns the name of the ethereum global browser API.\n * This is intended to populate the endowments of the\n * SES Compartment in which a Snap executes.\n *\n * This populates the global scope with an EIP-1193 provider, which DOES NOT implement all legacy functionality exposed to dapps.\n *\n * @param _builderOptions - Optional specification builder options.\n * @returns The specification for the network endowment.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.Endowment,\n any,\n EthereumProviderEndowmentSpecification\n> = (_builderOptions?: any) => {\n return {\n permissionType: PermissionType.Endowment,\n targetName: permissionName,\n allowedCaveats: null,\n endowmentGetter: (_getterOptions?: EndowmentGetterParams) => {\n return ['ethereum'];\n },\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nexport const ethereumProviderEndowmentBuilder = Object.freeze({\n targetName: permissionName,\n specificationBuilder,\n} as const);\n"],"mappings":";AAKA,SAAS,gBAAgB,mBAAmB;AAI5C,IAAM;AAmBN,IAAM,uBAIF,CAAC,oBAA0B;AAC7B,SAAO;AAAA,IACL,gBAAgB,eAAe;AAAA,IAC/B,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,iBAAiB,CAAC,mBAA2C;AAC3D,aAAO,CAAC,UAAU;AAAA,IACpB;AAAA,IACA,cAAc,CAAC,YAAY,IAAI;AAAA,EACjC;AACF;AAEO,IAAM,mCAAmC,OAAO,OAAO;AAAA,EAC5D,YAAY;AAAA,EACZ;AACF,CAAU;","names":[]}
@@ -1,52 +0,0 @@
1
- // src/restricted/getBip44Entropy.ts
2
- import { BIP44CoinTypeNode } from "@metamask/key-tree";
3
- import { PermissionType, SubjectType } from "@metamask/permission-controller";
4
- import { rpcErrors } from "@metamask/rpc-errors";
5
- import { SnapCaveatType } from "@metamask/snaps-utils";
6
- var targetName = "snap_getBip44Entropy";
7
- var specificationBuilder = ({ methodHooks: methodHooks2 }) => {
8
- return {
9
- permissionType: PermissionType.RestrictedMethod,
10
- targetName,
11
- allowedCaveats: [SnapCaveatType.PermittedCoinTypes],
12
- methodImplementation: getBip44EntropyImplementation(methodHooks2),
13
- validator: ({ caveats }) => {
14
- if (caveats?.length !== 1 || caveats[0].type !== SnapCaveatType.PermittedCoinTypes) {
15
- throw rpcErrors.invalidParams({
16
- message: `Expected a single "${SnapCaveatType.PermittedCoinTypes}" caveat.`
17
- });
18
- }
19
- },
20
- subjectTypes: [SubjectType.Snap]
21
- };
22
- };
23
- var methodHooks = {
24
- getMnemonic: true,
25
- getUnlockPromise: true
26
- };
27
- var getBip44EntropyBuilder = Object.freeze({
28
- targetName,
29
- specificationBuilder,
30
- methodHooks
31
- });
32
- function getBip44EntropyImplementation({
33
- getMnemonic,
34
- getUnlockPromise
35
- }) {
36
- return async function getBip44Entropy(args) {
37
- await getUnlockPromise(true);
38
- const params = args.params;
39
- const node = await BIP44CoinTypeNode.fromDerivationPath([
40
- await getMnemonic(),
41
- `bip32:44'`,
42
- `bip32:${params.coinType}'`
43
- ]);
44
- return node.toJSON();
45
- };
46
- }
47
-
48
- export {
49
- getBip44EntropyBuilder,
50
- getBip44EntropyImplementation
51
- };
52
- //# sourceMappingURL=chunk-LR7UR4YU.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/restricted/getBip44Entropy.ts"],"sourcesContent":["import { BIP44CoinTypeNode } from '@metamask/key-tree';\nimport type {\n PermissionSpecificationBuilder,\n PermissionValidatorConstraint,\n RestrictedMethodOptions,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type {\n GetBip44EntropyParams,\n GetBip44EntropyResult,\n} from '@metamask/snaps-sdk';\nimport { SnapCaveatType } from '@metamask/snaps-utils';\nimport type { NonEmptyArray } from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\n\nconst targetName = 'snap_getBip44Entropy';\n\nexport type GetBip44EntropyMethodHooks = {\n /**\n * @returns The mnemonic of the user's primary keyring.\n */\n getMnemonic: () => Promise<Uint8Array>;\n\n /**\n * Waits for the extension to be unlocked.\n *\n * @returns A promise that resolves once the extension is unlocked.\n */\n getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;\n};\n\ntype GetBip44EntropySpecificationBuilderOptions = {\n methodHooks: GetBip44EntropyMethodHooks;\n};\n\ntype GetBip44EntropySpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof targetName;\n methodImplementation: ReturnType<typeof getBip44EntropyImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n validator: PermissionValidatorConstraint;\n}>;\n\n/**\n * The specification builder for the `snap_getBip44Entropy` permission.\n * `snap_getBip44Entropy_*` lets the Snap control private keys for a particular\n * BIP-32 coin type.\n *\n * @param options - The specification builder options.\n * @param options.methodHooks - The RPC method hooks needed by the method\n * implementation.\n * @returns The specification for the `snap_getBip44Entropy` permission.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n GetBip44EntropySpecificationBuilderOptions,\n GetBip44EntropySpecification\n> = ({ methodHooks }: GetBip44EntropySpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName,\n allowedCaveats: [SnapCaveatType.PermittedCoinTypes],\n methodImplementation: getBip44EntropyImplementation(methodHooks),\n validator: ({ caveats }) => {\n if (\n caveats?.length !== 1 ||\n caveats[0].type !== SnapCaveatType.PermittedCoinTypes\n ) {\n throw rpcErrors.invalidParams({\n message: `Expected a single \"${SnapCaveatType.PermittedCoinTypes}\" caveat.`,\n });\n }\n },\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nconst methodHooks: MethodHooksObject<GetBip44EntropyMethodHooks> = {\n getMnemonic: true,\n getUnlockPromise: true,\n};\n\nexport const getBip44EntropyBuilder = Object.freeze({\n targetName,\n specificationBuilder,\n methodHooks,\n} as const);\n\n/**\n * Builds the method implementation for `snap_getBip44Entropy`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.getMnemonic - A function to retrieve the Secret Recovery Phrase\n * of the user.\n * @param hooks.getUnlockPromise - A function that resolves once the MetaMask\n * extension is unlocked and prompts the user to unlock their MetaMask if it is\n * locked.\n * @returns The method implementation which returns a `BIP44CoinTypeNode`.\n * @throws If the params are invalid.\n */\nexport function getBip44EntropyImplementation({\n getMnemonic,\n getUnlockPromise,\n}: GetBip44EntropyMethodHooks) {\n return async function getBip44Entropy(\n args: RestrictedMethodOptions<GetBip44EntropyParams>,\n ): Promise<GetBip44EntropyResult> {\n await getUnlockPromise(true);\n\n // `args.params` is validated by the decorator, so it's safe to assert here.\n const params = args.params as GetBip44EntropyParams;\n\n const node = await BIP44CoinTypeNode.fromDerivationPath([\n await getMnemonic(),\n `bip32:44'`,\n `bip32:${params.coinType}'`,\n ]);\n\n return node.toJSON();\n };\n}\n"],"mappings":";AAAA,SAAS,yBAAyB;AAOlC,SAAS,gBAAgB,mBAAmB;AAC5C,SAAS,iBAAiB;AAK1B,SAAS,sBAAsB;AAK/B,IAAM,aAAa;AAsCnB,IAAM,uBAIF,CAAC,EAAE,aAAAA,aAAY,MAAkD;AACnE,SAAO;AAAA,IACL,gBAAgB,eAAe;AAAA,IAC/B;AAAA,IACA,gBAAgB,CAAC,eAAe,kBAAkB;AAAA,IAClD,sBAAsB,8BAA8BA,YAAW;AAAA,IAC/D,WAAW,CAAC,EAAE,QAAQ,MAAM;AAC1B,UACE,SAAS,WAAW,KACpB,QAAQ,CAAC,EAAE,SAAS,eAAe,oBACnC;AACA,cAAM,UAAU,cAAc;AAAA,UAC5B,SAAS,sBAAsB,eAAe,kBAAkB;AAAA,QAClE,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,cAAc,CAAC,YAAY,IAAI;AAAA,EACjC;AACF;AAEA,IAAM,cAA6D;AAAA,EACjE,aAAa;AAAA,EACb,kBAAkB;AACpB;AAEO,IAAM,yBAAyB,OAAO,OAAO;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAcH,SAAS,8BAA8B;AAAA,EAC5C;AAAA,EACA;AACF,GAA+B;AAC7B,SAAO,eAAe,gBACpB,MACgC;AAChC,UAAM,iBAAiB,IAAI;AAG3B,UAAM,SAAS,KAAK;AAEpB,UAAM,OAAO,MAAM,kBAAkB,mBAAmB;AAAA,MACtD,MAAM,YAAY;AAAA,MAClB;AAAA,MACA,SAAS,OAAO,QAAQ;AAAA,IAC1B,CAAC;AAED,WAAO,KAAK,OAAO;AAAA,EACrB;AACF;","names":["methodHooks"]}
@@ -1,57 +0,0 @@
1
- import {
2
- getNode
3
- } from "./chunk-W33UWNA2.mjs";
4
-
5
- // src/restricted/getBip32Entropy.ts
6
- import { PermissionType, SubjectType } from "@metamask/permission-controller";
7
- import { rpcErrors } from "@metamask/rpc-errors";
8
- import { SnapCaveatType } from "@metamask/snaps-utils";
9
- import { assert } from "@metamask/utils";
10
- var targetName = "snap_getBip32Entropy";
11
- var specificationBuilder = ({ methodHooks: methodHooks2 }) => {
12
- return {
13
- permissionType: PermissionType.RestrictedMethod,
14
- targetName,
15
- allowedCaveats: [SnapCaveatType.PermittedDerivationPaths],
16
- methodImplementation: getBip32EntropyImplementation(methodHooks2),
17
- validator: ({ caveats }) => {
18
- if (caveats?.length !== 1 || caveats[0].type !== SnapCaveatType.PermittedDerivationPaths) {
19
- throw rpcErrors.invalidParams({
20
- message: `Expected a single "${SnapCaveatType.PermittedDerivationPaths}" caveat.`
21
- });
22
- }
23
- },
24
- subjectTypes: [SubjectType.Snap]
25
- };
26
- };
27
- var methodHooks = {
28
- getMnemonic: true,
29
- getUnlockPromise: true
30
- };
31
- var getBip32EntropyBuilder = Object.freeze({
32
- targetName,
33
- specificationBuilder,
34
- methodHooks
35
- });
36
- function getBip32EntropyImplementation({
37
- getMnemonic,
38
- getUnlockPromise
39
- }) {
40
- return async function getBip32Entropy(args) {
41
- await getUnlockPromise(true);
42
- const { params } = args;
43
- assert(params);
44
- const node = await getNode({
45
- curve: params.curve,
46
- path: params.path,
47
- secretRecoveryPhrase: await getMnemonic()
48
- });
49
- return node.toJSON();
50
- };
51
- }
52
-
53
- export {
54
- getBip32EntropyBuilder,
55
- getBip32EntropyImplementation
56
- };
57
- //# sourceMappingURL=chunk-LXJBBRQ4.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/restricted/getBip32Entropy.ts"],"sourcesContent":["import type {\n PermissionSpecificationBuilder,\n PermissionValidatorConstraint,\n RestrictedMethodOptions,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type {\n GetBip32EntropyParams,\n GetBip32EntropyResult,\n} from '@metamask/snaps-sdk';\nimport { SnapCaveatType } from '@metamask/snaps-utils';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert } from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\nimport { getNode } from '../utils';\n\nconst targetName = 'snap_getBip32Entropy';\n\nexport type GetBip32EntropyMethodHooks = {\n /**\n * @returns The mnemonic of the user's primary keyring.\n */\n getMnemonic: () => Promise<Uint8Array>;\n\n /**\n * Waits for the extension to be unlocked.\n *\n * @returns A promise that resolves once the extension is unlocked.\n */\n getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;\n};\n\ntype GetBip32EntropySpecificationBuilderOptions = {\n methodHooks: GetBip32EntropyMethodHooks;\n};\n\ntype GetBip32EntropySpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof targetName;\n methodImplementation: ReturnType<typeof getBip32EntropyImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n validator: PermissionValidatorConstraint;\n}>;\n\n/**\n * The specification builder for the `snap_getBip32Entropy` permission.\n * `snap_getBip32Entropy` lets the Snap control private keys for a particular\n * BIP-32 node.\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 `snap_getBip32Entropy` permission.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n GetBip32EntropySpecificationBuilderOptions,\n GetBip32EntropySpecification\n> = ({ methodHooks }: GetBip32EntropySpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName,\n allowedCaveats: [SnapCaveatType.PermittedDerivationPaths],\n methodImplementation: getBip32EntropyImplementation(methodHooks),\n validator: ({ caveats }) => {\n if (\n caveats?.length !== 1 ||\n caveats[0].type !== SnapCaveatType.PermittedDerivationPaths\n ) {\n throw rpcErrors.invalidParams({\n message: `Expected a single \"${SnapCaveatType.PermittedDerivationPaths}\" caveat.`,\n });\n }\n },\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nconst methodHooks: MethodHooksObject<GetBip32EntropyMethodHooks> = {\n getMnemonic: true,\n getUnlockPromise: true,\n};\n\nexport const getBip32EntropyBuilder = Object.freeze({\n targetName,\n specificationBuilder,\n methodHooks,\n} as const);\n\n/**\n * Builds the method implementation for `snap_getBip32Entropy`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.getMnemonic - A function to retrieve the Secret Recovery Phrase of the user.\n * @param hooks.getUnlockPromise - A function that resolves once the MetaMask extension is unlocked\n * and prompts the user to unlock their MetaMask if it is locked.\n * @returns The method implementation which returns a `JsonSLIP10Node`.\n * @throws If the params are invalid.\n */\nexport function getBip32EntropyImplementation({\n getMnemonic,\n getUnlockPromise,\n}: GetBip32EntropyMethodHooks) {\n return async function getBip32Entropy(\n args: RestrictedMethodOptions<GetBip32EntropyParams>,\n ): Promise<GetBip32EntropyResult> {\n await getUnlockPromise(true);\n\n const { params } = args;\n assert(params);\n\n const node = await getNode({\n curve: params.curve,\n path: params.path,\n secretRecoveryPhrase: await getMnemonic(),\n });\n\n return node.toJSON();\n };\n}\n"],"mappings":";;;;;AAMA,SAAS,gBAAgB,mBAAmB;AAC5C,SAAS,iBAAiB;AAK1B,SAAS,sBAAsB;AAE/B,SAAS,cAAc;AAKvB,IAAM,aAAa;AAqCnB,IAAM,uBAIF,CAAC,EAAE,aAAAA,aAAY,MAAkD;AACnE,SAAO;AAAA,IACL,gBAAgB,eAAe;AAAA,IAC/B;AAAA,IACA,gBAAgB,CAAC,eAAe,wBAAwB;AAAA,IACxD,sBAAsB,8BAA8BA,YAAW;AAAA,IAC/D,WAAW,CAAC,EAAE,QAAQ,MAAM;AAC1B,UACE,SAAS,WAAW,KACpB,QAAQ,CAAC,EAAE,SAAS,eAAe,0BACnC;AACA,cAAM,UAAU,cAAc;AAAA,UAC5B,SAAS,sBAAsB,eAAe,wBAAwB;AAAA,QACxE,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,cAAc,CAAC,YAAY,IAAI;AAAA,EACjC;AACF;AAEA,IAAM,cAA6D;AAAA,EACjE,aAAa;AAAA,EACb,kBAAkB;AACpB;AAEO,IAAM,yBAAyB,OAAO,OAAO;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAYH,SAAS,8BAA8B;AAAA,EAC5C;AAAA,EACA;AACF,GAA+B;AAC7B,SAAO,eAAe,gBACpB,MACgC;AAChC,UAAM,iBAAiB,IAAI;AAE3B,UAAM,EAAE,OAAO,IAAI;AACnB,WAAO,MAAM;AAEb,UAAM,OAAO,MAAM,QAAQ;AAAA,MACzB,OAAO,OAAO;AAAA,MACd,MAAM,OAAO;AAAA,MACb,sBAAsB,MAAM,YAAY;AAAA,IAC1C,CAAC;AAED,WAAO,KAAK,OAAO;AAAA,EACrB;AACF;","names":["methodHooks"]}