@metamask/keyring-api 21.6.0 → 23.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 (235) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/dist/api/account.cjs +15 -1
  3. package/dist/api/account.cjs.map +1 -1
  4. package/dist/api/account.d.cts +17 -4
  5. package/dist/api/account.d.cts.map +1 -1
  6. package/dist/api/account.d.mts +17 -4
  7. package/dist/api/account.d.mts.map +1 -1
  8. package/dist/api/account.mjs +14 -0
  9. package/dist/api/account.mjs.map +1 -1
  10. package/dist/api/index.cjs +1 -1
  11. package/dist/api/index.cjs.map +1 -1
  12. package/dist/api/index.d.cts +1 -1
  13. package/dist/api/index.d.cts.map +1 -1
  14. package/dist/api/index.d.mts +1 -1
  15. package/dist/api/index.d.mts.map +1 -1
  16. package/dist/api/index.mjs +1 -1
  17. package/dist/api/index.mjs.map +1 -1
  18. package/dist/api/keyring.cjs.map +1 -1
  19. package/dist/api/keyring.d.cts +1 -1
  20. package/dist/api/keyring.d.cts.map +1 -1
  21. package/dist/api/keyring.d.mts +1 -1
  22. package/dist/api/keyring.d.mts.map +1 -1
  23. package/dist/api/keyring.mjs.map +1 -1
  24. package/dist/eth/index.cjs +0 -1
  25. package/dist/eth/index.cjs.map +1 -1
  26. package/dist/eth/index.d.cts +0 -1
  27. package/dist/eth/index.d.cts.map +1 -1
  28. package/dist/eth/index.d.mts +0 -1
  29. package/dist/eth/index.d.mts.map +1 -1
  30. package/dist/eth/index.mjs +0 -1
  31. package/dist/eth/index.mjs.map +1 -1
  32. package/dist/events.d.cts +10 -8
  33. package/dist/events.d.cts.map +1 -1
  34. package/dist/events.d.mts +10 -8
  35. package/dist/events.d.mts.map +1 -1
  36. package/dist/index.cjs +1 -0
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +1 -0
  39. package/dist/index.d.cts.map +1 -1
  40. package/dist/index.d.mts +1 -0
  41. package/dist/index.d.mts.map +1 -1
  42. package/dist/index.mjs +1 -0
  43. package/dist/index.mjs.map +1 -1
  44. package/dist/rpc.cjs +2 -1
  45. package/dist/rpc.cjs.map +1 -1
  46. package/dist/rpc.d.cts +23 -18
  47. package/dist/rpc.d.cts.map +1 -1
  48. package/dist/rpc.d.mts +23 -18
  49. package/dist/rpc.d.mts.map +1 -1
  50. package/dist/rpc.mjs +2 -1
  51. package/dist/rpc.mjs.map +1 -1
  52. package/dist/{api/v2 → v2/api}/create-account/bip44.cjs +1 -1
  53. package/dist/{api/v2/create-account/bip44.mjs.map → v2/api/create-account/bip44.cjs.map} +1 -1
  54. package/dist/{api/v2 → v2/api}/create-account/bip44.d.cts.map +1 -1
  55. package/dist/{api/v2 → v2/api}/create-account/bip44.d.mts.map +1 -1
  56. package/dist/{api/v2 → v2/api}/create-account/bip44.mjs +1 -1
  57. package/dist/v2/api/create-account/bip44.mjs.map +1 -0
  58. package/dist/{api/v2 → v2/api}/create-account/custom.cjs.map +1 -1
  59. package/dist/{api/v2 → v2/api}/create-account/custom.d.cts.map +1 -1
  60. package/dist/{api/v2 → v2/api}/create-account/custom.d.mts.map +1 -1
  61. package/dist/{api/v2 → v2/api}/create-account/custom.mjs.map +1 -1
  62. package/dist/{api/v2 → v2/api}/create-account/index.cjs.map +1 -1
  63. package/dist/{api/v2 → v2/api}/create-account/index.d.cts +1 -1
  64. package/dist/{api/v2 → v2/api}/create-account/index.d.cts.map +1 -1
  65. package/dist/{api/v2 → v2/api}/create-account/index.d.mts +1 -1
  66. package/dist/{api/v2 → v2/api}/create-account/index.d.mts.map +1 -1
  67. package/dist/{api/v2 → v2/api}/create-account/index.mjs.map +1 -1
  68. package/dist/{api/v2 → v2/api}/create-account/private-key.cjs +1 -1
  69. package/dist/v2/api/create-account/private-key.cjs.map +1 -0
  70. package/dist/{api/v2 → v2/api}/create-account/private-key.d.cts +3 -2
  71. package/dist/{api/v2 → v2/api}/create-account/private-key.d.cts.map +1 -1
  72. package/dist/{api/v2 → v2/api}/create-account/private-key.d.mts +3 -2
  73. package/dist/{api/v2 → v2/api}/create-account/private-key.d.mts.map +1 -1
  74. package/dist/{api/v2 → v2/api}/create-account/private-key.mjs +1 -1
  75. package/dist/v2/api/create-account/private-key.mjs.map +1 -0
  76. package/dist/{api/v2 → v2/api}/export-account/index.cjs.map +1 -1
  77. package/dist/{api/v2 → v2/api}/export-account/index.d.cts.map +1 -1
  78. package/dist/{api/v2 → v2/api}/export-account/index.d.mts.map +1 -1
  79. package/dist/{api/v2 → v2/api}/export-account/index.mjs.map +1 -1
  80. package/dist/{api/v2 → v2/api}/export-account/private-key.cjs.map +1 -1
  81. package/dist/{api/v2 → v2/api}/export-account/private-key.d.cts.map +1 -1
  82. package/dist/{api/v2 → v2/api}/export-account/private-key.d.mts.map +1 -1
  83. package/dist/{api/v2 → v2/api}/export-account/private-key.mjs.map +1 -1
  84. package/dist/{api/v2 → v2/api}/index.cjs +1 -1
  85. package/dist/v2/api/index.cjs.map +1 -0
  86. package/dist/{api/v2 → v2/api}/index.d.cts +1 -1
  87. package/dist/v2/api/index.d.cts.map +1 -0
  88. package/dist/{api/v2 → v2/api}/index.d.mts +1 -1
  89. package/dist/v2/api/index.d.mts.map +1 -0
  90. package/dist/{api/v2 → v2/api}/index.mjs +1 -1
  91. package/dist/v2/api/index.mjs.map +1 -0
  92. package/dist/{api/v2 → v2/api}/keyring-capabilities.cjs +2 -2
  93. package/dist/v2/api/keyring-capabilities.cjs.map +1 -0
  94. package/dist/{api/v2 → v2/api}/keyring-capabilities.d.cts +7 -6
  95. package/dist/v2/api/keyring-capabilities.d.cts.map +1 -0
  96. package/dist/{api/v2 → v2/api}/keyring-capabilities.d.mts +7 -6
  97. package/dist/v2/api/keyring-capabilities.d.mts.map +1 -0
  98. package/dist/{api/v2 → v2/api}/keyring-capabilities.mjs +2 -2
  99. package/dist/v2/api/keyring-capabilities.mjs.map +1 -0
  100. package/dist/v2/api/keyring-rpc.cjs +93 -0
  101. package/dist/v2/api/keyring-rpc.cjs.map +1 -0
  102. package/dist/v2/api/keyring-rpc.d.cts +443 -0
  103. package/dist/v2/api/keyring-rpc.d.cts.map +1 -0
  104. package/dist/v2/api/keyring-rpc.d.mts +443 -0
  105. package/dist/v2/api/keyring-rpc.d.mts.map +1 -0
  106. package/dist/v2/api/keyring-rpc.mjs +89 -0
  107. package/dist/v2/api/keyring-rpc.mjs.map +1 -0
  108. package/dist/{api/v2 → v2/api}/keyring-type.cjs.map +1 -1
  109. package/dist/{api/v2 → v2/api}/keyring-type.d.cts.map +1 -1
  110. package/dist/{api/v2 → v2/api}/keyring-type.d.mts.map +1 -1
  111. package/dist/{api/v2 → v2/api}/keyring-type.mjs.map +1 -1
  112. package/dist/v2/api/keyring.cjs.map +1 -0
  113. package/dist/{api/v2 → v2/api}/keyring.d.cts +4 -4
  114. package/dist/{api/v2 → v2/api}/keyring.d.cts.map +1 -1
  115. package/dist/{api/v2 → v2/api}/keyring.d.mts +4 -4
  116. package/dist/{api/v2 → v2/api}/keyring.d.mts.map +1 -1
  117. package/dist/v2/api/keyring.mjs.map +1 -0
  118. package/dist/{api/v2 → v2/api}/private-key.cjs +1 -1
  119. package/dist/v2/api/private-key.cjs.map +1 -0
  120. package/dist/{api/v2 → v2/api}/private-key.d.cts +3 -2
  121. package/dist/v2/api/private-key.d.cts.map +1 -0
  122. package/dist/{api/v2 → v2/api}/private-key.d.mts +3 -2
  123. package/dist/v2/api/private-key.d.mts.map +1 -0
  124. package/dist/{api/v2 → v2/api}/private-key.mjs +1 -1
  125. package/dist/v2/api/private-key.mjs.map +1 -0
  126. package/dist/{eth/v2 → v2}/index.cjs +1 -1
  127. package/dist/v2/index.cjs.map +1 -0
  128. package/dist/v2/index.d.cts +2 -0
  129. package/dist/v2/index.d.cts.map +1 -0
  130. package/dist/v2/index.d.mts +2 -0
  131. package/dist/v2/index.d.mts.map +1 -0
  132. package/dist/v2/index.mjs +2 -0
  133. package/dist/v2/index.mjs.map +1 -0
  134. package/dist/xlm/constants.cjs +15 -0
  135. package/dist/xlm/constants.cjs.map +1 -0
  136. package/dist/xlm/constants.d.cts +10 -0
  137. package/dist/xlm/constants.d.cts.map +1 -0
  138. package/dist/xlm/constants.d.mts +10 -0
  139. package/dist/xlm/constants.d.mts.map +1 -0
  140. package/dist/xlm/constants.mjs +12 -0
  141. package/dist/xlm/constants.mjs.map +1 -0
  142. package/dist/{api/v2/wrapper → xlm}/index.cjs +2 -2
  143. package/dist/xlm/index.cjs.map +1 -0
  144. package/dist/xlm/index.d.cts +3 -0
  145. package/dist/xlm/index.d.cts.map +1 -0
  146. package/dist/xlm/index.d.mts +3 -0
  147. package/dist/xlm/index.d.mts.map +1 -0
  148. package/dist/xlm/index.mjs +3 -0
  149. package/dist/xlm/index.mjs.map +1 -0
  150. package/dist/xlm/types.cjs +42 -0
  151. package/dist/xlm/types.cjs.map +1 -0
  152. package/dist/xlm/types.d.cts +71 -0
  153. package/dist/xlm/types.d.cts.map +1 -0
  154. package/dist/xlm/types.d.mts +71 -0
  155. package/dist/xlm/types.d.mts.map +1 -0
  156. package/dist/xlm/types.mjs +39 -0
  157. package/dist/xlm/types.mjs.map +1 -0
  158. package/package.json +27 -17
  159. package/dist/api/v2/create-account/bip44.cjs.map +0 -1
  160. package/dist/api/v2/create-account/private-key.cjs.map +0 -1
  161. package/dist/api/v2/create-account/private-key.mjs.map +0 -1
  162. package/dist/api/v2/index.cjs.map +0 -1
  163. package/dist/api/v2/index.d.cts.map +0 -1
  164. package/dist/api/v2/index.d.mts.map +0 -1
  165. package/dist/api/v2/index.mjs.map +0 -1
  166. package/dist/api/v2/keyring-capabilities.cjs.map +0 -1
  167. package/dist/api/v2/keyring-capabilities.d.cts.map +0 -1
  168. package/dist/api/v2/keyring-capabilities.d.mts.map +0 -1
  169. package/dist/api/v2/keyring-capabilities.mjs.map +0 -1
  170. package/dist/api/v2/keyring.cjs.map +0 -1
  171. package/dist/api/v2/keyring.mjs.map +0 -1
  172. package/dist/api/v2/private-key.cjs.map +0 -1
  173. package/dist/api/v2/private-key.d.cts.map +0 -1
  174. package/dist/api/v2/private-key.d.mts.map +0 -1
  175. package/dist/api/v2/private-key.mjs.map +0 -1
  176. package/dist/api/v2/wrapper/index.cjs.map +0 -1
  177. package/dist/api/v2/wrapper/index.d.cts +0 -3
  178. package/dist/api/v2/wrapper/index.d.cts.map +0 -1
  179. package/dist/api/v2/wrapper/index.d.mts +0 -3
  180. package/dist/api/v2/wrapper/index.d.mts.map +0 -1
  181. package/dist/api/v2/wrapper/index.mjs +0 -3
  182. package/dist/api/v2/wrapper/index.mjs.map +0 -1
  183. package/dist/api/v2/wrapper/keyring-account-registry.cjs +0 -135
  184. package/dist/api/v2/wrapper/keyring-account-registry.cjs.map +0 -1
  185. package/dist/api/v2/wrapper/keyring-account-registry.d.cts +0 -88
  186. package/dist/api/v2/wrapper/keyring-account-registry.d.cts.map +0 -1
  187. package/dist/api/v2/wrapper/keyring-account-registry.d.mts +0 -88
  188. package/dist/api/v2/wrapper/keyring-account-registry.d.mts.map +0 -1
  189. package/dist/api/v2/wrapper/keyring-account-registry.mjs +0 -131
  190. package/dist/api/v2/wrapper/keyring-account-registry.mjs.map +0 -1
  191. package/dist/api/v2/wrapper/keyring-wrapper.cjs +0 -134
  192. package/dist/api/v2/wrapper/keyring-wrapper.cjs.map +0 -1
  193. package/dist/api/v2/wrapper/keyring-wrapper.d.cts +0 -154
  194. package/dist/api/v2/wrapper/keyring-wrapper.d.cts.map +0 -1
  195. package/dist/api/v2/wrapper/keyring-wrapper.d.mts +0 -154
  196. package/dist/api/v2/wrapper/keyring-wrapper.d.mts.map +0 -1
  197. package/dist/api/v2/wrapper/keyring-wrapper.mjs +0 -130
  198. package/dist/api/v2/wrapper/keyring-wrapper.mjs.map +0 -1
  199. package/dist/eth/v2/eth-keyring-wrapper.cjs +0 -165
  200. package/dist/eth/v2/eth-keyring-wrapper.cjs.map +0 -1
  201. package/dist/eth/v2/eth-keyring-wrapper.d.cts +0 -54
  202. package/dist/eth/v2/eth-keyring-wrapper.d.cts.map +0 -1
  203. package/dist/eth/v2/eth-keyring-wrapper.d.mts +0 -54
  204. package/dist/eth/v2/eth-keyring-wrapper.d.mts.map +0 -1
  205. package/dist/eth/v2/eth-keyring-wrapper.mjs +0 -161
  206. package/dist/eth/v2/eth-keyring-wrapper.mjs.map +0 -1
  207. package/dist/eth/v2/index.cjs.map +0 -1
  208. package/dist/eth/v2/index.d.cts +0 -2
  209. package/dist/eth/v2/index.d.cts.map +0 -1
  210. package/dist/eth/v2/index.d.mts +0 -2
  211. package/dist/eth/v2/index.d.mts.map +0 -1
  212. package/dist/eth/v2/index.mjs +0 -2
  213. package/dist/eth/v2/index.mjs.map +0 -1
  214. /package/dist/{api/v2 → v2/api}/create-account/bip44.d.cts +0 -0
  215. /package/dist/{api/v2 → v2/api}/create-account/bip44.d.mts +0 -0
  216. /package/dist/{api/v2 → v2/api}/create-account/custom.cjs +0 -0
  217. /package/dist/{api/v2 → v2/api}/create-account/custom.d.cts +0 -0
  218. /package/dist/{api/v2 → v2/api}/create-account/custom.d.mts +0 -0
  219. /package/dist/{api/v2 → v2/api}/create-account/custom.mjs +0 -0
  220. /package/dist/{api/v2 → v2/api}/create-account/index.cjs +0 -0
  221. /package/dist/{api/v2 → v2/api}/create-account/index.mjs +0 -0
  222. /package/dist/{api/v2 → v2/api}/export-account/index.cjs +0 -0
  223. /package/dist/{api/v2 → v2/api}/export-account/index.d.cts +0 -0
  224. /package/dist/{api/v2 → v2/api}/export-account/index.d.mts +0 -0
  225. /package/dist/{api/v2 → v2/api}/export-account/index.mjs +0 -0
  226. /package/dist/{api/v2 → v2/api}/export-account/private-key.cjs +0 -0
  227. /package/dist/{api/v2 → v2/api}/export-account/private-key.d.cts +0 -0
  228. /package/dist/{api/v2 → v2/api}/export-account/private-key.d.mts +0 -0
  229. /package/dist/{api/v2 → v2/api}/export-account/private-key.mjs +0 -0
  230. /package/dist/{api/v2 → v2/api}/keyring-type.cjs +0 -0
  231. /package/dist/{api/v2 → v2/api}/keyring-type.d.cts +0 -0
  232. /package/dist/{api/v2 → v2/api}/keyring-type.d.mts +0 -0
  233. /package/dist/{api/v2 → v2/api}/keyring-type.mjs +0 -0
  234. /package/dist/{api/v2 → v2/api}/keyring.cjs +0 -0
  235. /package/dist/{api/v2 → v2/api}/keyring.mjs +0 -0
package/package.json CHANGED
@@ -1,20 +1,22 @@
1
1
  {
2
2
  "name": "@metamask/keyring-api",
3
- "version": "21.6.0",
3
+ "version": "23.0.0",
4
4
  "description": "MetaMask Keyring API",
5
5
  "keywords": [
6
6
  "metamask",
7
7
  "keyring",
8
8
  "snaps"
9
9
  ],
10
- "homepage": "https://github.com/MetaMask/keyring-api#readme",
10
+ "homepage": "https://github.com/MetaMask/accounts/tree/main/packages/keyring-api#readme",
11
11
  "bugs": {
12
- "url": "https://github.com/MetaMask/keyring-api/issues"
12
+ "url": "https://github.com/MetaMask/accounts/issues"
13
13
  },
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "https://github.com/MetaMask/keyring-api.git"
16
+ "url": "https://github.com/MetaMask/accounts.git"
17
17
  },
18
+ "license": "SEE LICENSE IN LICENSE",
19
+ "sideEffects": false,
18
20
  "exports": {
19
21
  ".": {
20
22
  "import": {
@@ -25,7 +27,18 @@
25
27
  "types": "./dist/index.d.cts",
26
28
  "default": "./dist/index.cjs"
27
29
  }
28
- }
30
+ },
31
+ "./v2": {
32
+ "import": {
33
+ "types": "./dist/v2/index.d.mts",
34
+ "default": "./dist/v2/index.mjs"
35
+ },
36
+ "require": {
37
+ "types": "./dist/v2/index.d.cts",
38
+ "default": "./dist/v2/index.cjs"
39
+ }
40
+ },
41
+ "./package.json": "./package.json"
29
42
  },
30
43
  "main": "./dist/index.cjs",
31
44
  "types": "./dist/index.d.cts",
@@ -33,34 +46,31 @@
33
46
  "dist/"
34
47
  ],
35
48
  "scripts": {
36
- "build": "ts-bridge --project tsconfig.build.json --no-references",
49
+ "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
50
+ "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
37
51
  "build:clean": "yarn build --clean",
38
52
  "build:docs": "typedoc",
39
53
  "changelog:update": "../../scripts/update-changelog.sh @metamask/keyring-api",
40
54
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/keyring-api",
41
55
  "publish:preview": "yarn npm publish --tag preview",
56
+ "since-latest-release": "../../scripts/since-latest-release.sh",
42
57
  "test": "yarn test:source && yarn test:types",
43
- "test:clean": "jest --clearCache",
44
- "test:source": "jest && jest-it-up",
58
+ "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
59
+ "test:source": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
45
60
  "test:types": "../../scripts/tsd-test.sh ./src",
46
- "test:watch": "jest --watch"
61
+ "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose",
62
+ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
47
63
  },
48
64
  "dependencies": {
49
- "@ethereumjs/tx": "^5.4.0",
50
- "@metamask/eth-sig-util": "^8.2.0",
51
65
  "@metamask/keyring-utils": "^3.2.0",
52
66
  "@metamask/superstruct": "^3.1.0",
53
- "@metamask/utils": "^11.1.0",
54
- "@types/uuid": "^9.0.8",
55
- "async-mutex": "^0.5.0",
56
- "bitcoin-address-validation": "^2.2.3",
57
- "uuid": "^9.0.1"
67
+ "@metamask/utils": "^11.11.0",
68
+ "bitcoin-address-validation": "^2.2.3"
58
69
  },
59
70
  "devDependencies": {
60
71
  "@lavamoat/allow-scripts": "^3.2.1",
61
72
  "@lavamoat/preinstall-always-fail": "^2.1.0",
62
73
  "@metamask/auto-changelog": "^3.4.4",
63
- "@metamask/keyring-utils": "^3.2.0",
64
74
  "@ts-bridge/cli": "^0.6.3",
65
75
  "@types/jest": "^29.5.12",
66
76
  "@types/node": "^20.12.12",
@@ -1 +0,0 @@
1
- {"version":3,"file":"bip44.cjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/bip44.ts"],"names":[],"mappings":";;;AAAA,uDAM+B;AAE/B,qDAAwD;AAExD;;GAEG;AACU,QAAA,yCAAyC,GAAG,IAAA,oBAAM,EAAC;IAC9D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,mBAAmB,CAAC;IAClC;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,cAAc,EAAE,iCAAoB;CACrC,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,0CAA0C,GAAG,IAAA,oBAAM,EAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,oBAAoB,CAAC;IACnC;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC;AAYH;;GAEG;AACU,QAAA,uCAAuC,GAAG,IAAA,oBAAM,EAAC;IAC5D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,gBAAgB,CAAC;IAC/B;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC;AAYH;;GAEG;AACU,QAAA,+CAA+C,GAAG,IAAA,oBAAM,EAAC;IACpE;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,0BAA0B,CAAC;IACzC;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,KAAK,EAAE,IAAA,oBAAM,EAAC;QACZ;;WAEG;QACH,IAAI,EAAE,IAAA,oBAAM,GAAE;QACd;;WAEG;QACH,EAAE,EAAE,IAAA,oBAAM,GAAE;KACb,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n literal,\n number,\n object,\n string,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { DerivationPathStruct } from '../../derivation';\n\n/**\n * Struct for {@link CreateAccountBip44DerivePathOptions}.\n */\nexport const CreateAccountBip44DerivePathOptionsStruct = object({\n /**\n * Type of the options.\n */\n type: literal('bip44:derive-path'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * BIP-44 derivation path to be used to derive the account.\n */\n derivationPath: DerivationPathStruct,\n});\n\n/**\n * Options for creating an account using the given BIP-44 derivation path.\n */\nexport type CreateAccountBip44DerivePathOptions = Infer<\n typeof CreateAccountBip44DerivePathOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DeriveIndexOptions}.\n */\nexport const CreateAccountBip44DeriveIndexOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:derive-index'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating an account using the given BIP-44 account group index.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DeriveIndexOptions = Infer<\n typeof CreateAccountBip44DeriveIndexOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DiscoverOptions}.\n */\nexport const CreateAccountBip44DiscoverOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:discover'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating accounts by performing a BIP-44 account discovery.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DiscoverOptions = Infer<\n typeof CreateAccountBip44DiscoverOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DeriveIndexRangeOptions}.\n */\nexport const CreateAccountBip44DeriveIndexRangeOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:derive-index-range'),\n /**\n * ID of the entropy source to be used to derive the accounts.\n */\n entropySource: string(),\n /**\n * The range of account group indices to derive (inclusive on both ends).\n */\n range: object({\n /**\n * The starting index of the account group range (inclusive).\n */\n from: number(),\n /**\n * The ending index of the account group range (inclusive).\n */\n to: number(),\n }),\n});\n\n/**\n * Options for creating accounts by deriving a range of BIP-44 account indices.\n *\n * The range is inclusive on both ends, meaning range.from=0 and range.to=5\n * will create accounts for group indices 0, 1, 2, 3, 4, and 5.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DeriveIndexRangeOptions = Infer<\n typeof CreateAccountBip44DeriveIndexRangeOptionsStruct\n>;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"private-key.cjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/private-key.ts"],"names":[],"mappings":";;;AAAA,uDAM+B;AAE/B,+CAAyD;AACzD,oDAA0D;AAE1D;;GAEG;AACU,QAAA,oCAAoC,GAAG,IAAA,oBAAM,EAAC;IACzD;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,oBAAoB,CAAC;IACnC;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;IACpB;;OAEG;IACH,QAAQ,EAAE,sCAAwB;IAClC;;OAEG;IACH,WAAW,EAAE,IAAA,2BAAa,EAAC,kCAAwB,CAAC;CACrD,CAAC,CAAC","sourcesContent":["import {\n exactOptional,\n literal,\n object,\n string,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { KeyringAccountTypeStruct } from '../../account';\nimport { PrivateKeyEncodingStruct } from '../private-key';\n\n/**\n * Struct for {@link CreateAccountPrivateKeyOptions}.\n */\nexport const CreateAccountPrivateKeyOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('private-key:import'),\n /**\n * The encoded private key to be imported.\n */\n privateKey: string(),\n /**\n * The encoding of the private key.\n */\n encoding: PrivateKeyEncodingStruct,\n /**\n * The account type of the imported account.\n */\n accountType: exactOptional(KeyringAccountTypeStruct),\n});\n\n/**\n * Options for importing an account from a private key.\n */\nexport type CreateAccountPrivateKeyOptions = Infer<\n typeof CreateAccountPrivateKeyOptionsStruct\n>;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"private-key.mjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,OAAO,EACP,MAAM,EACN,MAAM,EAEP,8BAA8B;AAE/B,OAAO,EAAE,wBAAwB,EAAE,0BAAsB;AACzD,OAAO,EAAE,wBAAwB,EAAE,2BAAuB;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,MAAM,CAAC;IACzD;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,oBAAoB,CAAC;IACnC;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE;IACpB;;OAEG;IACH,QAAQ,EAAE,wBAAwB;IAClC;;OAEG;IACH,WAAW,EAAE,aAAa,CAAC,wBAAwB,CAAC;CACrD,CAAC,CAAC","sourcesContent":["import {\n exactOptional,\n literal,\n object,\n string,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { KeyringAccountTypeStruct } from '../../account';\nimport { PrivateKeyEncodingStruct } from '../private-key';\n\n/**\n * Struct for {@link CreateAccountPrivateKeyOptions}.\n */\nexport const CreateAccountPrivateKeyOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('private-key:import'),\n /**\n * The encoded private key to be imported.\n */\n privateKey: string(),\n /**\n * The encoding of the private key.\n */\n encoding: PrivateKeyEncodingStruct,\n /**\n * The account type of the imported account.\n */\n accountType: exactOptional(KeyringAccountTypeStruct),\n});\n\n/**\n * Options for importing an account from a private key.\n */\nexport type CreateAccountPrivateKeyOptions = Infer<\n typeof CreateAccountPrivateKeyOptionsStruct\n>;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,6DAAuC;AACvC,qDAA+B;AAC/B,6DAAiC;AACjC,6DAAiC;AACjC,oDAA8B;AAC9B,sDAA0B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\nexport * from './wrapper';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B;AAC9B,oCAA0B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B;AAC9B,oCAA0B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/api/v2/index.ts"],"names":[],"mappings":"AACA,2CAAuC;AACvC,mCAA+B;AAC/B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B;AAC9B,oCAA0B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\nexport * from './wrapper';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyring-capabilities.cjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-capabilities.ts"],"names":[],"mappings":";;;AAAA,uDAQ+B;AAE/B,mDAGuB;AACvB,sCAA4C;AAE5C;;GAEG;AACU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C;;OAEG;IACH,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,wBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,IAAA,2BAAa,EAClB,IAAA,oBAAM,EAAC;QACL;;WAEG;QACH,UAAU,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QACpC;;WAEG;QACH,WAAW,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QACrC;;WAEG;QACH,gBAAgB,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QAC1C;;WAEG;QACH,QAAQ,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;KACnC,CAAC,CACH;IACD;;OAEG;IACH,UAAU,EAAE,IAAA,2BAAa,EACvB,IAAA,oBAAM,EAAC;QACL;;WAEG;QACH,aAAa,EAAE,IAAA,2BAAa,EAAC,IAAA,mBAAK,EAAC,0CAA4B,CAAC,CAAC;QACjE;;WAEG;QACH,aAAa,EAAE,IAAA,2BAAa,EAAC,IAAA,mBAAK,EAAC,0CAA4B,CAAC,CAAC;KAClE,CAAC,CACH;IACD;;;;;;OAMG;IACH,MAAM,EAAE,IAAA,2BAAa,EACnB,IAAA,qBAAO,EACL,IAAA,oBAAM,EAAC;QACL,cAAc,EAAE,IAAA,qBAAO,GAAE;KAC1B,CAAC,CACH,CACF;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n partial,\n type Infer,\n} from '@metamask/superstruct';\n\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\nimport { CaipChainIdStruct } from '../caip';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n /**\n * List of CAIP-2 chain IDs that this keyring supports.\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * BIP-44 capabilities supported by this keyring.\n */\n bip44: exactOptional(\n object({\n /**\n * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n */\n derivePath: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a range of BIP-44 account indices.\n */\n deriveIndexRange: exactOptional(boolean()),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: exactOptional(boolean()),\n }),\n ),\n /**\n * Private key capabilities supported by this keyring.\n */\n privateKey: exactOptional(\n object({\n /**\n * List of supported formats for importing private keys.\n */\n importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n /**\n * List of supported formats for exporting private keys.\n */\n exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n }),\n ),\n /**\n * Indicates which KeyringV2 methods accept non-standard options.\n *\n * When a method is set to `true`, it signals that the keyring implementation\n * accepts custom options for that method, different from the standard API.\n * This is a workaround for keyrings with very specific requirements.\n */\n custom: exactOptional(\n partial(\n object({\n createAccounts: boolean(),\n }),\n ),\n ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n * scopes: ['bip122:_'],\n * bip44: {\n * derivePath: true,\n * deriveIndex: true,\n * deriveIndexRange: true,\n * discover: true,\n * },\n * privateKey: {\n * importFormats: [\n * { encoding: 'base58', type: 'bip122:p2sh' },\n * { encoding: 'base58', type: 'bip122:p2tr' },\n * { encoding: 'base58', type: 'bip122:p2pkh' },\n * { encoding: 'base58', type: 'bip122:p2wpkh' },\n * ],\n * exportFormats: [\n * { encoding: 'base58' },\n * { encoding: 'base58' },\n * ],\n * },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyring-capabilities.d.cts","sourceRoot":"","sources":["../../../src/api/v2/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,KAAK,EACX,8BAA8B;AAQ/B;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;IACpC;;OAEG;;IAEH;;OAEG;;;;;;;QAGC;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;IAIP;;OAEG;;;;;;;;;;QAGC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;QAEH;;WAEG;;;;;;;;;;;;IAIP;;;;;;OAMG;;;;;;EAQH,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyring-capabilities.d.mts","sourceRoot":"","sources":["../../../src/api/v2/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,KAAK,EACX,8BAA8B;AAQ/B;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;IACpC;;OAEG;;IAEH;;OAEG;;;;;;;QAGC;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;IAIP;;OAEG;;;;;;;;;;QAGC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;QAEH;;WAEG;;;;;;;;;;;;IAIP;;;;;;OAMG;;;;;;EAQH,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyring-capabilities.mjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,EACN,OAAO,EAER,8BAA8B;AAE/B,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,0BAAsB;AACvB,OAAO,EAAE,iBAAiB,EAAE,oBAAgB;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,aAAa,CAClB,MAAM,CAAC;QACL;;WAEG;QACH,UAAU,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACpC;;WAEG;QACH,WAAW,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACrC;;WAEG;QACH,gBAAgB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1C;;WAEG;QACH,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KACnC,CAAC,CACH;IACD;;OAEG;IACH,UAAU,EAAE,aAAa,CACvB,MAAM,CAAC;QACL;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACjE;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;KAClE,CAAC,CACH;IACD;;;;;;OAMG;IACH,MAAM,EAAE,aAAa,CACnB,OAAO,CACL,MAAM,CAAC;QACL,cAAc,EAAE,OAAO,EAAE;KAC1B,CAAC,CACH,CACF;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n partial,\n type Infer,\n} from '@metamask/superstruct';\n\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\nimport { CaipChainIdStruct } from '../caip';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n /**\n * List of CAIP-2 chain IDs that this keyring supports.\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * BIP-44 capabilities supported by this keyring.\n */\n bip44: exactOptional(\n object({\n /**\n * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n */\n derivePath: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a range of BIP-44 account indices.\n */\n deriveIndexRange: exactOptional(boolean()),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: exactOptional(boolean()),\n }),\n ),\n /**\n * Private key capabilities supported by this keyring.\n */\n privateKey: exactOptional(\n object({\n /**\n * List of supported formats for importing private keys.\n */\n importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n /**\n * List of supported formats for exporting private keys.\n */\n exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n }),\n ),\n /**\n * Indicates which KeyringV2 methods accept non-standard options.\n *\n * When a method is set to `true`, it signals that the keyring implementation\n * accepts custom options for that method, different from the standard API.\n * This is a workaround for keyrings with very specific requirements.\n */\n custom: exactOptional(\n partial(\n object({\n createAccounts: boolean(),\n }),\n ),\n ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n * scopes: ['bip122:_'],\n * bip44: {\n * derivePath: true,\n * deriveIndex: true,\n * deriveIndexRange: true,\n * discover: true,\n * },\n * privateKey: {\n * importFormats: [\n * { encoding: 'base58', type: 'bip122:p2sh' },\n * { encoding: 'base58', type: 'bip122:p2tr' },\n * { encoding: 'base58', type: 'bip122:p2pkh' },\n * { encoding: 'base58', type: 'bip122:p2wpkh' },\n * ],\n * exportFormats: [\n * { encoding: 'base58' },\n * { encoding: 'base58' },\n * ],\n * },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../../../src/api/v2/keyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { AccountId } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { CreateAccountOptions } from './create-account';\nimport type { ExportedAccount, ExportAccountOptions } from './export-account';\nimport type { KeyringCapabilities } from './keyring-capabilities';\nimport type { KeyringType } from './keyring-type';\nimport type { KeyringAccount } from '../account';\nimport type { KeyringRequest } from '../request';\n\n/**\n * The KeyringV2 interface defines methods for managing accounts and signing\n * requests. This interface unifies the existing EVM and Snap keyring interfaces\n * to provide a consistent API for all keyring type.\n *\n * This interface supports both EVM and non-EVM chains, and includes\n * account metadata needed for features like Multi-SRP and Backup and Sync.\n */\nexport type KeyringV2 = {\n /**\n * Type of the keyring.\n */\n type: `${KeyringType}`;\n\n /**\n * List of capabilities supported by the keyring.\n */\n capabilities: KeyringCapabilities;\n\n /**\n * Serialize the keyring state to a JSON object.\n *\n * @returns A promise that resolves to a JSON-serializable representation of\n * the keyring state.\n */\n serialize(): Promise<Json>;\n\n /**\n * Restores the keyring state from a serialized JSON object.\n *\n * @param state - A JSON object representing a serialized keyring state.\n * @returns A promise that resolves when the keyring state has been restored.\n */\n deserialize(state: Json): Promise<void>;\n\n /**\n * Initialize the keyring.\n *\n * This method is called after the constructor to allow the keyring to\n * perform any necessary asynchronous initialization tasks.\n *\n * @returns A promise that resolves when initialization is complete.\n */\n init?(): Promise<void>;\n\n /**\n * Destroy the keyring.\n *\n * This method is called before the keyring is removed from the Keyring\n * Controller, allowing the keyring to perform any necessary cleanup tasks.\n *\n * @returns A promise that resolves when cleanup is complete.\n */\n destroy?(): Promise<void>;\n\n /**\n * Returns all accounts managed by the keyring.\n *\n * @returns A promise that resolves to an array of all accounts managed by\n * this keyring.\n */\n getAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Returns the account with the specified ID.\n *\n * @param accountId - ID of the account to retrieve.\n * @returns A promise that resolves to the account with the given ID.\n */\n getAccount(accountId: AccountId): Promise<KeyringAccount>;\n\n /**\n * Creates one or more new accounts according to the provided options.\n *\n * Deterministic account creation MUST be idempotent, meaning that for\n * deterministic algorithms, like BIP-44, calling this method with the same\n * options should always return the same accounts, even if the accounts\n * already exist in the keyring.\n *\n * @param options - Options describing how to create the account(s).\n * @returns A promise that resolves to an array of the created account objects.\n */\n createAccounts(options: CreateAccountOptions): Promise<KeyringAccount[]>;\n\n /**\n * Deletes the account with the specified ID.\n *\n * @param accountId - ID of the account to delete.\n * @returns A promise that resolves when the account has been deleted.\n */\n deleteAccount(accountId: AccountId): Promise<void>;\n\n /**\n * Exports the private key or secret material for the specified account.\n *\n * @param accountId - ID of the account to export.\n * @param options - Optional export options.\n * @returns A promise that resolves to the exported account data.\n */\n exportAccount?(\n accountId: AccountId,\n options?: ExportAccountOptions,\n ): Promise<ExportedAccount>;\n\n /**\n * Submits a request to the keyring.\n *\n * @param request - The `KeyringRequest` object to submit.\n * @returns A promise that resolves to the response for the request.\n */\n submitRequest(request: KeyringRequest): Promise<Json>;\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../../src/api/v2/keyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { AccountId } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { CreateAccountOptions } from './create-account';\nimport type { ExportedAccount, ExportAccountOptions } from './export-account';\nimport type { KeyringCapabilities } from './keyring-capabilities';\nimport type { KeyringType } from './keyring-type';\nimport type { KeyringAccount } from '../account';\nimport type { KeyringRequest } from '../request';\n\n/**\n * The KeyringV2 interface defines methods for managing accounts and signing\n * requests. This interface unifies the existing EVM and Snap keyring interfaces\n * to provide a consistent API for all keyring type.\n *\n * This interface supports both EVM and non-EVM chains, and includes\n * account metadata needed for features like Multi-SRP and Backup and Sync.\n */\nexport type KeyringV2 = {\n /**\n * Type of the keyring.\n */\n type: `${KeyringType}`;\n\n /**\n * List of capabilities supported by the keyring.\n */\n capabilities: KeyringCapabilities;\n\n /**\n * Serialize the keyring state to a JSON object.\n *\n * @returns A promise that resolves to a JSON-serializable representation of\n * the keyring state.\n */\n serialize(): Promise<Json>;\n\n /**\n * Restores the keyring state from a serialized JSON object.\n *\n * @param state - A JSON object representing a serialized keyring state.\n * @returns A promise that resolves when the keyring state has been restored.\n */\n deserialize(state: Json): Promise<void>;\n\n /**\n * Initialize the keyring.\n *\n * This method is called after the constructor to allow the keyring to\n * perform any necessary asynchronous initialization tasks.\n *\n * @returns A promise that resolves when initialization is complete.\n */\n init?(): Promise<void>;\n\n /**\n * Destroy the keyring.\n *\n * This method is called before the keyring is removed from the Keyring\n * Controller, allowing the keyring to perform any necessary cleanup tasks.\n *\n * @returns A promise that resolves when cleanup is complete.\n */\n destroy?(): Promise<void>;\n\n /**\n * Returns all accounts managed by the keyring.\n *\n * @returns A promise that resolves to an array of all accounts managed by\n * this keyring.\n */\n getAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Returns the account with the specified ID.\n *\n * @param accountId - ID of the account to retrieve.\n * @returns A promise that resolves to the account with the given ID.\n */\n getAccount(accountId: AccountId): Promise<KeyringAccount>;\n\n /**\n * Creates one or more new accounts according to the provided options.\n *\n * Deterministic account creation MUST be idempotent, meaning that for\n * deterministic algorithms, like BIP-44, calling this method with the same\n * options should always return the same accounts, even if the accounts\n * already exist in the keyring.\n *\n * @param options - Options describing how to create the account(s).\n * @returns A promise that resolves to an array of the created account objects.\n */\n createAccounts(options: CreateAccountOptions): Promise<KeyringAccount[]>;\n\n /**\n * Deletes the account with the specified ID.\n *\n * @param accountId - ID of the account to delete.\n * @returns A promise that resolves when the account has been deleted.\n */\n deleteAccount(accountId: AccountId): Promise<void>;\n\n /**\n * Exports the private key or secret material for the specified account.\n *\n * @param accountId - ID of the account to export.\n * @param options - Optional export options.\n * @returns A promise that resolves to the exported account data.\n */\n exportAccount?(\n accountId: AccountId,\n options?: ExportAccountOptions,\n ): Promise<ExportedAccount>;\n\n /**\n * Submits a request to the keyring.\n *\n * @param request - The `KeyringRequest` object to submit.\n * @returns A promise that resolves to the response for the request.\n */\n submitRequest(request: KeyringRequest): Promise<Json>;\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"private-key.cjs","sourceRoot":"","sources":["../../../src/api/v2/private-key.ts"],"names":[],"mappings":";;;AAAA,uDAK+B;AAE/B,4CAAsD;AAEtD;;GAEG;AACH,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,iDAA2B,CAAA;IAE3B;;OAEG;IACH,uCAAiB,CAAA;AACnB,CAAC,EAVW,kBAAkB,kCAAlB,kBAAkB,QAU7B;AAED;;GAEG;AACU,QAAA,wBAAwB,GAAG,IAAA,mBAAK,EAAC;IAC5C,GAAG,kBAAkB,CAAC,WAAW,EAAE;IACnC,GAAG,kBAAkB,CAAC,MAAM,EAAE;CAC/B,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,4BAA4B,GAAG,IAAA,oBAAM,EAAC;IACjD;;OAEG;IACH,QAAQ,EAAE,gCAAwB;IAElC;;;;;;OAMG;IACH,IAAI,EAAE,IAAA,2BAAa,EAAC,kCAAwB,CAAC;CAC9C,CAAC,CAAC;AAOH;;GAEG;AACU,QAAA,4BAA4B,GAAG,IAAA,oBAAM,EAAC;IACjD;;OAEG;IACH,QAAQ,EAAE,gCAAwB;CACnC,CAAC,CAAC","sourcesContent":["import {\n enums,\n exactOptional,\n object,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { KeyringAccountTypeStruct } from '../account';\n\n/**\n * Supported encoding formats for private keys.\n */\nexport enum PrivateKeyEncoding {\n /**\n * Hexadecimal encoding format.\n */\n Hexadecimal = 'hexadecimal',\n\n /**\n * Base58 encoding format.\n */\n Base58 = 'base58',\n}\n\n/**\n * Struct for {@link PrivateKeyEncoding}.\n */\nexport const PrivateKeyEncodingStruct = enums([\n `${PrivateKeyEncoding.Hexadecimal}`,\n `${PrivateKeyEncoding.Base58}`,\n]);\n\n/**\n * Struct for {@link ImportPrivateKeyFormat}.\n */\nexport const ImportPrivateKeyFormatStruct = object({\n /**\n * Format used to encode the private key as a string.\n */\n encoding: PrivateKeyEncodingStruct,\n\n /**\n * Type of the account to be created.\n *\n * This field is necessary when there is ambiguity about the type of account\n * to be created from the private key. For example, in Bitcoin, a private key\n * can be used to create multiple types of accounts, such as P2WPKH, or P2TR.\n */\n type: exactOptional(KeyringAccountTypeStruct),\n});\n\n/**\n * Represents the format for importing a private key into a keyring.\n */\nexport type ImportPrivateKeyFormat = Infer<typeof ImportPrivateKeyFormatStruct>;\n\n/**\n * Struct for {@link ExportPrivateKeyFormat}.\n */\nexport const ExportPrivateKeyFormatStruct = object({\n /**\n * Format used to encode the private key as a string.\n */\n encoding: PrivateKeyEncodingStruct,\n});\n\n/**\n * Represents the format for exporting a private key from a keyring.\n */\nexport type ExportPrivateKeyFormat = Infer<typeof ExportPrivateKeyFormatStruct>;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"private-key.d.cts","sourceRoot":"","sources":["../../../src/api/v2/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,KAAK,EACX,8BAA8B;AAI/B;;GAEG;AACH,oBAAY,kBAAkB;IAC5B;;OAEG;IACH,WAAW,gBAAgB;IAE3B;;OAEG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;EAGnC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;IACvC;;OAEG;;;;;IAGH;;;;;;OAMG;;;;;;;;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;IACvC;;OAEG;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"private-key.d.mts","sourceRoot":"","sources":["../../../src/api/v2/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,KAAK,EACX,8BAA8B;AAI/B;;GAEG;AACH,oBAAY,kBAAkB;IAC5B;;OAEG;IACH,WAAW,gBAAgB;IAE3B;;OAEG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;EAGnC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;IACvC;;OAEG;;;;;IAGH;;;;;;OAMG;;;;;;;;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;IACvC;;OAEG;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"private-key.mjs","sourceRoot":"","sources":["../../../src/api/v2/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,aAAa,EACb,MAAM,EAEP,8BAA8B;AAE/B,OAAO,EAAE,wBAAwB,EAAE,uBAAmB;AAEtD;;GAEG;AACH,MAAM,CAAN,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,iDAA2B,CAAA;IAE3B;;OAEG;IACH,uCAAiB,CAAA;AACnB,CAAC,EAVW,kBAAkB,KAAlB,kBAAkB,QAU7B;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC;IAC5C,GAAG,kBAAkB,CAAC,WAAW,EAAE;IACnC,GAAG,kBAAkB,CAAC,MAAM,EAAE;CAC/B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;IACjD;;OAEG;IACH,QAAQ,EAAE,wBAAwB;IAElC;;;;;;OAMG;IACH,IAAI,EAAE,aAAa,CAAC,wBAAwB,CAAC;CAC9C,CAAC,CAAC;AAOH;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;IACjD;;OAEG;IACH,QAAQ,EAAE,wBAAwB;CACnC,CAAC,CAAC","sourcesContent":["import {\n enums,\n exactOptional,\n object,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { KeyringAccountTypeStruct } from '../account';\n\n/**\n * Supported encoding formats for private keys.\n */\nexport enum PrivateKeyEncoding {\n /**\n * Hexadecimal encoding format.\n */\n Hexadecimal = 'hexadecimal',\n\n /**\n * Base58 encoding format.\n */\n Base58 = 'base58',\n}\n\n/**\n * Struct for {@link PrivateKeyEncoding}.\n */\nexport const PrivateKeyEncodingStruct = enums([\n `${PrivateKeyEncoding.Hexadecimal}`,\n `${PrivateKeyEncoding.Base58}`,\n]);\n\n/**\n * Struct for {@link ImportPrivateKeyFormat}.\n */\nexport const ImportPrivateKeyFormatStruct = object({\n /**\n * Format used to encode the private key as a string.\n */\n encoding: PrivateKeyEncodingStruct,\n\n /**\n * Type of the account to be created.\n *\n * This field is necessary when there is ambiguity about the type of account\n * to be created from the private key. For example, in Bitcoin, a private key\n * can be used to create multiple types of accounts, such as P2WPKH, or P2TR.\n */\n type: exactOptional(KeyringAccountTypeStruct),\n});\n\n/**\n * Represents the format for importing a private key into a keyring.\n */\nexport type ImportPrivateKeyFormat = Infer<typeof ImportPrivateKeyFormatStruct>;\n\n/**\n * Struct for {@link ExportPrivateKeyFormat}.\n */\nexport const ExportPrivateKeyFormatStruct = object({\n /**\n * Format used to encode the private key as a string.\n */\n encoding: PrivateKeyEncodingStruct,\n});\n\n/**\n * Represents the format for exporting a private key from a keyring.\n */\nexport type ExportPrivateKeyFormat = Infer<typeof ExportPrivateKeyFormatStruct>;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAkC;AAClC,iEAA2C","sourcesContent":["export * from './keyring-wrapper';\nexport * from './keyring-account-registry';\n"]}
@@ -1,3 +0,0 @@
1
- export * from "./keyring-wrapper.cjs";
2
- export * from "./keyring-account-registry.cjs";
3
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,+CAA2C"}
@@ -1,3 +0,0 @@
1
- export * from "./keyring-wrapper.mjs";
2
- export * from "./keyring-account-registry.mjs";
3
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,+CAA2C"}
@@ -1,3 +0,0 @@
1
- export * from "./keyring-wrapper.mjs";
2
- export * from "./keyring-account-registry.mjs";
3
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,+CAA2C","sourcesContent":["export * from './keyring-wrapper';\nexport * from './keyring-account-registry';\n"]}
@@ -1,135 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
- 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");
5
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
- };
7
- var _KeyringAccountRegistry_accountById, _KeyringAccountRegistry_idByAddress;
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.KeyringAccountRegistry = void 0;
10
- const uuid_1 = require("uuid");
11
- /**
12
- * In-memory registry for KeyringAccount objects.
13
- *
14
- * Provides O(1) lookups by account ID or address, and stores the full
15
- * KeyringAccount objects for efficient retrieval.
16
- */
17
- class KeyringAccountRegistry {
18
- constructor() {
19
- _KeyringAccountRegistry_accountById.set(this, new Map());
20
- _KeyringAccountRegistry_idByAddress.set(this, new Map());
21
- }
22
- /**
23
- * Get an account by its account ID.
24
- *
25
- * @param accountId - The account ID to look up.
26
- * @returns The KeyringAccount, or undefined if not found.
27
- */
28
- get(accountId) {
29
- return __classPrivateFieldGet(this, _KeyringAccountRegistry_accountById, "f").get(accountId);
30
- }
31
- /**
32
- * Get an account's address by its account ID.
33
- *
34
- * @param accountId - The account ID to look up.
35
- * @returns The address, or undefined if not found.
36
- */
37
- getAddress(accountId) {
38
- return __classPrivateFieldGet(this, _KeyringAccountRegistry_accountById, "f").get(accountId)?.address;
39
- }
40
- /**
41
- * Get an account ID by the underlying address.
42
- *
43
- * @param address - The address to look up.
44
- * @returns The account ID, or undefined if not found.
45
- */
46
- getAccountId(address) {
47
- return __classPrivateFieldGet(this, _KeyringAccountRegistry_idByAddress, "f").get(address);
48
- }
49
- /**
50
- * Register a new address and generate an account ID for it.
51
- * If the address is already registered, returns the existing account ID.
52
- *
53
- * @param address - The address to register.
54
- * @returns The account ID for this address.
55
- */
56
- register(address) {
57
- const existing = __classPrivateFieldGet(this, _KeyringAccountRegistry_idByAddress, "f").get(address);
58
- if (existing) {
59
- return existing;
60
- }
61
- const id = (0, uuid_1.v4)();
62
- __classPrivateFieldGet(this, _KeyringAccountRegistry_idByAddress, "f").set(address, id);
63
- return id;
64
- }
65
- /**
66
- * Add an account to the registry.
67
- * Also registers the address → account ID mapping.
68
- *
69
- * ⚠️ If an address was previously registered via `register()` with a
70
- * different account ID, calling `set()` with an account that has a new ID for
71
- * the same address will overwrite the address → ID mapping. The old ID
72
- * becomes "dangling" (i.e., `get(oldId)` will return undefined).
73
- *
74
- * @param account - The KeyringAccount to cache.
75
- */
76
- set(account) {
77
- __classPrivateFieldGet(this, _KeyringAccountRegistry_accountById, "f").set(account.id, account);
78
- __classPrivateFieldGet(this, _KeyringAccountRegistry_idByAddress, "f").set(account.address, account.id);
79
- }
80
- /**
81
- * Remove an account from the registry.
82
- *
83
- * @param accountId - The account ID to remove.
84
- */
85
- delete(accountId) {
86
- const account = __classPrivateFieldGet(this, _KeyringAccountRegistry_accountById, "f").get(accountId);
87
- if (account) {
88
- __classPrivateFieldGet(this, _KeyringAccountRegistry_idByAddress, "f").delete(account.address);
89
- __classPrivateFieldGet(this, _KeyringAccountRegistry_accountById, "f").delete(accountId);
90
- }
91
- }
92
- /**
93
- * Clear all accounts from the registry.
94
- */
95
- clear() {
96
- __classPrivateFieldGet(this, _KeyringAccountRegistry_accountById, "f").clear();
97
- __classPrivateFieldGet(this, _KeyringAccountRegistry_idByAddress, "f").clear();
98
- }
99
- /**
100
- * Get all cached accounts as an array.
101
- *
102
- * @returns Array of all KeyringAccountType objects in the registry.
103
- */
104
- values() {
105
- return Array.from(__classPrivateFieldGet(this, _KeyringAccountRegistry_accountById, "f").values());
106
- }
107
- /**
108
- * Get all account IDs in the registry.
109
- *
110
- * @returns Array of all account IDs.
111
- */
112
- keys() {
113
- return Array.from(__classPrivateFieldGet(this, _KeyringAccountRegistry_accountById, "f").keys());
114
- }
115
- /**
116
- * Check if an account exists in the registry.
117
- *
118
- * @param accountId - The account ID to check.
119
- * @returns True if the account exists.
120
- */
121
- has(accountId) {
122
- return __classPrivateFieldGet(this, _KeyringAccountRegistry_accountById, "f").has(accountId);
123
- }
124
- /**
125
- * Get the number of accounts in the registry.
126
- *
127
- * @returns The number of accounts.
128
- */
129
- get size() {
130
- return __classPrivateFieldGet(this, _KeyringAccountRegistry_accountById, "f").size;
131
- }
132
- }
133
- exports.KeyringAccountRegistry = KeyringAccountRegistry;
134
- _KeyringAccountRegistry_accountById = new WeakMap(), _KeyringAccountRegistry_idByAddress = new WeakMap();
135
- //# sourceMappingURL=keyring-account-registry.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyring-account-registry.cjs","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/keyring-account-registry.ts"],"names":[],"mappings":";;;;;;;;;AACA,+BAAoC;AAIpC;;;;;GAKG;AACH,MAAa,sBAAsB;IAAnC;QAGW,8CAAe,IAAI,GAAG,EAAiC,EAAC;QAExD,8CAAe,IAAI,GAAG,EAAqB,EAAC;IA0HvD,CAAC;IAxHC;;;;;OAKG;IACH,GAAG,CAAC,SAAoB;QACtB,OAAO,uBAAA,IAAI,2CAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,SAAoB;QAC7B,OAAO,uBAAA,IAAI,2CAAa,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,OAAe;QAC1B,OAAO,uBAAA,IAAI,2CAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,OAAe;QACtB,MAAM,QAAQ,GAAG,uBAAA,IAAI,2CAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,MAAM,EAAE,GAAG,IAAA,SAAM,GAAE,CAAC;QACpB,uBAAA,IAAI,2CAAa,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACnC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG,CAAC,OAA2B;QAC7B,uBAAA,IAAI,2CAAa,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3C,uBAAA,IAAI,2CAAa,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAoB;QACzB,MAAM,OAAO,GAAG,uBAAA,IAAI,2CAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACjD,IAAI,OAAO,EAAE,CAAC;YACZ,uBAAA,IAAI,2CAAa,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC1C,uBAAA,IAAI,2CAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK;QACH,uBAAA,IAAI,2CAAa,CAAC,KAAK,EAAE,CAAC;QAC1B,uBAAA,IAAI,2CAAa,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,uBAAA,IAAI,2CAAa,CAAC,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;IAED;;;;OAIG;IACH,IAAI;QACF,OAAO,KAAK,CAAC,IAAI,CAAC,uBAAA,IAAI,2CAAa,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,SAAoB;QACtB,OAAO,uBAAA,IAAI,2CAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,uBAAA,IAAI,2CAAa,CAAC,IAAI,CAAC;IAChC,CAAC;CACF;AA/HD,wDA+HC","sourcesContent":["import type { AccountId } from '@metamask/keyring-utils';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport type { KeyringAccount } from '../../account';\n\n/**\n * In-memory registry for KeyringAccount objects.\n *\n * Provides O(1) lookups by account ID or address, and stores the full\n * KeyringAccount objects for efficient retrieval.\n */\nexport class KeyringAccountRegistry<\n KeyringAccountType extends KeyringAccount = KeyringAccount,\n> {\n readonly #accountById = new Map<AccountId, KeyringAccountType>();\n\n readonly #idByAddress = new Map<string, AccountId>();\n\n /**\n * Get an account by its account ID.\n *\n * @param accountId - The account ID to look up.\n * @returns The KeyringAccount, or undefined if not found.\n */\n get(accountId: AccountId): KeyringAccountType | undefined {\n return this.#accountById.get(accountId);\n }\n\n /**\n * Get an account's address by its account ID.\n *\n * @param accountId - The account ID to look up.\n * @returns The address, or undefined if not found.\n */\n getAddress(accountId: AccountId): string | undefined {\n return this.#accountById.get(accountId)?.address;\n }\n\n /**\n * Get an account ID by the underlying address.\n *\n * @param address - The address to look up.\n * @returns The account ID, or undefined if not found.\n */\n getAccountId(address: string): AccountId | undefined {\n return this.#idByAddress.get(address);\n }\n\n /**\n * Register a new address and generate an account ID for it.\n * If the address is already registered, returns the existing account ID.\n *\n * @param address - The address to register.\n * @returns The account ID for this address.\n */\n register(address: string): AccountId {\n const existing = this.#idByAddress.get(address);\n if (existing) {\n return existing;\n }\n const id = uuidv4();\n this.#idByAddress.set(address, id);\n return id;\n }\n\n /**\n * Add an account to the registry.\n * Also registers the address → account ID mapping.\n *\n * ⚠️ If an address was previously registered via `register()` with a\n * different account ID, calling `set()` with an account that has a new ID for\n * the same address will overwrite the address → ID mapping. The old ID\n * becomes \"dangling\" (i.e., `get(oldId)` will return undefined).\n *\n * @param account - The KeyringAccount to cache.\n */\n set(account: KeyringAccountType): void {\n this.#accountById.set(account.id, account);\n this.#idByAddress.set(account.address, account.id);\n }\n\n /**\n * Remove an account from the registry.\n *\n * @param accountId - The account ID to remove.\n */\n delete(accountId: AccountId): void {\n const account = this.#accountById.get(accountId);\n if (account) {\n this.#idByAddress.delete(account.address);\n this.#accountById.delete(accountId);\n }\n }\n\n /**\n * Clear all accounts from the registry.\n */\n clear(): void {\n this.#accountById.clear();\n this.#idByAddress.clear();\n }\n\n /**\n * Get all cached accounts as an array.\n *\n * @returns Array of all KeyringAccountType objects in the registry.\n */\n values(): KeyringAccountType[] {\n return Array.from(this.#accountById.values());\n }\n\n /**\n * Get all account IDs in the registry.\n *\n * @returns Array of all account IDs.\n */\n keys(): AccountId[] {\n return Array.from(this.#accountById.keys());\n }\n\n /**\n * Check if an account exists in the registry.\n *\n * @param accountId - The account ID to check.\n * @returns True if the account exists.\n */\n has(accountId: AccountId): boolean {\n return this.#accountById.has(accountId);\n }\n\n /**\n * Get the number of accounts in the registry.\n *\n * @returns The number of accounts.\n */\n get size(): number {\n return this.#accountById.size;\n }\n}\n"]}
@@ -1,88 +0,0 @@
1
- import type { AccountId } from "@metamask/keyring-utils";
2
- import type { KeyringAccount } from "../../account.cjs";
3
- /**
4
- * In-memory registry for KeyringAccount objects.
5
- *
6
- * Provides O(1) lookups by account ID or address, and stores the full
7
- * KeyringAccount objects for efficient retrieval.
8
- */
9
- export declare class KeyringAccountRegistry<KeyringAccountType extends KeyringAccount = KeyringAccount> {
10
- #private;
11
- /**
12
- * Get an account by its account ID.
13
- *
14
- * @param accountId - The account ID to look up.
15
- * @returns The KeyringAccount, or undefined if not found.
16
- */
17
- get(accountId: AccountId): KeyringAccountType | undefined;
18
- /**
19
- * Get an account's address by its account ID.
20
- *
21
- * @param accountId - The account ID to look up.
22
- * @returns The address, or undefined if not found.
23
- */
24
- getAddress(accountId: AccountId): string | undefined;
25
- /**
26
- * Get an account ID by the underlying address.
27
- *
28
- * @param address - The address to look up.
29
- * @returns The account ID, or undefined if not found.
30
- */
31
- getAccountId(address: string): AccountId | undefined;
32
- /**
33
- * Register a new address and generate an account ID for it.
34
- * If the address is already registered, returns the existing account ID.
35
- *
36
- * @param address - The address to register.
37
- * @returns The account ID for this address.
38
- */
39
- register(address: string): AccountId;
40
- /**
41
- * Add an account to the registry.
42
- * Also registers the address → account ID mapping.
43
- *
44
- * ⚠️ If an address was previously registered via `register()` with a
45
- * different account ID, calling `set()` with an account that has a new ID for
46
- * the same address will overwrite the address → ID mapping. The old ID
47
- * becomes "dangling" (i.e., `get(oldId)` will return undefined).
48
- *
49
- * @param account - The KeyringAccount to cache.
50
- */
51
- set(account: KeyringAccountType): void;
52
- /**
53
- * Remove an account from the registry.
54
- *
55
- * @param accountId - The account ID to remove.
56
- */
57
- delete(accountId: AccountId): void;
58
- /**
59
- * Clear all accounts from the registry.
60
- */
61
- clear(): void;
62
- /**
63
- * Get all cached accounts as an array.
64
- *
65
- * @returns Array of all KeyringAccountType objects in the registry.
66
- */
67
- values(): KeyringAccountType[];
68
- /**
69
- * Get all account IDs in the registry.
70
- *
71
- * @returns Array of all account IDs.
72
- */
73
- keys(): AccountId[];
74
- /**
75
- * Check if an account exists in the registry.
76
- *
77
- * @param accountId - The account ID to check.
78
- * @returns True if the account exists.
79
- */
80
- has(accountId: AccountId): boolean;
81
- /**
82
- * Get the number of accounts in the registry.
83
- *
84
- * @returns The number of accounts.
85
- */
86
- get size(): number;
87
- }
88
- //# sourceMappingURL=keyring-account-registry.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyring-account-registry.d.cts","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/keyring-account-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gCAAgC;AAGzD,OAAO,KAAK,EAAE,cAAc,EAAE,0BAAsB;AAEpD;;;;;GAKG;AACH,qBAAa,sBAAsB,CACjC,kBAAkB,SAAS,cAAc,GAAG,cAAc;;IAM1D;;;;;OAKG;IACH,GAAG,CAAC,SAAS,EAAE,SAAS,GAAG,kBAAkB,GAAG,SAAS;IAIzD;;;;;OAKG;IACH,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS;IAIpD;;;;;OAKG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAIpD;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS;IAUpC;;;;;;;;;;OAUG;IACH,GAAG,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAKtC;;;;OAIG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAQlC;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;;;OAIG;IACH,MAAM,IAAI,kBAAkB,EAAE;IAI9B;;;;OAIG;IACH,IAAI,IAAI,SAAS,EAAE;IAInB;;;;;OAKG;IACH,GAAG,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAIlC;;;;OAIG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
@@ -1,88 +0,0 @@
1
- import type { AccountId } from "@metamask/keyring-utils";
2
- import type { KeyringAccount } from "../../account.mjs";
3
- /**
4
- * In-memory registry for KeyringAccount objects.
5
- *
6
- * Provides O(1) lookups by account ID or address, and stores the full
7
- * KeyringAccount objects for efficient retrieval.
8
- */
9
- export declare class KeyringAccountRegistry<KeyringAccountType extends KeyringAccount = KeyringAccount> {
10
- #private;
11
- /**
12
- * Get an account by its account ID.
13
- *
14
- * @param accountId - The account ID to look up.
15
- * @returns The KeyringAccount, or undefined if not found.
16
- */
17
- get(accountId: AccountId): KeyringAccountType | undefined;
18
- /**
19
- * Get an account's address by its account ID.
20
- *
21
- * @param accountId - The account ID to look up.
22
- * @returns The address, or undefined if not found.
23
- */
24
- getAddress(accountId: AccountId): string | undefined;
25
- /**
26
- * Get an account ID by the underlying address.
27
- *
28
- * @param address - The address to look up.
29
- * @returns The account ID, or undefined if not found.
30
- */
31
- getAccountId(address: string): AccountId | undefined;
32
- /**
33
- * Register a new address and generate an account ID for it.
34
- * If the address is already registered, returns the existing account ID.
35
- *
36
- * @param address - The address to register.
37
- * @returns The account ID for this address.
38
- */
39
- register(address: string): AccountId;
40
- /**
41
- * Add an account to the registry.
42
- * Also registers the address → account ID mapping.
43
- *
44
- * ⚠️ If an address was previously registered via `register()` with a
45
- * different account ID, calling `set()` with an account that has a new ID for
46
- * the same address will overwrite the address → ID mapping. The old ID
47
- * becomes "dangling" (i.e., `get(oldId)` will return undefined).
48
- *
49
- * @param account - The KeyringAccount to cache.
50
- */
51
- set(account: KeyringAccountType): void;
52
- /**
53
- * Remove an account from the registry.
54
- *
55
- * @param accountId - The account ID to remove.
56
- */
57
- delete(accountId: AccountId): void;
58
- /**
59
- * Clear all accounts from the registry.
60
- */
61
- clear(): void;
62
- /**
63
- * Get all cached accounts as an array.
64
- *
65
- * @returns Array of all KeyringAccountType objects in the registry.
66
- */
67
- values(): KeyringAccountType[];
68
- /**
69
- * Get all account IDs in the registry.
70
- *
71
- * @returns Array of all account IDs.
72
- */
73
- keys(): AccountId[];
74
- /**
75
- * Check if an account exists in the registry.
76
- *
77
- * @param accountId - The account ID to check.
78
- * @returns True if the account exists.
79
- */
80
- has(accountId: AccountId): boolean;
81
- /**
82
- * Get the number of accounts in the registry.
83
- *
84
- * @returns The number of accounts.
85
- */
86
- get size(): number;
87
- }
88
- //# sourceMappingURL=keyring-account-registry.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyring-account-registry.d.mts","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/keyring-account-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gCAAgC;AAGzD,OAAO,KAAK,EAAE,cAAc,EAAE,0BAAsB;AAEpD;;;;;GAKG;AACH,qBAAa,sBAAsB,CACjC,kBAAkB,SAAS,cAAc,GAAG,cAAc;;IAM1D;;;;;OAKG;IACH,GAAG,CAAC,SAAS,EAAE,SAAS,GAAG,kBAAkB,GAAG,SAAS;IAIzD;;;;;OAKG;IACH,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS;IAIpD;;;;;OAKG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAIpD;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS;IAUpC;;;;;;;;;;OAUG;IACH,GAAG,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAKtC;;;;OAIG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAQlC;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;;;OAIG;IACH,MAAM,IAAI,kBAAkB,EAAE;IAI9B;;;;OAIG;IACH,IAAI,IAAI,SAAS,EAAE;IAInB;;;;;OAKG;IACH,GAAG,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAIlC;;;;OAIG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}