@metamask/keyring-api 6.2.0 → 6.3.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 (75) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/dist/KeyringClient.js +9 -9
  3. package/dist/KeyringClient.js.map +1 -1
  4. package/dist/api/account.d.ts +62 -0
  5. package/dist/api/account.js +56 -0
  6. package/dist/api/account.js.map +1 -0
  7. package/dist/api/balance.d.ts +9 -0
  8. package/dist/api/balance.js +11 -0
  9. package/dist/api/balance.js.map +1 -0
  10. package/dist/api/export.d.ts +8 -0
  11. package/dist/api/export.js +7 -0
  12. package/dist/api/export.js.map +1 -0
  13. package/dist/api/index.d.ts +6 -0
  14. package/dist/api/index.js +23 -0
  15. package/dist/api/index.js.map +1 -0
  16. package/dist/{api.d.ts → api/keyring.d.ts} +34 -125
  17. package/dist/api/keyring.js +3 -0
  18. package/dist/api/keyring.js.map +1 -0
  19. package/dist/api/request.d.ts +39 -0
  20. package/dist/api/request.js +29 -0
  21. package/dist/api/request.js.map +1 -0
  22. package/dist/api/response.d.ts +24 -0
  23. package/dist/api/response.js +44 -0
  24. package/dist/api/response.js.map +1 -0
  25. package/dist/btc/types.d.ts +4 -7
  26. package/dist/btc/types.js +10 -12
  27. package/dist/btc/types.js.map +1 -1
  28. package/dist/eth/erc4337/types.d.ts +1 -1
  29. package/dist/eth/erc4337/types.js +2 -1
  30. package/dist/eth/erc4337/types.js.map +1 -1
  31. package/dist/eth/types.d.ts +9 -15
  32. package/dist/eth/types.js +23 -29
  33. package/dist/eth/types.js.map +1 -1
  34. package/dist/eth/utils.d.ts +3 -2
  35. package/dist/eth/utils.js +3 -2
  36. package/dist/eth/utils.js.map +1 -1
  37. package/dist/internal/api.d.ts +94 -112
  38. package/dist/internal/api.js +35 -22
  39. package/dist/internal/api.js.map +1 -1
  40. package/dist/internal/events.d.ts +44 -96
  41. package/dist/internal/events.js +10 -10
  42. package/dist/internal/events.js.map +1 -1
  43. package/dist/internal/rpc.d.ts +1 -0
  44. package/dist/internal/rpc.js +1 -0
  45. package/dist/internal/rpc.js.map +1 -1
  46. package/dist/internal/types.d.ts +65 -6
  47. package/dist/internal/types.js +7 -9
  48. package/dist/internal/types.js.map +1 -1
  49. package/dist/rpc-handler.d.ts +12 -0
  50. package/dist/rpc-handler.js +40 -2
  51. package/dist/rpc-handler.js.map +1 -1
  52. package/dist/superstruct.d.ts +9 -4
  53. package/dist/superstruct.js +14 -14
  54. package/dist/superstruct.js.map +1 -1
  55. package/dist/utils/caip.d.ts +37 -0
  56. package/dist/utils/caip.js +48 -0
  57. package/dist/utils/caip.js.map +1 -0
  58. package/dist/utils/index.d.ts +3 -0
  59. package/dist/utils/index.js +20 -0
  60. package/dist/utils/index.js.map +1 -0
  61. package/dist/utils/types.d.ts +17 -0
  62. package/dist/utils/types.js +29 -0
  63. package/dist/utils/types.js.map +1 -0
  64. package/dist/utils/typing.d.ts +32 -0
  65. package/dist/utils/typing.js +21 -0
  66. package/dist/utils/typing.js.map +1 -0
  67. package/package.json +26 -26
  68. package/dist/api.js +0 -108
  69. package/dist/api.js.map +0 -1
  70. package/dist/base-types.d.ts +0 -62
  71. package/dist/base-types.js +0 -32
  72. package/dist/base-types.js.map +0 -1
  73. package/dist/utils.d.ts +0 -26
  74. package/dist/utils.js +0 -26
  75. package/dist/utils.js.map +0 -1
