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

@cardano-foundation/ledgerjs-hw-app-cardano

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cardano-foundation/ledgerjs-hw-app-cardano - npm Package Compare versions

Comparing version 1.0.8 to 2.0.0

lib/cardano.js

848

lib/Ada.js

@@ -16,4 +16,12 @@ "use strict";

});
exports["default"] = exports.getErrorDescription = exports.ErrorCodes = void 0;
Object.defineProperty(exports, "cardano", {
enumerable: true,
get: function get() {
return _cardano["default"];
}
});
exports["default"] = exports.getErrorDescription = exports.ErrorCodes = exports.AddressTypeNibbles = void 0;
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));

@@ -35,2 +43,4 @@

var _cardano = _interopRequireDefault(require("./cardano"));
var _ErrorMsgs;

@@ -47,8 +57,24 @@

GET_VERSION: 0x00,
GET_SERIAL: 0x01,
GET_EXT_PUBLIC_KEY: 0x10,
DERIVE_ADDRESS: 0x11,
ATTEST_UTXO: 0x20,
SIGN_TX: 0x21,
RUN_TESTS: 0xf0
};
var AddressTypeNibbles = {
BASE: 0,
POINTER: 4,
ENTERPRISE: 6,
BYRON: 8,
REWARD: 14
};
exports.AddressTypeNibbles = AddressTypeNibbles;
var MetadataCodes = {
SIGN_TX_METADATA_NO: 1,
SIGN_TX_METADATA_YES: 2
};
var TxOutputTypeCodes = {
SIGN_TX_OUTPUT_TYPE_ADDRESS: 1,
SIGN_TX_OUTPUT_TYPE_ADDRESS_PARAMS: 2
};
var ErrorCodes = {

@@ -62,2 +88,3 @@ ERR_STILL_IN_CALL: 0x6e04,

ERR_DEVICE_LOCKED: 0x6e11,
ERR_UNSUPPORTED_ADDRESS_TYPE: 0x6e12,
// Not thrown by ledger-app-cardano itself but other apps

@@ -68,3 +95,3 @@ ERR_CLA_NOT_SUPPORTED: 0x6e00

var GH_ERRORS_LINK = "https://github.com/cardano-foundation/ledger-app-cardano/blob/master/src/errors.h";
var ErrorMsgs = (_ErrorMsgs = {}, (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_INVALID_DATA, "Invalid data supplied to Ledger"), (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_INVALID_BIP_PATH, "Invalid derivation path supplied to Ledger"), (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_REJECTED_BY_USER, "Action rejected by user"), (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_REJECTED_BY_POLICY, "Action rejected by Ledger's security policy"), (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_DEVICE_LOCKED, "Device is locked"), (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_CLA_NOT_SUPPORTED, "Wrong Ledger app"), _ErrorMsgs);
var ErrorMsgs = (_ErrorMsgs = {}, (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_INVALID_DATA, "Invalid data supplied to Ledger"), (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_INVALID_BIP_PATH, "Invalid derivation path supplied to Ledger"), (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_REJECTED_BY_USER, "Action rejected by user"), (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_REJECTED_BY_POLICY, "Action rejected by Ledger's security policy"), (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_DEVICE_LOCKED, "Device is locked"), (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_CLA_NOT_SUPPORTED, "Wrong Ledger app"), (0, _defineProperty2["default"])(_ErrorMsgs, ErrorCodes.ERR_UNSUPPORTED_ADDRESS_TYPE, "Unsupported address type"), _ErrorMsgs);

@@ -175,22 +202,11 @@ var getErrorDescription = function getErrorDescription(statusCode) {

this.transport = transport;
this.methods = ["getVersion", "getExtendedPublicKey", "signTransaction", "deriveAddress", "showAddress"];
this.methods = ["getVersion", "getSerial", "getExtendedPublicKey", "signTransaction", "deriveAddress", "showAddress"];
this.transport.decorateAppAPIMethods(this, this.methods, scrambleKey);
this.send = wrapConvertError(this.transport.send);
}
/**
* Returns an object containing the app version.
*
* @returns {Promise<GetVersionResponse>} Result object containing the application version number.
*
* @example
* const { major, minor, patch, flags } = await ada.getVersion();
* console.log(`App version ${major}.${minor}.${patch}`);
*
*/
(0, _createClass2["default"])(Ada, [{
key: "getVersion",
key: "_getVersion",
value: function () {
var _getVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
var _getVersion2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
var _this = this;

@@ -239,18 +255,23 @@

function getVersion() {
return _getVersion.apply(this, arguments);
function _getVersion() {
return _getVersion2.apply(this, arguments);
}
return getVersion;
return _getVersion;
}()
/**
* Runs unit tests on the device (DEVEL app build only)
* Returns an object containing the app version.
*
* @returns {Promise<void>}
* @returns {Promise<GetVersionResponse>} Result object containing the application version number.
*
* @example
* const { major, minor, patch, flags } = await ada.getVersion();
* console.log(`App version ${major}.${minor}.${patch}`);
*
*/
}, {
key: "runTests",
key: "getVersion",
value: function () {
var _runTests = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
var _getVersion3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
return _regenerator["default"].wrap(function _callee4$(_context4) {

@@ -260,6 +281,5 @@ while (1) {

case 0:
_context4.next = 2;
return wrapRetryStillInCall(this.send)(CLA, INS.RUN_TESTS, 0x00, 0x00);
return _context4.abrupt("return", this._getVersion());
case 2:
case 1:
case "end":

@@ -272,15 +292,42 @@ return _context4.stop();

function runTests() {
return _runTests.apply(this, arguments);
function getVersion() {
return _getVersion3.apply(this, arguments);
}
return runTests;
return getVersion;
}()
}, {
key: "_attestUtxo",
key: "_isGetSerialSupported",
value: function _isGetSerialSupported(version) {
var major = parseInt(version.major);
var minor = parseInt(version.minor);
var patch = parseInt(version.patch);
if (isNaN(major) || isNaN(minor) || isNaN(patch)) return false;
if (major > 1) {
return true;
} else if (major == 1) {
return minor >= 2;
} else {
return false;
}
}
/**
* Returns an object containing the device serial number.
*
* @returns {Promise<GetSerialResponse>} Result object containing the device serial number.
*
* @example
* const { serial } = await ada.getSerial();
* console.log(`Serial number ${serial}`);
*
*/
}, {
key: "getSerial",
value: function () {
var _attestUtxo2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(txDataHex, outputIndex) {
var _getSerial = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
var _this2 = this;
var _send, P1_INIT, P1_CONTINUE, P2_UNUSED, CHUNK_SIZE, data, result, txData, i, chunk, _result, _chunk, _result2, sum, sizes, _utils$chunkBy, _utils$chunkBy2, txHash, outputNumber, amount, hmac;
var version, _send, P1_UNUSED, P2_UNUSED, response, serial;

@@ -291,76 +338,36 @@ return _regenerator["default"].wrap(function _callee5$(_context5) {

case 0:
_utils.Precondition.checkIsHexString(txDataHex);
_context5.next = 2;
return this._getVersion();
_utils.Precondition.checkIsUint32(outputIndex);
case 2:
version = _context5.sent;
if (this._isGetSerialSupported(version)) {
_context5.next = 5;
break;
}
throw new Error("getSerial not supported by device firmware");
case 5:
_send = function _send(p1, p2, data) {
return _this2.send(CLA, INS.ATTEST_UTXO, p1, p2, data).then(_utils["default"].stripRetcodeFromResponse);
return _this2.send(CLA, INS.GET_SERIAL, p1, p2, data).then(_utils["default"].stripRetcodeFromResponse);
};
P1_INIT = 0x01;
P1_CONTINUE = 0x02;
P2_UNUSED = 0x00; // Note: U2F transport does not like APDU length longer than 255
// so we are leaving it some space
CHUNK_SIZE = 245;
// Initial request
data = _utils["default"].uint32_to_buf(outputIndex);
P1_UNUSED = 0x00;
P2_UNUSED = 0x00;
_context5.next = 10;
return wrapRetryStillInCall(_send)(P1_INIT, P2_UNUSED, data);
return wrapRetryStillInCall(_send)(P1_UNUSED, P2_UNUSED, _utils["default"].hex_to_buf(""));
case 10:
result = _context5.sent;
response = _context5.sent;
_utils.Assert.assert(result.length == 0);
_utils.Assert.assert(response.length == 7);
txData = _utils["default"].hex_to_buf(txDataHex);
i = 0;
case 14:
if (!(i + CHUNK_SIZE < txData.length)) {
_context5.next = 23;
break;
}
chunk = txData.slice(i, i + CHUNK_SIZE);
_context5.next = 18;
return _send(P1_CONTINUE, P2_UNUSED, chunk);
case 18:
_result = _context5.sent;
_utils.Assert.assert(_result.length == 0);
i += CHUNK_SIZE;
_context5.next = 14;
break;
case 23:
_chunk = txData.slice(i);
_context5.next = 26;
return _send(P1_CONTINUE, P2_UNUSED, _chunk);
case 26:
_result2 = _context5.sent;
sum = function sum(arr) {
return arr.reduce(function (x, y) {
return x + y;
}, 0);
};
sizes = [32, 4, 8, 16];
_utils.Assert.assert(_result2.length == sum(sizes));
_utils$chunkBy = _utils["default"].chunkBy(_result2, sizes), _utils$chunkBy2 = (0, _slicedToArray2["default"])(_utils$chunkBy, 4), txHash = _utils$chunkBy2[0], outputNumber = _utils$chunkBy2[1], amount = _utils$chunkBy2[2], hmac = _utils$chunkBy2[3];
serial = _utils["default"].buf_to_hex(response);
return _context5.abrupt("return", {
rawBuffer: _result2,
txHashHex: _utils["default"].buf_to_hex(txHash),
outputIndex: _utils["default"].buf_to_uint32(outputNumber),
amountStr: _utils["default"].buf_to_amount(amount),
hmacHex: _utils["default"].buf_to_hex(hmac)
serial: serial
});
case 32:
case 14:
case "end":

@@ -370,21 +377,21 @@ return _context5.stop();

}
}, _callee5);
}, _callee5, this);
}));
function _attestUtxo(_x, _x2) {
return _attestUtxo2.apply(this, arguments);
function getSerial() {
return _getSerial.apply(this, arguments);
}
return _attestUtxo;
return getSerial;
}()
/**
* @param string Raw transaction data (without witnesses) encoded as hex string
* @param number Output indes
* Runs unit tests on the device (DEVEL app build only)
*
* @returns {Promise<void>}
*/
}, {
key: "attestUtxo",
key: "runTests",
value: function () {
var _attestUtxo3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(txDataHex, outputIndex) {
var _runTests = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
return _regenerator["default"].wrap(function _callee6$(_context6) {

@@ -394,5 +401,6 @@ while (1) {

case 0:
return _context6.abrupt("return", this._attestUtxo(txDataHex, outputIndex));
_context6.next = 2;
return wrapRetryStillInCall(this.send)(CLA, INS.RUN_TESTS, 0x00, 0x00);
case 1:
case 2:
case "end":

@@ -405,7 +413,7 @@ return _context6.stop();

function attestUtxo(_x3, _x4) {
return _attestUtxo3.apply(this, arguments);
function runTests() {
return _runTests.apply(this, arguments);
}
return attestUtxo;
return runTests;
}()

@@ -430,3 +438,3 @@ /**

var _send, P1_UNUSED, P2_UNUSED, data, response, _utils$chunkBy3, _utils$chunkBy4, publicKey, chainCode, rest;
var _send, P1_UNUSED, P2_UNUSED, data, response, _utils$chunkBy, _utils$chunkBy2, publicKey, chainCode, rest;

@@ -451,3 +459,3 @@ return _regenerator["default"].wrap(function _callee7$(_context7) {

response = _context7.sent;
_utils$chunkBy3 = _utils["default"].chunkBy(response, [32, 32]), _utils$chunkBy4 = (0, _slicedToArray2["default"])(_utils$chunkBy3, 3), publicKey = _utils$chunkBy4[0], chainCode = _utils$chunkBy4[1], rest = _utils$chunkBy4[2];
_utils$chunkBy = _utils["default"].chunkBy(response, [32, 32]), _utils$chunkBy2 = (0, _slicedToArray2["default"])(_utils$chunkBy, 3), publicKey = _utils$chunkBy2[0], chainCode = _utils$chunkBy2[1], rest = _utils$chunkBy2[2];

@@ -469,3 +477,3 @@ _utils.Assert.assert(rest.length == 0);

function getExtendedPublicKey(_x5) {
function getExtendedPublicKey(_x) {
return _getExtendedPublicKey.apply(this, arguments);

@@ -486,5 +494,24 @@ }

*
* TODO update error codes
*
* @example
* const { address } = await ada.deriveAddress([ HARDENED + 44, HARDENED + 1815, HARDENED + 1, 0, 5 ]);
* const { address } = await ada.deriveAddress(
* 0b1000, // byron address
* 764824073,
* [ HARDENED | 44, HARDENED | 1815, HARDENED | 1, 0, 5 ],
* null
* null
* null
* );
*
* @example
* const { address } = await ada.deriveAddress(
* 0b0000, // base address
* 0x00,
* [ HARDENED | 1852, HARDENED | 1815, HARDENED | 0, 0, 5 ],
* [ HARDENED | 1852, HARDENED | 1815, HARDENED | 0, 2, 0 ]
* null
* null
* );
*
*/

@@ -495,6 +522,14 @@

value: function () {
var _deriveAddress = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(path) {
var _deriveAddress = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(addressTypeNibble, networkIdOrProtocolMagic, spendingPath) {
var _this4 = this;
var _send, P1_RETURN, P2_UNUSED, data, response;
var stakingPath,
stakingKeyHashHex,
stakingBlockchainPointer,
_send,
P1_RETURN,
P2_UNUSED,
data,
response,
_args8 = arguments;

@@ -505,3 +540,5 @@ return _regenerator["default"].wrap(function _callee8$(_context8) {

case 0:
_utils.Precondition.checkIsValidPath(path);
stakingPath = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : null;
stakingKeyHashHex = _args8.length > 4 && _args8[4] !== undefined ? _args8[4] : null;
stakingBlockchainPointer = _args8.length > 5 && _args8[5] !== undefined ? _args8[5] : null;

@@ -514,13 +551,13 @@ _send = function _send(p1, p2, data) {

P2_UNUSED = 0x00;
data = _utils["default"].path_to_buf(path);
_context8.next = 7;
data = _cardano["default"].serializeAddressInfo(addressTypeNibble, networkIdOrProtocolMagic, spendingPath, stakingPath, stakingKeyHashHex, stakingBlockchainPointer);
_context8.next = 9;
return _send(P1_RETURN, P2_UNUSED, data);
case 7:
case 9:
response = _context8.sent;
return _context8.abrupt("return", {
address58: _utils["default"].base58_encode(response)
addressHex: response.toString('hex')
});
case 9:
case 11:
case "end":

@@ -533,3 +570,3 @@ return _context8.stop();

function deriveAddress(_x6) {
function deriveAddress(_x2, _x3, _x4) {
return _deriveAddress.apply(this, arguments);

@@ -543,6 +580,14 @@ }

value: function () {
var _showAddress = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(path) {
var _showAddress = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(addressTypeNibble, networkIdOrProtocolMagic, spendingPath) {
var _this5 = this;
var _send, P1_DISPLAY, P2_UNUSED, data, response;
var stakingPath,
stakingKeyHashHex,
stakingBlockchainPointer,
_send,
P1_DISPLAY,
P2_UNUSED,
data,
response,
_args9 = arguments;

@@ -553,3 +598,5 @@ return _regenerator["default"].wrap(function _callee9$(_context9) {

case 0:
_utils.Precondition.checkIsValidPath(path);
stakingPath = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : null;
stakingKeyHashHex = _args9.length > 4 && _args9[4] !== undefined ? _args9[4] : null;
stakingBlockchainPointer = _args9.length > 5 && _args9[5] !== undefined ? _args9[5] : null;

@@ -562,7 +609,7 @@ _send = function _send(p1, p2, data) {

P2_UNUSED = 0x00;
data = _utils["default"].path_to_buf(path);
_context9.next = 7;
data = _cardano["default"].serializeAddressInfo(addressTypeNibble, networkIdOrProtocolMagic, spendingPath, stakingPath, stakingKeyHashHex, stakingBlockchainPointer);
_context9.next = 9;
return _send(P1_DISPLAY, P2_UNUSED, data);
case 7:
case 9:
response = _context9.sent;

@@ -572,3 +619,3 @@

case 9:
case 11:
case "end":

@@ -581,3 +628,3 @@ return _context9.stop();

function showAddress(_x7) {
function showAddress(_x5, _x6, _x7) {
return _showAddress.apply(this, arguments);

@@ -591,10 +638,10 @@ }

value: function () {
var _signTransaction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(inputs, outputs) {
var _signTransaction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee21(networkId, protocolMagic, inputs, outputs, feeStr, ttlStr, certificates, withdrawals, metadataHashHex) {
var _this6 = this;
var P1_STAGE_INIT, P1_STAGE_INPUTS, P1_STAGE_OUTPUTS, P1_STAGE_CONFIRM, P1_STAGE_WITNESSES, P2_UNUSED, SIGN_TX_INPUT_TYPE_ATTESTED_UTXO, _send, signTx_init, signTx_addInput, signTx_addAddressOutput, signTx_addChangeOutput, signTx_awaitConfirm, signTx_getWitness, attestedInputs, _iterator, _step, _step$value, txDataHex, outputIndex, _attestation, _i, _attestedInputs, attestation, _iterator2, _step2, output, _yield$signTx_awaitCo, txHashHex, witnesses, _iterator3, _step3, input, witness;
var P1_STAGE_INIT, P1_STAGE_INPUTS, P1_STAGE_OUTPUTS, P1_STAGE_FEE, P1_STAGE_TTL, P1_STAGE_CERTIFICATES, P1_STAGE_WITHDRAWALS, P1_STAGE_METADATA, P1_STAGE_CONFIRM, P1_STAGE_WITNESSES, P2_UNUSED, _send, signTx_init, signTx_addInput, signTx_addAddressOutput, signTx_addChangeOutput, signTx_addCertificate, signTx_addWithdrawal, signTx_setFee, signTx_setTtl, signTx_setMetadata, signTx_awaitConfirm, signTx_getWitness, witnessPathsSet, witnessPaths, _i, _arr, path, pathKey, _iterator, _step, input, _iterator2, _step2, output, _iterator3, _step3, certificate, _iterator4, _step4, withdrawal, _yield$signTx_awaitCo, txHashHex, witnesses, _i2, _witnessPaths, _path, witness;
return _regenerator["default"].wrap(function _callee16$(_context16) {
return _regenerator["default"].wrap(function _callee21$(_context21) {
while (1) {
switch (_context16.prev = _context16.next) {
switch (_context21.prev = _context21.next) {
case 0:

@@ -605,6 +652,10 @@ //console.log("sign");

P1_STAGE_OUTPUTS = 0x03;
P1_STAGE_CONFIRM = 0x04;
P1_STAGE_WITNESSES = 0x05;
P1_STAGE_FEE = 0x04;
P1_STAGE_TTL = 0x05;
P1_STAGE_CERTIFICATES = 0x06;
P1_STAGE_WITHDRAWALS = 0x07;
P1_STAGE_METADATA = 0x08;
P1_STAGE_CONFIRM = 0x09;
P1_STAGE_WITNESSES = 0x0a;
P2_UNUSED = 0x00;
SIGN_TX_INPUT_TYPE_ATTESTED_UTXO = 0x01;

@@ -616,3 +667,3 @@ _send = function _send(p1, p2, data) {

signTx_init = /*#__PURE__*/function () {
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(numInputs, numOutputs) {
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(networkId, protocolMagic, numInputs, numOutputs, numCertificates, numWithdrawals, numWitnesses, includeMetadata) {
var data, response;

@@ -623,3 +674,3 @@ return _regenerator["default"].wrap(function _callee10$(_context10) {

case 0:
data = Buffer.concat([_utils["default"].uint32_to_buf(numInputs), _utils["default"].uint32_to_buf(numOutputs)]);
data = Buffer.concat([_utils["default"].uint8_to_buf(networkId), _utils["default"].uint32_to_buf(protocolMagic), _utils["default"].uint8_to_buf(includeMetadata ? MetadataCodes.SIGN_TX_METADATA_YES : MetadataCodes.SIGN_TX_METADATA_NO), _utils["default"].uint32_to_buf(numInputs), _utils["default"].uint32_to_buf(numOutputs), _utils["default"].uint32_to_buf(numCertificates), _utils["default"].uint32_to_buf(numWithdrawals), _utils["default"].uint32_to_buf(numWitnesses)]);
_context10.next = 3;

@@ -641,3 +692,3 @@ return wrapRetryStillInCall(_send)(P1_STAGE_INIT, P2_UNUSED, data);

return function signTx_init(_x10, _x11) {
return function signTx_init(_x17, _x18, _x19, _x20, _x21, _x22, _x23, _x24) {
return _ref3.apply(this, arguments);

@@ -648,3 +699,3 @@ };

signTx_addInput = /*#__PURE__*/function () {
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(attestation) {
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(input) {
var data, response;

@@ -655,3 +706,3 @@ return _regenerator["default"].wrap(function _callee11$(_context11) {

case 0:
data = Buffer.concat([_utils["default"].uint8_to_buf(SIGN_TX_INPUT_TYPE_ATTESTED_UTXO), attestation.rawBuffer]);
data = Buffer.concat([_utils["default"].hex_to_buf(input.txHashHex), _utils["default"].uint32_to_buf(input.outputIndex)]);
_context11.next = 3;

@@ -673,3 +724,3 @@ return _send(P1_STAGE_INPUTS, P2_UNUSED, data);

return function signTx_addInput(_x12) {
return function signTx_addInput(_x25) {
return _ref4.apply(this, arguments);

@@ -680,3 +731,3 @@ };

signTx_addAddressOutput = /*#__PURE__*/function () {
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(address58, amountStr) {
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(addressHex, amountStr) {
var data, response;

@@ -687,3 +738,3 @@ return _regenerator["default"].wrap(function _callee12$(_context12) {

case 0:
data = Buffer.concat([_utils["default"].amount_to_buf(amountStr), _utils["default"].uint8_to_buf(0x01), _utils["default"].base58_decode(address58)]);
data = Buffer.concat([_utils["default"].amount_to_buf(amountStr), _utils["default"].uint8_to_buf(TxOutputTypeCodes.SIGN_TX_OUTPUT_TYPE_ADDRESS), _utils["default"].hex_to_buf(addressHex)]);
_context12.next = 3;

@@ -705,3 +756,3 @@ return _send(P1_STAGE_OUTPUTS, P2_UNUSED, data);

return function signTx_addAddressOutput(_x13, _x14) {
return function signTx_addAddressOutput(_x26, _x27) {
return _ref5.apply(this, arguments);

@@ -712,4 +763,9 @@ };

signTx_addChangeOutput = /*#__PURE__*/function () {
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(path, amountStr) {
var data, response;
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(addressTypeNibble, spendingPath, amountStr) {
var stakingPath,
stakingKeyHashHex,
stakingBlockchainPointer,
data,
response,
_args13 = arguments;
return _regenerator["default"].wrap(function _callee13$(_context13) {

@@ -719,7 +775,10 @@ while (1) {

case 0:
data = Buffer.concat([_utils["default"].amount_to_buf(amountStr), _utils["default"].uint8_to_buf(0x02), _utils["default"].path_to_buf(path)]);
_context13.next = 3;
stakingPath = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : null;
stakingKeyHashHex = _args13.length > 4 && _args13[4] !== undefined ? _args13[4] : null;
stakingBlockchainPointer = _args13.length > 5 && _args13[5] !== undefined ? _args13[5] : null;
data = Buffer.concat([_utils["default"].amount_to_buf(amountStr), _utils["default"].uint8_to_buf(TxOutputTypeCodes.SIGN_TX_OUTPUT_TYPE_ADDRESS_PARAMS), _cardano["default"].serializeAddressInfo(addressTypeNibble, addressTypeNibble == AddressTypeNibbles.BYRON ? protocolMagic : networkId, spendingPath, stakingPath, stakingKeyHashHex, stakingBlockchainPointer)]);
_context13.next = 6;
return _send(P1_STAGE_OUTPUTS, P2_UNUSED, data);
case 3:
case 6:
response = _context13.sent;

@@ -729,3 +788,3 @@

case 5:
case 8:
case "end":

@@ -738,3 +797,3 @@ return _context13.stop();

return function signTx_addChangeOutput(_x15, _x16) {
return function signTx_addChangeOutput(_x28, _x29, _x30) {
return _ref6.apply(this, arguments);

@@ -744,5 +803,5 @@ };

signTx_awaitConfirm = /*#__PURE__*/function () {
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
var response;
signTx_addCertificate = /*#__PURE__*/function () {
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(type, path, poolKeyHashHex) {
var dataFields, data, response;
return _regenerator["default"].wrap(function _callee14$(_context14) {

@@ -752,8 +811,159 @@ while (1) {

case 0:
_context14.next = 2;
dataFields = [_utils["default"].uint8_to_buf(type), _utils["default"].path_to_buf(path)];
if (poolKeyHashHex != null) {
dataFields.push(_utils["default"].hex_to_buf(poolKeyHashHex));
}
data = Buffer.concat(dataFields);
_context14.next = 5;
return _send(P1_STAGE_CERTIFICATES, P2_UNUSED, data);
case 5:
response = _context14.sent;
_utils.Assert.assert(response.length == 0);
case 7:
case "end":
return _context14.stop();
}
}
}, _callee14);
}));
return function signTx_addCertificate(_x31, _x32, _x33) {
return _ref7.apply(this, arguments);
};
}();
signTx_addWithdrawal = /*#__PURE__*/function () {
var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(path, amountStr) {
var data, response;
return _regenerator["default"].wrap(function _callee15$(_context15) {
while (1) {
switch (_context15.prev = _context15.next) {
case 0:
data = Buffer.concat([_utils["default"].amount_to_buf(amountStr), _utils["default"].path_to_buf(path)]);
_context15.next = 3;
return _send(P1_STAGE_WITHDRAWALS, P2_UNUSED, data);
case 3:
response = _context15.sent;
_utils.Assert.assert(response.length == 0);
case 5:
case "end":
return _context15.stop();
}
}
}, _callee15);
}));
return function signTx_addWithdrawal(_x34, _x35) {
return _ref8.apply(this, arguments);
};
}();
signTx_setFee = /*#__PURE__*/function () {
var _ref9 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(feeStr) {
var data, response;
return _regenerator["default"].wrap(function _callee16$(_context16) {
while (1) {
switch (_context16.prev = _context16.next) {
case 0:
data = Buffer.concat([_utils["default"].amount_to_buf(feeStr)]);
_context16.next = 3;
return _send(P1_STAGE_FEE, P2_UNUSED, data);
case 3:
response = _context16.sent;
_utils.Assert.assert(response.length == 0);
case 5:
case "end":
return _context16.stop();
}
}
}, _callee16);
}));
return function signTx_setFee(_x36) {
return _ref9.apply(this, arguments);
};
}();
signTx_setTtl = /*#__PURE__*/function () {
var _ref10 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(ttlStr) {
var data, response;
return _regenerator["default"].wrap(function _callee17$(_context17) {
while (1) {
switch (_context17.prev = _context17.next) {
case 0:
data = Buffer.concat([_utils["default"].amount_to_buf(ttlStr)]);
_context17.next = 3;
return _send(P1_STAGE_TTL, P2_UNUSED, data);
case 3:
response = _context17.sent;
_utils.Assert.assert(response.length == 0);
case 5:
case "end":
return _context17.stop();
}
}
}, _callee17);
}));
return function signTx_setTtl(_x37) {
return _ref10.apply(this, arguments);
};
}();
signTx_setMetadata = /*#__PURE__*/function () {
var _ref11 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee18(metadataHashHex) {
var data, response;
return _regenerator["default"].wrap(function _callee18$(_context18) {
while (1) {
switch (_context18.prev = _context18.next) {
case 0:
data = _utils["default"].hex_to_buf(metadataHashHex);
_context18.next = 3;
return _send(P1_STAGE_METADATA, P2_UNUSED, data);
case 3:
response = _context18.sent;
_utils.Assert.assert(response.length == 0);
case 5:
case "end":
return _context18.stop();
}
}
}, _callee18);
}));
return function signTx_setMetadata(_x38) {
return _ref11.apply(this, arguments);
};
}();
signTx_awaitConfirm = /*#__PURE__*/function () {
var _ref12 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee19() {
var response;
return _regenerator["default"].wrap(function _callee19$(_context19) {
while (1) {
switch (_context19.prev = _context19.next) {
case 0:
_context19.next = 2;
return _send(P1_STAGE_CONFIRM, P2_UNUSED, _utils["default"].hex_to_buf(""));
case 2:
response = _context14.sent;
return _context14.abrupt("return", {
response = _context19.sent;
return _context19.abrupt("return", {
txHashHex: response.toString("hex")

@@ -764,10 +974,10 @@ });

case "end":
return _context14.stop();
return _context19.stop();
}
}
}, _callee14);
}, _callee19);
}));
return function signTx_awaitConfirm() {
return _ref7.apply(this, arguments);
return _ref12.apply(this, arguments);
};

@@ -777,15 +987,15 @@ }();

signTx_getWitness = /*#__PURE__*/function () {
var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(path) {
var _ref13 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee20(path) {
var data, response;
return _regenerator["default"].wrap(function _callee15$(_context15) {
return _regenerator["default"].wrap(function _callee20$(_context20) {
while (1) {
switch (_context15.prev = _context15.next) {
switch (_context20.prev = _context20.next) {
case 0:
data = Buffer.concat([_utils["default"].path_to_buf(path)]);
_context15.next = 3;
_context20.next = 3;
return _send(P1_STAGE_WITNESSES, P2_UNUSED, data);
case 3:
response = _context15.sent;
return _context15.abrupt("return", {
response = _context20.sent;
return _context20.abrupt("return", {
path: path,

@@ -797,89 +1007,82 @@ witnessSignatureHex: _utils["default"].buf_to_hex(response)

case "end":
return _context15.stop();
return _context20.stop();
}
}
}, _callee15);
}, _callee20);
}));
return function signTx_getWitness(_x17) {
return _ref8.apply(this, arguments);
return function signTx_getWitness(_x39) {
return _ref13.apply(this, arguments);
};
}(); //console.log("attest");
}(); // init
//console.log("init");
// for unique witness paths
attestedInputs = []; // attest
witnessPathsSet = new Set();
witnessPaths = [];
for (_i = 0, _arr = [].concat((0, _toConsumableArray2["default"])(inputs), (0, _toConsumableArray2["default"])(certificates), (0, _toConsumableArray2["default"])(withdrawals)); _i < _arr.length; _i++) {
path = _arr[_i].path;
pathKey = JSON.stringify(path);
if (!witnessPathsSet.has(pathKey)) {
witnessPathsSet.add(pathKey);
witnessPaths.push(path);
}
}
_context21.next = 28;
return signTx_init(networkId, protocolMagic, inputs.length, outputs.length, certificates.length, withdrawals.length, witnessPaths.length, metadataHashHex != null);
case 28:
// inputs
//console.log("inputs");
_iterator = _createForOfIteratorHelper(inputs);
_context16.prev = 16;
_context21.prev = 29;
_iterator.s();
case 18:
case 31:
if ((_step = _iterator.n()).done) {
_context16.next = 26;
_context21.next = 37;
break;
}
_step$value = _step.value, txDataHex = _step$value.txDataHex, outputIndex = _step$value.outputIndex;
_context16.next = 22;
return this._attestUtxo(txDataHex, outputIndex);
input = _step.value;
_context21.next = 35;
return signTx_addInput(input);
case 22:
_attestation = _context16.sent;
attestedInputs.push(_attestation);
case 24:
_context16.next = 18;
case 35:
_context21.next = 31;
break;
case 26:
_context16.next = 31;
case 37:
_context21.next = 42;
break;
case 28:
_context16.prev = 28;
_context16.t0 = _context16["catch"](16);
case 39:
_context21.prev = 39;
_context21.t0 = _context21["catch"](29);
_iterator.e(_context16.t0);
_iterator.e(_context21.t0);
case 31:
_context16.prev = 31;
case 42:
_context21.prev = 42;
_iterator.f();
return _context16.finish(31);
return _context21.finish(42);
case 34:
_context16.next = 36;
return signTx_init(attestedInputs.length, outputs.length);
case 36:
_i = 0, _attestedInputs = attestedInputs;
case 37:
if (!(_i < _attestedInputs.length)) {
_context16.next = 44;
break;
}
attestation = _attestedInputs[_i];
_context16.next = 41;
return signTx_addInput(attestation);
case 41:
_i++;
_context16.next = 37;
break;
case 44:
case 45:
// outputs
//console.log("outputs");
_iterator2 = _createForOfIteratorHelper(outputs);
_context16.prev = 45;
_context21.prev = 46;
_iterator2.s();
case 47:
case 48:
if ((_step2 = _iterator2.n()).done) {
_context16.next = 62;
_context21.next = 63;
break;

@@ -890,102 +1093,184 @@ }

if (!output.address58) {
_context16.next = 54;
if (!output.addressHex) {
_context21.next = 55;
break;
}
_context16.next = 52;
return signTx_addAddressOutput(output.address58, output.amountStr);
_context21.next = 53;
return signTx_addAddressOutput(output.addressHex, output.amountStr);
case 52:
_context16.next = 60;
case 53:
_context21.next = 61;
break;
case 54:
if (!output.path) {
_context16.next = 59;
case 55:
if (!output.spendingPath) {
_context21.next = 60;
break;
}
_context16.next = 57;
return signTx_addChangeOutput(output.path, output.amountStr);
_context21.next = 58;
return signTx_addChangeOutput(output.addressTypeNibble, output.spendingPath, output.amountStr, output.stakingPath, output.stakingKeyHashHex, output.stakingBlockchainPointer);
case 57:
_context16.next = 60;
case 58:
_context21.next = 61;
break;
case 59:
case 60:
throw new Error("TODO");
case 60:
_context16.next = 47;
case 61:
_context21.next = 48;
break;
case 62:
_context16.next = 67;
case 63:
_context21.next = 68;
break;
case 64:
_context16.prev = 64;
_context16.t1 = _context16["catch"](45);
case 65:
_context21.prev = 65;
_context21.t1 = _context21["catch"](46);
_iterator2.e(_context16.t1);
_iterator2.e(_context21.t1);
case 67:
_context16.prev = 67;
case 68:
_context21.prev = 68;
_iterator2.f();
return _context16.finish(67);
return _context21.finish(68);
case 70:
_context16.next = 72;
return signTx_awaitConfirm();
case 71:
_context21.next = 73;
return signTx_setFee(feeStr);
case 72:
_yield$signTx_awaitCo = _context16.sent;
txHashHex = _yield$signTx_awaitCo.txHashHex;
//console.log("witnesses");
witnesses = [];
_iterator3 = _createForOfIteratorHelper(inputs);
_context16.prev = 76;
case 73:
_context21.next = 75;
return signTx_setTtl(ttlStr);
case 75:
if (!(certificates.length > 0)) {
_context21.next = 93;
break;
}
_iterator3 = _createForOfIteratorHelper(certificates);
_context21.prev = 77;
_iterator3.s();
case 78:
case 79:
if ((_step3 = _iterator3.n()).done) {
_context16.next = 86;
_context21.next = 85;
break;
}
input = _step3.value;
_context16.next = 82;
return signTx_getWitness(input.path);
certificate = _step3.value;
_context21.next = 83;
return signTx_addCertificate(certificate.type, certificate.path, certificate.poolKeyHashHex);
case 82:
witness = _context16.sent;
witnesses.push(witness);
case 84:
_context16.next = 78;
case 83:
_context21.next = 79;
break;
case 86:
_context16.next = 91;
case 85:
_context21.next = 90;
break;
case 88:
_context16.prev = 88;
_context16.t2 = _context16["catch"](76);
case 87:
_context21.prev = 87;
_context21.t2 = _context21["catch"](77);
_iterator3.e(_context16.t2);
_iterator3.e(_context21.t2);
case 91:
_context16.prev = 91;
case 90:
_context21.prev = 90;
_iterator3.f();
return _context16.finish(91);
return _context21.finish(90);
case 94:
return _context16.abrupt("return", {
case 93:
if (!(withdrawals.length > 0)) {
_context21.next = 111;
break;
}
_iterator4 = _createForOfIteratorHelper(withdrawals);
_context21.prev = 95;
_iterator4.s();
case 97:
if ((_step4 = _iterator4.n()).done) {
_context21.next = 103;
break;
}
withdrawal = _step4.value;
_context21.next = 101;
return signTx_addWithdrawal(withdrawal.path, withdrawal.amountStr);
case 101:
_context21.next = 97;
break;
case 103:
_context21.next = 108;
break;
case 105:
_context21.prev = 105;
_context21.t3 = _context21["catch"](95);
_iterator4.e(_context21.t3);
case 108:
_context21.prev = 108;
_iterator4.f();
return _context21.finish(108);
case 111:
if (!(metadataHashHex != null)) {
_context21.next = 114;
break;
}
_context21.next = 114;
return signTx_setMetadata(metadataHashHex);
case 114:
_context21.next = 116;
return signTx_awaitConfirm();
case 116:
_yield$signTx_awaitCo = _context21.sent;
txHashHex = _yield$signTx_awaitCo.txHashHex;
//console.log("witnesses");
witnesses = [];
_i2 = 0, _witnessPaths = witnessPaths;
case 120:
if (!(_i2 < _witnessPaths.length)) {
_context21.next = 129;
break;
}
_path = _witnessPaths[_i2];
_context21.next = 124;
return signTx_getWitness(_path);
case 124:
witness = _context21.sent;
witnesses.push(witness);
case 126:
_i2++;
_context21.next = 120;
break;
case 129:
return _context21.abrupt("return", {
txHashHex: txHashHex,

@@ -995,11 +1280,11 @@ witnesses: witnesses

case 95:
case 130:
case "end":
return _context16.stop();
return _context21.stop();
}
}
}, _callee16, this, [[16, 28, 31, 34], [45, 64, 67, 70], [76, 88, 91, 94]]);
}, _callee21, null, [[29, 39, 42, 45], [46, 65, 68, 71], [77, 87, 90, 93], [95, 105, 108, 111]]);
}));
function signTransaction(_x8, _x9) {
function signTransaction(_x8, _x9, _x10, _x11, _x12, _x13, _x14, _x15, _x16) {
return _signTransaction.apply(this, arguments);

@@ -1012,5 +1297,6 @@ }

return Ada;
}();
}(); // reexport
exports["default"] = Ada;
//# sourceMappingURL=Ada.js.map

@@ -20,5 +20,9 @@ "use strict";

exports.base58_decode = base58_decode;
exports.str_to_path = str_to_path;
exports.bech32_encodeAddress = bech32_encodeAddress;
exports.bech32_decodeAddress = bech32_decodeAddress;
exports.safe_parseInt = safe_parseInt;
exports["default"] = exports.Assert = exports.Precondition = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));

@@ -28,2 +32,8 @@

var _bech = _interopRequireDefault(require("bech32"));
var _Ada = require("./Ada");
var _hex_to_buf$buf_to_he;
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }

@@ -37,3 +47,3 @@

var bs58 = (0, _baseX["default"])(BASE58_ALPHABET);
var HARDENED = 0x80000000; // We use bs10 as an easy way to parse/encode amount strings
var BECH32_ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"; // We use bs10 as an easy way to parse/encode amount strings

@@ -43,2 +53,3 @@ var bs10 = (0, _baseX["default"])("0123456789"); // Max supply in lovelace

var MAX_LOVELACE_SUPPLY_STR = ["45", "000", "000", "000", "000000"].join("");
var TESTNET_NETWORK_ID = 0x00;
var Precondition = {

@@ -128,2 +139,20 @@ // Generic check

}
},
checkIsValidBech32Address: function checkIsValidBech32Address(data) {
Precondition.checkIsString(data);
Precondition.check(data.split("1").length == 2);
var _iterator3 = _createForOfIteratorHelper(data.split("1")[1]),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var c = _step3.value;
Precondition.check(BECH32_ALPHABET.includes(c));
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
}

@@ -190,8 +219,8 @@ };

var _iterator3 = _createForOfIteratorHelper(chunkLengths),
_step3;
var _iterator4 = _createForOfIteratorHelper(chunkLengths),
_step4;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var len = _step3.value;
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
var len = _step4.value;
Precondition.checkIsInteger(len);

@@ -201,5 +230,5 @@ Precondition.check(len > 0);

} catch (err) {
_iterator3.e(err);
_iterator4.e(err);
} finally {
_iterator3.f();
_iterator4.f();
}

@@ -257,2 +286,45 @@

function bech32_encodeAddress(data) {
Precondition.checkIsBuffer(data);
var networkId = data[0] & 15;
var data5bit = _bech["default"].toWords(data);
var MAX_HUMAN_ADDRESS_LENGTH = 150; // see cardano.h in https://github.com/vacuumlabs/ledger-app-cardano-shelley
return _bech["default"].encode(getShelleyAddressPrefix(data), data5bit, MAX_HUMAN_ADDRESS_LENGTH);
} // based on https://github.com/cardano-foundation/CIPs/pull/6/files
function getShelleyAddressPrefix(data) {
var result = "";
var addressType = (data[0] & 240) >> 4;
switch (addressType) {
case _Ada.AddressTypeNibbles.REWARD:
result = "stake";
break;
default:
result = "addr";
}
var networkId = data[0] & 15;
if (networkId === TESTNET_NETWORK_ID) {
result += "_test";
}
return result;
}
function bech32_decodeAddress(data) {
Precondition.checkIsValidBech32Address(data);
var _bech32$decode = _bech["default"].decode(data, 1000),
words = _bech32$decode.words;
return Buffer.from(_bech["default"].fromWords(words));
}
function safe_parseInt(str) {

@@ -270,24 +342,3 @@ Precondition.checkIsString(str);

function parseBIP32Index(str) {
var base = 0;
if (str.endsWith("'")) {
str = str.slice(0, -1);
base = HARDENED;
}
var i = safe_parseInt(str);
Precondition.check(i >= 0);
Precondition.check(i < HARDENED);
return base + i;
}
function str_to_path(data) {
Precondition.checkIsString(data);
Precondition.check(data.length > 0);
return data.split("/").map(parseBIP32Index);
}
var _default = {
HARDENED: HARDENED,
var _default = (_hex_to_buf$buf_to_he = {
hex_to_buf: hex_to_buf,

@@ -301,2 +352,3 @@ buf_to_hex: buf_to_hex,

path_to_buf: path_to_buf,
safe_parseInt: safe_parseInt,
amount_to_buf: amount_to_buf,

@@ -306,7 +358,7 @@ buf_to_amount: buf_to_amount,

base58_decode: base58_decode,
chunkBy: chunkBy,
stripRetcodeFromResponse: stripRetcodeFromResponse,
str_to_path: str_to_path
};
bech32_encodeAddress: bech32_encodeAddress,
bech32_decodeAddress: bech32_decodeAddress
}, (0, _defineProperty2["default"])(_hex_to_buf$buf_to_he, "safe_parseInt", safe_parseInt), (0, _defineProperty2["default"])(_hex_to_buf$buf_to_he, "chunkBy", chunkBy), (0, _defineProperty2["default"])(_hex_to_buf$buf_to_he, "stripRetcodeFromResponse", stripRetcodeFromResponse), _hex_to_buf$buf_to_he);
exports["default"] = _default;
//# sourceMappingURL=utils.js.map
{
"name": "@cardano-foundation/ledgerjs-hw-app-cardano",
"version": "1.0.8",
"version": "2.0.0",
"files": [

@@ -27,2 +27,3 @@ "lib"

"base-x": "^3.0.5",
"bech32": "^1.1.4",
"node-int64": "^0.4.0"

@@ -58,6 +59,11 @@ },

"build-test": "yarn run clean && yarn run build && yarn run clean-test && babel --source-maps -d test/lib test/src && flow-copy-source -v test/src test/lib",
"test-integration": "yarn run build-test && mocha --timeout 15000 test/lib/integration",
"test-direct": "yarn run build-test && mocha --timeout 3600000 test/lib/direct",
"test": "yarn test-integration && yarn test-direct"
"test": "yarn build-test && yarn test-device-run && yarn test-integration-run && yarn test-direct-run",
"test-device": "yarn run build-test && mocha --timeout 3600000 test/lib/device",
"test-device-run": "mocha --timeout 3600000 test/lib/device",
"test-integration": "yarn run build-test && yarn run test-integration-run",
"test-integration-run": "mocha --timeout 600000 test/lib/integration",
"test-direct": "yarn build-test && yarn test-direct-run",
"test-direct-run": "mocha --timeout 3600000 test/lib/direct",
"//": "run single test by specifying --grep <name> parameter in test-integration"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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