@metamask-previews/keyring-controller 17.2.0-preview-cf09c0a → 17.2.0-preview-09a2ffd5

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 (44) hide show
  1. package/dist/KeyringController.js +22 -0
  2. package/dist/KeyringController.js.map +1 -0
  3. package/dist/KeyringController.mjs +20 -1585
  4. package/dist/KeyringController.mjs.map +1 -1
  5. package/dist/chunk-F64I344Z.mjs +68 -0
  6. package/dist/chunk-F64I344Z.mjs.map +1 -0
  7. package/dist/chunk-JQRVJ3XK.mjs +1595 -0
  8. package/dist/chunk-JQRVJ3XK.mjs.map +1 -0
  9. package/dist/chunk-NOCGQCUM.js +68 -0
  10. package/dist/chunk-NOCGQCUM.js.map +1 -0
  11. package/dist/chunk-YRSQWNOT.js +1595 -0
  12. package/dist/chunk-YRSQWNOT.js.map +1 -0
  13. package/dist/constants.js +7 -0
  14. package/dist/constants.js.map +1 -0
  15. package/dist/constants.mjs +6 -35
  16. package/dist/constants.mjs.map +1 -1
  17. package/dist/index.js +20 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/index.mjs +19 -1
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/tsconfig.build.tsbuildinfo +1 -0
  22. package/dist/{KeyringController.d.mts → types/KeyringController.d.ts} +10 -10
  23. package/dist/types/KeyringController.d.ts.map +1 -0
  24. package/dist/{constants.d.cts → types/constants.d.ts} +1 -1
  25. package/dist/types/constants.d.ts.map +1 -0
  26. package/dist/types/index.d.ts +2 -0
  27. package/dist/types/index.d.ts.map +1 -0
  28. package/package.json +7 -12
  29. package/dist/KeyringController.cjs +0 -1608
  30. package/dist/KeyringController.cjs.map +0 -1
  31. package/dist/KeyringController.d.cts +0 -700
  32. package/dist/KeyringController.d.cts.map +0 -1
  33. package/dist/KeyringController.d.mts.map +0 -1
  34. package/dist/constants.cjs +0 -39
  35. package/dist/constants.cjs.map +0 -1
  36. package/dist/constants.d.cts.map +0 -1
  37. package/dist/constants.d.mts +0 -35
  38. package/dist/constants.d.mts.map +0 -1
  39. package/dist/index.cjs +0 -18
  40. package/dist/index.cjs.map +0 -1
  41. package/dist/index.d.cts +0 -2
  42. package/dist/index.d.cts.map +0 -1
  43. package/dist/index.d.mts +0 -2
  44. package/dist/index.d.mts.map +0 -1
@@ -1,700 +0,0 @@
1
- import type { TxData, TypedTransaction } from "@ethereumjs/tx";
2
- import type { MetaMaskKeyring as QRKeyring, IKeyringState as IQRKeyringState } from "@keystonehq/metamask-airgapped-keyring";
3
- import type { RestrictedControllerMessenger } from "@metamask/base-controller";
4
- import { BaseController } from "@metamask/base-controller";
5
- import * as encryptorUtils from "@metamask/browser-passworder";
6
- import type { EthBaseTransaction, EthBaseUserOperation, EthKeyring, EthUserOperation, EthUserOperationPatch, KeyringExecutionContext } from "@metamask/keyring-api";
7
- import type { PersonalMessageParams, TypedMessageParams } from "@metamask/message-manager";
8
- import type { Eip1024EncryptedData, Hex, Json, KeyringClass } from "@metamask/utils";
9
- import type { Patch } from "immer";
10
- declare const name = "KeyringController";
11
- /**
12
- * Available keyring types
13
- */
14
- export declare enum KeyringTypes {
15
- simple = "Simple Key Pair",
16
- hd = "HD Key Tree",
17
- qr = "QR Hardware Wallet Device",
18
- trezor = "Trezor Hardware",
19
- ledger = "Ledger Hardware",
20
- lattice = "Lattice Hardware",
21
- snap = "Snap Keyring"
22
- }
23
- /**
24
- * Custody keyring types are a special case, as they are not a single type
25
- * but they all start with the prefix "Custody".
26
- * @param keyringType - The type of the keyring.
27
- * @returns Whether the keyring type is a custody keyring.
28
- */
29
- export declare const isCustodyKeyring: (keyringType: string) => boolean;
30
- /**
31
- * @type KeyringControllerState
32
- *
33
- * Keyring controller state
34
- * @property vault - Encrypted string representing keyring data
35
- * @property isUnlocked - Whether vault is unlocked
36
- * @property keyringTypes - Account types
37
- * @property keyrings - Group of accounts
38
- * @property encryptionKey - Keyring encryption key
39
- * @property encryptionSalt - Keyring encryption salt
40
- */
41
- export type KeyringControllerState = {
42
- vault?: string;
43
- isUnlocked: boolean;
44
- keyrings: KeyringObject[];
45
- encryptionKey?: string;
46
- encryptionSalt?: string;
47
- };
48
- export type KeyringControllerMemState = Omit<KeyringControllerState, 'vault' | 'encryptionKey' | 'encryptionSalt'>;
49
- export type KeyringControllerGetStateAction = {
50
- type: `${typeof name}:getState`;
51
- handler: () => KeyringControllerState;
52
- };
53
- export type KeyringControllerSignMessageAction = {
54
- type: `${typeof name}:signMessage`;
55
- handler: KeyringController['signMessage'];
56
- };
57
- export type KeyringControllerSignPersonalMessageAction = {
58
- type: `${typeof name}:signPersonalMessage`;
59
- handler: KeyringController['signPersonalMessage'];
60
- };
61
- export type KeyringControllerSignTypedMessageAction = {
62
- type: `${typeof name}:signTypedMessage`;
63
- handler: KeyringController['signTypedMessage'];
64
- };
65
- export type KeyringControllerDecryptMessageAction = {
66
- type: `${typeof name}:decryptMessage`;
67
- handler: KeyringController['decryptMessage'];
68
- };
69
- export type KeyringControllerGetEncryptionPublicKeyAction = {
70
- type: `${typeof name}:getEncryptionPublicKey`;
71
- handler: KeyringController['getEncryptionPublicKey'];
72
- };
73
- export type KeyringControllerGetKeyringsByTypeAction = {
74
- type: `${typeof name}:getKeyringsByType`;
75
- handler: KeyringController['getKeyringsByType'];
76
- };
77
- export type KeyringControllerGetKeyringForAccountAction = {
78
- type: `${typeof name}:getKeyringForAccount`;
79
- handler: KeyringController['getKeyringForAccount'];
80
- };
81
- export type KeyringControllerGetAccountsAction = {
82
- type: `${typeof name}:getAccounts`;
83
- handler: KeyringController['getAccounts'];
84
- };
85
- export type KeyringControllerPersistAllKeyringsAction = {
86
- type: `${typeof name}:persistAllKeyrings`;
87
- handler: KeyringController['persistAllKeyrings'];
88
- };
89
- export type KeyringControllerPrepareUserOperationAction = {
90
- type: `${typeof name}:prepareUserOperation`;
91
- handler: KeyringController['prepareUserOperation'];
92
- };
93
- export type KeyringControllerPatchUserOperationAction = {
94
- type: `${typeof name}:patchUserOperation`;
95
- handler: KeyringController['patchUserOperation'];
96
- };
97
- export type KeyringControllerSignUserOperationAction = {
98
- type: `${typeof name}:signUserOperation`;
99
- handler: KeyringController['signUserOperation'];
100
- };
101
- export type KeyringControllerAddNewAccountAction = {
102
- type: `${typeof name}:addNewAccount`;
103
- handler: KeyringController['addNewAccount'];
104
- };
105
- export type KeyringControllerStateChangeEvent = {
106
- type: `${typeof name}:stateChange`;
107
- payload: [KeyringControllerState, Patch[]];
108
- };
109
- export type KeyringControllerAccountRemovedEvent = {
110
- type: `${typeof name}:accountRemoved`;
111
- payload: [string];
112
- };
113
- export type KeyringControllerLockEvent = {
114
- type: `${typeof name}:lock`;
115
- payload: [];
116
- };
117
- export type KeyringControllerUnlockEvent = {
118
- type: `${typeof name}:unlock`;
119
- payload: [];
120
- };
121
- export type KeyringControllerQRKeyringStateChangeEvent = {
122
- type: `${typeof name}:qrKeyringStateChange`;
123
- payload: [ReturnType<IQRKeyringState['getState']>];
124
- };
125
- export type KeyringControllerActions = KeyringControllerGetStateAction | KeyringControllerSignMessageAction | KeyringControllerSignPersonalMessageAction | KeyringControllerSignTypedMessageAction | KeyringControllerDecryptMessageAction | KeyringControllerGetEncryptionPublicKeyAction | KeyringControllerGetAccountsAction | KeyringControllerGetKeyringsByTypeAction | KeyringControllerGetKeyringForAccountAction | KeyringControllerPersistAllKeyringsAction | KeyringControllerPrepareUserOperationAction | KeyringControllerPatchUserOperationAction | KeyringControllerSignUserOperationAction | KeyringControllerAddNewAccountAction;
126
- export type KeyringControllerEvents = KeyringControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | KeyringControllerAccountRemovedEvent | KeyringControllerQRKeyringStateChangeEvent;
127
- export type KeyringControllerMessenger = RestrictedControllerMessenger<typeof name, KeyringControllerActions, KeyringControllerEvents, never, never>;
128
- export type KeyringControllerOptions = {
129
- keyringBuilders?: {
130
- (): EthKeyring<Json>;
131
- type: string;
132
- }[];
133
- messenger: KeyringControllerMessenger;
134
- state?: {
135
- vault?: string;
136
- };
137
- } & ({
138
- cacheEncryptionKey: true;
139
- encryptor?: ExportableKeyEncryptor;
140
- } | {
141
- cacheEncryptionKey?: false;
142
- encryptor?: GenericEncryptor | ExportableKeyEncryptor;
143
- });
144
- /**
145
- * @type KeyringObject
146
- *
147
- * Keyring object to return in fullUpdate
148
- * @property type - Keyring type
149
- * @property accounts - Associated accounts
150
- */
151
- export type KeyringObject = {
152
- accounts: string[];
153
- type: string;
154
- };
155
- /**
156
- * A strategy for importing an account
157
- */
158
- export declare enum AccountImportStrategy {
159
- privateKey = "privateKey",
160
- json = "json"
161
- }
162
- /**
163
- * The `signTypedMessage` version
164
- *
165
- * @see https://docs.metamask.io/guide/signing-data.html
166
- */
167
- export declare enum SignTypedDataVersion {
168
- V1 = "V1",
169
- V3 = "V3",
170
- V4 = "V4"
171
- }
172
- /**
173
- * A serialized keyring object.
174
- */
175
- export type SerializedKeyring = {
176
- type: string;
177
- data: Json;
178
- };
179
- /**
180
- * A generic encryptor interface that supports encrypting and decrypting
181
- * serializable data with a password.
182
- */
183
- export type GenericEncryptor = {
184
- /**
185
- * Encrypts the given object with the given password.
186
- *
187
- * @param password - The password to encrypt with.
188
- * @param object - The object to encrypt.
189
- * @returns The encrypted string.
190
- */
191
- encrypt: (password: string, object: Json) => Promise<string>;
192
- /**
193
- * Decrypts the given encrypted string with the given password.
194
- *
195
- * @param password - The password to decrypt with.
196
- * @param encryptedString - The encrypted string to decrypt.
197
- * @returns The decrypted object.
198
- */
199
- decrypt: (password: string, encryptedString: string) => Promise<unknown>;
200
- /**
201
- * Optional vault migration helper. Checks if the provided vault is up to date
202
- * with the desired encryption algorithm.
203
- *
204
- * @param vault - The encrypted string to check.
205
- * @param targetDerivationParams - The desired target derivation params.
206
- * @returns The updated encrypted string.
207
- */
208
- isVaultUpdated?: (vault: string, targetDerivationParams?: encryptorUtils.KeyDerivationOptions) => boolean;
209
- };
210
- /**
211
- * An encryptor interface that supports encrypting and decrypting
212
- * serializable data with a password, and exporting and importing keys.
213
- */
214
- export type ExportableKeyEncryptor = GenericEncryptor & {
215
- /**
216
- * Encrypts the given object with the given encryption key.
217
- *
218
- * @param key - The encryption key to encrypt with.
219
- * @param object - The object to encrypt.
220
- * @returns The encryption result.
221
- */
222
- encryptWithKey: (key: unknown, object: Json) => Promise<encryptorUtils.EncryptionResult>;
223
- /**
224
- * Encrypts the given object with the given password, and returns the
225
- * encryption result and the exported key string.
226
- *
227
- * @param password - The password to encrypt with.
228
- * @param object - The object to encrypt.
229
- * @param salt - The optional salt to use for encryption.
230
- * @returns The encrypted string and the exported key string.
231
- */
232
- encryptWithDetail: (password: string, object: Json, salt?: string) => Promise<encryptorUtils.DetailedEncryptionResult>;
233
- /**
234
- * Decrypts the given encrypted string with the given encryption key.
235
- *
236
- * @param key - The encryption key to decrypt with.
237
- * @param encryptedString - The encrypted string to decrypt.
238
- * @returns The decrypted object.
239
- */
240
- decryptWithKey: (key: unknown, encryptedString: string) => Promise<unknown>;
241
- /**
242
- * Decrypts the given encrypted string with the given password, and returns
243
- * the decrypted object and the salt and exported key string used for
244
- * encryption.
245
- *
246
- * @param password - The password to decrypt with.
247
- * @param encryptedString - The encrypted string to decrypt.
248
- * @returns The decrypted object and the salt and exported key string used for
249
- * encryption.
250
- */
251
- decryptWithDetail: (password: string, encryptedString: string) => Promise<encryptorUtils.DetailedDecryptResult>;
252
- /**
253
- * Generates an encryption key from exported key string.
254
- *
255
- * @param key - The exported key string.
256
- * @returns The encryption key.
257
- */
258
- importKey: (key: string) => Promise<unknown>;
259
- };
260
- export type KeyringSelector = {
261
- type: string;
262
- index?: number;
263
- } | {
264
- address: Hex;
265
- };
266
- /**
267
- * Get builder function for `Keyring`
268
- *
269
- * Returns a builder function for `Keyring` with a `type` property.
270
- *
271
- * @param KeyringConstructor - The Keyring class for the builder.
272
- * @returns A builder function for the given Keyring.
273
- */
274
- export declare function keyringBuilderFactory(KeyringConstructor: KeyringClass<Json>): {
275
- (): import("@metamask/utils").Keyring<Json>;
276
- type: string;
277
- };
278
- export declare const getDefaultKeyringState: () => KeyringControllerState;
279
- /**
280
- * Controller responsible for establishing and managing user identity.
281
- *
282
- * This class is a wrapper around the `eth-keyring-controller` package. The
283
- * `eth-keyring-controller` manages the "vault", which is an encrypted store of private keys, and
284
- * it manages the wallet "lock" state. This wrapper class has convenience methods for interacting
285
- * with the internal keyring controller and handling certain complex operations that involve the
286
- * keyrings.
287
- */
288
- export declare class KeyringController extends BaseController<typeof name, KeyringControllerState, KeyringControllerMessenger> {
289
- #private;
290
- /**
291
- * Creates a KeyringController instance.
292
- *
293
- * @param options - Initial options used to configure this controller
294
- * @param options.encryptor - An optional object for defining encryption schemes.
295
- * @param options.keyringBuilders - Set a new name for account.
296
- * @param options.cacheEncryptionKey - Whether to cache or not encryption key.
297
- * @param options.messenger - A restricted controller messenger.
298
- * @param options.state - Initial state to set on this controller.
299
- */
300
- constructor(options: KeyringControllerOptions);
301
- /**
302
- * Adds a new account to the default (first) HD seed phrase keyring.
303
- *
304
- * @param accountCount - Number of accounts before adding a new one, used to
305
- * make the method idempotent.
306
- * @returns Promise resolving to the added account address.
307
- */
308
- addNewAccount(accountCount?: number): Promise<string>;
309
- /**
310
- * Adds a new account to the specified keyring.
311
- *
312
- * @param keyring - Keyring to add the account to.
313
- * @param accountCount - Number of accounts before adding a new one, used to make the method idempotent.
314
- * @returns Promise resolving to the added account address
315
- */
316
- addNewAccountForKeyring(keyring: EthKeyring<Json>, accountCount?: number): Promise<Hex>;
317
- /**
318
- * Adds a new account to the default (first) HD seed phrase keyring without updating identities in preferences.
319
- *
320
- * @returns Promise resolving to the added account address.
321
- */
322
- addNewAccountWithoutUpdate(): Promise<string>;
323
- /**
324
- * Effectively the same as creating a new keychain then populating it
325
- * using the given seed phrase.
326
- *
327
- * @param password - Password to unlock keychain.
328
- * @param seed - A BIP39-compliant seed phrase as Uint8Array,
329
- * either as a string or an array of UTF-8 bytes that represent the string.
330
- * @returns Promise resolving when the operation ends successfully.
331
- */
332
- createNewVaultAndRestore(password: string, seed: Uint8Array): Promise<void>;
333
- /**
334
- * Create a new vault and primary keyring.
335
- *
336
- * This only works if keyrings are empty. If there is a pre-existing unlocked vault, calling this will have no effect.
337
- * If there is a pre-existing locked vault, it will be replaced.
338
- *
339
- * @param password - Password to unlock the new vault.
340
- */
341
- createNewVaultAndKeychain(password: string): Promise<void>;
342
- /**
343
- * Adds a new keyring of the given `type`.
344
- *
345
- * @param type - Keyring type name.
346
- * @param opts - Keyring options.
347
- * @throws If a builder for the given `type` does not exist.
348
- * @returns Promise resolving to the added keyring.
349
- */
350
- addNewKeyring(type: KeyringTypes | string, opts?: unknown): Promise<unknown>;
351
- /**
352
- * Method to verify a given password validity. Throws an
353
- * error if the password is invalid.
354
- *
355
- * @param password - Password of the keyring.
356
- */
357
- verifyPassword(password: string): Promise<void>;
358
- /**
359
- * Returns the status of the vault.
360
- *
361
- * @returns Boolean returning true if the vault is unlocked.
362
- */
363
- isUnlocked(): boolean;
364
- /**
365
- * Gets the seed phrase of the HD keyring.
366
- *
367
- * @param password - Password of the keyring.
368
- * @returns Promise resolving to the seed phrase.
369
- */
370
- exportSeedPhrase(password: string): Promise<Uint8Array>;
371
- /**
372
- * Gets the private key from the keyring controlling an address.
373
- *
374
- * @param password - Password of the keyring.
375
- * @param address - Address to export.
376
- * @returns Promise resolving to the private key for an address.
377
- */
378
- exportAccount(password: string, address: string): Promise<string>;
379
- /**
380
- * Returns the public addresses of all accounts from every keyring.
381
- *
382
- * @returns A promise resolving to an array of addresses.
383
- */
384
- getAccounts(): Promise<string[]>;
385
- /**
386
- * Get encryption public key.
387
- *
388
- * @param account - An account address.
389
- * @param opts - Additional encryption options.
390
- * @throws If the `account` does not exist or does not support the `getEncryptionPublicKey` method
391
- * @returns Promise resolving to encyption public key of the `account` if one exists.
392
- */
393
- getEncryptionPublicKey(account: string, opts?: Record<string, unknown>): Promise<string>;
394
- /**
395
- * Attempts to decrypt the provided message parameters.
396
- *
397
- * @param messageParams - The decryption message parameters.
398
- * @param messageParams.from - The address of the account you want to use to decrypt the message.
399
- * @param messageParams.data - The encrypted data that you want to decrypt.
400
- * @returns The raw decryption result.
401
- */
402
- decryptMessage(messageParams: {
403
- from: string;
404
- data: Eip1024EncryptedData;
405
- }): Promise<string>;
406
- /**
407
- * Returns the currently initialized keyring that manages
408
- * the specified `address` if one exists.
409
- *
410
- * @deprecated Use of this method is discouraged as actions executed directly on
411
- * keyrings are not being reflected in the KeyringController state and not
412
- * persisted in the vault. Use `withKeyring` instead.
413
- * @param account - An account address.
414
- * @returns Promise resolving to keyring of the `account` if one exists.
415
- */
416
- getKeyringForAccount(account: string): Promise<unknown>;
417
- /**
418
- * Returns all keyrings of the given type.
419
- *
420
- * @deprecated Use of this method is discouraged as actions executed directly on
421
- * keyrings are not being reflected in the KeyringController state and not
422
- * persisted in the vault. Use `withKeyring` instead.
423
- * @param type - Keyring type name.
424
- * @returns An array of keyrings of the given type.
425
- */
426
- getKeyringsByType(type: KeyringTypes | string): unknown[];
427
- /**
428
- * Persist all serialized keyrings in the vault.
429
- *
430
- * @deprecated This method is being phased out in favor of `withKeyring`.
431
- * @returns Promise resolving with `true` value when the
432
- * operation completes.
433
- */
434
- persistAllKeyrings(): Promise<boolean>;
435
- /**
436
- * Imports an account with the specified import strategy.
437
- *
438
- * @param strategy - Import strategy name.
439
- * @param args - Array of arguments to pass to the underlying stategy.
440
- * @throws Will throw when passed an unrecognized strategy.
441
- * @returns Promise resolving to the imported account address.
442
- */
443
- importAccountWithStrategy(strategy: AccountImportStrategy, args: any[]): Promise<string>;
444
- /**
445
- * Removes an account from keyring state.
446
- *
447
- * @param address - Address of the account to remove.
448
- * @fires KeyringController:accountRemoved
449
- * @returns Promise resolving when the account is removed.
450
- */
451
- removeAccount(address: string): Promise<void>;
452
- /**
453
- * Deallocates all secrets and locks the wallet.
454
- *
455
- * @returns Promise resolving when the operation completes.
456
- */
457
- setLocked(): Promise<void>;
458
- /**
459
- * Signs message by calling down into a specific keyring.
460
- *
461
- * @param messageParams - PersonalMessageParams object to sign.
462
- * @returns Promise resolving to a signed message string.
463
- */
464
- signMessage(messageParams: PersonalMessageParams): Promise<string>;
465
- /**
466
- * Signs personal message by calling down into a specific keyring.
467
- *
468
- * @param messageParams - PersonalMessageParams object to sign.
469
- * @returns Promise resolving to a signed message string.
470
- */
471
- signPersonalMessage(messageParams: PersonalMessageParams): Promise<string>;
472
- /**
473
- * Signs typed message by calling down into a specific keyring.
474
- *
475
- * @param messageParams - TypedMessageParams object to sign.
476
- * @param version - Compatibility version EIP712.
477
- * @throws Will throw when passed an unrecognized version.
478
- * @returns Promise resolving to a signed message string or an error if any.
479
- */
480
- signTypedMessage(messageParams: TypedMessageParams, version: SignTypedDataVersion): Promise<string>;
481
- /**
482
- * Signs a transaction by calling down into a specific keyring.
483
- *
484
- * @param transaction - Transaction object to sign. Must be a `ethereumjs-tx` transaction instance.
485
- * @param from - Address to sign from, should be in keychain.
486
- * @param opts - An optional options object.
487
- * @returns Promise resolving to a signed transaction string.
488
- */
489
- signTransaction(transaction: TypedTransaction, from: string, opts?: Record<string, unknown>): Promise<TxData>;
490
- /**
491
- * Convert a base transaction to a base UserOperation.
492
- *
493
- * @param from - Address of the sender.
494
- * @param transactions - Base transactions to include in the UserOperation.
495
- * @param executionContext - The execution context to use for the UserOperation.
496
- * @returns A pseudo-UserOperation that can be used to construct a real.
497
- */
498
- prepareUserOperation(from: string, transactions: EthBaseTransaction[], executionContext: KeyringExecutionContext): Promise<EthBaseUserOperation>;
499
- /**
500
- * Patches properties of a UserOperation. Currently, only the
501
- * `paymasterAndData` can be patched.
502
- *
503
- * @param from - Address of the sender.
504
- * @param userOp - UserOperation to patch.
505
- * @param executionContext - The execution context to use for the UserOperation.
506
- * @returns A patch to apply to the UserOperation.
507
- */
508
- patchUserOperation(from: string, userOp: EthUserOperation, executionContext: KeyringExecutionContext): Promise<EthUserOperationPatch>;
509
- /**
510
- * Signs an UserOperation.
511
- *
512
- * @param from - Address of the sender.
513
- * @param userOp - UserOperation to sign.
514
- * @param executionContext - The execution context to use for the UserOperation.
515
- * @returns The signature of the UserOperation.
516
- */
517
- signUserOperation(from: string, userOp: EthUserOperation, executionContext: KeyringExecutionContext): Promise<string>;
518
- /**
519
- * Changes the password used to encrypt the vault.
520
- *
521
- * @param password - The new password.
522
- * @returns Promise resolving when the operation completes.
523
- */
524
- changePassword(password: string): Promise<void>;
525
- /**
526
- * Attempts to decrypt the current vault and load its keyrings,
527
- * using the given encryption key and salt.
528
- *
529
- * @param encryptionKey - Key to unlock the keychain.
530
- * @param encryptionSalt - Salt to unlock the keychain.
531
- * @returns Promise resolving when the operation completes.
532
- */
533
- submitEncryptionKey(encryptionKey: string, encryptionSalt: string): Promise<void>;
534
- /**
535
- * Attempts to decrypt the current vault and load its keyrings,
536
- * using the given password.
537
- *
538
- * @param password - Password to unlock the keychain.
539
- * @returns Promise resolving when the operation completes.
540
- */
541
- submitPassword(password: string): Promise<void>;
542
- /**
543
- * Verifies the that the seed phrase restores the current keychain's accounts.
544
- *
545
- * @returns Promise resolving to the seed phrase as Uint8Array.
546
- */
547
- verifySeedPhrase(): Promise<Uint8Array>;
548
- /**
549
- * Select a keyring and execute the given operation with
550
- * the selected keyring, as a mutually exclusive atomic
551
- * operation.
552
- *
553
- * The method automatically persists changes at the end of the
554
- * function execution, or rolls back the changes if an error
555
- * is thrown.
556
- *
557
- * @param selector - Keyring selector object.
558
- * @param operation - Function to execute with the selected keyring.
559
- * @param options - Additional options.
560
- * @param options.createIfMissing - Whether to create a new keyring if the selected one is missing.
561
- * @param options.createWithData - Optional data to use when creating a new keyring.
562
- * @returns Promise resolving to the result of the function execution.
563
- * @template SelectedKeyring - The type of the selected keyring.
564
- * @template CallbackResult - The type of the value resolved by the callback function.
565
- * @deprecated This method overload is deprecated. Use `withKeyring` without options instead.
566
- */
567
- withKeyring<SelectedKeyring extends EthKeyring<Json> = EthKeyring<Json>, CallbackResult = void>(selector: KeyringSelector, operation: (keyring: SelectedKeyring) => Promise<CallbackResult>, options: {
568
- createIfMissing?: false;
569
- } | {
570
- createIfMissing: true;
571
- createWithData?: unknown;
572
- }): Promise<CallbackResult>;
573
- /**
574
- * Select a keyring and execute the given operation with
575
- * the selected keyring, as a mutually exclusive atomic
576
- * operation.
577
- *
578
- * The method automatically persists changes at the end of the
579
- * function execution, or rolls back the changes if an error
580
- * is thrown.
581
- *
582
- * @param selector - Keyring selector object.
583
- * @param operation - Function to execute with the selected keyring.
584
- * @returns Promise resolving to the result of the function execution.
585
- * @template SelectedKeyring - The type of the selected keyring.
586
- * @template CallbackResult - The type of the value resolved by the callback function.
587
- */
588
- withKeyring<SelectedKeyring extends EthKeyring<Json> = EthKeyring<Json>, CallbackResult = void>(selector: KeyringSelector, operation: (keyring: SelectedKeyring) => Promise<CallbackResult>): Promise<CallbackResult>;
589
- /**
590
- * Get QR Hardware keyring.
591
- *
592
- * @returns The QR Keyring if defined, otherwise undefined
593
- * @deprecated Use `withKeyring` instead.
594
- */
595
- getQRKeyring(): QRKeyring | undefined;
596
- /**
597
- * Get QR hardware keyring. If it doesn't exist, add it.
598
- *
599
- * @returns The added keyring
600
- * @deprecated Use `addNewKeyring` and `withKeyring` instead.
601
- */
602
- getOrAddQRKeyring(): Promise<QRKeyring>;
603
- /**
604
- * Restore QR keyring from serialized data.
605
- *
606
- * @param serialized - Serialized data to restore the keyring from.
607
- * @returns Promise resolving when the operation completes.
608
- * @deprecated Use `withKeyring` instead.
609
- */
610
- restoreQRKeyring(serialized: any): Promise<void>;
611
- /**
612
- * Reset QR keyring state.
613
- *
614
- * @returns Promise resolving when the operation completes.
615
- * @deprecated Use `withKeyring` instead.
616
- */
617
- resetQRKeyringState(): Promise<void>;
618
- /**
619
- * Get QR keyring state.
620
- *
621
- * @returns Promise resolving to the keyring state.
622
- * @deprecated Use `withKeyring` or subscribe to `"KeyringController:qrKeyringStateChange"`
623
- * instead.
624
- */
625
- getQRKeyringState(): Promise<IQRKeyringState>;
626
- /**
627
- * Submit QR hardware wallet public HDKey.
628
- *
629
- * @param cryptoHDKey - The key to submit.
630
- * @returns Promise resolving when the operation completes.
631
- * @deprecated Use `withKeyring` instead.
632
- */
633
- submitQRCryptoHDKey(cryptoHDKey: string): Promise<void>;
634
- /**
635
- * Submit QR hardware wallet account.
636
- *
637
- * @param cryptoAccount - The account to submit.
638
- * @returns Promise resolving when the operation completes.
639
- * @deprecated Use `withKeyring` instead.
640
- */
641
- submitQRCryptoAccount(cryptoAccount: string): Promise<void>;
642
- /**
643
- * Submit QR hardware wallet signature.
644
- *
645
- * @param requestId - The request ID.
646
- * @param ethSignature - The signature to submit.
647
- * @returns Promise resolving when the operation completes.
648
- * @deprecated Use `withKeyring` instead.
649
- */
650
- submitQRSignature(requestId: string, ethSignature: string): Promise<void>;
651
- /**
652
- * Cancel QR sign request.
653
- *
654
- * @returns Promise resolving when the operation completes.
655
- * @deprecated Use `withKeyring` instead.
656
- */
657
- cancelQRSignRequest(): Promise<void>;
658
- /**
659
- * Cancels qr keyring sync.
660
- *
661
- * @returns Promise resolving when the operation completes.
662
- * @deprecated Use `withKeyring` instead.
663
- */
664
- cancelQRSynchronization(): Promise<void>;
665
- /**
666
- * Connect to QR hardware wallet.
667
- *
668
- * @param page - The page to connect to.
669
- * @returns Promise resolving to the connected accounts.
670
- * @deprecated Use of this method is discouraged as it creates a dangling promise
671
- * internal to the `QRKeyring`, which can lead to unpredictable deadlocks. Please use
672
- * `withKeyring` instead.
673
- */
674
- connectQRHardware(page: number): Promise<{
675
- balance: string;
676
- address: string;
677
- index: number;
678
- }[]>;
679
- /**
680
- * Unlock a QR hardware wallet account.
681
- *
682
- * @param index - The index of the account to unlock.
683
- * @returns Promise resolving when the operation completes.
684
- * @deprecated Use `withKeyring` instead.
685
- */
686
- unlockQRHardwareWalletAccount(index: number): Promise<void>;
687
- getAccountKeyringType(account: string): Promise<string>;
688
- /**
689
- * Forget the QR hardware wallet.
690
- *
691
- * @returns Promise resolving to the removed accounts and the remaining accounts.
692
- * @deprecated Use `withKeyring` instead.
693
- */
694
- forgetQRDevice(): Promise<{
695
- removedAccounts: string[];
696
- remainingAccounts: string[];
697
- }>;
698
- }
699
- export default KeyringController;
700
- //# sourceMappingURL=KeyringController.d.cts.map