@radixdlt/hardware-ledger
Version:
Ledger Nano hardware wallet connection
30 lines • 2.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.radixCLA = exports.prettifyLedgerResponseCode = exports.LedgerResponseCodes = exports.LedgerInstruction = void 0;
var LedgerInstruction;
(function (LedgerInstruction) {
LedgerInstruction[LedgerInstruction["GET_VERSION"] = 3] = "GET_VERSION";
LedgerInstruction[LedgerInstruction["GET_APP_NAME"] = 4] = "GET_APP_NAME";
LedgerInstruction[LedgerInstruction["GET_PUBLIC_KEY"] = 5] = "GET_PUBLIC_KEY";
LedgerInstruction[LedgerInstruction["DO_SIGN_TX"] = 6] = "DO_SIGN_TX";
LedgerInstruction[LedgerInstruction["DO_SIGN_HASH"] = 7] = "DO_SIGN_HASH";
LedgerInstruction[LedgerInstruction["DO_KEY_EXCHANGE"] = 8] = "DO_KEY_EXCHANGE";
})(LedgerInstruction = exports.LedgerInstruction || (exports.LedgerInstruction = {}));
/// Keep in sync with: https://github.com/radixdlt/app-radix/blob/main/src/sw.h
var LedgerResponseCodes;
(function (LedgerResponseCodes) {
LedgerResponseCodes[LedgerResponseCodes["ERR_CMD_SIGN_TX_UNSUPPORTED_INSTRUCTION_TYPE"] = 50696] = "ERR_CMD_SIGN_TX_UNSUPPORTED_INSTRUCTION_TYPE";
LedgerResponseCodes[LedgerResponseCodes["ERR_COMMON_BAD_STATE"] = 57345] = "ERR_COMMON_BAD_STATE";
LedgerResponseCodes[LedgerResponseCodes["ERR_ASSERTION_FAILED"] = 57346] = "ERR_ASSERTION_FAILED";
LedgerResponseCodes[LedgerResponseCodes["ERR_FATAL_ERROR"] = 57347] = "ERR_FATAL_ERROR";
LedgerResponseCodes[LedgerResponseCodes["SW_DENY"] = 27013] = "SW_DENY";
LedgerResponseCodes[LedgerResponseCodes["SW_WRONG_P1P2"] = 27270] = "SW_WRONG_P1P2";
LedgerResponseCodes[LedgerResponseCodes["SW_WRONG_DATA_LENGTH"] = 27271] = "SW_WRONG_DATA_LENGTH";
LedgerResponseCodes[LedgerResponseCodes["SW_INS_NOT_SUPPORTED"] = 27904] = "SW_INS_NOT_SUPPORTED";
LedgerResponseCodes[LedgerResponseCodes["SW_CLA_NOT_SUPPORTED"] = 28160] = "SW_CLA_NOT_SUPPORTED";
LedgerResponseCodes[LedgerResponseCodes["SW_OK"] = 36864] = "SW_OK";
})(LedgerResponseCodes = exports.LedgerResponseCodes || (exports.LedgerResponseCodes = {}));
const prettifyLedgerResponseCode = (code) => `${code === LedgerResponseCodes.SW_OK ? '✅' : '❌'} code: '${LedgerResponseCodes[code]}' 0x${code.toString(16)} (0d${code.toString(10)})`;
exports.prettifyLedgerResponseCode = prettifyLedgerResponseCode;
exports.radixCLA = 0xaa;
//# sourceMappingURL=_types.js.map