@metamask-previews/keyring-api 10.1.0-3416820 → 11.0.0-11541a9

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 (310) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/{api/account.cjs → account.cjs} +3 -4
  3. package/dist/account.cjs.map +1 -0
  4. package/dist/{api/account.d.cts → account.d.cts} +1 -1
  5. package/dist/account.d.cts.map +1 -0
  6. package/dist/{api/account.d.mts → account.d.mts} +1 -1
  7. package/dist/account.d.mts.map +1 -0
  8. package/dist/{api/account.mjs → account.mjs} +1 -2
  9. package/dist/account.mjs.map +1 -0
  10. package/dist/balance.cjs +10 -0
  11. package/dist/balance.cjs.map +1 -0
  12. package/dist/balance.d.cts.map +1 -0
  13. package/dist/balance.d.mts.map +1 -0
  14. package/dist/{api/balance.mjs → balance.mjs} +1 -2
  15. package/dist/balance.mjs.map +1 -0
  16. package/dist/{api/caip.cjs → caip.cjs} +6 -6
  17. package/dist/caip.cjs.map +1 -0
  18. package/dist/caip.d.cts.map +1 -0
  19. package/dist/caip.d.mts.map +1 -0
  20. package/dist/{api/caip.mjs → caip.mjs} +1 -1
  21. package/dist/{api/caip.mjs.map → caip.mjs.map} +1 -1
  22. package/dist/export.cjs.map +1 -0
  23. package/dist/export.d.cts.map +1 -0
  24. package/dist/export.d.mts.map +1 -0
  25. package/dist/export.mjs.map +1 -0
  26. package/dist/index.cjs +6 -12
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +7 -12
  29. package/dist/index.d.cts.map +1 -1
  30. package/dist/index.d.mts +7 -12
  31. package/dist/index.d.mts.map +1 -1
  32. package/dist/index.mjs +6 -12
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/keyring.cjs +5 -0
  35. package/dist/keyring.cjs.map +1 -0
  36. package/dist/keyring.d.cts.map +1 -0
  37. package/dist/keyring.d.mts.map +1 -0
  38. package/dist/keyring.mjs +4 -0
  39. package/dist/keyring.mjs.map +1 -0
  40. package/dist/{api/request.cjs → request.cjs} +6 -7
  41. package/dist/request.cjs.map +1 -0
  42. package/dist/{api/request.d.cts → request.d.cts} +3 -3
  43. package/dist/request.d.cts.map +1 -0
  44. package/dist/{api/request.d.mts → request.d.mts} +3 -3
  45. package/dist/request.d.mts.map +1 -0
  46. package/dist/{api/request.mjs → request.mjs} +1 -2
  47. package/dist/request.mjs.map +1 -0
  48. package/dist/{api/response.cjs → response.cjs} +6 -6
  49. package/dist/{api/response.cjs.map → response.cjs.map} +1 -1
  50. package/dist/response.d.cts.map +1 -0
  51. package/dist/response.d.mts.map +1 -0
  52. package/dist/{api/response.mjs → response.mjs} +1 -1
  53. package/dist/{api/response.mjs.map → response.mjs.map} +1 -1
  54. package/package.json +10 -11
  55. package/dist/JsonRpcRequest.cjs +0 -13
  56. package/dist/JsonRpcRequest.cjs.map +0 -1
  57. package/dist/JsonRpcRequest.d.cts +0 -17
  58. package/dist/JsonRpcRequest.d.cts.map +0 -1
  59. package/dist/JsonRpcRequest.d.mts +0 -17
  60. package/dist/JsonRpcRequest.d.mts.map +0 -1
  61. package/dist/JsonRpcRequest.mjs +0 -10
  62. package/dist/JsonRpcRequest.mjs.map +0 -1
  63. package/dist/KeyringClient.cjs +0 -124
  64. package/dist/KeyringClient.cjs.map +0 -1
  65. package/dist/KeyringClient.d.cts +0 -29
  66. package/dist/KeyringClient.d.cts.map +0 -1
  67. package/dist/KeyringClient.d.mts +0 -29
  68. package/dist/KeyringClient.d.mts.map +0 -1
  69. package/dist/KeyringClient.mjs +0 -120
  70. package/dist/KeyringClient.mjs.map +0 -1
  71. package/dist/KeyringSnapRpcClient.cjs +0 -68
  72. package/dist/KeyringSnapRpcClient.cjs.map +0 -1
  73. package/dist/KeyringSnapRpcClient.d.cts +0 -40
  74. package/dist/KeyringSnapRpcClient.d.cts.map +0 -1
  75. package/dist/KeyringSnapRpcClient.d.mts +0 -40
  76. package/dist/KeyringSnapRpcClient.d.mts.map +0 -1
  77. package/dist/KeyringSnapRpcClient.mjs +0 -63
  78. package/dist/KeyringSnapRpcClient.mjs.map +0 -1
  79. package/dist/api/account.cjs.map +0 -1
  80. package/dist/api/account.d.cts.map +0 -1
  81. package/dist/api/account.d.mts.map +0 -1
  82. package/dist/api/account.mjs.map +0 -1
  83. package/dist/api/balance.cjs +0 -11
  84. package/dist/api/balance.cjs.map +0 -1
  85. package/dist/api/balance.d.cts.map +0 -1
  86. package/dist/api/balance.d.mts.map +0 -1
  87. package/dist/api/balance.mjs.map +0 -1
  88. package/dist/api/caip.cjs.map +0 -1
  89. package/dist/api/caip.d.cts.map +0 -1
  90. package/dist/api/caip.d.mts.map +0 -1
  91. package/dist/api/export.cjs.map +0 -1
  92. package/dist/api/export.d.cts.map +0 -1
  93. package/dist/api/export.d.mts.map +0 -1
  94. package/dist/api/export.mjs.map +0 -1
  95. package/dist/api/index.cjs +0 -23
  96. package/dist/api/index.cjs.map +0 -1
  97. package/dist/api/index.d.cts +0 -8
  98. package/dist/api/index.d.cts.map +0 -1
  99. package/dist/api/index.d.mts +0 -8
  100. package/dist/api/index.d.mts.map +0 -1
  101. package/dist/api/index.mjs +0 -7
  102. package/dist/api/index.mjs.map +0 -1
  103. package/dist/api/keyring.cjs +0 -3
  104. package/dist/api/keyring.cjs.map +0 -1
  105. package/dist/api/keyring.d.cts.map +0 -1
  106. package/dist/api/keyring.d.mts.map +0 -1
  107. package/dist/api/keyring.mjs +0 -2
  108. package/dist/api/keyring.mjs.map +0 -1
  109. package/dist/api/request.cjs.map +0 -1
  110. package/dist/api/request.d.cts.map +0 -1
  111. package/dist/api/request.d.mts.map +0 -1
  112. package/dist/api/request.mjs.map +0 -1
  113. package/dist/api/response.d.cts.map +0 -1
  114. package/dist/api/response.d.mts.map +0 -1
  115. package/dist/btc/index.cjs +0 -18
  116. package/dist/btc/index.cjs.map +0 -1
  117. package/dist/btc/index.d.cts +0 -2
  118. package/dist/btc/index.d.cts.map +0 -1
  119. package/dist/btc/index.d.mts +0 -2
  120. package/dist/btc/index.d.mts.map +0 -1
  121. package/dist/btc/index.mjs +0 -2
  122. package/dist/btc/index.mjs.map +0 -1
  123. package/dist/btc/types.cjs +0 -40
  124. package/dist/btc/types.cjs.map +0 -1
  125. package/dist/btc/types.d.cts +0 -34
  126. package/dist/btc/types.d.cts.map +0 -1
  127. package/dist/btc/types.d.mts +0 -34
  128. package/dist/btc/types.d.mts.map +0 -1
  129. package/dist/btc/types.mjs +0 -37
  130. package/dist/btc/types.mjs.map +0 -1
  131. package/dist/eth/erc4337/index.cjs +0 -18
  132. package/dist/eth/erc4337/index.cjs.map +0 -1
  133. package/dist/eth/erc4337/index.d.cts +0 -2
  134. package/dist/eth/erc4337/index.d.cts.map +0 -1
  135. package/dist/eth/erc4337/index.d.mts +0 -2
  136. package/dist/eth/erc4337/index.d.mts.map +0 -1
  137. package/dist/eth/erc4337/index.mjs +0 -2
  138. package/dist/eth/erc4337/index.mjs.map +0 -1
  139. package/dist/eth/erc4337/types.cjs +0 -62
  140. package/dist/eth/erc4337/types.cjs.map +0 -1
  141. package/dist/eth/erc4337/types.d.cts +0 -98
  142. package/dist/eth/erc4337/types.d.cts.map +0 -1
  143. package/dist/eth/erc4337/types.d.mts +0 -98
  144. package/dist/eth/erc4337/types.d.mts.map +0 -1
  145. package/dist/eth/erc4337/types.mjs +0 -59
  146. package/dist/eth/erc4337/types.mjs.map +0 -1
  147. package/dist/eth/index.cjs +0 -20
  148. package/dist/eth/index.cjs.map +0 -1
  149. package/dist/eth/index.d.cts +0 -4
  150. package/dist/eth/index.d.cts.map +0 -1
  151. package/dist/eth/index.d.mts +0 -4
  152. package/dist/eth/index.d.mts.map +0 -1
  153. package/dist/eth/index.mjs +0 -4
  154. package/dist/eth/index.mjs.map +0 -1
  155. package/dist/eth/types.cjs +0 -73
  156. package/dist/eth/types.cjs.map +0 -1
  157. package/dist/eth/types.d.cts +0 -81
  158. package/dist/eth/types.d.cts.map +0 -1
  159. package/dist/eth/types.d.mts +0 -81
  160. package/dist/eth/types.d.mts.map +0 -1
  161. package/dist/eth/types.mjs +0 -70
  162. package/dist/eth/types.mjs.map +0 -1
  163. package/dist/eth/utils.cjs +0 -15
  164. package/dist/eth/utils.cjs.map +0 -1
  165. package/dist/eth/utils.d.cts +0 -9
  166. package/dist/eth/utils.d.cts.map +0 -1
  167. package/dist/eth/utils.d.mts +0 -9
  168. package/dist/eth/utils.d.mts.map +0 -1
  169. package/dist/eth/utils.mjs +0 -11
  170. package/dist/eth/utils.mjs.map +0 -1
  171. package/dist/events.cjs +0 -17
  172. package/dist/events.cjs.map +0 -1
  173. package/dist/events.d.cts +0 -11
  174. package/dist/events.d.cts.map +0 -1
  175. package/dist/events.d.mts +0 -11
  176. package/dist/events.d.mts.map +0 -1
  177. package/dist/events.mjs +0 -14
  178. package/dist/events.mjs.map +0 -1
  179. package/dist/internal/api.cjs +0 -139
  180. package/dist/internal/api.cjs.map +0 -1
  181. package/dist/internal/api.d.cts +0 -420
  182. package/dist/internal/api.d.cts.map +0 -1
  183. package/dist/internal/api.d.mts +0 -420
  184. package/dist/internal/api.d.mts.map +0 -1
  185. package/dist/internal/api.mjs +0 -136
  186. package/dist/internal/api.mjs.map +0 -1
  187. package/dist/internal/eth/EthKeyring.cjs +0 -3
  188. package/dist/internal/eth/EthKeyring.cjs.map +0 -1
  189. package/dist/internal/eth/EthKeyring.d.cts +0 -34
  190. package/dist/internal/eth/EthKeyring.d.cts.map +0 -1
  191. package/dist/internal/eth/EthKeyring.d.mts +0 -34
  192. package/dist/internal/eth/EthKeyring.d.mts.map +0 -1
  193. package/dist/internal/eth/EthKeyring.mjs +0 -2
  194. package/dist/internal/eth/EthKeyring.mjs.map +0 -1
  195. package/dist/internal/eth/index.cjs +0 -3
  196. package/dist/internal/eth/index.cjs.map +0 -1
  197. package/dist/internal/eth/index.d.cts +0 -2
  198. package/dist/internal/eth/index.d.cts.map +0 -1
  199. package/dist/internal/eth/index.d.mts +0 -2
  200. package/dist/internal/eth/index.d.mts.map +0 -1
  201. package/dist/internal/eth/index.mjs +0 -2
  202. package/dist/internal/eth/index.mjs.map +0 -1
  203. package/dist/internal/events.cjs +0 -72
  204. package/dist/internal/events.cjs.map +0 -1
  205. package/dist/internal/events.d.cts +0 -162
  206. package/dist/internal/events.d.cts.map +0 -1
  207. package/dist/internal/events.d.mts +0 -162
  208. package/dist/internal/events.d.mts.map +0 -1
  209. package/dist/internal/events.mjs +0 -69
  210. package/dist/internal/events.mjs.map +0 -1
  211. package/dist/internal/index.cjs +0 -21
  212. package/dist/internal/index.cjs.map +0 -1
  213. package/dist/internal/index.d.cts +0 -6
  214. package/dist/internal/index.d.cts.map +0 -1
  215. package/dist/internal/index.d.mts +0 -6
  216. package/dist/internal/index.d.mts.map +0 -1
  217. package/dist/internal/index.mjs +0 -5
  218. package/dist/internal/index.mjs.map +0 -1
  219. package/dist/internal/rpc.cjs +0 -33
  220. package/dist/internal/rpc.cjs.map +0 -1
  221. package/dist/internal/rpc.d.cts +0 -26
  222. package/dist/internal/rpc.d.cts.map +0 -1
  223. package/dist/internal/rpc.d.mts +0 -26
  224. package/dist/internal/rpc.d.mts.map +0 -1
  225. package/dist/internal/rpc.mjs +0 -29
  226. package/dist/internal/rpc.mjs.map +0 -1
  227. package/dist/internal/types.cjs +0 -52
  228. package/dist/internal/types.cjs.map +0 -1
  229. package/dist/internal/types.d.cts +0 -392
  230. package/dist/internal/types.d.cts.map +0 -1
  231. package/dist/internal/types.d.mts +0 -392
  232. package/dist/internal/types.d.mts.map +0 -1
  233. package/dist/internal/types.mjs +0 -49
  234. package/dist/internal/types.mjs.map +0 -1
  235. package/dist/rpc-handler.cjs +0 -136
  236. package/dist/rpc-handler.cjs.map +0 -1
  237. package/dist/rpc-handler.d.cts +0 -30
  238. package/dist/rpc-handler.d.cts.map +0 -1
  239. package/dist/rpc-handler.d.mts +0 -30
  240. package/dist/rpc-handler.d.mts.map +0 -1
  241. package/dist/rpc-handler.mjs +0 -131
  242. package/dist/rpc-handler.mjs.map +0 -1
  243. package/dist/snap-utils.cjs +0 -21
  244. package/dist/snap-utils.cjs.map +0 -1
  245. package/dist/snap-utils.d.cts +0 -12
  246. package/dist/snap-utils.d.cts.map +0 -1
  247. package/dist/snap-utils.d.mts +0 -12
  248. package/dist/snap-utils.d.mts.map +0 -1
  249. package/dist/snap-utils.mjs +0 -17
  250. package/dist/snap-utils.mjs.map +0 -1
  251. package/dist/sol/index.cjs +0 -18
  252. package/dist/sol/index.cjs.map +0 -1
  253. package/dist/sol/index.d.cts +0 -2
  254. package/dist/sol/index.d.cts.map +0 -1
  255. package/dist/sol/index.d.mts +0 -2
  256. package/dist/sol/index.d.mts.map +0 -1
  257. package/dist/sol/index.mjs +0 -2
  258. package/dist/sol/index.mjs.map +0 -1
  259. package/dist/sol/types.cjs +0 -36
  260. package/dist/sol/types.cjs.map +0 -1
  261. package/dist/sol/types.d.cts +0 -39
  262. package/dist/sol/types.d.cts.map +0 -1
  263. package/dist/sol/types.d.mts +0 -39
  264. package/dist/sol/types.d.mts.map +0 -1
  265. package/dist/sol/types.mjs +0 -33
  266. package/dist/sol/types.mjs.map +0 -1
  267. package/dist/superstruct.cjs +0 -81
  268. package/dist/superstruct.cjs.map +0 -1
  269. package/dist/superstruct.d.cts +0 -84
  270. package/dist/superstruct.d.cts.map +0 -1
  271. package/dist/superstruct.d.mts +0 -84
  272. package/dist/superstruct.d.mts.map +0 -1
  273. package/dist/superstruct.mjs +0 -74
  274. package/dist/superstruct.mjs.map +0 -1
  275. package/dist/utils/index.cjs +0 -19
  276. package/dist/utils/index.cjs.map +0 -1
  277. package/dist/utils/index.d.cts +0 -3
  278. package/dist/utils/index.d.cts.map +0 -1
  279. package/dist/utils/index.d.mts +0 -3
  280. package/dist/utils/index.d.mts.map +0 -1
  281. package/dist/utils/index.mjs +0 -3
  282. package/dist/utils/index.mjs.map +0 -1
  283. package/dist/utils/types.cjs +0 -29
  284. package/dist/utils/types.cjs.map +0 -1
  285. package/dist/utils/types.d.cts +0 -18
  286. package/dist/utils/types.d.cts.map +0 -1
  287. package/dist/utils/types.d.mts +0 -18
  288. package/dist/utils/types.d.mts.map +0 -1
  289. package/dist/utils/types.mjs +0 -26
  290. package/dist/utils/types.mjs.map +0 -1
  291. package/dist/utils/typing.cjs +0 -21
  292. package/dist/utils/typing.cjs.map +0 -1
  293. package/dist/utils/typing.d.cts +0 -33
  294. package/dist/utils/typing.d.cts.map +0 -1
  295. package/dist/utils/typing.d.mts +0 -33
  296. package/dist/utils/typing.d.mts.map +0 -1
  297. package/dist/utils/typing.mjs +0 -17
  298. package/dist/utils/typing.mjs.map +0 -1
  299. /package/dist/{api/balance.d.cts → balance.d.cts} +0 -0
  300. /package/dist/{api/balance.d.mts → balance.d.mts} +0 -0
  301. /package/dist/{api/caip.d.cts → caip.d.cts} +0 -0
  302. /package/dist/{api/caip.d.mts → caip.d.mts} +0 -0
  303. /package/dist/{api/export.cjs → export.cjs} +0 -0
  304. /package/dist/{api/export.d.cts → export.d.cts} +0 -0
  305. /package/dist/{api/export.d.mts → export.d.mts} +0 -0
  306. /package/dist/{api/export.mjs → export.mjs} +0 -0
  307. /package/dist/{api/keyring.d.cts → keyring.d.cts} +0 -0
  308. /package/dist/{api/keyring.d.mts → keyring.d.mts} +0 -0
  309. /package/dist/{api/response.d.cts → response.d.cts} +0 -0
  310. /package/dist/{api/response.d.mts → response.d.mts} +0 -0
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
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KeyringAccountStruct = exports.SolAccountType = exports.BtcAccountType = exports.EthAccountType = void 0;
4
+ const keyring_utils_1 = require("@metamask/keyring-utils");
4
5
  const superstruct_1 = require("@metamask/superstruct");
