@metamask/keyring-api 10.1.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/{JsonRpcRequest.js → JsonRpcRequest.cjs} +2 -2
  3. package/dist/JsonRpcRequest.cjs.map +1 -0
  4. package/dist/{JsonRpcRequest.d.ts → JsonRpcRequest.d.cts} +3 -2
  5. package/dist/JsonRpcRequest.d.cts.map +1 -0
  6. package/dist/JsonRpcRequest.d.mts +17 -0
  7. package/dist/JsonRpcRequest.d.mts.map +1 -0
  8. package/dist/JsonRpcRequest.mjs +10 -0
  9. package/dist/JsonRpcRequest.mjs.map +1 -0
  10. package/dist/{KeyringClient.js → KeyringClient.cjs} +4 -4
  11. package/dist/KeyringClient.cjs.map +1 -0
  12. package/dist/{KeyringClient.d.ts → KeyringClient.d.cts} +4 -3
  13. package/dist/KeyringClient.d.cts.map +1 -0
  14. package/dist/KeyringClient.d.mts +29 -0
  15. package/dist/KeyringClient.d.mts.map +1 -0
  16. package/dist/KeyringClient.mjs +120 -0
  17. package/dist/KeyringClient.mjs.map +1 -0
  18. package/dist/{KeyringSnapRpcClient.js → KeyringSnapRpcClient.cjs} +2 -2
  19. package/dist/KeyringSnapRpcClient.cjs.map +1 -0
  20. package/dist/{KeyringSnapRpcClient.d.ts → KeyringSnapRpcClient.d.cts} +6 -5
  21. package/dist/KeyringSnapRpcClient.d.cts.map +1 -0
  22. package/dist/KeyringSnapRpcClient.d.mts +40 -0
  23. package/dist/KeyringSnapRpcClient.d.mts.map +1 -0
  24. package/dist/KeyringSnapRpcClient.mjs +63 -0
  25. package/dist/KeyringSnapRpcClient.mjs.map +1 -0
  26. package/dist/api/{account.js → account.cjs} +3 -3
  27. package/dist/api/account.cjs.map +1 -0
  28. package/dist/api/{account.d.ts → account.d.cts} +2 -1
  29. package/dist/api/account.d.cts.map +1 -0
  30. package/dist/api/account.d.mts +70 -0
  31. package/dist/api/account.d.mts.map +1 -0
  32. package/dist/api/account.mjs +61 -0
  33. package/dist/api/account.mjs.map +1 -0
  34. package/dist/api/{balance.js → balance.cjs} +3 -3
  35. package/dist/api/balance.cjs.map +1 -0
  36. package/dist/api/{balance.d.ts → balance.d.cts} +2 -1
  37. package/dist/api/balance.d.cts.map +1 -0
  38. package/dist/api/balance.d.mts +10 -0
  39. package/dist/api/balance.d.mts.map +1 -0
  40. package/dist/api/balance.mjs +8 -0
  41. package/dist/api/balance.mjs.map +1 -0
  42. package/dist/api/{caip.js → caip.cjs} +5 -5
  43. package/dist/api/caip.cjs.map +1 -0
  44. package/dist/api/{caip.d.ts → caip.d.cts} +2 -1
  45. package/dist/api/caip.d.cts.map +1 -0
  46. package/dist/api/caip.d.mts +38 -0
  47. package/dist/api/caip.d.mts.map +1 -0
  48. package/dist/api/caip.mjs +43 -0
  49. package/dist/api/caip.mjs.map +1 -0
  50. package/dist/api/{export.js → export.cjs} +1 -1
  51. package/dist/api/export.cjs.map +1 -0
  52. package/dist/api/{export.d.ts → export.d.cts} +2 -1
  53. package/dist/api/export.d.cts.map +1 -0
  54. package/dist/api/export.d.mts +9 -0
  55. package/dist/api/export.d.mts.map +1 -0
  56. package/dist/api/export.mjs +4 -0
  57. package/dist/api/export.mjs.map +1 -0
  58. package/dist/api/{index.js → index.cjs} +7 -7
  59. package/dist/api/index.cjs.map +1 -0
  60. package/dist/api/index.d.cts +8 -0
  61. package/dist/api/index.d.cts.map +1 -0
  62. package/dist/api/index.d.mts +8 -0
  63. package/dist/api/index.d.mts.map +1 -0
  64. package/dist/api/index.mjs +7 -0
  65. package/dist/api/index.mjs.map +1 -0
  66. package/dist/api/{keyring.js → keyring.cjs} +1 -1
  67. package/dist/api/keyring.cjs.map +1 -0
  68. package/dist/api/{keyring.d.ts → keyring.d.cts} +8 -7
  69. package/dist/api/keyring.d.cts.map +1 -0
  70. package/dist/api/keyring.d.mts +160 -0
  71. package/dist/api/keyring.d.mts.map +1 -0
  72. package/dist/api/keyring.mjs +2 -0
  73. package/dist/api/keyring.mjs.map +1 -0
  74. package/dist/api/{request.js → request.cjs} +3 -3
  75. package/dist/api/request.cjs.map +1 -0
  76. package/dist/api/{request.d.ts → request.d.cts} +3 -2
  77. package/dist/api/request.d.cts.map +1 -0
  78. package/dist/api/request.d.mts +40 -0
  79. package/dist/api/request.d.mts.map +1 -0
  80. package/dist/api/request.mjs +26 -0
  81. package/dist/api/request.mjs.map +1 -0
  82. package/dist/api/{response.js → response.cjs} +2 -2
  83. package/dist/api/response.cjs.map +1 -0
  84. package/dist/api/{response.d.ts → response.d.cts} +2 -1
  85. package/dist/api/response.d.cts.map +1 -0
  86. package/dist/api/response.d.mts +25 -0
  87. package/dist/api/response.d.mts.map +1 -0
  88. package/dist/api/response.mjs +41 -0
  89. package/dist/api/response.mjs.map +1 -0
  90. package/dist/{eth/erc4337/index.js → btc/index.cjs} +2 -2
  91. package/dist/btc/index.cjs.map +1 -0
  92. package/dist/btc/index.d.cts +2 -0
  93. package/dist/btc/index.d.cts.map +1 -0
  94. package/dist/btc/index.d.mts +2 -0
  95. package/dist/btc/index.d.mts.map +1 -0
  96. package/dist/btc/index.mjs +2 -0
  97. package/dist/btc/index.mjs.map +1 -0
  98. package/dist/btc/{types.js → types.cjs} +3 -3
  99. package/dist/btc/types.cjs.map +1 -0
  100. package/dist/btc/{types.d.ts → types.d.cts} +2 -1
  101. package/dist/btc/types.d.cts.map +1 -0
  102. package/dist/btc/types.d.mts +34 -0
  103. package/dist/btc/types.d.mts.map +1 -0
  104. package/dist/btc/types.mjs +37 -0
  105. package/dist/btc/types.mjs.map +1 -0
  106. package/dist/{contexts.js → contexts.cjs} +1 -1
  107. package/dist/contexts.cjs.map +1 -0
  108. package/dist/{contexts.d.ts → contexts.d.cts} +1 -0
  109. package/dist/contexts.d.cts.map +1 -0
  110. package/dist/contexts.d.mts +8 -0
  111. package/dist/contexts.d.mts.map +1 -0
  112. package/dist/contexts.mjs +2 -0
  113. package/dist/contexts.mjs.map +1 -0
  114. package/dist/{sol/index.js → eth/erc4337/index.cjs} +2 -2
  115. package/dist/eth/erc4337/index.cjs.map +1 -0
  116. package/dist/eth/erc4337/index.d.cts +2 -0
  117. package/dist/eth/erc4337/index.d.cts.map +1 -0
  118. package/dist/eth/erc4337/index.d.mts +2 -0
  119. package/dist/eth/erc4337/index.d.mts.map +1 -0
  120. package/dist/eth/erc4337/index.mjs +2 -0
  121. package/dist/eth/erc4337/index.mjs.map +1 -0
  122. package/dist/eth/erc4337/{types.js → types.cjs} +4 -4
  123. package/dist/eth/erc4337/types.cjs.map +1 -0
  124. package/dist/eth/erc4337/{types.d.ts → types.d.cts} +6 -5
  125. package/dist/eth/erc4337/types.d.cts.map +1 -0
  126. package/dist/eth/erc4337/types.d.mts +98 -0
  127. package/dist/eth/erc4337/types.d.mts.map +1 -0
  128. package/dist/eth/erc4337/types.mjs +59 -0
  129. package/dist/eth/erc4337/types.mjs.map +1 -0
  130. package/dist/eth/{index.js → index.cjs} +4 -4
  131. package/dist/eth/index.cjs.map +1 -0
  132. package/dist/eth/index.d.cts +4 -0
  133. package/dist/eth/index.d.cts.map +1 -0
  134. package/dist/eth/index.d.mts +4 -0
  135. package/dist/eth/index.d.mts.map +1 -0
  136. package/dist/eth/index.mjs +4 -0
  137. package/dist/eth/index.mjs.map +1 -0
  138. package/dist/eth/{types.js → types.cjs} +3 -3
  139. package/dist/eth/types.cjs.map +1 -0
  140. package/dist/eth/{types.d.ts → types.d.cts} +2 -1
  141. package/dist/eth/types.d.cts.map +1 -0
  142. package/dist/eth/types.d.mts +81 -0
  143. package/dist/eth/types.d.mts.map +1 -0
  144. package/dist/eth/types.mjs +70 -0
  145. package/dist/eth/types.mjs.map +1 -0
  146. package/dist/eth/{utils.js → utils.cjs} +3 -4
  147. package/dist/eth/{utils.js.map → utils.cjs.map} +1 -1
  148. package/dist/eth/{utils.d.ts → utils.d.cts} +2 -1
  149. package/dist/eth/utils.d.cts.map +1 -0
  150. package/dist/eth/utils.d.mts +9 -0
  151. package/dist/eth/utils.d.mts.map +1 -0
  152. package/dist/eth/utils.mjs +11 -0
  153. package/dist/eth/utils.mjs.map +1 -0
  154. package/dist/{events.js → events.cjs} +1 -1
  155. package/dist/events.cjs.map +1 -0
  156. package/dist/{events.d.ts → events.d.cts} +1 -0
  157. package/dist/events.d.cts.map +1 -0
  158. package/dist/events.d.mts +11 -0
  159. package/dist/events.d.mts.map +1 -0
  160. package/dist/events.mjs +14 -0
  161. package/dist/events.mjs.map +1 -0
  162. package/dist/index.cjs +29 -0
  163. package/dist/index.cjs.map +1 -0
  164. package/dist/index.d.cts +14 -0
  165. package/dist/index.d.cts.map +1 -0
  166. package/dist/index.d.mts +14 -0
  167. package/dist/index.d.mts.map +1 -0
  168. package/dist/index.mjs +13 -0
  169. package/dist/index.mjs.map +1 -0
  170. package/dist/internal/{api.js → api.cjs} +5 -5
  171. package/dist/internal/api.cjs.map +1 -0
  172. package/dist/internal/{api.d.ts → api.d.cts} +5 -4
  173. package/dist/internal/api.d.cts.map +1 -0
  174. package/dist/internal/api.d.mts +420 -0
  175. package/dist/internal/api.d.mts.map +1 -0
  176. package/dist/internal/api.mjs +136 -0
  177. package/dist/internal/api.mjs.map +1 -0
  178. package/dist/internal/eth/{EthKeyring.js → EthKeyring.cjs} +1 -1
  179. package/dist/internal/eth/EthKeyring.cjs.map +1 -0
  180. package/dist/internal/eth/{EthKeyring.d.ts → EthKeyring.d.cts} +4 -3
  181. package/dist/internal/eth/EthKeyring.d.cts.map +1 -0
  182. package/dist/internal/eth/EthKeyring.d.mts +34 -0
  183. package/dist/internal/eth/EthKeyring.d.mts.map +1 -0
  184. package/dist/internal/eth/EthKeyring.mjs +2 -0
  185. package/dist/internal/eth/EthKeyring.mjs.map +1 -0
  186. package/dist/internal/eth/{index.js → index.cjs} +1 -1
  187. package/dist/internal/eth/index.cjs.map +1 -0
  188. package/dist/internal/eth/index.d.cts +2 -0
  189. package/dist/internal/eth/index.d.cts.map +1 -0
  190. package/dist/internal/eth/index.d.mts +2 -0
  191. package/dist/internal/eth/index.d.mts.map +1 -0
  192. package/dist/internal/eth/index.mjs +2 -0
  193. package/dist/internal/eth/index.mjs.map +1 -0
  194. package/dist/internal/{events.js → events.cjs} +5 -5
  195. package/dist/internal/events.cjs.map +1 -0
  196. package/dist/internal/{events.d.ts → events.d.cts} +3 -2
  197. package/dist/internal/events.d.cts.map +1 -0
  198. package/dist/internal/events.d.mts +162 -0
  199. package/dist/internal/events.d.mts.map +1 -0
  200. package/dist/internal/events.mjs +69 -0
  201. package/dist/internal/events.mjs.map +1 -0
  202. package/dist/internal/{index.js → index.cjs} +5 -5
  203. package/dist/internal/index.cjs.map +1 -0
  204. package/dist/internal/index.d.cts +6 -0
  205. package/dist/internal/index.d.cts.map +1 -0
  206. package/dist/internal/index.d.mts +6 -0
  207. package/dist/internal/index.d.mts.map +1 -0
  208. package/dist/internal/index.mjs +5 -0
  209. package/dist/internal/index.mjs.map +1 -0
  210. package/dist/internal/{rpc.js → rpc.cjs} +3 -3
  211. package/dist/internal/rpc.cjs.map +1 -0
  212. package/dist/internal/{rpc.d.ts → rpc.d.cts} +1 -0
  213. package/dist/internal/rpc.d.cts.map +1 -0
  214. package/dist/internal/rpc.d.mts +26 -0
  215. package/dist/internal/rpc.d.mts.map +1 -0
  216. package/dist/internal/rpc.mjs +29 -0
  217. package/dist/internal/{rpc.js.map → rpc.mjs.map} +1 -1
  218. package/dist/internal/{types.js → types.cjs} +6 -6
  219. package/dist/internal/types.cjs.map +1 -0
  220. package/dist/internal/{types.d.ts → types.d.cts} +21 -20
  221. package/dist/internal/types.d.cts.map +1 -0
  222. package/dist/internal/types.d.mts +392 -0
  223. package/dist/internal/types.d.mts.map +1 -0
  224. package/dist/internal/types.mjs +49 -0
  225. package/dist/internal/types.mjs.map +1 -0
  226. package/dist/{rpc-handler.js → rpc-handler.cjs} +6 -6
  227. package/dist/rpc-handler.cjs.map +1 -0
  228. package/dist/{rpc-handler.d.ts → rpc-handler.d.cts} +4 -3
  229. package/dist/rpc-handler.d.cts.map +1 -0
  230. package/dist/rpc-handler.d.mts +30 -0
  231. package/dist/rpc-handler.d.mts.map +1 -0
  232. package/dist/rpc-handler.mjs +131 -0
  233. package/dist/rpc-handler.mjs.map +1 -0
  234. package/dist/{snap-utils.js → snap-utils.cjs} +2 -3
  235. package/dist/snap-utils.cjs.map +1 -0
  236. package/dist/{snap-utils.d.ts → snap-utils.d.cts} +4 -3
  237. package/dist/snap-utils.d.cts.map +1 -0
  238. package/dist/snap-utils.d.mts +12 -0
  239. package/dist/snap-utils.d.mts.map +1 -0
  240. package/dist/snap-utils.mjs +17 -0
  241. package/dist/snap-utils.mjs.map +1 -0
  242. package/dist/{btc/index.js → sol/index.cjs} +2 -2
  243. package/dist/sol/index.cjs.map +1 -0
  244. package/dist/sol/index.d.cts +2 -0
  245. package/dist/sol/index.d.cts.map +1 -0
  246. package/dist/sol/index.d.mts +2 -0
  247. package/dist/sol/index.d.mts.map +1 -0
  248. package/dist/sol/index.mjs +2 -0
  249. package/dist/sol/index.mjs.map +1 -0
  250. package/dist/sol/{types.js → types.cjs} +3 -3
  251. package/dist/sol/types.cjs.map +1 -0
  252. package/dist/sol/{types.d.ts → types.d.cts} +2 -1
  253. package/dist/sol/types.d.cts.map +1 -0
  254. package/dist/sol/types.d.mts +39 -0
  255. package/dist/sol/types.d.mts.map +1 -0
  256. package/dist/sol/types.mjs +33 -0
  257. package/dist/sol/types.mjs.map +1 -0
  258. package/dist/{superstruct.js → superstruct.cjs} +5 -6
  259. package/dist/superstruct.cjs.map +1 -0
  260. package/dist/{superstruct.d.ts → superstruct.d.cts} +3 -2
  261. package/dist/superstruct.d.cts.map +1 -0
  262. package/dist/superstruct.d.mts +84 -0
  263. package/dist/superstruct.d.mts.map +1 -0
  264. package/dist/superstruct.mjs +74 -0
  265. package/dist/superstruct.mjs.map +1 -0
  266. package/dist/utils/{index.js → index.cjs} +3 -3
  267. package/dist/utils/index.cjs.map +1 -0
  268. package/dist/utils/index.d.cts +3 -0
  269. package/dist/utils/index.d.cts.map +1 -0
  270. package/dist/utils/index.d.mts +3 -0
  271. package/dist/utils/index.d.mts.map +1 -0
  272. package/dist/utils/index.mjs +3 -0
  273. package/dist/utils/index.mjs.map +1 -0
  274. package/dist/utils/{types.js → types.cjs} +2 -2
  275. package/dist/utils/types.cjs.map +1 -0
  276. package/dist/utils/{types.d.ts → types.d.cts} +2 -1
  277. package/dist/utils/types.d.cts.map +1 -0
  278. package/dist/utils/types.d.mts +18 -0
  279. package/dist/utils/types.d.mts.map +1 -0
  280. package/dist/utils/types.mjs +26 -0
  281. package/dist/utils/types.mjs.map +1 -0
  282. package/dist/utils/{typing.js → typing.cjs} +2 -3
  283. package/dist/utils/{typing.js.map → typing.cjs.map} +1 -1
  284. package/dist/utils/{typing.d.ts → typing.d.cts} +1 -0
  285. package/dist/utils/typing.d.cts.map +1 -0
  286. package/dist/utils/typing.d.mts +33 -0
  287. package/dist/utils/typing.d.mts.map +1 -0
  288. package/dist/utils/typing.mjs +17 -0
  289. package/dist/utils/typing.mjs.map +1 -0
  290. package/package.json +19 -8
  291. package/dist/JsonRpcRequest.js.map +0 -1
  292. package/dist/KeyringClient.js.map +0 -1
  293. package/dist/KeyringSnapRpcClient.js.map +0 -1
  294. package/dist/api/account.js.map +0 -1
  295. package/dist/api/balance.js.map +0 -1
  296. package/dist/api/caip.js.map +0 -1
  297. package/dist/api/export.js.map +0 -1
  298. package/dist/api/index.d.ts +0 -7
  299. package/dist/api/index.js.map +0 -1
  300. package/dist/api/keyring.js.map +0 -1
  301. package/dist/api/request.js.map +0 -1
  302. package/dist/api/response.js.map +0 -1
  303. package/dist/btc/index.d.ts +0 -1
  304. package/dist/btc/index.js.map +0 -1
  305. package/dist/btc/types.js.map +0 -1
  306. package/dist/contexts.js.map +0 -1
  307. package/dist/eth/erc4337/index.d.ts +0 -1
  308. package/dist/eth/erc4337/index.js.map +0 -1
  309. package/dist/eth/erc4337/types.js.map +0 -1
  310. package/dist/eth/index.d.ts +0 -3
  311. package/dist/eth/index.js.map +0 -1
  312. package/dist/eth/types.js.map +0 -1
  313. package/dist/events.js.map +0 -1
  314. package/dist/index.d.ts +0 -12
  315. package/dist/index.js +0 -28
  316. package/dist/index.js.map +0 -1
  317. package/dist/internal/api.js.map +0 -1
  318. package/dist/internal/eth/EthKeyring.js.map +0 -1
  319. package/dist/internal/eth/index.d.ts +0 -1
  320. package/dist/internal/eth/index.js.map +0 -1
  321. package/dist/internal/events.js.map +0 -1
  322. package/dist/internal/index.d.ts +0 -5
  323. package/dist/internal/index.js.map +0 -1
  324. package/dist/internal/types.js.map +0 -1
  325. package/dist/rpc-handler.js.map +0 -1
  326. package/dist/snap-utils.js.map +0 -1
  327. package/dist/sol/index.d.ts +0 -1
  328. package/dist/sol/index.js.map +0 -1
  329. package/dist/sol/types.js.map +0 -1
  330. package/dist/superstruct.js.map +0 -1
  331. package/dist/utils/index.d.ts +0 -2
  332. package/dist/utils/index.js.map +0 -1
  333. package/dist/utils/types.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [11.0.0]
