@metamask-previews/keyring-api 11.0.0-b85bfaa → 11.0.0-cd6bf38

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 (332) hide show
  1. package/dist/JsonRpcRequest.cjs +13 -0
  2. package/dist/JsonRpcRequest.cjs.map +1 -0
  3. package/dist/JsonRpcRequest.d.cts +17 -0
  4. package/dist/JsonRpcRequest.d.cts.map +1 -0
  5. package/dist/JsonRpcRequest.d.mts +17 -0
  6. package/dist/JsonRpcRequest.d.mts.map +1 -0
  7. package/dist/JsonRpcRequest.mjs +10 -0
  8. package/dist/JsonRpcRequest.mjs.map +1 -0
  9. package/dist/KeyringClient.cjs +130 -0
  10. package/dist/KeyringClient.cjs.map +1 -0
  11. package/dist/KeyringClient.d.cts +31 -0
  12. package/dist/KeyringClient.d.cts.map +1 -0
  13. package/dist/KeyringClient.d.mts +31 -0
  14. package/dist/KeyringClient.d.mts.map +1 -0
  15. package/dist/KeyringClient.mjs +126 -0
  16. package/dist/KeyringClient.mjs.map +1 -0
  17. package/dist/KeyringSnapRpcClient.cjs +68 -0
  18. package/dist/KeyringSnapRpcClient.cjs.map +1 -0
  19. package/dist/KeyringSnapRpcClient.d.cts +40 -0
  20. package/dist/KeyringSnapRpcClient.d.cts.map +1 -0
  21. package/dist/KeyringSnapRpcClient.d.mts +40 -0
  22. package/dist/KeyringSnapRpcClient.d.mts.map +1 -0
  23. package/dist/KeyringSnapRpcClient.mjs +63 -0
  24. package/dist/KeyringSnapRpcClient.mjs.map +1 -0
  25. package/dist/{account.cjs → api/account.cjs} +4 -3
  26. package/dist/api/account.cjs.map +1 -0
  27. package/dist/{account.d.cts → api/account.d.cts} +1 -1
  28. package/dist/api/account.d.cts.map +1 -0
  29. package/dist/{account.d.mts → api/account.d.mts} +1 -1
  30. package/dist/api/account.d.mts.map +1 -0
  31. package/dist/{account.mjs → api/account.mjs} +2 -1
  32. package/dist/api/account.mjs.map +1 -0
  33. package/dist/api/asset.cjs +83 -0
  34. package/dist/api/asset.cjs.map +1 -0
  35. package/dist/api/asset.d.cts +93 -0
  36. package/dist/api/asset.d.cts.map +1 -0
  37. package/dist/api/asset.d.mts +93 -0
  38. package/dist/api/asset.d.mts.map +1 -0
  39. package/dist/api/asset.mjs +80 -0
  40. package/dist/api/asset.mjs.map +1 -0
  41. package/dist/api/balance.cjs +11 -0
  42. package/dist/api/balance.cjs.map +1 -0
  43. package/dist/{balance.d.cts → api/balance.d.cts} +1 -1
  44. package/dist/api/balance.d.cts.map +1 -0
  45. package/dist/{balance.d.mts → api/balance.d.mts} +1 -1
  46. package/dist/api/balance.d.mts.map +1 -0
  47. package/dist/{balance.mjs → api/balance.mjs} +2 -1
  48. package/dist/api/balance.mjs.map +1 -0
  49. package/dist/{caip.cjs → api/caip.cjs} +3 -3
  50. package/dist/{caip.cjs.map → api/caip.cjs.map} +1 -1
  51. package/dist/api/caip.d.cts.map +1 -0
  52. package/dist/api/caip.d.mts.map +1 -0
  53. package/dist/{caip.mjs → api/caip.mjs} +1 -1
  54. package/dist/{caip.mjs.map → api/caip.mjs.map} +1 -1
  55. package/dist/api/export.cjs.map +1 -0
  56. package/dist/api/export.d.cts.map +1 -0
  57. package/dist/api/export.d.mts.map +1 -0
  58. package/dist/api/export.mjs.map +1 -0
  59. package/dist/api/index.cjs +25 -0
  60. package/dist/api/index.cjs.map +1 -0
  61. package/dist/api/index.d.cts +10 -0
  62. package/dist/api/index.d.cts.map +1 -0
  63. package/dist/api/index.d.mts +10 -0
  64. package/dist/api/index.d.mts.map +1 -0
  65. package/dist/api/index.mjs +9 -0
  66. package/dist/api/index.mjs.map +1 -0
  67. package/dist/api/keyring.cjs +3 -0
  68. package/dist/api/keyring.cjs.map +1 -0
  69. package/dist/{keyring.d.cts → api/keyring.d.cts} +14 -0
  70. package/dist/api/keyring.d.cts.map +1 -0
  71. package/dist/{keyring.d.mts → api/keyring.d.mts} +14 -0
  72. package/dist/api/keyring.d.mts.map +1 -0
  73. package/dist/api/keyring.mjs +2 -0
  74. package/dist/api/keyring.mjs.map +1 -0
  75. package/dist/{request.cjs → api/request.cjs} +7 -6
  76. package/dist/api/request.cjs.map +1 -0
  77. package/dist/{request.d.cts → api/request.d.cts} +3 -3
  78. package/dist/api/request.d.cts.map +1 -0
  79. package/dist/{request.d.mts → api/request.d.mts} +3 -3
  80. package/dist/api/request.d.mts.map +1 -0
  81. package/dist/{request.mjs → api/request.mjs} +2 -1
  82. package/dist/api/request.mjs.map +1 -0
  83. package/dist/{response.cjs → api/response.cjs} +6 -6
  84. package/dist/{response.cjs.map → api/response.cjs.map} +1 -1
  85. package/dist/api/response.d.cts.map +1 -0
  86. package/dist/api/response.d.mts.map +1 -0
  87. package/dist/{response.mjs → api/response.mjs} +1 -1
  88. package/dist/{response.mjs.map → api/response.mjs.map} +1 -1
  89. package/dist/api/transaction.cjs +283 -0
  90. package/dist/api/transaction.cjs.map +1 -0
  91. package/dist/api/transaction.d.cts +761 -0
  92. package/dist/api/transaction.d.cts.map +1 -0
  93. package/dist/api/transaction.d.mts +761 -0
  94. package/dist/api/transaction.d.mts.map +1 -0
  95. package/dist/api/transaction.mjs +280 -0
  96. package/dist/api/transaction.mjs.map +1 -0
  97. package/dist/btc/index.cjs +18 -0
  98. package/dist/btc/index.cjs.map +1 -0
  99. package/dist/btc/index.d.cts +2 -0
  100. package/dist/btc/index.d.cts.map +1 -0
  101. package/dist/btc/index.d.mts +2 -0
  102. package/dist/btc/index.d.mts.map +1 -0
  103. package/dist/btc/index.mjs +2 -0
  104. package/dist/btc/index.mjs.map +1 -0
  105. package/dist/btc/types.cjs +40 -0
  106. package/dist/btc/types.cjs.map +1 -0
  107. package/dist/btc/types.d.cts +34 -0
  108. package/dist/btc/types.d.cts.map +1 -0
  109. package/dist/btc/types.d.mts +34 -0
  110. package/dist/btc/types.d.mts.map +1 -0
  111. package/dist/btc/types.mjs +37 -0
  112. package/dist/btc/types.mjs.map +1 -0
  113. package/dist/eth/erc4337/index.cjs +18 -0
  114. package/dist/eth/erc4337/index.cjs.map +1 -0
  115. package/dist/eth/erc4337/index.d.cts +2 -0
  116. package/dist/eth/erc4337/index.d.cts.map +1 -0
  117. package/dist/eth/erc4337/index.d.mts +2 -0
  118. package/dist/eth/erc4337/index.d.mts.map +1 -0
  119. package/dist/eth/erc4337/index.mjs +2 -0
  120. package/dist/eth/erc4337/index.mjs.map +1 -0
  121. package/dist/eth/erc4337/types.cjs +62 -0
  122. package/dist/eth/erc4337/types.cjs.map +1 -0
  123. package/dist/eth/erc4337/types.d.cts +98 -0
  124. package/dist/eth/erc4337/types.d.cts.map +1 -0
  125. package/dist/eth/erc4337/types.d.mts +98 -0
  126. package/dist/eth/erc4337/types.d.mts.map +1 -0
  127. package/dist/eth/erc4337/types.mjs +59 -0
  128. package/dist/eth/erc4337/types.mjs.map +1 -0
  129. package/dist/eth/index.cjs +20 -0
  130. package/dist/eth/index.cjs.map +1 -0
  131. package/dist/eth/index.d.cts +4 -0
  132. package/dist/eth/index.d.cts.map +1 -0
  133. package/dist/eth/index.d.mts +4 -0
  134. package/dist/eth/index.d.mts.map +1 -0
  135. package/dist/eth/index.mjs +4 -0
  136. package/dist/eth/index.mjs.map +1 -0
  137. package/dist/eth/types.cjs +73 -0
  138. package/dist/eth/types.cjs.map +1 -0
  139. package/dist/eth/types.d.cts +81 -0
  140. package/dist/eth/types.d.cts.map +1 -0
  141. package/dist/eth/types.d.mts +81 -0
  142. package/dist/eth/types.d.mts.map +1 -0
  143. package/dist/eth/types.mjs +70 -0
  144. package/dist/eth/types.mjs.map +1 -0
  145. package/dist/eth/utils.cjs +14 -0
  146. package/dist/eth/utils.cjs.map +1 -0
  147. package/dist/eth/utils.d.cts +9 -0
  148. package/dist/eth/utils.d.cts.map +1 -0
  149. package/dist/eth/utils.d.mts +9 -0
  150. package/dist/eth/utils.d.mts.map +1 -0
  151. package/dist/eth/utils.mjs +11 -0
  152. package/dist/eth/utils.mjs.map +1 -0
  153. package/dist/events.cjs +17 -0
  154. package/dist/events.cjs.map +1 -0
  155. package/dist/events.d.cts +11 -0
  156. package/dist/events.d.cts.map +1 -0
  157. package/dist/events.d.mts +11 -0
  158. package/dist/events.d.mts.map +1 -0
  159. package/dist/events.mjs +14 -0
  160. package/dist/events.mjs.map +1 -0
  161. package/dist/index.cjs +12 -6
  162. package/dist/index.cjs.map +1 -1
  163. package/dist/index.d.cts +12 -7
  164. package/dist/index.d.cts.map +1 -1
  165. package/dist/index.d.mts +12 -7
  166. package/dist/index.d.mts.map +1 -1
  167. package/dist/index.mjs +12 -6
  168. package/dist/index.mjs.map +1 -1
  169. package/dist/internal/api.cjs +150 -0
  170. package/dist/internal/api.cjs.map +1 -0
  171. package/dist/internal/api.d.cts +737 -0
  172. package/dist/internal/api.d.cts.map +1 -0
  173. package/dist/internal/api.d.mts +737 -0
  174. package/dist/internal/api.d.mts.map +1 -0
  175. package/dist/internal/api.mjs +147 -0
  176. package/dist/internal/api.mjs.map +1 -0
  177. package/dist/internal/eth/EthKeyring.cjs +3 -0
  178. package/dist/internal/eth/EthKeyring.cjs.map +1 -0
  179. package/dist/internal/eth/EthKeyring.d.cts +34 -0
  180. package/dist/internal/eth/EthKeyring.d.cts.map +1 -0
  181. package/dist/internal/eth/EthKeyring.d.mts +34 -0
  182. package/dist/internal/eth/EthKeyring.d.mts.map +1 -0
  183. package/dist/internal/eth/EthKeyring.mjs +2 -0
  184. package/dist/internal/eth/EthKeyring.mjs.map +1 -0
  185. package/dist/internal/eth/index.cjs +3 -0
  186. package/dist/internal/eth/index.cjs.map +1 -0
  187. package/dist/internal/eth/index.d.cts +2 -0
  188. package/dist/internal/eth/index.d.cts.map +1 -0
  189. package/dist/internal/eth/index.d.mts +2 -0
  190. package/dist/internal/eth/index.d.mts.map +1 -0
  191. package/dist/internal/eth/index.mjs +2 -0
  192. package/dist/internal/eth/index.mjs.map +1 -0
  193. package/dist/internal/events.cjs +72 -0
  194. package/dist/internal/events.cjs.map +1 -0
  195. package/dist/internal/events.d.cts +162 -0
  196. package/dist/internal/events.d.cts.map +1 -0
  197. package/dist/internal/events.d.mts +162 -0
  198. package/dist/internal/events.d.mts.map +1 -0
  199. package/dist/internal/events.mjs +69 -0
  200. package/dist/internal/events.mjs.map +1 -0
  201. package/dist/internal/index.cjs +21 -0
  202. package/dist/internal/index.cjs.map +1 -0
  203. package/dist/internal/index.d.cts +6 -0
  204. package/dist/internal/index.d.cts.map +1 -0
  205. package/dist/internal/index.d.mts +6 -0
  206. package/dist/internal/index.d.mts.map +1 -0
  207. package/dist/internal/index.mjs +5 -0
  208. package/dist/internal/index.mjs.map +1 -0
  209. package/dist/internal/rpc.cjs +34 -0
  210. package/dist/internal/rpc.cjs.map +1 -0
  211. package/dist/internal/rpc.d.cts +27 -0
  212. package/dist/internal/rpc.d.cts.map +1 -0
  213. package/dist/internal/rpc.d.mts +27 -0
  214. package/dist/internal/rpc.d.mts.map +1 -0
  215. package/dist/internal/rpc.mjs +30 -0
  216. package/dist/internal/rpc.mjs.map +1 -0
  217. package/dist/internal/types.cjs +52 -0
  218. package/dist/internal/types.cjs.map +1 -0
  219. package/dist/internal/types.d.cts +392 -0
  220. package/dist/internal/types.d.cts.map +1 -0
  221. package/dist/internal/types.d.mts +392 -0
  222. package/dist/internal/types.d.mts.map +1 -0
  223. package/dist/internal/types.mjs +49 -0
  224. package/dist/internal/types.mjs.map +1 -0
  225. package/dist/rpc-handler.cjs +143 -0
  226. package/dist/rpc-handler.cjs.map +1 -0
  227. package/dist/rpc-handler.d.cts +30 -0
  228. package/dist/rpc-handler.d.cts.map +1 -0
  229. package/dist/rpc-handler.d.mts +30 -0
  230. package/dist/rpc-handler.d.mts.map +1 -0
  231. package/dist/rpc-handler.mjs +138 -0
  232. package/dist/rpc-handler.mjs.map +1 -0
  233. package/dist/snap-utils.cjs +20 -0
  234. package/dist/snap-utils.cjs.map +1 -0
  235. package/dist/snap-utils.d.cts +12 -0
  236. package/dist/snap-utils.d.cts.map +1 -0
  237. package/dist/snap-utils.d.mts +12 -0
  238. package/dist/snap-utils.d.mts.map +1 -0
  239. package/dist/snap-utils.mjs +17 -0
  240. package/dist/snap-utils.mjs.map +1 -0
  241. package/dist/sol/index.cjs +18 -0
  242. package/dist/sol/index.cjs.map +1 -0
  243. package/dist/sol/index.d.cts +2 -0
  244. package/dist/sol/index.d.cts.map +1 -0
  245. package/dist/sol/index.d.mts +2 -0
  246. package/dist/sol/index.d.mts.map +1 -0
  247. package/dist/sol/index.mjs +2 -0
  248. package/dist/sol/index.mjs.map +1 -0
  249. package/dist/sol/types.cjs +36 -0
  250. package/dist/sol/types.cjs.map +1 -0
  251. package/dist/sol/types.d.cts +39 -0
  252. package/dist/sol/types.d.cts.map +1 -0
  253. package/dist/sol/types.d.mts +39 -0
  254. package/dist/sol/types.d.mts.map +1 -0
  255. package/dist/sol/types.mjs +33 -0
  256. package/dist/sol/types.mjs.map +1 -0
  257. package/dist/superstruct.cjs +109 -0
  258. package/dist/superstruct.cjs.map +1 -0
  259. package/dist/superstruct.d.cts +102 -0
  260. package/dist/superstruct.d.cts.map +1 -0
  261. package/dist/superstruct.d.mts +102 -0
  262. package/dist/superstruct.d.mts.map +1 -0
  263. package/dist/superstruct.mjs +102 -0
  264. package/dist/superstruct.mjs.map +1 -0
  265. package/dist/utils/index.cjs +20 -0
  266. package/dist/utils/index.cjs.map +1 -0
  267. package/dist/utils/index.d.cts +4 -0
  268. package/dist/utils/index.d.cts.map +1 -0
  269. package/dist/utils/index.d.mts +4 -0
  270. package/dist/utils/index.d.mts.map +1 -0
  271. package/dist/utils/index.mjs +4 -0
  272. package/dist/utils/index.mjs.map +1 -0
  273. package/dist/utils/pagination.cjs +28 -0
  274. package/dist/utils/pagination.cjs.map +1 -0
  275. package/dist/utils/pagination.d.cts +59 -0
  276. package/dist/utils/pagination.d.cts.map +1 -0
  277. package/dist/utils/pagination.d.mts +59 -0
  278. package/dist/utils/pagination.d.mts.map +1 -0
  279. package/dist/utils/pagination.mjs +25 -0
  280. package/dist/utils/pagination.mjs.map +1 -0
  281. package/dist/utils/types.cjs +29 -0
  282. package/dist/utils/types.cjs.map +1 -0
  283. package/dist/utils/types.d.cts +42 -0
  284. package/dist/utils/types.d.cts.map +1 -0
  285. package/dist/utils/types.d.mts +42 -0
  286. package/dist/utils/types.d.mts.map +1 -0
  287. package/dist/utils/types.mjs +26 -0
  288. package/dist/utils/types.mjs.map +1 -0
  289. package/dist/utils/typing.cjs +20 -0
  290. package/dist/utils/typing.cjs.map +1 -0
  291. package/dist/utils/typing.d.cts +33 -0
  292. package/dist/utils/typing.d.cts.map +1 -0
  293. package/dist/utils/typing.d.mts +33 -0
  294. package/dist/utils/typing.d.mts.map +1 -0
  295. package/dist/utils/typing.mjs +17 -0
  296. package/dist/utils/typing.mjs.map +1 -0
  297. package/package.json +11 -10
  298. package/dist/account.cjs.map +0 -1
  299. package/dist/account.d.cts.map +0 -1
  300. package/dist/account.d.mts.map +0 -1
  301. package/dist/account.mjs.map +0 -1
  302. package/dist/balance.cjs +0 -10
  303. package/dist/balance.cjs.map +0 -1
  304. package/dist/balance.d.cts.map +0 -1
  305. package/dist/balance.d.mts.map +0 -1
  306. package/dist/balance.mjs.map +0 -1
  307. package/dist/caip.d.cts.map +0 -1
  308. package/dist/caip.d.mts.map +0 -1
  309. package/dist/export.cjs.map +0 -1
  310. package/dist/export.d.cts.map +0 -1
  311. package/dist/export.d.mts.map +0 -1
  312. package/dist/export.mjs.map +0 -1
  313. package/dist/keyring.cjs +0 -5
  314. package/dist/keyring.cjs.map +0 -1
  315. package/dist/keyring.d.cts.map +0 -1
  316. package/dist/keyring.d.mts.map +0 -1
  317. package/dist/keyring.mjs +0 -4
  318. package/dist/keyring.mjs.map +0 -1
  319. package/dist/request.cjs.map +0 -1
  320. package/dist/request.d.cts.map +0 -1
  321. package/dist/request.d.mts.map +0 -1
  322. package/dist/request.mjs.map +0 -1
  323. package/dist/response.d.cts.map +0 -1
  324. package/dist/response.d.mts.map +0 -1
  325. /package/dist/{caip.d.cts → api/caip.d.cts} +0 -0
  326. /package/dist/{caip.d.mts → api/caip.d.mts} +0 -0
  327. /package/dist/{export.cjs → api/export.cjs} +0 -0
  328. /package/dist/{export.d.cts → api/export.d.cts} +0 -0
  329. /package/dist/{export.d.mts → api/export.d.mts} +0 -0
  330. /package/dist/{export.mjs → api/export.mjs} +0 -0
  331. /package/dist/{response.d.cts → api/response.d.cts} +0 -0
  332. /package/dist/{response.d.mts → api/response.d.mts} +0 -0
