@metamask/keyring-api 11.1.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/dist/api/account.cjs +7 -4
  3. package/dist/api/account.cjs.map +1 -1
  4. package/dist/api/account.d.cts +6 -1
  5. package/dist/api/account.d.cts.map +1 -1
  6. package/dist/api/account.d.mts +6 -1
  7. package/dist/api/account.d.mts.map +1 -1
  8. package/dist/api/account.mjs +7 -4
  9. package/dist/api/account.mjs.map +1 -1
  10. package/dist/api/asset.cjs +5 -6
  11. package/dist/api/asset.cjs.map +1 -1
  12. package/dist/api/asset.d.cts +2 -2
  13. package/dist/api/asset.d.cts.map +1 -1
  14. package/dist/api/asset.d.mts +2 -2
  15. package/dist/api/asset.d.mts.map +1 -1
  16. package/dist/api/asset.mjs +1 -2
  17. package/dist/api/asset.mjs.map +1 -1
  18. package/dist/api/balance.cjs +3 -4
  19. package/dist/api/balance.cjs.map +1 -1
  20. package/dist/api/balance.d.cts.map +1 -1
  21. package/dist/api/balance.d.mts.map +1 -1
  22. package/dist/api/balance.mjs +1 -2
  23. package/dist/api/balance.mjs.map +1 -1
  24. package/dist/api/caip.cjs +3 -3
  25. package/dist/api/caip.cjs.map +1 -1
  26. package/dist/api/caip.d.cts.map +1 -1
  27. package/dist/api/caip.d.mts.map +1 -1
  28. package/dist/api/caip.mjs +1 -1
  29. package/dist/api/caip.mjs.map +1 -1
  30. package/dist/api/index.cjs +1 -0
  31. package/dist/api/index.cjs.map +1 -1
  32. package/dist/api/index.d.cts +1 -0
  33. package/dist/api/index.d.cts.map +1 -1
  34. package/dist/api/index.d.mts +1 -0
  35. package/dist/api/index.d.mts.map +1 -1
  36. package/dist/api/index.mjs +1 -0
  37. package/dist/api/index.mjs.map +1 -1
  38. package/dist/api/keyring.cjs +2 -0
  39. package/dist/api/keyring.cjs.map +1 -1
  40. package/dist/api/keyring.d.cts +1 -1
  41. package/dist/api/keyring.d.cts.map +1 -1
  42. package/dist/api/keyring.d.mts +1 -1
  43. package/dist/api/keyring.d.mts.map +1 -1
  44. package/dist/api/keyring.mjs +2 -0
  45. package/dist/api/keyring.mjs.map +1 -1
  46. package/dist/{utils → api}/pagination.cjs +3 -3
  47. package/dist/api/pagination.cjs.map +1 -0
  48. package/dist/{utils → api}/pagination.d.cts +1 -1
  49. package/dist/api/pagination.d.cts.map +1 -0
  50. package/dist/{utils → api}/pagination.d.mts +1 -1
  51. package/dist/api/pagination.d.mts.map +1 -0
  52. package/dist/{utils → api}/pagination.mjs +1 -1
  53. package/dist/api/pagination.mjs.map +1 -0
  54. package/dist/api/request.cjs +6 -7
  55. package/dist/api/request.cjs.map +1 -1
  56. package/dist/api/request.d.cts +5 -5
  57. package/dist/api/request.d.cts.map +1 -1
  58. package/dist/api/request.d.mts +5 -5
  59. package/dist/api/request.d.mts.map +1 -1
  60. package/dist/api/request.mjs +1 -2
  61. package/dist/api/request.mjs.map +1 -1
  62. package/dist/api/response.cjs +6 -6
  63. package/dist/api/response.cjs.map +1 -1
  64. package/dist/api/response.d.cts +1 -1
  65. package/dist/api/response.d.cts.map +1 -1
  66. package/dist/api/response.d.mts +1 -1
  67. package/dist/api/response.d.mts.map +1 -1
  68. package/dist/api/response.mjs +1 -1
  69. package/dist/api/response.mjs.map +1 -1
  70. package/dist/api/transaction.cjs +7 -8
  71. package/dist/api/transaction.cjs.map +1 -1
  72. package/dist/api/transaction.d.cts +65 -65
  73. package/dist/api/transaction.d.cts.map +1 -1
  74. package/dist/api/transaction.d.mts +65 -65
  75. package/dist/api/transaction.d.mts.map +1 -1
  76. package/dist/api/transaction.mjs +1 -2
  77. package/dist/api/transaction.mjs.map +1 -1
  78. package/dist/btc/constants.cjs +17 -0
  79. package/dist/btc/constants.cjs.map +1 -0
  80. package/dist/btc/constants.d.cts +12 -0
  81. package/dist/btc/constants.d.cts.map +1 -0
  82. package/dist/btc/constants.d.mts +12 -0
  83. package/dist/btc/constants.d.mts.map +1 -0
  84. package/dist/btc/constants.mjs +14 -0
  85. package/dist/btc/constants.mjs.map +1 -0
  86. package/dist/btc/index.cjs +1 -0
  87. package/dist/btc/index.cjs.map +1 -1
  88. package/dist/btc/index.d.cts +1 -0
  89. package/dist/btc/index.d.cts.map +1 -1
  90. package/dist/btc/index.d.mts +1 -0
  91. package/dist/btc/index.d.mts.map +1 -1
  92. package/dist/btc/index.mjs +1 -0
  93. package/dist/btc/index.mjs.map +1 -1
  94. package/dist/btc/types.cjs +2 -2
  95. package/dist/btc/types.cjs.map +1 -1
  96. package/dist/btc/types.d.cts +3 -1
  97. package/dist/btc/types.d.cts.map +1 -1
  98. package/dist/btc/types.d.mts +3 -1
  99. package/dist/btc/types.d.mts.map +1 -1
  100. package/dist/btc/types.mjs +2 -2
  101. package/dist/btc/types.mjs.map +1 -1
  102. package/dist/eth/constants.cjs +13 -0
  103. package/dist/eth/constants.cjs.map +1 -0
  104. package/dist/eth/constants.d.cts +8 -0
  105. package/dist/eth/constants.d.cts.map +1 -0
  106. package/dist/eth/constants.d.mts +8 -0
  107. package/dist/eth/constants.d.mts.map +1 -0
  108. package/dist/eth/constants.mjs +10 -0
  109. package/dist/eth/constants.mjs.map +1 -0
  110. package/dist/eth/erc4337/types.cjs +10 -11
  111. package/dist/eth/erc4337/types.cjs.map +1 -1
  112. package/dist/eth/erc4337/types.d.cts +5 -5
  113. package/dist/eth/erc4337/types.d.cts.map +1 -1
  114. package/dist/eth/erc4337/types.d.mts +5 -5
  115. package/dist/eth/erc4337/types.d.mts.map +1 -1
  116. package/dist/eth/erc4337/types.mjs +1 -2
  117. package/dist/eth/erc4337/types.mjs.map +1 -1
  118. package/dist/eth/index.cjs +1 -0
  119. package/dist/eth/index.cjs.map +1 -1
  120. package/dist/eth/index.d.cts +1 -0
  121. package/dist/eth/index.d.cts.map +1 -1
  122. package/dist/eth/index.d.mts +1 -0
  123. package/dist/eth/index.d.mts.map +1 -1
  124. package/dist/eth/index.mjs +1 -0
  125. package/dist/eth/index.mjs.map +1 -1
  126. package/dist/eth/types.cjs +11 -6
  127. package/dist/eth/types.cjs.map +1 -1
  128. package/dist/eth/types.d.cts +10 -2
  129. package/dist/eth/types.d.cts.map +1 -1
  130. package/dist/eth/types.d.mts +10 -2
  131. package/dist/eth/types.d.mts.map +1 -1
  132. package/dist/eth/types.mjs +7 -2
  133. package/dist/eth/types.mjs.map +1 -1
  134. package/dist/eth/utils.cjs.map +1 -1
  135. package/dist/eth/utils.d.cts.map +1 -1
  136. package/dist/eth/utils.d.mts.map +1 -1
  137. package/dist/eth/utils.mjs.map +1 -1
  138. package/dist/events.cjs +67 -1
  139. package/dist/events.cjs.map +1 -1
  140. package/dist/events.d.cts +169 -0
  141. package/dist/events.d.cts.map +1 -1
  142. package/dist/events.d.mts +169 -0
  143. package/dist/events.d.mts.map +1 -1
  144. package/dist/events.mjs +66 -0
  145. package/dist/events.mjs.map +1 -1
  146. package/dist/index.cjs +2 -8
  147. package/dist/index.cjs.map +1 -1
  148. package/dist/index.d.cts +3 -9
  149. package/dist/index.d.cts.map +1 -1
  150. package/dist/index.d.mts +3 -9
  151. package/dist/index.d.mts.map +1 -1
  152. package/dist/index.mjs +2 -8
  153. package/dist/index.mjs.map +1 -1
  154. package/dist/{internal/api.cjs → rpc.cjs} +71 -42
  155. package/dist/rpc.cjs.map +1 -0
  156. package/dist/{internal/api.d.cts → rpc.d.cts} +141 -104
  157. package/dist/rpc.d.cts.map +1 -0
  158. package/dist/{internal/api.d.mts → rpc.d.mts} +141 -104
  159. package/dist/rpc.d.mts.map +1 -0
  160. package/dist/{internal/api.mjs → rpc.mjs} +33 -5
  161. package/dist/rpc.mjs.map +1 -0
  162. package/dist/sol/constants.cjs +15 -0
  163. package/dist/sol/constants.cjs.map +1 -0
  164. package/dist/sol/constants.d.cts +10 -0
  165. package/dist/sol/constants.d.cts.map +1 -0
  166. package/dist/sol/constants.d.mts +10 -0
  167. package/dist/sol/constants.d.mts.map +1 -0
  168. package/dist/sol/constants.mjs +12 -0
  169. package/dist/sol/constants.mjs.map +1 -0
  170. package/dist/sol/index.cjs +1 -0
  171. package/dist/sol/index.cjs.map +1 -1
  172. package/dist/sol/index.d.cts +1 -0
  173. package/dist/sol/index.d.cts.map +1 -1
  174. package/dist/sol/index.d.mts +1 -0
  175. package/dist/sol/index.d.mts.map +1 -1
  176. package/dist/sol/index.mjs +1 -0
  177. package/dist/sol/index.mjs.map +1 -1
  178. package/dist/sol/types.cjs +3 -3
  179. package/dist/sol/types.cjs.map +1 -1
  180. package/dist/sol/types.d.cts +3 -1
  181. package/dist/sol/types.d.cts.map +1 -1
  182. package/dist/sol/types.d.mts +3 -1
  183. package/dist/sol/types.d.mts.map +1 -1
  184. package/dist/sol/types.mjs +1 -1
  185. package/dist/sol/types.mjs.map +1 -1
  186. package/package.json +11 -14
  187. package/dist/JsonRpcRequest.cjs +0 -13
  188. package/dist/JsonRpcRequest.cjs.map +0 -1
  189. package/dist/JsonRpcRequest.d.cts +0 -17
  190. package/dist/JsonRpcRequest.d.cts.map +0 -1
  191. package/dist/JsonRpcRequest.d.mts +0 -17
  192. package/dist/JsonRpcRequest.d.mts.map +0 -1
  193. package/dist/JsonRpcRequest.mjs +0 -10
  194. package/dist/JsonRpcRequest.mjs.map +0 -1
  195. package/dist/KeyringClient.cjs +0 -130
  196. package/dist/KeyringClient.cjs.map +0 -1
  197. package/dist/KeyringClient.d.cts +0 -31
  198. package/dist/KeyringClient.d.cts.map +0 -1
  199. package/dist/KeyringClient.d.mts +0 -31
  200. package/dist/KeyringClient.d.mts.map +0 -1
  201. package/dist/KeyringClient.mjs +0 -126
  202. package/dist/KeyringClient.mjs.map +0 -1
  203. package/dist/KeyringSnapRpcClient.cjs +0 -68
  204. package/dist/KeyringSnapRpcClient.cjs.map +0 -1
  205. package/dist/KeyringSnapRpcClient.d.cts +0 -40
  206. package/dist/KeyringSnapRpcClient.d.cts.map +0 -1
  207. package/dist/KeyringSnapRpcClient.d.mts +0 -40
  208. package/dist/KeyringSnapRpcClient.d.mts.map +0 -1
  209. package/dist/KeyringSnapRpcClient.mjs +0 -63
  210. package/dist/KeyringSnapRpcClient.mjs.map +0 -1
  211. package/dist/internal/api.cjs.map +0 -1
  212. package/dist/internal/api.d.cts.map +0 -1
  213. package/dist/internal/api.d.mts.map +0 -1
  214. package/dist/internal/api.mjs.map +0 -1
  215. package/dist/internal/eth/EthKeyring.cjs +0 -3
  216. package/dist/internal/eth/EthKeyring.cjs.map +0 -1
  217. package/dist/internal/eth/EthKeyring.d.cts +0 -34
  218. package/dist/internal/eth/EthKeyring.d.cts.map +0 -1
  219. package/dist/internal/eth/EthKeyring.d.mts +0 -34
  220. package/dist/internal/eth/EthKeyring.d.mts.map +0 -1
  221. package/dist/internal/eth/EthKeyring.mjs +0 -2
  222. package/dist/internal/eth/EthKeyring.mjs.map +0 -1
  223. package/dist/internal/eth/index.cjs +0 -3
  224. package/dist/internal/eth/index.cjs.map +0 -1
  225. package/dist/internal/eth/index.d.cts +0 -2
  226. package/dist/internal/eth/index.d.cts.map +0 -1
  227. package/dist/internal/eth/index.d.mts +0 -2
  228. package/dist/internal/eth/index.d.mts.map +0 -1
  229. package/dist/internal/eth/index.mjs +0 -2
  230. package/dist/internal/eth/index.mjs.map +0 -1
  231. package/dist/internal/events.cjs +0 -72
  232. package/dist/internal/events.cjs.map +0 -1
  233. package/dist/internal/events.d.cts +0 -162
  234. package/dist/internal/events.d.cts.map +0 -1
  235. package/dist/internal/events.d.mts +0 -162
  236. package/dist/internal/events.d.mts.map +0 -1
  237. package/dist/internal/events.mjs +0 -69
  238. package/dist/internal/events.mjs.map +0 -1
  239. package/dist/internal/index.cjs +0 -21
  240. package/dist/internal/index.cjs.map +0 -1
  241. package/dist/internal/index.d.cts +0 -6
  242. package/dist/internal/index.d.cts.map +0 -1
  243. package/dist/internal/index.d.mts +0 -6
  244. package/dist/internal/index.d.mts.map +0 -1
  245. package/dist/internal/index.mjs +0 -5
  246. package/dist/internal/index.mjs.map +0 -1
  247. package/dist/internal/rpc.cjs +0 -34
  248. package/dist/internal/rpc.cjs.map +0 -1
  249. package/dist/internal/rpc.d.cts +0 -27
  250. package/dist/internal/rpc.d.cts.map +0 -1
  251. package/dist/internal/rpc.d.mts +0 -27
  252. package/dist/internal/rpc.d.mts.map +0 -1
  253. package/dist/internal/rpc.mjs +0 -30
  254. package/dist/internal/rpc.mjs.map +0 -1
  255. package/dist/internal/types.cjs +0 -52
  256. package/dist/internal/types.cjs.map +0 -1
  257. package/dist/internal/types.d.cts +0 -392
  258. package/dist/internal/types.d.cts.map +0 -1
  259. package/dist/internal/types.d.mts +0 -392
  260. package/dist/internal/types.d.mts.map +0 -1
  261. package/dist/internal/types.mjs +0 -49
  262. package/dist/internal/types.mjs.map +0 -1
  263. package/dist/rpc-handler.cjs +0 -143
  264. package/dist/rpc-handler.cjs.map +0 -1
  265. package/dist/rpc-handler.d.cts +0 -30
  266. package/dist/rpc-handler.d.cts.map +0 -1
  267. package/dist/rpc-handler.d.mts +0 -30
  268. package/dist/rpc-handler.d.mts.map +0 -1
  269. package/dist/rpc-handler.mjs +0 -138
  270. package/dist/rpc-handler.mjs.map +0 -1
  271. package/dist/snap-utils.cjs +0 -20
  272. package/dist/snap-utils.cjs.map +0 -1
  273. package/dist/snap-utils.d.cts +0 -12
  274. package/dist/snap-utils.d.cts.map +0 -1
  275. package/dist/snap-utils.d.mts +0 -12
  276. package/dist/snap-utils.d.mts.map +0 -1
  277. package/dist/snap-utils.mjs +0 -17
  278. package/dist/snap-utils.mjs.map +0 -1
  279. package/dist/superstruct.cjs +0 -109
  280. package/dist/superstruct.cjs.map +0 -1
  281. package/dist/superstruct.d.cts +0 -102
  282. package/dist/superstruct.d.cts.map +0 -1
  283. package/dist/superstruct.d.mts +0 -102
  284. package/dist/superstruct.d.mts.map +0 -1
  285. package/dist/superstruct.mjs +0 -102
  286. package/dist/superstruct.mjs.map +0 -1
  287. package/dist/utils/index.cjs +0 -20
  288. package/dist/utils/index.cjs.map +0 -1
  289. package/dist/utils/index.d.cts +0 -4
  290. package/dist/utils/index.d.cts.map +0 -1
  291. package/dist/utils/index.d.mts +0 -4
  292. package/dist/utils/index.d.mts.map +0 -1
  293. package/dist/utils/index.mjs +0 -4
  294. package/dist/utils/index.mjs.map +0 -1
  295. package/dist/utils/pagination.cjs.map +0 -1
  296. package/dist/utils/pagination.d.cts.map +0 -1
  297. package/dist/utils/pagination.d.mts.map +0 -1
  298. package/dist/utils/pagination.mjs.map +0 -1
  299. package/dist/utils/types.cjs +0 -29
  300. package/dist/utils/types.cjs.map +0 -1
  301. package/dist/utils/types.d.cts +0 -42
  302. package/dist/utils/types.d.cts.map +0 -1
  303. package/dist/utils/types.d.mts +0 -42
  304. package/dist/utils/types.d.mts.map +0 -1
  305. package/dist/utils/types.mjs +0 -26
  306. package/dist/utils/types.mjs.map +0 -1
  307. package/dist/utils/typing.cjs +0 -20
  308. package/dist/utils/typing.cjs.map +0 -1
  309. package/dist/utils/typing.d.cts +0 -33
  310. package/dist/utils/typing.d.cts.map +0 -1
  311. package/dist/utils/typing.d.mts +0 -33
  312. package/dist/utils/typing.d.mts.map +0 -1
  313. package/dist/utils/typing.mjs +0 -17
  314. package/dist/utils/typing.mjs.map +0 -1
@@ -1,6 +1,7 @@
1
- import { array, enums, literal } from "@metamask/superstruct";
1
+ import { object, definePattern } from "@metamask/keyring-utils";
2
+ import { nonempty, array, enums, literal } from "@metamask/superstruct";
3
+ import { EthScopes } from "./index.mjs";
2
4
  import { EthAccountType, KeyringAccountStruct } from "../api/index.mjs";
3
- import { object, definePattern } from "../superstruct.mjs";
4
5
  export const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);
5
6
  export const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);
6
7
  export const EthUint256Struct = definePattern('EthUint256', /^0x([1-9a-f][0-9a-f]*|0)$/iu);
@@ -31,6 +32,10 @@ export const EthEoaAccountStruct = object({
31
32
  * Account type.
32
33
  */
33
34
  type: literal(`${EthAccountType.Eoa}`),
35
+ /**
36
+ * Account scopes (must be ['eip155']).
37
+ */
38
+ scopes: nonempty(array(literal(EthScopes.Namespace))),
34
39
  /**
35
40
  * Account supported methods.
36
41
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AAE9D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,yBAAe;AAC9D,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,2BAAuB;AAEvD,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,oBAAoB,CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,0BAA0B;IAC1B,2CAA8B,CAAA;IAC9B,8BAAiB,CAAA;IACjB,oDAAuC,CAAA;IACvC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,mBAAmB;IACnB,8DAAiD,CAAA;IACjD,0DAA6C,CAAA;IAC7C,wDAA2C,CAAA;AAC7C,CAAC,EAZW,SAAS,KAAT,SAAS,QAYpB;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;IACxC,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,CAAC;IAEtC;;OAEG;IACH,OAAO,EAAE,KAAK,CACZ,KAAK,CAAC;QACJ,GAAG,SAAS,CAAC,YAAY,EAAE;QAC3B,GAAG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;KAC/B,CAAC,CACH;CACF,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;IAC5C,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,KAAK,CACZ,KAAK,CAAC;QACJ,GAAG,SAAS,CAAC,YAAY,EAAE;QAC3B,GAAG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,oBAAoB,EAAE;QACnC,GAAG,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { EthAccountType, KeyringAccountStruct } from '../api';\nimport { object, definePattern } from '../superstruct';\n\nexport const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);\n\nexport const EthAddressStruct = definePattern(\n 'EthAddress',\n /^0x[0-9a-f]{40}$/iu,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gCAAgC;AAEhE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AAExE,OAAO,EAAE,SAAS,EAAE,oBAAU;AAC9B,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,yBAAe;AAE9D,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,oBAAoB,CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,0BAA0B;IAC1B,2CAA8B,CAAA;IAC9B,8BAAiB,CAAA;IACjB,oDAAuC,CAAA;IACvC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,mBAAmB;IACnB,8DAAiD,CAAA;IACjD,0DAA6C,CAAA;IAC7C,wDAA2C,CAAA;AAC7C,CAAC,EAZW,SAAS,KAAT,SAAS,QAYpB;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;IACxC,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,CAAC;IAEtC;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IAErD;;OAEG;IACH,OAAO,EAAE,KAAK,CACZ,KAAK,CAAC;QACJ,GAAG,SAAS,CAAC,YAAY,EAAE;QAC3B,GAAG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;KAC/B,CAAC,CACH;CACF,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;IAC5C,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,KAAK,CACZ,KAAK,CAAC;QACJ,GAAG,SAAS,CAAC,YAAY,EAAE;QAC3B,GAAG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,oBAAoB,EAAE;QACnC,GAAG,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, literal } from '@metamask/superstruct';\n\nimport { EthScopes } from '.';\nimport { EthAccountType, KeyringAccountStruct } from '../api';\n\nexport const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);\n\nexport const EthAddressStruct = definePattern(\n 'EthAddress',\n /^0x[0-9a-f]{40}$/iu,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account scopes (must be ['eip155']).\n */\n scopes: nonempty(array(literal(EthScopes.Namespace))),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":";;AASA,4CAEC;AAVD,0CAAwC;AAExC;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,IAAwB;IACvD,OAAO,IAAI,KAAK,oBAAc,CAAC,GAAG,IAAI,IAAI,KAAK,oBAAc,CAAC,OAAO,CAAC;AACxE,CAAC","sourcesContent":["import type { KeyringAccountType } from '../api';\nimport { EthAccountType } from '../api';\n\n/**\n * Checks if the given type is an EVM account type.\n *\n * @param type - The type to check.\n * @returns Returns true if the type is an EVM account type, false otherwise.\n */\nexport function isEvmAccountType(type: KeyringAccountType): boolean {\n return type === EthAccountType.Eoa || type === EthAccountType.Erc4337;\n}\n"]}
1
+ {"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":";;AASA,4CAEC;AAXD,0CAAwC;AAGxC;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,IAAwB;IACvD,OAAO,IAAI,KAAK,oBAAc,CAAC,GAAG,IAAI,IAAI,KAAK,oBAAc,CAAC,OAAO,CAAC;AACxE,CAAC","sourcesContent":["import { EthAccountType } from '../api';\nimport type { KeyringAccountType } from '../api';\n\n/**\n * Checks if the given type is an EVM account type.\n *\n * @param type - The type to check.\n * @returns Returns true if the type is an EVM account type, false otherwise.\n */\nexport function isEvmAccountType(type: KeyringAccountType): boolean {\n return type === EthAccountType.Eoa || type === EthAccountType.Erc4337;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAe;AAGjD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAElE"}
1
+ {"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAe;AAEjD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAElE"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAe;AAGjD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAElE"}
1
+ {"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAe;AAEjD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAElE"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,yBAAe;AAExC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAwB;IACvD,OAAO,IAAI,KAAK,cAAc,CAAC,GAAG,IAAI,IAAI,KAAK,cAAc,CAAC,OAAO,CAAC;AACxE,CAAC","sourcesContent":["import type { KeyringAccountType } from '../api';\nimport { EthAccountType } from '../api';\n\n/**\n * Checks if the given type is an EVM account type.\n *\n * @param type - The type to check.\n * @returns Returns true if the type is an EVM account type, false otherwise.\n */\nexport function isEvmAccountType(type: KeyringAccountType): boolean {\n return type === EthAccountType.Eoa || type === EthAccountType.Erc4337;\n}\n"]}
1
+ {"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,yBAAe;AAGxC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAwB;IACvD,OAAO,IAAI,KAAK,cAAc,CAAC,GAAG,IAAI,IAAI,KAAK,cAAc,CAAC,OAAO,CAAC;AACxE,CAAC","sourcesContent":["import { EthAccountType } from '../api';\nimport type { KeyringAccountType } from '../api';\n\n/**\n * Checks if the given type is an EVM account type.\n *\n * @param type - The type to check.\n * @returns Returns true if the type is an EVM account type, false otherwise.\n */\nexport function isEvmAccountType(type: KeyringAccountType): boolean {\n return type === EthAccountType.Eoa || type === EthAccountType.Erc4337;\n}\n"]}
package/dist/events.cjs CHANGED
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeyringEvent = void 0;
3
+ exports.RequestRejectedEventStruct = exports.RequestApprovedEventStruct = exports.AccountDeletedEventStruct = exports.AccountUpdatedEventStruct = exports.AccountCreatedEventStruct = exports.KeyringEvent = void 0;
4
+ const keyring_utils_1 = require("@metamask/keyring-utils");
5
+ const superstruct_1 = require("@metamask/superstruct");
6
+ const utils_1 = require("@metamask/utils");
7
+ const api_1 = require("./api/index.cjs");
4
8
  /**
5
9
  * Supported keyring events.
6
10
  */
@@ -14,4 +18,66 @@ var KeyringEvent;
14
18
  KeyringEvent["RequestApproved"] = "notify:requestApproved";
15
19
  KeyringEvent["RequestRejected"] = "notify:requestRejected";
16
20
  })(KeyringEvent || (exports.KeyringEvent = KeyringEvent = {}));
21
+ exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
22
+ method: (0, superstruct_1.literal)(`${KeyringEvent.AccountCreated}`),
23
+ params: (0, keyring_utils_1.object)({
24
+ /**
25
+ * New account object.
26
+ */
27
+ account: api_1.KeyringAccountStruct,
28
+ /**
29
+ * Account name suggestion provided to the MetaMask client.
30
+ *
31
+ * The keyring can suggest a name for the account, but it's up to the
32
+ * client to decide whether to use it. The keyring won't be informed if the
33
+ * client decides to use a different name.
34
+ */
35
+ accountNameSuggestion: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
36
+ /**
37
+ * Instructs MetaMask to display the add account confirmation dialog in the UI.
38
+ * **Note:** This is not guaranteed to be honored by the MetaMask client.
39
+ */
40
+ displayConfirmation: (0, keyring_utils_1.exactOptional)((0, superstruct_1.boolean)()),
41
+ }),
42
+ });
43
+ exports.AccountUpdatedEventStruct = (0, keyring_utils_1.object)({
44
+ method: (0, superstruct_1.literal)(`${KeyringEvent.AccountUpdated}`),
45
+ params: (0, keyring_utils_1.object)({
46
+ /**
47
+ * Updated account object.
48
+ */
49
+ account: api_1.KeyringAccountStruct,
50
+ }),
51
+ });
52
+ exports.AccountDeletedEventStruct = (0, keyring_utils_1.object)({
53
+ method: (0, superstruct_1.literal)(`${KeyringEvent.AccountDeleted}`),
54
+ params: (0, keyring_utils_1.object)({
55
+ /**
56
+ * Deleted account ID.
57
+ */
58
+ id: keyring_utils_1.UuidStruct,
59
+ }),
60
+ });
61
+ exports.RequestApprovedEventStruct = (0, keyring_utils_1.object)({
62
+ method: (0, superstruct_1.literal)(`${KeyringEvent.RequestApproved}`),
63
+ params: (0, keyring_utils_1.object)({
64
+ /**
65
+ * Request ID.
66
+ */
67
+ id: keyring_utils_1.UuidStruct,
68
+ /**
69
+ * Request result.
70
+ */
71
+ result: utils_1.JsonStruct,
72
+ }),
73
+ });
74
+ exports.RequestRejectedEventStruct = (0, keyring_utils_1.object)({
75
+ method: (0, superstruct_1.literal)(`${KeyringEvent.RequestRejected}`),
76
+ params: (0, keyring_utils_1.object)({
77
+ /**
78
+ * Request ID.
79
+ */
80
+ id: keyring_utils_1.UuidStruct,
81
+ }),
82
+ });
17
83
  //# sourceMappingURL=events.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,YASX;AATD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;AAC5C,CAAC,EATW,YAAY,4BAAZ,YAAY,QASvB","sourcesContent":["/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n}\n"]}
1
+ {"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA,2DAA4E;AAC5E,uDAAiE;AACjE,2CAA6C;AAE7C,yCAA6C;AAE7C;;GAEG;AACH,IAAY,YASX;AATD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;AAC5C,CAAC,EATW,YAAY,4BAAZ,YAAY,QASvB;AAEY,QAAA,yBAAyB,GAAG,IAAA,sBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,0BAAoB;QAE7B;;;;;;WAMG;QACH,qBAAqB,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAE9C;;;WAGG;QACH,mBAAmB,EAAE,IAAA,6BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;KAC9C,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,sBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,0BAAoB;KAC9B,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,sBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,0BAAU;QAEd;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport { boolean, literal, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from './api';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n}\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n }),\n});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n"]}
package/dist/events.d.cts CHANGED
@@ -8,4 +8,173 @@ export declare enum KeyringEvent {
8
8
  RequestApproved = "notify:requestApproved",
9
9
  RequestRejected = "notify:requestRejected"
10
10
  }
