import type { TypedTransaction, TypedTxData } from "@ethereumjs/tx"; import { BaseController } from "@metamask/base-controller"; import type * as encryptorUtils from "@metamask/browser-passworder"; import type { KeyringExecutionContext, EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch, KeyringAccount } from "@metamask/keyring-api"; import type { Keyring as KeyringV2, KeyringType } from "@metamask/keyring-api/v2"; import type { EthKeyring } from "@metamask/keyring-internal-api"; import type { Keyring, KeyringClass } from "@metamask/keyring-utils"; import type { Messenger } from "@metamask/messenger"; import type { Eip1024EncryptedData, Hex, Json } from "@metamask/utils"; import type { Patch } from "immer"; import type { KeyringControllerMethodActions } from "./KeyringController-method-action-types.mjs"; import type { Eip7702AuthorizationParams, Credentials, PersonalMessageParams, TypedMessageParams } from "./types.mjs"; declare const name = "KeyringController"; /** * Available keyring types * * @deprecated Use `KeyringType` from `@metamask/keyring-api/v2` instead. This enum will be removed * in a future release once V2 is fully adopted. Only use it if the keyring you are trying to access * has no V2 builder available yet. */ export declare enum KeyringTypes { simple = "Simple Key Pair", hd = "HD Key Tree", qr = "QR Hardware Wallet Device", trezor = "Trezor Hardware", oneKey = "OneKey Hardware", ledger = "Ledger Hardware", lattice = "Lattice Hardware", snap = "Snap Keyring", money = "Money Keyring" } /** * Custody keyring types are a special case, as they are not a single type * but they all start with the prefix "Custody". * * @param keyringType - The type of the keyring. * @returns Whether the keyring type is a custody keyring. */ export declare const isCustodyKeyring: (keyringType: string) => boolean; /** * The KeyringController state */ export type KeyringControllerState = { /** * Encrypted array of serialized keyrings data. */ vault?: string; /** * Whether the vault has been decrypted successfully and * keyrings contained within are deserialized and available. */ isUnlocked: boolean; /** * Representations of managed keyrings. */ keyrings: KeyringObject[]; /** * The encryption key derived from the password and used to encrypt * the vault. This is only stored if the `cacheEncryptionKey` option * is enabled. */ encryptionKey?: string; /** * The salt used to derive the encryption key from the password. */ encryptionSalt?: string; }; export type KeyringControllerMemState = Omit; export type KeyringControllerGetStateAction = { type: `${typeof name}:getState`; handler: () => KeyringControllerState; }; export type KeyringControllerStateChangeEvent = { type: `${typeof name}:stateChange`; payload: [KeyringControllerState, Patch[]]; }; export type KeyringControllerAccountRemovedEvent = { type: `${typeof name}:accountRemoved`; payload: [string]; }; export type KeyringControllerLockEvent = { type: `${typeof name}:lock`; payload: []; }; export type KeyringControllerUnlockEvent = { type: `${typeof name}:unlock`; payload: []; }; export type KeyringControllerActions = KeyringControllerGetStateAction | KeyringControllerMethodActions; export type KeyringControllerEvents = KeyringControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | KeyringControllerAccountRemovedEvent; export type KeyringControllerMessenger = Messenger; export type KeyringControllerOptions = DefaultEncryptionResult> = { keyringBuilders?: { (): EthKeyring; type: string; }[]; keyringV2Builders?: KeyringV2Builder[]; messenger: KeyringControllerMessenger; state?: { vault?: string; keyringsMetadata?: KeyringMetadata[]; }; encryptor: Encryptor; }; /** * A keyring object representation. */ export type KeyringObject = { /** * Accounts associated with the keyring. */ accounts: string[]; /** * Keyring type. */ type: string; /** * Additional data associated with the keyring. */ metadata: KeyringMetadata; }; /** * Additional information related to a keyring. */ export type KeyringMetadata = { /** * Keyring ID */ id: string; /** * Keyring name */ name: string; }; /** * A keyring entry, including the keyring instance (+ v2 instance) and its metadata. */ export type KeyringEntry = { /** * The keyring instance. */ keyring: EthKeyring; /** * The keyring V2 instance, if available. */ keyringV2?: KeyringV2; /** * The keyring metadata. */ metadata: KeyringMetadata; }; /** * A restricted view of the {@link KeyringController} exposed to the callback * passed to {@link KeyringController.withController}. * * It provides a read-only live view of all keyrings and the ability to stage * keyring additions and removals atomically within a single transaction. */ export type RestrictedController = { /** * Read-only live view of all keyrings in the current transaction (original * keyrings plus any added, minus any removed so far in this callback). */ readonly keyrings: readonly KeyringEntry[]; /** * Create a new keyring of the given type and stage it for commit. The new * entry is immediately visible in {@link RestrictedController.keyrings}. * * @param type - The type of keyring to create. * @param opts - Optional data to pass to the keyring builder. * @returns The newly created `{ keyring, metadata }` entry. */ addNewKeyring(type: string, opts?: unknown): Promise; /** * Stage the keyring with the given id for removal. The keyring is * immediately removed from {@link RestrictedController.keyrings}. * * @param id - The id of the keyring to remove. */ removeKeyring(id: string): Promise; }; /** * A strategy for importing an account */ export declare enum AccountImportStrategy { privateKey = "privateKey", json = "json" } /** * The `signTypedMessage` version * * @see https://docs.metamask.io/guide/signing-data.html */ export declare enum SignTypedDataVersion { V1 = "V1", V3 = "V3", V4 = "V4" } /** * A serialized keyring object. */ export type SerializedKeyring = { type: string; data: Json; metadata?: KeyringMetadata; }; export type EncryptionResultConstraint = { salt?: string; keyMetadata?: SupportedKeyMetadata; }; export type DefaultEncryptionResult = { data: string; iv: string; salt?: string; keyMetadata?: SupportedKeyMetadata; }; /** * An encryptor interface that supports encrypting and decrypting * serializable data with a password, and exporting and importing keys. */ export type Encryptor = DefaultEncryptionResult> = { /** * Encrypts the given object with the given password. * * @param password - The password to encrypt with. * @param object - The object to encrypt. * @returns The encrypted string. */ encrypt: (password: string, object: Json) => Promise; /** * Decrypts the given encrypted string with the given password. * * @param password - The password to decrypt with. * @param encryptedString - The encrypted string to decrypt. * @returns The decrypted object. */ decrypt: (password: string, encryptedString: string) => Promise; /** * Optional vault migration helper. Checks if the provided vault is up to date * with the desired encryption algorithm. * * @param vault - The encrypted string to check. * @param targetDerivationParams - The desired target derivation params. * @returns The updated encrypted string. */ isVaultUpdated?: (vault: string, targetDerivationParams?: encryptorUtils.KeyDerivationOptions) => boolean; /** * Encrypts the given object with the given encryption key. * * @param key - The encryption key to encrypt with. * @param object - The object to encrypt. * @returns The encryption result. */ encryptWithKey: (key: EncryptionKey, object: Json) => Promise; /** * Encrypts the given object with the given password, and returns the * encryption result and the serialized key string. * * @param password - The password to encrypt with. * @param object - The object to encrypt. * @param salt - The optional salt to use for encryption. * @returns The encrypted string and the serialized key string. */ encryptWithDetail: (password: string, object: Json, salt?: string) => Promise; /** * Decrypts the given encrypted string with the given encryption key. * * @param key - The encryption key to decrypt with. * @param encryptedObject - The encrypted string to decrypt. * @returns The decrypted object. */ decryptWithKey: (key: EncryptionKey, encryptedObject: EncryptionResult) => Promise; /** * Decrypts the given encrypted string with the given password, and returns * the decrypted object and the salt and serialized key string used for * encryption. * * @param password - The password to decrypt with. * @param encryptedString - The encrypted string to decrypt. * @returns The decrypted object and the salt and serialized key string used for * encryption. */ decryptWithDetail: (password: string, encryptedString: string) => Promise; /** * Generates an encryption key from a serialized key. * * @param key - The serialized key string. * @returns The encryption key. */ importKey: (key: string) => Promise; /** * Exports the encryption key as a string. * * @param key - The encryption key to export. * @returns The serialized key string. */ exportKey: (key: EncryptionKey) => Promise; /** * Derives an encryption key from a password. * * @param password - The password to derive the key from. * @param salt - The salt to use for key derivation. * @param exportable - Whether the key should be exportable or not. * @param options - Optional key derivation options. * @returns The derived encryption key. */ keyFromPassword: (password: string, salt: string, exportable?: boolean, keyDerivationOptions?: SupportedKeyDerivationParams) => Promise; /** * Generates a random salt for key derivation. */ generateSalt: typeof encryptorUtils.generateSalt; }; /** * Keyring selector used for `withKeyring`. */ export type KeyringSelector = { type: string; index?: number; } | { address: Hex; } | { id: string; } | { /** * A predicate function used to select a keyring. The first keyring for * which this function returns `true` will be selected. * * NOTE: The caller must not mutate the keyring instance passed to this * function. Mutations bypass the controller's state management * safeguards and will lead to inconsistent state. The instance is not * frozen for performance reasons, but treating it as read-only is a * firm requirement — any mutation is a bug in the caller. */ filter: ((keyring: EthKeyring, metadata: KeyringMetadata) => boolean) | ((keyring: EthKeyring, metadata: KeyringMetadata) => keyring is SelectedKeyring); }; /** * Keyring selector used for `withKeyringV2` (see {@link KeyringController#withKeyringV2} and {@link KeyringSelector}). */ export type KeyringSelectorV2 = { type: `${KeyringType}`; index?: number; } | { address: KeyringAccount['address']; } | { id: KeyringMetadata['id']; } | { /** Similar to {@link KeyringSelector.filter} but for `KeyringV2` instances. */ filter: ((keyring: KeyringV2, metadata: KeyringMetadata) => boolean) | ((keyring: KeyringV2, metadata: KeyringMetadata) => keyring is SelectedKeyring); }; /** * Keyring builder. */ export type KeyringBuilder = { (): Keyring; type: string; }; /** * A builder that wraps a legacy `Keyring` into a `KeyringV2` adapter. * * The controller calls the builder once when the V1 keyring is created * or restored; the resulting wrapper is cached for the keyring's lifetime. */ export type KeyringV2Builder = { (keyring: Keyring, metadata: KeyringMetadata): KeyringV2; type: string; }; /** * Get builder function for `Keyring` * * Returns a builder function for `Keyring` with a `type` property. * * @param KeyringConstructor - The Keyring class for the builder. * @returns A builder function for the given Keyring. */ export declare function keyringBuilderFactory(KeyringConstructor: KeyringClass): KeyringBuilder; export declare const getDefaultKeyringState: () => KeyringControllerState; /** * Controller responsible for establishing and managing user identity. * * This class is a wrapper around the `eth-keyring-controller` package. The * `eth-keyring-controller` manages the "vault", which is an encrypted store of private keys, and * it manages the wallet "lock" state. This wrapper class has convenience methods for interacting * with the internal keyring controller and handling certain complex operations that involve the * keyrings. */ export declare class KeyringController = DefaultEncryptionResult> extends BaseController { #private; /** * Creates a KeyringController instance. * * @param options - Initial options used to configure this controller * @param options.encryptor - An optional object for defining encryption schemes. * @param options.keyringBuilders - Set a new name for account. * @param options.cacheEncryptionKey - Whether to cache or not encryption key. * @param options.messenger - A restricted messenger. * @param options.state - Initial state to set on this controller. */ constructor(options: KeyringControllerOptions); /** * Adds a new account to the default (first) HD seed phrase keyring. * * @param accountCount - Number of accounts before adding a new one, used to * make the method idempotent. * @returns Promise resolving to the added account address. */ addNewAccount(accountCount?: number): Promise; /** * Adds a new account to the specified keyring. * * @param keyring - Keyring to add the account to. * @param accountCount - Number of accounts before adding a new one, used to make the method idempotent. * @returns Promise resolving to the added account address */ addNewAccountForKeyring(keyring: EthKeyring, accountCount?: number): Promise; /** * Effectively the same as creating a new keychain then populating it * using the given seed phrase. * * @param password - Password to unlock keychain. * @param seed - A BIP39-compliant seed phrase as Uint8Array, * either as a string or an array of UTF-8 bytes that represent the string. * @returns Promise resolving when the operation ends successfully. */ createNewVaultAndRestore(password: string, seed: Uint8Array): Promise; /** * Create a new vault and primary keyring. * * This only works if keyrings are empty. If there is a pre-existing unlocked vault, calling this will have no effect. * If there is a pre-existing locked vault, it will be replaced. * * @param password - Password to unlock the new vault. * @returns Promise resolving when the operation ends successfully. */ createNewVaultAndKeychain(password: string): Promise; /** * Adds a new keyring of the given `type`. * * @param type - Keyring type name. * @param opts - Keyring options. * @throws If a builder for the given `type` does not exist. * @returns Promise resolving to the new keyring metadata. */ addNewKeyring(type: KeyringTypes | string, opts?: unknown): Promise; /** * Method to verify a given password validity. Throws an * error if the password is invalid. * * @param password - Password of the keyring. */ verifyPassword(password: string): Promise; /** * Returns the status of the vault. * * @returns Boolean returning true if the vault is unlocked. */ isUnlocked(): boolean; /** * Gets the seed phrase of the HD keyring. * * @param credentials - Object holding either the `password` or the vault * `encryptionKey`. * @param keyringId - The id of the keyring. * @returns Promise resolving to the seed phrase. */ exportSeedPhrase(credentials: Credentials, keyringId?: string): Promise; /** * Gets the private key from the keyring controlling an address. * * @param credentials - Object holding either the `password` or the vault * `encryptionKey`. * @param address - Address to export. * @returns Promise resolving to the private key for an address. */ exportAccount(credentials: Credentials, address: string): Promise; /** * Returns the public addresses of all accounts from every keyring. * * @returns A promise resolving to an array of addresses. */ getAccounts(): Promise; /** * Get encryption public key. * * @param account - An account address. * @param opts - Additional encryption options. * @throws If the `account` does not exist or does not support the `getEncryptionPublicKey` method * @returns Promise resolving to encyption public key of the `account` if one exists. */ getEncryptionPublicKey(account: string, opts?: Record): Promise; /** * Attempts to decrypt the provided message parameters. * * @param messageParams - The decryption message parameters. * @param messageParams.from - The address of the account you want to use to decrypt the message. * @param messageParams.data - The encrypted data that you want to decrypt. * @returns The raw decryption result. */ decryptMessage(messageParams: { from: string; data: Eip1024EncryptedData; }): Promise; /** * Returns the currently initialized keyring that manages * the specified `address` if one exists. * * @deprecated Use of this method is discouraged as actions executed directly on * keyrings are not being reflected in the KeyringController state and not * persisted in the vault. Use `withKeyring` instead. * @param account - An account address. * @returns Promise resolving to keyring of the `account` if one exists. */ getKeyringForAccount(account: string): Promise; /** * Returns all keyrings of the given type. * * @deprecated Use of this method is discouraged as actions executed directly on * keyrings are not being reflected in the KeyringController state and not * persisted in the vault. Use `withKeyring` instead. * @param type - Keyring type name. * @returns An array of keyrings of the given type. */ getKeyringsByType(type: KeyringTypes | string): unknown[]; /** * Persist all serialized keyrings in the vault. * * @deprecated This method is being phased out in favor of `withKeyring`. * @returns Promise resolving with `true` value when the * operation completes. */ persistAllKeyrings(): Promise; /** * Imports an account with the specified import strategy. * * @param strategy - Import strategy name. * @param args - Array of arguments to pass to the underlying stategy. * @throws Will throw when passed an unrecognized strategy. * @returns Promise resolving to the imported account address. */ importAccountWithStrategy(strategy: AccountImportStrategy, args: any[]): Promise; /** * Removes an account from keyring state. * * @param address - Address of the account to remove. * @fires KeyringController:accountRemoved * @returns Promise resolving when the account is removed. */ removeAccount(address: string): Promise; /** * Deallocates all secrets and locks the wallet. * * @returns Promise resolving when the operation completes. */ setLocked(): Promise; /** * Signs message by calling down into a specific keyring. * * @param messageParams - PersonalMessageParams object to sign. * @returns Promise resolving to a signed message string. */ signMessage(messageParams: PersonalMessageParams): Promise; /** * Signs EIP-7702 Authorization message by calling down into a specific keyring. * * @param params - EIP7702AuthorizationParams object to sign. * @returns Promise resolving to an EIP-7702 Authorization signature. * @throws Will throw UnsupportedSignEIP7702Authorization if the keyring does not support signing EIP-7702 Authorization messages. */ signEip7702Authorization(params: Eip7702AuthorizationParams): Promise; /** * Signs personal message by calling down into a specific keyring. * * @param messageParams - PersonalMessageParams object to sign. * @returns Promise resolving to a signed message string. */ signPersonalMessage(messageParams: PersonalMessageParams): Promise; /** * Signs typed message by calling down into a specific keyring. * * @param messageParams - TypedMessageParams object to sign. * @param version - Compatibility version EIP712. * @throws Will throw when passed an unrecognized version. * @returns Promise resolving to a signed message string or an error if any. */ signTypedMessage(messageParams: TypedMessageParams, version: SignTypedDataVersion): Promise; /** * Signs a transaction by calling down into a specific keyring. * * @param transaction - Transaction object to sign. Must be a `ethereumjs-tx` transaction instance. * @param from - Address to sign from, should be in keychain. * @param opts - An optional options object. * @returns Promise resolving to a signed transaction string. */ signTransaction(transaction: TypedTransaction, from: string, opts?: Record): Promise; /** * Convert a base transaction to a base UserOperation. * * @param from - Address of the sender. * @param transactions - Base transactions to include in the UserOperation. * @param executionContext - The execution context to use for the UserOperation. * @returns A pseudo-UserOperation that can be used to construct a real. */ prepareUserOperation(from: string, transactions: EthBaseTransaction[], executionContext: KeyringExecutionContext): Promise; /** * Patches properties of a UserOperation. Currently, only the * `paymasterAndData` can be patched. * * @param from - Address of the sender. * @param userOp - UserOperation to patch. * @param executionContext - The execution context to use for the UserOperation. * @returns A patch to apply to the UserOperation. */ patchUserOperation(from: string, userOp: EthUserOperation, executionContext: KeyringExecutionContext): Promise; /** * Signs an UserOperation. * * @param from - Address of the sender. * @param userOp - UserOperation to sign. * @param executionContext - The execution context to use for the UserOperation. * @returns The signature of the UserOperation. */ signUserOperation(from: string, userOp: EthUserOperation, executionContext: KeyringExecutionContext): Promise; /** * Changes the password used to encrypt the vault. * * @param password - The new password. * @returns Promise resolving when the operation completes. */ changePassword(password: string): Promise; /** * Attempts to decrypt the current vault and load its keyrings, using the * given encryption key and salt. The optional salt can be used to check for * consistency with the vault salt. * * @param encryptionKey - Key to unlock the keychain. * @param encryptionSalt - Optional salt to unlock the keychain. * @returns Promise resolving when the operation completes. */ submitEncryptionKey(encryptionKey: string, encryptionSalt?: string): Promise; /** * Exports the vault encryption key. * * @returns The vault encryption key. */ exportEncryptionKey(): Promise; /** * Attempts to decrypt the current vault and load its keyrings, * using the given password. * * @param password - Password to unlock the keychain. * @returns Promise resolving when the operation completes. */ submitPassword(password: string): Promise; /** * Verifies the that the seed phrase restores the current keychain's accounts. * * @param keyringId - The id of the keyring to verify. * @returns Promise resolving to the seed phrase as Uint8Array. */ verifySeedPhrase(keyringId?: string): Promise; /** * Select a keyring and execute the given operation with * the selected keyring, as a mutually exclusive atomic * operation. * * The method automatically persists changes at the end of the * function execution, or rolls back the changes if an error * is thrown. * * @param selector - Keyring selector object. * @param operation - Function to execute with the selected keyring. * @param options - Additional options. * @param options.createIfMissing - Whether to create a new keyring if the selected one is missing. * @param options.createWithData - Optional data to use when creating a new keyring. * @returns Promise resolving to the result of the function execution. * @template SelectedKeyring - The type of the selected keyring. * @template CallbackResult - The type of the value resolved by the callback function. * @deprecated This method overload is deprecated. Use `withKeyring` without options instead. */ withKeyring(selector: KeyringSelector, operation: ({ keyring, metadata }: KeyringEntry) => Promise, options: { createIfMissing?: false; } | { createIfMissing: true; createWithData?: unknown; }): Promise; /** * Select a keyring and execute the given operation with * the selected keyring, as a mutually exclusive atomic * operation. * * The method automatically persists changes at the end of the * function execution, or rolls back the changes if an error * is thrown. * * @param selector - Keyring selector object. * @param operation - Function to execute with the selected keyring. * @returns Promise resolving to the result of the function execution. * @template SelectedKeyring - The type of the selected keyring. * @template CallbackResult - The type of the value resolved by the callback function. */ withKeyring(selector: KeyringSelector, operation: ({ keyring, metadata }: KeyringEntry) => Promise): Promise; /** * Select a keyring and execute the given operation with the selected * keyring, **without** acquiring the controller's mutual exclusion lock. * * ## When to use this method * * This method is an escape hatch for read-only access to keyring data that * is immutable once the keyring is initialized. A typical safe use case is * reading the `mnemonic` from an `HdKeyring`: the mnemonic is set during * `deserialize()` and never mutated afterwards, so it can safely be read * without holding the lock. * * ## Why it is "unsafe" * * The "unsafe" designation mirrors the semantics of `unsafe { }` blocks in * Rust: the method itself does not enforce thread-safety guarantees. By * calling this method the **caller** explicitly takes responsibility for * ensuring that: * * - The operation is **read-only** — no state is mutated. * - The data being read is **immutable** after the keyring is initialized, * so concurrent locked operations cannot alter it while this callback * runs. * * Do **not** use this method to: * - Mutate keyring state (add accounts, sign, etc.) — use `withKeyring`. * - Read mutable fields that could change during concurrent operations. * * @param selector - Keyring selector object. * @param operation - Read-only function to execute with the selected keyring. * @returns Promise resolving to the result of the function execution. * @template SelectedKeyring - The type of the selected keyring. * @template CallbackResult - The type of the value resolved by the callback function. */ withKeyringUnsafe(selector: KeyringSelector, operation: ({ keyring, metadata, }: { keyring: SelectedKeyring; metadata: KeyringMetadata; }) => Promise): Promise; /** * Select a keyring using its `KeyringV2` adapter, and execute * the given operation with the wrapped keyring as a mutually * exclusive atomic operation. * * The cached `KeyringV2` adapter is retrieved from the keyring * entry. * * A `KeyringV2Builder` for the selected keyring's type must exist * (either as a default or registered via the `keyringV2Builders` * constructor option); otherwise an error is thrown. * * The method automatically persists changes at the end of the * function execution, or rolls back the changes if an error * is thrown. * * @param selector - Keyring selector object. * @param operation - Function to execute with the wrapped V2 keyring. * @returns Promise resolving to the result of the function execution. * @template CallbackResult - The type of the value resolved by the callback function. */ withKeyringV2(selector: KeyringSelectorV2, operation: ({ keyring, metadata, }: { keyring: SelectedKeyring; metadata: KeyringMetadata; }) => Promise): Promise; /** * Select a keyring, wrap it in a `KeyringV2` adapter, and execute * the given read-only operation **without** acquiring the controller's * mutual exclusion lock. * * ## When to use this method * * This method is an escape hatch for read-only access to keyring data that * is immutable once the keyring is initialized. A typical safe use case is * reading immutable fields from a `KeyringV2` adapter: data that is set * during initialization and never mutated afterwards. * * ## Why it is "unsafe" * * The "unsafe" designation mirrors the semantics of `unsafe { }` blocks in * Rust: the method itself does not enforce thread-safety guarantees. By * calling this method the **caller** explicitly takes responsibility for * ensuring that: * * - The operation is **read-only** — no state is mutated. * - The data being read is **immutable** after the keyring is initialized, * so concurrent locked operations cannot alter it while this callback * runs. * * Do **not** use this method to: * - Mutate keyring state (add accounts, sign, etc.) — use `withKeyringV2`. * - Read mutable fields that could change during concurrent operations. * * @param selector - Keyring selector object. * @param operation - Read-only function to execute with the wrapped V2 keyring. * @returns Promise resolving to the result of the function execution. * @template SelectedKeyring - The type of the selected V2 keyring. * @template CallbackResult - The type of the value resolved by the callback function. */ withKeyringV2Unsafe(selector: KeyringSelectorV2, operation: ({ keyring, metadata, }: { keyring: SelectedKeyring; metadata: KeyringMetadata; }) => Promise): Promise; /** * Execute an operation against all keyrings as a mutually exclusive atomic * operation. The operation receives a {@link RestrictedController} instance * that exposes a read-only live view of all keyrings as well as * `addNewKeyring` and `removeKeyring` methods to stage mutations. * * The method automatically persists changes at the end of the function * execution, or rolls back the changes if an error is thrown. * * @param operation - Function to execute with the restricted controller. * @returns Promise resolving to the result of the function execution. * @template CallbackResult - The type of the value resolved by the callback function. */ withController(operation: (restrictedController: RestrictedController) => Promise): Promise; /** * Gets the type of the keyring that manages the specified account. * * @param account - The account address to look up. * @returns A promise that resolves to the type of the keyring managing the account. */ getAccountKeyringType(account: string): Promise; } export default KeyringController; //# sourceMappingURL=KeyringController.d.mts.map