Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ledgerhq/errors

Package Overview
Dependencies
Maintainers
12
Versions
232
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ledgerhq/errors - npm Package Compare versions

Comparing version 4.74.2 to 5.0.0-alpha.3

140

lib/helpers.js

@@ -6,18 +6,20 @@ "use strict";

});
exports.serializeError = exports.deserializeError = exports.createCustomErrorClass = exports.addCustomErrorDeserializer = void 0;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
/* eslint-disable no-continue */
/* eslint-disable no-continue */
/* eslint-disable no-param-reassign */
/* eslint-disable no-prototype-builtins */
const errorClasses = {};
const deserializers = {};
var errorClasses = {};
var deserializers = {};
var addCustomErrorDeserializer = exports.addCustomErrorDeserializer = function addCustomErrorDeserializer(name, deserializer) {
const addCustomErrorDeserializer = (name, deserializer) => {
deserializers[name] = deserializer;
};
var createCustomErrorClass = exports.createCustomErrorClass = function createCustomErrorClass(name) {
var C = function CustomError(message, fields) {
exports.addCustomErrorDeserializer = addCustomErrorDeserializer;
const createCustomErrorClass = name => {
const C = function CustomError(message, fields) {
Object.assign(this, fields);

@@ -27,43 +29,48 @@ this.name = name;

this.stack = new Error().stack;
};
// $FlowFixMe
}; // $FlowFixMe
C.prototype = new Error();
errorClasses[name] = C; // $FlowFixMe we can't easily type a subset of Error for now...
errorClasses[name] = C;
// $FlowFixMe we can't easily type a subset of Error for now...
return C;
};
}; // inspired from https://github.com/programble/errio/blob/master/index.js
// inspired from https://github.com/programble/errio/blob/master/index.js
var deserializeError = exports.deserializeError = function deserializeError(object) {
if ((typeof object === "undefined" ? "undefined" : _typeof(object)) === "object" && object) {
exports.createCustomErrorClass = createCustomErrorClass;
const deserializeError = object => {
if (typeof object === "object" && object) {
try {
// $FlowFixMe FIXME HACK
var msg = JSON.parse(object.message);
const msg = JSON.parse(object.message);
if (msg.message && msg.name) {
object = msg;
}
} catch (e) {
// nothing
} catch (e) {// nothing
}
var error = void 0;
let error;
if (typeof object.name === "string") {
var _object = object,
name = _object.name;
const {
name
} = object;
const des = deserializers[name];
var des = deserializers[name];
if (des) {
error = des(object);
} else {
var _constructor = name === "Error" ? Error : errorClasses[name];
let constructor = name === "Error" ? Error : errorClasses[name];
if (!_constructor) {
if (!constructor) {
console.warn("deserializing an unknown class '" + name + "'");
_constructor = createCustomErrorClass(name);
constructor = createCustomErrorClass(name);
}
error = Object.create(_constructor.prototype);
error = Object.create(constructor.prototype);
try {
for (var prop in object) {
for (const prop in object) {
if (object.hasOwnProperty(prop)) {

@@ -73,4 +80,3 @@ error[prop] = object[prop];

}
} catch (e) {
// sometimes setting a property can fail (e.g. .name)
} catch (e) {// sometimes setting a property can fail (e.g. .name)
}

@@ -85,58 +91,51 @@ }

}
return error;
}
return new Error(String(object));
};
}; // inspired from https://github.com/sindresorhus/serialize-error/blob/master/index.js
// inspired from https://github.com/sindresorhus/serialize-error/blob/master/index.js
var serializeError = exports.serializeError = function serializeError(value) {
exports.deserializeError = deserializeError;
const serializeError = value => {
if (!value) return value;
if ((typeof value === "undefined" ? "undefined" : _typeof(value)) === "object") {
if (typeof value === "object") {
return destroyCircular(value, []);
}
if (typeof value === "function") {
return "[Function: " + (value.name || "anonymous") + "]";
return `[Function: ${value.name || "anonymous"}]`;
}
return value;
};
}; // https://www.npmjs.com/package/destroy-circular
// https://www.npmjs.com/package/destroy-circular
exports.serializeError = serializeError;
function destroyCircular(from, seen) {
var to = {};
const to = {};
seen.push(from);
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = Object.keys(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var key = _step.value;
for (const key of Object.keys(from)) {
const value = from[key];
var value = from[key];
if (typeof value === "function") {
continue;
}
if (!value || (typeof value === "undefined" ? "undefined" : _typeof(value)) !== "object") {
to[key] = value;
continue;
}
if (seen.indexOf(from[key]) === -1) {
to[key] = destroyCircular(from[key], seen.slice(0));
continue;
}
to[key] = "[Circular]";
if (typeof value === "function") {
continue;
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
if (!value || typeof value !== "object") {
to[key] = value;
continue;
}
if (seen.indexOf(from[key]) === -1) {
to[key] = destroyCircular(from[key], seen.slice(0));
continue;
}
to[key] = "[Circular]";
}

@@ -147,10 +146,13 @@

}
if (typeof from.message === "string") {
to.message = from.message;
}
if (typeof from.stack === "string") {
to.stack = from.stack;
}
return to;
}
//# sourceMappingURL=helpers.js.map

@@ -6,102 +6,206 @@ "use strict";

});
exports.StatusCodes = exports.DBNotReset = exports.DBWrongPassword = exports.NoDBPathGiven = exports.FirmwareOrAppUpdateRequired = exports.LedgerAPI5xx = exports.LedgerAPI4xx = exports.GenuineCheckFailed = exports.PairingFailed = exports.SyncError = exports.FeeTooHigh = exports.FeeRequired = exports.FeeNotLoaded = exports.CantScanQRCode = exports.ETHAddressNonEIP = exports.WrongAppForCurrency = exports.WrongDeviceForAccount = exports.WebsocketConnectionFailed = exports.WebsocketConnectionError = exports.DeviceShouldStayInApp = exports.TransportWebUSBGestureRequired = exports.TransportInterfaceNotAvailable = exports.TransportOpenUserCancelled = exports.UserRefusedOnDevice = exports.UserRefusedAllowManager = exports.UserRefusedFirmwareUpdate = exports.UserRefusedAddress = exports.UserRefusedDeviceNameChange = exports.UpdateYourApp = exports.UnavailableTezosOriginatedAccountSend = exports.UnavailableTezosOriginatedAccountReceive = exports.RecipientRequired = exports.MCUNotGenuineToDashboard = exports.UnexpectedBootloader = exports.TimeoutTagged = exports.PasswordIncorrectError = exports.PasswordsDontMatchError = exports.GasLessThanEstimate = exports.NotEnoughGas = exports.NoAccessToCamera = exports.NotEnoughBalanceBecauseDestinationNotCreated = exports.NotEnoughSpendableBalance = exports.NotEnoughBalanceInParentAccount = exports.NotEnoughBalanceToDelegate = exports.NotEnoughBalance = exports.NoAddressesFound = exports.NetworkDown = exports.ManagerUninstallBTCDep = exports.ManagerNotEnoughSpaceError = exports.ManagerFirmwareNotEnoughSpaceError = exports.ManagerDeviceLockedError = exports.ManagerAppDepUninstallRequired = exports.ManagerAppDepInstallRequired = exports.ManagerAppRelyOnBTCError = exports.ManagerAppAlreadyInstalledError = exports.LedgerAPINotAvailable = exports.LedgerAPIErrorWithMessage = exports.LedgerAPIError = exports.UnknownMCU = exports.LatestMCUInstalledError = exports.InvalidAddressBecauseDestinationIsAlsoSource = exports.InvalidAddress = exports.InvalidXRPTag = exports.HardResetFail = exports.FeeEstimationFailed = exports.EthAppPleaseEnableContractData = exports.EnpointConfigError = exports.DisconnectedDeviceDuringOperation = exports.DisconnectedDevice = exports.DeviceSocketNoBulkStatus = exports.DeviceSocketFail = exports.DeviceNameInvalid = exports.DeviceHalted = exports.DeviceInOSUExpected = exports.DeviceOnDashboardUnexpected = exports.DeviceOnDashboardExpected = exports.DeviceNotGenuineError = exports.DeviceGenuineSocketEarlyClose = exports.DeviceAppVerifyNotSupported = exports.CurrencyNotSupported = exports.CashAddrNotSupported = exports.CantOpenDevice = exports.BtcUnmatchedApp = exports.BluetoothRequired = exports.AmountRequired = exports.AccountNotSupported = exports.AccountNameRequiredError = exports.addCustomErrorDeserializer = exports.createCustomErrorClass = exports.deserializeError = exports.serializeError = undefined;
exports.TransportError = TransportError;
exports.getAltStatusMessage = getAltStatusMessage;
exports.TransportStatusError = TransportStatusError;
Object.defineProperty(exports, "serializeError", {
enumerable: true,
get: function () {
return _helpers.serializeError;
}
});
Object.defineProperty(exports, "deserializeError", {
enumerable: true,
get: function () {
return _helpers.deserializeError;
}
});
Object.defineProperty(exports, "createCustomErrorClass", {
enumerable: true,
get: function () {
return _helpers.createCustomErrorClass;
}
});
Object.defineProperty(exports, "addCustomErrorDeserializer", {
enumerable: true,
get: function () {
return _helpers.addCustomErrorDeserializer;
}
});
exports.StatusCodes = exports.DBNotReset = exports.DBWrongPassword = exports.NoDBPathGiven = exports.FirmwareOrAppUpdateRequired = exports.LedgerAPI5xx = exports.LedgerAPI4xx = exports.GenuineCheckFailed = exports.PairingFailed = exports.SyncError = exports.FeeTooHigh = exports.FeeRequired = exports.FeeNotLoaded = exports.CantScanQRCode = exports.ETHAddressNonEIP = exports.WrongAppForCurrency = exports.WrongDeviceForAccount = exports.WebsocketConnectionFailed = exports.WebsocketConnectionError = exports.DeviceShouldStayInApp = exports.TransportWebUSBGestureRequired = exports.TransportInterfaceNotAvailable = exports.TransportOpenUserCancelled = exports.UserRefusedOnDevice = exports.UserRefusedAllowManager = exports.UserRefusedFirmwareUpdate = exports.UserRefusedAddress = exports.UserRefusedDeviceNameChange = exports.UpdateYourApp = exports.UnavailableTezosOriginatedAccountSend = exports.UnavailableTezosOriginatedAccountReceive = exports.RecipientRequired = exports.MCUNotGenuineToDashboard = exports.UnexpectedBootloader = exports.TimeoutTagged = exports.PasswordIncorrectError = exports.PasswordsDontMatchError = exports.GasLessThanEstimate = exports.NotEnoughGas = exports.NoAccessToCamera = exports.NotEnoughBalanceBecauseDestinationNotCreated = exports.NotEnoughSpendableBalance = exports.NotEnoughBalanceInParentAccount = exports.NotEnoughBalanceToDelegate = exports.NotEnoughBalance = exports.NoAddressesFound = exports.NetworkDown = exports.ManagerUninstallBTCDep = exports.ManagerNotEnoughSpaceError = exports.ManagerFirmwareNotEnoughSpaceError = exports.ManagerDeviceLockedError = exports.ManagerAppDepUninstallRequired = exports.ManagerAppDepInstallRequired = exports.ManagerAppRelyOnBTCError = exports.ManagerAppAlreadyInstalledError = exports.LedgerAPINotAvailable = exports.LedgerAPIErrorWithMessage = exports.LedgerAPIError = exports.UnknownMCU = exports.LatestMCUInstalledError = exports.InvalidAddressBecauseDestinationIsAlsoSource = exports.InvalidAddress = exports.InvalidXRPTag = exports.HardResetFail = exports.FeeEstimationFailed = exports.EthAppPleaseEnableContractData = exports.EnpointConfigError = exports.DisconnectedDeviceDuringOperation = exports.DisconnectedDevice = exports.DeviceSocketNoBulkStatus = exports.DeviceSocketFail = exports.DeviceNameInvalid = exports.DeviceHalted = exports.DeviceInOSUExpected = exports.DeviceOnDashboardUnexpected = exports.DeviceOnDashboardExpected = exports.DeviceNotGenuineError = exports.DeviceGenuineSocketEarlyClose = exports.DeviceAppVerifyNotSupported = exports.CurrencyNotSupported = exports.CashAddrNotSupported = exports.CantOpenDevice = exports.BtcUnmatchedApp = exports.BluetoothRequired = exports.AmountRequired = exports.AccountNotSupported = exports.AccountNameRequiredError = void 0;
var _helpers = require("./helpers");
exports.serializeError = _helpers.serializeError;
exports.deserializeError = _helpers.deserializeError;
exports.createCustomErrorClass = _helpers.createCustomErrorClass;
exports.addCustomErrorDeserializer = _helpers.addCustomErrorDeserializer;
var AccountNameRequiredError = exports.AccountNameRequiredError = (0, _helpers.createCustomErrorClass)("AccountNameRequired");
var AccountNotSupported = exports.AccountNotSupported = (0, _helpers.createCustomErrorClass)("AccountNotSupported");
var AmountRequired = exports.AmountRequired = (0, _helpers.createCustomErrorClass)("AmountRequired");
var BluetoothRequired = exports.BluetoothRequired = (0, _helpers.createCustomErrorClass)("BluetoothRequired");
var BtcUnmatchedApp = exports.BtcUnmatchedApp = (0, _helpers.createCustomErrorClass)("BtcUnmatchedApp");
var CantOpenDevice = exports.CantOpenDevice = (0, _helpers.createCustomErrorClass)("CantOpenDevice");
var CashAddrNotSupported = exports.CashAddrNotSupported = (0, _helpers.createCustomErrorClass)("CashAddrNotSupported");
var CurrencyNotSupported = exports.CurrencyNotSupported = (0, _helpers.createCustomErrorClass)("CurrencyNotSupported");
var DeviceAppVerifyNotSupported = exports.DeviceAppVerifyNotSupported = (0, _helpers.createCustomErrorClass)("DeviceAppVerifyNotSupported");
var DeviceGenuineSocketEarlyClose = exports.DeviceGenuineSocketEarlyClose = (0, _helpers.createCustomErrorClass)("DeviceGenuineSocketEarlyClose");
var DeviceNotGenuineError = exports.DeviceNotGenuineError = (0, _helpers.createCustomErrorClass)("DeviceNotGenuine");
var DeviceOnDashboardExpected = exports.DeviceOnDashboardExpected = (0, _helpers.createCustomErrorClass)("DeviceOnDashboardExpected");
var DeviceOnDashboardUnexpected = exports.DeviceOnDashboardUnexpected = (0, _helpers.createCustomErrorClass)("DeviceOnDashboardUnexpected");
var DeviceInOSUExpected = exports.DeviceInOSUExpected = (0, _helpers.createCustomErrorClass)("DeviceInOSUExpected");
var DeviceHalted = exports.DeviceHalted = (0, _helpers.createCustomErrorClass)("DeviceHalted");
var DeviceNameInvalid = exports.DeviceNameInvalid = (0, _helpers.createCustomErrorClass)("DeviceNameInvalid");
var DeviceSocketFail = exports.DeviceSocketFail = (0, _helpers.createCustomErrorClass)("DeviceSocketFail");
var DeviceSocketNoBulkStatus = exports.DeviceSocketNoBulkStatus = (0, _helpers.createCustomErrorClass)("DeviceSocketNoBulkStatus");
var DisconnectedDevice = exports.DisconnectedDevice = (0, _helpers.createCustomErrorClass)("DisconnectedDevice");
var DisconnectedDeviceDuringOperation = exports.DisconnectedDeviceDuringOperation = (0, _helpers.createCustomErrorClass)("DisconnectedDeviceDuringOperation");
var EnpointConfigError = exports.EnpointConfigError = (0, _helpers.createCustomErrorClass)("EnpointConfig");
var EthAppPleaseEnableContractData = exports.EthAppPleaseEnableContractData = (0, _helpers.createCustomErrorClass)("EthAppPleaseEnableContractData");
var FeeEstimationFailed = exports.FeeEstimationFailed = (0, _helpers.createCustomErrorClass)("FeeEstimationFailed");
var HardResetFail = exports.HardResetFail = (0, _helpers.createCustomErrorClass)("HardResetFail");
var InvalidXRPTag = exports.InvalidXRPTag = (0, _helpers.createCustomErrorClass)("InvalidXRPTag");
var InvalidAddress = exports.InvalidAddress = (0, _helpers.createCustomErrorClass)("InvalidAddress");
var InvalidAddressBecauseDestinationIsAlsoSource = exports.InvalidAddressBecauseDestinationIsAlsoSource = (0, _helpers.createCustomErrorClass)("InvalidAddressBecauseDestinationIsAlsoSource");
var LatestMCUInstalledError = exports.LatestMCUInstalledError = (0, _helpers.createCustomErrorClass)("LatestMCUInstalledError");
var UnknownMCU = exports.UnknownMCU = (0, _helpers.createCustomErrorClass)("UnknownMCU");
var LedgerAPIError = exports.LedgerAPIError = (0, _helpers.createCustomErrorClass)("LedgerAPIError");
var LedgerAPIErrorWithMessage = exports.LedgerAPIErrorWithMessage = (0, _helpers.createCustomErrorClass)("LedgerAPIErrorWithMessage");
var LedgerAPINotAvailable = exports.LedgerAPINotAvailable = (0, _helpers.createCustomErrorClass)("LedgerAPINotAvailable");
var ManagerAppAlreadyInstalledError = exports.ManagerAppAlreadyInstalledError = (0, _helpers.createCustomErrorClass)("ManagerAppAlreadyInstalled");
var ManagerAppRelyOnBTCError = exports.ManagerAppRelyOnBTCError = (0, _helpers.createCustomErrorClass)("ManagerAppRelyOnBTC");
var ManagerAppDepInstallRequired = exports.ManagerAppDepInstallRequired = (0, _helpers.createCustomErrorClass)("ManagerAppDepInstallRequired");
var ManagerAppDepUninstallRequired = exports.ManagerAppDepUninstallRequired = (0, _helpers.createCustomErrorClass)("ManagerAppDepUninstallRequired");
var ManagerDeviceLockedError = exports.ManagerDeviceLockedError = (0, _helpers.createCustomErrorClass)("ManagerDeviceLocked");
var ManagerFirmwareNotEnoughSpaceError = exports.ManagerFirmwareNotEnoughSpaceError = (0, _helpers.createCustomErrorClass)("ManagerFirmwareNotEnoughSpace");
var ManagerNotEnoughSpaceError = exports.ManagerNotEnoughSpaceError = (0, _helpers.createCustomErrorClass)("ManagerNotEnoughSpace");
var ManagerUninstallBTCDep = exports.ManagerUninstallBTCDep = (0, _helpers.createCustomErrorClass)("ManagerUninstallBTCDep");
var NetworkDown = exports.NetworkDown = (0, _helpers.createCustomErrorClass)("NetworkDown");
var NoAddressesFound = exports.NoAddressesFound = (0, _helpers.createCustomErrorClass)("NoAddressesFound");
var NotEnoughBalance = exports.NotEnoughBalance = (0, _helpers.createCustomErrorClass)("NotEnoughBalance");
var NotEnoughBalanceToDelegate = exports.NotEnoughBalanceToDelegate = (0, _helpers.createCustomErrorClass)("NotEnoughBalanceToDelegate");
var NotEnoughBalanceInParentAccount = exports.NotEnoughBalanceInParentAccount = (0, _helpers.createCustomErrorClass)("NotEnoughBalanceInParentAccount");
var NotEnoughSpendableBalance = exports.NotEnoughSpendableBalance = (0, _helpers.createCustomErrorClass)("NotEnoughSpendableBalance");
var NotEnoughBalanceBecauseDestinationNotCreated = exports.NotEnoughBalanceBecauseDestinationNotCreated = (0, _helpers.createCustomErrorClass)("NotEnoughBalanceBecauseDestinationNotCreated");
var NoAccessToCamera = exports.NoAccessToCamera = (0, _helpers.createCustomErrorClass)("NoAccessToCamera");
var NotEnoughGas = exports.NotEnoughGas = (0, _helpers.createCustomErrorClass)("NotEnoughGas");
var GasLessThanEstimate = exports.GasLessThanEstimate = (0, _helpers.createCustomErrorClass)("GasLessThanEstimate");
var PasswordsDontMatchError = exports.PasswordsDontMatchError = (0, _helpers.createCustomErrorClass)("PasswordsDontMatch");
var PasswordIncorrectError = exports.PasswordIncorrectError = (0, _helpers.createCustomErrorClass)("PasswordIncorrect");
var TimeoutTagged = exports.TimeoutTagged = (0, _helpers.createCustomErrorClass)("TimeoutTagged");
var UnexpectedBootloader = exports.UnexpectedBootloader = (0, _helpers.createCustomErrorClass)("UnexpectedBootloader");
var MCUNotGenuineToDashboard = exports.MCUNotGenuineToDashboard = (0, _helpers.createCustomErrorClass)("MCUNotGenuineToDashboard");
var RecipientRequired = exports.RecipientRequired = (0, _helpers.createCustomErrorClass)("RecipientRequired");
var UnavailableTezosOriginatedAccountReceive = exports.UnavailableTezosOriginatedAccountReceive = (0, _helpers.createCustomErrorClass)("UnavailableTezosOriginatedAccountReceive");
var UnavailableTezosOriginatedAccountSend = exports.UnavailableTezosOriginatedAccountSend = (0, _helpers.createCustomErrorClass)("UnavailableTezosOriginatedAccountSend");
var UpdateYourApp = exports.UpdateYourApp = (0, _helpers.createCustomErrorClass)("UpdateYourApp");
var UserRefusedDeviceNameChange = exports.UserRefusedDeviceNameChange = (0, _helpers.createCustomErrorClass)("UserRefusedDeviceNameChange");
var UserRefusedAddress = exports.UserRefusedAddress = (0, _helpers.createCustomErrorClass)("UserRefusedAddress");
var UserRefusedFirmwareUpdate = exports.UserRefusedFirmwareUpdate = (0, _helpers.createCustomErrorClass)("UserRefusedFirmwareUpdate");
var UserRefusedAllowManager = exports.UserRefusedAllowManager = (0, _helpers.createCustomErrorClass)("UserRefusedAllowManager");
var UserRefusedOnDevice = exports.UserRefusedOnDevice = (0, _helpers.createCustomErrorClass)("UserRefusedOnDevice"); // TODO rename because it's just for transaction refusal
var TransportOpenUserCancelled = exports.TransportOpenUserCancelled = (0, _helpers.createCustomErrorClass)("TransportOpenUserCancelled");
var TransportInterfaceNotAvailable = exports.TransportInterfaceNotAvailable = (0, _helpers.createCustomErrorClass)("TransportInterfaceNotAvailable");
var TransportWebUSBGestureRequired = exports.TransportWebUSBGestureRequired = (0, _helpers.createCustomErrorClass)("TransportWebUSBGestureRequired");
var DeviceShouldStayInApp = exports.DeviceShouldStayInApp = (0, _helpers.createCustomErrorClass)("DeviceShouldStayInApp");
var WebsocketConnectionError = exports.WebsocketConnectionError = (0, _helpers.createCustomErrorClass)("WebsocketConnectionError");
var WebsocketConnectionFailed = exports.WebsocketConnectionFailed = (0, _helpers.createCustomErrorClass)("WebsocketConnectionFailed");
var WrongDeviceForAccount = exports.WrongDeviceForAccount = (0, _helpers.createCustomErrorClass)("WrongDeviceForAccount");
var WrongAppForCurrency = exports.WrongAppForCurrency = (0, _helpers.createCustomErrorClass)("WrongAppForCurrency");
var ETHAddressNonEIP = exports.ETHAddressNonEIP = (0, _helpers.createCustomErrorClass)("ETHAddressNonEIP");
var CantScanQRCode = exports.CantScanQRCode = (0, _helpers.createCustomErrorClass)("CantScanQRCode");
var FeeNotLoaded = exports.FeeNotLoaded = (0, _helpers.createCustomErrorClass)("FeeNotLoaded");
var FeeRequired = exports.FeeRequired = (0, _helpers.createCustomErrorClass)("FeeRequired");
var FeeTooHigh = exports.FeeTooHigh = (0, _helpers.createCustomErrorClass)("FeeTooHigh");
var SyncError = exports.SyncError = (0, _helpers.createCustomErrorClass)("SyncError");
var PairingFailed = exports.PairingFailed = (0, _helpers.createCustomErrorClass)("PairingFailed");
var GenuineCheckFailed = exports.GenuineCheckFailed = (0, _helpers.createCustomErrorClass)("GenuineCheckFailed");
var LedgerAPI4xx = exports.LedgerAPI4xx = (0, _helpers.createCustomErrorClass)("LedgerAPI4xx");
var LedgerAPI5xx = exports.LedgerAPI5xx = (0, _helpers.createCustomErrorClass)("LedgerAPI5xx");
var FirmwareOrAppUpdateRequired = exports.FirmwareOrAppUpdateRequired = (0, _helpers.createCustomErrorClass)("FirmwareOrAppUpdateRequired");
const AccountNameRequiredError = (0, _helpers.createCustomErrorClass)("AccountNameRequired");
exports.AccountNameRequiredError = AccountNameRequiredError;
const AccountNotSupported = (0, _helpers.createCustomErrorClass)("AccountNotSupported");
exports.AccountNotSupported = AccountNotSupported;
const AmountRequired = (0, _helpers.createCustomErrorClass)("AmountRequired");
exports.AmountRequired = AmountRequired;
const BluetoothRequired = (0, _helpers.createCustomErrorClass)("BluetoothRequired");
exports.BluetoothRequired = BluetoothRequired;
const BtcUnmatchedApp = (0, _helpers.createCustomErrorClass)("BtcUnmatchedApp");
exports.BtcUnmatchedApp = BtcUnmatchedApp;
const CantOpenDevice = (0, _helpers.createCustomErrorClass)("CantOpenDevice");
exports.CantOpenDevice = CantOpenDevice;
const CashAddrNotSupported = (0, _helpers.createCustomErrorClass)("CashAddrNotSupported");
exports.CashAddrNotSupported = CashAddrNotSupported;
const CurrencyNotSupported = (0, _helpers.createCustomErrorClass)("CurrencyNotSupported");
exports.CurrencyNotSupported = CurrencyNotSupported;
const DeviceAppVerifyNotSupported = (0, _helpers.createCustomErrorClass)("DeviceAppVerifyNotSupported");
exports.DeviceAppVerifyNotSupported = DeviceAppVerifyNotSupported;
const DeviceGenuineSocketEarlyClose = (0, _helpers.createCustomErrorClass)("DeviceGenuineSocketEarlyClose");
exports.DeviceGenuineSocketEarlyClose = DeviceGenuineSocketEarlyClose;
const DeviceNotGenuineError = (0, _helpers.createCustomErrorClass)("DeviceNotGenuine");
exports.DeviceNotGenuineError = DeviceNotGenuineError;
const DeviceOnDashboardExpected = (0, _helpers.createCustomErrorClass)("DeviceOnDashboardExpected");
exports.DeviceOnDashboardExpected = DeviceOnDashboardExpected;
const DeviceOnDashboardUnexpected = (0, _helpers.createCustomErrorClass)("DeviceOnDashboardUnexpected");
exports.DeviceOnDashboardUnexpected = DeviceOnDashboardUnexpected;
const DeviceInOSUExpected = (0, _helpers.createCustomErrorClass)("DeviceInOSUExpected");
exports.DeviceInOSUExpected = DeviceInOSUExpected;
const DeviceHalted = (0, _helpers.createCustomErrorClass)("DeviceHalted");
exports.DeviceHalted = DeviceHalted;
const DeviceNameInvalid = (0, _helpers.createCustomErrorClass)("DeviceNameInvalid");
exports.DeviceNameInvalid = DeviceNameInvalid;
const DeviceSocketFail = (0, _helpers.createCustomErrorClass)("DeviceSocketFail");
exports.DeviceSocketFail = DeviceSocketFail;
const DeviceSocketNoBulkStatus = (0, _helpers.createCustomErrorClass)("DeviceSocketNoBulkStatus");
exports.DeviceSocketNoBulkStatus = DeviceSocketNoBulkStatus;
const DisconnectedDevice = (0, _helpers.createCustomErrorClass)("DisconnectedDevice");
exports.DisconnectedDevice = DisconnectedDevice;
const DisconnectedDeviceDuringOperation = (0, _helpers.createCustomErrorClass)("DisconnectedDeviceDuringOperation");
exports.DisconnectedDeviceDuringOperation = DisconnectedDeviceDuringOperation;
const EnpointConfigError = (0, _helpers.createCustomErrorClass)("EnpointConfig");
exports.EnpointConfigError = EnpointConfigError;
const EthAppPleaseEnableContractData = (0, _helpers.createCustomErrorClass)("EthAppPleaseEnableContractData");
exports.EthAppPleaseEnableContractData = EthAppPleaseEnableContractData;
const FeeEstimationFailed = (0, _helpers.createCustomErrorClass)("FeeEstimationFailed");
exports.FeeEstimationFailed = FeeEstimationFailed;
const HardResetFail = (0, _helpers.createCustomErrorClass)("HardResetFail");
exports.HardResetFail = HardResetFail;
const InvalidXRPTag = (0, _helpers.createCustomErrorClass)("InvalidXRPTag");
exports.InvalidXRPTag = InvalidXRPTag;
const InvalidAddress = (0, _helpers.createCustomErrorClass)("InvalidAddress");
exports.InvalidAddress = InvalidAddress;
const InvalidAddressBecauseDestinationIsAlsoSource = (0, _helpers.createCustomErrorClass)("InvalidAddressBecauseDestinationIsAlsoSource");
exports.InvalidAddressBecauseDestinationIsAlsoSource = InvalidAddressBecauseDestinationIsAlsoSource;
const LatestMCUInstalledError = (0, _helpers.createCustomErrorClass)("LatestMCUInstalledError");
exports.LatestMCUInstalledError = LatestMCUInstalledError;
const UnknownMCU = (0, _helpers.createCustomErrorClass)("UnknownMCU");
exports.UnknownMCU = UnknownMCU;
const LedgerAPIError = (0, _helpers.createCustomErrorClass)("LedgerAPIError");
exports.LedgerAPIError = LedgerAPIError;
const LedgerAPIErrorWithMessage = (0, _helpers.createCustomErrorClass)("LedgerAPIErrorWithMessage");
exports.LedgerAPIErrorWithMessage = LedgerAPIErrorWithMessage;
const LedgerAPINotAvailable = (0, _helpers.createCustomErrorClass)("LedgerAPINotAvailable");
exports.LedgerAPINotAvailable = LedgerAPINotAvailable;
const ManagerAppAlreadyInstalledError = (0, _helpers.createCustomErrorClass)("ManagerAppAlreadyInstalled");
exports.ManagerAppAlreadyInstalledError = ManagerAppAlreadyInstalledError;
const ManagerAppRelyOnBTCError = (0, _helpers.createCustomErrorClass)("ManagerAppRelyOnBTC");
exports.ManagerAppRelyOnBTCError = ManagerAppRelyOnBTCError;
const ManagerAppDepInstallRequired = (0, _helpers.createCustomErrorClass)("ManagerAppDepInstallRequired");
exports.ManagerAppDepInstallRequired = ManagerAppDepInstallRequired;
const ManagerAppDepUninstallRequired = (0, _helpers.createCustomErrorClass)("ManagerAppDepUninstallRequired");
exports.ManagerAppDepUninstallRequired = ManagerAppDepUninstallRequired;
const ManagerDeviceLockedError = (0, _helpers.createCustomErrorClass)("ManagerDeviceLocked");
exports.ManagerDeviceLockedError = ManagerDeviceLockedError;
const ManagerFirmwareNotEnoughSpaceError = (0, _helpers.createCustomErrorClass)("ManagerFirmwareNotEnoughSpace");
exports.ManagerFirmwareNotEnoughSpaceError = ManagerFirmwareNotEnoughSpaceError;
const ManagerNotEnoughSpaceError = (0, _helpers.createCustomErrorClass)("ManagerNotEnoughSpace");
exports.ManagerNotEnoughSpaceError = ManagerNotEnoughSpaceError;
const ManagerUninstallBTCDep = (0, _helpers.createCustomErrorClass)("ManagerUninstallBTCDep");
exports.ManagerUninstallBTCDep = ManagerUninstallBTCDep;
const NetworkDown = (0, _helpers.createCustomErrorClass)("NetworkDown");
exports.NetworkDown = NetworkDown;
const NoAddressesFound = (0, _helpers.createCustomErrorClass)("NoAddressesFound");
exports.NoAddressesFound = NoAddressesFound;
const NotEnoughBalance = (0, _helpers.createCustomErrorClass)("NotEnoughBalance");
exports.NotEnoughBalance = NotEnoughBalance;
const NotEnoughBalanceToDelegate = (0, _helpers.createCustomErrorClass)("NotEnoughBalanceToDelegate");
exports.NotEnoughBalanceToDelegate = NotEnoughBalanceToDelegate;
const NotEnoughBalanceInParentAccount = (0, _helpers.createCustomErrorClass)("NotEnoughBalanceInParentAccount");
exports.NotEnoughBalanceInParentAccount = NotEnoughBalanceInParentAccount;
const NotEnoughSpendableBalance = (0, _helpers.createCustomErrorClass)("NotEnoughSpendableBalance");
exports.NotEnoughSpendableBalance = NotEnoughSpendableBalance;
const NotEnoughBalanceBecauseDestinationNotCreated = (0, _helpers.createCustomErrorClass)("NotEnoughBalanceBecauseDestinationNotCreated");
exports.NotEnoughBalanceBecauseDestinationNotCreated = NotEnoughBalanceBecauseDestinationNotCreated;
const NoAccessToCamera = (0, _helpers.createCustomErrorClass)("NoAccessToCamera");
exports.NoAccessToCamera = NoAccessToCamera;
const NotEnoughGas = (0, _helpers.createCustomErrorClass)("NotEnoughGas");
exports.NotEnoughGas = NotEnoughGas;
const GasLessThanEstimate = (0, _helpers.createCustomErrorClass)("GasLessThanEstimate");
exports.GasLessThanEstimate = GasLessThanEstimate;
const PasswordsDontMatchError = (0, _helpers.createCustomErrorClass)("PasswordsDontMatch");
exports.PasswordsDontMatchError = PasswordsDontMatchError;
const PasswordIncorrectError = (0, _helpers.createCustomErrorClass)("PasswordIncorrect");
exports.PasswordIncorrectError = PasswordIncorrectError;
const TimeoutTagged = (0, _helpers.createCustomErrorClass)("TimeoutTagged");
exports.TimeoutTagged = TimeoutTagged;
const UnexpectedBootloader = (0, _helpers.createCustomErrorClass)("UnexpectedBootloader");
exports.UnexpectedBootloader = UnexpectedBootloader;
const MCUNotGenuineToDashboard = (0, _helpers.createCustomErrorClass)("MCUNotGenuineToDashboard");
exports.MCUNotGenuineToDashboard = MCUNotGenuineToDashboard;
const RecipientRequired = (0, _helpers.createCustomErrorClass)("RecipientRequired");
exports.RecipientRequired = RecipientRequired;
const UnavailableTezosOriginatedAccountReceive = (0, _helpers.createCustomErrorClass)("UnavailableTezosOriginatedAccountReceive");
exports.UnavailableTezosOriginatedAccountReceive = UnavailableTezosOriginatedAccountReceive;
const UnavailableTezosOriginatedAccountSend = (0, _helpers.createCustomErrorClass)("UnavailableTezosOriginatedAccountSend");
exports.UnavailableTezosOriginatedAccountSend = UnavailableTezosOriginatedAccountSend;
const UpdateYourApp = (0, _helpers.createCustomErrorClass)("UpdateYourApp");
exports.UpdateYourApp = UpdateYourApp;
const UserRefusedDeviceNameChange = (0, _helpers.createCustomErrorClass)("UserRefusedDeviceNameChange");
exports.UserRefusedDeviceNameChange = UserRefusedDeviceNameChange;
const UserRefusedAddress = (0, _helpers.createCustomErrorClass)("UserRefusedAddress");
exports.UserRefusedAddress = UserRefusedAddress;
const UserRefusedFirmwareUpdate = (0, _helpers.createCustomErrorClass)("UserRefusedFirmwareUpdate");
exports.UserRefusedFirmwareUpdate = UserRefusedFirmwareUpdate;
const UserRefusedAllowManager = (0, _helpers.createCustomErrorClass)("UserRefusedAllowManager");
exports.UserRefusedAllowManager = UserRefusedAllowManager;
const UserRefusedOnDevice = (0, _helpers.createCustomErrorClass)("UserRefusedOnDevice"); // TODO rename because it's just for transaction refusal
// db stuff, no need to translate
var NoDBPathGiven = exports.NoDBPathGiven = (0, _helpers.createCustomErrorClass)("NoDBPathGiven");
var DBWrongPassword = exports.DBWrongPassword = (0, _helpers.createCustomErrorClass)("DBWrongPassword");
var DBNotReset = exports.DBNotReset = (0, _helpers.createCustomErrorClass)("DBNotReset");
exports.UserRefusedOnDevice = UserRefusedOnDevice;
const TransportOpenUserCancelled = (0, _helpers.createCustomErrorClass)("TransportOpenUserCancelled");
exports.TransportOpenUserCancelled = TransportOpenUserCancelled;
const TransportInterfaceNotAvailable = (0, _helpers.createCustomErrorClass)("TransportInterfaceNotAvailable");
exports.TransportInterfaceNotAvailable = TransportInterfaceNotAvailable;
const TransportWebUSBGestureRequired = (0, _helpers.createCustomErrorClass)("TransportWebUSBGestureRequired");
exports.TransportWebUSBGestureRequired = TransportWebUSBGestureRequired;
const DeviceShouldStayInApp = (0, _helpers.createCustomErrorClass)("DeviceShouldStayInApp");
exports.DeviceShouldStayInApp = DeviceShouldStayInApp;
const WebsocketConnectionError = (0, _helpers.createCustomErrorClass)("WebsocketConnectionError");
exports.WebsocketConnectionError = WebsocketConnectionError;
const WebsocketConnectionFailed = (0, _helpers.createCustomErrorClass)("WebsocketConnectionFailed");
exports.WebsocketConnectionFailed = WebsocketConnectionFailed;
const WrongDeviceForAccount = (0, _helpers.createCustomErrorClass)("WrongDeviceForAccount");
exports.WrongDeviceForAccount = WrongDeviceForAccount;
const WrongAppForCurrency = (0, _helpers.createCustomErrorClass)("WrongAppForCurrency");
exports.WrongAppForCurrency = WrongAppForCurrency;
const ETHAddressNonEIP = (0, _helpers.createCustomErrorClass)("ETHAddressNonEIP");
exports.ETHAddressNonEIP = ETHAddressNonEIP;
const CantScanQRCode = (0, _helpers.createCustomErrorClass)("CantScanQRCode");
exports.CantScanQRCode = CantScanQRCode;
const FeeNotLoaded = (0, _helpers.createCustomErrorClass)("FeeNotLoaded");
exports.FeeNotLoaded = FeeNotLoaded;
const FeeRequired = (0, _helpers.createCustomErrorClass)("FeeRequired");
exports.FeeRequired = FeeRequired;
const FeeTooHigh = (0, _helpers.createCustomErrorClass)("FeeTooHigh");
exports.FeeTooHigh = FeeTooHigh;
const SyncError = (0, _helpers.createCustomErrorClass)("SyncError");
exports.SyncError = SyncError;
const PairingFailed = (0, _helpers.createCustomErrorClass)("PairingFailed");
exports.PairingFailed = PairingFailed;
const GenuineCheckFailed = (0, _helpers.createCustomErrorClass)("GenuineCheckFailed");
exports.GenuineCheckFailed = GenuineCheckFailed;
const LedgerAPI4xx = (0, _helpers.createCustomErrorClass)("LedgerAPI4xx");
exports.LedgerAPI4xx = LedgerAPI4xx;
const LedgerAPI5xx = (0, _helpers.createCustomErrorClass)("LedgerAPI5xx");
exports.LedgerAPI5xx = LedgerAPI5xx;
const FirmwareOrAppUpdateRequired = (0, _helpers.createCustomErrorClass)("FirmwareOrAppUpdateRequired"); // db stuff, no need to translate
exports.FirmwareOrAppUpdateRequired = FirmwareOrAppUpdateRequired;
const NoDBPathGiven = (0, _helpers.createCustomErrorClass)("NoDBPathGiven");
exports.NoDBPathGiven = NoDBPathGiven;
const DBWrongPassword = (0, _helpers.createCustomErrorClass)("DBWrongPassword");
exports.DBWrongPassword = DBWrongPassword;
const DBNotReset = (0, _helpers.createCustomErrorClass)("DBNotReset");
/**

@@ -111,2 +215,5 @@ * TransportError is used for any generic transport errors.

*/
exports.DBNotReset = DBNotReset;
function TransportError(message, id) {

@@ -117,11 +224,8 @@ this.name = "TransportError";

this.id = id;
}
//$FlowFixMe
TransportError.prototype = new Error();
} //$FlowFixMe
(0, _helpers.addCustomErrorDeserializer)("TransportError", function (e) {
return new TransportError(e.message, e.id);
});
var StatusCodes = exports.StatusCodes = {
TransportError.prototype = new Error();
(0, _helpers.addCustomErrorDeserializer)("TransportError", e => new TransportError(e.message, e.id));
const StatusCodes = {
PIN_REMAINING_ATTEMPTS: 0x63c0,

@@ -158,2 +262,3 @@ INCORRECT_LENGTH: 0x6700,

};
exports.StatusCodes = StatusCodes;

@@ -165,11 +270,16 @@ function getAltStatusMessage(code) {

return "Incorrect length";
case 0x6982:
return "Security not satisfied (dongle locked or have invalid access rights)";
case 0x6985:
return "Condition of use not satisfied (denied by the user?)";
case 0x6a80:
return "Invalid data received";
case 0x6b00:
return "Invalid parameter received";
}
if (0x6f00 <= code && code <= 0x6fff) {

@@ -179,3 +289,2 @@ return "Internal error, please report";

}
/**

@@ -185,20 +294,18 @@ * Error thrown when a device returned a non success status.

*/
function TransportStatusError(statusCode) {
this.name = "TransportStatusError";
var statusText = Object.keys(StatusCodes).find(function (k) {
return StatusCodes[k] === statusCode;
}) || "UNKNOWN_ERROR";
var smsg = getAltStatusMessage(statusCode) || statusText;
var statusCodeStr = statusCode.toString(16);
this.message = "Ledger device: " + smsg + " (0x" + statusCodeStr + ")";
const statusText = Object.keys(StatusCodes).find(k => StatusCodes[k] === statusCode) || "UNKNOWN_ERROR";
const smsg = getAltStatusMessage(statusCode) || statusText;
const statusCodeStr = statusCode.toString(16);
this.message = `Ledger device: ${smsg} (0x${statusCodeStr})`;
this.stack = new Error().stack;
this.statusCode = statusCode;
this.statusText = statusText;
}
//$FlowFixMe
} //$FlowFixMe
TransportStatusError.prototype = new Error();
(0, _helpers.addCustomErrorDeserializer)("TransportStatusError", function (e) {
return new TransportStatusError(e.statusCode);
});
(0, _helpers.addCustomErrorDeserializer)("TransportStatusError", e => new TransportStatusError(e.statusCode));
//# sourceMappingURL=index.js.map
{
"name": "@ledgerhq/errors",
"version": "4.74.2",
"version": "5.0.0-alpha.3+0b49d08",
"description": "Ledger common errors",

@@ -31,3 +31,3 @@ "keywords": [

},
"gitHead": "5f74b291e1bfd836d23a829a5948f7273af16359"
"gitHead": "0b49d08dedc19562fefbd2148292cc0995a0d4ae"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc