@metamask-previews/keyring-api 11.0.0-22cd5fe → 11.0.0-b250745

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 (273) hide show
  1. package/dist/api/account.cjs +3 -8
  2. package/dist/api/account.cjs.map +1 -1
  3. package/dist/api/account.d.cts +1 -6
  4. package/dist/api/account.d.cts.map +1 -1
  5. package/dist/api/account.d.mts +1 -6
  6. package/dist/api/account.d.mts.map +1 -1
  7. package/dist/api/account.mjs +3 -8
  8. package/dist/api/account.mjs.map +1 -1
  9. package/dist/api/balance.cjs +3 -4
  10. package/dist/api/balance.cjs.map +1 -1
  11. package/dist/api/balance.d.cts.map +1 -1
  12. package/dist/api/balance.d.mts.map +1 -1
  13. package/dist/api/balance.mjs +1 -2
  14. package/dist/api/balance.mjs.map +1 -1
  15. package/dist/api/caip.cjs +3 -3
  16. package/dist/api/caip.cjs.map +1 -1
  17. package/dist/api/caip.d.cts.map +1 -1
  18. package/dist/api/caip.d.mts.map +1 -1
  19. package/dist/api/caip.mjs +1 -1
  20. package/dist/api/caip.mjs.map +1 -1
  21. package/dist/api/keyring.cjs +2 -0
  22. package/dist/api/keyring.cjs.map +1 -1
  23. package/dist/api/keyring.d.cts.map +1 -1
  24. package/dist/api/keyring.d.mts.map +1 -1
  25. package/dist/api/keyring.mjs +2 -0
  26. package/dist/api/keyring.mjs.map +1 -1
  27. package/dist/api/request.cjs +6 -7
  28. package/dist/api/request.cjs.map +1 -1
  29. package/dist/api/request.d.cts +3 -3
  30. package/dist/api/request.d.cts.map +1 -1
  31. package/dist/api/request.d.mts +3 -3
  32. package/dist/api/request.d.mts.map +1 -1
  33. package/dist/api/request.mjs +1 -2
  34. package/dist/api/request.mjs.map +1 -1
  35. package/dist/api/response.cjs +6 -6
  36. package/dist/api/response.cjs.map +1 -1
  37. package/dist/api/response.d.cts.map +1 -1
  38. package/dist/api/response.d.mts.map +1 -1
  39. package/dist/api/response.mjs +1 -1
  40. package/dist/api/response.mjs.map +1 -1
  41. package/dist/btc/index.cjs +0 -1
  42. package/dist/btc/index.cjs.map +1 -1
  43. package/dist/btc/index.d.cts +0 -1
  44. package/dist/btc/index.d.cts.map +1 -1
  45. package/dist/btc/index.d.mts +0 -1
  46. package/dist/btc/index.d.mts.map +1 -1
  47. package/dist/btc/index.mjs +0 -1
  48. package/dist/btc/index.mjs.map +1 -1
  49. package/dist/btc/types.cjs +2 -2
  50. package/dist/btc/types.cjs.map +1 -1
  51. package/dist/btc/types.d.cts +1 -3
  52. package/dist/btc/types.d.cts.map +1 -1
  53. package/dist/btc/types.d.mts +1 -3
  54. package/dist/btc/types.d.mts.map +1 -1
  55. package/dist/btc/types.mjs +2 -2
  56. package/dist/btc/types.mjs.map +1 -1
  57. package/dist/eth/erc4337/types.cjs +10 -11
  58. package/dist/eth/erc4337/types.cjs.map +1 -1
  59. package/dist/eth/erc4337/types.d.cts +5 -5
  60. package/dist/eth/erc4337/types.d.cts.map +1 -1
  61. package/dist/eth/erc4337/types.d.mts +5 -5
  62. package/dist/eth/erc4337/types.d.mts.map +1 -1
  63. package/dist/eth/erc4337/types.mjs +1 -2
  64. package/dist/eth/erc4337/types.mjs.map +1 -1
  65. package/dist/eth/index.cjs +0 -1
  66. package/dist/eth/index.cjs.map +1 -1
  67. package/dist/eth/index.d.cts +0 -1
  68. package/dist/eth/index.d.cts.map +1 -1
  69. package/dist/eth/index.d.mts +0 -1
  70. package/dist/eth/index.d.mts.map +1 -1
  71. package/dist/eth/index.mjs +0 -1
  72. package/dist/eth/index.mjs.map +1 -1
  73. package/dist/eth/types.cjs +6 -6
  74. package/dist/eth/types.cjs.map +1 -1
  75. package/dist/eth/types.d.cts +2 -6
  76. package/dist/eth/types.d.cts.map +1 -1
  77. package/dist/eth/types.d.mts +2 -6
  78. package/dist/eth/types.d.mts.map +1 -1
  79. package/dist/eth/types.mjs +1 -1
  80. package/dist/eth/types.mjs.map +1 -1
  81. package/dist/eth/utils.cjs.map +1 -1
  82. package/dist/eth/utils.d.cts.map +1 -1
  83. package/dist/eth/utils.d.mts.map +1 -1
  84. package/dist/eth/utils.mjs.map +1 -1
  85. package/dist/events.cjs +67 -1
  86. package/dist/events.cjs.map +1 -1
  87. package/dist/events.d.cts +161 -0
  88. package/dist/events.d.cts.map +1 -1
  89. package/dist/events.d.mts +161 -0
  90. package/dist/events.d.mts.map +1 -1
  91. package/dist/events.mjs +66 -0
  92. package/dist/events.mjs.map +1 -1
  93. package/dist/index.cjs +2 -8
  94. package/dist/index.cjs.map +1 -1
  95. package/dist/index.d.cts +3 -9
  96. package/dist/index.d.cts.map +1 -1
  97. package/dist/index.d.mts +3 -9
  98. package/dist/index.d.mts.map +1 -1
  99. package/dist/index.mjs +2 -8
  100. package/dist/index.mjs.map +1 -1
  101. package/dist/rpc.cjs.map +1 -0
  102. package/dist/rpc.d.cts.map +1 -0
  103. package/dist/rpc.d.mts.map +1 -0
  104. package/dist/rpc.mjs.map +1 -0
  105. package/dist/sol/index.cjs +0 -1
  106. package/dist/sol/index.cjs.map +1 -1
  107. package/dist/sol/index.d.cts +0 -1
  108. package/dist/sol/index.d.cts.map +1 -1
  109. package/dist/sol/index.d.mts +0 -1
  110. package/dist/sol/index.d.mts.map +1 -1
  111. package/dist/sol/index.mjs +0 -1
  112. package/dist/sol/index.mjs.map +1 -1
  113. package/dist/sol/types.cjs +3 -3
  114. package/dist/sol/types.cjs.map +1 -1
  115. package/dist/sol/types.d.cts +1 -3
  116. package/dist/sol/types.d.cts.map +1 -1
  117. package/dist/sol/types.d.mts +1 -3
  118. package/dist/sol/types.d.mts.map +1 -1
  119. package/dist/sol/types.mjs +1 -1
  120. package/dist/sol/types.mjs.map +1 -1
  121. package/package.json +9 -11
  122. package/dist/JsonRpcRequest.cjs +0 -13
  123. package/dist/JsonRpcRequest.cjs.map +0 -1
  124. package/dist/JsonRpcRequest.d.cts +0 -17
  125. package/dist/JsonRpcRequest.d.cts.map +0 -1
  126. package/dist/JsonRpcRequest.d.mts +0 -17
  127. package/dist/JsonRpcRequest.d.mts.map +0 -1
  128. package/dist/JsonRpcRequest.mjs +0 -10
  129. package/dist/JsonRpcRequest.mjs.map +0 -1
  130. package/dist/KeyringClient.cjs +0 -124
  131. package/dist/KeyringClient.cjs.map +0 -1
  132. package/dist/KeyringClient.d.cts +0 -29
  133. package/dist/KeyringClient.d.cts.map +0 -1
  134. package/dist/KeyringClient.d.mts +0 -29
  135. package/dist/KeyringClient.d.mts.map +0 -1
  136. package/dist/KeyringClient.mjs +0 -120
  137. package/dist/KeyringClient.mjs.map +0 -1
  138. package/dist/KeyringSnapRpcClient.cjs +0 -68
  139. package/dist/KeyringSnapRpcClient.cjs.map +0 -1
  140. package/dist/KeyringSnapRpcClient.d.cts +0 -40
  141. package/dist/KeyringSnapRpcClient.d.cts.map +0 -1
  142. package/dist/KeyringSnapRpcClient.d.mts +0 -40
  143. package/dist/KeyringSnapRpcClient.d.mts.map +0 -1
  144. package/dist/KeyringSnapRpcClient.mjs +0 -63
  145. package/dist/KeyringSnapRpcClient.mjs.map +0 -1
  146. package/dist/btc/constants.cjs +0 -13
  147. package/dist/btc/constants.cjs.map +0 -1
  148. package/dist/btc/constants.d.cts +0 -9
  149. package/dist/btc/constants.d.cts.map +0 -1
  150. package/dist/btc/constants.d.mts +0 -9
  151. package/dist/btc/constants.d.mts.map +0 -1
  152. package/dist/btc/constants.mjs +0 -10
  153. package/dist/btc/constants.mjs.map +0 -1
  154. package/dist/eth/constants.cjs +0 -12
  155. package/dist/eth/constants.cjs.map +0 -1
  156. package/dist/eth/constants.d.cts +0 -8
  157. package/dist/eth/constants.d.cts.map +0 -1
  158. package/dist/eth/constants.d.mts +0 -8
  159. package/dist/eth/constants.d.mts.map +0 -1
  160. package/dist/eth/constants.mjs +0 -9
  161. package/dist/eth/constants.mjs.map +0 -1
  162. package/dist/internal/api.cjs +0 -139
  163. package/dist/internal/api.cjs.map +0 -1
  164. package/dist/internal/api.d.cts +0 -431
  165. package/dist/internal/api.d.cts.map +0 -1
  166. package/dist/internal/api.d.mts +0 -431
  167. package/dist/internal/api.d.mts.map +0 -1
  168. package/dist/internal/api.mjs +0 -136
  169. package/dist/internal/api.mjs.map +0 -1
  170. package/dist/internal/eth/EthKeyring.cjs +0 -3
  171. package/dist/internal/eth/EthKeyring.cjs.map +0 -1
  172. package/dist/internal/eth/EthKeyring.d.cts +0 -34
  173. package/dist/internal/eth/EthKeyring.d.cts.map +0 -1
  174. package/dist/internal/eth/EthKeyring.d.mts +0 -34
  175. package/dist/internal/eth/EthKeyring.d.mts.map +0 -1
  176. package/dist/internal/eth/EthKeyring.mjs +0 -2
  177. package/dist/internal/eth/EthKeyring.mjs.map +0 -1
  178. package/dist/internal/eth/index.cjs +0 -3
  179. package/dist/internal/eth/index.cjs.map +0 -1
  180. package/dist/internal/eth/index.d.cts +0 -2
  181. package/dist/internal/eth/index.d.cts.map +0 -1
  182. package/dist/internal/eth/index.d.mts +0 -2
  183. package/dist/internal/eth/index.d.mts.map +0 -1
  184. package/dist/internal/eth/index.mjs +0 -2
  185. package/dist/internal/eth/index.mjs.map +0 -1
  186. package/dist/internal/events.cjs +0 -72
  187. package/dist/internal/events.cjs.map +0 -1
  188. package/dist/internal/events.d.cts +0 -170
  189. package/dist/internal/events.d.cts.map +0 -1
  190. package/dist/internal/events.d.mts +0 -170
  191. package/dist/internal/events.d.mts.map +0 -1
  192. package/dist/internal/events.mjs +0 -69
  193. package/dist/internal/events.mjs.map +0 -1
  194. package/dist/internal/index.cjs +0 -21
  195. package/dist/internal/index.cjs.map +0 -1
  196. package/dist/internal/index.d.cts +0 -6
  197. package/dist/internal/index.d.cts.map +0 -1
  198. package/dist/internal/index.d.mts +0 -6
  199. package/dist/internal/index.d.mts.map +0 -1
  200. package/dist/internal/index.mjs +0 -5
  201. package/dist/internal/index.mjs.map +0 -1
  202. package/dist/internal/rpc.cjs.map +0 -1
  203. package/dist/internal/rpc.d.cts.map +0 -1
  204. package/dist/internal/rpc.d.mts.map +0 -1
  205. package/dist/internal/rpc.mjs.map +0 -1
  206. package/dist/internal/types.cjs +0 -52
  207. package/dist/internal/types.cjs.map +0 -1
  208. package/dist/internal/types.d.cts +0 -402
  209. package/dist/internal/types.d.cts.map +0 -1
  210. package/dist/internal/types.d.mts +0 -402
  211. package/dist/internal/types.d.mts.map +0 -1
  212. package/dist/internal/types.mjs +0 -49
  213. package/dist/internal/types.mjs.map +0 -1
  214. package/dist/rpc-handler.cjs +0 -136
  215. package/dist/rpc-handler.cjs.map +0 -1
  216. package/dist/rpc-handler.d.cts +0 -30
  217. package/dist/rpc-handler.d.cts.map +0 -1
  218. package/dist/rpc-handler.d.mts +0 -30
  219. package/dist/rpc-handler.d.mts.map +0 -1
  220. package/dist/rpc-handler.mjs +0 -131
  221. package/dist/rpc-handler.mjs.map +0 -1
  222. package/dist/snap-utils.cjs +0 -20
  223. package/dist/snap-utils.cjs.map +0 -1
  224. package/dist/snap-utils.d.cts +0 -12
  225. package/dist/snap-utils.d.cts.map +0 -1
  226. package/dist/snap-utils.d.mts +0 -12
  227. package/dist/snap-utils.d.mts.map +0 -1
  228. package/dist/snap-utils.mjs +0 -17
  229. package/dist/snap-utils.mjs.map +0 -1
  230. package/dist/sol/constants.cjs +0 -14
  231. package/dist/sol/constants.cjs.map +0 -1
  232. package/dist/sol/constants.d.cts +0 -10
  233. package/dist/sol/constants.d.cts.map +0 -1
  234. package/dist/sol/constants.d.mts +0 -10
  235. package/dist/sol/constants.d.mts.map +0 -1
  236. package/dist/sol/constants.mjs +0 -11
  237. package/dist/sol/constants.mjs.map +0 -1
  238. package/dist/superstruct.cjs +0 -80
  239. package/dist/superstruct.cjs.map +0 -1
  240. package/dist/superstruct.d.cts +0 -84
  241. package/dist/superstruct.d.cts.map +0 -1
  242. package/dist/superstruct.d.mts +0 -84
  243. package/dist/superstruct.d.mts.map +0 -1
  244. package/dist/superstruct.mjs +0 -74
  245. package/dist/superstruct.mjs.map +0 -1
  246. package/dist/utils/index.cjs +0 -19
  247. package/dist/utils/index.cjs.map +0 -1
  248. package/dist/utils/index.d.cts +0 -3
  249. package/dist/utils/index.d.cts.map +0 -1
  250. package/dist/utils/index.d.mts +0 -3
  251. package/dist/utils/index.d.mts.map +0 -1
  252. package/dist/utils/index.mjs +0 -3
  253. package/dist/utils/index.mjs.map +0 -1
  254. package/dist/utils/types.cjs +0 -29
  255. package/dist/utils/types.cjs.map +0 -1
  256. package/dist/utils/types.d.cts +0 -18
  257. package/dist/utils/types.d.cts.map +0 -1
  258. package/dist/utils/types.d.mts +0 -18
  259. package/dist/utils/types.d.mts.map +0 -1
  260. package/dist/utils/types.mjs +0 -26
  261. package/dist/utils/types.mjs.map +0 -1
  262. package/dist/utils/typing.cjs +0 -20
  263. package/dist/utils/typing.cjs.map +0 -1
  264. package/dist/utils/typing.d.cts +0 -33
  265. package/dist/utils/typing.d.cts.map +0 -1
  266. package/dist/utils/typing.d.mts +0 -33
  267. package/dist/utils/typing.d.mts.map +0 -1
  268. package/dist/utils/typing.mjs +0 -17
  269. package/dist/utils/typing.mjs.map +0 -1
  270. /package/dist/{internal/rpc.cjs → rpc.cjs} +0 -0
  271. /package/dist/{internal/rpc.d.cts → rpc.d.cts} +0 -0
  272. /package/dist/{internal/rpc.d.mts → rpc.d.mts} +0 -0
  273. /package/dist/{internal/rpc.mjs → rpc.mjs} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.cjs","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":";;;AAyBA,gDAEC;AA3BD;;GAEG;AACH,IAAY,gBAcX;AAdD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,qEAAiD,CAAA;IACjD,uEAAmD,CAAA;IACnD,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,6DAAyC,CAAA;IACzC,2DAAuC,CAAA;AACzC,CAAC,EAdW,gBAAgB,gCAAhB,gBAAgB,QAc3B;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["/**\n * Keyring RPC methods used by the API.\n */\nexport enum KeyringRpcMethod {\n ListAccounts = 'keyring_listAccounts',\n GetAccount = 'keyring_getAccount',\n CreateAccount = 'keyring_createAccount',\n GetAccountBalances = 'keyring_getAccountBalances',\n FilterAccountChains = 'keyring_filterAccountChains',\n UpdateAccount = 'keyring_updateAccount',\n DeleteAccount = 'keyring_deleteAccount',\n ExportAccount = 'keyring_exportAccount',\n ListRequests = 'keyring_listRequests',\n GetRequest = 'keyring_getRequest',\n SubmitRequest = 'keyring_submitRequest',\n ApproveRequest = 'keyring_approveRequest',\n RejectRequest = 'keyring_rejectRequest',\n}\n\n/**\n * Check if a method is a keyring RPC method.\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method.\n */\nexport function isKeyringRpcMethod(method: string): boolean {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.d.cts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,kBAAkB,+BAA+B;IACjD,mBAAmB,gCAAgC;IACnD,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,cAAc,2BAA2B;IACzC,aAAa,0BAA0B;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.d.mts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,kBAAkB,+BAA+B;IACjD,mBAAmB,gCAAgC;IACnD,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,cAAc,2BAA2B;IACzC,aAAa,0BAA0B;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.mjs","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,gBAcX;AAdD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,qEAAiD,CAAA;IACjD,uEAAmD,CAAA;IACnD,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,6DAAyC,CAAA;IACzC,2DAAuC,CAAA;AACzC,CAAC,EAdW,gBAAgB,KAAhB,gBAAgB,QAc3B;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["/**\n * Keyring RPC methods used by the API.\n */\nexport enum KeyringRpcMethod {\n ListAccounts = 'keyring_listAccounts',\n GetAccount = 'keyring_getAccount',\n CreateAccount = 'keyring_createAccount',\n GetAccountBalances = 'keyring_getAccountBalances',\n FilterAccountChains = 'keyring_filterAccountChains',\n UpdateAccount = 'keyring_updateAccount',\n DeleteAccount = 'keyring_deleteAccount',\n ExportAccount = 'keyring_exportAccount',\n ListRequests = 'keyring_listRequests',\n GetRequest = 'keyring_getRequest',\n SubmitRequest = 'keyring_submitRequest',\n ApproveRequest = 'keyring_approveRequest',\n RejectRequest = 'keyring_rejectRequest',\n}\n\n/**\n * Check if a method is a keyring RPC method.\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method.\n */\nexport function isKeyringRpcMethod(method: string): boolean {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n"]}
@@ -14,6 +14,5 @@ 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("./constants.cjs"), exports);
18
17
  __exportStar(require("./types.cjs"), exports);
19
18
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/sol/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA4B;AAC5B,8CAAwB","sourcesContent":["export * from './constants';\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/sol/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAAwB","sourcesContent":["export * from './types';\n"]}
@@ -1,3 +1,2 @@
1
- export * from "./constants.cjs";
2
1
  export * from "./types.cjs";
3
2
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/sol/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,4BAAwB"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/sol/index.ts"],"names":[],"mappings":"AAAA,4BAAwB"}
@@ -1,3 +1,2 @@
1
- export * from "./constants.mjs";
2
1
  export * from "./types.mjs";