@@ -0,0 +1,42 @@
1
+ import { type Infer } from "@metamask/superstruct";
2
+ /**
3
+ * UUIDv4 struct.
4
+ */
5
+ export declare const UuidStruct: import("@metamask/superstruct").Struct<string, null>;
6
+ /**
7
+ * Validates if a given value is a valid URL.
8
+ *
9
+ * @param value - The value to be validated.
10
+ * @returns A boolean indicating if the value is a valid URL.
11
+ */
12
+ export declare const UrlStruct: import("@metamask/superstruct").Struct<string, null>;
13
+ /**
14
+ * A string which contains a positive float number.
15
+ */
16
+ export declare const StringNumberStruct: import("@metamask/superstruct").Struct<string, null>;
17
+ export type StringNumber = Infer<typeof StringNumberStruct>;
18
+ /**
19
+ * This is a helper type used by the {@link Equals} type.
20
+ */
21
+ type EqualsHelper<Type> = <Dummy>() => Dummy extends Type ? 1 : 2;
22
+ /**
23
+ * A utility type that checks whether two types are exactly the same.
24
+ *
25
+ * This type evaluates to `true` if `TypeA` and `TypeB` are identical,
26
+ * otherwise it evaluates to `false`.
27
+ *
28
+ * @template TypeA - The first type to compare.
29
+ * @template TypeB - The second type to compare.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * // Example usage:
34
+ * type Test1 = Equals<number, number>; // true
35
+ * type Test2 = Equals<number, string>; // false
36
+ * type Test3 = Equals<{ a: string }, { a: string }>; // true
37
+ * type Test4 = Equals<{ a: string }, { a: number }>; // false
38
+ * ```
39
+ */
40
+ export type Equals<TypeA, TypeB> = EqualsHelper<TypeA> extends EqualsHelper<TypeB> ? true : false;
41
+ export {};
42
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,KAAK,EAAE,8BAA8B;AAI3D;;GAEG;AACH,eAAO,MAAM,UAAU,sDAGtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,sDAOpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAG9B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE5D;;GAEG;AACH,KAAK,YAAY,CAAC,IAAI,IAAI,CAAC,KAAK,OAAO,KAAK,SAAS,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,MAAM,CAAC,KAAK,EAAE,KAAK,IAC7B,YAAY,CAAC,KAAK,CAAC,SAAS,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { type Infer } from "@metamask/superstruct";
2
+ /**
3
+ * UUIDv4 struct.
4
+ */
5
+ export declare const UuidStruct: import("@metamask/superstruct").Struct<string, null>;
6
+ /**
7
+ * Validates if a given value is a valid URL.
8
+ *
9
+ * @param value - The value to be validated.
10
+ * @returns A boolean indicating if the value is a valid URL.
11
+ */
12
+ export declare const UrlStruct: import("@metamask/superstruct").Struct<string, null>;
13
+ /**
14
+ * A string which contains a positive float number.
15
+ */
16
+ export declare const StringNumberStruct: import("@metamask/superstruct").Struct<string, null>;
17
+ export type StringNumber = Infer<typeof StringNumberStruct>;
18
+ /**
19
+ * This is a helper type used by the {@link Equals} type.
20
+ */
21
+ type EqualsHelper<Type> = <Dummy>() => Dummy extends Type ? 1 : 2;
22
+ /**
23
+ * A utility type that checks whether two types are exactly the same.
24
+ *
25
+ * This type evaluates to `true` if `TypeA` and `TypeB` are identical,
26
+ * otherwise it evaluates to `false`.
27
+ *
28
+ * @template TypeA - The first type to compare.
29
+ * @template TypeB - The second type to compare.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * // Example usage:
34
+ * type Test1 = Equals<number, number>; // true
35
+ * type Test2 = Equals<number, string>; // false
36
+ * type Test3 = Equals<{ a: string }, { a: string }>; // true
37
+ * type Test4 = Equals<{ a: string }, { a: number }>; // false
38
+ * ```
39
+ */
40
+ export type Equals<TypeA, TypeB> = EqualsHelper<TypeA> extends EqualsHelper<TypeB> ? true : false;
41
+ export {};
42
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,KAAK,EAAE,8BAA8B;AAI3D;;GAEG;AACH,eAAO,MAAM,UAAU,sDAGtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,sDAOpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAG9B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE5D;;GAEG;AACH,KAAK,YAAY,CAAC,IAAI,IAAI,CAAC,KAAK,OAAO,KAAK,SAAS,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,MAAM,CAAC,KAAK,EAAE,KAAK,IAC7B,YAAY,CAAC,KAAK,CAAC,SAAS,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { define } from "@metamask/superstruct";
2
+ import { definePattern } from "../superstruct.mjs";
3
+ /**
4
+ * UUIDv4 struct.
5
+ */
6
+ export const UuidStruct = definePattern('UuidV4', /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu);
7
+ /**
8
+ * Validates if a given value is a valid URL.
9
+ *
10
+ * @param value - The value to be validated.
11
+ * @returns A boolean indicating if the value is a valid URL.
12
+ */
13
+ export const UrlStruct = define('Url', (value) => {
14
+ try {
15
+ const url = new URL(value);
16
+ return url.protocol === 'http:' || url.protocol === 'https:';
17
+ }
18
+ catch {
19
+ return false;
20
+ }
21
+ });
22
+ /**
23
+ * A string which contains a positive float number.
24
+ */
25
+ export const StringNumberStruct = definePattern('StringNumber', /^\d+(\.\d+)?$/u);
26
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,8BAA8B;AAE3D,OAAO,EAAE,aAAa,EAAE,2BAAuB;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CACrC,QAAQ,EACR,yEAAyE,CAC1E,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAS,KAAK,EAAE,CAAC,KAAc,EAAE,EAAE;IAChE,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAe,CAAC,CAAC;QACrC,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAC7C,cAAc,EACd,gBAAgB,CACjB,CAAC","sourcesContent":["import { define, type Infer } from '@metamask/superstruct';\n\nimport { definePattern } from '../superstruct';\n\n/**\n * UUIDv4 struct.\n */\nexport const UuidStruct = definePattern(\n 'UuidV4',\n /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu,\n);\n\n/**\n * Validates if a given value is a valid URL.\n *\n * @param value - The value to be validated.\n * @returns A boolean indicating if the value is a valid URL.\n */\nexport const UrlStruct = define<string>('Url', (value: unknown) => {\n try {\n const url = new URL(value as string);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n return false;\n }\n});\n\n/**\n * A string which contains a positive float number.\n */\nexport const StringNumberStruct = definePattern(\n 'StringNumber',\n /^\\d+(\\.\\d+)?$/u,\n);\nexport type StringNumber = Infer<typeof StringNumberStruct>;\n\n/**\n * This is a helper type used by the {@link Equals} type.\n */\ntype EqualsHelper<Type> = <Dummy>() => Dummy extends Type ? 1 : 2;\n\n/**\n * A utility type that checks whether two types are exactly the same.\n *\n * This type evaluates to `true` if `TypeA` and `TypeB` are identical,\n * otherwise it evaluates to `false`.\n *\n * @template TypeA - The first type to compare.\n * @template TypeB - The second type to compare.\n *\n * @example\n * ```ts\n * // Example usage:\n * type Test1 = Equals<number, number>; // true\n * type Test2 = Equals<number, string>; // false\n * type Test3 = Equals<{ a: string }, { a: string }>; // true\n * type Test4 = Equals<{ a: string }, { a: number }>; // false\n * ```\n */\nexport type Equals<TypeA, TypeB> =\n EqualsHelper<TypeA> extends EqualsHelper<TypeB> ? true : false;\n"]}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.expectTrue = expectTrue;
4
+ /**
5
+ * Assert that a type extends `true`. It can be used, for example, to assert
6
+ * that a given type extends another type.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * expectTrue<Extends<{a: string, b: string}, {a: string}>>(); // Ok
11
+ * expectTrue<Extends<{a: string}, {a: string, b: string}>>(); // Error
12
+ * ```
13
+ *
14
+ * This function follows the naming pattern used on `tsd`.
15
+ */
16
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17
+ function expectTrue() {
18
+ // Intentionally empty
19
+ }
20
+ //# sourceMappingURL=typing.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typing.cjs","sourceRoot":"","sources":["../../src/utils/typing.ts"],"names":[],"mappings":";;AAoCA,gCAEC;AAfD;;;;;;;;;;;GAWG;AACH,6DAA6D;AAC7D,SAAgB,UAAU;IACxB,sBAAsB;AACxB,CAAC","sourcesContent":["/**\n * Omit keys from a union type.\n *\n * The normal `Omit` type does not distribute over unions. So we use this\n * workaround that applies `Omit` to each member of the union.\n *\n * See: <https://github.com/microsoft/TypeScript/issues/31501#issuecomment-1280579305>\n */\nexport type OmitUnion<Type, Key extends keyof any> = Type extends any\n ? Omit<Type, Key>\n : never;\n\n/**\n * Type that resolves to `true` if `Child` extends `Base`, otherwise `false`.\n *\n * @example\n * ```ts\n * type A = Extends<{a: string, b: string}, {a: string}>; // true\n * type B = Extends<{a: string}, {a: string, b: string}>; // false\n * ```\n */\nexport type Extends<Child, Base> = Child extends Base ? true : false;\n\n/**\n * Assert that a type extends `true`. It can be used, for example, to assert\n * that a given type extends another type.\n *\n * @example\n * ```ts\n * expectTrue<Extends<{a: string, b: string}, {a: string}>>(); // Ok\n * expectTrue<Extends<{a: string}, {a: string, b: string}>>(); // Error\n * ```\n *\n * This function follows the naming pattern used on `tsd`.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function expectTrue<Type extends true>(): void {\n // Intentionally empty\n}\n"]}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Omit keys from a union type.
3
+ *
4
+ * The normal `Omit` type does not distribute over unions. So we use this
5
+ * workaround that applies `Omit` to each member of the union.
6
+ *
7
+ * See: <https://github.com/microsoft/TypeScript/issues/31501#issuecomment-1280579305>
8
+ */
9
+ export type OmitUnion<Type, Key extends keyof any> = Type extends any ? Omit<Type, Key> : never;
10
+ /**
11
+ * Type that resolves to `true` if `Child` extends `Base`, otherwise `false`.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * type A = Extends<{a: string, b: string}, {a: string}>; // true
16
+ * type B = Extends<{a: string}, {a: string, b: string}>; // false
17
+ * ```
18
+ */
19
+ export type Extends<Child, Base> = Child extends Base ? true : false;
20
+ /**
21
+ * Assert that a type extends `true`. It can be used, for example, to assert
22
+ * that a given type extends another type.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * expectTrue<Extends<{a: string, b: string}, {a: string}>>(); // Ok
27
+ * expectTrue<Extends<{a: string}, {a: string, b: string}>>(); // Error
28
+ * ```
29
+ *
30
+ * This function follows the naming pattern used on `tsd`.
31
+ */
32
+ export declare function expectTrue<Type extends true>(): void;
33
+ //# sourceMappingURL=typing.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typing.d.cts","sourceRoot":"","sources":["../../src/utils/typing.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,SAAS,MAAM,GAAG,IAAI,IAAI,SAAS,GAAG,GACjE,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,GACf,KAAK,CAAC;AAEV;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,CAAC,KAAK,EAAE,IAAI,IAAI,KAAK,SAAS,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAErE;;;;;;;;;;;GAWG;AAEH,wBAAgB,UAAU,CAAC,IAAI,SAAS,IAAI,KAAK,IAAI,CAEpD"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Omit keys from a union type.
3
+ *
4
+ * The normal `Omit` type does not distribute over unions. So we use this
5
+ * workaround that applies `Omit` to each member of the union.
6
+ *
7
+ * See: <https://github.com/microsoft/TypeScript/issues/31501#issuecomment-1280579305>
8
+ */
9
+ export type OmitUnion<Type, Key extends keyof any> = Type extends any ? Omit<Type, Key> : never;
10
+ /**
11
+ * Type that resolves to `true` if `Child` extends `Base`, otherwise `false`.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * type A = Extends<{a: string, b: string}, {a: string}>; // true
16
+ * type B = Extends<{a: string}, {a: string, b: string}>; // false
17
+ * ```
18
+ */
19
+ export type Extends<Child, Base> = Child extends Base ? true : false;
20
+ /**
21
+ * Assert that a type extends `true`. It can be used, for example, to assert
22
+ * that a given type extends another type.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * expectTrue<Extends<{a: string, b: string}, {a: string}>>(); // Ok
27
+ * expectTrue<Extends<{a: string}, {a: string, b: string}>>(); // Error
28
+ * ```
29
+ *
30
+ * This function follows the naming pattern used on `tsd`.
31
+ */
32
+ export declare function expectTrue<Type extends true>(): void;
33
+ //# sourceMappingURL=typing.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typing.d.mts","sourceRoot":"","sources":["../../src/utils/typing.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,SAAS,MAAM,GAAG,IAAI,IAAI,SAAS,GAAG,GACjE,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,GACf,KAAK,CAAC;AAEV;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,CAAC,KAAK,EAAE,IAAI,IAAI,KAAK,SAAS,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAErE;;;;;;;;;;;GAWG;AAEH,wBAAgB,UAAU,CAAC,IAAI,SAAS,IAAI,KAAK,IAAI,CAEpD"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Assert that a type extends `true`. It can be used, for example, to assert
3
+ * that a given type extends another type.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * expectTrue<Extends<{a: string, b: string}, {a: string}>>(); // Ok
8
+ * expectTrue<Extends<{a: string}, {a: string, b: string}>>(); // Error
9
+ * ```
10
+ *
11
+ * This function follows the naming pattern used on `tsd`.
12
+ */
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
+ export function expectTrue() {
15
+ // Intentionally empty
16
+ }
17
+ //# sourceMappingURL=typing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typing.mjs","sourceRoot":"","sources":["../../src/utils/typing.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;;;GAWG;AACH,6DAA6D;AAC7D,MAAM,UAAU,UAAU;IACxB,sBAAsB;AACxB,CAAC","sourcesContent":["/**\n * Omit keys from a union type.\n *\n * The normal `Omit` type does not distribute over unions. So we use this\n * workaround that applies `Omit` to each member of the union.\n *\n * See: <https://github.com/microsoft/TypeScript/issues/31501#issuecomment-1280579305>\n */\nexport type OmitUnion<Type, Key extends keyof any> = Type extends any\n ? Omit<Type, Key>\n : never;\n\n/**\n * Type that resolves to `true` if `Child` extends `Base`, otherwise `false`.\n *\n * @example\n * ```ts\n * type A = Extends<{a: string, b: string}, {a: string}>; // true\n * type B = Extends<{a: string}, {a: string, b: string}>; // false\n * ```\n */\nexport type Extends<Child, Base> = Child extends Base ? true : false;\n\n/**\n * Assert that a type extends `true`. It can be used, for example, to assert\n * that a given type extends another type.\n *\n * @example\n * ```ts\n * expectTrue<Extends<{a: string, b: string}, {a: string}>>(); // Ok\n * expectTrue<Extends<{a: string}, {a: string, b: string}>>(); // Error\n * ```\n *\n * This function follows the naming pattern used on `tsd`.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function expectTrue<Type extends true>(): void {\n // Intentionally empty\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/keyring-api",
3
- "version": "11.0.0-b85bfaa",
3
+ "version": "11.0.0-cd6bf38",
4
4
  "description": "MetaMask Keyring API",