@@ -9,43 +9,29 @@ export declare const ListAccountsRequestStruct: import("superstruct").Struct<{
9
9
  id: import("superstruct").Struct<string | number | null, null>;
10
10
  }>;
11
11
  export declare type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;
12
- export declare const ListAccountsResponseStruct: import("superstruct").Struct<({
13
- type: "bip122:p2wpkh";
12
+ export declare const ListAccountsResponseStruct: import("superstruct").Struct<{
13
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
14
14
  id: string;
15
15
  address: string;
16
16
  options: Record<string, import("@metamask/utils").Json>;
17
- methods: "btc_sendmany"[];
18
- } | {
19
- type: "eip155:eoa";
20
- id: string;
21
- address: string;
22
- options: Record<string, import("@metamask/utils").Json>;
23
- methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
24
- } | {
25
- type: "eip155:erc4337";
26
- id: string;
27
- address: string;
28
- options: Record<string, import("@metamask/utils").Json>;
29
- methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
30
- })[], import("superstruct").Struct<{
31
- type: "bip122:p2wpkh";
32
- id: string;
33
- address: string;
34
- options: Record<string, import("@metamask/utils").Json>;
35
- methods: "btc_sendmany"[];
36
- } | {
37
- type: "eip155:eoa";
38
- id: string;
39
- address: string;
40
- options: Record<string, import("@metamask/utils").Json>;
41
- methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
42
- } | {
43
- type: "eip155:erc4337";
17
+ methods: string[];
18
+ }[], import("superstruct").Struct<{
19
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
44
20
  id: string;
45
21
  address: string;
46
22
  options: Record<string, import("@metamask/utils").Json>;
47
- methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
48
- }, null>>;
23
+ methods: string[];
24
+ }, {
25
+ id: import("superstruct").Struct<string, null>;
26
+ type: import("superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
27
+ "eip155:eoa": "eip155:eoa";
28
+ "eip155:erc4337": "eip155:erc4337";
29
+ "bip122:p2wpkh": "bip122:p2wpkh";
30
+ }>;
31
+ address: import("superstruct").Struct<string, null>;
32
+ options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
33
+ methods: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;
34
+ }>>;
49
35
  export declare type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;
50
36
  export declare const GetAccountRequestStruct: import("superstruct").Struct<{
51
37
  jsonrpc: "2.0";
@@ -66,24 +52,22 @@ export declare const GetAccountRequestStruct: import("superstruct").Struct<{
66
52
  }>;
67
53
  export declare type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;
68
54
  export declare const GetAccountResponseStruct: import("superstruct").Struct<{
69
- type: "bip122:p2wpkh";
70
- id: string;
71
- address: string;
72
- options: Record<string, import("@metamask/utils").Json>;
73
- methods: "btc_sendmany"[];
74
- } | {
75
- type: "eip155:eoa";
76
- id: string;
77
- address: string;
78
- options: Record<string, import("@metamask/utils").Json>;
79
- methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
80
- } | {
81
- type: "eip155:erc4337";
55
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
82
56
  id: string;
83
57
  address: string;
84
58
  options: Record<string, import("@metamask/utils").Json>;
85
- methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
86
- }, null>;
59
+ methods: string[];
60
+ }, {
61
+ id: import("superstruct").Struct<string, null>;
62
+ type: import("superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
63
+ "eip155:eoa": "eip155:eoa";
64
+ "eip155:erc4337": "eip155:erc4337";
65
+ "bip122:p2wpkh": "bip122:p2wpkh";
66
+ }>;
67
+ address: import("superstruct").Struct<string, null>;
68
+ options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
69
+ methods: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;
70
+ }>;
87
71
  export declare type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;
88
72
  export declare const CreateAccountRequestStruct: import("superstruct").Struct<{
89
73
  jsonrpc: "2.0";
@@ -104,25 +88,49 @@ export declare const CreateAccountRequestStruct: import("superstruct").Struct<{
104
88
  }>;
105
89
  export declare type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;
106
90
  export declare const CreateAccountResponseStruct: import("superstruct").Struct<{
107
- type: "bip122:p2wpkh";
91
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
108
92
  id: string;
109
93
  address: string;
110
94
  options: Record<string, import("@metamask/utils").Json>;
111
- methods: "btc_sendmany"[];
112
- } | {
113
- type: "eip155:eoa";
114
- id: string;
115
- address: string;
116
- options: Record<string, import("@metamask/utils").Json>;
117
- methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
118
- } | {
119
- type: "eip155:erc4337";
120
- id: string;
121
- address: string;
122
- options: Record<string, import("@metamask/utils").Json>;
123
- methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
124
- }, null>;
95
+ methods: string[];
96
+ }, {
97
+ id: import("superstruct").Struct<string, null>;
98
+ type: import("superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
99
+ "eip155:eoa": "eip155:eoa";
100
+ "eip155:erc4337": "eip155:erc4337";
101
+ "bip122:p2wpkh": "bip122:p2wpkh";
102
+ }>;
103
+ address: import("superstruct").Struct<string, null>;
104
+ options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
105
+ methods: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;
106
+ }>;
125
107
  export declare type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;