11
+ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").Struct<{
12
+ method: "notify:accountCreated";
13
+ params: {
14
+ account: {
15
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
16
+ id: string;
17
+ options: Record<string, import("@metamask/utils").Json>;
18
+ address: string;
19
+ scopes: string[];
20
+ methods: string[];
21
+ };
22
+ accountNameSuggestion?: string;
23
+ displayConfirmation?: boolean;
24
+ };
25
+ }, {
26
+ method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
27
+ params: import("@metamask/superstruct").Struct<{
28
+ account: {
29
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
30
+ id: string;
31
+ options: Record<string, import("@metamask/utils").Json>;
32
+ address: string;
33
+ scopes: string[];
34
+ methods: string[];
35
+ };
36
+ accountNameSuggestion?: string;
37
+ displayConfirmation?: boolean;
38
+ }, {
39
+ /**
40
+ * New account object.
41
+ */
42
+ account: import("@metamask/superstruct").Struct<{
43
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
44
+ id: string;
45
+ options: Record<string, import("@metamask/utils").Json>;
46
+ address: string;
47
+ scopes: string[];
48
+ methods: string[];
49
+ }, {
50
+ id: import("@metamask/superstruct").Struct<string, null>;
51
+ type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
52
+ "eip155:eoa": "eip155:eoa";
53
+ "eip155:erc4337": "eip155:erc4337";
54
+ "bip122:p2wpkh": "bip122:p2wpkh";
55
+ "solana:data-account": "solana:data-account";
56
+ }>;
57
+ address: import("@metamask/superstruct").Struct<string, null>;
58
+ scopes: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
59
+ options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
60
+ methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
61
+ }>;
62
+ /**
63
+ * Account name suggestion provided to the MetaMask client.
64
+ *
65
+ * The keyring can suggest a name for the account, but it's up to the
66
+ * client to decide whether to use it. The keyring won't be informed if the
67
+ * client decides to use a different name.
68
+ */
69
+ accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
70
+ /**
71
+ * Instructs MetaMask to display the add account confirmation dialog in the UI.
72
+ * **Note:** This is not guaranteed to be honored by the MetaMask client.
73
+ */
74
+ displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
75
+ }>;
76
+ }>;
77
+ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
78
+ method: "notify:accountUpdated";
79
+ params: {
80
+ account: {
81
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
82
+ id: string;
83
+ options: Record<string, import("@metamask/utils").Json>;
84
+ address: string;
85
+ scopes: string[];
86
+ methods: string[];
87
+ };
88
+ };
89
+ }, {
90
+ method: import("@metamask/superstruct").Struct<"notify:accountUpdated", "notify:accountUpdated">;
91
+ params: import("@metamask/superstruct").Struct<{
92
+ account: {
93
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
94
+ id: string;
95
+ options: Record<string, import("@metamask/utils").Json>;
96
+ address: string;
97
+ scopes: string[];
98
+ methods: string[];
99
+ };
100
+ }, {
101
+ /**
102
+ * Updated account object.
103
+ */
104
+ account: import("@metamask/superstruct").Struct<{
105
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
106
+ id: string;
107
+ options: Record<string, import("@metamask/utils").Json>;
108
+ address: string;
109
+ scopes: string[];
110
+ methods: string[];
111
+ }, {
112
+ id: import("@metamask/superstruct").Struct<string, null>;
113
+ type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
114
+ "eip155:eoa": "eip155:eoa";
115
+ "eip155:erc4337": "eip155:erc4337";
116
+ "bip122:p2wpkh": "bip122:p2wpkh";
117
+ "solana:data-account": "solana:data-account";
118
+ }>;
119
+ address: import("@metamask/superstruct").Struct<string, null>;
120
+ scopes: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
121
+ options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
122
+ methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
123
+ }>;
124
+ }>;
125
+ }>;
126
+ export declare const AccountDeletedEventStruct: import("@metamask/superstruct").Struct<{
127
+ method: "notify:accountDeleted";
128
+ params: {
129
+ id: string;
130
+ };
131
+ }, {
132
+ method: import("@metamask/superstruct").Struct<"notify:accountDeleted", "notify:accountDeleted">;
133
+ params: import("@metamask/superstruct").Struct<{
134
+ id: string;
135
+ }, {
136
+ /**
137
+ * Deleted account ID.
138
+ */
139
+ id: import("@metamask/superstruct").Struct<string, null>;
140
+ }>;
141
+ }>;
142
+ export declare const RequestApprovedEventStruct: import("@metamask/superstruct").Struct<{
143
+ method: "notify:requestApproved";
144
+ params: {
145
+ result: import("@metamask/utils").Json;
146
+ id: string;
147
+ };
148
+ }, {
149
+ method: import("@metamask/superstruct").Struct<"notify:requestApproved", "notify:requestApproved">;
150
+ params: import("@metamask/superstruct").Struct<{
151
+ result: import("@metamask/utils").Json;
152
+ id: string;
153
+ }, {
154
+ /**
155
+ * Request ID.
156
+ */
157
+ id: import("@metamask/superstruct").Struct<string, null>;
158
+ /**
159
+ * Request result.
160
+ */
161
+ result: import("@metamask/superstruct").Struct<import("@metamask/utils").Json, unknown>;
162
+ }>;
163
+ }>;
164
+ export declare const RequestRejectedEventStruct: import("@metamask/superstruct").Struct<{
165
+ method: "notify:requestRejected";
166
+ params: {
167
+ id: string;
168
+ };
169
+ }, {
170
+ method: import("@metamask/superstruct").Struct<"notify:requestRejected", "notify:requestRejected">;
171
+ params: import("@metamask/superstruct").Struct<{
172
+ id: string;
173
+ }, {
174
+ /**
175
+ * Request ID.
176
+ */
177
+ id: import("@metamask/superstruct").Struct<string, null>;
178
+ }>;
179
+ }>;
11
180
  //# sourceMappingURL=events.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.cts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;CAC3C"}
1
+ {"version":3,"file":"events.d.cts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;CAC3C;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;;QAGH;;;;;;WAMG;;QAGH;;;WAGG;;;EAGL,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;;;EAGL,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;QAGlC;;WAEG;;;EAGL,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;QAGnC;;WAEG;;QAGH;;WAEG;;;EAGL,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;QAGnC;;WAEG;;;EAGL,CAAC"}
package/dist/events.d.mts CHANGED
@@ -8,4 +8,173 @@ export declare enum KeyringEvent {
8
8
  RequestApproved = "notify:requestApproved",
9
9
  RequestRejected = "notify:requestRejected"
10
10
  }
11
+ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").Struct<{
12
+ method: "notify:accountCreated";
13
+ params: {
14
+ account: {
15
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
16
+ id: string;
17
+ options: Record<string, import("@metamask/utils").Json>;
18
+ address: string;
19
+ scopes: string[];
20
+ methods: string[];
21
+ };
22
+ accountNameSuggestion?: string;
23
+ displayConfirmation?: boolean;
24
+ };
25
+ }, {
26
+ method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
27
+ params: import("@metamask/superstruct").Struct<{
28
+ account: {
29
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
30
+ id: string;
31
+ options: Record<string, import("@metamask/utils").Json>;
32
+ address: string;
33
+ scopes: string[];
34
+ methods: string[];
35
+ };
36
+ accountNameSuggestion?: string;
37
+ displayConfirmation?: boolean;
38
+ }, {
39
+ /**
40
+ * New account object.
41
+ */
42
+ account: import("@metamask/superstruct").Struct<{
43
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
44
+ id: string;
45
+ options: Record<string, import("@metamask/utils").Json>;
46
+ address: string;
47
+ scopes: string[];
48
+ methods: string[];
49
+ }, {
50
+ id: import("@metamask/superstruct").Struct<string, null>;
51
+ type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
52
+ "eip155:eoa": "eip155:eoa";
53
+ "eip155:erc4337": "eip155:erc4337";
54
+ "bip122:p2wpkh": "bip122:p2wpkh";
55
+ "solana:data-account": "solana:data-account";
56
+ }>;
57
+ address: import("@metamask/superstruct").Struct<string, null>;
58
+ scopes: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
59
+ options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
60
+ methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
61
+ }>;
62
+ /**
63
+ * Account name suggestion provided to the MetaMask client.
64
+ *
65
+ * The keyring can suggest a name for the account, but it's up to the
66
+ * client to decide whether to use it. The keyring won't be informed if the
67
+ * client decides to use a different name.
68
+ */
69
+ accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
70
+ /**
71
+ * Instructs MetaMask to display the add account confirmation dialog in the UI.
72
+ * **Note:** This is not guaranteed to be honored by the MetaMask client.
73
+ */
74
+ displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
75
+ }>;
76
+ }>;
77
+ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
78
+ method: "notify:accountUpdated";
79
+ params: {
80
+ account: {
81
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
82
+ id: string;
83
+ options: Record<string, import("@metamask/utils").Json>;
84
+ address: string;
85
+ scopes: string[];
86
+ methods: string[];
87
+ };
88
+ };
89
+ }, {
90
+ method: import("@metamask/superstruct").Struct<"notify:accountUpdated", "notify:accountUpdated">;
91
+ params: import("@metamask/superstruct").Struct<{
92
+ account: {
93
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
94
+ id: string;
95
+ options: Record<string, import("@metamask/utils").Json>;
96
+ address: string;
97
+ scopes: string[];
98
+ methods: string[];
99
+ };
100
+ }, {
101
+ /**
102
+ * Updated account object.
103
+ */
104
+ account: import("@metamask/superstruct").Struct<{
105
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
106
+ id: string;
107
+ options: Record<string, import("@metamask/utils").Json>;
108
+ address: string;
109
+ scopes: string[];
110
+ methods: string[];
111
+ }, {
112
+ id: import("@metamask/superstruct").Struct<string, null>;
113
+ type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
114
+ "eip155:eoa": "eip155:eoa";
115
+ "eip155:erc4337": "eip155:erc4337";
116
+ "bip122:p2wpkh": "bip122:p2wpkh";
117
+ "solana:data-account": "solana:data-account";
118
+ }>;
119
+ address: import("@metamask/superstruct").Struct<string, null>;
120
+ scopes: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
121
+ options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
122
+ methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
123
+ }>;
124
+ }>;
125
+ }>;
126
+ export declare const AccountDeletedEventStruct: import("@metamask/superstruct").Struct<{
127
+ method: "notify:accountDeleted";
128
+ params: {
129
+ id: string;
130
+ };
131
+ }, {
132
+ method: import("@metamask/superstruct").Struct<"notify:accountDeleted", "notify:accountDeleted">;
133
+ params: import("@metamask/superstruct").Struct<{
134
+ id: string;
135
+ }, {
136
+ /**
137
+ * Deleted account ID.
138
+ */
139
+ id: import("@metamask/superstruct").Struct<string, null>;
140
+ }>;
141
+ }>;
142
+ export declare const RequestApprovedEventStruct: import("@metamask/superstruct").Struct<{
143
+ method: "notify:requestApproved";
144
+ params: {
145
+ result: import("@metamask/utils").Json;
146
+ id: string;
147
+ };
148
+ }, {
149
+ method: import("@metamask/superstruct").Struct<"notify:requestApproved", "notify:requestApproved">;
150
+ params: import("@metamask/superstruct").Struct<{
151
+ result: import("@metamask/utils").Json;
152
+ id: string;
153
+ }, {
154
+ /**
155
+ * Request ID.
156
+ */
157
+ id: import("@metamask/superstruct").Struct<string, null>;
158
+ /**
159
+ * Request result.
160
+ */
161
+ result: import("@metamask/superstruct").Struct<import("@metamask/utils").Json, unknown>;
162
+ }>;
163
+ }>;
164
+ export declare const RequestRejectedEventStruct: import("@metamask/superstruct").Struct<{
165
+ method: "notify:requestRejected";
166
+ params: {
167
+ id: string;
168
+ };
169
+ }, {
170
+ method: import("@metamask/superstruct").Struct<"notify:requestRejected", "notify:requestRejected">;
171
+ params: import("@metamask/superstruct").Struct<{
172
+ id: string;
173
+ }, {
174
+ /**
175
+ * Request ID.
176
+ */
177
+ id: import("@metamask/superstruct").Struct<string, null>;
178
+ }>;
179
+ }>;
11
180
  //# sourceMappingURL=events.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.mts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;CAC3C"}