5
5
  "keywords": [
6
6
  "metamask",
@@ -42,21 +42,22 @@
42
42
  "test": "yarn test:source && yarn test:types",
43
43
  "test:clean": "jest --clearCache",
44
44
  "test:source": "jest && jest-it-up",
45
- "test:types": "../../scripts/tsd-test.sh ./src",
45
+ "test:types": "tsd",
46
46
  "test:watch": "jest --watch"
47
47
  },
48
48
  "dependencies": {
49
- "@metamask/keyring-utils": "0.0.1",
49
+ "@metamask/snaps-sdk": "^6.7.0",
50
50
  "@metamask/superstruct": "^3.1.0",
51
- "@metamask/utils": "^9.2.1",
51
+ "@metamask/utils": "^9.3.0",
52
+ "@types/uuid": "^9.0.8",
52
53
  "bech32": "^2.0.0",
53
- "uuid": "^9.0.1"
54
+ "uuid": "^9.0.1",
55
+ "webextension-polyfill": "^0.12.0"
54
56
  },
55
57
  "devDependencies": {
56
58
  "@lavamoat/allow-scripts": "^3.2.1",
57
59
  "@lavamoat/preinstall-always-fail": "^2.1.0",
58
60
  "@metamask/auto-changelog": "^3.4.4",
59
- "@metamask/keyring-utils": "0.0.1",
60
61
  "@metamask/providers": "^18.1.0",
61
62
  "@ts-bridge/cli": "^0.6.0",
62
63
  "@types/jest": "^29.5.12",
@@ -72,6 +73,9 @@
72
73
  "typedoc": "^0.25.13",
73
74
  "typescript": "~5.6.3"
74
75
  },
76
+ "peerDependencies": {
77
+ "@metamask/providers": "^18.1.0"
78
+ },
75
79
  "engines": {
76
80
  "node": "^18.18 || >=20"
77
81
  },
@@ -87,9 +91,6 @@
87
91
  }
88
92
  },
89
93
  "tsd": {
90
- "directory": "src",
91
- "compilerOptions": {
92
- "composite": "false"
93
- }
94
+ "directory": "src"
94
95
  }
95
96
  }
@@ -1 +0,0 @@
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"]}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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;I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AE,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"]}
package/dist/balance.cjs DELETED
@@ -1,10 +0,0 @@
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
@@ -1 +0,0 @@
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"]}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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"}
@@ -1 +0,0 @@
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 +0,0 @@
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"]}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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/keyring.cjs DELETED
@@ -1,5 +0,0 @@
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
@@ -1 +0,0 @@
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"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../src/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO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@@
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
@@ -1 +0,0 @@
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 +0,0 @@
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"]}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"response.d.mts","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"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes