@metamask/keyring-api 21.3.0 → 21.5.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 (163) hide show
  1. package/CHANGELOG.md +49 -2
  2. package/README.md +4 -0
  3. package/dist/api/account-options.cjs +44 -7
  4. package/dist/api/account-options.cjs.map +1 -1
  5. package/dist/api/account-options.d.cts +41 -3
  6. package/dist/api/account-options.d.cts.map +1 -1
  7. package/dist/api/account-options.d.mts +41 -3
  8. package/dist/api/account-options.d.mts.map +1 -1
  9. package/dist/api/account-options.mjs +43 -6
  10. package/dist/api/account-options.mjs.map +1 -1
  11. package/dist/api/account.d.cts +4 -0
  12. package/dist/api/account.d.cts.map +1 -1
  13. package/dist/api/account.d.mts +4 -0
  14. package/dist/api/account.d.mts.map +1 -1
  15. package/dist/api/keyring.cjs +0 -2
  16. package/dist/api/keyring.cjs.map +1 -1
  17. package/dist/api/keyring.d.cts +13 -0
  18. package/dist/api/keyring.d.cts.map +1 -1
  19. package/dist/api/keyring.d.mts +13 -0
  20. package/dist/api/keyring.d.mts.map +1 -1
  21. package/dist/api/keyring.mjs +0 -2
  22. package/dist/api/keyring.mjs.map +1 -1
  23. package/dist/api/v2/create-account/bip44.cjs +27 -1
  24. package/dist/api/v2/create-account/bip44.cjs.map +1 -1
  25. package/dist/api/v2/create-account/bip44.d.cts +46 -0
  26. package/dist/api/v2/create-account/bip44.d.cts.map +1 -1
  27. package/dist/api/v2/create-account/bip44.d.mts +46 -0
  28. package/dist/api/v2/create-account/bip44.d.mts.map +1 -1
  29. package/dist/api/v2/create-account/bip44.mjs +26 -0
  30. package/dist/api/v2/create-account/bip44.mjs.map +1 -1
  31. package/dist/api/v2/create-account/custom.cjs +14 -0
  32. package/dist/api/v2/create-account/custom.cjs.map +1 -0
  33. package/dist/api/v2/create-account/custom.d.cts +25 -0
  34. package/dist/api/v2/create-account/custom.d.cts.map +1 -0
  35. package/dist/api/v2/create-account/custom.d.mts +25 -0
  36. package/dist/api/v2/create-account/custom.d.mts.map +1 -0
  37. package/dist/api/v2/create-account/custom.mjs +11 -0
  38. package/dist/api/v2/create-account/custom.mjs.map +1 -0
  39. package/dist/api/v2/create-account/index.cjs +55 -0
  40. package/dist/api/v2/create-account/index.cjs.map +1 -1
  41. package/dist/api/v2/create-account/index.d.cts +55 -1
  42. package/dist/api/v2/create-account/index.d.cts.map +1 -1
  43. package/dist/api/v2/create-account/index.d.mts +55 -1
  44. package/dist/api/v2/create-account/index.d.mts.map +1 -1
  45. package/dist/api/v2/create-account/index.mjs +55 -1
  46. package/dist/api/v2/create-account/index.mjs.map +1 -1
  47. package/dist/api/v2/index.cjs +1 -0
  48. package/dist/api/v2/index.cjs.map +1 -1
  49. package/dist/api/v2/index.d.cts +1 -0
  50. package/dist/api/v2/index.d.cts.map +1 -1
  51. package/dist/api/v2/index.d.mts +1 -0
  52. package/dist/api/v2/index.d.mts.map +1 -1
  53. package/dist/api/v2/index.mjs +1 -0
  54. package/dist/api/v2/index.mjs.map +1 -1
  55. package/dist/api/v2/keyring-capabilities.cjs +17 -3
  56. package/dist/api/v2/keyring-capabilities.cjs.map +1 -1
  57. package/dist/api/v2/keyring-capabilities.d.cts +31 -9
  58. package/dist/api/v2/keyring-capabilities.d.cts.map +1 -1
  59. package/dist/api/v2/keyring-capabilities.d.mts +31 -9
  60. package/dist/api/v2/keyring-capabilities.d.mts.map +1 -1
  61. package/dist/api/v2/keyring-capabilities.mjs +18 -4
  62. package/dist/api/v2/keyring-capabilities.mjs.map +1 -1
  63. package/dist/api/v2/wrapper/index.cjs +19 -0
  64. package/dist/api/v2/wrapper/index.cjs.map +1 -0
  65. package/dist/api/v2/wrapper/index.d.cts +3 -0
  66. package/dist/api/v2/wrapper/index.d.cts.map +1 -0
  67. package/dist/api/v2/wrapper/index.d.mts +3 -0
  68. package/dist/api/v2/wrapper/index.d.mts.map +1 -0
  69. package/dist/api/v2/wrapper/index.mjs +3 -0
  70. package/dist/api/v2/wrapper/index.mjs.map +1 -0
  71. package/dist/api/v2/wrapper/keyring-account-registry.cjs +135 -0
  72. package/dist/api/v2/wrapper/keyring-account-registry.cjs.map +1 -0
  73. package/dist/api/v2/wrapper/keyring-account-registry.d.cts +88 -0
  74. package/dist/api/v2/wrapper/keyring-account-registry.d.cts.map +1 -0
  75. package/dist/api/v2/wrapper/keyring-account-registry.d.mts +88 -0
  76. package/dist/api/v2/wrapper/keyring-account-registry.d.mts.map +1 -0
  77. package/dist/api/v2/wrapper/keyring-account-registry.mjs +131 -0
  78. package/dist/api/v2/wrapper/keyring-account-registry.mjs.map +1 -0
  79. package/dist/api/v2/wrapper/keyring-wrapper.cjs +134 -0
  80. package/dist/api/v2/wrapper/keyring-wrapper.cjs.map +1 -0
  81. package/dist/api/v2/wrapper/keyring-wrapper.d.cts +154 -0
  82. package/dist/api/v2/wrapper/keyring-wrapper.d.cts.map +1 -0
  83. package/dist/api/v2/wrapper/keyring-wrapper.d.mts +154 -0
  84. package/dist/api/v2/wrapper/keyring-wrapper.d.mts.map +1 -0
  85. package/dist/api/v2/wrapper/keyring-wrapper.mjs +130 -0
  86. package/dist/api/v2/wrapper/keyring-wrapper.mjs.map +1 -0
  87. package/dist/btc/types.d.cts +16 -0
  88. package/dist/btc/types.d.cts.map +1 -1
  89. package/dist/btc/types.d.mts +16 -0
  90. package/dist/btc/types.d.mts.map +1 -1
  91. package/dist/eth/index.cjs +2 -0
  92. package/dist/eth/index.cjs.map +1 -1
  93. package/dist/eth/index.d.cts +2 -0
  94. package/dist/eth/index.d.cts.map +1 -1
  95. package/dist/eth/index.d.mts +2 -0
  96. package/dist/eth/index.d.mts.map +1 -1
  97. package/dist/eth/index.mjs +2 -0
  98. package/dist/eth/index.mjs.map +1 -1
  99. package/dist/eth/rpc/index.cjs +18 -0
  100. package/dist/eth/rpc/index.cjs.map +1 -0
  101. package/dist/eth/rpc/index.d.cts +2 -0
  102. package/dist/eth/rpc/index.d.cts.map +1 -0
  103. package/dist/eth/rpc/index.d.mts +2 -0
  104. package/dist/eth/rpc/index.d.mts.map +1 -0
  105. package/dist/eth/rpc/index.mjs +2 -0
  106. package/dist/eth/rpc/index.mjs.map +1 -0
  107. package/dist/eth/rpc/params.cjs +151 -0
  108. package/dist/eth/rpc/params.cjs.map +1 -0
  109. package/dist/eth/rpc/params.d.cts +215 -0
  110. package/dist/eth/rpc/params.d.cts.map +1 -0
  111. package/dist/eth/rpc/params.d.mts +215 -0
  112. package/dist/eth/rpc/params.d.mts.map +1 -0
  113. package/dist/eth/rpc/params.mjs +148 -0
  114. package/dist/eth/rpc/params.mjs.map +1 -0
  115. package/dist/eth/types.cjs +5 -2
  116. package/dist/eth/types.cjs.map +1 -1
  117. package/dist/eth/types.d.cts +9 -0
  118. package/dist/eth/types.d.cts.map +1 -1
  119. package/dist/eth/types.d.mts +9 -0
  120. package/dist/eth/types.d.mts.map +1 -1
  121. package/dist/eth/types.mjs +4 -1
  122. package/dist/eth/types.mjs.map +1 -1
  123. package/dist/eth/v2/eth-keyring-wrapper.cjs +165 -0
  124. package/dist/eth/v2/eth-keyring-wrapper.cjs.map +1 -0
  125. package/dist/eth/v2/eth-keyring-wrapper.d.cts +54 -0
  126. package/dist/eth/v2/eth-keyring-wrapper.d.cts.map +1 -0
  127. package/dist/eth/v2/eth-keyring-wrapper.d.mts +54 -0
  128. package/dist/eth/v2/eth-keyring-wrapper.d.mts.map +1 -0
  129. package/dist/eth/v2/eth-keyring-wrapper.mjs +161 -0
  130. package/dist/eth/v2/eth-keyring-wrapper.mjs.map +1 -0
  131. package/dist/eth/v2/index.cjs +18 -0
  132. package/dist/eth/v2/index.cjs.map +1 -0
  133. package/dist/eth/v2/index.d.cts +2 -0
  134. package/dist/eth/v2/index.d.cts.map +1 -0
  135. package/dist/eth/v2/index.d.mts +2 -0
  136. package/dist/eth/v2/index.d.mts.map +1 -0
  137. package/dist/eth/v2/index.mjs +2 -0
  138. package/dist/eth/v2/index.mjs.map +1 -0
  139. package/dist/events.cjs +0 -2
  140. package/dist/events.cjs.map +1 -1
  141. package/dist/events.d.cts +16 -0
  142. package/dist/events.d.cts.map +1 -1
  143. package/dist/events.d.mts +16 -0
  144. package/dist/events.d.mts.map +1 -1
  145. package/dist/events.mjs +0 -2
  146. package/dist/events.mjs.map +1 -1
  147. package/dist/rpc.cjs +27 -12
  148. package/dist/rpc.cjs.map +1 -1
  149. package/dist/rpc.d.cts +200 -12
  150. package/dist/rpc.d.cts.map +1 -1
  151. package/dist/rpc.d.mts +200 -12
  152. package/dist/rpc.d.mts.map +1 -1
  153. package/dist/rpc.mjs +27 -12
  154. package/dist/rpc.mjs.map +1 -1
  155. package/dist/sol/types.d.cts +4 -0
  156. package/dist/sol/types.d.cts.map +1 -1
  157. package/dist/sol/types.d.mts +4 -0
  158. package/dist/sol/types.d.mts.map +1 -1
  159. package/dist/trx/types.d.cts +4 -0
  160. package/dist/trx/types.d.cts.map +1 -1
  161. package/dist/trx/types.d.mts +4 -0
  162. package/dist/trx/types.d.mts.map +1 -1
  163. package/package.json +9 -4
@@ -28,6 +28,8 @@ export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Stru
28
28
  groupIndex: number;
29
29
  } | {
30
30
  type: "private-key";
31
+ } | {
32
+ type: "custom";
31
33
  };
32
34
  exportable?: boolean;
33
35
  };
@@ -70,6 +72,8 @@ export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Stru
70
72
  groupIndex: number;
71
73
  } | {
72
74
  type: "private-key";
75
+ } | {
76
+ type: "custom";
73
77
  };
74
78
  exportable?: boolean;
75
79
  }, null>;
@@ -85,6 +89,8 @@ export declare const BtcP2shAccountStruct: import("@metamask/superstruct").Struc
85
89
  groupIndex: number;
86
90
  } | {
87
91
  type: "private-key";
92
+ } | {
93
+ type: "custom";
88
94
  };
89
95
  exportable?: boolean;
90
96
  };
@@ -127,6 +133,8 @@ export declare const BtcP2shAccountStruct: import("@metamask/superstruct").Struc
127
133
  groupIndex: number;
128
134
  } | {
129
135
  type: "private-key";
136
+ } | {
137
+ type: "custom";
130
138
  };
131
139
  exportable?: boolean;
132
140
  }, null>;
@@ -142,6 +150,8 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
142
150
  groupIndex: number;
143
151
  } | {
144
152
  type: "private-key";
153
+ } | {
154
+ type: "custom";
145
155
  };
146
156
  exportable?: boolean;
147
157
  };
@@ -184,6 +194,8 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
184
194
  groupIndex: number;
185
195
  } | {
186
196
  type: "private-key";
197
+ } | {
198
+ type: "custom";
187
199
  };
188
200
  exportable?: boolean;
189
201
  }, null>;
@@ -199,6 +211,8 @@ export declare const BtcP2trAccountStruct: import("@metamask/superstruct").Struc
199
211
  groupIndex: number;
200
212
  } | {
201
213
  type: "private-key";
214
+ } | {
215
+ type: "custom";
202
216
  };
203
217
  exportable?: boolean;
204
218
  };
@@ -241,6 +255,8 @@ export declare const BtcP2trAccountStruct: import("@metamask/superstruct").Struc
241
255
  groupIndex: number;
242
256
  } | {
243
257
  type: "private-key";
258
+ } | {
259
+ type: "custom";
244
260
  };
245
261
  exportable?: boolean;
246
262
  }, null>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAkCnD,eAAO,MAAM,qBAAqB,sDAMjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sDAMhC,CAAC;AAEF,eAAO,MAAM,sBAAsB,sDAMlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sDAMhC,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IACnB,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,aAAa,kBAAkB;IAC/B,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,gBAAgB,qBAAqB;IACrC,WAAW,gBAAgB;CAC5B;AAg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rB,aAAa,kBAAkB;IAC/B,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,gBAAgB,qBAAqB;IACrC,WAAW,gBAAgB;CAC5B;AAgBD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;IAGhC;;OAEG;;IAGH;;OAEG;;IArBH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBH,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAnCH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BH,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;IAGjC;;OAEG;;IAGH;;OAEG;;IAjDH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CH,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IA/DH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;EA0DH,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -28,6 +28,8 @@ export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Stru
28
28
  groupIndex: number;
29
29
  } | {
30
30
  type: "private-key";
31
+ } | {
32
+ type: "custom";
31
33
  };
32
34
  exportable?: boolean;
33
35
  };
@@ -70,6 +72,8 @@ export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Stru
70
72
  groupIndex: number;
71
73
  } | {
72
74
  type: "private-key";
75
+ } | {
76
+ type: "custom";
73
77
  };
74
78
  exportable?: boolean;
75
79
  }, null>;
@@ -85,6 +89,8 @@ export declare const BtcP2shAccountStruct: import("@metamask/superstruct").Struc
85
89
  groupIndex: number;
86
90
  } | {
87
91
  type: "private-key";
92
+ } | {
93
+ type: "custom";
88
94
  };
89
95
  exportable?: boolean;
90
96
  };
@@ -127,6 +133,8 @@ export declare const BtcP2shAccountStruct: import("@metamask/superstruct").Struc
127
133
  groupIndex: number;
128
134
  } | {
129
135
  type: "private-key";
136
+ } | {
137
+ type: "custom";
130
138
  };
131
139
  exportable?: boolean;
132
140
  }, null>;
@@ -142,6 +150,8 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
142
150
  groupIndex: number;
143
151
  } | {
144
152
  type: "private-key";
153
+ } | {
154
+ type: "custom";
145
155
  };
146
156
  exportable?: boolean;
147
157
  };
@@ -184,6 +194,8 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
184
194
  groupIndex: number;
185
195
  } | {
186
196
  type: "private-key";
197
+ } | {
198
+ type: "custom";
187
199
  };
188
200
  exportable?: boolean;
189
201
  }, null>;
@@ -199,6 +211,8 @@ export declare const BtcP2trAccountStruct: import("@metamask/superstruct").Struc
199
211
  groupIndex: number;
200
212
  } | {
201
213
  type: "private-key";
214
+ } | {
215
+ type: "custom";
202
216
  };
203
217
  exportable?: boolean;
204
218
  };
@@ -241,6 +255,8 @@ export declare const BtcP2trAccountStruct: import("@metamask/superstruct").Struc
241
255
  groupIndex: number;
242
256
  } | {
243
257
  type: "private-key";
258
+ } | {
259
+ type: "custom";
244
260
  };
245
261
  exportable?: boolean;
246
262
  }, null>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAkCnD,eAAO,M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AAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -16,6 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./constants.cjs"), exports);
18
18
  __exportStar(require("./erc4337/index.cjs"), exports);
19
+ __exportStar(require("./rpc/index.cjs"), exports);
19
20
  __exportStar(require("./types.cjs"), exports);
20
21
  __exportStar(require("./utils.cjs"), exports);
22
+ __exportStar(require("./v2/index.cjs"), exports);
21
23
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA4B;AAC5B,sDAA0B;AAC1B,8CAAwB;AACxB,8CAAwB","sourcesContent":["export * from './constants';\nexport * from './erc4337';\nexport * from './types';\nexport * from './utils';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA4B;AAC5B,sDAA0B;AAC1B,kDAAsB;AACtB,8CAAwB;AACxB,8CAAwB;AACxB,iDAAqB","sourcesContent":["export * from './constants';\nexport * from './erc4337';\nexport * from './rpc';\nexport * from './types';\nexport * from './utils';\nexport * from './v2';\n"]}
@@ -1,5 +1,7 @@
1
1
  export * from "./constants.cjs";
2
2
  export * from "./erc4337/index.cjs";
3
+ export * from "./rpc/index.cjs";
3
4
  export * from "./types.cjs";
4
5
  export * from "./utils.cjs";
6
+ export * from "./v2/index.cjs";
5
7
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,oCAA0B;AAC1B,4BAAwB;AACxB,4BAAwB"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,oCAA0B;AAC1B,gCAAsB;AACtB,4BAAwB;AACxB,4BAAwB;AACxB,+BAAqB"}
@@ -1,5 +1,7 @@
1
1
  export * from "./constants.mjs";
2
2
  export * from "./erc4337/index.mjs";
3
+ export * from "./rpc/index.mjs";
3
4
  export * from "./types.mjs";
4
5
  export * from "./utils.mjs";
6
+ export * from "./v2/index.mjs";
5
7
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,oCAA0B;AAC1B,4BAAwB;AACxB,4BAAwB"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,oCAA0B;AAC1B,gCAAsB;AACtB,4BAAwB;AACxB,4BAAwB;AACxB,+BAAqB"}
@@ -1,5 +1,7 @@
1
1
  export * from "./constants.mjs";
2
2
  export * from "./erc4337/index.mjs";
3
+ export * from "./rpc/index.mjs";
3
4
  export * from "./types.mjs";
4
5
  export * from "./utils.mjs";