1
+ {"version":3,"file":"events.d.mts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;CAC3C;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;;QAGH;;;;;;WAMG;;QAGH;;;WAGG;;;EAGL,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;;;EAGL,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;QAGlC;;WAEG;;;EAGL,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;QAGnC;;WAEG;;QAGH;;WAEG;;;EAGL,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;QAGnC;;WAEG;;;EAGL,CAAC"}
package/dist/events.mjs CHANGED
@@ -1,3 +1,7 @@
1
+ import { exactOptional, object, UuidStruct } from "@metamask/keyring-utils";
2
+ import { boolean, literal, string } from "@metamask/superstruct";
3
+ import { JsonStruct } from "@metamask/utils";
4
+ import { KeyringAccountStruct } from "./api/index.mjs";
1
5
  /**
2
6
  * Supported keyring events.
3
7
  */
@@ -11,4 +15,66 @@ export var KeyringEvent;
11
15
  KeyringEvent["RequestApproved"] = "notify:requestApproved";
12
16
  KeyringEvent["RequestRejected"] = "notify:requestRejected";
13
17
  })(KeyringEvent || (KeyringEvent = {}));
18
+ export const AccountCreatedEventStruct = object({
19
+ method: literal(`${KeyringEvent.AccountCreated}`),
20
+ params: object({
21
+ /**
22
+ * New account object.
23
+ */
24
+ account: KeyringAccountStruct,
25
+ /**
26
+ * Account name suggestion provided to the MetaMask client.
27
+ *
28
+ * The keyring can suggest a name for the account, but it's up to the
29
+ * client to decide whether to use it. The keyring won't be informed if the
30
+ * client decides to use a different name.
31
+ */
32
+ accountNameSuggestion: exactOptional(string()),
33
+ /**
34
+ * Instructs MetaMask to display the add account confirmation dialog in the UI.
35
+ * **Note:** This is not guaranteed to be honored by the MetaMask client.
36
+ */
37
+ displayConfirmation: exactOptional(boolean()),
38
+ }),
39
+ });
40
+ export const AccountUpdatedEventStruct = object({
41
+ method: literal(`${KeyringEvent.AccountUpdated}`),
42
+ params: object({
43
+ /**
44
+ * Updated account object.
45
+ */
46
+ account: KeyringAccountStruct,
47
+ }),
48
+ });
49
+ export const AccountDeletedEventStruct = object({
50
+ method: literal(`${KeyringEvent.AccountDeleted}`),
51
+ params: object({
52
+ /**
53
+ * Deleted account ID.
54
+ */
55
+ id: UuidStruct,
56
+ }),
57
+ });
58
+ export const RequestApprovedEventStruct = object({
59
+ method: literal(`${KeyringEvent.RequestApproved}`),
60
+ params: object({
61
+ /**
62
+ * Request ID.
63
+ */
64
+ id: UuidStruct,
65
+ /**
66
+ * Request result.
67
+ */
68
+ result: JsonStruct,
69
+ }),
70
+ });
71
+ export const RequestRejectedEventStruct = object({
72
+ method: literal(`${KeyringEvent.RequestRejected}`),
73
+ params: object({
74
+ /**
75
+ * Request ID.
76
+ */
77
+ id: UuidStruct,
78
+ }),
79
+ });
14
80
  //# sourceMappingURL=events.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;AAC5C,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB","sourcesContent":["/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n}\n"]}
1
+ {"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAC5E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,8BAA8B;AACjE,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,oBAAoB,EAAE,wBAAc;AAE7C;;GAEG;AACH,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;AAC5C,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,OAAO,EAAE,oBAAoB;QAE7B;;;;;;WAMG;QACH,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;QAE9C;;;WAGG;QACH,mBAAmB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KAC9C,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,OAAO,EAAE,oBAAoB;KAC9B,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,EAAE,EAAE,UAAU;KACf,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,EAAE,EAAE,UAAU;QAEd;;WAEG;QACH,MAAM,EAAE,UAAU;KACnB,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,EAAE,EAAE,UAAU;KACf,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport { boolean, literal, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from './api';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n}\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n }),\n});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n"]}
package/dist/index.cjs CHANGED
@@ -16,14 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./api/index.cjs"), exports);
18
18
  __exportStar(require("./btc/index.cjs"), exports);
19
- __exportStar(require("./eth/index.cjs"), exports);
20
19
  __exportStar(require("./sol/index.cjs"), exports);
20
+ __exportStar(require("./eth/index.cjs"), exports);
21
+ __exportStar(require("./rpc.cjs"), exports);
21
22
  __exportStar(require("./events.cjs"), exports);
22
- __exportStar(require("./internal/index.cjs"), exports);
23
- __exportStar(require("./JsonRpcRequest.cjs"), exports);
24
- __exportStar(require("./KeyringClient.cjs"), exports);
25
- __exportStar(require("./KeyringSnapRpcClient.cjs"), exports);
26
- __exportStar(require("./rpc-handler.cjs"), exports);
27
- __exportStar(require("./snap-utils.cjs"), exports);
28
- __exportStar(require("./superstruct.cjs"), exports);
29
23
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAsB;AACtB,kDAAsB;AAEtB,kDAAsB;AACtB,kDAAsB;AACtB,+CAAyB;AACzB,uDAA2B;AAC3B,uDAAiC;AACjC,sDAAgC;AAChC,6DAAuC;AACvC,oDAA8B;AAC9B,mDAA6B;AAC7B,oDAA8B","sourcesContent":["export * from './api';\nexport * from './btc';\nexport type * from './contexts';\nexport * from './eth';\nexport * from './sol';\nexport * from './events';\nexport * from './internal';\nexport * from './JsonRpcRequest';\nexport * from './KeyringClient';\nexport * from './KeyringSnapRpcClient';\nexport * from './rpc-handler';\nexport * from './snap-utils';\nexport * from './superstruct';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAsB;AACtB,kDAAsB;AACtB,kDAAsB;AACtB,kDAAsB;AAEtB,4CAAsB;AACtB,+CAAyB","sourcesContent":["export * from './api';\nexport * from './btc';\nexport * from './sol';\nexport * from './eth';\nexport type * from './contexts';\nexport * from './rpc';\nexport * from './events';\n"]}