@metamask/keyring-api 10.1.0 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/dist/{JsonRpcRequest.js → JsonRpcRequest.cjs} +2 -2
  3. package/dist/JsonRpcRequest.cjs.map +1 -0
  4. package/dist/{JsonRpcRequest.d.ts → JsonRpcRequest.d.cts} +3 -2
  5. package/dist/JsonRpcRequest.d.cts.map +1 -0
  6. package/dist/JsonRpcRequest.d.mts +17 -0
  7. package/dist/JsonRpcRequest.d.mts.map +1 -0
  8. package/dist/JsonRpcRequest.mjs +10 -0
  9. package/dist/JsonRpcRequest.mjs.map +1 -0
  10. package/dist/{KeyringClient.js → KeyringClient.cjs} +10 -4
  11. package/dist/KeyringClient.cjs.map +1 -0
  12. package/dist/{KeyringClient.d.ts → KeyringClient.d.cts} +6 -3
  13. package/dist/KeyringClient.d.cts.map +1 -0
  14. package/dist/KeyringClient.d.mts +31 -0
  15. package/dist/KeyringClient.d.mts.map +1 -0
  16. package/dist/KeyringClient.mjs +126 -0
  17. package/dist/KeyringClient.mjs.map +1 -0
  18. package/dist/{KeyringSnapRpcClient.js → KeyringSnapRpcClient.cjs} +2 -2
  19. package/dist/KeyringSnapRpcClient.cjs.map +1 -0
  20. package/dist/{KeyringSnapRpcClient.d.ts → KeyringSnapRpcClient.d.cts} +6 -5
  21. package/dist/KeyringSnapRpcClient.d.cts.map +1 -0
  22. package/dist/KeyringSnapRpcClient.d.mts +40 -0
  23. package/dist/KeyringSnapRpcClient.d.mts.map +1 -0
  24. package/dist/KeyringSnapRpcClient.mjs +63 -0
  25. package/dist/KeyringSnapRpcClient.mjs.map +1 -0
  26. package/dist/api/{account.js → account.cjs} +3 -3
  27. package/dist/api/account.cjs.map +1 -0
  28. package/dist/api/{account.d.ts → account.d.cts} +2 -1
  29. package/dist/api/account.d.cts.map +1 -0
  30. package/dist/api/account.d.mts +70 -0
  31. package/dist/api/account.d.mts.map +1 -0
  32. package/dist/api/account.mjs +61 -0
  33. package/dist/api/account.mjs.map +1 -0
  34. package/dist/api/asset.cjs +83 -0
  35. package/dist/api/asset.cjs.map +1 -0
  36. package/dist/api/asset.d.cts +93 -0
  37. package/dist/api/asset.d.cts.map +1 -0
  38. package/dist/api/asset.d.mts +93 -0
  39. package/dist/api/asset.d.mts.map +1 -0
  40. package/dist/api/asset.mjs +80 -0
  41. package/dist/api/asset.mjs.map +1 -0
  42. package/dist/api/{balance.js → balance.cjs} +3 -3
  43. package/dist/api/balance.cjs.map +1 -0
  44. package/dist/api/{balance.d.ts → balance.d.cts} +3 -2
  45. package/dist/api/balance.d.cts.map +1 -0
  46. package/dist/api/balance.d.mts +10 -0
  47. package/dist/api/balance.d.mts.map +1 -0
  48. package/dist/api/balance.mjs +8 -0
  49. package/dist/api/balance.mjs.map +1 -0
  50. package/dist/api/{caip.js → caip.cjs} +5 -5
  51. package/dist/api/caip.cjs.map +1 -0
  52. package/dist/api/{caip.d.ts → caip.d.cts} +2 -1
  53. package/dist/api/caip.d.cts.map +1 -0
  54. package/dist/api/caip.d.mts +38 -0
  55. package/dist/api/caip.d.mts.map +1 -0
  56. package/dist/api/caip.mjs +43 -0
  57. package/dist/api/caip.mjs.map +1 -0
  58. package/dist/api/{export.js → export.cjs} +1 -1
  59. package/dist/api/export.cjs.map +1 -0
  60. package/dist/api/{export.d.ts → export.d.cts} +2 -1
  61. package/dist/api/export.d.cts.map +1 -0
  62. package/dist/api/export.d.mts +9 -0
  63. package/dist/api/export.d.mts.map +1 -0
  64. package/dist/api/export.mjs +4 -0
  65. package/dist/api/export.mjs.map +1 -0
  66. package/dist/api/{index.js → index.cjs} +9 -7
  67. package/dist/api/index.cjs.map +1 -0
  68. package/dist/api/index.d.cts +10 -0
  69. package/dist/api/index.d.cts.map +1 -0
  70. package/dist/api/index.d.mts +10 -0
  71. package/dist/api/index.d.mts.map +1 -0
  72. package/dist/api/index.mjs +9 -0
  73. package/dist/api/index.mjs.map +1 -0
  74. package/dist/api/{keyring.js → keyring.cjs} +1 -1
  75. package/dist/api/keyring.cjs.map +1 -0
  76. package/dist/api/{keyring.d.ts → keyring.d.cts} +22 -7
  77. package/dist/api/keyring.d.cts.map +1 -0
  78. package/dist/api/keyring.d.mts +174 -0
  79. package/dist/api/keyring.d.mts.map +1 -0
  80. package/dist/api/keyring.mjs +2 -0
  81. package/dist/api/keyring.mjs.map +1 -0
  82. package/dist/api/{request.js → request.cjs} +3 -3
  83. package/dist/api/request.cjs.map +1 -0
  84. package/dist/api/{request.d.ts → request.d.cts} +3 -2
  85. package/dist/api/request.d.cts.map +1 -0
  86. package/dist/api/request.d.mts +40 -0
  87. package/dist/api/request.d.mts.map +1 -0
  88. package/dist/api/request.mjs +26 -0
  89. package/dist/api/request.mjs.map +1 -0
  90. package/dist/api/{response.js → response.cjs} +2 -2
  91. package/dist/api/response.cjs.map +1 -0
  92. package/dist/api/{response.d.ts → response.d.cts} +2 -1
  93. package/dist/api/response.d.cts.map +1 -0
  94. package/dist/api/response.d.mts +25 -0
  95. package/dist/api/response.d.mts.map +1 -0
  96. package/dist/api/response.mjs +41 -0
  97. package/dist/api/response.mjs.map +1 -0
  98. package/dist/api/transaction.cjs +295 -0
  99. package/dist/api/transaction.cjs.map +1 -0
  100. package/dist/api/transaction.d.cts +773 -0
  101. package/dist/api/transaction.d.cts.map +1 -0
  102. package/dist/api/transaction.d.mts +773 -0
  103. package/dist/api/transaction.d.mts.map +1 -0
  104. package/dist/api/transaction.mjs +292 -0
  105. package/dist/api/transaction.mjs.map +1 -0
  106. package/dist/{eth/erc4337/index.js → btc/index.cjs} +2 -2
  107. package/dist/btc/index.cjs.map +1 -0
  108. package/dist/btc/index.d.cts +2 -0
  109. package/dist/btc/index.d.cts.map +1 -0
  110. package/dist/btc/index.d.mts +2 -0
  111. package/dist/btc/index.d.mts.map +1 -0
  112. package/dist/btc/index.mjs +2 -0
  113. package/dist/btc/index.mjs.map +1 -0
  114. package/dist/btc/{types.js → types.cjs} +3 -3
  115. package/dist/btc/types.cjs.map +1 -0
  116. package/dist/btc/{types.d.ts → types.d.cts} +2 -1
  117. package/dist/btc/types.d.cts.map +1 -0
  118. package/dist/btc/types.d.mts +34 -0
  119. package/dist/btc/types.d.mts.map +1 -0
  120. package/dist/btc/types.mjs +37 -0
  121. package/dist/btc/types.mjs.map +1 -0
  122. package/dist/{contexts.js → contexts.cjs} +1 -1
  123. package/dist/contexts.cjs.map +1 -0
  124. package/dist/{contexts.d.ts → contexts.d.cts} +1 -0
  125. package/dist/contexts.d.cts.map +1 -0
  126. package/dist/contexts.d.mts +8 -0
  127. package/dist/contexts.d.mts.map +1 -0
  128. package/dist/contexts.mjs +2 -0
  129. package/dist/contexts.mjs.map +1 -0
  130. package/dist/{sol/index.js → eth/erc4337/index.cjs} +2 -2
  131. package/dist/eth/erc4337/index.cjs.map +1 -0
  132. package/dist/eth/erc4337/index.d.cts +2 -0
  133. package/dist/eth/erc4337/index.d.cts.map +1 -0
  134. package/dist/eth/erc4337/index.d.mts +2 -0
  135. package/dist/eth/erc4337/index.d.mts.map +1 -0
  136. package/dist/eth/erc4337/index.mjs +2 -0
  137. package/dist/eth/erc4337/index.mjs.map +1 -0
  138. package/dist/eth/erc4337/{types.js → types.cjs} +4 -4
  139. package/dist/eth/erc4337/types.cjs.map +1 -0
  140. package/dist/eth/erc4337/{types.d.ts → types.d.cts} +7 -6
  141. package/dist/eth/erc4337/types.d.cts.map +1 -0
  142. package/dist/eth/erc4337/types.d.mts +98 -0
  143. package/dist/eth/erc4337/types.d.mts.map +1 -0
  144. package/dist/eth/erc4337/types.mjs +59 -0
  145. package/dist/eth/erc4337/types.mjs.map +1 -0
  146. package/dist/eth/index.cjs +20 -0
  147. package/dist/eth/index.cjs.map +1 -0
  148. package/dist/eth/index.d.cts +4 -0
  149. package/dist/eth/index.d.cts.map +1 -0
  150. package/dist/eth/index.d.mts +4 -0
  151. package/dist/eth/index.d.mts.map +1 -0
  152. package/dist/eth/index.mjs +4 -0
  153. package/dist/eth/index.mjs.map +1 -0
  154. package/dist/eth/{types.js → types.cjs} +3 -3
  155. package/dist/eth/types.cjs.map +1 -0
  156. package/dist/eth/{types.d.ts → types.d.cts} +2 -1
  157. package/dist/eth/types.d.cts.map +1 -0
  158. package/dist/eth/types.d.mts +81 -0
  159. package/dist/eth/types.d.mts.map +1 -0
  160. package/dist/eth/types.mjs +70 -0
  161. package/dist/eth/types.mjs.map +1 -0
  162. package/dist/eth/{utils.js → utils.cjs} +3 -4
  163. package/dist/eth/{utils.js.map → utils.cjs.map} +1 -1
  164. package/dist/eth/{utils.d.ts → utils.d.cts} +2 -1
  165. package/dist/eth/utils.d.cts.map +1 -0
  166. package/dist/eth/utils.d.mts +9 -0
  167. package/dist/eth/utils.d.mts.map +1 -0
  168. package/dist/eth/utils.mjs +11 -0
  169. package/dist/eth/utils.mjs.map +1 -0
  170. package/dist/{events.js → events.cjs} +1 -1
  171. package/dist/events.cjs.map +1 -0
  172. package/dist/{events.d.ts → events.d.cts} +1 -0
  173. package/dist/events.d.cts.map +1 -0
  174. package/dist/events.d.mts +11 -0
  175. package/dist/events.d.mts.map +1 -0
  176. package/dist/events.mjs +14 -0
  177. package/dist/events.mjs.map +1 -0
  178. package/dist/index.cjs +29 -0
  179. package/dist/index.cjs.map +1 -0
  180. package/dist/index.d.cts +14 -0
  181. package/dist/index.d.cts.map +1 -0
  182. package/dist/index.d.mts +14 -0
  183. package/dist/index.d.mts.map +1 -0
  184. package/dist/index.mjs +13 -0
  185. package/dist/index.mjs.map +1 -0
  186. package/dist/internal/{api.js → api.cjs} +17 -6
  187. package/dist/internal/api.cjs.map +1 -0
  188. package/dist/internal/{api.d.ts → api.d.cts} +323 -5
  189. package/dist/internal/api.d.cts.map +1 -0
  190. package/dist/internal/api.d.mts +737 -0
  191. package/dist/internal/api.d.mts.map +1 -0
  192. package/dist/internal/api.mjs +147 -0
  193. package/dist/internal/api.mjs.map +1 -0
  194. package/dist/internal/eth/{EthKeyring.js → EthKeyring.cjs} +1 -1
  195. package/dist/internal/eth/EthKeyring.cjs.map +1 -0
  196. package/dist/internal/eth/{EthKeyring.d.ts → EthKeyring.d.cts} +4 -3
  197. package/dist/internal/eth/EthKeyring.d.cts.map +1 -0
  198. package/dist/internal/eth/EthKeyring.d.mts +34 -0
  199. package/dist/internal/eth/EthKeyring.d.mts.map +1 -0
  200. package/dist/internal/eth/EthKeyring.mjs +2 -0
  201. package/dist/internal/eth/EthKeyring.mjs.map +1 -0
  202. package/dist/internal/eth/{index.js → index.cjs} +1 -1
  203. package/dist/internal/eth/index.cjs.map +1 -0
  204. package/dist/internal/eth/index.d.cts +2 -0
  205. package/dist/internal/eth/index.d.cts.map +1 -0
  206. package/dist/internal/eth/index.d.mts +2 -0
  207. package/dist/internal/eth/index.d.mts.map +1 -0
  208. package/dist/internal/eth/index.mjs +2 -0
  209. package/dist/internal/eth/index.mjs.map +1 -0
  210. package/dist/internal/{events.js → events.cjs} +5 -5
  211. package/dist/internal/events.cjs.map +1 -0
  212. package/dist/internal/{events.d.ts → events.d.cts} +3 -2
  213. package/dist/internal/events.d.cts.map +1 -0
  214. package/dist/internal/events.d.mts +162 -0
  215. package/dist/internal/events.d.mts.map +1 -0
  216. package/dist/internal/events.mjs +69 -0
  217. package/dist/internal/events.mjs.map +1 -0
  218. package/dist/internal/{index.js → index.cjs} +5 -5
  219. package/dist/internal/index.cjs.map +1 -0
  220. package/dist/internal/index.d.cts +6 -0
  221. package/dist/internal/index.d.cts.map +1 -0
  222. package/dist/internal/index.d.mts +6 -0
  223. package/dist/internal/index.d.mts.map +1 -0
  224. package/dist/internal/index.mjs +5 -0
  225. package/dist/internal/index.mjs.map +1 -0
  226. package/dist/internal/{rpc.js → rpc.cjs} +4 -3
  227. package/dist/internal/rpc.cjs.map +1 -0
  228. package/dist/internal/{rpc.d.ts → rpc.d.cts} +2 -0
  229. package/dist/internal/rpc.d.cts.map +1 -0
  230. package/dist/internal/rpc.d.mts +27 -0
  231. package/dist/internal/rpc.d.mts.map +1 -0
  232. package/dist/internal/rpc.mjs +30 -0
  233. package/dist/internal/rpc.mjs.map +1 -0
  234. package/dist/internal/{types.js → types.cjs} +6 -6
  235. package/dist/internal/types.cjs.map +1 -0
  236. package/dist/internal/{types.d.ts → types.d.cts} +21 -20
  237. package/dist/internal/types.d.cts.map +1 -0
  238. package/dist/internal/types.d.mts +392 -0
  239. package/dist/internal/types.d.mts.map +1 -0
  240. package/dist/internal/types.mjs +49 -0
  241. package/dist/internal/types.mjs.map +1 -0
  242. package/dist/{rpc-handler.js → rpc-handler.cjs} +13 -6
  243. package/dist/rpc-handler.cjs.map +1 -0
  244. package/dist/{rpc-handler.d.ts → rpc-handler.d.cts} +4 -3
  245. package/dist/rpc-handler.d.cts.map +1 -0
  246. package/dist/rpc-handler.d.mts +30 -0
  247. package/dist/rpc-handler.d.mts.map +1 -0
  248. package/dist/rpc-handler.mjs +138 -0
  249. package/dist/rpc-handler.mjs.map +1 -0
  250. package/dist/{snap-utils.js → snap-utils.cjs} +2 -3
  251. package/dist/snap-utils.cjs.map +1 -0
  252. package/dist/{snap-utils.d.ts → snap-utils.d.cts} +4 -3
  253. package/dist/snap-utils.d.cts.map +1 -0
  254. package/dist/snap-utils.d.mts +12 -0
  255. package/dist/snap-utils.d.mts.map +1 -0
  256. package/dist/snap-utils.mjs +17 -0
  257. package/dist/snap-utils.mjs.map +1 -0
  258. package/dist/{btc/index.js → sol/index.cjs} +2 -2
  259. package/dist/sol/index.cjs.map +1 -0
  260. package/dist/sol/index.d.cts +2 -0
  261. package/dist/sol/index.d.cts.map +1 -0
  262. package/dist/sol/index.d.mts +2 -0
  263. package/dist/sol/index.d.mts.map +1 -0
  264. package/dist/sol/index.mjs +2 -0
  265. package/dist/sol/index.mjs.map +1 -0
  266. package/dist/sol/{types.js → types.cjs} +3 -3
  267. package/dist/sol/types.cjs.map +1 -0
  268. package/dist/sol/{types.d.ts → types.d.cts} +2 -1
  269. package/dist/sol/types.d.cts.map +1 -0
  270. package/dist/sol/types.d.mts +39 -0
  271. package/dist/sol/types.d.mts.map +1 -0
  272. package/dist/sol/types.mjs +33 -0
  273. package/dist/sol/types.mjs.map +1 -0
  274. package/dist/{superstruct.js → superstruct.cjs} +34 -6
  275. package/dist/superstruct.cjs.map +1 -0
  276. package/dist/{superstruct.d.ts → superstruct.d.cts} +21 -2
  277. package/dist/superstruct.d.cts.map +1 -0
  278. package/dist/superstruct.d.mts +102 -0
  279. package/dist/superstruct.d.mts.map +1 -0
  280. package/dist/superstruct.mjs +102 -0
  281. package/dist/superstruct.mjs.map +1 -0
  282. package/dist/{eth/index.js → utils/index.cjs} +4 -4
  283. package/dist/utils/index.cjs.map +1 -0
  284. package/dist/utils/index.d.cts +4 -0
  285. package/dist/utils/index.d.cts.map +1 -0
  286. package/dist/utils/index.d.mts +4 -0
  287. package/dist/utils/index.d.mts.map +1 -0
  288. package/dist/utils/index.mjs +4 -0
  289. package/dist/utils/index.mjs.map +1 -0
  290. package/dist/utils/pagination.cjs +28 -0
  291. package/dist/utils/pagination.cjs.map +1 -0
  292. package/dist/utils/pagination.d.cts +59 -0
  293. package/dist/utils/pagination.d.cts.map +1 -0
  294. package/dist/utils/pagination.d.mts +59 -0
  295. package/dist/utils/pagination.d.mts.map +1 -0
  296. package/dist/utils/pagination.mjs +25 -0
  297. package/dist/utils/pagination.mjs.map +1 -0
  298. package/dist/utils/{types.js → types.cjs} +2 -2
  299. package/dist/utils/types.cjs.map +1 -0
  300. package/dist/utils/types.d.cts +42 -0
  301. package/dist/utils/types.d.cts.map +1 -0
  302. package/dist/utils/types.d.mts +42 -0
  303. package/dist/utils/types.d.mts.map +1 -0
  304. package/dist/utils/types.mjs +26 -0
  305. package/dist/utils/types.mjs.map +1 -0
  306. package/dist/utils/{typing.js → typing.cjs} +2 -3
  307. package/dist/utils/{typing.js.map → typing.cjs.map} +1 -1
  308. package/dist/utils/{typing.d.ts → typing.d.cts} +1 -0
  309. package/dist/utils/typing.d.cts.map +1 -0
  310. package/dist/utils/typing.d.mts +33 -0
  311. package/dist/utils/typing.d.mts.map +1 -0
  312. package/dist/utils/typing.mjs +17 -0
  313. package/dist/utils/typing.mjs.map +1 -0
  314. package/package.json +20 -9
  315. package/dist/JsonRpcRequest.js.map +0 -1
  316. package/dist/KeyringClient.js.map +0 -1
  317. package/dist/KeyringSnapRpcClient.js.map +0 -1
  318. package/dist/api/account.js.map +0 -1
  319. package/dist/api/balance.js.map +0 -1
  320. package/dist/api/caip.js.map +0 -1
  321. package/dist/api/export.js.map +0 -1
  322. package/dist/api/index.d.ts +0 -7
  323. package/dist/api/index.js.map +0 -1
  324. package/dist/api/keyring.js.map +0 -1
  325. package/dist/api/request.js.map +0 -1
  326. package/dist/api/response.js.map +0 -1
  327. package/dist/btc/index.d.ts +0 -1
  328. package/dist/btc/index.js.map +0 -1
  329. package/dist/btc/types.js.map +0 -1
  330. package/dist/contexts.js.map +0 -1
  331. package/dist/eth/erc4337/index.d.ts +0 -1
  332. package/dist/eth/erc4337/index.js.map +0 -1
  333. package/dist/eth/erc4337/types.js.map +0 -1
  334. package/dist/eth/index.d.ts +0 -3
  335. package/dist/eth/index.js.map +0 -1
  336. package/dist/eth/types.js.map +0 -1
  337. package/dist/events.js.map +0 -1
  338. package/dist/index.d.ts +0 -12
  339. package/dist/index.js +0 -28
  340. package/dist/index.js.map +0 -1
  341. package/dist/internal/api.js.map +0 -1
  342. package/dist/internal/eth/EthKeyring.js.map +0 -1
  343. package/dist/internal/eth/index.d.ts +0 -1
  344. package/dist/internal/eth/index.js.map +0 -1
  345. package/dist/internal/events.js.map +0 -1
  346. package/dist/internal/index.d.ts +0 -5
  347. package/dist/internal/index.js.map +0 -1
  348. package/dist/internal/rpc.js.map +0 -1
  349. package/dist/internal/types.js.map +0 -1
  350. package/dist/rpc-handler.js.map +0 -1
  351. package/dist/snap-utils.js.map +0 -1
  352. package/dist/sol/index.d.ts +0 -1
  353. package/dist/sol/index.js.map +0 -1
  354. package/dist/sol/types.js.map +0 -1
  355. package/dist/superstruct.js.map +0 -1
  356. package/dist/utils/index.d.ts +0 -2
  357. package/dist/utils/index.js +0 -19
  358. package/dist/utils/index.js.map +0 -1
  359. package/dist/utils/types.d.ts +0 -17
  360. package/dist/utils/types.js.map +0 -1
@@ -0,0 +1,38 @@
1
+ import { type Infer } from "@metamask/superstruct";
2
+ /**
3
+ * A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
4
+ */
5
+ export declare const CaipAssetTypeStruct: import("@metamask/superstruct").Struct<string, null>;
6
+ export type CaipAssetType = Infer<typeof CaipAssetTypeStruct>;
7
+ /**
8
+ * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
9
+ */
10
+ export declare const CaipAssetIdStruct: import("@metamask/superstruct").Struct<string, null>;
11
+ export type CaipAssetId = Infer<typeof CaipAssetIdStruct>;
12
+ /**
13
+ * Check if the given value is a {@link CaipAssetType}.
14
+ *
15
+ * @param value - The value to check.
16
+ * @returns Whether the value is a {@link CaipAssetType}.
17
+ * @example
18
+ * ```ts
19
+ * isCaipAssetType('eip155:1/slip44:60'); // true
20
+ * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true
21
+ * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false
22
+ * ```
23
+ */
24
+ export declare function isCaipAssetType(value: unknown): value is CaipAssetType;
25
+ /**
26
+ * Check if the given value is a {@link CaipAssetId}.
27
+ *
28
+ * @param value - The value to check.
29
+ * @returns Whether the value is a {@link CaipAssetId}.
30
+ * @example
31
+ * ```ts
32
+ * isCaipAssetType('eip155:1/slip44:60'); // false
33
+ * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false
34
+ * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true
35
+ * ```
36
+ */
37
+ export declare function isCaipAssetId(value: unknown): value is CaipAssetId;
38
+ //# sourceMappingURL=caip.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caip.d.mts","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,KAAK,EAAE,8BAA8B;AAUvD;;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,43 @@
1
+ import { is } from "@metamask/superstruct";
2
+ import { definePattern } from "../superstruct.mjs";
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
+ 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
+ /**
6
+ * A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
7
+ */
8
+ export const CaipAssetTypeStruct = definePattern('CaipAssetType', CAIP_ASSET_TYPE_REGEX);
9
+ /**
10
+ * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
11
+ */
12
+ export const CaipAssetIdStruct = definePattern('CaipAssetId', CAIP_ASSET_ID_REGEX);
13
+ /**
14
+ * Check if the given value is a {@link CaipAssetType}.
15
+ *
16
+ * @param value - The value to check.
17
+ * @returns Whether the value is a {@link CaipAssetType}.
18
+ * @example
19
+ * ```ts
20
+ * isCaipAssetType('eip155:1/slip44:60'); // true
21
+ * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true
22
+ * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false
23
+ * ```
24
+ */
25
+ export function isCaipAssetType(value) {
26
+ return is(value, CaipAssetTypeStruct);
27
+ }
28
+ /**
29
+ * Check if the given value is a {@link CaipAssetId}.
30
+ *
31
+ * @param value - The value to check.
32
+ * @returns Whether the value is a {@link CaipAssetId}.
33
+ * @example
34
+ * ```ts
35
+ * isCaipAssetType('eip155:1/slip44:60'); // false
36
+ * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false
37
+ * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true
38
+ * ```
39
+ */
40
+ export function isCaipAssetId(value) {
41
+ return is(value, CaipAssetIdStruct);
42
+ }
43
+ //# sourceMappingURL=caip.mjs.map
@@ -0,0 +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"]}
@@ -4,4 +4,4 @@ exports.KeyringAccountDataStruct = void 0;
4
4
  const superstruct_1 = require("@metamask/superstruct");
5
5
  const utils_1 = require("@metamask/utils");
6
6
  exports.KeyringAccountDataStruct = (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct);
7
- //# sourceMappingURL=export.js.map
7
+ //# sourceMappingURL=export.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.cjs","sourceRoot":"","sources":["../../src/api/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,4 +1,4 @@
1
- import type { Infer } from '@metamask/superstruct';
1
+ import type { Infer } from "@metamask/superstruct";
2
2
  export declare const KeyringAccountDataStruct: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
3
3
  /**
4
4
  * Response to a call to `exportAccount`.
@@ -6,3 +6,4 @@ export declare const KeyringAccountDataStruct: import("@metamask/superstruct").S
6
6
  * The exact response depends on the keyring implementation.
7
7
  */
8
8
  export type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;
9
+ //# sourceMappingURL=export.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.cts","sourceRoot":"","sources":["../../src/api/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,9 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ export declare const KeyringAccountDataStruct: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
3
+ /**
4
+ * Response to a call to `exportAccount`.
5
+ *
6
+ * The exact response depends on the keyring implementation.
7
+ */
8
+ export type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;
9
+ //# sourceMappingURL=export.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.mts","sourceRoot":"","sources":["../../src/api/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,4 @@
1
+ import { record, string } from "@metamask/superstruct";
2
+ import { JsonStruct } from "@metamask/utils";
3
+ export const KeyringAccountDataStruct = record(string(), JsonStruct);
4
+ //# sourceMappingURL=export.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.mjs","sourceRoot":"","sources":["../../src/api/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"]}
@@ -14,10 +14,12 @@ 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("./account"), exports);
18
- __exportStar(require("./balance"), exports);
19
- __exportStar(require("./caip"), exports);
20
- __exportStar(require("./export"), exports);
21
- __exportStar(require("./request"), exports);
22
- __exportStar(require("./response"), exports);
23
- //# sourceMappingURL=index.js.map
17
+ __exportStar(require("./account.cjs"), exports);
18
+ __exportStar(require("./asset.cjs"), exports);
19
+ __exportStar(require("./balance.cjs"), exports);
20
+ __exportStar(require("./caip.cjs"), exports);
21
+ __exportStar(require("./export.cjs"), exports);
22
+ __exportStar(require("./request.cjs"), exports);
23
+ __exportStar(require("./response.cjs"), exports);
24
+ __exportStar(require("./transaction.cjs"), exports);
25
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,8CAAwB;AACxB,gDAA0B;AAC1B,6CAAuB;AACvB,+CAAyB;AACzB,gDAA0B;AAC1B,iDAA2B;AAC3B,oDAA8B","sourcesContent":["export * from './account';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport type * from './keyring';\n"]}
@@ -0,0 +1,10 @@
1
+ export * from "./account.cjs";
2
+ export * from "./asset.cjs";
3
+ export * from "./balance.cjs";
4
+ export * from "./caip.cjs";
5
+ export * from "./export.cjs";
6
+ export * from "./request.cjs";
7
+ export * from "./response.cjs";
8
+ export * from "./transaction.cjs";
9
+ export type * from "./keyring.cjs";
10
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,mCAA+B"}
@@ -0,0 +1,10 @@
1
+ export * from "./account.mjs";
2
+ export * from "./asset.mjs";
3
+ export * from "./balance.mjs";
4
+ export * from "./caip.mjs";
5
+ export * from "./export.mjs";
6
+ export * from "./request.mjs";
7
+ export * from "./response.mjs";
8
+ export * from "./transaction.mjs";
9
+ export type * from "./keyring.mjs";
10
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,mCAA+B"}
@@ -0,0 +1,9 @@
1
+ export * from "./account.mjs";
2
+ export * from "./asset.mjs";
3
+ export * from "./balance.mjs";
4
+ export * from "./caip.mjs";
5
+ export * from "./export.mjs";
6
+ export * from "./request.mjs";
7
+ export * from "./response.mjs";
8
+ export * from "./transaction.mjs";
9
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B","sourcesContent":["export * from './account';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport type * from './keyring';\n"]}
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=keyring.js.map
3
+ //# sourceMappingURL=keyring.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"","sourcesContent":["import 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';\nimport type { Transaction } from './transaction';\nimport type { Paginated, Pagination } from '../utils';\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 * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\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,10 +1,12 @@
1
- import type { Json } from '@metamask/utils';
2
- import type { KeyringAccount } from './account';
3
- import type { Balance } from './balance';
4
- import type { CaipAssetType } from './caip';
5
- import type { KeyringAccountData } from './export';
6
- import type { KeyringRequest } from './request';
7
- import type { KeyringResponse } from './response';
1
+ import type { Json } from "@metamask/utils";
2
+ import type { KeyringAccount } from "./account.cjs";
3
+ import type { Balance } from "./balance.cjs";
4
+ import type { CaipAssetType } from "./caip.cjs";
5
+ import type { KeyringAccountData } from "./export.cjs";
6
+ import type { KeyringRequest } from "./request.cjs";
7
+ import type { KeyringResponse } from "./response.cjs";
8
+ import type { Transaction } from "./transaction.cjs";
9
+ import type { Paginated, Pagination } from "../utils/index.cjs";
8
10
  /**
9
11
  * Keyring interface.
10
12
  *
@@ -41,6 +43,18 @@ export type Keyring = {
41
43
  * object without any private information.
42
44
  */
43
45
  createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
46
+ /**
47
+ * Lists the transactions of an account, paginated and ordered by the most
48
+ * recent first.
49
+ *
50
+ * The pagination options are used to limit the number of transactions in the
51
+ * response and to iterate over the results.
52
+ *
53
+ * @param id - The ID of the account to list the transactions for.
54
+ * @param pagination - The pagination options.
55
+ * @returns A promise that resolves to the next page of transactions.
56
+ */
57
+ listAccountTransactions?(id: string, pagination: Pagination): Promise<Paginated<Transaction>>;
44
58
  /**
45
59
  * Retrieve the balances of a given account.
46
60
  *
@@ -157,3 +171,4 @@ export type Keyring = {
157
171
  */
158
172
  rejectRequest?(id: string): Promise<void>;
159
173
  };
174
+ //# sourceMappingURL=keyring.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,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;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,0BAAsB;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,2BAAiB;AAEtD;;;;;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;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,CACtB,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;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,174 @@
1
+ import type { Json } from "@metamask/utils";
2
+ import type { KeyringAccount } from "./account.mjs";
3
+ import type { Balance } from "./balance.mjs";
4
+ import type { CaipAssetType } from "./caip.mjs";
5
+ import type { KeyringAccountData } from "./export.mjs";
6
+ import type { KeyringRequest } from "./request.mjs";
7
+ import type { KeyringResponse } from "./response.mjs";
8
+ import type { Transaction } from "./transaction.mjs";
9
+ import type { Paginated, Pagination } from "../utils/index.mjs";
10
+ /**
11
+ * Keyring interface.
12
+ *
13
+ * Represents the functionality and operations related to managing accounts and
14
+ * handling requests.
15
+ */
16
+ export type Keyring = {
17
+ /**
18
+ * List accounts.
19
+ *
20
+ * Retrieves an array of KeyringAccount objects representing the available
21
+ * accounts.
22
+ *
23
+ * @returns A promise that resolves to an array of KeyringAccount objects.
24
+ */
25
+ listAccounts(): Promise<KeyringAccount[]>;
26
+ /**
27
+ * Get an account.
28
+ *
29
+ * Retrieves the KeyringAccount object for the given account ID.
30
+ *
31
+ * @param id - The ID of the account to retrieve.
32
+ * @returns A promise that resolves to the KeyringAccount object if found, or
33
+ * undefined otherwise.
34
+ */
35
+ getAccount(id: string): Promise<KeyringAccount | undefined>;
36
+ /**
37
+ * Create an account.
38
+ *
39
+ * Creates a new account with optional, keyring-defined, account options.
40
+ *
41
+ * @param options - Keyring-defined options for the account (optional).
42
+ * @returns A promise that resolves to the newly created KeyringAccount
43
+ * object without any private information.
44
+ */
45
+ createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
46
+ /**
47
+ * Lists the transactions of an account, paginated and ordered by the most
48
+ * recent first.
49
+ *
50
+ * The pagination options are used to limit the number of transactions in the
51
+ * response and to iterate over the results.
52
+ *
53
+ * @param id - The ID of the account to list the transactions for.
54
+ * @param pagination - The pagination options.
55
+ * @returns A promise that resolves to the next page of transactions.
56
+ */
57
+ listAccountTransactions?(id: string, pagination: Pagination): Promise<Paginated<Transaction>>;
58
+ /**
59
+ * Retrieve the balances of a given account.
60
+ *
61
+ * This method fetches the balances of specified assets for a given account
62
+ * ID. It returns a promise that resolves to an object where the keys are
63
+ * asset types and the values are balance objects containing the amount and
64
+ * unit.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * await keyring.getAccountBalances(
69
+ * '43550276-c7d6-4fac-87c7-00390ad0ce90',
70
+ * ['bip122:000000000019d6689c085ae165831e93/slip44:0']
71
+ * );
72
+ * // Returns something similar to:
73
+ * // {
74
+ * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {
75
+ * // amount: '0.0001',
76
+ * // unit: 'BTC',
77
+ * // }
78
+ * // }
79
+ * ```
80
+ * @param id - ID of the account to retrieve the balances for.
81
+ * @param assets - Array of asset types (CAIP-19) to retrieve balances for.
82
+ * @returns A promise that resolves to an object mapping asset types to their
83
+ * respective balances.
84
+ */
85
+ getAccountBalances?(id: string, assets: CaipAssetType[]): Promise<Record<CaipAssetType, Balance>>;
86
+ /**
87
+ * Filter supported chains for a given account.
88
+ *
89
+ * @param id - ID of the account to be checked.
90
+ * @param chains - List of chains (CAIP-2) to be checked.
91
+ * @returns A Promise that resolves to a filtered list of CAIP-2 IDs
92
+ * representing the supported chains.
93
+ */
94
+ filterAccountChains(id: string, chains: string[]): Promise<string[]>;
95
+ /**
96
+ * Update an account.
97
+ *
98
+ * Updates the account with the given account object. Does nothing if the
99
+ * account does not exist.
100
+ *
101
+ * @param account - The updated account object.
102
+ * @returns A promise that resolves when the account is successfully updated.
103
+ */
104
+ updateAccount(account: KeyringAccount): Promise<void>;
105
+ /**
106
+ * Delete an account from the keyring.
107
+ *
108
+ * Deletes the account with the given ID from the keyring.
109
+ *
110
+ * @param id - The ID of the account to delete.
111
+ * @returns A promise that resolves when the account is successfully deleted.
112
+ */
113
+ deleteAccount(id: string): Promise<void>;
114
+ /**
115
+ * Exports an account's private key.
116
+ *
117
+ * If the keyring cannot export a private key, this function should throw an
118
+ * error.
119
+ *
120
+ * @param id - The ID of the account to export.
121
+ * @returns A promise that resolves to the exported account.
122
+ */
123
+ exportAccount?(id: string): Promise<KeyringAccountData>;
124
+ /**
125
+ * List all submitted requests.
126
+ *
127
+ * Retrieves an array of KeyringRequest objects representing the submitted
128
+ * requests.
129
+ *
130
+ * @returns A promise that resolves to an array of KeyringRequest objects.
131
+ */
132
+ listRequests?(): Promise<KeyringRequest[]>;
133
+ /**
134
+ * Get a request.
135
+ *
136
+ * Retrieves the KeyringRequest object for the given request ID.
137
+ *
138
+ * @param id - The ID of the request to retrieve.
139
+ * @returns A promise that resolves to the KeyringRequest object if found, or
140
+ * undefined otherwise.
141
+ */
142
+ getRequest?(id: string): Promise<KeyringRequest | undefined>;
143
+ /**
144
+ * Submit a request.
145
+ *
146
+ * Submits the given KeyringRequest object.
147
+ *
148
+ * @param request - The KeyringRequest object to submit.
149
+ * @returns A promise that resolves to the request response.
150
+ */
151
+ submitRequest(request: KeyringRequest): Promise<KeyringResponse>;
152
+ /**
153
+ * Approve a request.
154
+ *
155
+ * Approves the request with the given ID and sets the response if provided.
156
+ *
157
+ * @param id - The ID of the request to approve.
158
+ * @param data - The response to the request (optional).
159
+ * @returns A promise that resolves when the request is successfully
160
+ * approved.
161
+ */
162
+ approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;
163
+ /**
164
+ * Reject a request.
165
+ *
166
+ * Rejects the request with the given ID.
167
+ *
168
+ * @param id - The ID of the request to reject.
169
+ * @returns A promise that resolves when the request is successfully
170
+ * rejected.
171
+ */
172
+ rejectRequest?(id: string): Promise<void>;
173
+ };
174
+ //# sourceMappingURL=keyring.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,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;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,0BAAsB;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,2BAAiB;AAEtD;;;;;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;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,CACtB,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=keyring.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"","sourcesContent":["import 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';\nimport type { Transaction } from './transaction';\nimport type { Paginated, Pagination } from '../utils';\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 * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\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"]}
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KeyringRequestStruct = void 0;
4
4
  const superstruct_1 = require("@metamask/superstruct");
5
5
  const utils_1 = require("@metamask/utils");
6
- const superstruct_2 = require("../superstruct");
7
- const utils_2 = require("../utils");
6
+ const superstruct_2 = require("../superstruct.cjs");
7
+ const utils_2 = require("../utils/index.cjs");
8
8
  exports.KeyringRequestStruct = (0, superstruct_2.object)({
9
9
  /**
10
10
  * Keyring request ID (UUIDv4).
@@ -26,4 +26,4 @@ exports.KeyringRequestStruct = (0, superstruct_2.object)({
26
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)])),
27
27
  }),
28
28
  });
29
- //# sourceMappingURL=request.js.map
29
+ //# sourceMappingURL=request.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.cjs","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":";;;AACA,uDAAqE;AACrE,2CAA6C;AAE7C,oDAAuD;AACvD,8CAAsC;AAEzB,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,kBAAU;IAEd;;OAEG;IACH,KAAK,EAAE,IAAA,oBAAM,GAAE;IAEf;;OAEG;IACH,OAAO,EAAE,kBAAU;IAEnB;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,EAAC;QACd,MAAM,EAAE,IAAA,oBAAM,GAAE;QAChB,MAAM,EAAE,IAAA,2BAAa,EACnB,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,kBAAU,CAAC,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,CACzD;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, record, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from '../superstruct';\nimport { UuidStruct } from '../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,4 +1,4 @@
1
- import type { Infer } from '@metamask/superstruct';
1
+ import type { Infer } from "@metamask/superstruct";
2
2
  export declare const KeyringRequestStruct: import("@metamask/superstruct").Struct<{
3
3
  id: string;
4
4
  scope: string;
@@ -28,7 +28,7 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
28
28
  params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
29
29
  }, {
30
30
  method: import("@metamask/superstruct").Struct<string, null>;
31
- params: import("@metamask/superstruct").Struct<import("../superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
31
+ params: import("@metamask/superstruct").Struct<import("../superstruct.cjs").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
32
32
  }>;
33
33
  }>;
34
34
  /**
@@ -37,3 +37,4 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
37
37
  * Represents a request made to the keyring for account-related operations.
38
38
  */
39
39
  export type KeyringRequest = Infer<typeof KeyringRequestStruct>;
40
+ //# sourceMappingURL=request.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.cts","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAOnD,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"}
@@ -0,0 +1,40 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struct<{
3
+ id: string;
4
+ scope: string;
5
+ account: string;
6
+ request: {
7
+ method: string;
8
+ params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
9
+ };
10
+ }, {
11
+ /**
12
+ * Keyring request ID (UUIDv4).
13
+ */
14
+ id: import("@metamask/superstruct").Struct<string, null>;
15
+ /**
16
+ * Request's scope (CAIP-2 chain ID).
17
+ */
18
+ scope: import("@metamask/superstruct").Struct<string, null>;
19
+ /**
20
+ * Account ID (UUIDv4).
21
+ */
22
+ account: import("@metamask/superstruct").Struct<string, null>;
23
+ /**
24
+ * Inner request sent by the client application.
25
+ */
26
+ request: import("@metamask/superstruct").Struct<{
27
+ method: string;
28
+ params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
29
+ }, {
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>;
32
+ }>;
33
+ }>;
34
+ /**
35
+ * Keyring request.
36
+ *
37
+ * Represents a request made to the keyring for account-related operations.
38
+ */
39
+ export type KeyringRequest = Infer<typeof KeyringRequestStruct>;
40
+ //# sourceMappingURL=request.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.mts","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAOnD,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"}
@@ -0,0 +1,26 @@
1
+ import { array, record, string, union } from "@metamask/superstruct";
2
+ import { JsonStruct } from "@metamask/utils";
3
+ import { exactOptional, object } from "../superstruct.mjs";
4
+ import { UuidStruct } from "../utils/index.mjs";
5
+ export const KeyringRequestStruct = object({
6
+ /**
7
+ * Keyring request ID (UUIDv4).
8
+ */
9
+ id: UuidStruct,
10
+ /**
11
+ * Request's scope (CAIP-2 chain ID).
12
+ */
13
+ scope: string(),
14
+ /**
15
+ * Account ID (UUIDv4).
16
+ */
17
+ account: UuidStruct,
18
+ /**
19
+ * Inner request sent by the client application.
20
+ */
21
+ request: object({
22
+ method: string(),
23
+ params: exactOptional(union([array(JsonStruct), record(string(), JsonStruct)])),
24
+ }),
25
+ });
26
+ //# sourceMappingURL=request.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.mjs","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;AACrE,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,2BAAuB;AACvD,OAAO,EAAE,UAAU,EAAE,2BAAiB;AAEtC,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 type { Infer } from '@metamask/superstruct';\nimport { array, record, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from '../superstruct';\nimport { UuidStruct } from '../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"]}