@metamask/eth-ledger-bridge-keyring
Version:
A MetaMask compatible keyring, for ledger hardware wallets
20 lines • 772 B
JavaScript
import { ETH_APP_COMMAND_ERROR_TAG } from "../eth-get-app-configuration-command.mjs";
/**
* 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>`.
*/
export function createMockDeviceExchangeError(errorCode) {
return {
_tag: ETH_APP_COMMAND_ERROR_TAG,
message: `DMK error: ${String(errorCode)}`,
errorCode,
originalError: undefined,
};
}
//# sourceMappingURL=mock-error.mjs.map