11
+
12
+ ### Added
13
+
14
+ - **BREAKING:** Add ESM build ([#40](https://github.com/MetaMask/accounts/pull/40))
15
+ - It's no longer possible to import files from `./dist` directly.
16
+
10
17
  ## [10.1.0]
11
18
 
12
19
  ### Added
@@ -431,7 +438,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
431
438
  - SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
432
439
  - Helper functions to create keyring handler in the snap.
433
440
 
434
- [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@10.1.0...HEAD
441
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@11.0.0...HEAD
442
+ [11.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@10.1.0...@metamask/keyring-api@11.0.0
435
443
  [10.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@10.0.0...@metamask/keyring-api@10.1.0
436
444
  [10.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@9.0.0...@metamask/keyring-api@10.0.0
437
445
  [9.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.3...@metamask/keyring-api@9.0.0
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JsonRpcRequestStruct = void 0;
4
4
  const superstruct_1 = require("@metamask/superstruct");
5
5
  const utils_1 = require("@metamask/utils");
6
- const superstruct_2 = require("./superstruct");
6
+ const superstruct_2 = require("./superstruct.cjs");
7
7
  exports.JsonRpcRequestStruct = (0, superstruct_2.object)({
8
8
  jsonrpc: (0, superstruct_1.literal)('2.0'),
9
9
  id: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)(), (0, superstruct_1.literal)(null)]),
10
10
  method: (0, superstruct_1.string)(),
11
11
  params: (0, superstruct_2.exactOptional)((0, superstruct_1.union)([(0, superstruct_1.array)(utils_1.JsonStruct), (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct)])),
12
12
  });
13
- //# sourceMappingURL=JsonRpcRequest.js.map
13
+ //# sourceMappingURL=JsonRpcRequest.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonRpcRequest.cjs","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":";;;AAAA,uDAO+B;AAE/B,2CAA6C;AAE7C,mDAAsD;AAEzC,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,MAAM,EAAE,IAAA,oBAAM,GAAE;IAChB,MAAM,EAAE,IAAA,2BAAa,EACnB,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,kBAAU,CAAC,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,CACzD;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from './superstruct';\n\nexport const JsonRpcRequestStruct = object({\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n});\n\n/**\n * JSON-RPC request type.\n */\nexport type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;\n"]}
@@ -1,4 +1,4 @@
1
- import type { Infer } from '@metamask/superstruct';
1
+ import type { Infer } from "@metamask/superstruct";
2
2
  export declare const JsonRpcRequestStruct: import("@metamask/superstruct").Struct<{
3
3
  jsonrpc: "2.0";
4
4
  id: string | number | null;
@@ -8,9 +8,10 @@ export declare const JsonRpcRequestStruct: import("@metamask/superstruct").Struc
8
8
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
9
9
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
10
10
  method: import("@metamask/superstruct").Struct<string, null>;
11
- params: import("@metamask/superstruct").Struct<import("./superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
11
+ params: import("@metamask/superstruct").Struct<import("./superstruct.cjs").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
12
12
  }>;
13
13
  /**
14
14
  * JSON-RPC request type.
15
15
  */
16
16
  export type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;
17
+ //# sourceMappingURL=JsonRpcRequest.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonRpcRequest.d.cts","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,eAAO,MAAM,oBAAoB;;;;;;;;;;EAO/B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ export declare const JsonRpcRequestStruct: import("@metamask/superstruct").Struct<{
3
+ jsonrpc: "2.0";
4
+ id: string | number | null;
5
+ method: string;
6
+ params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
7
+ }, {
8
+ jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
9
+ id: import("@metamask/superstruct").Struct<string | number | null, null>;
10
+ method: import("@metamask/superstruct").Struct<string, null>;
11
+ params: import("@metamask/superstruct").Struct<import("./superstruct.mjs").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
12
+ }>;
13
+ /**
14
+ * JSON-RPC request type.
15
+ */
16
+ export type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;
17
+ //# sourceMappingURL=JsonRpcRequest.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonRpcRequest.d.mts","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,eAAO,MAAM,oBAAoB;;;;;;;;;;EAO/B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { array, literal, number, record, string, union } from "@metamask/superstruct";
2
+ import { JsonStruct } from "@metamask/utils";
3
+ import { exactOptional, object } from "./superstruct.mjs";
4
+ export const JsonRpcRequestStruct = object({
5
+ jsonrpc: literal('2.0'),
6
+ id: union([string(), number(), literal(null)]),
7
+ method: string(),
8
+ params: exactOptional(union([array(JsonStruct), record(string(), JsonStruct)])),
9
+ });
10
+ //# sourceMappingURL=JsonRpcRequest.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonRpcRequest.mjs","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAE/B,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,0BAAsB;AAEtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;IACvB,EAAE,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,MAAM,EAAE,MAAM,EAAE;IAChB,MAAM,EAAE,aAAa,CACnB,KAAK,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CACzD;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from './superstruct';\n\nexport const JsonRpcRequestStruct = object({\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n});\n\n/**\n * JSON-RPC request type.\n */\nexport type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;\n"]}
@@ -15,9 +15,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.KeyringClient = void 0;
16
16
  const superstruct_1 = require("@metamask/superstruct");
17
17
  const uuid_1 = require("uuid");
18
- const api_1 = require("./internal/api");
19
- const rpc_1 = require("./internal/rpc");
20
- const superstruct_2 = require("./superstruct");
18
+ const api_1 = require("./internal/api.cjs");
19
+ const rpc_1 = require("./internal/rpc.cjs");
20
+ const superstruct_2 = require("./superstruct.cjs");
21
21
  class KeyringClient {
22
22
  /**
23
23
  * Create a new instance of `KeyringClient`.
@@ -121,4 +121,4 @@ async function _KeyringClient_send(partial) {
121
121
  ...partial,
122
122
  });
123
123
  };
124
- //# sourceMappingURL=KeyringClient.js.map
124
+ //# sourceMappingURL=KeyringClient.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyringClient.cjs","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAA+C;AAE/C,+BAAkC;AAWlC,4CAcwB;AACxB,4CAAkD;AAElD,mDAA2C;AAM3C,MAAa,aAAa;IAGxB;;;;OAIG;IACH,YAAY,MAAc;;QAPjB,wCAAgB;QAQvB,uBAAA,IAAI,yBAAW,MAAM,MAAA,CAAC;IACxB,CAAC;IAgBD,KAAK,CAAC,YAAY;QAChB,OAAO,IAAA,wBAAU,EACf,MAAM,uBAAA,IAAI,qDAAM,MAAV,IAAI,EAAO;YACf,MAAM,EAAE,sBAAgB,CAAC,YAAY;SACtC,CAAC,EACF,gCAA0B,CAC3B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU;QACzB,OAAO,IAAA,wBAAU,EACf,MAAM,uBAAA,IAAI,qDAAM,MAAV,IAAI,EAAO;YACf,MAAM,EAAE,sBAAgB,CAAC,UAAU;YACnC,MAAM,EAAE,EAAE,EAAE,EAAE;SACf,CAAC,EACF,8BAAwB,CACzB,CAAC;IACJ,CAAC;IAED,KAAK,CAA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E,sBAAgB,CAAC,aAAa;YACtC,MAAM,EAAE,EAAE,EAAE,EAAE;SACf,CAAC,EACF,iCAA2B,CAC5B,CAAC;IACJ,CAAC;CACF;AAjKD,sCAiKC;;AArJC;;;;;GAKG;AACH,KAAK,8BAAO,OAA+C;IACzD,OAAO,uBAAA,IAAI,6BAAQ,CAAC,IAAI,CAAC;QACvB,OAAO,EAAE,KAAK;QACd,EAAE,EAAE,IAAA,SAAI,GAAE;QACV,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { assert } from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\nimport { v4 as uuid } from 'uuid';\n\nimport type {\n Keyring,\n KeyringAccount,\n KeyringRequest,\n KeyringAccountData,\n KeyringResponse,\n CaipAssetType,\n Balance,\n} from './api';\nimport {\n ApproveRequestResponseStruct,\n CreateAccountResponseStruct,\n DeleteAccountResponseStruct,\n ExportAccountResponseStruct,\n FilterAccountChainsResponseStruct,\n GetAccountBalancesResponseStruct,\n GetAccountResponseStruct,\n GetRequestResponseStruct,\n ListAccountsResponseStruct,\n ListRequestsResponseStruct,\n RejectRequestResponseStruct,\n SubmitRequestResponseStruct,\n UpdateAccountResponseStruct,\n} from './internal/api';\nimport { KeyringRpcMethod } from './internal/rpc';\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport { strictMask } from './superstruct';\n\nexport type Sender = {\n send(request: JsonRpcRequest): Promise<Json>;\n};\n\nexport class KeyringClient implements Keyring {\n readonly #sender: Sender;\n\n /**\n * Create a new instance of `KeyringClient`.\n *\n * @param sender - The `Sender` instance to use to send requests to the snap.\n */\n constructor(sender: Sender) {\n this.#sender = sender;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param partial - A partial JSON-RPC request (method and params).\n * @returns A promise that resolves to the response to the request.\n */\n async #send(partial: Omit<JsonRpcRequest, 'jsonrpc' | 'id'>): Promise<Json> {\n return this.#sender.send({\n jsonrpc: '2.0',\n id: uuid(),\n ...partial,\n });\n }\n\n async listAccounts(): Promise<KeyringAccount[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListAccounts,\n }),\n ListAccountsResponseStruct,\n );\n }\n\n async getAccount(id: string): Promise<KeyringAccount> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetAccount,\n params: { id },\n }),\n GetAccountResponseStruct,\n );\n }\n\n async getAccountBalances(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetAccountBalances,\n params: { id, assets },\n }),\n GetAccountBalancesResponseStruct,\n );\n }\n\n async createAccount(\n options: Record<string, Json> = {},\n ): Promise<KeyringAccount> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.CreateAccount,\n params: { options },\n }),\n CreateAccountResponseStruct,\n );\n }\n\n async filterAccountChains(id: string, chains: string[]): Promise<string[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.FilterAccountChains,\n params: { id, chains },\n }),\n FilterAccountChainsResponseStruct,\n );\n }\n\n async updateAccount(account: KeyringAccount): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.UpdateAccount,\n params: { account },\n }),\n UpdateAccountResponseStruct,\n );\n }\n\n async deleteAccount(id: string): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.DeleteAccount,\n params: { id },\n }),\n DeleteAccountResponseStruct,\n );\n }\n\n async exportAccount(id: string): Promise<KeyringAccountData> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ExportAccount,\n params: { id },\n }),\n ExportAccountResponseStruct,\n );\n }\n\n async listRequests(): Promise<KeyringRequest[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListRequests,\n }),\n ListRequestsResponseStruct,\n );\n }\n\n async getRequest(id: string): Promise<KeyringRequest> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetRequest,\n params: { id },\n }),\n GetRequestResponseStruct,\n );\n }\n\n async submitRequest(request: KeyringRequest): Promise<KeyringResponse> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.SubmitRequest,\n params: request,\n }),\n SubmitRequestResponseStruct,\n );\n }\n\n async approveRequest(\n id: string,\n data: Record<string, Json> = {},\n ): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.ApproveRequest,\n params: { id, data },\n }),\n ApproveRequestResponseStruct,\n );\n }\n\n async rejectRequest(id: string): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.RejectRequest,\n params: { id },\n }),\n RejectRequestResponseStruct,\n );\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { Json } from '@metamask/utils';
2
- import type { Keyring, KeyringAccount, KeyringRequest, KeyringAccountData, KeyringResponse, CaipAssetType, Balance } from './api';
3
- import type { JsonRpcRequest } from './JsonRpcRequest';
1
+ import type { Json } from "@metamask/utils";
2
+ import type { Keyring, KeyringAccount, KeyringRequest, KeyringAccountData, KeyringResponse, CaipAssetType, Balance } from "./api/index.cjs";
3
+ import type { JsonRpcRequest } from "./JsonRpcRequest.cjs";
4
4
  export type Sender = {
5
5
  send(request: JsonRpcRequest): Promise<Json>;
6
6
  };
@@ -26,3 +26,4 @@ export declare class KeyringClient implements Keyring {
26
26
  approveRequest(id: string, data?: Record<string, Json>): Promise<void>;
27
27
  rejectRequest(id: string): Promise<void>;
28
28
  }
29
+ //# sourceMappingURL=KeyringClient.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyringClient.d.cts","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAG5C,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,OAAO,EACR,wBAAc;AAiBf,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AAGvD,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,CAAC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ring, KeyringAccount, KeyringRequest, KeyringAccountData, KeyringResponse, CaipAssetType, Balance } from "./api/index.mjs";
3
+ import type { JsonRpcRequest } from "./JsonRpcRequest.mjs";
4
+ export type Sender = {
5
+ send(request: JsonRpcRequest): Promise<Json>;
6
+ };
7
+ export declare class KeyringClient implements Keyring {
8
+ #private;
9
+ /**
10
+ * Create a new instance of `KeyringClient`.
11
+ *
12
+ * @param sender - The `Sender` instance to use to send requests to the snap.
13
+ */
14
+ constructor(sender: Sender);
15
+ listAccounts(): Promise<KeyringAccount[]>;
16
+ getAccount(id: string): Promise<KeyringAccount>;
17
+ getAccountBalances(id: string, assets: CaipAssetType[]): Promise<Record<CaipAssetType, Balance>>;
18
+ createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
19
+ filterAccountChains(id: string, chains: string[]): Promise<string[]>;
20
+ updateAccount(account: KeyringAccount): Promise<void>;
21
+ deleteAccount(id: string): Promise<void>;
22
+ exportAccount(id: string): Promise<KeyringAccountData>;
23
+ listRequests(): Promise<KeyringRequest[]>;
24
+ getRequest(id: string): Promise<KeyringRequest>;
25
+ submitRequest(request: KeyringRequest): Promise<KeyringResponse>;
26
+ approveRequest(id: string, data?: Record<string, Json>): Promise<void>;
27
+ rejectRequest(id: string): Promise<void>;
28
+ }
29
+ //# sourceMappingURL=KeyringClient.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyringClient.d.mts","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAG5C,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,OAAO,EACR,wBAAc;AAiBf,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AAGvD,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C,CAAC;AAEF,qBAAa,aAAc,YAAW,OAAO;;IAG3C;;;;OAIG;gBACS,MAAM,EAAE,MAAM;IAkBpB,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IASzC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAU/C,kBAAkB,CACtB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,aAAa,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAUpC,aAAa,CACjB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAM,GACjC,OAAO,CAAC,cAAc,CAAC;IAUpB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAUpE,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrD,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAUtD,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IASzC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAU/C,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAUhE,cAAc,CAClB,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAM,GAC9B,OAAO,CAAC,IAAI,CAAC;IAUV,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAS/C"}
@@ -0,0 +1,120 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _KeyringClient_instances, _KeyringClient_sender, _KeyringClient_send;
13
+ import { assert } from "@metamask/superstruct";
14
+ import { v4 as uuid } from "uuid";
15
+ import { ApproveRequestResponseStruct, CreateAccountResponseStruct, DeleteAccountResponseStruct, ExportAccountResponseStruct, FilterAccountChainsResponseStruct, GetAccountBalancesResponseStruct, GetAccountResponseStruct, GetRequestResponseStruct, ListAccountsResponseStruct, ListRequestsResponseStruct, RejectRequestResponseStruct, SubmitRequestResponseStruct, UpdateAccountResponseStruct } from "./internal/api.mjs";
16
+ import { KeyringRpcMethod } from "./internal/rpc.mjs";
17
+ import { strictMask } from "./superstruct.mjs";
18
+ export class KeyringClient {
19
+ /**
20
+ * Create a new instance of `KeyringClient`.
21
+ *
22
+ * @param sender - The `Sender` instance to use to send requests to the snap.
23
+ */
24
+ constructor(sender) {
25
+ _KeyringClient_instances.add(this);
26
+ _KeyringClient_sender.set(this, void 0);
27
+ __classPrivateFieldSet(this, _KeyringClient_sender, sender, "f");
28
+ }
29
+ async listAccounts() {
30
+ return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
31
+ method: KeyringRpcMethod.ListAccounts,
32
+ }), ListAccountsResponseStruct);
33
+ }
34
+ async getAccount(id) {
35
+ return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
36
+ method: KeyringRpcMethod.GetAccount,
37
+ params: { id },
38
+ }), GetAccountResponseStruct);
39
+ }
40
+ async getAccountBalances(id, assets) {
41
+ return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
42
+ method: KeyringRpcMethod.GetAccountBalances,
43
+ params: { id, assets },
44
+ }), GetAccountBalancesResponseStruct);
45
+ }
46
+ async createAccount(options = {}) {
47
+ return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
48
+ method: KeyringRpcMethod.CreateAccount,
49
+ params: { options },
50
+ }), CreateAccountResponseStruct);
51
+ }
52
+ async filterAccountChains(id, chains) {
53
+ return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
54
+ method: KeyringRpcMethod.FilterAccountChains,
55
+ params: { id, chains },
56
+ }), FilterAccountChainsResponseStruct);
57
+ }
58
+ async updateAccount(account) {
59
+ assert(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
60
+ method: KeyringRpcMethod.UpdateAccount,
61
+ params: { account },
62
+ }), UpdateAccountResponseStruct);
63
+ }
64
+ async deleteAccount(id) {
65
+ assert(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
66
+ method: KeyringRpcMethod.DeleteAccount,
67
+ params: { id },
68
+ }), DeleteAccountResponseStruct);
69
+ }
70
+ async exportAccount(id) {
71
+ return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
72
+ method: KeyringRpcMethod.ExportAccount,
73
+ params: { id },
74
+ }), ExportAccountResponseStruct);
75
+ }
76
+ async listRequests() {
77
+ return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
78
+ method: KeyringRpcMethod.ListRequests,
79
+ }), ListRequestsResponseStruct);
80
+ }
81
+ async getRequest(id) {
82
+ return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
83
+ method: KeyringRpcMethod.GetRequest,
84
+ params: { id },
85
+ }), GetRequestResponseStruct);
86
+ }
87
+ async submitRequest(request) {
88
+ return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
89
+ method: KeyringRpcMethod.SubmitRequest,
90
+ params: request,
91
+ }), SubmitRequestResponseStruct);
92
+ }
93
+ async approveRequest(id, data = {}) {
94
+ assert(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
95
+ method: KeyringRpcMethod.ApproveRequest,
96
+ params: { id, data },
97
+ }), ApproveRequestResponseStruct);
98
+ }
99
+ async rejectRequest(id) {
100
+ assert(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
101
+ method: KeyringRpcMethod.RejectRequest,
102
+ params: { id },
103
+ }), RejectRequestResponseStruct);
104
+ }
105
+ }
106
+ _KeyringClient_sender = new WeakMap(), _KeyringClient_instances = new WeakSet(), _KeyringClient_send =
107
+ /**
108
+ * Send a request to the snap and return the response.
109
+ *
110
+ * @param partial - A partial JSON-RPC request (method and params).
111
+ * @returns A promise that resolves to the response to the request.
112
+ */
113
+ async function _KeyringClient_send(partial) {
114
+ return __classPrivateFieldGet(this, _KeyringClient_sender, "f").send({
115
+ jsonrpc: '2.0',
116
+ id: uuid(),
117
+ ...partial,
118
+ });
119
+ };
120
+ //# sourceMappingURL=KeyringClient.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyringClient.mjs","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,8BAA8B;AAE/C,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,aAAa;AAWlC,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,2BAA2B,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AAV,IAAI,EAAO;YACf,MAAM,EAAE,gBAAgB,CAAC,UAAU;YACnC,MAAM,EAAE,EAAE,EAAE,EAAE;SACf,CAAC,EACF,wBAAwB,CACzB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAuB;QACzC,OAAO,UAAU,CACf,MAAM,uBAAA,IAAI,qDAAM,MAAV,IAAI,EAAO;YACf,MAAM,EAAE,gBAAgB,CAAC,aAAa;YACtC,MAAM,EAAE,OAAO;SAChB,CAAC,EACF,2BAA2B,CAC5B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,EAAU,EACV,OAA6B,EAAE;QAE/B,MAAM,CACJ,MAAM,uBAAA,IAAI,qDAAM,MAAV,IAAI,EAAO;YACf,MAAM,EAAE,gBAAgB,CAAC,cAAc;YACvC,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;SACrB,CAAC,EACF,4BAA4B,CAC7B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU;QAC5B,MAAM,CACJ,MAAM,uBAAA,IAAI,qDAAM,MAAV,IAAI,EAAO;YACf,MAAM,EAAE,gBAAgB,CAAC,aAAa;YACtC,MAAM,EAAE,EAAE,EAAE,EAAE;SACf,CAAC,EACF,2BAA2B,CAC5B,CAAC;IACJ,CAAC;CACF;;AArJC;;;;;GAKG;AACH,KAAK,8BAAO,OAA+C;IACzD,OAAO,uBAAA,IAAI,6BAAQ,CAAC,IAAI,CAAC;QACvB,OAAO,EAAE,KAAK;QACd,EAAE,EAAE,IAAI,EAAE;QACV,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { assert } from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\nimport { v4 as uuid } from 'uuid';\n\nimport type {\n Keyring,\n KeyringAccount,\n KeyringRequest,\n KeyringAccountData,\n KeyringResponse,\n CaipAssetType,\n Balance,\n} from './api';\nimport {\n ApproveRequestResponseStruct,\n CreateAccountResponseStruct,\n DeleteAccountResponseStruct,\n ExportAccountResponseStruct,\n FilterAccountChainsResponseStruct,\n GetAccountBalancesResponseStruct,\n GetAccountResponseStruct,\n GetRequestResponseStruct,\n ListAccountsResponseStruct,\n ListRequestsResponseStruct,\n RejectRequestResponseStruct,\n SubmitRequestResponseStruct,\n UpdateAccountResponseStruct,\n} from './internal/api';\nimport { KeyringRpcMethod } from './internal/rpc';\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport { strictMask } from './superstruct';\n\nexport type Sender = {\n send(request: JsonRpcRequest): Promise<Json>;\n};\n\nexport class KeyringClient implements Keyring {\n readonly #sender: Sender;\n\n /**\n * Create a new instance of `KeyringClient`.\n *\n * @param sender - The `Sender` instance to use to send requests to the snap.\n */\n constructor(sender: Sender) {\n this.#sender = sender;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param partial - A partial JSON-RPC request (method and params).\n * @returns A promise that resolves to the response to the request.\n */\n async #send(partial: Omit<JsonRpcRequest, 'jsonrpc' | 'id'>): Promise<Json> {\n return this.#sender.send({\n jsonrpc: '2.0',\n id: uuid(),\n ...partial,\n });\n }\n\n async listAccounts(): Promise<KeyringAccount[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListAccounts,\n }),\n ListAccountsResponseStruct,\n );\n }\n\n async getAccount(id: string): Promise<KeyringAccount> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetAccount,\n params: { id },\n }),\n GetAccountResponseStruct,\n );\n }\n\n async getAccountBalances(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetAccountBalances,\n params: { id, assets },\n }),\n GetAccountBalancesResponseStruct,\n );\n }\n\n async createAccount(\n options: Record<string, Json> = {},\n ): Promise<KeyringAccount> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.CreateAccount,\n params: { options },\n }),\n CreateAccountResponseStruct,\n );\n }\n\n async filterAccountChains(id: string, chains: string[]): Promise<string[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.FilterAccountChains,\n params: { id, chains },\n }),\n FilterAccountChainsResponseStruct,\n );\n }\n\n async updateAccount(account: KeyringAccount): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.UpdateAccount,\n params: { account },\n }),\n UpdateAccountResponseStruct,\n );\n }\n\n async deleteAccount(id: string): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.DeleteAccount,\n params: { id },\n }),\n DeleteAccountResponseStruct,\n );\n }\n\n async exportAccount(id: string): Promise<KeyringAccountData> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ExportAccount,\n params: { id },\n }),\n ExportAccountResponseStruct,\n );\n }\n\n async listRequests(): Promise<KeyringRequest[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListRequests,\n }),\n ListRequestsResponseStruct,\n );\n }\n\n async getRequest(id: string): Promise<KeyringRequest> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetRequest,\n params: { id },\n }),\n GetRequestResponseStruct,\n );\n }\n\n async submitRequest(request: KeyringRequest): Promise<KeyringResponse> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.SubmitRequest,\n params: request,\n }),\n SubmitRequestResponseStruct,\n );\n }\n\n async approveRequest(\n id: string,\n data: Record<string, Json> = {},\n ): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.ApproveRequest,\n params: { id, data },\n }),\n ApproveRequestResponseStruct,\n );\n }\n\n async rejectRequest(id: string): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.RejectRequest,\n params: { id },\n }),\n RejectRequestResponseStruct,\n );\n }\n}\n"]}
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _SnapRpcSender_origin, _SnapRpcSender_provider;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.KeyringSnapRpcClient = exports.SnapRpcSender = void 0;
16
- const KeyringClient_1 = require("./KeyringClient");
16
+ const KeyringClient_1 = require("./KeyringClient.cjs");
17
17
  /**
18
18
  * Implementation of the `Sender` interface that can be used to send requests
19
19
  * to a snap through the snap JSON-RPC API.
@@ -65,4 +65,4 @@ class KeyringSnapRpcClient extends KeyringClient_1.KeyringClient {
65
65
  }
66
66
  }
67
67
  exports.KeyringSnapRpcClient = KeyringSnapRpcClient;
68
- //# sourceMappingURL=KeyringSnapRpcClient.js.map
68
+ //# sourceMappingURL=KeyringSnapRpcClient.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyringSnapRpcClient.cjs","sourceRoot":"","sources":["../src/KeyringSnapRpcClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,uDAAgD;AAEhD;;;GAGG;AACH,MAAa,aAAa;IAKxB;;;;;OAKG;IACH,YAAY,MAAc,EAAE,QAAgC;QAVnD,wCAAgB;QAEhB,0CAAkC;QASzC,uBAAA,IAAI,yBAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,2BAAa,QAAQ,MAAA,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB;QAChC,OAAO,uBAAA,IAAI,+BAAU,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,sBAAsB;YAC9B,MAAM,EAAE;gBACN,MAAM,EAAE,uBAAA,IAAI,6BAAQ;gBACpB,OAAO;aACR;SACF,CAAkB,CAAC;IACtB,CAAC;CACF;AA/BD,sCA+BC;;AAED;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,6BAAa;IACrD;;;;;OAKG;IACH,YAAY,MAAc,EAAE,QAAgC;QAC1D,KAAK,CAAC,IAAI,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AAVD,oDAUC","sourcesContent":["import type { MetaMaskInpageProvider } from '@metamask/providers';\nimport type { Json } from '@metamask/utils';\n\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport type { Sender } from './KeyringClient';\nimport { KeyringClient } from './KeyringClient';\n\n/**\n * Implementation of the `Sender` interface that can be used to send requests\n * to a snap through the snap JSON-RPC API.\n */\nexport class SnapRpcSender implements Sender {\n readonly #origin: string;\n\n readonly #provider: MetaMaskInpageProvider;\n\n /**\n * Create a new instance of `SnapRpcSender`.\n *\n * @param origin - The caller's origin.\n * @param provider - The `MetaMaskInpageProvider` instance to use.\n */\n constructor(origin: string, provider: MetaMaskInpageProvider) {\n this.#origin = origin;\n this.#provider = provider;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param request - The JSON-RPC request to send to the snap.\n * @returns A promise that resolves to the response of the request.\n */\n async send(request: JsonRpcRequest): Promise<Json> {\n return this.#provider.request({\n method: 'wallet_invokeKeyring',\n params: {\n snapId: this.#origin,\n request,\n },\n }) as Promise<Json>;\n }\n}\n\n/**\n * A `KeyringClient` that allows the communication with a snap through the snap\n * JSON-RPC API.\n */\nexport class KeyringSnapRpcClient extends KeyringClient {\n /**\n * Create a new instance of `KeyringSnapRpcClient`.\n *\n * @param origin - Caller's origin.\n * @param provider - The `MetaMaskInpageProvider` instance to use.\n */\n constructor(origin: string, provider: MetaMaskInpageProvider) {\n super(new SnapRpcSender(origin, provider));\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
- import type { MetaMaskInpageProvider } from '@metamask/providers';
2
- import type { Json } from '@metamask/utils';
3
- import type { JsonRpcRequest } from './JsonRpcRequest';
4
- import type { Sender } from './KeyringClient';
5
- import { KeyringClient } from './KeyringClient';
1
+ import type { MetaMaskInpageProvider } from "@metamask/providers";
2
+ import type { Json } from "@metamask/utils";
3
+ import type { JsonRpcRequest } from "./JsonRpcRequest.cjs";
4
+ import type { Sender } from "./KeyringClient.cjs";
5
+ import { KeyringClient } from "./KeyringClient.cjs";
6
6
  /**
7
7
  * Implementation of the `Sender` interface that can be used to send requests
8
8
  * to a snap through the snap JSON-RPC API.
@@ -37,3 +37,4 @@ export declare class KeyringSnapRpcClient extends KeyringClient {
37
37
  */
38
38
  constructor(origin: string, provider: MetaMaskInpageProvider);
39
39
  }
40
+ //# sourceMappingURL=KeyringSnapRpcClient.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyringSnapRpcClient.d.cts","sourceRoot":"","sources":["../src/KeyringSnapRpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,4BAA4B;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,4BAAwB;AAC9C,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAEhD;;;GAGG;AACH,qBAAa,aAAc,YAAW,MAAM;;IAK1C;;;;;OAKG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB;IAK5D;;;;;OAKG;IACG,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CASnD;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;IACrD;;;;;OAKG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB;CAG7D"}
@@ -0,0 +1,40 @@
1
+ import type { MetaMaskInpageProvider } from "@metamask/providers";
2
+ import type { Json } from "@metamask/utils";
3
+ import type { JsonRpcRequest } from "./JsonRpcRequest.mjs";
4
+ import type { Sender } from "./KeyringClient.mjs";
5
+ import { KeyringClient } from "./KeyringClient.mjs";
6
+ /**
7
+ * Implementation of the `Sender` interface that can be used to send requests
8
+ * to a snap through the snap JSON-RPC API.
9
+ */
10
+ export declare class SnapRpcSender implements Sender {
11
+ #private;
12
+ /**
13
+ * Create a new instance of `SnapRpcSender`.
14
+ *
15
+ * @param origin - The caller's origin.
16
+ * @param provider - The `MetaMaskInpageProvider` instance to use.
17
+ */
18
+ constructor(origin: string, provider: MetaMaskInpageProvider);
19
+ /**
20
+ * Send a request to the snap and return the response.
21
+ *
22
+ * @param request - The JSON-RPC request to send to the snap.
23
+ * @returns A promise that resolves to the response of the request.
24
+ */
25
+ send(request: JsonRpcRequest): Promise<Json>;
26
+ }
27
+ /**
28
+ * A `KeyringClient` that allows the communication with a snap through the snap
29
+ * JSON-RPC API.
30
+ */
31
+ export declare class KeyringSnapRpcClient extends KeyringClient {
32
+ /**
33
+ * Create a new instance of `KeyringSnapRpcClient`.
34
+ *
35
+ * @param origin - Caller's origin.
36
+ * @param provider - The `MetaMaskInpageProvider` instance to use.
37
+ */
38
+ constructor(origin: string, provider: MetaMaskInpageProvider);
39
+ }
40
+ //# sourceMappingURL=KeyringSnapRpcClient.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyringSnapRpcClient.d.mts","sourceRoot":"","sources":["../src/KeyringSnapRpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,4BAA4B;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,4BAAwB;AAC9C,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAEhD;;;GAGG;AACH,qBAAa,aAAc,YAAW,MAAM;;IAK1C;;;;;OAKG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB;IAK5D;;;;;OAKG;IACG,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CASnD;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;IACrD;;;;;OAKG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB;CAG7D"}
@@ -0,0 +1,63 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _SnapRpcSender_origin, _SnapRpcSender_provider;
13
+ import { KeyringClient } from "./KeyringClient.mjs";
14
+ /**
15
+ * Implementation of the `Sender` interface that can be used to send requests
16
+ * to a snap through the snap JSON-RPC API.
17
+ */
18
+ export class SnapRpcSender {
19
+ /**
20
+ * Create a new instance of `SnapRpcSender`.
21
+ *
22
+ * @param origin - The caller's origin.
23
+ * @param provider - The `MetaMaskInpageProvider` instance to use.
24
+ */
25
+ constructor(origin, provider) {
26
+ _SnapRpcSender_origin.set(this, void 0);
27
+ _SnapRpcSender_provider.set(this, void 0);
28
+ __classPrivateFieldSet(this, _SnapRpcSender_origin, origin, "f");
29
+ __classPrivateFieldSet(this, _SnapRpcSender_provider, provider, "f");
30
+ }
31
+ /**
32
+ * Send a request to the snap and return the response.
33
+ *
34
+ * @param request - The JSON-RPC request to send to the snap.
35
+ * @returns A promise that resolves to the response of the request.
36
+ */
37
+ async send(request) {
38
+ return __classPrivateFieldGet(this, _SnapRpcSender_provider, "f").request({
39
+ method: 'wallet_invokeKeyring',
40
+ params: {
41
+ snapId: __classPrivateFieldGet(this, _SnapRpcSender_origin, "f"),
42
+ request,
43
+ },
44
+ });
45
+ }
46
+ }
47
+ _SnapRpcSender_origin = new WeakMap(), _SnapRpcSender_provider = new WeakMap();
48
+ /**
49
+ * A `KeyringClient` that allows the communication with a snap through the snap
50
+ * JSON-RPC API.
51
+ */
52
+ export class KeyringSnapRpcClient extends KeyringClient {
53
+ /**
54
+ * Create a new instance of `KeyringSnapRpcClient`.
55
+ *
56
+ * @param origin - Caller's origin.
57
+ * @param provider - The `MetaMaskInpageProvider` instance to use.
58
+ */
59
+ constructor(origin, provider) {
60
+ super(new SnapRpcSender(origin, provider));
61
+ }
62
+ }
63
+ //# sourceMappingURL=KeyringSnapRpcClient.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyringSnapRpcClient.mjs","sourceRoot":"","sources":["../src/KeyringSnapRpcClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAEhD;;;GAGG;AACH,MAAM,OAAO,aAAa;IAKxB;;;;;OAKG;IACH,YAAY,MAAc,EAAE,QAAgC;QAVnD,wCAAgB;QAEhB,0CAAkC;QASzC,uBAAA,IAAI,yBAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,2BAAa,QAAQ,MAAA,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB;QAChC,OAAO,uBAAA,IAAI,+BAAU,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,sBAAsB;YAC9B,MAAM,EAAE;gBACN,MAAM,EAAE,uBAAA,IAAI,6BAAQ;gBACpB,OAAO;aACR;SACF,CAAkB,CAAC;IACtB,CAAC;CACF;;AAED;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,aAAa;IACrD;;;;;OAKG;IACH,YAAY,MAAc,EAAE,QAAgC;QAC1D,KAAK,CAAC,IAAI,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["import type { MetaMaskInpageProvider } from '@metamask/providers';\nimport type { Json } from '@metamask/utils';\n\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport type { Sender } from './KeyringClient';\nimport { KeyringClient } from './KeyringClient';\n\n/**\n * Implementation of the `Sender` interface that can be used to send requests\n * to a snap through the snap JSON-RPC API.\n */\nexport class SnapRpcSender implements Sender {\n readonly #origin: string;\n\n readonly #provider: MetaMaskInpageProvider;\n\n /**\n * Create a new instance of `SnapRpcSender`.\n *\n * @param origin - The caller's origin.\n * @param provider - The `MetaMaskInpageProvider` instance to use.\n */\n constructor(origin: string, provider: MetaMaskInpageProvider) {\n this.#origin = origin;\n this.#provider = provider;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param request - The JSON-RPC request to send to the snap.\n * @returns A promise that resolves to the response of the request.\n */\n async send(request: JsonRpcRequest): Promise<Json> {\n return this.#provider.request({\n method: 'wallet_invokeKeyring',\n params: {\n snapId: this.#origin,\n request,\n },\n }) as Promise<Json>;\n }\n}\n\n/**\n * A `KeyringClient` that allows the communication with a snap through the snap\n * JSON-RPC API.\n */\nexport class KeyringSnapRpcClient extends KeyringClient {\n /**\n * Create a new instance of `KeyringSnapRpcClient`.\n *\n * @param origin - Caller's origin.\n * @param provider - The `MetaMaskInpageProvider` instance to use.\n */\n constructor(origin: string, provider: MetaMaskInpageProvider) {\n super(new SnapRpcSender(origin, provider));\n }\n}\n"]}
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KeyringAccountStruct = exports.SolAccountType = exports.BtcAccountType = exports.EthAccountType = void 0;
4
4
  const superstruct_1 = require("@metamask/superstruct");
