@metamask/keyring-api 23.4.0 → 23.6.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 (176) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/dist/api/account-options.cjs +3 -3
  3. package/dist/api/account-options.cjs.map +1 -1
  4. package/dist/api/account-options.d.cts.map +1 -1
  5. package/dist/api/account-options.d.mts.map +1 -1
  6. package/dist/api/account-options.mjs +2 -2
  7. package/dist/api/account-options.mjs.map +1 -1
  8. package/dist/api/account.cjs +1 -1
  9. package/dist/api/account.cjs.map +1 -1
  10. package/dist/api/account.mjs +2 -2
  11. package/dist/api/account.mjs.map +1 -1
  12. package/dist/api/asset.cjs +3 -3
  13. package/dist/api/asset.cjs.map +1 -1
  14. package/dist/api/asset.d.cts.map +1 -1
  15. package/dist/api/asset.d.mts.map +1 -1
  16. package/dist/api/asset.mjs +2 -2
  17. package/dist/api/asset.mjs.map +1 -1
  18. package/dist/api/balance.cjs +1 -1
  19. package/dist/api/balance.cjs.map +1 -1
  20. package/dist/api/balance.mjs +2 -2
  21. package/dist/api/balance.mjs.map +1 -1
  22. package/dist/api/options.cjs +3 -2
  23. package/dist/api/options.cjs.map +1 -1
  24. package/dist/api/options.d.cts +1 -1
  25. package/dist/api/options.d.cts.map +1 -1
  26. package/dist/api/options.d.mts +1 -1
  27. package/dist/api/options.d.mts.map +1 -1
  28. package/dist/api/options.mjs +2 -1
  29. package/dist/api/options.mjs.map +1 -1
  30. package/dist/api/pagination.cjs +2 -3
  31. package/dist/api/pagination.cjs.map +1 -1
  32. package/dist/api/pagination.d.cts +1 -1
  33. package/dist/api/pagination.d.cts.map +1 -1
  34. package/dist/api/pagination.d.mts +1 -1
  35. package/dist/api/pagination.d.mts.map +1 -1
  36. package/dist/api/pagination.mjs +1 -2
  37. package/dist/api/pagination.mjs.map +1 -1
  38. package/dist/api/request.cjs +3 -3
  39. package/dist/api/request.cjs.map +1 -1
  40. package/dist/api/request.d.cts +1 -1
  41. package/dist/api/request.d.cts.map +1 -1
  42. package/dist/api/request.d.mts +1 -1
  43. package/dist/api/request.d.mts.map +1 -1
  44. package/dist/api/request.mjs +2 -2
  45. package/dist/api/request.mjs.map +1 -1
  46. package/dist/api/response.cjs +5 -6
  47. package/dist/api/response.cjs.map +1 -1
  48. package/dist/api/response.d.cts.map +1 -1
  49. package/dist/api/response.d.mts.map +1 -1
  50. package/dist/api/response.mjs +1 -2
  51. package/dist/api/response.mjs.map +1 -1
  52. package/dist/api/transaction.cjs +10 -10
  53. package/dist/api/transaction.cjs.map +1 -1
  54. package/dist/api/transaction.d.cts +11 -11
  55. package/dist/api/transaction.d.cts.map +1 -1
  56. package/dist/api/transaction.d.mts +11 -11
  57. package/dist/api/transaction.d.mts.map +1 -1
  58. package/dist/api/transaction.mjs +2 -2
  59. package/dist/api/transaction.mjs.map +1 -1
  60. package/dist/btc/types.cjs +5 -6
  61. package/dist/btc/types.cjs.map +1 -1
  62. package/dist/btc/types.d.cts.map +1 -1
  63. package/dist/btc/types.d.mts.map +1 -1
  64. package/dist/btc/types.mjs +1 -2
  65. package/dist/btc/types.mjs.map +1 -1
  66. package/dist/eth/erc4337/types.cjs +9 -8
  67. package/dist/eth/erc4337/types.cjs.map +1 -1
  68. package/dist/eth/erc4337/types.d.cts +4 -4
  69. package/dist/eth/erc4337/types.d.cts.map +1 -1
  70. package/dist/eth/erc4337/types.d.mts +4 -4
  71. package/dist/eth/erc4337/types.d.mts.map +1 -1
  72. package/dist/eth/erc4337/types.mjs +2 -1
  73. package/dist/eth/erc4337/types.mjs.map +1 -1
  74. package/dist/eth/rpc/params.cjs +4 -5
  75. package/dist/eth/rpc/params.cjs.map +1 -1
  76. package/dist/eth/rpc/params.d.cts.map +1 -1
  77. package/dist/eth/rpc/params.d.mts.map +1 -1
  78. package/dist/eth/rpc/params.mjs +1 -2
  79. package/dist/eth/rpc/params.mjs.map +1 -1
  80. package/dist/eth/types.cjs +4 -5
  81. package/dist/eth/types.cjs.map +1 -1
  82. package/dist/eth/types.d.cts +1 -1
  83. package/dist/eth/types.d.cts.map +1 -1
  84. package/dist/eth/types.d.mts +1 -1
  85. package/dist/eth/types.d.mts.map +1 -1
  86. package/dist/eth/types.mjs +2 -3
  87. package/dist/eth/types.mjs.map +1 -1
  88. package/dist/events.cjs +20 -20
  89. package/dist/events.cjs.map +1 -1
  90. package/dist/events.d.cts +4 -4
  91. package/dist/events.d.cts.map +1 -1
  92. package/dist/events.d.mts +4 -4
  93. package/dist/events.d.mts.map +1 -1
  94. package/dist/events.mjs +2 -2
  95. package/dist/events.mjs.map +1 -1
  96. package/dist/rpc.cjs +36 -36
  97. package/dist/rpc.cjs.map +1 -1
  98. package/dist/rpc.d.cts +12 -12
  99. package/dist/rpc.d.cts.map +1 -1
  100. package/dist/rpc.d.mts +12 -12
  101. package/dist/rpc.d.mts.map +1 -1
  102. package/dist/rpc.mjs +2 -2
  103. package/dist/rpc.mjs.map +1 -1
  104. package/dist/sol/types.cjs +1 -2
  105. package/dist/sol/types.cjs.map +1 -1
  106. package/dist/sol/types.d.cts.map +1 -1
  107. package/dist/sol/types.d.mts.map +1 -1
  108. package/dist/sol/types.mjs +1 -2
  109. package/dist/sol/types.mjs.map +1 -1
  110. package/dist/trx/types.cjs +1 -2
  111. package/dist/trx/types.cjs.map +1 -1
  112. package/dist/trx/types.d.cts.map +1 -1
  113. package/dist/trx/types.d.mts.map +1 -1
  114. package/dist/trx/types.mjs +1 -2
  115. package/dist/trx/types.mjs.map +1 -1
  116. package/dist/v2/api/create-account/index.d.cts +1 -1
  117. package/dist/v2/api/create-account/index.d.mts +1 -1
  118. package/dist/v2/api/create-account/private-key.cjs +1 -1
  119. package/dist/v2/api/create-account/private-key.cjs.map +1 -1
  120. package/dist/v2/api/create-account/private-key.d.cts +3 -2
  121. package/dist/v2/api/create-account/private-key.d.cts.map +1 -1
  122. package/dist/v2/api/create-account/private-key.d.mts +3 -2
  123. package/dist/v2/api/create-account/private-key.d.mts.map +1 -1
  124. package/dist/v2/api/create-account/private-key.mjs +2 -2
  125. package/dist/v2/api/create-account/private-key.mjs.map +1 -1
  126. package/dist/v2/api/export-account/index.d.cts +9 -4
  127. package/dist/v2/api/export-account/index.d.cts.map +1 -1
  128. package/dist/v2/api/export-account/index.d.mts +9 -4
  129. package/dist/v2/api/export-account/index.d.mts.map +1 -1
  130. package/dist/v2/api/export-account/private-key.cjs +1 -1
  131. package/dist/v2/api/export-account/private-key.cjs.map +1 -1
  132. package/dist/v2/api/export-account/private-key.d.cts +6 -4
  133. package/dist/v2/api/export-account/private-key.d.cts.map +1 -1
  134. package/dist/v2/api/export-account/private-key.d.mts +6 -4
  135. package/dist/v2/api/export-account/private-key.d.mts.map +1 -1
  136. package/dist/v2/api/export-account/private-key.mjs +2 -2
  137. package/dist/v2/api/export-account/private-key.mjs.map +1 -1
  138. package/dist/v2/api/keyring-capabilities.cjs +5 -0
  139. package/dist/v2/api/keyring-capabilities.cjs.map +1 -1
  140. package/dist/v2/api/keyring-capabilities.d.cts +19 -10
  141. package/dist/v2/api/keyring-capabilities.d.cts.map +1 -1
  142. package/dist/v2/api/keyring-capabilities.d.mts +19 -10
  143. package/dist/v2/api/keyring-capabilities.d.mts.map +1 -1
  144. package/dist/v2/api/keyring-capabilities.mjs +5 -0
  145. package/dist/v2/api/keyring-capabilities.mjs.map +1 -1
  146. package/dist/v2/api/keyring-rpc.cjs +10 -10
  147. package/dist/v2/api/keyring-rpc.cjs.map +1 -1
  148. package/dist/v2/api/keyring-rpc.d.cts +12 -10
  149. package/dist/v2/api/keyring-rpc.d.cts.map +1 -1
  150. package/dist/v2/api/keyring-rpc.d.mts +12 -10
  151. package/dist/v2/api/keyring-rpc.d.mts.map +1 -1
  152. package/dist/v2/api/keyring-rpc.mjs +2 -2
  153. package/dist/v2/api/keyring-rpc.mjs.map +1 -1
  154. package/dist/v2/api/keyring-snap-rpc.cjs +14 -1
  155. package/dist/v2/api/keyring-snap-rpc.cjs.map +1 -1
  156. package/dist/v2/api/keyring-snap-rpc.d.cts +62 -8
  157. package/dist/v2/api/keyring-snap-rpc.d.cts.map +1 -1
  158. package/dist/v2/api/keyring-snap-rpc.d.mts +62 -8
  159. package/dist/v2/api/keyring-snap-rpc.d.mts.map +1 -1
  160. package/dist/v2/api/keyring-snap-rpc.mjs +16 -3
  161. package/dist/v2/api/keyring-snap-rpc.mjs.map +1 -1
  162. package/dist/v2/api/private-key.cjs +5 -0
  163. package/dist/v2/api/private-key.cjs.map +1 -1
  164. package/dist/v2/api/private-key.d.cts +13 -6
  165. package/dist/v2/api/private-key.d.cts.map +1 -1
  166. package/dist/v2/api/private-key.d.mts +13 -6
  167. package/dist/v2/api/private-key.d.mts.map +1 -1
  168. package/dist/v2/api/private-key.mjs +5 -0
  169. package/dist/v2/api/private-key.mjs.map +1 -1
  170. package/dist/xlm/types.cjs +1 -2
  171. package/dist/xlm/types.cjs.map +1 -1
  172. package/dist/xlm/types.d.cts.map +1 -1
  173. package/dist/xlm/types.d.mts.map +1 -1
  174. package/dist/xlm/types.mjs +1 -2
  175. package/dist/xlm/types.mjs.map +1 -1
  176. package/package.json +3 -3
@@ -15,11 +15,11 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
15
15
  };
16
16
  privateKey?: {
17
17
  importFormats?: {
18
- encoding: "hexadecimal" | "base58";
18
+ encoding: "hexadecimal" | "base58" | "base32";
19
19
  type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
20
20
  }[];
21
21
  exportFormats?: {
22
- encoding: "hexadecimal" | "base58";
22
+ encoding: "hexadecimal" | "base58" | "base32";
23
23
  }[];
24
24
  };
25
25
  snap?: {
@@ -29,6 +29,7 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
29
29
  };
30
30
  transactions?: boolean;
31
31
  selectedAccounts?: boolean;
32
+ resolveAccountAddress?: boolean;
32
33
  };
33
34
  }, {
34
35
  /**
@@ -66,26 +67,27 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
66
67
  */
67
68
  privateKey: import("@metamask/superstruct").ExactOptionalStruct<{
68
69
  importFormats?: {
69
- encoding: "hexadecimal" | "base58";
70
+ encoding: "hexadecimal" | "base58" | "base32";
70
71
  type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
71
72
  }[];
72
73
  exportFormats?: {
73
- encoding: "hexadecimal" | "base58";
74
+ encoding: "hexadecimal" | "base58" | "base32";
74
75
  }[];
75
76
  }, {
76
77
  /**
77
78
  * List of supported formats for importing private keys.
78
79
  */
79
80
  importFormats: import("@metamask/superstruct").ExactOptionalStruct<{
80
- encoding: "hexadecimal" | "base58";
81
+ encoding: "hexadecimal" | "base58" | "base32";
81
82
  type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
82
83
  }[], import("@metamask/superstruct").Struct<{
83
- encoding: "hexadecimal" | "base58";
84
+ encoding: "hexadecimal" | "base58" | "base32";
84
85
  type?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
85
86
  }, {
86
- encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
87
+ encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58" | "base32", {
87
88
  hexadecimal: "hexadecimal";
88
89
  base58: "base58";
90
+ base32: "base32";
89
91
  }>;
90
92
  type: import("@metamask/superstruct").ExactOptionalStruct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account", {
91
93
  "eip155:eoa": "eip155:eoa";
@@ -104,13 +106,14 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
104
106
  * List of supported formats for exporting private keys.
105
107
  */
106
108
  exportFormats: import("@metamask/superstruct").ExactOptionalStruct<{
107
- encoding: "hexadecimal" | "base58";
109
+ encoding: "hexadecimal" | "base58" | "base32";
108
110
  }[], import("@metamask/superstruct").Struct<{
109
- encoding: "hexadecimal" | "base58";
111
+ encoding: "hexadecimal" | "base58" | "base32";
110
112
  }, {
111
- encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
113
+ encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58" | "base32", {
112
114
  hexadecimal: "hexadecimal";
113
115
  base58: "base58";
116
+ base32: "base32";
114
117
  }>;
115
118
  }>>;
116
119
  }>;
@@ -138,6 +141,7 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
138
141
  };
139
142
  transactions?: boolean;
140
143
  selectedAccounts?: boolean;
144
+ resolveAccountAddress?: boolean;
141
145
  }, {
142
146
  /**
143
147
  * Asset-related capabilities.
@@ -167,6 +171,11 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
167
171
  * (`keyring_setSelectedAccounts`).
168
172
  */
169
173
  selectedAccounts: import("@metamask/superstruct").ExactOptionalStruct<boolean, null>;
174
+ /**
175
+ * Whether the keyring supports resolving the account address to use for
176
+ * routing a signing request (`keyring_resolveAccountAddress`).
177
+ */
178
+ resolveAccountAddress: import("@metamask/superstruct").ExactOptionalStruct<boolean, null>;
170
179
  }>;
171
180
  }>;