3
2
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/sol/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,4BAAwB"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/sol/index.ts"],"names":[],"mappings":"AAAA,4BAAwB"}
@@ -1,3 +1,2 @@
1
- export * from "./constants.mjs";
2
1
  export * from "./types.mjs";
3
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/sol/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,4BAAwB","sourcesContent":["export * from './constants';\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/sol/index.ts"],"names":[],"mappings":"AAAA,4BAAwB","sourcesContent":["export * from './types';\n"]}
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SolDataAccountStruct = exports.SolMethod = exports.SolAddressStruct = void 0;
4
+ const keyring_utils_1 = require("@metamask/keyring-utils");
4
5
  const superstruct_1 = require("@metamask/superstruct");
5
6
  const api_1 = require("../api/index.cjs");
6
- const superstruct_2 = require("../superstruct.cjs");
7
7
  /**
8
8
  * Solana addresses are represented in the format of a 256-bit ed25519 public key and
9
9
  * are encoded using base58.
10
10
  * They are usually 32 to 44 characters long.
11
11
  */
12
- exports.SolAddressStruct = (0, superstruct_2.definePattern)('SolAddress', /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);
12
+ exports.SolAddressStruct = (0, keyring_utils_1.definePattern)('SolAddress', /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);
13
13
  /**
14
14
  * Supported Solana methods.
15
15
  */
@@ -18,7 +18,7 @@ var SolMethod;
18
18
  // General transaction methods
19
19
  SolMethod["SendAndConfirmTransaction"] = "sendAndConfirmTransaction";
20
20
  })(SolMethod || (exports.SolMethod = SolMethod = {}));
21
- exports.SolDataAccountStruct = (0, superstruct_2.object)({
21
+ exports.SolDataAccountStruct = (0, keyring_utils_1.object)({
22
22
  ...api_1.KeyringAccountStruct.schema,
23
23
  /**
24
24
  * Account address.
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":";;;AACA,uDAA8D;AAE9D,0CAA8D;AAC9D,oDAAuD;AAEvD;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,IAAA,2BAAa,EAC3C,YAAY,EACZ,iCAAiC,CAClC,CAAC;AAEF;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,oEAAuD,CAAA;AACzD,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAEY,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC,GAAG,0BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,wBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,WAAW,EAAE,CAAC;IAE9C;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,CAAC,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;CAClE,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { KeyringAccountStruct, SolAccountType } from '../api';\nimport { object, definePattern } from '../superstruct';\n\n/**\n * Solana addresses are represented in the format of a 256-bit ed25519 public key and\n * are encoded using base58.\n * They are usually 32 to 44 characters long.\n */\nexport const SolAddressStruct = definePattern(\n 'SolAddress',\n /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu,\n);\n\n/**\n * Supported Solana methods.\n */\nexport enum SolMethod {\n // General transaction methods\n SendAndConfirmTransaction = 'sendAndConfirmTransaction',\n}\n\nexport const SolDataAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: SolAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${SolAccountType.DataAccount}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${SolMethod.SendAndConfirmTransaction}`])),\n});\n\nexport type SolDataAccount = Infer<typeof SolDataAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAA8D;AAE9D,0CAA8D;AAE9D;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,IAAA,6BAAa,EAC3C,YAAY,EACZ,iCAAiC,CAClC,CAAC;AAEF;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,oEAAuD,CAAA;AACzD,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAEY,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC,GAAG,0BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,wBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,WAAW,EAAE,CAAC;IAE9C;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,CAAC,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;CAClE,CAAC,CAAC","sourcesContent":["import { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { KeyringAccountStruct, SolAccountType } from '../api';\n\n/**\n * Solana addresses are represented in the format of a 256-bit ed25519 public key and\n * are encoded using base58.\n * They are usually 32 to 44 characters long.\n */\nexport const SolAddressStruct = definePattern(\n 'SolAddress',\n /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu,\n);\n\n/**\n * Supported Solana methods.\n */\nexport enum SolMethod {\n // General transaction methods\n SendAndConfirmTransaction = 'sendAndConfirmTransaction',\n}\n\nexport const SolDataAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: SolAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${SolAccountType.DataAccount}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${SolMethod.SendAndConfirmTransaction}`])),\n});\n\nexport type SolDataAccount = Infer<typeof SolDataAccountStruct>;\n"]}
@@ -12,10 +12,9 @@ export declare enum SolMethod {
12
12
  SendAndConfirmTransaction = "sendAndConfirmTransaction"
13
13
  }
14
14
  export declare const SolDataAccountStruct: import("@metamask/superstruct").Struct<{
15
- type: "solana:data-account";
16
15
  id: string;
16
+ type: "solana:data-account";
17
17
  address: string;
18
- scopes: string[];
19
18
  options: Record<string, import("@metamask/utils").Json>;
20
19
  methods: "sendAndConfirmTransaction"[];
21
20
  }, {
@@ -34,7 +33,6 @@ export declare const SolDataAccountStruct: import("@metamask/superstruct").Struc
34
33
  sendAndConfirmTransaction: "sendAndConfirmTransaction";
35
34
  }>>;
36
35
  id: import("@metamask/superstruct").Struct<string, null>;
37
- scopes: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
38
36
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
39
37
  }>;
40
38
  export type SolDataAccount = Infer<typeof SolDataAccountStruct>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,yBAAyB,8BAA8B;CACxD;AAED,eAAO,MAAM,oBAAoB;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,yBAAyB,8BAA8B;CACxD;AAED,eAAO,MAAM,oBAAoB;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -12,10 +12,9 @@ export declare enum SolMethod {
12
12
  SendAndConfirmTransaction = "sendAndConfirmTransaction"
13
13
  }
14
14
  export declare const SolDataAccountStruct: import("@metamask/superstruct").Struct<{
15
- type: "solana:data-account";
16
15
  id: string;
16
+ type: "solana:data-account";
17
17
  address: string;
18
- scopes: string[];
19
18
  options: Record<string, import("@metamask/utils").Json>;
20
19
  methods: "sendAndConfirmTransaction"[];
21
20
  }, {
@@ -34,7 +33,6 @@ export declare const SolDataAccountStruct: import("@metamask/superstruct").Struc
34
33
  sendAndConfirmTransaction: "sendAndConfirmTransaction";
35
34
  }>>;
36
35
  id: import("@metamask/superstruct").Struct<string, null>;
37
- scopes: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
38
36
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
39
37
  }>;
40
38
  export type SolDataAccount = Infer<typeof SolDataAccountStruct>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,yBAAyB,8BAA8B;CACxD;AAED,eAAO,MAAM,oBAAoB;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,yBAAyB,8BAA8B;CACxD;AAED,eAAO,MAAM,oBAAoB;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
+ import { object, definePattern } from "@metamask/keyring-utils";
1
2
  import { array, enums, literal } from "@metamask/superstruct";
2
3
  import { KeyringAccountStruct, SolAccountType } from "../api/index.mjs";
3
- import { object, definePattern } from "../superstruct.mjs";
4
4
  /**
5
5
  * Solana addresses are represented in the format of a 256-bit ed25519 public key and
6
6
  * are encoded using base58.
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AAE9D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,yBAAe;AAC9D,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,2BAAuB;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,iCAAiC,CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,oEAAuD,CAAA;AACzD,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;IAE9C;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;CAClE,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { KeyringAccountStruct, SolAccountType } from '../api';\nimport { object, definePattern } from '../superstruct';\n\n/**\n * Solana addresses are represented in the format of a 256-bit ed25519 public key and\n * are encoded using base58.\n * They are usually 32 to 44 characters long.\n */\nexport const SolAddressStruct = definePattern(\n 'SolAddress',\n /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu,\n);\n\n/**\n * Supported Solana methods.\n */\nexport enum SolMethod {\n // General transaction methods\n SendAndConfirmTransaction = 'sendAndConfirmTransaction',\n}\n\nexport const SolDataAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: SolAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${SolAccountType.DataAccount}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${SolMethod.SendAndConfirmTransaction}`])),\n});\n\nexport type SolDataAccount = Infer<typeof SolDataAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gCAAgC;AAEhE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AAE9D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,yBAAe;AAE9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,iCAAiC,CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,oEAAuD,CAAA;AACzD,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;IAE9C;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;CAClE,CAAC,CAAC","sourcesContent":["import { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { KeyringAccountStruct, SolAccountType } from '../api';\n\n/**\n * Solana addresses are represented in the format of a 256-bit ed25519 public key and\n * are encoded using base58.\n * They are usually 32 to 44 characters long.\n */\nexport const SolAddressStruct = definePattern(\n 'SolAddress',\n /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu,\n);\n\n/**\n * Supported Solana methods.\n */\nexport enum SolMethod {\n // General transaction methods\n SendAndConfirmTransaction = 'sendAndConfirmTransaction',\n}\n\nexport const SolDataAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: SolAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${SolAccountType.DataAccount}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${SolMethod.SendAndConfirmTransaction}`])),\n});\n\nexport type SolDataAccount = Infer<typeof SolDataAccountStruct>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/keyring-api",
3
- "version": "11.0.0-22cd5fe",
3
+ "version": "11.0.0-b250745",
4
4
  "description": "MetaMask Keyring API",
5
5
  "keywords": [
6
6
  "metamask",
@@ -42,23 +42,21 @@
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": "tsd",
45
+ "test:types": "../../scripts/tsd-test.sh ./src",
46
46
  "test:watch": "jest --watch"
47
47
  },
48
48
  "dependencies": {
49
- "@metamask/snaps-sdk": "^6.7.0",
49
+ "@metamask/keyring-utils": "0.0.1",
50
50
  "@metamask/superstruct": "^3.1.0",
51
51
  "@metamask/utils": "^9.2.1",
52
- "@types/uuid": "^9.0.8",
53
52
  "bech32": "^2.0.0",
54
- "uuid": "^9.0.1",
55
- "webextension-polyfill": "^0.12.0"
53
+ "uuid": "^9.0.1"
56
54
  },
57
55
  "devDependencies": {
58
56
  "@lavamoat/allow-scripts": "^3.2.1",
59
57
  "@lavamoat/preinstall-always-fail": "^2.1.0",
60
58
  "@metamask/auto-changelog": "^3.4.4",
61
- "@metamask/providers": "^18.1.0",
59
+ "@metamask/keyring-utils": "0.0.1",
62
60
  "@ts-bridge/cli": "^0.6.0",
63
61
  "@types/jest": "^29.5.12",
64
62
  "@types/node": "^20.12.12",
@@ -73,9 +71,6 @@
73
71
  "typedoc": "^0.25.13",
74
72
  "typescript": "~5.6.3"
75
73
  },
76
- "peerDependencies": {
77
- "@metamask/providers": "^18.1.0"
78
- },
79
74
  "engines": {
80
75
  "node": "^18.18 || >=20"
81
76
  },
@@ -91,6 +86,9 @@
91
86
  }
92
87
  },
93
88
  "tsd": {
94
- "directory": "src"
89
+ "directory": "src",
90
+ "compilerOptions": {
91
+ "composite": "false"
92
+ }
95
93
  }
96
94
  }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JsonRpcRequestStruct = void 0;
4
- const superstruct_1 = require("@metamask/superstruct");
5
- const utils_1 = require("@metamask/utils");
6
- const superstruct_2 = require("./superstruct.cjs");
7
- exports.JsonRpcRequestStruct = (0, superstruct_2.object)({
8
- jsonrpc: (0, superstruct_1.literal)('2.0'),
9
- id: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)(), (0, superstruct_1.literal)(null)]),
10
- method: (0, superstruct_1.string)(),
11
- params: (0, superstruct_2.exactOptional)((0, superstruct_1.union)([(0, superstruct_1.array)(utils_1.JsonStruct), (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct)])),
12
- });
13
- //# sourceMappingURL=JsonRpcRequest.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JsonRpcRequest.cjs","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":";;;AAAA,uDAO+B;AAE/B,2CAA6C;AAE7C,mDAAsD;AAEzC,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,MAAM,EAAE,IAAA,oBAAM,GAAE;IAChB,MAAM,EAAE,IAAA,2BAAa,EACnB,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,kBAAU,CAAC,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,CACzD;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from './superstruct';\n\nexport const JsonRpcRequestStruct = object({\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n});\n\n/**\n * JSON-RPC request type.\n */\nexport type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;\n"]}
@@ -1,17 +0,0 @@
1
- import type { Infer } from "@metamask/superstruct";
2
- export declare const JsonRpcRequestStruct: import("@metamask/superstruct").Struct<{
3
- jsonrpc: "2.0";
4
- id: string | number | null;
5
- method: string;
6
- params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
7
- }, {
8
- jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
9
- id: import("@metamask/superstruct").Struct<string | number | null, null>;
10
- method: import("@metamask/superstruct").Struct<string, null>;
11
- params: import("@metamask/superstruct").Struct<import("./superstruct.cjs").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
12
- }>;
13
- /**
14
- * JSON-RPC request type.
15
- */
16
- export type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;
17
- //# sourceMappingURL=JsonRpcRequest.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JsonRpcRequest.d.cts","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,eAAO,MAAM,oBAAoB;;;;;;;;;;EAO/B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- import type { Infer } from "@metamask/superstruct";
2
- export declare const JsonRpcRequestStruct: import("@metamask/superstruct").Struct<{
3
- jsonrpc: "2.0";
4
- id: string | number | null;
5
- method: string;
6
- params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
7
- }, {
8
- jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
9
- id: import("@metamask/superstruct").Struct<string | number | null, null>;
10
- method: import("@metamask/superstruct").Struct<string, null>;
11
- params: import("@metamask/superstruct").Struct<import("./superstruct.mjs").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
12
- }>;
13
- /**
14
- * JSON-RPC request type.
15
- */
16
- export type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;
17
- //# sourceMappingURL=JsonRpcRequest.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JsonRpcRequest.d.mts","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,eAAO,MAAM,oBAAoB;;;;;;;;;;EAO/B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- import { array, literal, number, record, string, union } from "@metamask/superstruct";
2
- import { JsonStruct } from "@metamask/utils";
3
- import { exactOptional, object } from "./superstruct.mjs";
4
- export const JsonRpcRequestStruct = object({
5
- jsonrpc: literal('2.0'),
6
- id: union([string(), number(), literal(null)]),
7
- method: string(),
8
- params: exactOptional(union([array(JsonStruct), record(string(), JsonStruct)])),
9
- });
10
- //# sourceMappingURL=JsonRpcRequest.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JsonRpcRequest.mjs","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAE/B,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,0BAAsB;AAEtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;IACvB,EAAE,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,MAAM,EAAE,MAAM,EAAE;IAChB,MAAM,EAAE,aAAa,CACnB,KAAK,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CACzD;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from './superstruct';\n\nexport const JsonRpcRequestStruct = object({\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n});\n\n/**\n * JSON-RPC request type.\n */\nexport type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;\n"]}
@@ -1,124 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _KeyringClient_instances, _KeyringClient_sender, _KeyringClient_send;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.KeyringClient = void 0;
16
- const superstruct_1 = require("@metamask/superstruct");
17
- const uuid_1 = require("uuid");
18
- const api_1 = require("./internal/api.cjs");
19
- const rpc_1 = require("./internal/rpc.cjs");
20
- const superstruct_2 = require("./superstruct.cjs");
21
- class KeyringClient {
22
- /**
23
- * Create a new instance of `KeyringClient`.
24
- *
25
- * @param sender - The `Sender` instance to use to send requests to the snap.
26
- */
27
- constructor(sender) {
28
- _KeyringClient_instances.add(this);
29
- _KeyringClient_sender.set(this, void 0);
30
- __classPrivateFieldSet(this, _KeyringClient_sender, sender, "f");
31
- }
32
- async listAccounts() {
33
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
34
- method: rpc_1.KeyringRpcMethod.ListAccounts,
35
- }), api_1.ListAccountsResponseStruct);
36
- }
37
- async getAccount(id) {
38
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
39
- method: rpc_1.KeyringRpcMethod.GetAccount,
40
- params: { id },
41
- }), api_1.GetAccountResponseStruct);
42
- }
43
- async getAccountBalances(id, assets) {
44
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
45
- method: rpc_1.KeyringRpcMethod.GetAccountBalances,
46
- params: { id, assets },
47
- }), api_1.GetAccountBalancesResponseStruct);
48
- }
49
- async createAccount(options = {}) {
50
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
51
- method: rpc_1.KeyringRpcMethod.CreateAccount,
52
- params: { options },
53
- }), api_1.CreateAccountResponseStruct);
54
- }
55
- async filterAccountChains(id, chains) {
56
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
57
- method: rpc_1.KeyringRpcMethod.FilterAccountChains,
58
- params: { id, chains },
59
- }), api_1.FilterAccountChainsResponseStruct);
60
- }
61
- async updateAccount(account) {
62
- (0, superstruct_1.assert)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
63
- method: rpc_1.KeyringRpcMethod.UpdateAccount,
64
- params: { account },
65
- }), api_1.UpdateAccountResponseStruct);
66
- }
67
- async deleteAccount(id) {
68
- (0, superstruct_1.assert)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
69
- method: rpc_1.KeyringRpcMethod.DeleteAccount,
70
- params: { id },
71
- }), api_1.DeleteAccountResponseStruct);
72
- }
73
- async exportAccount(id) {
74
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
75
- method: rpc_1.KeyringRpcMethod.ExportAccount,
76
- params: { id },
77
- }), api_1.ExportAccountResponseStruct);
78
- }
79
- async listRequests() {
80
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
81
- method: rpc_1.KeyringRpcMethod.ListRequests,
82
- }), api_1.ListRequestsResponseStruct);
83
- }
84
- async getRequest(id) {
85
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
86
- method: rpc_1.KeyringRpcMethod.GetRequest,
87
- params: { id },
88
- }), api_1.GetRequestResponseStruct);
89
- }
90
- async submitRequest(request) {
91
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
92
- method: rpc_1.KeyringRpcMethod.SubmitRequest,
93
- params: request,
94
- }), api_1.SubmitRequestResponseStruct);
95
- }
96
- async approveRequest(id, data = {}) {
97
- (0, superstruct_1.assert)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
98
- method: rpc_1.KeyringRpcMethod.ApproveRequest,
99
- params: { id, data },
100
- }), api_1.ApproveRequestResponseStruct);
101
- }
102
- async rejectRequest(id) {
103
- (0, superstruct_1.assert)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
104
- method: rpc_1.KeyringRpcMethod.RejectRequest,
105
- params: { id },
106
- }), api_1.RejectRequestResponseStruct);
107
- }
108
- }
109
- exports.KeyringClient = KeyringClient;
110
- _KeyringClient_sender = new WeakMap(), _KeyringClient_instances = new WeakSet(), _KeyringClient_send =
111
- /**
112
- * Send a request to the snap and return the response.
113
- *
114
- * @param partial - A partial JSON-RPC request (method and params).
115
- * @returns A promise that resolves to the response to the request.
116
- */
117
- async function _KeyringClient_send(partial) {
118
- return __classPrivateFieldGet(this, _KeyringClient_sender, "f").send({
119
- jsonrpc: '2.0',
120
- id: (0, uuid_1.v4)(),
121
- ...partial,
122
- });
123
- };
124
- //# sourceMappingURL=KeyringClient.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeyringClient.cjs","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":"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","sourcesContent":["import { assert } from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\nimport { v4 as uuid } from 'uuid';\n\nimport type {\n Keyring,\n KeyringAccount,\n KeyringRequest,\n KeyringAccountData,\n KeyringResponse,\n CaipAssetType,\n Balance,\n} from './api';\nimport {\n ApproveRequestResponseStruct,\n CreateAccountResponseStruct,\n DeleteAccountResponseStruct,\n ExportAccountResponseStruct,\n FilterAccountChainsResponseStruct,\n GetAccountBalancesResponseStruct,\n GetAccountResponseStruct,\n GetRequestResponseStruct,\n ListAccountsResponseStruct,\n ListRequestsResponseStruct,\n RejectRequestResponseStruct,\n SubmitRequestResponseStruct,\n UpdateAccountResponseStruct,\n} from './internal/api';\nimport { KeyringRpcMethod } from './internal/rpc';\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport { strictMask } from './superstruct';\n\nexport type Sender = {\n send(request: JsonRpcRequest): Promise<Json>;\n};\n\nexport class KeyringClient implements Keyring {\n readonly #sender: Sender;\n\n /**\n * Create a new instance of `KeyringClient`.\n *\n * @param sender - The `Sender` instance to use to send requests to the snap.\n */\n constructor(sender: Sender) {\n this.#sender = sender;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param partial - A partial JSON-RPC request (method and params).\n * @returns A promise that resolves to the response to the request.\n */\n async #send(partial: Omit<JsonRpcRequest, 'jsonrpc' | 'id'>): Promise<Json> {\n return this.#sender.send({\n jsonrpc: '2.0',\n id: uuid(),\n ...partial,\n });\n }\n\n async listAccounts(): Promise<KeyringAccount[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListAccounts,\n }),\n ListAccountsResponseStruct,\n );\n }\n\n async getAccount(id: string): Promise<KeyringAccount> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetAccount,\n params: { id },\n }),\n GetAccountResponseStruct,\n );\n }\n\n async getAccountBalances(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetAccountBalances,\n params: { id, assets },\n }),\n GetAccountBalancesResponseStruct,\n );\n }\n\n async createAccount(\n options: Record<string, Json> = {},\n ): Promise<KeyringAccount> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.CreateAccount,\n params: { options },\n }),\n CreateAccountResponseStruct,\n );\n }\n\n async filterAccountChains(id: string, chains: string[]): Promise<string[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.FilterAccountChains,\n params: { id, chains },\n }),\n FilterAccountChainsResponseStruct,\n );\n }\n\n async updateAccount(account: KeyringAccount): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.UpdateAccount,\n params: { account },\n }),\n UpdateAccountResponseStruct,\n );\n }\n\n async deleteAccount(id: string): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.DeleteAccount,\n params: { id },\n }),\n DeleteAccountResponseStruct,\n );\n }\n\n async exportAccount(id: string): Promise<KeyringAccountData> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ExportAccount,\n params: { id },\n }),\n ExportAccountResponseStruct,\n );\n }\n\n async listRequests(): Promise<KeyringRequest[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListRequests,\n }),\n ListRequestsResponseStruct,\n );\n }\n\n async getRequest(id: string): Promise<KeyringRequest> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetRequest,\n params: { id },\n }),\n GetRequestResponseStruct,\n );\n }\n\n async submitRequest(request: KeyringRequest): Promise<KeyringResponse> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.SubmitRequest,\n params: request,\n }),\n SubmitRequestResponseStruct,\n );\n }\n\n async approveRequest(\n id: string,\n data: Record<string, Json> = {},\n ): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.ApproveRequest,\n params: { id, data },\n }),\n ApproveRequestResponseStruct,\n );\n }\n\n async rejectRequest(id: string): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.RejectRequest,\n params: { id },\n }),\n RejectRequestResponseStruct,\n );\n }\n}\n"]}
@@ -1,29 +0,0 @@
1
- import type { Json } from "@metamask/utils";
2
- import type { Keyring, KeyringAccount, KeyringRequest, KeyringAccountData, KeyringResponse, CaipAssetType, Balance } from "./api/index.cjs";
3
- import type { JsonRpcRequest } from "./JsonRpcRequest.cjs";
4
- export type Sender = {
5
- send(request: JsonRpcRequest): Promise<Json>;
6
- };
7
- export declare class KeyringClient implements Keyring {
8
- #private;
9
- /**
10
- * Create a new instance of `KeyringClient`.
11
- *
12
- * @param sender - The `Sender` instance to use to send requests to the snap.
13
- */
14
- constructor(sender: Sender);
15
- listAccounts(): Promise<KeyringAccount[]>;
16
- getAccount(id: string): Promise<KeyringAccount>;
17
- getAccountBalances(id: string, assets: CaipAssetType[]): Promise<Record<CaipAssetType, Balance>>;
18
- createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
19
- filterAccountChains(id: string, chains: string[]): Promise<string[]>;
20
- updateAccount(account: KeyringAccount): Promise<void>;
21
- deleteAccount(id: string): Promise<void>;
22
- exportAccount(id: string): Promise<KeyringAccountData>;
23
- listRequests(): Promise<KeyringRequest[]>;
24
- getRequest(id: string): Promise<KeyringRequest>;
25
- submitRequest(request: KeyringRequest): Promise<KeyringResponse>;
26
- approveRequest(id: string, data?: Record<string, Json>): Promise<void>;
27
- rejectRequest(id: string): Promise<void>;
28
- }
29
- //# sourceMappingURL=KeyringClient.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeyringClient.d.cts","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAG5C,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,OAAO,EACR,wBAAc;AAiBf,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AAGvD,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C,CAAC;AAEF,qBAAa,aAAc,YAAW,OAAO;;IAG3C;;;;OAIG;gBACS,MAAM,EAAE,MAAM;IAkBpB,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IASzC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAU/C,kBAAkB,CACtB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,aAAa,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAUpC,aAAa,CACjB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAM,GACjC,OAAO,CAAC,cAAc,CAAC;IAUpB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAUpE,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrD,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAUtD,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IASzC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAU/C,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAUhE,cAAc,CAClB,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAM,GAC9B,OAAO,CAAC,IAAI,CAAC;IAUV,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAS/C"}
@@ -1,29 +0,0 @@
1
- import type { Json } from "@metamask/utils";
2
- import type { Keyring, KeyringAccount, KeyringRequest, KeyringAccountData, KeyringResponse, CaipAssetType, Balance } from "./api/index.mjs";
3
- import type { JsonRpcRequest } from "./JsonRpcRequest.mjs";
4
- export type Sender = {
5
- send(request: JsonRpcRequest): Promise<Json>;
6
- };
7
- export declare class KeyringClient implements Keyring {
8
- #private;
9
- /**
10
- * Create a new instance of `KeyringClient`.
11
- *
12
- * @param sender - The `Sender` instance to use to send requests to the snap.
13
- */
14
- constructor(sender: Sender);
15
- listAccounts(): Promise<KeyringAccount[]>;
16
- getAccount(id: string): Promise<KeyringAccount>;
17
- getAccountBalances(id: string, assets: CaipAssetType[]): Promise<Record<CaipAssetType, Balance>>;
18
- createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
19
- filterAccountChains(id: string, chains: string[]): Promise<string[]>;
20
- updateAccount(account: KeyringAccount): Promise<void>;
21
- deleteAccount(id: string): Promise<void>;
22
- exportAccount(id: string): Promise<KeyringAccountData>;
23
- listRequests(): Promise<KeyringRequest[]>;
24
- getRequest(id: string): Promise<KeyringRequest>;
25
- submitRequest(request: KeyringRequest): Promise<KeyringResponse>;
26
- approveRequest(id: string, data?: Record<string, Json>): Promise<void>;
27
- rejectRequest(id: string): Promise<void>;
28
- }
29
- //# sourceMappingURL=KeyringClient.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeyringClient.d.mts","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAG5C,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,OAAO,EACR,wBAAc;AAiBf,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AAGvD,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C,CAAC;AAEF,qBAAa,aAAc,YAAW,OAAO;;IAG3C;;;;OAIG;gBACS,MAAM,EAAE,MAAM;IAkBpB,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IASzC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAU/C,kBAAkB,CACtB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,aAAa,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAUpC,aAAa,CACjB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAM,GACjC,OAAO,CAAC,cAAc,CAAC;IAUpB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAUpE,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrD,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAUtD,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IASzC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAU/C,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAUhE,cAAc,CAClB,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAM,GAC9B,OAAO,CAAC,IAAI,CAAC;IAUV,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAS/C"}