6
+ export * from "./v2/index.mjs";
5
7
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,oCAA0B;AAC1B,4BAAwB;AACxB,4BAAwB","sourcesContent":["export * from './constants';\nexport * from './erc4337';\nexport * from './types';\nexport * from './utils';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,oCAA0B;AAC1B,gCAAsB;AACtB,4BAAwB;AACxB,4BAAwB;AACxB,+BAAqB","sourcesContent":["export * from './constants';\nexport * from './erc4337';\nexport * from './rpc';\nexport * from './types';\nexport * from './utils';\nexport * from './v2';\n"]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./params.cjs"), exports);
18
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/eth/rpc/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAAyB","sourcesContent":["export * from './params';\n"]}
@@ -0,0 +1,2 @@
1
+ export * from "./params.cjs";
2
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/eth/rpc/index.ts"],"names":[],"mappings":"AAAA,6BAAyB"}
@@ -0,0 +1,2 @@
1
+ export * from "./params.mjs";
2
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/eth/rpc/index.ts"],"names":[],"mappings":"AAAA,6BAAyB"}
@@ -0,0 +1,2 @@
1
+ export * from "./params.mjs";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/eth/rpc/index.ts"],"names":[],"mappings":"AAAA,6BAAyB","sourcesContent":["export * from './params';\n"]}
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ /**
3
+ * Superstruct validation schemas for Ethereum JSON-RPC method parameters.
4
+ *
5
+ * These structs provide runtime validation for the parameters passed to various
6
+ * Ethereum RPC methods. They can be used by keyring implementations to validate
7
+ * incoming requests before processing.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.EthGetEncryptionPublicKeyParamsStruct = exports.EthSignEip7702AuthorizationParamsStruct = exports.EthGetAppKeyAddressParamsStruct = exports.EthDecryptParamsStruct = exports.EthSignTypedDataParamsStruct = exports.EthSignTypedDataV1ParamsStruct = exports.EthPersonalSignParamsStruct = exports.EthSignParamsStruct = exports.EthSignTransactionParamsStruct = exports.EthGetEncryptionPublicKeyOptionsStruct = exports.EthEip7702AuthorizationStruct = exports.EthEncryptedDataStruct = exports.EthTypedMessageStruct = exports.EthTypedDataTypesStruct = exports.EthTypedDataV1Struct = exports.EthTransactionDataStruct = void 0;
11
+ const keyring_utils_1 = require("@metamask/keyring-utils");
12
+ const superstruct_1 = require("@metamask/superstruct");
13
+ const types_1 = require("../types.cjs");
14
+ /**
15
+ * A struct for validating Ethereum transaction data.
16
+ *
17
+ * This uses `type()` instead of `object()` to allow extra properties,
18
+ * since transaction formats can vary and include additional fields.
19
+ * The actual transaction validation is performed by the transaction library.
20
+ */
21
+ exports.EthTransactionDataStruct = (0, superstruct_1.type)({
22
+ to: (0, superstruct_1.optional)((0, superstruct_1.nullable)(types_1.EthAddressStruct)),
23
+ from: (0, superstruct_1.optional)(types_1.EthAddressStruct),
24
+ nonce: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()])),
25
+ value: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()])),
26
+ data: (0, superstruct_1.optional)(types_1.EthBytesStruct),
27
+ gas: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()])),
28
+ gasLimit: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()])),
29
+ gasPrice: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()])),
30
+ maxFeePerGas: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()])),
31
+ maxPriorityFeePerGas: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()])),
32
+ accessList: (0, superstruct_1.optional)((0, superstruct_1.array)((0, superstruct_1.type)({
33
+ address: types_1.EthAddressStruct,
34
+ storageKeys: (0, superstruct_1.array)((0, superstruct_1.string)()),
35
+ }))),
36
+ type: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()])),
37
+ chainId: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()])),
38
+ });
39
+ /**
40
+ * A struct for TypedDataV1 format (legacy typed data).
41
+ * This is an array of { type, name, value } objects.
42
+ */
43
+ exports.EthTypedDataV1Struct = (0, superstruct_1.array)((0, keyring_utils_1.object)({
44
+ type: (0, superstruct_1.string)(),
45
+ name: (0, superstruct_1.string)(),
46
+ value: (0, superstruct_1.unknown)(),
47
+ }));
48
+ /**
49
+ * A struct for TypedData types definition.
50
+ * Maps type names to arrays of { name, type } definitions.
51
+ */
52
+ exports.EthTypedDataTypesStruct = (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.array)((0, keyring_utils_1.object)({
53
+ name: (0, superstruct_1.string)(),
54
+ type: (0, superstruct_1.string)(),
55
+ })));
56
+ /**
57
+ * A struct for TypedMessage format (EIP-712 V3/V4).
58
+ * Contains types, domain, primaryType, and message.
59
+ */
60
+ exports.EthTypedMessageStruct = (0, keyring_utils_1.object)({
61
+ types: exports.EthTypedDataTypesStruct,
62
+ primaryType: (0, superstruct_1.string)(),
63
+ domain: (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.any)()),
64
+ message: (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.any)()),
65
+ });
66
+ /**
67
+ * A struct for EIP-1024 encrypted data format (x25519-xsalsa20-poly1305).
68
+ */
69
+ exports.EthEncryptedDataStruct = (0, keyring_utils_1.object)({
70
+ version: (0, superstruct_1.literal)('x25519-xsalsa20-poly1305'),
71
+ nonce: (0, superstruct_1.string)(),
72
+ ephemPublicKey: (0, superstruct_1.string)(),
73
+ ciphertext: (0, superstruct_1.string)(),
74
+ });
75
+ /**
76
+ * A struct for EIP-7702 authorization tuple.
77
+ * Format: [chainId, address, nonce]
78
+ */
79
+ exports.EthEip7702AuthorizationStruct = (0, superstruct_1.tuple)([
80
+ (0, superstruct_1.number)(), // chainId
81
+ types_1.EthAddressStrictStruct, // address (contract to delegate to)
82
+ (0, superstruct_1.number)(), // nonce
83
+ ]);
84
+ /**
85
+ * A struct for getEncryptionPublicKey options.
86
+ */
87
+ exports.EthGetEncryptionPublicKeyOptionsStruct = (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.unknown)());
88
+ // ============================================================================
89
+ // RPC Method Parameter Structs
90
+ // ============================================================================
91
+ /**
92
+ * Parameters for `eth_signTransaction`.
93
+ */
94
+ exports.EthSignTransactionParamsStruct = (0, superstruct_1.tuple)([exports.EthTransactionDataStruct]);
95
+ /**
96
+ * Parameters for `eth_sign`.
97
+ */
98
+ exports.EthSignParamsStruct = (0, superstruct_1.tuple)([
99
+ types_1.EthAddressStruct, // address
100
+ types_1.EthBytesStruct, // data (hex-encoded message hash)
101
+ ]);
102
+ /**
103
+ * Parameters for `personal_sign`.
104
+ */
105
+ exports.EthPersonalSignParamsStruct = (0, superstruct_1.union)([
106
+ (0, superstruct_1.tuple)([types_1.EthBytesStruct]), // [data]
107
+ (0, superstruct_1.tuple)([types_1.EthBytesStruct, types_1.EthAddressStruct]), // [data, address]
108
+ ]);
109
+ /**
110
+ * Parameters for `eth_signTypedData_v1`.
111
+ */
112
+ exports.EthSignTypedDataV1ParamsStruct = (0, superstruct_1.tuple)([
113
+ types_1.EthAddressStruct, // address
114
+ exports.EthTypedDataV1Struct, // typed data array
115
+ ]);
116
+ /**
117
+ * Parameters for `eth_signTypedData_v3` and `eth_signTypedData_v4`.
118
+ */
119
+ exports.EthSignTypedDataParamsStruct = (0, superstruct_1.tuple)([
120
+ types_1.EthAddressStruct, // address
121
+ exports.EthTypedMessageStruct, // typed data object
122
+ ]);
123
+ /**
124
+ * Parameters for `eth_decrypt`.
125
+ */
126
+ exports.EthDecryptParamsStruct = (0, superstruct_1.tuple)([exports.EthEncryptedDataStruct]);
127
+ /**
128
+ * Parameters for `eth_getAppKeyAddress`.
129
+ */
130
+ exports.EthGetAppKeyAddressParamsStruct = (0, superstruct_1.tuple)([
131
+ (0, superstruct_1.string)(), // origin URL
132
+ ]);
133
+ /**
134
+ * Parameters for `eth_signEip7702Authorization`.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * const params = [[1, '0xContractAddress', 0]];
139
+ * ```
140
+ */
141
+ exports.EthSignEip7702AuthorizationParamsStruct = (0, superstruct_1.tuple)([
142
+ exports.EthEip7702AuthorizationStruct,
143
+ ]);
144
+ /**
145
+ * Parameters for `eth_getEncryptionPublicKey`.
146
+ */
147
+ exports.EthGetEncryptionPublicKeyParamsStruct = (0, superstruct_1.tuple)([
148
+ types_1.EthAddressStruct, // address
149
+ (0, superstruct_1.optional)(exports.EthGetEncryptionPublicKeyOptionsStruct), // options
150
+ ]);
151
+ //# sourceMappingURL=params.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"params.cjs","sourceRoot":"","sources":["../../../src/eth/rpc/params.ts"],"names":[],"mappings":";AAAA;;;;;;GAM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;AAIH;;GAEG;AACU,QAAA,sBAAsB,GAAG,IAAA,mBAAK,EAAC,CAAC,8BAAsB,CAAC,CAAC,CAAC;AAItE;;GAEG;AACU,QAAA,+BAA+B,GAAG,IAAA,mBAAK,EAAC;IACnD,IAAA,oBAAM,GAAE,EAAE,aAAa;CACxB,CAAC,CAAC;AAMH;;;;;;;GAOG;AACU,QAAA,uCAAuC,GAAG,IAAA,mBAAK,EAAC;IAC3D,qCAA6B;CAC9B,CAAC,CAAC;AAMH;;GAEG;AACU,QAAA,qCAAqC,GAAG,IAAA,mBAAK,EAAC;IACzD,wBAAgB,EAAE,UAAU;IAC5B,IAAA,sBAAQ,EAAC,8CAAsC,CAAC,EAAE,UAAU;CAC7D,CAAC,CAAC","sourcesContent":["/**\n * Superstruct validation schemas for Ethereum JSON-RPC method parameters.\n *\n * These structs provide runtime validation for the parameters passed to various\n * Ethereum RPC methods. They can be used by keyring implementations to validate\n * incoming requests before processing.\n */\n\nimport { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n any,\n array,\n literal,\n nullable,\n number,\n optional,\n record,\n string,\n tuple,\n type,\n union,\n unknown,\n} from '@metamask/superstruct';\n\nimport {\n EthAddressStrictStruct,\n EthAddressStruct,\n EthBytesStruct,\n} from '../types';\n\n/**\n * A struct for validating Ethereum transaction data.\n *\n * This uses `type()` instead of `object()` to allow extra properties,\n * since transaction formats can vary and include additional fields.\n * The actual transaction validation is performed by the transaction library.\n */\nexport const EthTransactionDataStruct = type({\n to: optional(nullable(EthAddressStruct)),\n from: optional(EthAddressStruct),\n nonce: optional(union([string(), number()])),\n value: optional(union([string(), number()])),\n data: optional(EthBytesStruct),\n gas: optional(union([string(), number()])),\n gasLimit: optional(union([string(), number()])),\n gasPrice: optional(union([string(), number()])),\n maxFeePerGas: optional(union([string(), number()])),\n maxPriorityFeePerGas: optional(union([string(), number()])),\n accessList: optional(\n array(\n type({\n address: EthAddressStruct,\n storageKeys: array(string()),\n }),\n ),\n ),\n type: optional(union([string(), number()])),\n chainId: optional(union([string(), number()])),\n});\n\nexport type EthTransactionData = Infer<typeof EthTransactionDataStruct>;\n\n/**\n * A struct for TypedDataV1 format (legacy typed data).\n * This is an array of { type, name, value } objects.\n */\nexport const EthTypedDataV1Struct = array(\n object({\n type: string(),\n name: string(),\n value: unknown(),\n }),\n);\n\nexport type EthTypedDataV1 = Infer<typeof EthTypedDataV1Struct>;\n\n/**\n * A struct for TypedData types definition.\n * Maps type names to arrays of { name, type } definitions.\n */\nexport const EthTypedDataTypesStruct = record(\n string(),\n array(\n object({\n name: string(),\n type: string(),\n }),\n ),\n);\n\nexport type EthTypedDataTypes = Infer<typeof EthTypedDataTypesStruct>;\n\n/**\n * A struct for TypedMessage format (EIP-712 V3/V4).\n * Contains types, domain, primaryType, and message.\n */\nexport const EthTypedMessageStruct = object({\n types: EthTypedDataTypesStruct,\n primaryType: string(),\n domain: record(string(), any()),\n message: record(string(), any()),\n});\n\nexport type EthTypedMessage = Infer<typeof EthTypedMessageStruct>;\n\n/**\n * A struct for EIP-1024 encrypted data format (x25519-xsalsa20-poly1305).\n */\nexport const EthEncryptedDataStruct = object({\n version: literal('x25519-xsalsa20-poly1305'),\n nonce: string(),\n ephemPublicKey: string(),\n ciphertext: string(),\n});\n\nexport type EthEncryptedData = Infer<typeof EthEncryptedDataStruct>;\n\n/**\n * A struct for EIP-7702 authorization tuple.\n * Format: [chainId, address, nonce]\n */\nexport const EthEip7702AuthorizationStruct = tuple([\n number(), // chainId\n EthAddressStrictStruct, // address (contract to delegate to)\n number(), // nonce\n]);\n\nexport type EthEip7702Authorization = Infer<\n typeof EthEip7702AuthorizationStruct\n>;\n\n/**\n * A struct for getEncryptionPublicKey options.\n */\nexport const EthGetEncryptionPublicKeyOptionsStruct = record(\n string(),\n unknown(),\n);\n\n// ============================================================================\n// RPC Method Parameter Structs\n// ============================================================================\n\n/**\n * Parameters for `eth_signTransaction`.\n */\nexport const EthSignTransactionParamsStruct = tuple([EthTransactionDataStruct]);\n\nexport type EthSignTransactionParams = Infer<\n typeof EthSignTransactionParamsStruct\n>;\n\n/**\n * Parameters for `eth_sign`.\n */\nexport const EthSignParamsStruct = tuple([\n EthAddressStruct, // address\n EthBytesStruct, // data (hex-encoded message hash)\n]);\n\nexport type EthSignParams = Infer<typeof EthSignParamsStruct>;\n\n/**\n * Parameters for `personal_sign`.\n */\nexport const EthPersonalSignParamsStruct = union([\n tuple([EthBytesStruct]), // [data]\n tuple([EthBytesStruct, EthAddressStruct]), // [data, address]\n]);\n\nexport type EthPersonalSignParams = Infer<typeof EthPersonalSignParamsStruct>;\n\n/**\n * Parameters for `eth_signTypedData_v1`.\n */\nexport const EthSignTypedDataV1ParamsStruct = tuple([\n EthAddressStruct, // address\n EthTypedDataV1Struct, // typed data array\n]);\n\nexport type EthSignTypedDataV1Params = Infer<\n typeof EthSignTypedDataV1ParamsStruct\n>;\n\n/**\n * Parameters for `eth_signTypedData_v3` and `eth_signTypedData_v4`.\n */\nexport const EthSignTypedDataParamsStruct = tuple([\n EthAddressStruct, // address\n EthTypedMessageStruct, // typed data object\n]);\n\nexport type EthSignTypedDataParams = Infer<typeof EthSignTypedDataParamsStruct>;\n\n/**\n * Parameters for `eth_decrypt`.\n */\nexport const EthDecryptParamsStruct = tuple([EthEncryptedDataStruct]);\n\nexport type EthDecryptParams = Infer<typeof EthDecryptParamsStruct>;\n\n/**\n * Parameters for `eth_getAppKeyAddress`.\n */\nexport const EthGetAppKeyAddressParamsStruct = tuple([\n string(), // origin URL\n]);\n\nexport type EthGetAppKeyAddressParams = Infer<\n typeof EthGetAppKeyAddressParamsStruct\n>;\n\n/**\n * Parameters for `eth_signEip7702Authorization`.\n *\n * @example\n * ```ts\n * const params = [[1, '0xContractAddress', 0]];\n * ```\n */\nexport const EthSignEip7702AuthorizationParamsStruct = tuple([\n EthEip7702AuthorizationStruct,\n]);\n\nexport type EthSignEip7702AuthorizationParams = Infer<\n typeof EthSignEip7702AuthorizationParamsStruct\n>;\n\n/**\n * Parameters for `eth_getEncryptionPublicKey`.\n */\nexport const EthGetEncryptionPublicKeyParamsStruct = tuple([\n EthAddressStruct, // address\n optional(EthGetEncryptionPublicKeyOptionsStruct), // options\n]);\n"]}
@@ -0,0 +1,215 @@
1
+ /**
2
+ * Superstruct validation schemas for Ethereum JSON-RPC method parameters.
3
+ *
4
+ * These structs provide runtime validation for the parameters passed to various
5
+ * Ethereum RPC methods. They can be used by keyring implementations to validate
6
+ * incoming requests before processing.
7
+ */
8
+ import type { Infer } from "@metamask/superstruct";
9
+ /**
10
+ * A struct for validating Ethereum transaction data.
11
+ *
12
+ * This uses `type()` instead of `object()` to allow extra properties,
13
+ * since transaction formats can vary and include additional fields.
14
+ * The actual transaction validation is performed by the transaction library.
15
+ */
16
+ export declare const EthTransactionDataStruct: import("@metamask/superstruct").Struct<{
17
+ value?: string | number | undefined;
18
+ type?: string | number | undefined;
19
+ data?: string | undefined;
20
+ from?: string | undefined;
21
+ chainId?: string | number | undefined;
22
+ accessList?: {
23
+ address: string;
24
+ storageKeys: string[];
25
+ }[] | undefined;
26
+ nonce?: string | number | undefined;
27
+ to?: string | null | undefined;
28
+ maxFeePerGas?: string | number | undefined;
29
+ maxPriorityFeePerGas?: string | number | undefined;
30
+ gas?: string | number | undefined;
31
+ gasLimit?: string | number | undefined;
32
+ gasPrice?: string | number | undefined;
33
+ }, {
34
+ to: import("@metamask/superstruct").Struct<string | null | undefined, null>;
35
+ from: import("@metamask/superstruct").Struct<string | undefined, null>;
36
+ nonce: import("@metamask/superstruct").Struct<string | number | undefined, null>;
37
+ value: import("@metamask/superstruct").Struct<string | number | undefined, null>;
38
+ data: import("@metamask/superstruct").Struct<string | undefined, null>;
39
+ gas: import("@metamask/superstruct").Struct<string | number | undefined, null>;
40
+ gasLimit: import("@metamask/superstruct").Struct<string | number | undefined, null>;
41
+ gasPrice: import("@metamask/superstruct").Struct<string | number | undefined, null>;
42
+ maxFeePerGas: import("@metamask/superstruct").Struct<string | number | undefined, null>;
43
+ maxPriorityFeePerGas: import("@metamask/superstruct").Struct<string | number | undefined, null>;
44
+ accessList: import("@metamask/superstruct").Struct<{
45
+ address: string;
46
+ storageKeys: string[];
47
+ }[] | undefined, import("@metamask/superstruct").Struct<{
48
+ address: string;
49
+ storageKeys: string[];
50
+ }, {
51
+ address: import("@metamask/superstruct").Struct<string, null>;
52
+ storageKeys: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
53
+ }>>;
54
+ type: import("@metamask/superstruct").Struct<string | number | undefined, null>;
55
+ chainId: import("@metamask/superstruct").Struct<string | number | undefined, null>;
56
+ }>;
57
+ export type EthTransactionData = Infer<typeof EthTransactionDataStruct>;
58
+ /**
59
+ * A struct for TypedDataV1 format (legacy typed data).
60
+ * This is an array of { type, name, value } objects.
61
+ */
62
+ export declare const EthTypedDataV1Struct: import("@metamask/superstruct").Struct<{
63
+ name: string;
64
+ value: unknown;
65
+ type: string;
66
+ }[], import("@metamask/superstruct").Struct<{
67
+ name: string;
68
+ value: unknown;
69
+ type: string;
70
+ }, {
71
+ type: import("@metamask/superstruct").Struct<string, null>;
72
+ name: import("@metamask/superstruct").Struct<string, null>;
73
+ value: import("@metamask/superstruct").Struct<unknown, null>;
74
+ }>>;
75
+ export type EthTypedDataV1 = Infer<typeof EthTypedDataV1Struct>;
76
+ /**
77
+ * A struct for TypedData types definition.
78
+ * Maps type names to arrays of { name, type } definitions.
79
+ */
80
+ export declare const EthTypedDataTypesStruct: import("@metamask/superstruct").Struct<Record<string, {
81
+ name: string;
82
+ type: string;
83
+ }[]>, null>;
84
+ export type EthTypedDataTypes = Infer<typeof EthTypedDataTypesStruct>;
85
+ /**
86
+ * A struct for TypedMessage format (EIP-712 V3/V4).
87
+ * Contains types, domain, primaryType, and message.
88
+ */
89
+ export declare const EthTypedMessageStruct: import("@metamask/superstruct").Struct<{
90
+ message: Record<string, any>;
91
+ domain: Record<string, any>;
92
+ types: Record<string, {
93
+ name: string;
94
+ type: string;
95
+ }[]>;
96
+ primaryType: string;
97
+ }, {
98
+ types: import("@metamask/superstruct").Struct<Record<string, {
99
+ name: string;
100
+ type: string;
101
+ }[]>, null>;
102
+ primaryType: import("@metamask/superstruct").Struct<string, null>;
103
+ domain: import("@metamask/superstruct").Struct<Record<string, any>, null>;
104
+ message: import("@metamask/superstruct").Struct<Record<string, any>, null>;
105
+ }>;
106
+ export type EthTypedMessage = Infer<typeof EthTypedMessageStruct>;
107
+ /**
108
+ * A struct for EIP-1024 encrypted data format (x25519-xsalsa20-poly1305).
109
+ */
110
+ export declare const EthEncryptedDataStruct: import("@metamask/superstruct").Struct<{
111
+ nonce: string;
112
+ version: "x25519-xsalsa20-poly1305";
113
+ ephemPublicKey: string;
114
+ ciphertext: string;
115
+ }, {
116
+ version: import("@metamask/superstruct").Struct<"x25519-xsalsa20-poly1305", "x25519-xsalsa20-poly1305">;
117
+ nonce: import("@metamask/superstruct").Struct<string, null>;
118
+ ephemPublicKey: import("@metamask/superstruct").Struct<string, null>;
119
+ ciphertext: import("@metamask/superstruct").Struct<string, null>;
120
+ }>;
121
+ export type EthEncryptedData = Infer<typeof EthEncryptedDataStruct>;
122
+ /**
123
+ * A struct for EIP-7702 authorization tuple.
124
+ * Format: [chainId, address, nonce]
125
+ */
126
+ export declare const EthEip7702AuthorizationStruct: import("@metamask/superstruct").Struct<[number, `0x${string}`, number], null>;
127
+ export type EthEip7702Authorization = Infer<typeof EthEip7702AuthorizationStruct>;
128
+ /**
129
+ * A struct for getEncryptionPublicKey options.
130
+ */
131
+ export declare const EthGetEncryptionPublicKeyOptionsStruct: import("@metamask/superstruct").Struct<Record<string, unknown>, null>;
132
+ /**
133
+ * Parameters for `eth_signTransaction`.
134
+ */
135
+ export declare const EthSignTransactionParamsStruct: import("@metamask/superstruct").Struct<[{
136
+ value?: string | number | undefined;
137
+ type?: string | number | undefined;
138
+ data?: string | undefined;
139
+ from?: string | undefined;
140
+ chainId?: string | number | undefined;
141
+ accessList?: {
142
+ address: string;
143
+ storageKeys: string[];
144
+ }[] | undefined;
145
+ nonce?: string | number | undefined;
146
+ to?: string | null | undefined;
147
+ maxFeePerGas?: string | number | undefined;
148
+ maxPriorityFeePerGas?: string | number | undefined;
149
+ gas?: string | number | undefined;
150
+ gasLimit?: string | number | undefined;
151
+ gasPrice?: string | number | undefined;
152
+ }], null>;
153
+ export type EthSignTransactionParams = Infer<typeof EthSignTransactionParamsStruct>;
154
+ /**
155
+ * Parameters for `eth_sign`.
156
+ */
157
+ export declare const EthSignParamsStruct: import("@metamask/superstruct").Struct<[string, string], null>;
158
+ export type EthSignParams = Infer<typeof EthSignParamsStruct>;
159
+ /**
160
+ * Parameters for `personal_sign`.
161
+ */
162
+ export declare const EthPersonalSignParamsStruct: import("@metamask/superstruct").Struct<[string, string] | [string], null>;
163
+ export type EthPersonalSignParams = Infer<typeof EthPersonalSignParamsStruct>;
164
+ /**
165
+ * Parameters for `eth_signTypedData_v1`.
166
+ */
167
+ export declare const EthSignTypedDataV1ParamsStruct: import("@metamask/superstruct").Struct<[string, {
168
+ name: string;
169
+ value: unknown;
170
+ type: string;
171
+ }[]], null>;
172
+ export type EthSignTypedDataV1Params = Infer<typeof EthSignTypedDataV1ParamsStruct>;
173
+ /**
174
+ * Parameters for `eth_signTypedData_v3` and `eth_signTypedData_v4`.
175
+ */
176
+ export declare const EthSignTypedDataParamsStruct: import("@metamask/superstruct").Struct<[string, {
177
+ message: Record<string, any>;
178
+ domain: Record<string, any>;
179
+ types: Record<string, {
180
+ name: string;
181
+ type: string;
182
+ }[]>;
183
+ primaryType: string;
184
+ }], null>;
185
+ export type EthSignTypedDataParams = Infer<typeof EthSignTypedDataParamsStruct>;
186
+ /**
187
+ * Parameters for `eth_decrypt`.
188
+ */
189
+ export declare const EthDecryptParamsStruct: import("@metamask/superstruct").Struct<[{
190
+ nonce: string;
191
+ version: "x25519-xsalsa20-poly1305";
192
+ ephemPublicKey: string;
193
+ ciphertext: string;
194
+ }], null>;
195
+ export type EthDecryptParams = Infer<typeof EthDecryptParamsStruct>;
196
+ /**
197
+ * Parameters for `eth_getAppKeyAddress`.
198
+ */
199
+ export declare const EthGetAppKeyAddressParamsStruct: import("@metamask/superstruct").Struct<[string], null>;
200
+ export type EthGetAppKeyAddressParams = Infer<typeof EthGetAppKeyAddressParamsStruct>;
201
+ /**
202
+ * Parameters for `eth_signEip7702Authorization`.
203
+ *
204
+ * @example
205
+ * ```ts
206
+ * const params = [[1, '0xContractAddress', 0]];
207
+ * ```
208
+ */
209
+ export declare const EthSignEip7702AuthorizationParamsStruct: import("@metamask/superstruct").Struct<[[number, `0x${string}`, number]], null>;
210
+ export type EthSignEip7702AuthorizationParams = Infer<typeof EthSignEip7702AuthorizationParamsStruct>;
211
+ /**
212
+ * Parameters for `eth_getEncryptionPublicKey`.
213
+ */
214
+ export declare const EthGetEncryptionPublicKeyParamsStruct: import("@metamask/superstruct").Struct<[string, Record<string, unknown> | undefined], null>;
215
+ //# sourceMappingURL=params.d.cts.map