172
181
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-capabilities.d.mts","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAQnD;;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;;;;;;IAQH;;;;OAIG;;;;;;;;;QAGC;;WAEG;;;;;YAGC;;;eAGG;;YAEH;;;eAGG;;;QAIP;;;WAGG;;QAEH;;;WAGG;;;EAIP,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
1
+ {"version":3,"file":"keyring-capabilities.d.mts","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAQnD;;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;;;;;;IAQH;;;;OAIG;;;;;;;;;;QAGC;;WAEG;;;;;YAGC;;;eAGG;;YAEH;;;eAGG;;;QAIP;;;WAGG;;QAEH;;;WAGG;;QAEH;;;WAGG;;;EAIP,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -84,6 +84,11 @@ export const KeyringCapabilitiesStruct = object({
84
84
  * (`keyring_setSelectedAccounts`).
85
85
  */
86
86
  selectedAccounts: exactOptional(boolean()),
87
+ /**
88
+ * Whether the keyring supports resolving the account address to use for
89
+ * routing a signing request (`keyring_resolveAccountAddress`).
90
+ */
91
+ resolveAccountAddress: exactOptional(boolean()),
87
92
  })),
88
93
  });
89
94
  //# sourceMappingURL=keyring-capabilities.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-capabilities.mjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,EACN,OAAO,EACR,8BAA8B;AAG/B,OAAO,EAAE,iBAAiB,EAAE,2BAAuB;AACnD,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,0BAAsB;AAEvB;;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;IACD;;;;OAIG;IACH,IAAI,EAAE,aAAa,CACjB,MAAM,CAAC;QACL;;WAEG;QACH,MAAM,EAAE,aAAa,CACnB,MAAM,CAAC;YACL;;;eAGG;YACH,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;YAClC;;;eAGG;YACH,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;SACnC,CAAC,CACH;QACD;;;WAGG;QACH,YAAY,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACtC;;;WAGG;QACH,gBAAgB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KAC3C,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n partial,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\n\nimport { CaipChainIdStruct } from '../../api/caip';\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\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 Keyring 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 * Snap-specific capabilities supported by this keyring.\n *\n * Each flag maps to a Snap keyring RPC method that the Snap implements.\n */\n snap: exactOptional(\n object({\n /**\n * Asset-related capabilities.\n */\n assets: exactOptional(\n object({\n /**\n * Whether the keyring supports getting account assets\n * (`keyring_getAccountAssets`).\n */\n metadata: exactOptional(boolean()),\n /**\n * Whether the keyring supports getting account balances\n * (`keyring_getAccountBalances`).\n */\n balances: exactOptional(boolean()),\n }),\n ),\n /**\n * Whether the keyring supports getting account transactions\n * (`keyring_getAccountTransactions`).\n */\n transactions: exactOptional(boolean()),\n /**\n * Whether the keyring supports receiving selected accounts notifications\n * (`keyring_setSelectedAccounts`).\n */\n selectedAccounts: exactOptional(boolean()),\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
+ {"version":3,"file":"keyring-capabilities.mjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names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C,CAAC,CACH;QACD;;;WAGG;QACH,YAAY,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACtC;;;WAGG;QACH,gBAAgB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1C;;;WAGG;QACH,qBAAqB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KAChD,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n partial,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\n\nimport { CaipChainIdStruct } from '../../api/caip';\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\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 Keyring 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 * Snap-specific capabilities supported by this keyring.\n *\n * Each flag maps to a Snap keyring RPC method that the Snap implements.\n */\n snap: exactOptional(\n object({\n /**\n * Asset-related capabilities.\n */\n assets: exactOptional(\n object({\n /**\n * Whether the keyring supports getting account assets\n * (`keyring_getAccountAssets`).\n */\n metadata: exactOptional(boolean()),\n /**\n * Whether the keyring supports getting account balances\n * (`keyring_getAccountBalances`).\n */\n balances: exactOptional(boolean()),\n }),\n ),\n /**\n * Whether the keyring supports getting account transactions\n * (`keyring_getAccountTransactions`).\n */\n transactions: exactOptional(boolean()),\n /**\n * Whether the keyring supports receiving selected accounts notifications\n * (`keyring_setSelectedAccounts`).\n */\n selectedAccounts: exactOptional(boolean()),\n /**\n * Whether the keyring supports resolving the account address to use for\n * routing a signing request (`keyring_resolveAccountAddress`).\n */\n resolveAccountAddress: exactOptional(boolean()),\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"]}
@@ -38,24 +38,24 @@ const CommonHeader = {
38
38
  };
39
39
  // ----------------------------------------------------------------------------
40
40
  // Get accounts