108
+ export declare const GetAccountBalancesRequestStruct: import("superstruct").Struct<{
109
+ jsonrpc: "2.0";
110
+ id: string | number | null;
111
+ method: "keyring_getAccountBalances";
112
+ params: {
113
+ id: string;
114
+ assets: string[];
115
+ };
116
+ }, {
117
+ method: import("superstruct").Struct<"keyring_getAccountBalances", "keyring_getAccountBalances">;
118
+ params: import("superstruct").Struct<{
119
+ id: string;
120
+ assets: string[];
121
+ }, {
122
+ id: import("superstruct").Struct<string, null>;
123
+ assets: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;
124
+ }>;
125
+ jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
126
+ id: import("superstruct").Struct<string | number | null, null>;
127
+ }>;
128
+ export declare type GetAccountBalancesRequest = Infer<typeof GetAccountBalancesRequestStruct>;
129
+ export declare const GetAccountBalancesResponseStruct: import("superstruct").Struct<Record<string, {
130
+ amount: string;
131
+ unit: string;
132
+ }>, null>;
133
+ export declare type GetAccountBalancesResponse = Infer<typeof GetAccountBalancesResponseStruct>;
126
134
  export declare const FilterAccountChainsStruct: import("superstruct").Struct<{
127
135
  jsonrpc: "2.0";
128
136
  id: string | number | null;
@@ -152,67 +160,41 @@ export declare const UpdateAccountRequestStruct: import("superstruct").Struct<{
152
160
  method: "keyring_updateAccount";
153
161
  params: {
154
162
  account: {
155
- type: "bip122:p2wpkh";
156
- id: string;
157
- address: string;
158
- options: Record<string, import("@metamask/utils").Json>;
159
- methods: "btc_sendmany"[];
160
- } | {
161
- type: "eip155:eoa";
163
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
162
164
  id: string;
163
165
  address: string;
164
166
  options: Record<string, import("@metamask/utils").Json>;
165
- methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
166
- } | {
167
- type: "eip155:erc4337";
168
- id: string;
169
- address: string;
170
- options: Record<string, import("@metamask/utils").Json>;
171
- methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
167
+ methods: string[];
172
168
  };
173
169
  };
174
170
  }, {
175
171
  method: import("superstruct").Struct<"keyring_updateAccount", "keyring_updateAccount">;
176
172
  params: import("superstruct").Struct<{
177
173
  account: {
178
- type: "bip122:p2wpkh";
174
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
179
175
  id: string;
180
176
  address: string;
181
177
  options: Record<string, import("@metamask/utils").Json>;
182
- methods: "btc_sendmany"[];
183
- } | {
184
- type: "eip155:eoa";
185
- id: string;
186
- address: string;
187
- options: Record<string, import("@metamask/utils").Json>;
188
- methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
189
- } | {
190
- type: "eip155:erc4337";
191
- id: string;
192
- address: string;
193
- options: Record<string, import("@metamask/utils").Json>;
194
- methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
178
+ methods: string[];
195
179
  };
196
180
  }, {
197
181
  account: import("superstruct").Struct<{
198
- type: "bip122:p2wpkh";
182
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
199
183
  id: string;
200
184
  address: string;
201
185
  options: Record<string, import("@metamask/utils").Json>;
202
- methods: "btc_sendmany"[];
203
- } | {
204
- type: "eip155:eoa";
205
- id: string;
206
- address: string;
207
- options: Record<string, import("@metamask/utils").Json>;
208
- methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
209
- } | {
210
- type: "eip155:erc4337";
211
- id: string;
212
- address: string;
213
- options: Record<string, import("@metamask/utils").Json>;
214
- methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
215
- }, null>;
186
+ methods: string[];
187
+ }, {
188
+ id: import("superstruct").Struct<string, null>;
189
+ type: import("superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
190
+ "eip155:eoa": "eip155:eoa";
191
+ "eip155:erc4337": "eip155:erc4337";
192
+ "bip122:p2wpkh": "bip122:p2wpkh";
193
+ }>;
194
+ address: import("superstruct").Struct<string, null>;
195
+ options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
196
+ methods: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;
197
+ }>;
216
198
  }>;
217
199
  jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
218
200
  id: import("superstruct").Struct<string | number | null, null>;
@@ -272,16 +254,16 @@ export declare const ListRequestsRequestStruct: import("superstruct").Struct<{
272
254
  export declare type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;
273
255
  export declare const ListRequestsResponseStruct: import("superstruct").Struct<{
274
256
  id: string;
275
- account: string;
276
257
  scope: string;
258
+ account: string;
277
259
  request: {
278
260
  method: string;
279
261
  params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
280
262
  };
281
263
  }[], import("superstruct").Struct<{
282
264
  id: string;
283
- account: string;
284
265
  scope: string;
266
+ account: string;
285
267
  request: {
286
268
  method: string;
287
269
  params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
@@ -295,7 +277,7 @@ export declare const ListRequestsResponseStruct: import("superstruct").Struct<{
295
277
  params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
296
278
  }, {
297
279
  method: import("superstruct").Struct<string, null>;
298
- params: import("superstruct").Struct<import("..").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
280
+ params: import("superstruct").Struct<import("../superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
299
281
  }>;
300
282
  }>>;
301
283
  export declare type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;
@@ -319,8 +301,8 @@ export declare const GetRequestRequestStruct: import("superstruct").Struct<{
319
301
  export declare type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;
320
302
  export declare const GetRequestResponseStruct: import("superstruct").Struct<{
321
303
  id: string;
322
- account: string;
323
304
  scope: string;
305
+ account: string;
324
306
  request: {
325
307
  method: string;
326
308
  params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
@@ -334,7 +316,7 @@ export declare const GetRequestResponseStruct: import("superstruct").Struct<{
334
316
  params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
335
317
  }, {
336
318
  method: import("superstruct").Struct<string, null>;
337
- params: import("superstruct").Struct<import("..").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
319
+ params: import("superstruct").Struct<import("../superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
338
320
  }>;
339
321
  }>;
340
322
  export declare type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;
@@ -344,8 +326,8 @@ export declare const SubmitRequestRequestStruct: import("superstruct").Struct<{
344
326
  method: "keyring_submitRequest";
345
327
  params: {
346
328
  id: string;
347
- account: string;
348
329
  scope: string;
330
+ account: string;
349
331
  request: {
350
332
  method: string;
351
333
  params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
@@ -355,8 +337,8 @@ export declare const SubmitRequestRequestStruct: import("superstruct").Struct<{
355
337
  method: import("superstruct").Struct<"keyring_submitRequest", "keyring_submitRequest">;
356
338
  params: import("superstruct").Struct<{
357
339
  id: string;
358
- account: string;
359
340
  scope: string;
341
+ account: string;
360
342
  request: {
361
343
  method: string;
362
344
  params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
@@ -370,7 +352,7 @@ export declare const SubmitRequestRequestStruct: import("superstruct").Struct<{
370
352
  params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
371
353
  }, {
372
354
  method: import("superstruct").Struct<string, null>;
373
- params: import("superstruct").Struct<import("..").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
355
+ params: import("superstruct").Struct<import("../superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
374
356
  }>;
375
357
  }>;
376
358
  jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
@@ -1,47 +1,60 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = exports.ApproveRequestResponseStruct = exports.ApproveRequestRequestStruct = exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.GetRequestResponseStruct = exports.GetRequestRequestStruct = exports.ListRequestsResponseStruct = exports.ListRequestsRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.UpdateAccountResponseStruct = exports.UpdateAccountRequestStruct = exports.FilterAccountChainsResponseStruct = exports.FilterAccountChainsStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = void 0;
3
+ exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = exports.ApproveRequestResponseStruct = exports.ApproveRequestRequestStruct = exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.GetRequestResponseStruct = exports.GetRequestRequestStruct = exports.ListRequestsResponseStruct = exports.ListRequestsRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.UpdateAccountResponseStruct = exports.UpdateAccountRequestStruct = exports.FilterAccountChainsResponseStruct = exports.FilterAccountChainsStruct = exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = void 0;
4
4
  const utils_1 = require("@metamask/utils");
5
5
  const superstruct_1 = require("superstruct");
6
6
  const api_1 = require("../api");
7
+ const superstruct_2 = require("../superstruct");
7
8
  const utils_2 = require("../utils");
9
+ const rpc_1 = require("./rpc");
8
10
  const CommonHeader = {
9
11
  jsonrpc: (0, superstruct_1.literal)('2.0'),
10
12
  id: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)(), (0, superstruct_1.literal)(null)]),
11
13
  };
12
14
  // ----------------------------------------------------------------------------
13
15
  // List accounts
14
- exports.ListAccountsRequestStruct = (0, superstruct_1.object)({
16
+ exports.ListAccountsRequestStruct = (0, superstruct_2.object)({
15
17
  ...CommonHeader,
16
18
  method: (0, superstruct_1.literal)('keyring_listAccounts'),
17
19
  });
18
20
  exports.ListAccountsResponseStruct = (0, superstruct_1.array)(api_1.KeyringAccountStruct);
19
21
  // ----------------------------------------------------------------------------
20
22
  // Get account
21
- exports.GetAccountRequestStruct = (0, superstruct_1.object)({
23
+ exports.GetAccountRequestStruct = (0, superstruct_2.object)({
22
24
  ...CommonHeader,
23
25
  method: (0, superstruct_1.literal)('keyring_getAccount'),
24
- params: (0, superstruct_1.object)({
26
+ params: (0, superstruct_2.object)({
25
27
  id: utils_2.UuidStruct,
26
28
  }),
27
29
  });
28
30
  exports.GetAccountResponseStruct = api_1.KeyringAccountStruct;
29
31
  // ----------------------------------------------------------------------------
30
32
  // Create account
31
- exports.CreateAccountRequestStruct = (0, superstruct_1.object)({
33
+ exports.CreateAccountRequestStruct = (0, superstruct_2.object)({
32
34
  ...CommonHeader,
33
35
  method: (0, superstruct_1.literal)('keyring_createAccount'),
34
- params: (0, superstruct_1.object)({
36
+ params: (0, superstruct_2.object)({
35
37
  options: (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct),
36
38
  }),
37
39
  });
38
40
  exports.CreateAccountResponseStruct = api_1.KeyringAccountStruct;
39
41
  // ----------------------------------------------------------------------------
42
+ // Get account balances
43
+ exports.GetAccountBalancesRequestStruct = (0, superstruct_2.object)({
44
+ ...CommonHeader,
45
+ method: (0, superstruct_1.literal)(`${rpc_1.KeyringRpcMethod.GetAccountBalances}`),
46
+ params: (0, superstruct_2.object)({
47
+ id: utils_2.UuidStruct,
48
+ assets: (0, superstruct_1.array)(utils_2.CaipAssetTypeStruct),
49
+ }),
50
+ });
51
+ exports.GetAccountBalancesResponseStruct = (0, superstruct_1.record)(utils_2.CaipAssetTypeStruct, api_1.BalanceStruct);
52
+ // ----------------------------------------------------------------------------
40
53
  // Filter account chains
41
- exports.FilterAccountChainsStruct = (0, superstruct_1.object)({
54
+ exports.FilterAccountChainsStruct = (0, superstruct_2.object)({
42
55
  ...CommonHeader,
43
56
  method: (0, superstruct_1.literal)('keyring_filterAccountChains'),
44
- params: (0, superstruct_1.object)({
57
+ params: (0, superstruct_2.object)({
45
58
  id: utils_2.UuidStruct,
46
59
  chains: (0, superstruct_1.array)((0, superstruct_1.string)()),
47
60
  }),
@@ -49,54 +62,54 @@ exports.FilterAccountChainsStruct = (0, superstruct_1.object)({
49
62
  exports.FilterAccountChainsResponseStruct = (0, superstruct_1.array)((0, superstruct_1.string)());
50
63
  // ----------------------------------------------------------------------------
51
64
  // Update account
52
- exports.UpdateAccountRequestStruct = (0, superstruct_1.object)({
65
+ exports.UpdateAccountRequestStruct = (0, superstruct_2.object)({
53
66
  ...CommonHeader,
54
67
  method: (0, superstruct_1.literal)('keyring_updateAccount'),
55
- params: (0, superstruct_1.object)({
68
+ params: (0, superstruct_2.object)({
56
69
  account: api_1.KeyringAccountStruct,
57
70
  }),
58
71
  });
59
72
  exports.UpdateAccountResponseStruct = (0, superstruct_1.literal)(null);
60
73
  // ----------------------------------------------------------------------------
61
74
  // Delete account
62
- exports.DeleteAccountRequestStruct = (0, superstruct_1.object)({
75
+ exports.DeleteAccountRequestStruct = (0, superstruct_2.object)({
63
76
  ...CommonHeader,
64
77
  method: (0, superstruct_1.literal)('keyring_deleteAccount'),
65
- params: (0, superstruct_1.object)({
78
+ params: (0, superstruct_2.object)({
66
79
  id: utils_2.UuidStruct,
67
80
  }),
68
81
  });
69
82
  exports.DeleteAccountResponseStruct = (0, superstruct_1.literal)(null);
70
83
  // ----------------------------------------------------------------------------
71
84
  // Export account
72
- exports.ExportAccountRequestStruct = (0, superstruct_1.object)({
85
+ exports.ExportAccountRequestStruct = (0, superstruct_2.object)({
73
86
  ...CommonHeader,
74
87
  method: (0, superstruct_1.literal)('keyring_exportAccount'),
75
- params: (0, superstruct_1.object)({
88
+ params: (0, superstruct_2.object)({
76
89
  id: utils_2.UuidStruct,
77
90
  }),
78
91
  });
79
92
  exports.ExportAccountResponseStruct = api_1.KeyringAccountDataStruct;
80
93
  // ----------------------------------------------------------------------------
81
94
  // List requests
82
- exports.ListRequestsRequestStruct = (0, superstruct_1.object)({
95
+ exports.ListRequestsRequestStruct = (0, superstruct_2.object)({
83
96
  ...CommonHeader,
84
97
  method: (0, superstruct_1.literal)('keyring_listRequests'),
85
98
  });
86
99
  exports.ListRequestsResponseStruct = (0, superstruct_1.array)(api_1.KeyringRequestStruct);
87
100
  // ----------------------------------------------------------------------------
88
101
  // Get request
89
- exports.GetRequestRequestStruct = (0, superstruct_1.object)({
102
+ exports.GetRequestRequestStruct = (0, superstruct_2.object)({
90
103
  ...CommonHeader,
91
104
  method: (0, superstruct_1.literal)('keyring_getRequest'),
92
- params: (0, superstruct_1.object)({
105
+ params: (0, superstruct_2.object)({
93
106
  id: utils_2.UuidStruct,
94
107
  }),
95
108
  });
96
109
  exports.GetRequestResponseStruct = api_1.KeyringRequestStruct;
97
110
  // ----------------------------------------------------------------------------
98
111
  // Submit request
99
- exports.SubmitRequestRequestStruct = (0, superstruct_1.object)({
112
+ exports.SubmitRequestRequestStruct = (0, superstruct_2.object)({
100
113
  ...CommonHeader,
101
114
  method: (0, superstruct_1.literal)('keyring_submitRequest'),
102
115
  params: api_1.KeyringRequestStruct,
@@ -104,10 +117,10 @@ exports.SubmitRequestRequestStruct = (0, superstruct_1.object)({
104
117
  exports.SubmitRequestResponseStruct = api_1.KeyringResponseStruct;
105
118
  // ----------------------------------------------------------------------------
106
119
  // Approve request
107
- exports.ApproveRequestRequestStruct = (0, superstruct_1.object)({
120
+ exports.ApproveRequestRequestStruct = (0, superstruct_2.object)({
108
121
  ...CommonHeader,
109
122
  method: (0, superstruct_1.literal)('keyring_approveRequest'),
110
- params: (0, superstruct_1.object)({
123
+ params: (0, superstruct_2.object)({
111
124
  id: utils_2.UuidStruct,
112
125
  data: (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct),
113
126
  }),
@@ -115,10 +128,10 @@ exports.ApproveRequestRequestStruct = (0, superstruct_1.object)({
115
128
  exports.ApproveRequestResponseStruct = (0, superstruct_1.literal)(null);
116
129
  // ----------------------------------------------------------------------------
117
130
  // Reject request
118
- exports.RejectRequestRequestStruct = (0, superstruct_1.object)({
131
+ exports.RejectRequestRequestStruct = (0, superstruct_2.object)({
119
132
  ...CommonHeader,
120
133
  method: (0, superstruct_1.literal)('keyring_rejectRequest'),
121
- params: (0, superstruct_1.object)({
134
+ params: (0, superstruct_2.object)({
122
135
  id: utils_2.UuidStruct,
123
136
  }),
124
137
  });
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/internal/api.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAE7C,6CAQqB;AAErB,gCAKgB;AAChB,oCAAsC;AAEtC,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBA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C;IAC5C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,oBAAoB,CAAC;IACrC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,wBAAwB,GAAG,0BAAoB,CAAC;AAI7D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,0BAAoB;CAC7B,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,2BAAqB,CAAC;AAIjE,+EAA+E;AAC/E,kBAAkB;AAEL,QAAA,2BAA2B,GAAG,IAAA,oBAAM,EAAC;IAChD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,wBAAwB,CAAC;IACzC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;QACd,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,4BAA4B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC;AAI1D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport {\n array,\n literal,\n number,\n object,\n record,\n string,\n union,\n} from 'superstruct';\n\nimport {\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n} from '../api';\nimport { UuidStruct } from '../utils';\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// List accounts\n\nexport const ListAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccounts'),\n});\n\nexport type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;\n\nexport const ListAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_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 account\n\nexport const CreateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_createAccount'),\n params: object({\n options: record(string(), JsonStruct),\n }),\n});\n\nexport type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;\n\nexport const CreateAccountResponseStruct = KeyringAccountStruct;\n\nexport type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: UuidStruct,\n chains: array(string()),\n }),\n});\n\nexport type FilterAccountChainsRequest = Infer<\n typeof FilterAccountChainsStruct\n>;\n\nexport const FilterAccountChainsResponseStruct = array(string());\n\nexport type FilterAccountChainsResponse = Infer<\n typeof FilterAccountChainsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Update account\n\nexport const UpdateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_updateAccount'),\n params: object({\n account: KeyringAccountStruct,\n }),\n});\n\nexport type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;\n\nexport const UpdateAccountResponseStruct = literal(null);\n\nexport type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_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('keyring_exportAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = KeyringAccountDataStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List requests\n\nexport const ListRequestsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listRequests'),\n});\n\nexport type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;\n\nexport const ListRequestsResponseStruct = array(KeyringRequestStruct);\n\nexport type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get request\n\nexport const GetRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;\n\nexport const GetRequestResponseStruct = KeyringRequestStruct;\n\nexport type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_submitRequest'),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = KeyringResponseStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Approve request\n\nexport const ApproveRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_approveRequest'),\n params: object({\n id: UuidStruct,\n data: record(string(), JsonStruct),\n }),\n});\n\nexport type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;\n\nexport const ApproveRequestResponseStruct = literal(null);\n\nexport type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Reject request\n\nexport const RejectRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_rejectRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/internal/api.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAE7C,6CAA4E;AAE5E,gCAMgB;AAChB,gDAAwC;AACxC,oCAA2D;AAC3D,+BAAyC;AAEzC,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,gBAAgB;AAEH,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,sBAAsB,CAAC;CACxC,CAAC,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G,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { array, literal, number, record, string, union } from 'superstruct';\n\nimport {\n BalanceStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n} from '../api';\nimport { object } from '../superstruct';\nimport { CaipAssetTypeStruct, UuidStruct } from '../utils';\nimport { KeyringRpcMethod } from './rpc';\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// List accounts\n\nexport const ListAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccounts'),\n});\n\nexport type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;\n\nexport const ListAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_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 account\n\nexport const CreateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_createAccount'),\n params: object({\n options: record(string(), JsonStruct),\n }),\n});\n\nexport type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;\n\nexport const CreateAccountResponseStruct = KeyringAccountStruct;\n\nexport type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.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// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: UuidStruct,\n chains: array(string()),\n }),\n});\n\nexport type FilterAccountChainsRequest = Infer<\n typeof FilterAccountChainsStruct\n>;\n\nexport const FilterAccountChainsResponseStruct = array(string());\n\nexport type FilterAccountChainsResponse = Infer<\n typeof FilterAccountChainsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Update account\n\nexport const UpdateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_updateAccount'),\n params: object({\n account: KeyringAccountStruct,\n }),\n});\n\nexport type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;\n\nexport const UpdateAccountResponseStruct = literal(null);\n\nexport type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_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('keyring_exportAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = KeyringAccountDataStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List requests\n\nexport const ListRequestsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listRequests'),\n});\n\nexport type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;\n\nexport const ListRequestsResponseStruct = array(KeyringRequestStruct);\n\nexport type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get request\n\nexport const GetRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;\n\nexport const GetRequestResponseStruct = KeyringRequestStruct;\n\nexport type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_submitRequest'),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = KeyringResponseStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Approve request\n\nexport const ApproveRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_approveRequest'),\n params: object({\n id: UuidStruct,\n data: record(string(), JsonStruct),\n }),\n});\n\nexport type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;\n\nexport const ApproveRequestResponseStruct = literal(null);\n\nexport type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Reject request\n\nexport const RejectRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_rejectRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}