import type { KeyringAccount, EntropySourceId } from "@metamask/keyring-api"; import type { KeyringCapabilities, Keyring, CreateAccountBip44DeriveIndexOptions } from "@metamask/keyring-api/v2"; import { EthKeyringWrapper } from "@metamask/keyring-sdk/v2"; import type { AccountId } from "@metamask/keyring-utils"; import { DeviceMode } from "../device.mjs"; import type { IndexedAddress } from "../device.mjs"; import type { QrKeyring as LegacyQrKeyring } from "../qr-keyring.mjs"; /** * Custom options for creating accounts on Account mode QR devices. * Account mode devices provide pre-defined addresses that must be selected by index. */ export type QrAccountModeCreateOptions = { type: 'custom'; /** * The entropy source ID (device fingerprint) to verify we're targeting the correct device. */ entropySource: EntropySourceId; /** * The index of the pre-defined address to add from the device. * This refers to the position in the device's address list, not a BIP-44 derivation index. */ addressIndex: number; }; /** * Account creation options for QR keyring. * Excludes unsupported types (custom, private-key:import) and adds our specific QrAccountModeCreateOptions. */ export type QrKeyringCreateAccountOptions = CreateAccountBip44DeriveIndexOptions | QrAccountModeCreateOptions; /** * Concrete {@link Keyring} adapter for {@link QrKeyring}. * * This wrapper exposes the accounts and signing capabilities of the legacy * QR keyring via the unified V2 interface. * * Account handling differs by device mode: * - **HD mode**: Accounts are derived by index with `groupIndex` values. * Supports `bip44:derive-index` for index-based derivation. * - **Account mode**: Accounts are treated as private key imports since the * device provides pre-defined addresses with arbitrary paths. Uses `custom` * account creation type to select addresses by their position in the device. */ export type QrKeyringOptions = { legacyKeyring: LegacyQrKeyring; entropySource: EntropySourceId; }; export declare class QrKeyring extends EthKeyringWrapper implements Keyring { #private; readonly entropySource: EntropySourceId; constructor(options: QrKeyringOptions); /** * Get the capabilities of this keyring. * * Overrides the base class getter to return capabilities dynamically * based on the current device mode. * * @returns The keyring's capabilities. */ get capabilities(): KeyringCapabilities; getAccounts(): Promise; createAccounts(options: QrKeyringCreateAccountOptions): Promise; /** * Delete an account from the keyring. * * @param accountId - The account ID to delete. */ deleteAccount(accountId: AccountId): Promise; /** * @returns The name of the paired device, or the keyring type if no device * is paired. */ getName(): string; /** * @returns The current device mode (HD or Account), or `undefined` if no * device is paired. */ getMode(): DeviceMode | undefined; /** * Fetch the first page of candidate addresses from the device. * * @returns The first page of addresses. */ getFirstPage(): Promise; /** * Fetch the next page of candidate addresses from the device. * * @returns The next page of addresses. */ getNextPage(): Promise; /** * Fetch the previous page of candidate addresses from the device. * * @returns The previous page of addresses. */ getPreviousPage(): Promise; /** * Clear the inner keyring's device-pairing state and accounts, and reset * the V2 account registry to keep them in sync. */ forgetDevice(): Promise; } //# sourceMappingURL=qr-keyring.d.mts.map