5
5
  const utils_1 = require("@metamask/utils");
6
- const superstruct_2 = require("../superstruct");
7
- const utils_2 = require("../utils");
6
+ const superstruct_2 = require("../superstruct.cjs");
7
+ const utils_2 = require("../utils/index.cjs");
8
8
  /**
9
9
  * Supported Ethereum account types.
10
10
  */
@@ -61,4 +61,4 @@ exports.KeyringAccountStruct = (0, superstruct_2.object)({
61
61
  */
62
62
  methods: (0, superstruct_1.array)((0, superstruct_1.string)()),
63
63
  });
64
- //# sourceMappingURL=account.js.map
64
+ //# sourceMappingURL=account.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.cjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":";;;AACA,uDAAqE;AACrE,2CAA6C;AAE7C,oDAAwC;AACxC,8CAAsC;AAEtC;;GAEG;AACH,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,0CAAwB,CAAA;AAC1B,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAED;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qDAAmC,CAAA;AACrC,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAWD;;;;;;GAMG;AACU,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,kBAAU;IAEd;;OAEG;IACH,IAAI,EAAE,IAAA,mBAAK,EAAC;QACV,GAAG,cAAc,CAAC,GAAG,EAAE;QACvB,GAAG,cAAc,CAAC,OAAO,EAAE;QAC3B,GAAG,cAAc,CAAC,MAAM,EAAE;QAC1B,GAAG,cAAc,CAAC,WAAW,EAAE;KAChC,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,GAAE;IAEjB;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,oBAAM,GAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, enums, record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { object } from '../superstruct';\nimport { UuidStruct } from '../utils';\n\n/**\n * Supported Ethereum account types.\n */\nexport enum EthAccountType {\n Eoa = 'eip155:eoa',\n Erc4337 = 'eip155:erc4337',\n}\n\n/**\n * Supported Bitcoin account types.\n */\nexport enum BtcAccountType {\n P2wpkh = 'bip122:p2wpkh',\n}\n\n/**\n * Supported Solana account types.\n */\nexport enum SolAccountType {\n DataAccount = 'solana:data-account',\n}\n\n/**\n * Supported account types.\n */\nexport type KeyringAccountType =\n | `${EthAccountType.Eoa}`\n | `${EthAccountType.Erc4337}`\n | `${BtcAccountType.P2wpkh}`\n | `${SolAccountType.DataAccount}`;\n\n/**\n * A struct which represents a Keyring account object. It is abstract enough to\n * be used with any blockchain. Specific blockchain account types should extend\n * this struct.\n *\n * See {@link KeyringAccount}.\n */\nexport const KeyringAccountStruct = object({\n /**\n * Account ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Account type.\n */\n type: enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2wpkh}`,\n `${SolAccountType.DataAccount}`,\n ]),\n\n /**\n * Account main address.\n */\n address: string(),\n\n /**\n * Account options.\n */\n options: record(string(), JsonStruct),\n\n /**\n * Account supported methods.\n */\n methods: array(string()),\n});\n\n/**\n * Keyring Account type represents an account and its properties from the\n * point of view of the keyring.\n */\nexport type KeyringAccount = Infer<typeof KeyringAccountStruct>;\n"]}
@@ -1,4 +1,4 @@
1
- import type { Infer } from '@metamask/superstruct';
1
+ import type { Infer } from "@metamask/superstruct";
2
2
  /**
3
3
  * Supported Ethereum account types.
4
4
  */
