@metamask/eth-ledger-bridge-keyring
Version:
A MetaMask compatible keyring, for ledger hardware wallets
24 lines • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createMockDeviceExchangeError = void 0;
const eth_get_app_configuration_command_1 = require("../eth-get-app-configuration-command.cjs");
/**
* Construct a mock {@link DeviceExchangeError} for tests.
*
* The DMK `DeviceExchangeError` is normally raised inside the DMK runtime;
* tests need a structurally-equivalent value without going through DMK.
* This helper centralises the cast so test files don't each roll their own.
*
* @param errorCode - The hex error code to embed (e.g. `'6985'`).
* @returns A mock `DeviceExchangeError<TErrorCode>`.
*/
function createMockDeviceExchangeError(errorCode) {
return {
_tag: eth_get_app_configuration_command_1.ETH_APP_COMMAND_ERROR_TAG,
message: `DMK error: ${String(errorCode)}`,
errorCode,
originalError: undefined,
};
}
exports.createMockDeviceExchangeError = createMockDeviceExchangeError;
//# sourceMappingURL=mock-error.cjs.map