@metamask/keyring-api 0.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyring-client.js","sourceRoot":"","sources":["../src/keyring-client.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Json } from '@metamask/utils';\nimport { assert } from 'superstruct';\nimport { v4 as uuid } from 'uuid';\n\nimport {\n Keyring,\n KeyringAccount,\n KeyringRequest,\n SubmitRequestResponse,\n} from './keyring-api';\nimport { InternalRequest, InternalRequestStruct } from './keyring-internal-api';\nimport { OmitUnion } from './utils';\n\nexport type Sender = {\n send<Response extends Json>(request: InternalRequest): Promise<Response>;\n};\n\nexport class KeyringClient implements Keyring {\n #sender: Sender;\n\n /**\n * Create a new instance of `KeyringClient`.\n *\n * @param sender - The `Sender` instance to use to send requests to the snap.\n */\n constructor(sender: Sender) {\n this.#sender = sender;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param partial - Partial internal request (method and params).\n * @returns A promise that resolves to the response to the request.\n */\n async #send<Response extends Json>(\n partial: OmitUnion<InternalRequest, 'jsonrpc' | 'id'>,\n ): Promise<Response> {\n const request = {\n jsonrpc: '2.0',\n id: uuid(),\n ...partial,\n };\n assert(request, InternalRequestStruct);\n return await this.#sender.send<Response>(request);\n }\n\n async listAccounts(): Promise<KeyringAccount[]> {\n return await this.#send<KeyringAccount[]>({\n method: 'keyring_listAccounts',\n });\n }\n\n async getAccount(id: string): Promise<KeyringAccount> {\n return await this.#send<KeyringAccount>({\n method: 'keyring_getAccount',\n params: { id },\n });\n }\n\n async createAccount(\n name: string,\n options: Record<string, Json> | null = null,\n ): Promise<KeyringAccount> {\n return await this.#send<KeyringAccount>({\n method: 'keyring_createAccount',\n params: { name, options },\n });\n }\n\n async filterAccountChains(id: string, chains: string[]): Promise<string[]> {\n return await this.#send<string[]>({\n method: 'keyring_filterAccountChains',\n params: { id, chains },\n });\n }\n\n async updateAccount(account: KeyringAccount): Promise<void> {\n await this.#send<null>({\n method: 'keyring_updateAccount',\n params: { account },\n });\n }\n\n async deleteAccount(id: string): Promise<void> {\n await this.#send<null>({\n method: 'keyring_deleteAccount',\n params: { id },\n });\n }\n\n async listRequests(): Promise<KeyringRequest[]> {\n return await this.#send<KeyringRequest[]>({\n method: 'keyring_listRequests',\n });\n }\n\n async getRequest(id: string): Promise<KeyringRequest> {\n return await this.#send<KeyringRequest>({\n method: 'keyring_getRequest',\n params: { id },\n });\n }\n\n async submitRequest(request: KeyringRequest): Promise<SubmitRequestResponse> {\n return await this.#send<SubmitRequestResponse>({\n method: 'keyring_submitRequest',\n params: request,\n });\n }\n\n async approveRequest(id: string): Promise<void> {\n await this.#send<null>({\n method: 'keyring_approveRequest',\n params: { id },\n });\n }\n\n async rejectRequest(id: string): Promise<void> {\n await this.#send<null>({\n method: 'keyring_rejectRequest',\n params: { id },\n });\n }\n}\n"]}
@@ -0,0 +1,588 @@
1
+ import { Infer } from 'superstruct';
2
+ export declare const ListAccountsRequestStruct: import("superstruct").Struct<{
3
+ id: string;
4
+ jsonrpc: "2.0";
5
+ method: "keyring_listAccounts" | "keyring_getAccount" | "keyring_createAccount" | "keyring_filterAccountChains" | "keyring_updateAccount" | "keyring_deleteAccount" | "keyring_listRequests" | "keyring_getRequest" | "keyring_submitRequest" | "keyring_approveRequest" | "keyring_rejectRequest";
6
+ }, {
7
+ id: import("superstruct").Struct<string, null>;
8
+ jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
9
+ method: import("superstruct").Struct<"keyring_listAccounts" | "keyring_getAccount" | "keyring_createAccount" | "keyring_filterAccountChains" | "keyring_updateAccount" | "keyring_deleteAccount" | "keyring_listRequests" | "keyring_getRequest" | "keyring_submitRequest" | "keyring_approveRequest" | "keyring_rejectRequest", {
10
+ keyring_listAccounts: "keyring_listAccounts";
11
+ keyring_getAccount: "keyring_getAccount";
12
+ keyring_createAccount: "keyring_createAccount";
13
+ keyring_filterAccountChains: "keyring_filterAccountChains";
14
+ keyring_updateAccount: "keyring_updateAccount";
15
+ keyring_deleteAccount: "keyring_deleteAccount";
16
+ keyring_listRequests: "keyring_listRequests";
17
+ keyring_getRequest: "keyring_getRequest";
18
+ keyring_submitRequest: "keyring_submitRequest";
19
+ keyring_approveRequest: "keyring_approveRequest";
20
+ keyring_rejectRequest: "keyring_rejectRequest";
21
+ }>;
22
+ }>;
23
+ export declare type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;
24
+ export declare const ListAccountsResponseStruct: import("superstruct").Struct<{
25
+ id: string;
26
+ name: string;
27
+ address: string;
28
+ options: Record<string, import("@metamask/utils").Json> | null;
29
+ supportedMethods: ("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
30
+ type: "eip155:eoa" | "eip155:erc4337";
31
+ }[], import("superstruct").Struct<{
32
+ id: string;
33
+ name: string;
34
+ address: string;
35
+ options: Record<string, import("@metamask/utils").Json> | null;
36
+ supportedMethods: ("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
37
+ type: "eip155:eoa" | "eip155:erc4337";
38
+ }, {
39
+ id: import("superstruct").Struct<string, null>;
40
+ name: import("superstruct").Struct<string, null>;
41
+ address: import("superstruct").Struct<string, null>;
42
+ options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json> | null, null>;
43
+ supportedMethods: import("superstruct").Struct<("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
44
+ personal_sign: "personal_sign";
45
+ eth_sendTransaction: "eth_sendTransaction";
46
+ eth_sign: "eth_sign";
47
+ eth_signTransaction: "eth_signTransaction";
48
+ eth_signTypedData: "eth_signTypedData";
49
+ eth_signTypedData_v1: "eth_signTypedData_v1";
50
+ eth_signTypedData_v2: "eth_signTypedData_v2";
51
+ eth_signTypedData_v3: "eth_signTypedData_v3";
52
+ eth_signTypedData_v4: "eth_signTypedData_v4";
53
+ }>>;
54
+ type: import("superstruct").Struct<"eip155:eoa" | "eip155:erc4337", {
55
+ "eip155:eoa": "eip155:eoa";
56
+ "eip155:erc4337": "eip155:erc4337";
57
+ }>;
58
+ }>>;
59
+ export declare type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;
60
+ export declare const GetAccountRequestStruct: import("superstruct").Struct<{
61
+ id: string;
62
+ jsonrpc: "2.0";
63
+ method: "keyring_getAccount";
64
+ params: {
65
+ id: string;
66
+ };
67
+ }, {
68
+ id: import("superstruct").Struct<string, null>;
69
+ jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
70
+ method: import("superstruct").Struct<"keyring_getAccount", "keyring_getAccount">;
71
+ params: import("superstruct").Struct<{
72
+ id: string;
73
+ }, {
74
+ id: import("superstruct").Struct<string, null>;
75
+ }>;
76
+ }>;
77
+ export declare type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;
78
+ export declare const GetAccountResponseStruct: import("superstruct").Struct<{
79
+ id: string;
80
+ name: string;
81
+ address: string;
82
+ options: Record<string, import("@metamask/utils").Json> | null;
83
+ supportedMethods: ("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
84
+ type: "eip155:eoa" | "eip155:erc4337";
85
+ }, {
86
+ id: import("superstruct").Struct<string, null>;
87
+ name: import("superstruct").Struct<string, null>;
88
+ address: import("superstruct").Struct<string, null>;
89
+ options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json> | null, null>;
90
+ supportedMethods: import("superstruct").Struct<("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
91
+ personal_sign: "personal_sign";
92
+ eth_sendTransaction: "eth_sendTransaction";
93
+ eth_sign: "eth_sign";
94
+ eth_signTransaction: "eth_signTransaction";
95
+ eth_signTypedData: "eth_signTypedData";
96
+ eth_signTypedData_v1: "eth_signTypedData_v1";
97
+ eth_signTypedData_v2: "eth_signTypedData_v2";
98
+ eth_signTypedData_v3: "eth_signTypedData_v3";
99
+ eth_signTypedData_v4: "eth_signTypedData_v4";
100
+ }>>;
101
+ type: import("superstruct").Struct<"eip155:eoa" | "eip155:erc4337", {
102
+ "eip155:eoa": "eip155:eoa";
103
+ "eip155:erc4337": "eip155:erc4337";
104
+ }>;
105
+ }>;
106
+ export declare type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;
107
+ export declare const CreateAccountRequestStruct: import("superstruct").Struct<{
108
+ id: string;
109
+ jsonrpc: "2.0";
110
+ method: "keyring_createAccount";
111
+ params: {
112
+ name: string;
113
+ options: Record<string, import("@metamask/utils").Json> | null;
114
+ };
115
+ }, {
116
+ id: import("superstruct").Struct<string, null>;
117
+ jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
118
+ method: import("superstruct").Struct<"keyring_createAccount", "keyring_createAccount">;
119
+ params: import("superstruct").Struct<{
120
+ name: string;
121
+ options: Record<string, import("@metamask/utils").Json> | null;
122
+ }, {
123
+ name: import("superstruct").Struct<string, null>;
124
+ options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json> | null, null>;
125
+ }>;
126
+ }>;
127
+ export declare type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;
128
+ export declare const CreateAccountResponseStruct: import("superstruct").Struct<{
129
+ id: string;
130
+ name: string;
131
+ address: string;
132
+ options: Record<string, import("@metamask/utils").Json> | null;
133
+ supportedMethods: ("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
134
+ type: "eip155:eoa" | "eip155:erc4337";
135
+ }, {
136
+ id: import("superstruct").Struct<string, null>;
137
+ name: import("superstruct").Struct<string, null>;
138
+ address: import("superstruct").Struct<string, null>;
139
+ options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json> | null, null>;
140
+ supportedMethods: import("superstruct").Struct<("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
141
+ personal_sign: "personal_sign";
142
+ eth_sendTransaction: "eth_sendTransaction";
143
+ eth_sign: "eth_sign";
144
+ eth_signTransaction: "eth_signTransaction";
145
+ eth_signTypedData: "eth_signTypedData";
146
+ eth_signTypedData_v1: "eth_signTypedData_v1";
147
+ eth_signTypedData_v2: "eth_signTypedData_v2";
148
+ eth_signTypedData_v3: "eth_signTypedData_v3";
149
+ eth_signTypedData_v4: "eth_signTypedData_v4";
150
+ }>>;
151
+ type: import("superstruct").Struct<"eip155:eoa" | "eip155:erc4337", {
152
+ "eip155:eoa": "eip155:eoa";
153
+ "eip155:erc4337": "eip155:erc4337";
154
+ }>;
155
+ }>;
156
+ export declare type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;
157
+ export declare const FilterAccountChainsStruct: import("superstruct").Struct<{
158
+ id: string;
159
+ jsonrpc: "2.0";
160
+ method: "keyring_filterAccountChains";
161
+ params: {
162
+ id: string;
163
+ chains: string[];
164
+ };
165
+ }, {
166
+ id: import("superstruct").Struct<string, null>;
167
+ jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
168
+ method: import("superstruct").Struct<"keyring_filterAccountChains", "keyring_filterAccountChains">;
169
+ params: import("superstruct").Struct<{
170
+ id: string;
171
+ chains: string[];
172
+ }, {
173
+ id: import("superstruct").Struct<string, null>;
174
+ chains: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;
175
+ }>;
176
+ }>;
177
+ export declare type FilterAccountChainsRequest = Infer<typeof FilterAccountChainsStruct>;
178
+ export declare const FilterAccountChainsResponseStruct: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;
179
+ export declare type FilterAccountChainsResponse = Infer<typeof FilterAccountChainsResponseStruct>;
180
+ export declare const UpdateAccountRequestStruct: import("superstruct").Struct<{
181
+ id: string;
182
+ jsonrpc: "2.0";
183
+ method: "keyring_updateAccount";
184
+ params: {
185
+ account: {
186
+ id: string;
187
+ name: string;
188
+ address: string;
189
+ options: Record<string, import("@metamask/utils").Json> | null;
190
+ supportedMethods: ("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
191
+ type: "eip155:eoa" | "eip155:erc4337";
192
+ };
193
+ };
194
+ }, {
195
+ id: import("superstruct").Struct<string, null>;
196
+ jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
197
+ method: import("superstruct").Struct<"keyring_updateAccount", "keyring_updateAccount">;
198
+ params: import("superstruct").Struct<{
199
+ account: {
200
+ id: string;
201
+ name: string;
202
+ address: string;
203
+ options: Record<string, import("@metamask/utils").Json> | null;
204
+ supportedMethods: ("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
205
+ type: "eip155:eoa" | "eip155:erc4337";
206
+ };
207
+ }, {
208
+ account: import("superstruct").Struct<{
209
+ id: string;
210
+ name: string;
211
+ address: string;
212
+ options: Record<string, import("@metamask/utils").Json> | null;
213
+ supportedMethods: ("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
214
+ type: "eip155:eoa" | "eip155:erc4337";
215
+ }, {
216
+ id: import("superstruct").Struct<string, null>;
217
+ name: import("superstruct").Struct<string, null>;
218
+ address: import("superstruct").Struct<string, null>;
219
+ options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json> | null, null>;
220
+ supportedMethods: import("superstruct").Struct<("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
221
+ personal_sign: "personal_sign";
222
+ eth_sendTransaction: "eth_sendTransaction";
223
+ eth_sign: "eth_sign";
224
+ eth_signTransaction: "eth_signTransaction";
225
+ eth_signTypedData: "eth_signTypedData";
226
+ eth_signTypedData_v1: "eth_signTypedData_v1";
227
+ eth_signTypedData_v2: "eth_signTypedData_v2";
228
+ eth_signTypedData_v3: "eth_signTypedData_v3";
229
+ eth_signTypedData_v4: "eth_signTypedData_v4";
230
+ }>>;
231
+ type: import("superstruct").Struct<"eip155:eoa" | "eip155:erc4337", {
232
+ "eip155:eoa": "eip155:eoa";
233
+ "eip155:erc4337": "eip155:erc4337";
234
+ }>;
235
+ }>;
236
+ }>;
237
+ }>;
238
+ export declare type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;
239
+ export declare const UpdateAccountResponseStruct: import("superstruct").Struct<null, null>;
240
+ export declare type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;
241
+ export declare const DeleteAccountRequestStruct: import("superstruct").Struct<{
242
+ id: string;
243
+ jsonrpc: "2.0";
244
+ method: "keyring_deleteAccount";
245
+ params: {
246
+ id: string;
247
+ };
248
+ }, {
249
+ id: import("superstruct").Struct<string, null>;
250
+ jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
251
+ method: import("superstruct").Struct<"keyring_deleteAccount", "keyring_deleteAccount">;
252
+ params: import("superstruct").Struct<{
253
+ id: string;
254
+ }, {
255
+ id: import("superstruct").Struct<string, null>;
256
+ }>;
257
+ }>;
258
+ export declare type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;
259
+ export declare const DeleteAccountResponseStruct: import("superstruct").Struct<null, null>;
260
+ export declare type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;
261
+ export declare const ListRequestsRequestStruct: import("superstruct").Struct<{
262
+ id: string;
263
+ jsonrpc: "2.0";
264
+ method: "keyring_listRequests";
265
+ }, {
266
+ id: import("superstruct").Struct<string, null>;
267
+ jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
268
+ method: import("superstruct").Struct<"keyring_listRequests", "keyring_listRequests">;
269
+ }>;
270
+ export declare type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;
271
+ export declare const ListRequestsResponseStruct: import("superstruct").Struct<{
272
+ account: string;
273
+ scope: string;
274
+ request: {
275
+ id: string;
276
+ jsonrpc: "2.0";
277
+ method: string;
278
+ } | {
279
+ id: string;
280
+ jsonrpc: "2.0";
281
+ method: string;
282
+ params: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
283
+ };
284
+ }[], import("superstruct").Struct<{
285
+ account: string;
286
+ scope: string;
287
+ request: {
288
+ id: string;
289
+ jsonrpc: "2.0";
290
+ method: string;
291
+ } | {
292
+ id: string;
293
+ jsonrpc: "2.0";
294
+ method: string;
295
+ params: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
296
+ };
297
+ }, {
298
+ account: import("superstruct").Struct<string, null>;
299
+ scope: import("superstruct").Struct<string, null>;
300
+ request: import("superstruct").Struct<{
301
+ id: string;
302
+ jsonrpc: "2.0";
303
+ method: string;
304
+ } | {
305
+ id: string;
306
+ jsonrpc: "2.0";
307
+ method: string;
308
+ params: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
309
+ }, null>;
310
+ }>>;
311
+ export declare type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;
312
+ export declare const GetRequestRequestStruct: import("superstruct").Struct<{
313
+ id: string;
314
+ jsonrpc: "2.0";
315
+ method: "keyring_getRequest";
316
+ params: {
317
+ id: string;
318
+ };
319
+ }, {
320
+ id: import("superstruct").Struct<string, null>;
321
+ jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
322
+ method: import("superstruct").Struct<"keyring_getRequest", "keyring_getRequest">;
323
+ params: import("superstruct").Struct<{
324
+ id: string;
325
+ }, {
326
+ id: import("superstruct").Struct<string, null>;
327
+ }>;
328
+ }>;
329
+ export declare type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;
330
+ export declare const GetRequestResponseStruct: import("superstruct").Struct<{
331
+ account: string;
332
+ scope: string;
333
+ request: {
334
+ id: string;
335
+ jsonrpc: "2.0";
336
+ method: string;
337
+ } | {
338
+ id: string;
339
+ jsonrpc: "2.0";
340
+ method: string;
341
+ params: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
342
+ };
343
+ }, {
344
+ account: import("superstruct").Struct<string, null>;
345
+ scope: import("superstruct").Struct<string, null>;
346
+ request: import("superstruct").Struct<{
347
+ id: string;
348
+ jsonrpc: "2.0";
349
+ method: string;
350
+ } | {
351
+ id: string;
352
+ jsonrpc: "2.0";
353
+ method: string;
354
+ params: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
355
+ }, null>;
356
+ }>;
357
+ export declare type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;
358
+ export declare const SubmitRequestRequestStruct: import("superstruct").Struct<{
359
+ id: string;
360
+ jsonrpc: "2.0";
361
+ method: "keyring_submitRequest";
362
+ params: {
363
+ account: string;
364
+ scope: string;
365
+ request: {
366
+ id: string;
367
+ jsonrpc: "2.0";
368
+ method: string;
369
+ } | {
370
+ id: string;
371
+ jsonrpc: "2.0";
372
+ method: string;
373
+ params: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
374
+ };
375
+ };
376
+ }, {
377
+ id: import("superstruct").Struct<string, null>;
378
+ jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
379
+ method: import("superstruct").Struct<"keyring_submitRequest", "keyring_submitRequest">;
380
+ params: import("superstruct").Struct<{
381
+ account: string;
382
+ scope: string;
383
+ request: {
384
+ id: string;
385
+ jsonrpc: "2.0";
386
+ method: string;
387
+ } | {
388
+ id: string;
389
+ jsonrpc: "2.0";
390
+ method: string;
391
+ params: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
392
+ };
393
+ }, {
394
+ account: import("superstruct").Struct<string, null>;
395
+ scope: import("superstruct").Struct<string, null>;
396
+ request: import("superstruct").Struct<{
397
+ id: string;
398
+ jsonrpc: "2.0";
399
+ method: string;
400
+ } | {
401
+ id: string;
402
+ jsonrpc: "2.0";
403
+ method: string;
404
+ params: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
405
+ }, null>;
406
+ }>;
407
+ }>;
408
+ export declare type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;
409
+ export declare const ApproveRequestRequestStruct: import("superstruct").Struct<{
410
+ id: string;
411
+ jsonrpc: "2.0";
412
+ method: "keyring_approveRequest";
413
+ params: {
414
+ id: string;
415
+ };
416
+ }, {
417
+ id: import("superstruct").Struct<string, null>;
418
+ jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
419
+ method: import("superstruct").Struct<"keyring_approveRequest", "keyring_approveRequest">;
420
+ params: import("superstruct").Struct<{
421
+ id: string;
422
+ }, {
423
+ id: import("superstruct").Struct<string, null>;
424
+ }>;
425
+ }>;
426
+ export declare type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;
427
+ export declare const ApproveRequestResponseStruct: import("superstruct").Struct<null, null>;
428
+ export declare type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;
429
+ export declare const RejectRequestRequestStruct: import("superstruct").Struct<{
430
+ id: string;
431
+ jsonrpc: "2.0";
432
+ method: "keyring_rejectRequest";
433
+ params: {
434
+ id: string;
435
+ };
436
+ }, {
437
+ id: import("superstruct").Struct<string, null>;
438
+ jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
439
+ method: import("superstruct").Struct<"keyring_rejectRequest", "keyring_rejectRequest">;
440
+ params: import("superstruct").Struct<{
441
+ id: string;
442
+ }, {
443
+ id: import("superstruct").Struct<string, null>;
444
+ }>;
445
+ }>;
446
+ export declare type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;
447
+ export declare const RejectRequestResponseStruct: import("superstruct").Struct<null, null>;
448
+ export declare type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;
449
+ export declare const InternalRequestStruct: import("superstruct").Struct<{
450
+ id: string;
451
+ jsonrpc: "2.0";
452
+ method: "keyring_listAccounts" | "keyring_getAccount" | "keyring_createAccount" | "keyring_filterAccountChains" | "keyring_updateAccount" | "keyring_deleteAccount" | "keyring_listRequests" | "keyring_getRequest" | "keyring_submitRequest" | "keyring_approveRequest" | "keyring_rejectRequest";
453
+ } | {
454
+ id: string;
455
+ jsonrpc: "2.0";
456
+ method: "keyring_getAccount";
457
+ params: {
458
+ id: string;
459
+ };
460
+ } | {
461
+ id: string;
462
+ jsonrpc: "2.0";
463
+ method: "keyring_createAccount";
464
+ params: {
465
+ name: string;
466
+ options: Record<string, import("@metamask/utils").Json> | null;
467
+ };
468
+ } | {
469
+ id: string;
470
+ jsonrpc: "2.0";
471
+ method: "keyring_filterAccountChains";
472
+ params: {
473
+ id: string;
474
+ chains: string[];
475
+ };
476
+ } | {
477
+ id: string;
478
+ jsonrpc: "2.0";
479
+ method: "keyring_updateAccount";
480
+ params: {
481
+ account: {
482
+ id: string;
483
+ name: string;
484
+ address: string;
485
+ options: Record<string, import("@metamask/utils").Json> | null;
486
+ supportedMethods: ("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
487
+ type: "eip155:eoa" | "eip155:erc4337";
488
+ };
489
+ };
490
+ } | {
491
+ id: string;
492
+ jsonrpc: "2.0";
493
+ method: "keyring_deleteAccount";
494
+ params: {
495
+ id: string;
496
+ };
497
+ } | {
498
+ id: string;
499
+ jsonrpc: "2.0";
500
+ method: "keyring_listRequests";
501
+ } | {
502
+ id: string;
503
+ jsonrpc: "2.0";
504
+ method: "keyring_getRequest";
505
+ params: {
506
+ id: string;
507
+ };
508
+ } | {
509
+ id: string;
510
+ jsonrpc: "2.0";
511
+ method: "keyring_submitRequest";
512
+ params: {
513
+ account: string;
514
+ scope: string;
515
+ request: {
516
+ id: string;
517
+ jsonrpc: "2.0";
518
+ method: string;
519
+ } | {
520
+ id: string;
521
+ jsonrpc: "2.0";
522
+ method: string;
523
+ params: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
524
+ };
525
+ };
526
+ } | {
527
+ id: string;
528
+ jsonrpc: "2.0";
529
+ method: "keyring_approveRequest";
530
+ params: {
531
+ id: string;
532
+ };
533
+ } | {
534
+ id: string;
535
+ jsonrpc: "2.0";
536
+ method: "keyring_rejectRequest";
537
+ params: {
538
+ id: string;
539
+ };
540
+ }, null>;
541
+ export declare type InternalRequest = Infer<typeof InternalRequestStruct>;
542
+ export declare const InternalResponseStruct: import("superstruct").Struct<string[] | {
543
+ id: string;
544
+ name: string;
545
+ address: string;
546
+ options: Record<string, import("@metamask/utils").Json> | null;
547
+ supportedMethods: ("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
548
+ type: "eip155:eoa" | "eip155:erc4337";
549
+ } | {
550
+ account: string;
551
+ scope: string;
552
+ request: {
553
+ id: string;
554
+ jsonrpc: "2.0";
555
+ method: string;
556
+ } | {
557
+ id: string;
558
+ jsonrpc: "2.0";
559
+ method: string;
560
+ params: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
561
+ };
562
+ } | {
563
+ pending: true;
564
+ } | {
565
+ pending: false;
566
+ result: import("@metamask/utils").Json;
567
+ } | {
568
+ id: string;
569
+ name: string;
570
+ address: string;
571
+ options: Record<string, import("@metamask/utils").Json> | null;
572
+ supportedMethods: ("personal_sign" | "eth_sendTransaction" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData" | "eth_signTypedData_v1" | "eth_signTypedData_v2" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
573
+ type: "eip155:eoa" | "eip155:erc4337";
574
+ }[] | {
575
+ account: string;
576
+ scope: string;
577
+ request: {
578
+ id: string;
579
+ jsonrpc: "2.0";
580
+ method: string;
581
+ } | {
582
+ id: string;
583
+ jsonrpc: "2.0";
584
+ method: string;
585
+ params: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
586
+ };
587
+ }[] | null, null>;
588
+ export declare type InternalResponse = Infer<typeof InternalResponseStruct>;