@@ -67,3 +67,4 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
67
67
  * point of view of the keyring.
68
68
  */
69
69
  export type KeyringAccount = Infer<typeof KeyringAccountStruct>;
70
+ //# sourceMappingURL=account.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.d.cts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAOnD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,MAAM,kBAAkB;CACzB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;IAQH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,70 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ /**
3
+ * Supported Ethereum account types.
4
+ */
5
+ export declare enum EthAccountType {
6
+ Eoa = "eip155:eoa",
7
+ Erc4337 = "eip155:erc4337"
8
+ }
9
+ /**
10
+ * Supported Bitcoin account types.
11
+ */
12
+ export declare enum BtcAccountType {
13
+ P2wpkh = "bip122:p2wpkh"
14
+ }
15
+ /**
16
+ * Supported Solana account types.
17
+ */
18
+ export declare enum SolAccountType {
19
+ DataAccount = "solana:data-account"
20
+ }
21
+ /**
22
+ * Supported account types.
23
+ */
24
+ export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2wpkh}` | `${SolAccountType.DataAccount}`;
25
+ /**
26
+ * A struct which represents a Keyring account object. It is abstract enough to
27
+ * be used with any blockchain. Specific blockchain account types should extend
28
+ * this struct.
29
+ *
30
+ * See {@link KeyringAccount}.
31
+ */
32
+ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
33
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
34
+ id: string;
35
+ address: string;
36
+ options: Record<string, import("@metamask/utils").Json>;
37
+ methods: string[];
38
+ }, {
39
+ /**
40
+ * Account ID (UUIDv4).
41
+ */
42
+ id: import("@metamask/superstruct").Struct<string, null>;
43
+ /**
44
+ * Account type.
45
+ */
46
+ type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
47
+ "eip155:eoa": "eip155:eoa";
48
+ "eip155:erc4337": "eip155:erc4337";
49
+ "bip122:p2wpkh": "bip122:p2wpkh";
50
+ "solana:data-account": "solana:data-account";
51
+ }>;
52
+ /**
53
+ * Account main address.
54
+ */
55
+ address: import("@metamask/superstruct").Struct<string, null>;
56
+ /**
57
+ * Account options.
58
+ */
59
+ options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
60
+ /**
61
+ * Account supported methods.
62
+ */
63
+ methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
64
+ }>;
65
+ /**
66
+ * Keyring Account type represents an account and its properties from the
67
+ * point of view of the keyring.
68
+ */
69
+ export type KeyringAccount = Infer<typeof KeyringAccountStruct>;
70
+ //# sourceMappingURL=account.d.mts.map