@metamask/eth-ledger-bridge-keyring
Version:
A MetaMask compatible keyring, for ledger hardware wallets
31 lines • 1.48 kB
text/typescript
import { ErrorMapping, ErrorCode, HardwareWalletError } from "@metamask/hw-wallet-sdk";
/**
* Factory function to create a HardwareWalletError from a Ledger error code.
*
* @param ledgerErrorCode - The Ledger error code (e.g., '0x6985', '0x5515')
* @param context - Optional additional context to append to the error message
* @returns A HardwareWalletError instance with mapped error details
*/
export declare function createLedgerError(ledgerErrorCode: string, context?: string): HardwareWalletError;
/**
* Checks if a Ledger error code exists in the error mappings.
*
* @param ledgerErrorCode - The Ledger error code to check
* @returns True if the error code is mapped, false otherwise
*/
export declare function isKnownLedgerError(ledgerErrorCode: string): boolean;
/**
* Gets the error mapping details for a Ledger error code without creating an error instance.
*
* @param ledgerErrorCode - The Ledger error code to look up
* @returns The error mapping details or undefined if not found
*/
export declare function getLedgerErrorMapping(ledgerErrorCode: string): ErrorMapping | undefined;
/**
* Factory function to create a HardwareWalletError from a keyring-level error code.
*
* @param code - The keyring error code (e.g., ErrorCode.DeviceStateOnlyV4Supported)
* @returns A HardwareWalletError instance with mapped error details
*/
export declare function createKeyringStateError(code: ErrorCode): HardwareWalletError;
//# sourceMappingURL=errors.d.cts.map