@metamask-previews/keyring-api 21.1.0-8202c83 → 21.3.0-ca02a28

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 (191) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/README.md +11 -0
  3. package/dist/api/account.cjs +15 -1
  4. package/dist/api/account.cjs.map +1 -1
  5. package/dist/api/account.d.cts +14 -0
  6. package/dist/api/account.d.cts.map +1 -1
  7. package/dist/api/account.d.mts +14 -0
  8. package/dist/api/account.d.mts.map +1 -1
  9. package/dist/api/account.mjs +14 -0
  10. package/dist/api/account.mjs.map +1 -1
  11. package/dist/api/index.cjs +1 -0
  12. package/dist/api/index.cjs.map +1 -1
  13. package/dist/api/index.d.cts +1 -0
  14. package/dist/api/index.d.cts.map +1 -1
  15. package/dist/api/index.d.mts +1 -0
  16. package/dist/api/index.d.mts.map +1 -1
  17. package/dist/api/index.mjs +1 -0
  18. package/dist/api/index.mjs.map +1 -1
  19. package/dist/api/keyring.cjs +0 -2
  20. package/dist/api/keyring.cjs.map +1 -1
  21. package/dist/api/keyring.d.cts.map +1 -1
  22. package/dist/api/keyring.d.mts.map +1 -1
  23. package/dist/api/keyring.mjs +0 -2
  24. package/dist/api/keyring.mjs.map +1 -1
  25. package/dist/api/v2/create-account/bip44.cjs +57 -0
  26. package/dist/api/v2/create-account/bip44.cjs.map +1 -0
  27. package/dist/api/v2/create-account/bip44.d.cts +83 -0
  28. package/dist/api/v2/create-account/bip44.d.cts.map +1 -0
  29. package/dist/api/v2/create-account/bip44.d.mts +83 -0
  30. package/dist/api/v2/create-account/bip44.d.mts.map +1 -0
  31. package/dist/api/v2/create-account/bip44.mjs +54 -0
  32. package/dist/api/v2/create-account/bip44.mjs.map +1 -0
  33. package/dist/api/v2/create-account/index.cjs +72 -0
  34. package/dist/api/v2/create-account/index.cjs.map +1 -0
  35. package/dist/api/v2/create-account/index.d.cts +58 -0
  36. package/dist/api/v2/create-account/index.d.cts.map +1 -0
  37. package/dist/api/v2/create-account/index.d.mts +58 -0
  38. package/dist/api/v2/create-account/index.d.mts.map +1 -0
  39. package/dist/api/v2/create-account/index.mjs +55 -0
  40. package/dist/api/v2/create-account/index.mjs.map +1 -0
  41. package/dist/api/v2/create-account/private-key.cjs +28 -0
  42. package/dist/api/v2/create-account/private-key.cjs.map +1 -0
  43. package/dist/api/v2/create-account/private-key.d.cts +45 -0
  44. package/dist/api/v2/create-account/private-key.d.cts.map +1 -0
  45. package/dist/api/v2/create-account/private-key.d.mts +45 -0
  46. package/dist/api/v2/create-account/private-key.d.mts.map +1 -0
  47. package/dist/api/v2/create-account/private-key.mjs +25 -0
  48. package/dist/api/v2/create-account/private-key.mjs.map +1 -0
  49. package/dist/api/v2/export-account/index.cjs +38 -0
  50. package/dist/api/v2/export-account/index.cjs.map +1 -0
  51. package/dist/api/v2/export-account/index.d.cts +48 -0
  52. package/dist/api/v2/export-account/index.d.cts.map +1 -0
  53. package/dist/api/v2/export-account/index.d.mts +48 -0
  54. package/dist/api/v2/export-account/index.d.mts.map +1 -0
  55. package/dist/api/v2/export-account/index.mjs +21 -0
  56. package/dist/api/v2/export-account/index.mjs.map +1 -0
  57. package/dist/api/v2/export-account/private-key.cjs +36 -0
  58. package/dist/api/v2/export-account/private-key.cjs.map +1 -0
  59. package/dist/api/v2/export-account/private-key.d.cts +53 -0
  60. package/dist/api/v2/export-account/private-key.d.cts.map +1 -0
  61. package/dist/api/v2/export-account/private-key.d.mts +53 -0
  62. package/dist/api/v2/export-account/private-key.d.mts.map +1 -0
  63. package/dist/api/v2/export-account/private-key.mjs +33 -0
  64. package/dist/api/v2/export-account/private-key.mjs.map +1 -0
  65. package/dist/api/v2/index.cjs +23 -0
  66. package/dist/api/v2/index.cjs.map +1 -0
  67. package/dist/api/v2/index.d.cts +8 -0
  68. package/dist/api/v2/index.d.cts.map +1 -0
  69. package/dist/api/v2/index.d.mts +8 -0
  70. package/dist/api/v2/index.d.mts.map +1 -0
  71. package/dist/api/v2/index.mjs +7 -0
  72. package/dist/api/v2/index.mjs.map +1 -0
  73. package/dist/api/v2/keyring-capabilities.cjs +46 -0
  74. package/dist/api/v2/keyring-capabilities.cjs.map +1 -0
  75. package/dist/api/v2/keyring-capabilities.d.cts +128 -0
  76. package/dist/api/v2/keyring-capabilities.d.cts.map +1 -0
  77. package/dist/api/v2/keyring-capabilities.d.mts +128 -0
  78. package/dist/api/v2/keyring-capabilities.d.mts.map +1 -0
  79. package/dist/api/v2/keyring-capabilities.mjs +43 -0
  80. package/dist/api/v2/keyring-capabilities.mjs.map +1 -0
  81. package/dist/api/v2/keyring-type.cjs +44 -0
  82. package/dist/api/v2/keyring-type.cjs.map +1 -0
  83. package/dist/api/v2/keyring-type.d.cts +40 -0
  84. package/dist/api/v2/keyring-type.d.cts.map +1 -0
  85. package/dist/api/v2/keyring-type.d.mts +40 -0
  86. package/dist/api/v2/keyring-type.d.mts.map +1 -0
  87. package/dist/api/v2/keyring-type.mjs +41 -0
  88. package/dist/api/v2/keyring-type.mjs.map +1 -0
  89. package/dist/api/v2/keyring.cjs +3 -0
  90. package/dist/api/v2/keyring.cjs.map +1 -0
  91. package/dist/api/v2/keyring.d.cts +107 -0
  92. package/dist/api/v2/keyring.d.cts.map +1 -0
  93. package/dist/api/v2/keyring.d.mts +107 -0
  94. package/dist/api/v2/keyring.d.mts.map +1 -0
  95. package/dist/api/v2/keyring.mjs +2 -0
  96. package/dist/api/v2/keyring.mjs.map +1 -0
  97. package/dist/api/v2/private-key.cjs +53 -0
  98. package/dist/api/v2/private-key.cjs.map +1 -0
  99. package/dist/api/v2/private-key.d.cts +77 -0
  100. package/dist/api/v2/private-key.d.cts.map +1 -0
  101. package/dist/api/v2/private-key.d.mts +77 -0
  102. package/dist/api/v2/private-key.d.mts.map +1 -0
  103. package/dist/api/v2/private-key.mjs +50 -0
  104. package/dist/api/v2/private-key.mjs.map +1 -0
  105. package/dist/api/v2/wrapper/index.cjs +19 -0
  106. package/dist/api/v2/wrapper/index.cjs.map +1 -0
  107. package/dist/api/v2/wrapper/index.d.cts +3 -0
  108. package/dist/api/v2/wrapper/index.d.cts.map +1 -0
  109. package/dist/api/v2/wrapper/index.d.mts +3 -0
  110. package/dist/api/v2/wrapper/index.d.mts.map +1 -0
  111. package/dist/api/v2/wrapper/index.mjs +3 -0
  112. package/dist/api/v2/wrapper/index.mjs.map +1 -0
  113. package/dist/api/v2/wrapper/keyring-account-registry.cjs +135 -0
  114. package/dist/api/v2/wrapper/keyring-account-registry.cjs.map +1 -0
  115. package/dist/api/v2/wrapper/keyring-account-registry.d.cts +88 -0
  116. package/dist/api/v2/wrapper/keyring-account-registry.d.cts.map +1 -0
  117. package/dist/api/v2/wrapper/keyring-account-registry.d.mts +88 -0
  118. package/dist/api/v2/wrapper/keyring-account-registry.d.mts.map +1 -0
  119. package/dist/api/v2/wrapper/keyring-account-registry.mjs +131 -0
  120. package/dist/api/v2/wrapper/keyring-account-registry.mjs.map +1 -0
  121. package/dist/api/v2/wrapper/keyring-wrapper.cjs +116 -0
  122. package/dist/api/v2/wrapper/keyring-wrapper.cjs.map +1 -0
  123. package/dist/api/v2/wrapper/keyring-wrapper.d.cts +146 -0
  124. package/dist/api/v2/wrapper/keyring-wrapper.d.cts.map +1 -0
  125. package/dist/api/v2/wrapper/keyring-wrapper.d.mts +146 -0
  126. package/dist/api/v2/wrapper/keyring-wrapper.d.mts.map +1 -0
  127. package/dist/api/v2/wrapper/keyring-wrapper.mjs +112 -0
  128. package/dist/api/v2/wrapper/keyring-wrapper.mjs.map +1 -0
  129. package/dist/eth/erc4337/types.d.cts +4 -4
  130. package/dist/eth/erc4337/types.d.mts +4 -4
  131. package/dist/eth/index.cjs +2 -0
  132. package/dist/eth/index.cjs.map +1 -1
  133. package/dist/eth/index.d.cts +2 -0
  134. package/dist/eth/index.d.cts.map +1 -1
  135. package/dist/eth/index.d.mts +2 -0
  136. package/dist/eth/index.d.mts.map +1 -1
  137. package/dist/eth/index.mjs +2 -0
  138. package/dist/eth/index.mjs.map +1 -1
  139. package/dist/eth/rpc/index.cjs +18 -0
  140. package/dist/eth/rpc/index.cjs.map +1 -0
  141. package/dist/eth/rpc/index.d.cts +2 -0
  142. package/dist/eth/rpc/index.d.cts.map +1 -0
  143. package/dist/eth/rpc/index.d.mts +2 -0
  144. package/dist/eth/rpc/index.d.mts.map +1 -0
  145. package/dist/eth/rpc/index.mjs +2 -0
  146. package/dist/eth/rpc/index.mjs.map +1 -0
  147. package/dist/eth/rpc/params.cjs +151 -0
  148. package/dist/eth/rpc/params.cjs.map +1 -0
  149. package/dist/eth/rpc/params.d.cts +215 -0
  150. package/dist/eth/rpc/params.d.cts.map +1 -0
  151. package/dist/eth/rpc/params.d.mts +215 -0
  152. package/dist/eth/rpc/params.d.mts.map +1 -0
  153. package/dist/eth/rpc/params.mjs +148 -0
  154. package/dist/eth/rpc/params.mjs.map +1 -0
  155. package/dist/eth/types.cjs.map +1 -1
  156. package/dist/eth/types.d.cts +5 -5
  157. package/dist/eth/types.d.cts.map +1 -1
  158. package/dist/eth/types.d.mts +5 -5
  159. package/dist/eth/types.d.mts.map +1 -1
  160. package/dist/eth/types.mjs.map +1 -1
  161. package/dist/eth/v2/eth-keyring-wrapper.cjs +165 -0
  162. package/dist/eth/v2/eth-keyring-wrapper.cjs.map +1 -0
  163. package/dist/eth/v2/eth-keyring-wrapper.d.cts +54 -0
  164. package/dist/eth/v2/eth-keyring-wrapper.d.cts.map +1 -0
  165. package/dist/eth/v2/eth-keyring-wrapper.d.mts +54 -0
  166. package/dist/eth/v2/eth-keyring-wrapper.d.mts.map +1 -0
  167. package/dist/eth/v2/eth-keyring-wrapper.mjs +161 -0
  168. package/dist/eth/v2/eth-keyring-wrapper.mjs.map +1 -0
  169. package/dist/eth/v2/index.cjs +18 -0
  170. package/dist/eth/v2/index.cjs.map +1 -0
  171. package/dist/eth/v2/index.d.cts +2 -0
  172. package/dist/eth/v2/index.d.cts.map +1 -0
  173. package/dist/eth/v2/index.d.mts +2 -0
  174. package/dist/eth/v2/index.d.mts.map +1 -0
  175. package/dist/eth/v2/index.mjs +2 -0
  176. package/dist/eth/v2/index.mjs.map +1 -0
  177. package/dist/events.cjs +0 -2
  178. package/dist/events.cjs.map +1 -1
  179. package/dist/events.d.cts.map +1 -1
  180. package/dist/events.d.mts.map +1 -1
  181. package/dist/events.mjs +0 -2
  182. package/dist/events.mjs.map +1 -1
  183. package/dist/trx/types.cjs +4 -0
  184. package/dist/trx/types.cjs.map +1 -1
  185. package/dist/trx/types.d.cts +4 -0
  186. package/dist/trx/types.d.cts.map +1 -1
  187. package/dist/trx/types.d.mts +4 -0
  188. package/dist/trx/types.d.mts.map +1 -1
  189. package/dist/trx/types.mjs +4 -0
  190. package/dist/trx/types.mjs.map +1 -1
  191. package/package.json +7 -2
@@ -0,0 +1,128 @@
1
+ import { type Infer } from "@metamask/superstruct";
2
+ /**
3
+ * Struct for {@link KeyringCapabilities}.
4
+ */
5
+ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").Struct<{
6
+ scopes: `${string}:${string}`[];
7
+ bip44?: {
8
+ derivePath: boolean;
9
+ deriveIndex: boolean;
10
+ discover: boolean;
11
+ };
12
+ privateKey?: {
13
+ importFormats?: {
14
+ encoding: "hexadecimal" | "base58";
15
+ type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
16
+ }[];
17
+ exportFormats?: {
18
+ encoding: "hexadecimal" | "base58";
19
+ }[];
20
+ };
21
+ }, {
22
+ /**
23
+ * List of CAIP-2 chain IDs that this keyring supports.
24
+ */
25
+ scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
26
+ /**
27
+ * BIP-44 capabilities supported by this keyring.
28
+ */
29
+ bip44: import("@metamask/superstruct").ExactOptionalStruct<{
30
+ derivePath: boolean;
31
+ deriveIndex: boolean;
32
+ discover: boolean;
33
+ }, {
34
+ /**
35
+ * Whether the keyring supports deriving accounts from a specific BIP-44 path.
36
+ */
37
+ derivePath: import("@metamask/superstruct").Struct<boolean, null>;
38
+ /**
39
+ * Whether the keyring supports deriving accounts from a BIP-44 account index.
40
+ */
41
+ deriveIndex: import("@metamask/superstruct").Struct<boolean, null>;
42
+ /**
43
+ * Whether the keyring supports BIP-44 account discovery.
44
+ */
45
+ discover: import("@metamask/superstruct").Struct<boolean, null>;
46
+ }>;
47
+ /**
48
+ * Private key capabilities supported by this keyring.
49
+ */
50
+ privateKey: import("@metamask/superstruct").ExactOptionalStruct<{
51
+ importFormats?: {
52
+ encoding: "hexadecimal" | "base58";
53
+ type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
54
+ }[];
55
+ exportFormats?: {
56
+ encoding: "hexadecimal" | "base58";
57
+ }[];
58
+ }, {
59
+ /**
60
+ * List of supported formats for importing private keys.
61
+ */
62
+ importFormats: import("@metamask/superstruct").ExactOptionalStruct<{
63
+ encoding: "hexadecimal" | "base58";
64
+ type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
65
+ }[], import("@metamask/superstruct").Struct<{
66
+ encoding: "hexadecimal" | "base58";
67
+ type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
68
+ }, {
69
+ encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
70
+ hexadecimal: "hexadecimal";
71
+ base58: "base58";
72
+ }>;
73
+ type: import("@metamask/superstruct").ExactOptionalStruct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
74
+ "eip155:eoa": "eip155:eoa";
75
+ "eip155:erc4337": "eip155:erc4337";
76
+ "bip122:p2pkh": "bip122:p2pkh";
77
+ "bip122:p2sh": "bip122:p2sh";
78
+ "bip122:p2wpkh": "bip122:p2wpkh";
79
+ "bip122:p2tr": "bip122:p2tr";
80
+ "solana:data-account": "solana:data-account";
81
+ "tron:eoa": "tron:eoa";
82
+ "any:account": "any:account";
83
+ }>;
84
+ }>>;
85
+ /**
86
+ * List of supported formats for exporting private keys.
87
+ */
88
+ exportFormats: import("@metamask/superstruct").ExactOptionalStruct<{
89
+ encoding: "hexadecimal" | "base58";
90
+ }[], import("@metamask/superstruct").Struct<{
91
+ encoding: "hexadecimal" | "base58";
92
+ }, {
93
+ encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
94
+ hexadecimal: "hexadecimal";
95
+ base58: "base58";
96
+ }>;
97
+ }>>;
98
+ }>;
99
+ }>;
100
+ /**
101
+ * Type representing the capabilities supported by a keyring.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * const capabilities: KeyringCapabilities = {
106
+ * scopes: ['bip122:_'],
107
+ * bip44: {
108
+ * derivePath: true,
109
+ * deriveIndex: true,
110
+ * discover: true,
111
+ * },
112
+ * privateKey: {
113
+ * importFormats: [
114
+ * { encoding: 'base58', type: 'bip122:p2sh' },
115
+ * { encoding: 'base58', type: 'bip122:p2tr' },
116
+ * { encoding: 'base58', type: 'bip122:p2pkh' },
117
+ * { encoding: 'base58', type: 'bip122:p2wpkh' },
118
+ * ],
119
+ * exportFormats: [
120
+ * { encoding: 'base58' },
121
+ * { encoding: 'base58' },
122
+ * ],
123
+ * },
124
+ * };
125
+ * ```
126
+ */
127
+ export type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;
128
+ //# sourceMappingURL=keyring-capabilities.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring-capabilities.d.mts","sourceRoot":"","sources":["../../../src/api/v2/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,KAAK,EACX,8BAA8B;AAQ/B;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;IACpC;;OAEG;;IAEH;;OAEG;;;;;;QAGC;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;IAIP;;OAEG;;;;;;;;;;QAGC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;QAEH;;WAEG;;;;;;;;;;;;EAIP,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { array, boolean, exactOptional, nonempty, object } from "@metamask/superstruct";
2
+ import { ExportPrivateKeyFormatStruct, ImportPrivateKeyFormatStruct } from "./private-key.mjs";
3
+ import { CaipChainIdStruct } from "../caip.mjs";
4
+ /**
5
+ * Struct for {@link KeyringCapabilities}.
6
+ */
7
+ export const KeyringCapabilitiesStruct = object({
8
+ /**
9
+ * List of CAIP-2 chain IDs that this keyring supports.
10
+ */
11
+ scopes: nonempty(array(CaipChainIdStruct)),
12
+ /**
13
+ * BIP-44 capabilities supported by this keyring.
14
+ */
15
+ bip44: exactOptional(object({
16
+ /**
17
+ * Whether the keyring supports deriving accounts from a specific BIP-44 path.
18
+ */
19
+ derivePath: boolean(),
20
+ /**
21
+ * Whether the keyring supports deriving accounts from a BIP-44 account index.
22
+ */
23
+ deriveIndex: boolean(),
24
+ /**
25
+ * Whether the keyring supports BIP-44 account discovery.
26
+ */
27
+ discover: boolean(),
28
+ })),
29
+ /**
30
+ * Private key capabilities supported by this keyring.
31
+ */
32
+ privateKey: exactOptional(object({
33
+ /**
34
+ * List of supported formats for importing private keys.
35
+ */
36
+ importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),
37
+ /**
38
+ * List of supported formats for exporting private keys.
39
+ */
40
+ exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),
41
+ })),
42
+ });
43
+ //# sourceMappingURL=keyring-capabilities.mjs.map
@@ -0,0 +1 @@
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,EAEP,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,OAAO,EAAE;QACrB;;WAEG;QACH,WAAW,EAAE,OAAO,EAAE;QACtB;;WAEG;QACH,QAAQ,EAAE,OAAO,EAAE;KACpB,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;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\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: boolean(),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: boolean(),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: 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\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 * 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"]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeyringType = void 0;
4
+ /**
5
+ * Enum representing the different types of keyrings supported.
6
+ */
7
+ var KeyringType;
8
+ (function (KeyringType) {
9
+ /**
10
+ * Represents a hierarchical deterministic (HD) keyring.
11
+ */
12
+ KeyringType["Hd"] = "hd";
13
+ /**
14
+ * Represents a keyring that directly stores private keys.
15
+ */
16
+ KeyringType["PrivateKey"] = "private-key";
17
+ /**
18
+ * Represents a keyring that implements the QR protocol.
19
+ *
20
+ * See: https://eips.ethereum.org/EIPS/eip-4527
21
+ */
22
+ KeyringType["Qr"] = "qr";
23
+ /**
24
+ * Represents keyring backed by a Snap.
25
+ */
26
+ KeyringType["Snap"] = "snap";
27
+ /**
28
+ * Represents keyring backed by a Ledger hardware wallet.
29
+ */
30
+ KeyringType["Ledger"] = "ledger";
31
+ /**
32
+ * Represents keyring backed by a Lattice hardware wallet.
33
+ */
34
+ KeyringType["Lattice"] = "lattice";
35
+ /**
36
+ * Represents keyring backed by a Trezor hardware wallet.
37
+ */
38
+ KeyringType["Trezor"] = "trezor";
39
+ /**
40
+ * Represents keyring backed by a OneKey hardware wallet.
41
+ */
42
+ KeyringType["OneKey"] = "onekey";
43
+ })(KeyringType || (exports.KeyringType = KeyringType = {}));
44
+ //# sourceMappingURL=keyring-type.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring-type.cjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,WA0CX;AA1CD,WAAY,WAAW;IACrB;;OAEG;IACH,wBAAS,CAAA;IAET;;OAEG;IACH,yCAA0B,CAAA;IAE1B;;;;OAIG;IACH,wBAAS,CAAA;IAET;;OAEG;IACH,4BAAa,CAAA;IAEb;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,kCAAmB,CAAA;IAEnB;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,gCAAiB,CAAA;AACnB,CAAC,EA1CW,WAAW,2BAAX,WAAW,QA0CtB","sourcesContent":["/**\n * Enum representing the different types of keyrings supported.\n */\nexport enum KeyringType {\n /**\n * Represents a hierarchical deterministic (HD) keyring.\n */\n Hd = 'hd',\n\n /**\n * Represents a keyring that directly stores private keys.\n */\n PrivateKey = 'private-key',\n\n /**\n * Represents a keyring that implements the QR protocol.\n *\n * See: https://eips.ethereum.org/EIPS/eip-4527\n */\n Qr = 'qr',\n\n /**\n * Represents keyring backed by a Snap.\n */\n Snap = 'snap',\n\n /**\n * Represents keyring backed by a Ledger hardware wallet.\n */\n Ledger = 'ledger',\n\n /**\n * Represents keyring backed by a Lattice hardware wallet.\n */\n Lattice = 'lattice',\n\n /**\n * Represents keyring backed by a Trezor hardware wallet.\n */\n Trezor = 'trezor',\n\n /**\n * Represents keyring backed by a OneKey hardware wallet.\n */\n OneKey = 'onekey',\n}\n"]}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Enum representing the different types of keyrings supported.
3
+ */
4
+ export declare enum KeyringType {
5
+ /**
6
+ * Represents a hierarchical deterministic (HD) keyring.
7
+ */
8
+ Hd = "hd",
9
+ /**
10
+ * Represents a keyring that directly stores private keys.
11
+ */
12
+ PrivateKey = "private-key",
13
+ /**
14
+ * Represents a keyring that implements the QR protocol.
15
+ *
16
+ * See: https://eips.ethereum.org/EIPS/eip-4527
17
+ */
18
+ Qr = "qr",
19
+ /**
20
+ * Represents keyring backed by a Snap.
21
+ */
22
+ Snap = "snap",
23
+ /**
24
+ * Represents keyring backed by a Ledger hardware wallet.
25
+ */
26
+ Ledger = "ledger",
27
+ /**
28
+ * Represents keyring backed by a Lattice hardware wallet.
29
+ */
30
+ Lattice = "lattice",
31
+ /**
32
+ * Represents keyring backed by a Trezor hardware wallet.
33
+ */
34
+ Trezor = "trezor",
35
+ /**
36
+ * Represents keyring backed by a OneKey hardware wallet.
37
+ */
38
+ OneKey = "onekey"
39
+ }
40
+ //# sourceMappingURL=keyring-type.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring-type.d.cts","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,WAAW;IACrB;;OAEG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;;OAIG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,MAAM,WAAW;CAClB"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Enum representing the different types of keyrings supported.
3
+ */
4
+ export declare enum KeyringType {
5
+ /**
6
+ * Represents a hierarchical deterministic (HD) keyring.
7
+ */
8
+ Hd = "hd",
9
+ /**
10
+ * Represents a keyring that directly stores private keys.
11
+ */
12
+ PrivateKey = "private-key",
13
+ /**
14
+ * Represents a keyring that implements the QR protocol.
15
+ *
16
+ * See: https://eips.ethereum.org/EIPS/eip-4527
17
+ */
18
+ Qr = "qr",
19
+ /**
20
+ * Represents keyring backed by a Snap.
21
+ */
22
+ Snap = "snap",
23
+ /**
24
+ * Represents keyring backed by a Ledger hardware wallet.
25
+ */
26
+ Ledger = "ledger",
27
+ /**
28
+ * Represents keyring backed by a Lattice hardware wallet.
29
+ */
30
+ Lattice = "lattice",
31
+ /**
32
+ * Represents keyring backed by a Trezor hardware wallet.
33
+ */
34
+ Trezor = "trezor",
35
+ /**
36
+ * Represents keyring backed by a OneKey hardware wallet.
37
+ */
38
+ OneKey = "onekey"
39
+ }
40
+ //# sourceMappingURL=keyring-type.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring-type.d.mts","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,WAAW;IACrB;;OAEG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;;OAIG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,MAAM,WAAW;CAClB"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Enum representing the different types of keyrings supported.
3
+ */
4
+ export var KeyringType;
5
+ (function (KeyringType) {
6
+ /**
7
+ * Represents a hierarchical deterministic (HD) keyring.
8
+ */
9
+ KeyringType["Hd"] = "hd";
10
+ /**
11
+ * Represents a keyring that directly stores private keys.
12
+ */
13
+ KeyringType["PrivateKey"] = "private-key";
14
+ /**
15
+ * Represents a keyring that implements the QR protocol.
16
+ *
17
+ * See: https://eips.ethereum.org/EIPS/eip-4527
18
+ */
19
+ KeyringType["Qr"] = "qr";
20
+ /**
21
+ * Represents keyring backed by a Snap.
22
+ */
23
+ KeyringType["Snap"] = "snap";
24
+ /**
25
+ * Represents keyring backed by a Ledger hardware wallet.
26
+ */
27
+ KeyringType["Ledger"] = "ledger";
28
+ /**
29
+ * Represents keyring backed by a Lattice hardware wallet.
30
+ */
31
+ KeyringType["Lattice"] = "lattice";
32
+ /**
33
+ * Represents keyring backed by a Trezor hardware wallet.
34
+ */
35
+ KeyringType["Trezor"] = "trezor";
36
+ /**
37
+ * Represents keyring backed by a OneKey hardware wallet.
38
+ */
39
+ KeyringType["OneKey"] = "onekey";
40
+ })(KeyringType || (KeyringType = {}));
41
+ //# sourceMappingURL=keyring-type.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring-type.mjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,WA0CX;AA1CD,WAAY,WAAW;IACrB;;OAEG;IACH,wBAAS,CAAA;IAET;;OAEG;IACH,yCAA0B,CAAA;IAE1B;;;;OAIG;IACH,wBAAS,CAAA;IAET;;OAEG;IACH,4BAAa,CAAA;IAEb;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,kCAAmB,CAAA;IAEnB;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,gCAAiB,CAAA;AACnB,CAAC,EA1CW,WAAW,KAAX,WAAW,QA0CtB","sourcesContent":["/**\n * Enum representing the different types of keyrings supported.\n */\nexport enum KeyringType {\n /**\n * Represents a hierarchical deterministic (HD) keyring.\n */\n Hd = 'hd',\n\n /**\n * Represents a keyring that directly stores private keys.\n */\n PrivateKey = 'private-key',\n\n /**\n * Represents a keyring that implements the QR protocol.\n *\n * See: https://eips.ethereum.org/EIPS/eip-4527\n */\n Qr = 'qr',\n\n /**\n * Represents keyring backed by a Snap.\n */\n Snap = 'snap',\n\n /**\n * Represents keyring backed by a Ledger hardware wallet.\n */\n Ledger = 'ledger',\n\n /**\n * Represents keyring backed by a Lattice hardware wallet.\n */\n Lattice = 'lattice',\n\n /**\n * Represents keyring backed by a Trezor hardware wallet.\n */\n Trezor = 'trezor',\n\n /**\n * Represents keyring backed by a OneKey hardware wallet.\n */\n OneKey = 'onekey',\n}\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=keyring.cjs.map
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,107 @@
1
+ import type { AccountId } from "@metamask/keyring-utils";
2
+ import type { Json } from "@metamask/utils";
3
+ import type { CreateAccountOptions } from "./create-account/index.cjs";
4
+ import type { ExportedAccount, ExportAccountOptions } from "./export-account/index.cjs";
5
+ import type { KeyringCapabilities } from "./keyring-capabilities.cjs";
6
+ import type { KeyringType } from "./keyring-type.cjs";
7
+ import type { KeyringAccount } from "../account.cjs";
8
+ import type { KeyringRequest } from "../request.cjs";
9
+ /**
10
+ * The KeyringV2 interface defines methods for managing accounts and signing
11
+ * requests. This interface unifies the existing EVM and Snap keyring interfaces
12
+ * to provide a consistent API for all keyring type.
13
+ *
14
+ * This interface supports both EVM and non-EVM chains, and includes
15
+ * account metadata needed for features like Multi-SRP and Backup and Sync.
16
+ */
17
+ export type KeyringV2 = {
18
+ /**
19
+ * Type of the keyring.
20
+ */
21
+ type: `${KeyringType}`;
22
+ /**
23
+ * List of capabilities supported by the keyring.
24
+ */
25
+ capabilities: KeyringCapabilities;
26
+ /**
27
+ * Serialize the keyring state to a JSON object.
28
+ *
29
+ * @returns A promise that resolves to a JSON-serializable representation of
30
+ * the keyring state.
31
+ */
32
+ serialize(): Promise<Json>;
33
+ /**
34
+ * Restores the keyring state from a serialized JSON object.
35
+ *
36
+ * @param state - A JSON object representing a serialized keyring state.
37
+ * @returns A promise that resolves when the keyring state has been restored.
38
+ */
39
+ deserialize(state: Json): Promise<void>;
40
+ /**
41
+ * Initialize the keyring.
42
+ *
43
+ * This method is called after the constructor to allow the keyring to
44
+ * perform any necessary asynchronous initialization tasks.
45
+ *
46
+ * @returns A promise that resolves when initialization is complete.
47
+ */
48
+ init?(): Promise<void>;
49
+ /**
50
+ * Destroy the keyring.
51
+ *
52
+ * This method is called before the keyring is removed from the Keyring
53
+ * Controller, allowing the keyring to perform any necessary cleanup tasks.
54
+ *
55
+ * @returns A promise that resolves when cleanup is complete.
56
+ */
57
+ destroy?(): Promise<void>;
58
+ /**
59
+ * Returns all accounts managed by the keyring.
60
+ *
61
+ * @returns A promise that resolves to an array of all accounts managed by
62
+ * this keyring.
63
+ */
64
+ getAccounts(): Promise<KeyringAccount[]>;
65
+ /**
66
+ * Returns the account with the specified ID.
67
+ *
68
+ * @param accountId - ID of the account to retrieve.
69
+ * @returns A promise that resolves to the account with the given ID.
70
+ */
71
+ getAccount(accountId: AccountId): Promise<KeyringAccount>;
72
+ /**
73
+ * Creates one or more new accounts according to the provided options.
74
+ *
75
+ * Deterministic account creation MUST be idempotent, meaning that for
76
+ * deterministic algorithms, like BIP-44, calling this method with the same
77
+ * options should always return the same accounts, even if the accounts
78
+ * already exist in the keyring.
79
+ *
80
+ * @param options - Options describing how to create the account(s).
81
+ * @returns A promise that resolves to an array of the created account objects.
82
+ */
83
+ createAccounts(options: CreateAccountOptions): Promise<KeyringAccount[]>;
84
+ /**
85
+ * Deletes the account with the specified ID.
86
+ *
87
+ * @param accountId - ID of the account to delete.
88
+ * @returns A promise that resolves when the account has been deleted.
89
+ */
90
+ deleteAccount(accountId: AccountId): Promise<void>;
91
+ /**
92
+ * Exports the private key or secret material for the specified account.
93
+ *
94
+ * @param accountId - ID of the account to export.
95
+ * @param options - Optional export options.
96
+ * @returns A promise that resolves to the exported account data.
97
+ */
98
+ exportAccount?(accountId: AccountId, options?: ExportAccountOptions): Promise<ExportedAccount>;
99
+ /**
100
+ * Submits a request to the keyring.
101
+ *
102
+ * @param request - The `KeyringRequest` object to submit.
103
+ * @returns A promise that resolves to the response for the request.
104
+ */
105
+ submitRequest(request: KeyringRequest): Promise<Json>;
106
+ };
107
+ //# sourceMappingURL=keyring.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../../../src/api/v2/keyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gCAAgC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,mCAAyB;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,mCAAyB;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,mCAA+B;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,2BAAuB;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAmB;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAmB;AAEjD;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,IAAI,EAAE,GAAG,WAAW,EAAE,CAAC;IAEvB;;OAEG;IACH,YAAY,EAAE,mBAAmB,CAAC;IAElC;;;;;OAKG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;;;;;;OAOG;IACH,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B;;;;;OAKG;IACH,WAAW,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAEzC;;;;;OAKG;IACH,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE1D;;;;;;;;;;OAUG;IACH,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAEzE;;;;;OAKG;IACH,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD;;;;;;OAMG;IACH,aAAa,CAAC,CACZ,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAAC;IAE5B;;;;;OAKG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC"}
@@ -0,0 +1,107 @@
1
+ import type { AccountId } from "@metamask/keyring-utils";
2
+ import type { Json } from "@metamask/utils";
3
+ import type { CreateAccountOptions } from "./create-account/index.mjs";
4
+ import type { ExportedAccount, ExportAccountOptions } from "./export-account/index.mjs";
5
+ import type { KeyringCapabilities } from "./keyring-capabilities.mjs";
6
+ import type { KeyringType } from "./keyring-type.mjs";
7
+ import type { KeyringAccount } from "../account.mjs";
8
+ import type { KeyringRequest } from "../request.mjs";
9
+ /**
10
+ * The KeyringV2 interface defines methods for managing accounts and signing
11
+ * requests. This interface unifies the existing EVM and Snap keyring interfaces
12
+ * to provide a consistent API for all keyring type.
13
+ *
14
+ * This interface supports both EVM and non-EVM chains, and includes
15
+ * account metadata needed for features like Multi-SRP and Backup and Sync.
16
+ */
17
+ export type KeyringV2 = {
18
+ /**
19
+ * Type of the keyring.
20
+ */
21
+ type: `${KeyringType}`;
22
+ /**
23
+ * List of capabilities supported by the keyring.
24
+ */
25
+ capabilities: KeyringCapabilities;
26
+ /**
27
+ * Serialize the keyring state to a JSON object.
28
+ *
29
+ * @returns A promise that resolves to a JSON-serializable representation of
30
+ * the keyring state.
31
+ */
32
+ serialize(): Promise<Json>;
33
+ /**
34
+ * Restores the keyring state from a serialized JSON object.
35
+ *
36
+ * @param state - A JSON object representing a serialized keyring state.
37
+ * @returns A promise that resolves when the keyring state has been restored.
38
+ */
39
+ deserialize(state: Json): Promise<void>;
40
+ /**
41
+ * Initialize the keyring.
42
+ *
43
+ * This method is called after the constructor to allow the keyring to
44
+ * perform any necessary asynchronous initialization tasks.
45
+ *
46
+ * @returns A promise that resolves when initialization is complete.
47
+ */
48
+ init?(): Promise<void>;
49
+ /**
50
+ * Destroy the keyring.
51
+ *
52
+ * This method is called before the keyring is removed from the Keyring
53
+ * Controller, allowing the keyring to perform any necessary cleanup tasks.
54
+ *
55
+ * @returns A promise that resolves when cleanup is complete.
56
+ */
57
+ destroy?(): Promise<void>;
58
+ /**
59
+ * Returns all accounts managed by the keyring.
60
+ *
61
+ * @returns A promise that resolves to an array of all accounts managed by
62
+ * this keyring.
63
+ */
64
+ getAccounts(): Promise<KeyringAccount[]>;
65
+ /**
66
+ * Returns the account with the specified ID.
67
+ *
68
+ * @param accountId - ID of the account to retrieve.
69
+ * @returns A promise that resolves to the account with the given ID.
70
+ */
71
+ getAccount(accountId: AccountId): Promise<KeyringAccount>;
72
+ /**
73
+ * Creates one or more new accounts according to the provided options.
74
+ *
75
+ * Deterministic account creation MUST be idempotent, meaning that for
76
+ * deterministic algorithms, like BIP-44, calling this method with the same
77
+ * options should always return the same accounts, even if the accounts
78
+ * already exist in the keyring.
79
+ *
80
+ * @param options - Options describing how to create the account(s).
81
+ * @returns A promise that resolves to an array of the created account objects.
82
+ */
83
+ createAccounts(options: CreateAccountOptions): Promise<KeyringAccount[]>;
84
+ /**
85
+ * Deletes the account with the specified ID.
86
+ *
87
+ * @param accountId - ID of the account to delete.
88
+ * @returns A promise that resolves when the account has been deleted.
89
+ */
90
+ deleteAccount(accountId: AccountId): Promise<void>;
91
+ /**
92
+ * Exports the private key or secret material for the specified account.
93
+ *
94
+ * @param accountId - ID of the account to export.
95
+ * @param options - Optional export options.
96
+ * @returns A promise that resolves to the exported account data.
97
+ */
98
+ exportAccount?(accountId: AccountId, options?: ExportAccountOptions): Promise<ExportedAccount>;
99
+ /**
100
+ * Submits a request to the keyring.
101
+ *
102
+ * @param request - The `KeyringRequest` object to submit.
103
+ * @returns A promise that resolves to the response for the request.
104
+ */
105
+ submitRequest(request: KeyringRequest): Promise<Json>;
106
+ };
107
+ //# sourceMappingURL=keyring.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../../../src/api/v2/keyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gCAAgC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,mCAAyB;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,mCAAyB;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,mCAA+B;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,2BAAuB;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAmB;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAmB;AAEjD;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,IAAI,EAAE,GAAG,WAAW,EAAE,CAAC;IAEvB;;OAEG;IACH,YAAY,EAAE,mBAAmB,CAAC;IAElC;;;;;OAKG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;;;;;;OAOG;IACH,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B;;;;;OAKG;IACH,WAAW,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAEzC;;;;;OAKG;IACH,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE1D;;;;;;;;;;OAUG;IACH,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAEzE;;;;;OAKG;IACH,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD;;;;;;OAMG;IACH,aAAa,CAAC,CACZ,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAAC;IAE5B;;;;;OAKG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=keyring.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../../src/api/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"]}