41
- exports.GetAccountsRequestStruct = (0, keyring_utils_1.object)({
41
+ exports.GetAccountsRequestStruct = (0, superstruct_1.object)({
42
42
  ...CommonHeader,
43
43
  method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.GetAccounts}`),
44
44
  });
45
45
  exports.GetAccountsResponseStruct = (0, superstruct_1.array)(account_1.KeyringAccountStruct);
46
46
  // ----------------------------------------------------------------------------
47
47
  // Get account
48
- exports.GetAccountRequestStruct = (0, keyring_utils_1.object)({
48
+ exports.GetAccountRequestStruct = (0, superstruct_1.object)({
49
49
  ...CommonHeader,
50
50
  method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.GetAccount}`),
51
- params: (0, keyring_utils_1.object)({
51
+ params: (0, superstruct_1.object)({
52
52
  id: keyring_utils_1.UuidStruct,
53
53
  }),
54
54
  });
55
55
  exports.GetAccountResponseStruct = account_1.KeyringAccountStruct;
56
56
  // ----------------------------------------------------------------------------
57
57
  // Create accounts
58
- exports.CreateAccountsRequestStruct = (0, keyring_utils_1.object)({
58
+ exports.CreateAccountsRequestStruct = (0, superstruct_1.object)({
59
59
  ...CommonHeader,
60
60
  method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.CreateAccounts}`),
61
61
  params: create_account_1.CreateAccountOptionsStruct,
@@ -63,28 +63,28 @@ exports.CreateAccountsRequestStruct = (0, keyring_utils_1.object)({
63
63
  exports.CreateAccountsResponseStruct = (0, superstruct_1.array)(account_1.KeyringAccountStruct);
64
64
  // ----------------------------------------------------------------------------
65
65
  // Delete account
66
- exports.DeleteAccountRequestStruct = (0, keyring_utils_1.object)({
66
+ exports.DeleteAccountRequestStruct = (0, superstruct_1.object)({
67
67
  ...CommonHeader,
68
68
  method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.DeleteAccount}`),
69
- params: (0, keyring_utils_1.object)({
69
+ params: (0, superstruct_1.object)({
70
70
  id: keyring_utils_1.UuidStruct,
71
71
  }),
72
72
  });
73
73
  exports.DeleteAccountResponseStruct = (0, superstruct_1.literal)(null);
74
74
  // ----------------------------------------------------------------------------
75
75
  // Export account
76
- exports.ExportAccountRequestStruct = (0, keyring_utils_1.object)({
76
+ exports.ExportAccountRequestStruct = (0, superstruct_1.object)({
77
77
  ...CommonHeader,
78
78
  method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.ExportAccount}`),
79
- params: (0, keyring_utils_1.object)({
79
+ params: (0, superstruct_1.object)({
80
80
  id: keyring_utils_1.UuidStruct,
81
- options: (0, keyring_utils_1.exactOptional)(export_account_1.ExportAccountOptionsStruct),
81
+ options: (0, superstruct_1.exactOptional)(export_account_1.ExportAccountOptionsStruct),
82
82
  }),
83
83
  });
84
84
  exports.ExportAccountResponseStruct = export_account_1.PrivateKeyExportedAccountStruct;
85
85
  // ----------------------------------------------------------------------------
86
86
  // Submit request
87
- exports.SubmitRequestRequestStruct = (0, keyring_utils_1.object)({
87
+ exports.SubmitRequestRequestStruct = (0, superstruct_1.object)({
88
88
  ...CommonHeader,
89
89
  method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.SubmitRequest}`),
90
90
  params: request_1.KeyringRequestStruct,
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-rpc.cjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-rpc.ts"],"names":[],"mappings":";;;AAAA,2DAA4E;AAE5E,uDAA8E;AAC9E,2CAA6C;AAE7C,mDAAyD;AACzD,mDAAyD;AACzD,+DAA8D;AAC9D,+DAG0B;AAgB1B;;GAEG;AACU,QAAA,gBAAgB,GAAG;IAC9B,WAAW,EAAE,qBAAqB;IAClC,cAAc,EAAE,wBAAwB;IACxC,2DAA2D;IAC3D,6DAA6D;IAC7D,UAAU,EAAE,oBAAoB;IAChC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;CAC9B,CAAC;AAQX;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,wBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC;AAFD,gDAEC;AAED,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAA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,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC;AAIzD,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,wBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,OAAO,EAAE,IAAA,6BAAa,EAAC,2CAA0B,CAAC;KACnD,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,gDAA+B,CAAC;AAI3E,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,wBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,8BAAoB;CAC7B,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,kBAAU,CAAC","sourcesContent":["import { object, exactOptional, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, literal, number, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../../api/account';\nimport { KeyringRequestStruct } from '../../api/request';\nimport { CreateAccountOptionsStruct } from './create-account';\nimport {\n ExportAccountOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './export-account';\nimport type { Keyring } from './keyring';\n\n/**\n * Keyring interface for keyring methods that can be invoked through\n * RPC calls.\n */\nexport type KeyringRpc = {\n getAccount: Keyring['getAccount'];\n getAccounts: Keyring['getAccounts'];\n createAccounts: Keyring['createAccounts'];\n deleteAccount: Keyring['deleteAccount'];\n submitRequest: Keyring['submitRequest'];\n exportAccount?: Keyring['exportAccount'];\n};\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport const KeyringRpcMethod = {\n GetAccounts: 'keyring_getAccounts',\n CreateAccounts: 'keyring_createAccounts',\n // Inherited from v1 (but method signatures may differ...):\n // NOTE: We use literals here to avoid circular dependencies.\n GetAccount: 'keyring_getAccount',\n DeleteAccount: 'keyring_deleteAccount',\n ExportAccount: 'keyring_exportAccount',\n SubmitRequest: 'keyring_submitRequest',\n} as const;\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport type KeyringRpcMethod =\n (typeof KeyringRpcMethod)[keyof typeof KeyringRpcMethod];\n\n/**\n * Check if a method is a keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method (v2).\n */\nexport function isKeyringRpcMethod(method: string): method is KeyringRpcMethod {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Get accounts\n\nexport const GetAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccounts}`),\n});\n\nexport type GetAccountsRequest = Infer<typeof GetAccountsRequestStruct>;\n\nexport const GetAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type GetAccountsResponse = Infer<typeof GetAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create accounts\n\nexport const CreateAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.CreateAccounts}`),\n params: CreateAccountOptionsStruct,\n});\n\nexport type CreateAccountsRequest = Infer<typeof CreateAccountsRequestStruct>;\n\nexport const CreateAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type CreateAccountsResponse = Infer<typeof CreateAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.DeleteAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.ExportAccount}`),\n params: object({\n id: UuidStruct,\n options: exactOptional(ExportAccountOptionsStruct),\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = PrivateKeyExportedAccountStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.SubmitRequest}`),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = JsonStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Keyring RPC requests.\n */\nexport type KeyringRpcRequests =\n | GetAccountsRequest\n | GetAccountRequest\n | CreateAccountsRequest\n | DeleteAccountRequest\n | ExportAccountRequest\n | SubmitRequestRequest;\n\n/**\n * Extract the proper request type for a given `KeyringRpcMethod`.\n */\nexport type KeyringRpcRequest<RpcMethod extends KeyringRpcMethod> = Ext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A,oBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,wBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,8BAAoB;CAC7B,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,kBAAU,CAAC","sourcesContent":["import { UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n exactOptional,\n literal,\n number,\n object,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../../api/account';\nimport { KeyringRequestStruct } from '../../api/request';\nimport { CreateAccountOptionsStruct } from './create-account';\nimport {\n ExportAccountOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './export-account';\nimport type { Keyring } from './keyring';\n\n/**\n * Keyring interface for keyring methods that can be invoked through\n * RPC calls.\n */\nexport type KeyringRpc = {\n getAccount: Keyring['getAccount'];\n getAccounts: Keyring['getAccounts'];\n createAccounts: Keyring['createAccounts'];\n deleteAccount: Keyring['deleteAccount'];\n submitRequest: Keyring['submitRequest'];\n exportAccount?: Keyring['exportAccount'];\n};\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport const KeyringRpcMethod = {\n GetAccounts: 'keyring_getAccounts',\n CreateAccounts: 'keyring_createAccounts',\n // Inherited from v1 (but method signatures may differ...):\n // NOTE: We use literals here to avoid circular dependencies.\n GetAccount: 'keyring_getAccount',\n DeleteAccount: 'keyring_deleteAccount',\n ExportAccount: 'keyring_exportAccount',\n SubmitRequest: 'keyring_submitRequest',\n} as const;\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport type KeyringRpcMethod =\n (typeof KeyringRpcMethod)[keyof typeof KeyringRpcMethod];\n\n/**\n * Check if a method is a keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method (v2).\n */\nexport function isKeyringRpcMethod(method: string): method is KeyringRpcMethod {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Get accounts\n\nexport const GetAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccounts}`),\n});\n\nexport type GetAccountsRequest = Infer<typeof GetAccountsRequestStruct>;\n\nexport const GetAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type GetAccountsResponse = Infer<typeof GetAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create accounts\n\nexport const CreateAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.CreateAccounts}`),\n params: CreateAccountOptionsStruct,\n});\n\nexport type CreateAccountsRequest = Infer<typeof CreateAccountsRequestStruct>;\n\nexport const CreateAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type CreateAccountsResponse = Infer<typeof CreateAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.DeleteAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.ExportAccount}`),\n params: object({\n id: UuidStruct,\n options: exactOptional(ExportAccountOptionsStruct),\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = PrivateKeyExportedAccountStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.SubmitRequest}`),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = JsonStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Keyring RPC requests.\n */\nexport type KeyringRpcRequests =\n | GetAccountsRequest\n | GetAccountRequest\n | CreateAccountsRequest\n | DeleteAccountRequest\n | ExportAccountRequest\n | SubmitRequestRequest;\n\n/**\n * Extract the proper request type for a given `KeyringRpcMethod`.\n */\nexport type KeyringRpcRequest<RpcMethod extends KeyringRpcMethod> = Extract<\n KeyringRpcRequests,\n { method: `${RpcMethod}` }\n>;\n"]}
@@ -210,7 +210,7 @@ export declare const CreateAccountsRequestStruct: import("@metamask/superstruct"
210
210
  type: "custom";
211
211
  } | {
212
212
  type: "private-key:import";
213
- encoding: "hexadecimal" | "base58";
213
+ encoding: "hexadecimal" | "base58" | "base32";
214
214
  privateKey: string;
215
215
  accountType?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
216
216
  };
@@ -239,7 +239,7 @@ export declare const CreateAccountsRequestStruct: import("@metamask/superstruct"
239
239
  type: "custom";
240
240
  } | {
241
241
  type: "private-key:import";
242
- encoding: "hexadecimal" | "base58";
242
+ encoding: "hexadecimal" | "base58" | "base32";
243
243
  privateKey: string;
244
244
  accountType?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
245
245
  }, null>;
@@ -345,7 +345,7 @@ export declare const ExportAccountRequestStruct: import("@metamask/superstruct")
345
345
  id: string;
346
346
  options?: {
347
347
  type: "private-key";
348
- encoding: "hexadecimal" | "base58";
348
+ encoding: "hexadecimal" | "base58" | "base32";
349
349
  };
350
350
  };
351
351
  }, {
@@ -354,18 +354,19 @@ export declare const ExportAccountRequestStruct: import("@metamask/superstruct")
354
354
  id: string;
355
355
  options?: {
356
356
  type: "private-key";
357
- encoding: "hexadecimal" | "base58";
357
+ encoding: "hexadecimal" | "base58" | "base32";
358
358
  };
359
359
  }, {
360
360
  id: import("@metamask/superstruct").Struct<string, null>;
361
- options: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
361
+ options: import("@metamask/superstruct").ExactOptionalStruct<{
362
362
  type: "private-key";
363
- encoding: "hexadecimal" | "base58";
363
+ encoding: "hexadecimal" | "base58" | "base32";
364
364
  }, {
365
365
  type: import("@metamask/superstruct").Struct<"private-key", "private-key">;
366
- encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
366
+ encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58" | "base32", {
367
367
  hexadecimal: "hexadecimal";
368
368
  base58: "base58";
369
+ base32: "base32";
369
370
  }>;
370
371
  }>;
371
372
  }>;
@@ -375,14 +376,15 @@ export declare const ExportAccountRequestStruct: import("@metamask/superstruct")
375
376
  export type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;
376
377
  export declare const ExportAccountResponseStruct: import("@metamask/superstruct").Struct<{
377
378
  type: "private-key";
378
- encoding: "hexadecimal" | "base58";
379
+ encoding: "hexadecimal" | "base58" | "base32";
379
380
  privateKey: string;
380
381
  }, {
381
382
  type: import("@metamask/superstruct").Struct<"private-key", "private-key">;
382
383
  privateKey: import("@metamask/superstruct").Struct<string, null>;
383
- encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
384
+ encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58" | "base32", {
384
385
  hexadecimal: "hexadecimal";
385
386
  base58: "base58";
387
+ base32: "base32";
386
388
  }>;
387
389
  }>;
388
390
  export type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;
@@ -421,7 +423,7 @@ export declare const SubmitRequestRequestStruct: import("@metamask/superstruct")
421
423
  params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
422
424
  }, {
423
425
  method: import("@metamask/superstruct").Struct<string, null>;
424
- params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
426
+ params: import("@metamask/superstruct").ExactOptionalStruct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[], null>;
425
427
  }>;
426
428
  }>;
427
429
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-rpc.d.cts","sourceRoot":"","sources":["../../../src/v2/api/keyring-rpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAWnD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AAEzC;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACpC,cAAc,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC1C,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACxC,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAC1C,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AC;AAI9E;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,kBAAkB,GAClB,iBAAiB,GACjB,qBAAqB,GACrB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,SAAS,SAAS,gBAAgB,IAAI,OAAO,CACzE,kBAAkB,EAClB;IAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAA;CAAE,CAC3B,CAAC"}
@@ -210,7 +210,7 @@ export declare const CreateAccountsRequestStruct: import("@metamask/superstruct"
210
210
  type: "custom";
211
211
  } | {
212
212
  type: "private-key:import";
213
- encoding: "hexadecimal" | "base58";
213
+ encoding: "hexadecimal" | "base58" | "base32";
214
214
  privateKey: string;
215
215
  accountType?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
216
216
  };
@@ -239,7 +239,7 @@ export declare const CreateAccountsRequestStruct: import("@metamask/superstruct"
239
239
  type: "custom";
240
240
  } | {
241
241
  type: "private-key:import";
242
- encoding: "hexadecimal" | "base58";
242
+ encoding: "hexadecimal" | "base58" | "base32";
243
243
  privateKey: string;
244
244
  accountType?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "stellar:account" | "any:account";
245
245
  }, null>;
@@ -345,7 +345,7 @@ export declare const ExportAccountRequestStruct: import("@metamask/superstruct")
345
345
  id: string;
346
346
  options?: {
347
347
  type: "private-key";
348
- encoding: "hexadecimal" | "base58";
348
+ encoding: "hexadecimal" | "base58" | "base32";
349
349
  };
350
350
  };
351
351
  }, {
@@ -354,18 +354,19 @@ export declare const ExportAccountRequestStruct: import("@metamask/superstruct")
354
354
  id: string;
355
355
  options?: {
356
356
  type: "private-key";
357
- encoding: "hexadecimal" | "base58";
357
+ encoding: "hexadecimal" | "base58" | "base32";
358
358
  };
359
359
  }, {
360
360
  id: import("@metamask/superstruct").Struct<string, null>;
361
- options: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
361
+ options: import("@metamask/superstruct").ExactOptionalStruct<{
362
362
  type: "private-key";
363
- encoding: "hexadecimal" | "base58";
363
+ encoding: "hexadecimal" | "base58" | "base32";
364
364
  }, {
365
365
  type: import("@metamask/superstruct").Struct<"private-key", "private-key">;
366
- encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
366
+ encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58" | "base32", {
367
367
  hexadecimal: "hexadecimal";
368
368
  base58: "base58";
369
+ base32: "base32";
369
370
  }>;
370
371
  }>;
371
372
  }>;
@@ -375,14 +376,15 @@ export declare const ExportAccountRequestStruct: import("@metamask/superstruct")
375
376
  export type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;
376
377
  export declare const ExportAccountResponseStruct: import("@metamask/superstruct").Struct<{
377
378
  type: "private-key";
378
- encoding: "hexadecimal" | "base58";
379
+ encoding: "hexadecimal" | "base58" | "base32";
379
380
  privateKey: string;
380
381
  }, {
381
382
  type: import("@metamask/superstruct").Struct<"private-key", "private-key">;
382
383
  privateKey: import("@metamask/superstruct").Struct<string, null>;
383
- encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
384
+ encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58" | "base32", {
384
385
  hexadecimal: "hexadecimal";
385
386
  base58: "base58";
387
+ base32: "base32";
386
388
  }>;
387
389
  }>;
388
390
  export type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;
@@ -421,7 +423,7 @@ export declare const SubmitRequestRequestStruct: import("@metamask/superstruct")
421
423
  params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
422
424
  }, {
423
425
  method: import("@metamask/superstruct").Struct<string, null>;
424
- params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
426
+ params: import("@metamask/superstruct").ExactOptionalStruct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[], null>;
425
427
  }>;
426
428
  }>;
427
429
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-rpc.d.mts","sourceRoot":"","sources":["../../../src/v2/api/keyring-rpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAWnD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AAEzC;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACpC,cAAc,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC1C,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACxC,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;CASnB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,gBAAgB,CAE7E;AAYD,eAAO,MAAM,wBAAwB;;;;;;;;EAGnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAExE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;EAMrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,oDAAgB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAK9E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;EAAkC,CAAC;AAE3E,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAK9E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,iFAAa,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAI9E;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,kBAAkB,GAClB,iBAAiB,GACjB,qBAAqB,GACrB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,SAAS,SAAS,gBAAgB,IAAI,OAAO,CACzE,kBAAkB,EAClB;IAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAA;CAAE,CAC3B,CAAC"}
@@ -1,5 +1,5 @@
1
- import { object, exactOptional, UuidStruct } from "@metamask/keyring-utils";
2
- import { array, literal, number, string, union } from "@metamask/superstruct";
1
+ import { UuidStruct } from "@metamask/keyring-utils";
2
+ import { array, exactOptional, literal, number, object, string, union } from "@metamask/superstruct";
3
3
  import { JsonStruct } from "@metamask/utils";
4
4
  import { KeyringAccountStruct } from "../../api/account.mjs";
5
5
  import { KeyringRequestStruct } from "../../api/request.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-rpc.mjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,gCAAgC;AAE5E,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;AAC9E,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,oBAAoB,EAAE,8BAA0B;AACzD,OAAO,EAAE,oBAAoB,EAAE,8BAA0B;AACzD,OAAO,EAAE,0BAA0B,EAAE,mCAAyB;AAC9D,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAChC,mCAAyB;AAgB1B;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,WAAW,EAAE,qBAAqB;IAClC,cAAc,EAAE,wBAAwB;IACxC,2DAA2D;IAC3D,6DAA6D;IAC7D,UAAU,EAAE,oBAAoB;IAChC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;CAC9B,CAAC;AAQX;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC;AAED,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;IACvB,EAAE,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,eAAe;AAEf,MAAM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AE,OAAO,CAAC,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;QACd,OAAO,EAAE,aAAa,CAAC,0BAA0B,CAAC;KACnD,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,+BAA+B,CAAC;AAI3E,+EAA+E;AAC/E,iBAAiB;AAEjB,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CAAC","sourcesContent":["import { object, exactOptional, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, literal, number, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../../api/account';\nimport { KeyringRequestStruct } from '../../api/request';\nimport { CreateAccountOptionsStruct } from './create-account';\nimport {\n ExportAccountOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './export-account';\nimport type { Keyring } from './keyring';\n\n/**\n * Keyring interface for keyring methods that can be invoked through\n * RPC calls.\n */\nexport type KeyringRpc = {\n getAccount: Keyring['getAccount'];\n getAccounts: Keyring['getAccounts'];\n createAccounts: Keyring['createAccounts'];\n deleteAccount: Keyring['deleteAccount'];\n submitRequest: Keyring['submitRequest'];\n exportAccount?: Keyring['exportAccount'];\n};\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport const KeyringRpcMethod = {\n GetAccounts: 'keyring_getAccounts',\n CreateAccounts: 'keyring_createAccounts',\n // Inherited from v1 (but method signatures may differ...):\n // NOTE: We use literals here to avoid circular dependencies.\n GetAccount: 'keyring_getAccount',\n DeleteAccount: 'keyring_deleteAccount',\n ExportAccount: 'keyring_exportAccount',\n SubmitRequest: 'keyring_submitRequest',\n} as const;\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport type KeyringRpcMethod =\n (typeof KeyringRpcMethod)[keyof typeof KeyringRpcMethod];\n\n/**\n * Check if a method is a keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method (v2).\n */\nexport function isKeyringRpcMethod(method: string): method is KeyringRpcMethod {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Get accounts\n\nexport const GetAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccounts}`),\n});\n\nexport type GetAccountsRequest = Infer<typeof GetAccountsRequestStruct>;\n\nexport const GetAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type GetAccountsResponse = Infer<typeof GetAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create accounts\n\nexport const CreateAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.CreateAccounts}`),\n params: CreateAccountOptionsStruct,\n});\n\nexport type CreateAccountsRequest = Infer<typeof CreateAccountsRequestStruct>;\n\nexport const CreateAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type CreateAccountsResponse = Infer<typeof CreateAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.DeleteAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.ExportAccount}`),\n params: object({\n id: UuidStruct,\n options: exactOptional(ExportAccountOptionsStruct),\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = PrivateKeyExportedAccountStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.SubmitRequest}`),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = JsonStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Keyring RPC requests.\n */\nexport type KeyringRpcRequests =\n | GetAccountsRequest\n | GetAccountRequest\n | CreateAccountsRequest\n | DeleteAccountRequest\n | ExportAccountRequest\n | SubmitRequestRequest;\n\n/**\n * Extract the proper request type for a given `KeyringRpcMethod`.\n */\nexport type KeyringRpcRequest<RpcMethod extends KeyringRpcMethod> = Extract<\n KeyringRpcRequests,\n { method: `${RpcMethod}` }\n>;\n"]}
1
+ {"version":3,"file":"keyring-rpc.mjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gCAAgC;AAErD,OAAO,EACL,KAAK,EACL,aAAa,EACb,OAAO,EACP,M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AM,CAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CAAC","sourcesContent":["import { UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n exactOptional,\n literal,\n number,\n object,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../../api/account';\nimport { KeyringRequestStruct } from '../../api/request';\nimport { CreateAccountOptionsStruct } from './create-account';\nimport {\n ExportAccountOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './export-account';\nimport type { Keyring } from './keyring';\n\n/**\n * Keyring interface for keyring methods that can be invoked through\n * RPC calls.\n */\nexport type KeyringRpc = {\n getAccount: Keyring['getAccount'];\n getAccounts: Keyring['getAccounts'];\n createAccounts: Keyring['createAccounts'];\n deleteAccount: Keyring['deleteAccount'];\n submitRequest: Keyring['submitRequest'];\n exportAccount?: Keyring['exportAccount'];\n};\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport const KeyringRpcMethod = {\n GetAccounts: 'keyring_getAccounts',\n CreateAccounts: 'keyring_createAccounts',\n // Inherited from v1 (but method signatures may differ...):\n // NOTE: We use literals here to avoid circular dependencies.\n GetAccount: 'keyring_getAccount',\n DeleteAccount: 'keyring_deleteAccount',\n ExportAccount: 'keyring_exportAccount',\n SubmitRequest: 'keyring_submitRequest',\n} as const;\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport type KeyringRpcMethod =\n (typeof KeyringRpcMethod)[keyof typeof KeyringRpcMethod];\n\n/**\n * Check if a method is a keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method (v2).\n */\nexport function isKeyringRpcMethod(method: string): method is KeyringRpcMethod {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Get accounts\n\nexport const GetAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccounts}`),\n});\n\nexport type GetAccountsRequest = Infer<typeof GetAccountsRequestStruct>;\n\nexport const GetAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type GetAccountsResponse = Infer<typeof GetAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create accounts\n\nexport const CreateAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.CreateAccounts}`),\n params: CreateAccountOptionsStruct,\n});\n\nexport type CreateAccountsRequest = Infer<typeof CreateAccountsRequestStruct>;\n\nexport const CreateAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type CreateAccountsResponse = Infer<typeof CreateAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.DeleteAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.ExportAccount}`),\n params: object({\n id: UuidStruct,\n options: exactOptional(ExportAccountOptionsStruct),\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = PrivateKeyExportedAccountStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.SubmitRequest}`),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = JsonStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Keyring RPC requests.\n */\nexport type KeyringRpcRequests =\n | GetAccountsRequest\n | GetAccountRequest\n | CreateAccountsRequest\n | DeleteAccountRequest\n | ExportAccountRequest\n | SubmitRequestRequest;\n\n/**\n * Extract the proper request type for a given `KeyringRpcMethod`.\n */\nexport type KeyringRpcRequest<RpcMethod extends KeyringRpcMethod> = Extract<\n KeyringRpcRequests,\n { method: `${RpcMethod}` }\n>;\n"]}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.GetAccountAssetsResponseStruct = exports.GetAccountAssetsRequestStruct = exports.GetAccountTransactionsResponseStruct = exports.GetAccountTransactionsRequestStruct = exports.SetSelectedAccountsResponseStruct = exports.SetSelectedAccountsRequestStruct = exports.isKeyringSnapRpcMethod = exports.KeyringSnapRpcMethod = void 0;
3
+ exports.ResolveAccountAddressResponseStruct = exports.ResolveAccountAddressRequestStruct = exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.GetAccountAssetsResponseStruct = exports.GetAccountAssetsRequestStruct = exports.GetAccountTransactionsResponseStruct = exports.GetAccountTransactionsRequestStruct = exports.SetSelectedAccountsResponseStruct = exports.SetSelectedAccountsRequestStruct = exports.isKeyringSnapRpcMethod = exports.KeyringSnapRpcMethod = void 0;
4
4
  const keyring_utils_1 = require("@metamask/keyring-utils");
5
5
  const superstruct_1 = require("@metamask/superstruct");
6
+ const address_1 = require("../../api/address.cjs");
6
7
  const balance_1 = require("../../api/balance.cjs");
7
8
  const caip_1 = require("../../api/caip.cjs");
8
9
  const pagination_1 = require("../../api/pagination.cjs");
@@ -18,6 +19,7 @@ exports.KeyringSnapRpcMethod = {
18
19
  GetAccountTransactions: 'keyring_getAccountTransactions',
19
20
  GetAccountAssets: 'keyring_getAccountAssets',
20
21
  GetAccountBalances: 'keyring_getAccountBalances',
22
+ ResolveAccountAddress: 'keyring_resolveAccountAddress',
21
23
  };
22
24
  /**
23
25
  * Check if a method is a Snap keyring RPC method (v2).
@@ -76,4 +78,15 @@ exports.GetAccountBalancesRequestStruct = (0, superstruct_1.object)({
76
78
  }),
77
79
  });
78
80
  exports.GetAccountBalancesResponseStruct = (0, superstruct_1.record)(caip_1.CaipAssetTypeStruct, balance_1.BalanceStruct);
81
+ // ----------------------------------------------------------------------------
82
+ // Resolve account address
83
+ exports.ResolveAccountAddressRequestStruct = (0, superstruct_1.object)({
84
+ ...CommonHeader,
85
+ method: (0, superstruct_1.literal)(`${exports.KeyringSnapRpcMethod.ResolveAccountAddress}`),
86
+ params: (0, superstruct_1.object)({
87
+ scope: caip_1.CaipChainIdStruct,
88
+ request: keyring_utils_1.JsonRpcRequestStruct,
89
+ }),
90
+ });
91
+ exports.ResolveAccountAddressResponseStruct = (0, superstruct_1.nullable)(address_1.ResolvedAccountAddressStruct);
79
92
  //# sourceMappingURL=keyring-snap-rpc.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-snap-rpc.cjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-snap-rpc.ts"],"names":[],"mappings":";;;AACA,2DAAqD;AA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AAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,UAAU,EAAE,6BAAgB;KAC7B,CAAC;CACH,CAAC,CAAC;AAMU,QAAA,oCAAoC,GAAG,oCAAsB,CAAC;AAM3E,+EAA+E;AAC/E,qBAAqB;AAER,QAAA,6BAA6B,GAAG,IAAA,oBAAM,EAAC;IAClD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,4BAAoB,CAAC,gBAAgB,EAAE,CAAC;IAC3D,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAMU,QAAA,8BAA8B,GAAG,IAAA,mBAAK,EAAC,8BAAuB,CAAC,CAAC;AAM7E,+EAA+E;AAC/E,uBAAuB;AAEV,QAAA,+BAA+B,GAAG,IAAA,oBAAM,EAAC;IACpD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,4BAAoB,CAAC,kBAAkB,EAAE,CAAC;IAC7D,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,MAAM,EAAE,IAAA,mBAAK,EAAC,0BAAmB,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAMU,QAAA,gCAAgC,GAAG,IAAA,oBAAM,EACpD,0BAAmB,EACnB,uBAAa,CACd,CAAC","sourcesContent":["import type { AccountId } from '@metamask/keyring-utils';\nimport { UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n object,\n record,\n string,\n union,\n} from '@metamask/superstruct';\n\nimport { BalanceStruct } from '../../api/balance';\nimport type { Balance } from '../../api/balance';\nimport { CaipAssetTypeOrIdStruct, CaipAssetTypeStruct } from '../../api/caip';\nimport type { CaipAssetType, CaipAssetTypeOrId } from '../../api/caip';\nimport { PaginationStruct } from '../../api/pagination';\nimport type { Pagination } from '../../api/pagination';\nimport { TransactionsPageStruct } from '../../api/transaction';\nimport type { TransactionsPage } from '../../api/transaction';\nimport { KeyringRpcMethod } from './keyring-rpc';\nimport type { KeyringRpc, KeyringRpcRequests } from './keyring-rpc';\n\n/**\n * All keyring RPC methods available to a Snap - includes the base\n * {@link KeyringRpcMethod} set plus snap-specific extensions.\n */\nexport const KeyringSnapRpcMethod = {\n ...KeyringRpcMethod,\n SetSelectedAccounts: 'keyring_setSelectedAccounts',\n GetAccountTransactions: 'keyring_getAccountTransactions',\n GetAccountAssets: 'keyring_getAccountAssets',\n GetAccountBalances: 'keyring_getAccountBalances',\n} as const;\n\n/**\n * All keyring RPC methods available to a Snap.\n */\nexport type KeyringSnapRpcMethod =\n (typeof KeyringSnapRpcMethod)[keyof typeof KeyringSnapRpcMethod];\n\n/**\n * Check if a method is a Snap keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a Snap keyring RPC method (v2).\n */\nexport function isKeyringSnapRpcMethod(\n method: string,\n): method is KeyringSnapRpcMethod {\n return Object.values(KeyringSnapRpcMethod).includes(\n method as KeyringSnapRpcMethod,\n );\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Set selected accounts\n\nexport const SetSelectedAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.SetSelectedAccounts}`),\n params: object({\n accounts: array(string()),\n }),\n});\n\nexport type SetSelectedAccountsRequest = Infer<\n typeof SetSelectedAccountsRequestStruct\n>;\n\nexport const SetSelectedAccountsResponseStruct = literal(null);\n\nexport type SetSelectedAccountsResponse = Infer<\n typeof SetSelectedAccountsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account transactions\n\nexport const GetAccountTransactionsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountTransactions}`),\n params: object({\n id: UuidStruct,\n pagination: PaginationStruct,\n }),\n});\n\nexport type GetAccountTransactionsRequest = Infer<\n typeof GetAccountTransactionsRequestStruct\n>;\n\nexport const GetAccountTransactionsResponseStruct = TransactionsPageStruct;\n\nexport type GetAccountTransactionsResponse = Infer<\n typeof GetAccountTransactionsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account assets\n\nexport const GetAccountAssetsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountAssets}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountAssetsRequest = Infer<\n typeof GetAccountAssetsRequestStruct\n>;\n\nexport const GetAccountAssetsResponseStruct = array(CaipAssetTypeOrIdStruct);\n\nexport type GetAccountAssetsResponse = Infer<\n typeof GetAccountAssetsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * All keyring RPC requests available to a Snap - includes base\n * {@link KeyringRpcRequests} plus snap-specific request types.\n */\nexport type KeyringSnapRpcRequests =\n | KeyringRpcRequests\n | SetSelectedAccountsRequest\n | GetAccountTransactionsRequest\n | GetAccountAssetsRequest\n | GetAccountBalancesRequest;\n\n/**\n * Extract the proper request type for a given {@link KeyringSnapRpcMethod}.\n */\nexport type KeyringSnapRpcRequest<RpcMethod extends KeyringSnapRpcMethod> =\n Extract<KeyringSnapRpcRequests, { method: `${RpcMethod}` }>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Snap keyring RPC interface - extends the base {@link KeyringRpc} with\n * optional snap-specific methods that a Snap may expose.\n */\nexport type KeyringSnapRpc = KeyringRpc & {\n /**\n * Notify the Snap of the currently selected accounts.\n * Maps to `keyring_setSelectedAccounts`.\n */\n setSelectedAccounts?: (accounts: AccountId[]) => Promise<void>;\n\n /**\n * Get transactions for an account with pagination.\n * Maps to `keyring_getAccountTransactions`.\n */\n getAccountTransactions?: (\n id: AccountId,\n pagination: Pagination,\n ) => Promise<TransactionsPage>;\n\n /**\n * Get the asset types supported by an account.\n * Maps to `keyring_getAccountAssets`.\n */\n getAccountAssets?: (id: AccountId) => Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Get balances for an account for the requested asset types.\n * Maps to `keyring_getAccountBalances`.\n */\n getAccountBalances?: (\n id: AccountId,\n assets: CaipAssetType[],\n ) => Promise<Record<CaipAssetType, Balance>>;\n};\n"]}
1
+ {"version":3,"file":"keyring-snap-rpc.cjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-snap-rpc.ts"],"names":[],"mappings":";;;AACA,2DAA2E;AAE3E,uDAS+B;AAE/B,mDAAiE;AAEjE,mDAAkD;AAElD,6CAIwB;AAMxB,yDAAwD;AAExD,2DAA+D;AAE/D,mDAAiD;AAGjD;;;GAGG;AACU,QAAA,oBAAoB,GAAG;IAClC,GAAG,8BAAgB;IACnB,mBAAmB,EAAE,6BAA6B;IAClD,sBAAsB,EAAE,gCAAgC;IACxD,gBAAgB,EAAE,0BAA0B;IAC5C,kBAAkB,EAAE,4BAA4B;IAChD,qBAAqB,EAAE,+BAA+B;CAC9C,CAAC;AAQX;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,MAAc;IAEd,OAAO,MAAM,CAAC,MAAM,CAAC,4BAAoB,CAAC,CAAC,QAAQ,CACjD,MAA8B,CAC/B,CAAC;AACJ,CAAC;AAND,wDAMC;AAED,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EA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AM,EAAC;IACpD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,4BAAoB,CAAC,kBAAkB,EAAE,CAAC;IAC7D,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,MAAM,EAAE,IAAA,mBAAK,EAAC,0BAAmB,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAMU,QAAA,gCAAgC,GAAG,IAAA,oBAAM,EACpD,0BAAmB,EACnB,uBAAa,CACd,CAAC;AAMF,+EAA+E;AAC/E,0BAA0B;AAEb,QAAA,kCAAkC,GAAG,IAAA,oBAAM,EAAC;IACvD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,4BAAoB,CAAC,qBAAqB,EAAE,CAAC;IAChE,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,KAAK,EAAE,wBAAiB;QACxB,OAAO,EAAE,oCAAoB;KAC9B,CAAC;CACH,CAAC,CAAC;AAMU,QAAA,mCAAmC,GAAG,IAAA,sBAAQ,EACzD,sCAA4B,CAC7B,CAAC","sourcesContent":["import type { AccountId, JsonRpcRequest } from '@metamask/keyring-utils';\nimport { UuidStruct, JsonRpcRequestStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n nullable,\n number,\n object,\n record,\n string,\n union,\n} from '@metamask/superstruct';\n\nimport { ResolvedAccountAddressStruct } from '../../api/address';\nimport type { ResolvedAccountAddress } from '../../api/address';\nimport { BalanceStruct } from '../../api/balance';\nimport type { Balance } from '../../api/balance';\nimport {\n CaipAssetTypeOrIdStruct,\n CaipAssetTypeStruct,\n CaipChainIdStruct,\n} from '../../api/caip';\nimport type {\n CaipAssetType,\n CaipAssetTypeOrId,\n CaipChainId,\n} from '../../api/caip';\nimport { PaginationStruct } from '../../api/pagination';\nimport type { Pagination } from '../../api/pagination';\nimport { TransactionsPageStruct } from '../../api/transaction';\nimport type { TransactionsPage } from '../../api/transaction';\nimport { KeyringRpcMethod } from './keyring-rpc';\nimport type { KeyringRpc, KeyringRpcRequests } from './keyring-rpc';\n\n/**\n * All keyring RPC methods available to a Snap - includes the base\n * {@link KeyringRpcMethod} set plus snap-specific extensions.\n */\nexport const KeyringSnapRpcMethod = {\n ...KeyringRpcMethod,\n SetSelectedAccounts: 'keyring_setSelectedAccounts',\n GetAccountTransactions: 'keyring_getAccountTransactions',\n GetAccountAssets: 'keyring_getAccountAssets',\n GetAccountBalances: 'keyring_getAccountBalances',\n ResolveAccountAddress: 'keyring_resolveAccountAddress',\n} as const;\n\n/**\n * All keyring RPC methods available to a Snap.\n */\nexport type KeyringSnapRpcMethod =\n (typeof KeyringSnapRpcMethod)[keyof typeof KeyringSnapRpcMethod];\n\n/**\n * Check if a method is a Snap keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a Snap keyring RPC method (v2).\n */\nexport function isKeyringSnapRpcMethod(\n method: string,\n): method is KeyringSnapRpcMethod {\n return Object.values(KeyringSnapRpcMethod).includes(\n method as KeyringSnapRpcMethod,\n );\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Set selected accounts\n\nexport const SetSelectedAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.SetSelectedAccounts}`),\n params: object({\n accounts: array(string()),\n }),\n});\n\nexport type SetSelectedAccountsRequest = Infer<\n typeof SetSelectedAccountsRequestStruct\n>;\n\nexport const SetSelectedAccountsResponseStruct = literal(null);\n\nexport type SetSelectedAccountsResponse = Infer<\n typeof SetSelectedAccountsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account transactions\n\nexport const GetAccountTransactionsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountTransactions}`),\n params: object({\n id: UuidStruct,\n pagination: PaginationStruct,\n }),\n});\n\nexport type GetAccountTransactionsRequest = Infer<\n typeof GetAccountTransactionsRequestStruct\n>;\n\nexport const GetAccountTransactionsResponseStruct = TransactionsPageStruct;\n\nexport type GetAccountTransactionsResponse = Infer<\n typeof GetAccountTransactionsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account assets\n\nexport const GetAccountAssetsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountAssets}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountAssetsRequest = Infer<\n typeof GetAccountAssetsRequestStruct\n>;\n\nexport const GetAccountAssetsResponseStruct = array(CaipAssetTypeOrIdStruct);\n\nexport type GetAccountAssetsResponse = Infer<\n typeof GetAccountAssetsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Resolve account address\n\nexport const ResolveAccountAddressRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.ResolveAccountAddress}`),\n params: object({\n scope: CaipChainIdStruct,\n request: JsonRpcRequestStruct,\n }),\n});\n\nexport type ResolveAccountAddressRequest = Infer<\n typeof ResolveAccountAddressRequestStruct\n>;\n\nexport const ResolveAccountAddressResponseStruct = nullable(\n ResolvedAccountAddressStruct,\n);\n\nexport type ResolveAccountAddressResponse = Infer<\n typeof ResolveAccountAddressResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * All keyring RPC requests available to a Snap - includes base\n * {@link KeyringRpcRequests} plus snap-specific request types.\n */\nexport type KeyringSnapRpcRequests =\n | KeyringRpcRequests\n | SetSelectedAccountsRequest\n | GetAccountTransactionsRequest\n | GetAccountAssetsRequest\n | GetAccountBalancesRequest\n | ResolveAccountAddressRequest;\n\n/**\n * Extract the proper request type for a given {@link KeyringSnapRpcMethod}.\n */\nexport type KeyringSnapRpcRequest<RpcMethod extends KeyringSnapRpcMethod> =\n Extract<KeyringSnapRpcRequests, { method: `${RpcMethod}` }>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Snap keyring RPC interface - extends the base {@link KeyringRpc} with\n * optional snap-specific methods that a Snap may expose.\n */\nexport type KeyringSnapRpc = KeyringRpc & {\n /**\n * Notify the Snap of the currently selected accounts.\n * Maps to `keyring_setSelectedAccounts`.\n */\n setSelectedAccounts?: (accounts: AccountId[]) => Promise<void>;\n\n /**\n * Get transactions for an account with pagination.\n * Maps to `keyring_getAccountTransactions`.\n */\n getAccountTransactions?: (\n id: AccountId,\n pagination: Pagination,\n ) => Promise<TransactionsPage>;\n\n /**\n * Get the asset types supported by an account.\n * Maps to `keyring_getAccountAssets`.\n */\n getAccountAssets?: (id: AccountId) => Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Get balances for an account for the requested asset types.\n * Maps to `keyring_getAccountBalances`.\n */\n getAccountBalances?: (\n id: AccountId,\n assets: CaipAssetType[],\n ) => Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Resolve the account address to use for routing a signing request.\n * Maps to `keyring_resolveAccountAddress`.\n */\n resolveAccountAddress?: (\n scope: CaipChainId,\n request: JsonRpcRequest,\n ) => Promise<ResolvedAccountAddress | null>;\n};\n"]}