5
6
  const utils_1 = require("@metamask/utils");
6
- const superstruct_2 = require("../superstruct.cjs");
7
- const utils_2 = require("../utils/index.cjs");
8
7
  /**
9
8
  * Supported Ethereum account types.
10
9
  */
@@ -34,11 +33,11 @@ var SolAccountType;
34
33
  *
35
34
  * See {@link KeyringAccount}.
36
35
  */
37
- exports.KeyringAccountStruct = (0, superstruct_2.object)({
36
+ exports.KeyringAccountStruct = (0, keyring_utils_1.object)({
38
37
  /**
39
38
  * Account ID (UUIDv4).
40
39
  */
41
- id: utils_2.UuidStruct,
40
+ id: keyring_utils_1.UuidStruct,
42
41
  /**
43
42
  * Account type.
44
43
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.cjs","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":";;;AAAA,2DAA6D;AAE7D,uDAAqE;AACrE,2CAA6C;AAE7C;;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,sBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,0BAAU;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 { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/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"]}
@@ -30,8 +30,8 @@ export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc
30
30
  * See {@link KeyringAccount}.
31
31
  */
32
32
  export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
33
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
34
33
  id: string;
34
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
35
35
  address: string;
36
36
  options: Record<string, import("@metamask/utils").Json>;
37
37
  methods: string[];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.d.cts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD;;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"}
@@ -30,8 +30,8 @@ export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc
30
30
  * See {@link KeyringAccount}.
31
31
  */
32
32
  export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
33
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
34
33
  id: string;
34
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
35
35
  address: string;
36
36
  options: Record<string, import("@metamask/utils").Json>;
37
37
  methods: string[];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.d.mts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD;;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"}
@@ -1,7 +1,6 @@
1
+ import { object, UuidStruct } from "@metamask/keyring-utils";
1
2
  import { array, enums, record, string } from "@metamask/superstruct";
2
3
  import { JsonStruct } from "@metamask/utils";
3
- import { object } from "../superstruct.mjs";
4
- import { UuidStruct } from "../utils/index.mjs";
5
4
  /**
6
5
  * Supported Ethereum account types.
7
6
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.mjs","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAE7D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AACrE,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C;;GAEG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,0CAAwB,CAAA;AAC1B,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qDAAmC,CAAA;AACrC,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AAWD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,EAAE,EAAE,UAAU;IAEd;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;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,MAAM,EAAE;IAEjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/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"]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BalanceStruct = void 0;
4
+ const keyring_utils_1 = require("@metamask/keyring-utils");
5
+ const superstruct_1 = require("@metamask/superstruct");
6
+ exports.BalanceStruct = (0, keyring_utils_1.object)({
7
+ amount: keyring_utils_1.StringNumberStruct,
8
+ unit: (0, superstruct_1.string)(),
9
+ });
10
+ //# sourceMappingURL=balance.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"balance.cjs","sourceRoot":"","sources":["../src/balance.ts"],"names":[],"mappings":";;;AAAA,2DAAqE;AAErE,uDAA+C;AAElC,QAAA,aAAa,GAAG,IAAA,sBAAM,EAAC;IAClC,MAAM,EAAE,kCAAkB;IAC1B,IAAI,EAAE,IAAA,oBAAM,GAAE;CACf,CAAC,CAAC","sourcesContent":["import { object, StringNumberStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { string } from '@metamask/superstruct';\n\nexport const BalanceStruct = object({\n amount: StringNumberStruct,\n unit: string(),\n});\n\nexport type Balance = Infer<typeof BalanceStruct>;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"balance.d.cts","sourceRoot":"","sources":["../src/balance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAGnD,eAAO,MAAM,aAAa;;;;;;EAGxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"balance.d.mts","sourceRoot":"","sources":["../src/balance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAGnD,eAAO,MAAM,aAAa;;;;;;EAGxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -1,6 +1,5 @@
1
+ import { object, StringNumberStruct } from "@metamask/keyring-utils";
1
2
  import { string } from "@metamask/superstruct";
2
- import { object } from "../superstruct.mjs";
3
- import { StringNumberStruct } from "../utils/index.mjs";
4
3
  export const BalanceStruct = object({
5
4
  amount: StringNumberStruct,
6
5
  unit: string(),
@@ -0,0 +1 @@
1
+ {"version":3,"file":"balance.mjs","sourceRoot":"","sources":["../src/balance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,gCAAgC;AAErE,OAAO,EAAE,MAAM,EAAE,8BAA8B;AAE/C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;IAClC,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,MAAM,EAAE;CACf,CAAC,CAAC","sourcesContent":["import { object, StringNumberStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { string } from '@metamask/superstruct';\n\nexport const BalanceStruct = object({\n amount: StringNumberStruct,\n unit: string(),\n});\n\nexport type Balance = Infer<typeof BalanceStruct>;\n"]}
@@ -1,18 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isCaipAssetId = exports.isCaipAssetType = exports.CaipAssetIdStruct = exports.CaipAssetTypeStruct = void 0;
3
+ exports.CaipAssetIdStruct = exports.CaipAssetTypeStruct = void 0;
4
+ exports.isCaipAssetType = isCaipAssetType;
5
+ exports.isCaipAssetId = isCaipAssetId;
6
+ const keyring_utils_1 = require("@metamask/keyring-utils");
4
7
  const superstruct_1 = require("@metamask/superstruct");
5
- const superstruct_2 = require("../superstruct.cjs");
6
8
  const CAIP_ASSET_TYPE_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;
7
9
  const CAIP_ASSET_ID_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;
8
10
  /**
9
11
  * A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
10
12
  */
11
- exports.CaipAssetTypeStruct = (0, superstruct_2.definePattern)('CaipAssetType', CAIP_ASSET_TYPE_REGEX);
13
+ exports.CaipAssetTypeStruct = (0, keyring_utils_1.definePattern)('CaipAssetType', CAIP_ASSET_TYPE_REGEX);
12
14
  /**
13
15
  * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
14
16
  */
15
- exports.CaipAssetIdStruct = (0, superstruct_2.definePattern)('CaipAssetId', CAIP_ASSET_ID_REGEX);
17
+ exports.CaipAssetIdStruct = (0, keyring_utils_1.definePattern)('CaipAssetId', CAIP_ASSET_ID_REGEX);
16
18
  /**
17
19
  * Check if the given value is a {@link CaipAssetType}.
18
20
  *
@@ -28,7 +30,6 @@ exports.CaipAssetIdStruct = (0, superstruct_2.definePattern)('CaipAssetId', CAIP
28
30
  function isCaipAssetType(value) {
29
31
  return (0, superstruct_1.is)(value, exports.CaipAssetTypeStruct);
30
32
  }
31
- exports.isCaipAssetType = isCaipAssetType;
32
33
  /**
33
34
  * Check if the given value is a {@link CaipAssetId}.
34
35
  *
@@ -44,5 +45,4 @@ exports.isCaipAssetType = isCaipAssetType;
44
45
  function isCaipAssetId(value) {
45
46
  return (0, superstruct_1.is)(value, exports.CaipAssetIdStruct);
46
47
  }
47
- exports.isCaipAssetId = isCaipAssetId;
48
48
  //# sourceMappingURL=caip.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caip.cjs","sourceRoot":"","sources":["../src/caip.ts"],"names":[],"mappings":";;;AAuCA,0CAEC;AAcD,sCAEC;AAzDD,2DAAwD;AACxD,uDAAuD;AAEvD,MAAM,qBAAqB,GACzB,2JAA2J,CAAC;AAE9J,MAAM,mBAAmB,GACvB,6LAA6L,CAAC;AAEhM;;GAEG;AACU,QAAA,mBAAmB,GAAG,IAAA,6BAAa,EAC9C,eAAe,EACf,qBAAqB,CACtB,CAAC;AAGF;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAA,6BAAa,EAC5C,aAAa,EACb,mBAAmB,CACpB,CAAC;AAGF;;;;;;;;;;;GAWG;AACH,SAAgB,eAAe,CAAC,KAAc;IAC5C,OAAO,IAAA,gBAAE,EAAC,KAAK,EAAE,2BAAmB,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAC,KAAc;IAC1C,OAAO,IAAA,gBAAE,EAAC,KAAK,EAAE,yBAAiB,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { definePattern } from '@metamask/keyring-utils';\nimport { is, type Infer } from '@metamask/superstruct';\n\nconst CAIP_ASSET_TYPE_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;\n\nconst CAIP_ASSET_ID_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;\n\n/**\n * A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.\n */\nexport const CaipAssetTypeStruct = definePattern(\n 'CaipAssetType',\n CAIP_ASSET_TYPE_REGEX,\n);\nexport type CaipAssetType = Infer<typeof CaipAssetTypeStruct>;\n\n/**\n * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.\n */\nexport const CaipAssetIdStruct = definePattern(\n 'CaipAssetId',\n CAIP_ASSET_ID_REGEX,\n);\nexport type CaipAssetId = Infer<typeof CaipAssetIdStruct>;\n\n/**\n * Check if the given value is a {@link CaipAssetType}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetType}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // true\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false\n * ```\n */\nexport function isCaipAssetType(value: unknown): value is CaipAssetType {\n return is(value, CaipAssetTypeStruct);\n}\n\n/**\n * Check if the given value is a {@link CaipAssetId}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetId}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // false\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true\n * ```\n */\nexport function isCaipAssetId(value: unknown): value is CaipAssetId {\n return is(value, CaipAssetIdStruct);\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caip.d.cts","sourceRoot":"","sources":["../src/caip.ts"],"names":[],"mappings":"AACA,OAAO,EAAM,KAAK,KAAK,EAAE,8BAA8B;AAQvD;;GAEG;AACH,eAAO,MAAM,mBAAmB,sDAG/B,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,iBAAiB,sDAG7B,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caip.d.mts","sourceRoot":"","sources":["../src/caip.ts"],"names":[],"mappings":"AACA,OAAO,EAAM,KAAK,KAAK,EAAE,8BAA8B;AAQvD;;GAEG;AACH,eAAO,MAAM,mBAAmB,sDAG/B,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,iBAAiB,sDAG7B,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE"}
@@ -1,5 +1,5 @@
1
+ import { definePattern } from "@metamask/keyring-utils";
1
2
  import { is } from "@metamask/superstruct";
2
- import { definePattern } from "../superstruct.mjs";
3
3
  const CAIP_ASSET_TYPE_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;
4
4
  const CAIP_ASSET_ID_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"caip.mjs","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAc,8BAA8B;AAEvD,OAAO,EAAE,aAAa,EAAE,2BAAuB;AAE/C,MAAM,qBAAqB,GACzB,2JAA2J,CAAC;AAE9J,MAAM,mBAAmB,GACvB,6LAA6L,CAAC;AAEhM;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAC9C,eAAe,EACf,qBAAqB,CACtB,CAAC;AAGF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC5C,aAAa,EACb,mBAAmB,CACpB,CAAC;AAGF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { is, type Infer } from '@metamask/superstruct';\n\nimport { definePattern } from '../superstruct';\n\nconst CAIP_ASSET_TYPE_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;\n\nconst CAIP_ASSET_ID_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;\n\n/**\n * A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.\n */\nexport const CaipAssetTypeStruct = definePattern(\n 'CaipAssetType',\n CAIP_ASSET_TYPE_REGEX,\n);\nexport type CaipAssetType = Infer<typeof CaipAssetTypeStruct>;\n\n/**\n * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.\n */\nexport const CaipAssetIdStruct = definePattern(\n 'CaipAssetId',\n CAIP_ASSET_ID_REGEX,\n);\nexport type CaipAssetId = Infer<typeof CaipAssetIdStruct>;\n\n/**\n * Check if the given value is a {@link CaipAssetType}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetType}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // true\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false\n * ```\n */\nexport function isCaipAssetType(value: unknown): value is CaipAssetType {\n return is(value, CaipAssetTypeStruct);\n}\n\n/**\n * Check if the given value is a {@link CaipAssetId}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetId}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // false\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true\n * ```\n */\nexport function isCaipAssetId(value: unknown): value is CaipAssetId {\n return is(value, CaipAssetIdStruct);\n}\n"]}
1
+ {"version":3,"file":"caip.mjs","sourceRoot":"","sources":["../src/caip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gCAAgC;AACxD,OAAO,EAAE,EAAE,EAAc,8BAA8B;AAEvD,MAAM,qBAAqB,GACzB,2JAA2J,CAAC;AAE9J,MAAM,mBAAmB,GACvB,6LAA6L,CAAC;AAEhM;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAC9C,eAAe,EACf,qBAAqB,CACtB,CAAC;AAGF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC5C,aAAa,EACb,mBAAmB,CACpB,CAAC;AAGF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { definePattern } from '@metamask/keyring-utils';\nimport { is, type Infer } from '@metamask/superstruct';\n\nconst CAIP_ASSET_TYPE_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;\n\nconst CAIP_ASSET_ID_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;\n\n/**\n * A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.\n */\nexport const CaipAssetTypeStruct = definePattern(\n 'CaipAssetType',\n CAIP_ASSET_TYPE_REGEX,\n);\nexport type CaipAssetType = Infer<typeof CaipAssetTypeStruct>;\n\n/**\n * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.\n */\nexport const CaipAssetIdStruct = definePattern(\n 'CaipAssetId',\n CAIP_ASSET_ID_REGEX,\n);\nexport type CaipAssetId = Infer<typeof CaipAssetIdStruct>;\n\n/**\n * Check if the given value is a {@link CaipAssetType}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetType}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // true\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false\n * ```\n */\nexport function isCaipAssetType(value: unknown): value is CaipAssetType {\n return is(value, CaipAssetTypeStruct);\n}\n\n/**\n * Check if the given value is a {@link CaipAssetId}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetId}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // false\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true\n * ```\n */\nexport function isCaipAssetId(value: unknown): value is CaipAssetId {\n return is(value, CaipAssetIdStruct);\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.cjs","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":";;;AACA,uDAAuD;AACvD,2CAA6C;AAEhC,QAAA,wBAAwB,GAAG,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringAccountDataStruct = record(string(), JsonStruct);\n\n/**\n * Response to a call to `exportAccount`.\n *\n * The exact response depends on the keyring implementation.\n */\nexport type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.cts","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,wBAAwB,8FAA+B,CAAC;AAErE;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.mts","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,wBAAwB,8FAA+B,CAAC;AAErE;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.mjs","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AACvD,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringAccountDataStruct = record(string(), JsonStruct);\n\n/**\n * Response to a call to `exportAccount`.\n *\n * The exact response depends on the keyring implementation.\n */\nexport type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;\n"]}
package/dist/index.cjs CHANGED
@@ -14,16 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./api/index.cjs"), exports);
18
- __exportStar(require("./btc/index.cjs"), exports);
19
- __exportStar(require("./eth/index.cjs"), exports);
20
- __exportStar(require("./sol/index.cjs"), exports);
21
- __exportStar(require("./events.cjs"), exports);
22
- __exportStar(require("./internal/index.cjs"), exports);
23
- __exportStar(require("./JsonRpcRequest.cjs"), exports);
24
- __exportStar(require("./KeyringClient.cjs"), exports);
25
- __exportStar(require("./KeyringSnapRpcClient.cjs"), exports);
26
- __exportStar(require("./rpc-handler.cjs"), exports);
27
- __exportStar(require("./snap-utils.cjs"), exports);
28
- __exportStar(require("./superstruct.cjs"), exports);
17
+ __exportStar(require("./account.cjs"), exports);
18
+ __exportStar(require("./balance.cjs"), exports);
19
+ __exportStar(require("./caip.cjs"), exports);
20
+ __exportStar(require("./export.cjs"), exports);
21
+ __exportStar(require("./request.cjs"), exports);
22
+ __exportStar(require("./response.cjs"), exports);
29
23
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAsB;AACtB,kDAAsB;AAEtB,kDAAsB;AACtB,kDAAsB;AACtB,+CAAyB;AACzB,uDAA2B;AAC3B,uDAAiC;AACjC,sDAAgC;AAChC,6DAAuC;AACvC,oDAA8B;AAC9B,mDAA6B;AAC7B,oDAA8B","sourcesContent":["export * from './api';\nexport * from './btc';\nexport type * from './contexts';\nexport * from './eth';\nexport * from './sol';\nexport * from './events';\nexport * from './internal';\nexport * from './JsonRpcRequest';\nexport * from './KeyringClient';\nexport * from './KeyringSnapRpcClient';\nexport * from './rpc-handler';\nexport * from './snap-utils';\nexport * from './superstruct';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,gDAA0B;AAC1B,6CAAuB;AACvB,+CAAyB;AAEzB,gDAA0B;AAC1B,iDAA2B","sourcesContent":["export * from './account';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport type * from './keyring';\nexport * from './request';\nexport * from './response';\nexport type * from './contexts';\n"]}
package/dist/index.d.cts CHANGED
@@ -1,14 +1,9 @@
1
- export * from "./api/index.cjs";
2
- export * from "./btc/index.cjs";
1
+ export * from "./account.cjs";
2
+ export * from "./balance.cjs";
3
+ export * from "./caip.cjs";
4
+ export * from "./export.cjs";
5
+ export type * from "./keyring.cjs";
6
+ export * from "./request.cjs";
7
+ export * from "./response.cjs";
3
8
  export type * from "./contexts.cjs";
4
- export * from "./eth/index.cjs";
5
- export * from "./sol/index.cjs";
6
- export * from "./events.cjs";
7
- export * from "./internal/index.cjs";
8
- export * from "./JsonRpcRequest.cjs";
9
- export * from "./KeyringClient.cjs";
10
- export * from "./KeyringSnapRpcClient.cjs";
11
- export * from "./rpc-handler.cjs";
12
- export * from "./snap-utils.cjs";
13
- export * from "./superstruct.cjs";
14
9
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,gCAAsB;AACtB,oCAAgC;AAChC,gCAAsB;AACtB,gCAAsB;AACtB,6BAAyB;AACzB,qCAA2B;AAC3B,qCAAiC;AACjC,oCAAgC;AAChC,2CAAuC;AACvC,kCAA8B;AAC9B,iCAA6B;AAC7B,kCAA8B"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,mCAA+B;AAC/B,8BAA0B;AAC1B,+BAA2B;AAC3B,oCAAgC"}
package/dist/index.d.mts CHANGED
@@ -1,14 +1,9 @@
1
- export * from "./api/index.mjs";
2
- export * from "./btc/index.mjs";
1
+ export * from "./account.mjs";
2
+ export * from "./balance.mjs";
3
+ export * from "./caip.mjs";
4
+ export * from "./export.mjs";
5
+ export type * from "./keyring.mjs";
6
+ export * from "./request.mjs";
7
+ export * from "./response.mjs";
3
8
  export type * from "./contexts.mjs";
4
- export * from "./eth/index.mjs";
5
- export * from "./sol/index.mjs";
6
- export * from "./events.mjs";
7
- export * from "./internal/index.mjs";
8
- export * from "./JsonRpcRequest.mjs";
9
- export * from "./KeyringClient.mjs";
10
- export * from "./KeyringSnapRpcClient.mjs";
11
- export * from "./rpc-handler.mjs";
12
- export * from "./snap-utils.mjs";
13
- export * from "./superstruct.mjs";
14
9
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,gCAAsB;AACtB,oCAAgC;AAChC,gCAAsB;AACtB,gCAAsB;AACtB,6BAAyB;AACzB,qCAA2B;AAC3B,qCAAiC;AACjC,oCAAgC;AAChC,2CAAuC;AACvC,kCAA8B;AAC9B,iCAA6B;AAC7B,kCAA8B"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,mCAA+B;AAC/B,8BAA0B;AAC1B,+BAA2B;AAC3B,oCAAgC"}
package/dist/index.mjs CHANGED
@@ -1,13 +1,7 @@
1
- export * from "./api/index.mjs";
2
- export * from "./btc/index.mjs";
3
- export * from "./eth/index.mjs";
4
- export * from "./sol/index.mjs";
5
- export * from "./events.mjs";
6
- export * from "./internal/index.mjs";
7
- export * from "./JsonRpcRequest.mjs";
8
- export * from "./KeyringClient.mjs";
9
- export * from "./KeyringSnapRpcClient.mjs";
10
- export * from "./rpc-handler.mjs";
11
- export * from "./snap-utils.mjs";
12
- export * from "./superstruct.mjs";
1
+ export * from "./account.mjs";
2
+ export * from "./balance.mjs";
3
+ export * from "./caip.mjs";
4
+ export * from "./export.mjs";
5
+ export * from "./request.mjs";
6
+ export * from "./response.mjs";
13
7
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,gCAAsB;AAEtB,gCAAsB;AACtB,gCAAsB;AACtB,6BAAyB;AACzB,qCAA2B;AAC3B,qCAAiC;AACjC,oCAAgC;AAChC,2CAAuC;AACvC,kCAA8B;AAC9B,iCAA6B;AAC7B,kCAA8B","sourcesContent":["export * from './api';\nexport * from './btc';\nexport type * from './contexts';\nexport * from './eth';\nexport * from './sol';\nexport * from './events';\nexport * from './internal';\nexport * from './JsonRpcRequest';\nexport * from './KeyringClient';\nexport * from './KeyringSnapRpcClient';\nexport * from './rpc-handler';\nexport * from './snap-utils';\nexport * from './superstruct';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AAEzB,8BAA0B;AAC1B,+BAA2B","sourcesContent":["export * from './account';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport type * from './keyring';\nexport * from './request';\nexport * from './response';\nexport type * from './contexts';\n"]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
3
+ // This rule seems to be triggering a false positive on the `KeyringAccount`.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=keyring.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../src/keyring.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { Balance } from './balance';\nimport type { CaipAssetType } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../src/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAe;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAiB;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAElD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;;OAOG;IACH,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE1C;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE5D;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,kBAAkB,CAAC,CACjB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,aAAa,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3C;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAErE;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAExD;;;;;;;OAOG;IACH,YAAY,CAAC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE3C;;;;;;;;OAQG;IACH,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE7D;;;;;;;OAOG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEjE;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../src/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAe;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAiB;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAElD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;;OAOG;IACH,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE1C;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE5D;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,kBAAkB,CAAC,CACjB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,aAAa,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3C;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAErE;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAExD;;;;;;;OAOG;IACH,YAAY,CAAC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE3C;;;;;;;;OAQG;IACH,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE7D;;;;;;;OAOG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEjE;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C,CAAC"}
@@ -0,0 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
2
+ // This rule seems to be triggering a false positive on the `KeyringAccount`.
3
+ export {};
4
+ //# sourceMappingURL=keyring.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../src/keyring.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { Balance } from './balance';\nimport type { CaipAssetType } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
@@ -1,15 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KeyringRequestStruct = void 0;
4
+ const keyring_utils_1 = require("@metamask/keyring-utils");
4
5
  const superstruct_1 = require("@metamask/superstruct");
5
6
  const utils_1 = require("@metamask/utils");
6
- const superstruct_2 = require("../superstruct.cjs");
7
- const utils_2 = require("../utils/index.cjs");
8
- exports.KeyringRequestStruct = (0, superstruct_2.object)({
7
+ exports.KeyringRequestStruct = (0, keyring_utils_1.object)({
9
8
  /**
10
9
  * Keyring request ID (UUIDv4).
11
10
  */
12
- id: utils_2.UuidStruct,
11
+ id: keyring_utils_1.UuidStruct,
13
12
  /**
14
13
  * Request's scope (CAIP-2 chain ID).
15
14
  */
@@ -17,13 +16,13 @@ exports.KeyringRequestStruct = (0, superstruct_2.object)({
17
16
  /**
18
17
  * Account ID (UUIDv4).
19
18
  */
20
- account: utils_2.UuidStruct,
19
+ account: keyring_utils_1.UuidStruct,
21
20
  /**
22
21
  * Inner request sent by the client application.
23
22
  */
24
- request: (0, superstruct_2.object)({
23
+ request: (0, keyring_utils_1.object)({
25
24
  method: (0, superstruct_1.string)(),
26
- 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)])),
25
+ params: (0, keyring_utils_1.exactOptional)((0, superstruct_1.union)([(0, superstruct_1.array)(utils_1.JsonStruct), (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct)])),
27
26
  }),
28
27
  });
29
28
  //# sourceMappingURL=request.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.cjs","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":";;;AAAA,2DAA4E;AAE5E,uDAAqE;AACrE,2CAA6C;AAEhC,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,0BAAU;IAEd;;OAEG;IACH,KAAK,EAAE,IAAA,oBAAM,GAAE;IAEf;;OAEG;IACH,OAAO,EAAE,0BAAU;IAEnB;;OAEG;IACH,OAAO,EAAE,IAAA,sBAAM,EAAC;QACd,MAAM,EAAE,IAAA,oBAAM,GAAE;QAChB,MAAM,EAAE,IAAA,6BAAa,EACnB,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,kBAAU,CAAC,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,CACzD;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, record, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringRequestStruct = object({\n /**\n * Keyring request ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Request's scope (CAIP-2 chain ID).\n */\n scope: string(),\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Inner request sent by the client application.\n */\n request: object({\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n }),\n});\n\n/**\n * Keyring request.\n *\n * Represents a request made to the keyring for account-related operations.\n */\nexport type KeyringRequest = Infer<typeof KeyringRequestStruct>;\n"]}
@@ -5,7 +5,7 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
5
5
  account: string;
6
6
  request: {
7
7
  method: string;
8
- params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
8
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
9
9
  };
10
10
  }, {
11
11
  /**
@@ -25,10 +25,10 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
25
25
  */
26
26
  request: import("@metamask/superstruct").Struct<{
27
27
  method: string;
28
- params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
28
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
29
29
  }, {
30
30
  method: import("@metamask/superstruct").Struct<string, null>;
31
- params: import("@metamask/superstruct").Struct<import("../superstruct.cjs").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
31
+ params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/keyring-utils").ExactOptionalTag | import("@metamask/utils").Json[], null>;
32
32
  }>;
33
33
  }>;
34
34
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.cts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,oBAAoB;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;EAOH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -5,7 +5,7 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
5
5
  account: string;
6
6
  request: {
7
7
  method: string;
8
- params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
8
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
9
9
  };
10
10
  }, {
11
11
  /**
@@ -25,10 +25,10 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
25
25
  */
26
26
  request: import("@metamask/superstruct").Struct<{
27
27
  method: string;
28
- params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
28
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
29
29
  }, {
30
30
  method: import("@metamask/superstruct").Struct<string, null>;
31
- params: import("@metamask/superstruct").Struct<import("../superstruct.mjs").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
31
+ params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/keyring-utils").ExactOptionalTag | import("@metamask/utils").Json[], null>;
32
32
  }>;
33
33
  }>;
34
34
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.mts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,oBAAoB;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;EAOH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,7 +1,6 @@
1
+ import { exactOptional, object, UuidStruct } from "@metamask/keyring-utils";
1
2
  import { array, record, string, union } from "@metamask/superstruct";
2
3
  import { JsonStruct } from "@metamask/utils";
3
- import { exactOptional, object } from "../superstruct.mjs";
4
- import { UuidStruct } from "../utils/index.mjs";
5
4
  export const KeyringRequestStruct = object({
6
5
  /**
7
6
  * Keyring request ID (UUIDv4).
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.mjs","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAE5E,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;AACrE,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,EAAE,EAAE,UAAU;IAEd;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE;IAEf;;OAEG;IACH,OAAO,EAAE,UAAU;IAEnB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,EAAE;QAChB,MAAM,EAAE,aAAa,CACnB,KAAK,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CACzD;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, record, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringRequestStruct = object({\n /**\n * Keyring request ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Request's scope (CAIP-2 chain ID).\n */\n scope: string(),\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Inner request sent by the client application.\n */\n request: object({\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n }),\n});\n\n/**\n * Keyring request.\n *\n * Represents a request made to the keyring for account-related operations.\n */\nexport type KeyringRequest = Infer<typeof KeyringRequestStruct>;\n"]}
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KeyringResponseStruct = void 0;
4
+ const keyring_utils_1 = require("@metamask/keyring-utils");
4
5
  const superstruct_1 = require("@metamask/superstruct");
5
6
  const utils_1 = require("@metamask/utils");
6
- const superstruct_2 = require("../superstruct.cjs");
7
7
  exports.KeyringResponseStruct = (0, superstruct_1.union)([
8
- (0, superstruct_2.object)({
8
+ (0, keyring_utils_1.object)({
9
9
  /**
10
10
  * Pending flag.
11
11
  *
@@ -21,12 +21,12 @@ exports.KeyringResponseStruct = (0, superstruct_1.union)([
21
21
  * with a link to the redirect URL. The user can choose to follow the link
22
22
  * or cancel the request.
23
23
  */
24
- redirect: (0, superstruct_2.exactOptional)((0, superstruct_2.object)({
25
- message: (0, superstruct_2.exactOptional)((0, superstruct_1.string)()),
26
- url: (0, superstruct_2.exactOptional)((0, superstruct_1.string)()),
24
+ redirect: (0, keyring_utils_1.exactOptional)((0, keyring_utils_1.object)({
25
+ message: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
26
+ url: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
27
27
  })),
28
28
  }),
29
- (0, superstruct_2.object)({
29
+ (0, keyring_utils_1.object)({
30
30
  /**
31
31
  * Pending flag.
32
32
  *
@@ -1 +1 @@
1
- {"version":3,"file":"response.cjs","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":";;;AACA,uDAA+D;AAC/D,2CAA6C;AAE7C,oDAAuD;AAE1C,QAAA,qBAAqB,GAAG,IAAA,mBAAK,EAAC;IACzC,IAAA,oBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC;QAEtB;;;;;;WAMG;QACH,QAAQ,EAAE,IAAA,2BAAa,EACrB,IAAA,oBAAM,EAAC;YACL,OAAO,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;YAChC,GAAG,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;SAC7B,CAAC,CACH;KACF,CAAC;IACF,IAAA,oBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;QAEvB;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { literal, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from '../superstruct';\n\nexport const KeyringResponseStruct = union([\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to true indicates that the request will be\n * handled asynchronously. The keyring must be called with `approveRequest`\n * or `rejectRequest` to resolve the request.\n */\n pending: literal(true),\n\n /**\n * Redirect URL.\n *\n * If present in the response, MetaMask will display a confirmation dialog\n * with a link to the redirect URL. The user can choose to follow the link\n * or cancel the request.\n */\n redirect: exactOptional(\n object({\n message: exactOptional(string()),\n url: exactOptional(string()),\n }),\n ),\n }),\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to false indicates that the request will be\n * handled synchronously. The keyring must return the result of the\n * request execution.\n */\n pending: literal(false),\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n]);\n\n/**\n * Response to a call to `submitRequest`.\n *\n * Keyring implementations must return a response with `pending: true` if the\n * request will be handled asynchronously. Otherwise, the response must contain\n * the result of the request and `pending: false`.\n *\n * In the asynchronous case, the keyring can return a redirect URL and message\n * to be shown to the user. The user can choose to follow the link or cancel\n * the request. The main use case for this is to redirect the user to the snap\n * dapp to review the request.\n */\nexport type KeyringResponse = Infer<typeof KeyringResponseStruct>;\n"]}
1
+ {"version":3,"file":"response.cjs","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAA+D;AAC/D,2CAA6C;AAEhC,QAAA,qBAAqB,GAAG,IAAA,mBAAK,EAAC;IACzC,IAAA,sBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC;QAEtB;;;;;;WAMG;QACH,QAAQ,EAAE,IAAA,6BAAa,EACrB,IAAA,sBAAM,EAAC;YACL,OAAO,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;YAChC,GAAG,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;SAC7B,CAAC,CACH;KACF,CAAC;IACF,IAAA,sBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;QAEvB;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { literal, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringResponseStruct = union([\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to true indicates that the request will be\n * handled asynchronously. The keyring must be called with `approveRequest`\n * or `rejectRequest` to resolve the request.\n */\n pending: literal(true),\n\n /**\n * Redirect URL.\n *\n * If present in the response, MetaMask will display a confirmation dialog\n * with a link to the redirect URL. The user can choose to follow the link\n * or cancel the request.\n */\n redirect: exactOptional(\n object({\n message: exactOptional(string()),\n url: exactOptional(string()),\n }),\n ),\n }),\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to false indicates that the request will be\n * handled synchronously. The keyring must return the result of the\n * request execution.\n */\n pending: literal(false),\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n]);\n\n/**\n * Response to a call to `submitRequest`.\n *\n * Keyring implementations must return a response with `pending: true` if the\n * request will be handled asynchronously. Otherwise, the response must contain\n * the result of the request and `pending: false`.\n *\n * In the asynchronous case, the keyring can return a redirect URL and message\n * to be shown to the user. The user can choose to follow the link or cancel\n * the request. The main use case for this is to redirect the user to the snap\n * dapp to review the request.\n */\nexport type KeyringResponse = Infer<typeof KeyringResponseStruct>;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.d.cts","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,qBAAqB;;;;;;;;;QAwChC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}