@ledgerhq/live-cli 24.10.3-nightly.0 → 24.10.3-nightly.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli.js +33 -63
- package/lib/cli.js.map +1 -1
- package/lib/commands/blockchain/bot.js +7 -7
- package/lib/commands/blockchain/bot.js.map +1 -1
- package/lib/commands/blockchain/botPortfolio.js +22 -26
- package/lib/commands/blockchain/botPortfolio.js.map +1 -1
- package/lib/commands/blockchain/botTransfer.js +219 -392
- package/lib/commands/blockchain/botTransfer.js.map +1 -1
- package/lib/commands/blockchain/broadcast.js +11 -42
- package/lib/commands/blockchain/broadcast.js.map +1 -1
- package/lib/commands/blockchain/confirmOp.js +12 -52
- package/lib/commands/blockchain/confirmOp.js.map +1 -1
- package/lib/commands/blockchain/derivation.js +31 -33
- package/lib/commands/blockchain/derivation.js.map +1 -1
- package/lib/commands/blockchain/estimateMaxSpendable.js +27 -56
- package/lib/commands/blockchain/estimateMaxSpendable.js.map +1 -1
- package/lib/commands/blockchain/generateTestScanAccounts.js +29 -37
- package/lib/commands/blockchain/generateTestScanAccounts.js.map +1 -1
- package/lib/commands/blockchain/generateTestTransaction.js +70 -96
- package/lib/commands/blockchain/generateTestTransaction.js.map +1 -1
- package/lib/commands/blockchain/getAddress.js +20 -24
- package/lib/commands/blockchain/getAddress.js.map +1 -1
- package/lib/commands/blockchain/getTransactionStatus.js +31 -69
- package/lib/commands/blockchain/getTransactionStatus.js.map +1 -1
- package/lib/commands/blockchain/receive.js +14 -42
- package/lib/commands/blockchain/receive.js.map +1 -1
- package/lib/commands/blockchain/satstack.js +30 -33
- package/lib/commands/blockchain/satstack.js.map +1 -1
- package/lib/commands/blockchain/satstackStatus.js +4 -5
- package/lib/commands/blockchain/satstackStatus.js.map +1 -1
- package/lib/commands/blockchain/scanDescriptors.js +8 -14
- package/lib/commands/blockchain/scanDescriptors.js.map +1 -1
- package/lib/commands/blockchain/send.js +61 -90
- package/lib/commands/blockchain/send.js.map +1 -1
- package/lib/commands/blockchain/signMessage.d.ts +1 -1
- package/lib/commands/blockchain/signMessage.js +15 -40
- package/lib/commands/blockchain/signMessage.js.map +1 -1
- package/lib/commands/blockchain/sync.js +27 -120
- package/lib/commands/blockchain/sync.js.map +1 -1
- package/lib/commands/blockchain/testDetectOpCollision.js +15 -48
- package/lib/commands/blockchain/testDetectOpCollision.js.map +1 -1
- package/lib/commands/blockchain/testGetTrustedInputFromTxHash.js +37 -86
- package/lib/commands/blockchain/testGetTrustedInputFromTxHash.js.map +1 -1
- package/lib/commands/device/app.js +42 -76
- package/lib/commands/device/app.js.map +1 -1
- package/lib/commands/device/appUninstallAll.d.ts +1 -1
- package/lib/commands/device/appUninstallAll.js +22 -29
- package/lib/commands/device/appUninstallAll.js.map +1 -1
- package/lib/commands/device/appsCheckAllAppVersions.js +208 -361
- package/lib/commands/device/appsCheckAllAppVersions.js.map +1 -1
- package/lib/commands/device/appsInstallAll.js +15 -24
- package/lib/commands/device/appsInstallAll.js.map +1 -1
- package/lib/commands/device/appsUpdateTestAll.js +69 -80
- package/lib/commands/device/appsUpdateTestAll.js.map +1 -1
- package/lib/commands/device/cleanSpeculos.js +4 -4
- package/lib/commands/device/cleanSpeculos.js.map +1 -1
- package/lib/commands/device/customLockScreenFetch.js +37 -84
- package/lib/commands/device/customLockScreenFetch.js.map +1 -1
- package/lib/commands/device/customLockScreenFetchAndRestore.js +46 -110
- package/lib/commands/device/customLockScreenFetchAndRestore.js.map +1 -1
- package/lib/commands/device/customLockScreenFetchHash.js +5 -7
- package/lib/commands/device/customLockScreenFetchHash.js.map +1 -1
- package/lib/commands/device/customLockScreenLoad.js +25 -72
- package/lib/commands/device/customLockScreenLoad.js.map +1 -1
- package/lib/commands/device/customLockScreenRemove.js +5 -7
- package/lib/commands/device/customLockScreenRemove.js.map +1 -1
- package/lib/commands/device/devDeviceAppsScenario.js +33 -65
- package/lib/commands/device/devDeviceAppsScenario.js.map +1 -1
- package/lib/commands/device/deviceAppVersion.js +5 -8
- package/lib/commands/device/deviceAppVersion.js.map +1 -1
- package/lib/commands/device/deviceInfo.js +5 -8
- package/lib/commands/device/deviceInfo.js.map +1 -1
- package/lib/commands/device/deviceSDKFirmwareUpdate.js +22 -68
- package/lib/commands/device/deviceSDKFirmwareUpdate.js.map +1 -1
- package/lib/commands/device/deviceSDKGetBatteryStatuses.js +7 -8
- package/lib/commands/device/deviceSDKGetBatteryStatuses.js.map +1 -1
- package/lib/commands/device/deviceSDKGetDeviceInfo.js +6 -7
- package/lib/commands/device/deviceSDKGetDeviceInfo.js.map +1 -1
- package/lib/commands/device/deviceSDKToggleOnboardingEarlyCheck.js +8 -9
- package/lib/commands/device/deviceSDKToggleOnboardingEarlyCheck.js.map +1 -1
- package/lib/commands/device/deviceVersion.js +5 -8
- package/lib/commands/device/deviceVersion.js.map +1 -1
- package/lib/commands/device/discoverDevices.js +15 -50
- package/lib/commands/device/discoverDevices.js.map +1 -1
- package/lib/commands/device/firmwareRepair.js +3 -6
- package/lib/commands/device/firmwareRepair.js.map +1 -1
- package/lib/commands/device/firmwareUpdate.js +63 -123
- package/lib/commands/device/firmwareUpdate.js.map +1 -1
- package/lib/commands/device/genuineCheck.js +7 -12
- package/lib/commands/device/genuineCheck.js.map +1 -1
- package/lib/commands/device/getBatteryStatus.js +5 -9
- package/lib/commands/device/getBatteryStatus.js.map +1 -1
- package/lib/commands/device/getDeviceRunningMode.js +7 -10
- package/lib/commands/device/getDeviceRunningMode.js.map +1 -1
- package/lib/commands/device/i18n.js +27 -79
- package/lib/commands/device/i18n.js.map +1 -1
- package/lib/commands/device/listApps.d.ts +1 -1
- package/lib/commands/device/listApps.js +7 -12
- package/lib/commands/device/listApps.js.map +1 -1
- package/lib/commands/device/managerListApps.js +21 -28
- package/lib/commands/device/managerListApps.js.map +1 -1
- package/lib/commands/device/proxy.js +242 -350
- package/lib/commands/device/proxy.js.map +1 -1
- package/lib/commands/device/reinstallConfigurationConsent.js +36 -126
- package/lib/commands/device/reinstallConfigurationConsent.js.map +1 -1
- package/lib/commands/device/repl.js +5 -10
- package/lib/commands/device/repl.js.map +1 -1
- package/lib/commands/device/speculosList.js +12 -58
- package/lib/commands/device/speculosList.js.map +1 -1
- package/lib/commands/live/balanceHistory.js +44 -79
- package/lib/commands/live/balanceHistory.js.map +1 -1
- package/lib/commands/live/countervalues.js +111 -207
- package/lib/commands/live/countervalues.js.map +1 -1
- package/lib/commands/live/envs.js +4 -6
- package/lib/commands/live/envs.js.map +1 -1
- package/lib/commands/live/exportAccounts.js +30 -56
- package/lib/commands/live/exportAccounts.js.map +1 -1
- package/lib/commands/live/ledgerKeyRingProtocol.d.ts +1 -1
- package/lib/commands/live/ledgerKeyRingProtocol.js +63 -103
- package/lib/commands/live/ledgerKeyRingProtocol.js.map +1 -1
- package/lib/commands/live/ledgerSync.js +20 -60
- package/lib/commands/live/ledgerSync.js.map +1 -1
- package/lib/commands/live/liveData.js +34 -60
- package/lib/commands/live/liveData.js.map +1 -1
- package/lib/commands/live/portfolio.js +68 -98
- package/lib/commands/live/portfolio.js.map +1 -1
- package/lib/commands/live/synchronousOnboarding.js +6 -9
- package/lib/commands/live/synchronousOnboarding.js.map +1 -1
- package/lib/commands/live/user.js +4 -4
- package/lib/commands/live/user.js.map +1 -1
- package/lib/commands/live/version.js +2 -4
- package/lib/commands/live/version.js.map +1 -1
- package/lib/commands/ptx/swap.js +194 -282
- package/lib/commands/ptx/swap.js.map +1 -1
- package/lib/commands-index.d.ts +9 -9
- package/lib/commands-index.js +64 -64
- package/lib/commands-index.js.map +1 -1
- package/lib/live-common-setup-base.js +26 -48
- package/lib/live-common-setup-base.js.map +1 -1
- package/lib/live-common-setup.js +66 -123
- package/lib/live-common-setup.js.map +1 -1
- package/lib/qr.js +6 -10
- package/lib/qr.js.map +1 -1
- package/lib/scan.js +84 -92
- package/lib/scan.js.map +1 -1
- package/lib/signedOperation.js +6 -6
- package/lib/signedOperation.js.map +1 -1
- package/lib/stream.js +57 -68
- package/lib/stream.js.map +1 -1
- package/lib/transaction.js +60 -142
- package/lib/transaction.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,92 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
4
|
};
|
|
41
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
6
|
/* eslint-disable no-console */
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
throw new Error("ledgerExplorer not found");
|
|
67
|
-
endpoint = ledgerExplorer.endpoint, version = ledgerExplorer.version, id = ledgerExplorer.id;
|
|
68
|
-
return [4 /*yield*/, (0, network_1.default)({
|
|
69
|
-
url: "".concat(endpoint, "/blockchain/").concat(version, "/").concat(id, "/transactions/").concat(hash, "/hex"),
|
|
70
|
-
})];
|
|
71
|
-
case 1:
|
|
72
|
-
res = _a.sent();
|
|
73
|
-
hex = res.data[0] && res.data[0].hex;
|
|
74
|
-
if (!hex)
|
|
75
|
-
return [2 /*return*/, "Backend returned no hex for this hash"];
|
|
76
|
-
hasExtraData = currency.id === "zcash" || currency.id === "komodo" || currency.id === "zencash";
|
|
77
|
-
tx = btc.splitTransaction(hex, currency.supportsSegwit, hasExtraData, [currency.id]);
|
|
78
|
-
return [4 /*yield*/, btc.getTrustedInput(0, tx, [currency.id])];
|
|
79
|
-
case 2:
|
|
80
|
-
outHash = _a.sent();
|
|
81
|
-
ouHash = outHash.substring(8, 72);
|
|
82
|
-
finalOut = Buffer.from(ouHash, "hex").reverse().toString("hex");
|
|
83
|
-
return [2 /*return*/, {
|
|
84
|
-
inHash: hash,
|
|
85
|
-
finalOut: finalOut,
|
|
86
|
-
}];
|
|
87
|
-
}
|
|
7
|
+
const deviceAccess_1 = require("@ledgerhq/live-common/hw/deviceAccess");
|
|
8
|
+
const scan_1 = require("../../scan");
|
|
9
|
+
const rxjs_1 = require("rxjs");
|
|
10
|
+
const invariant_1 = __importDefault(require("invariant"));
|
|
11
|
+
const hw_app_btc_1 = __importDefault(require("@ledgerhq/hw-app-btc"));
|
|
12
|
+
const network_1 = __importDefault(require("@ledgerhq/live-network/network"));
|
|
13
|
+
const explorer_1 = require("@ledgerhq/live-common/explorer");
|
|
14
|
+
const cryptoassets_1 = require("@ledgerhq/cryptoassets");
|
|
15
|
+
const command = async (transport, currencyId, hash) => {
|
|
16
|
+
const currency = (0, cryptoassets_1.findCryptoCurrencyById)(currencyId);
|
|
17
|
+
(0, invariant_1.default)(currency, "currency not found");
|
|
18
|
+
if (!currency)
|
|
19
|
+
throw new Error("currency not found");
|
|
20
|
+
const { bitcoinLikeInfo } = currency;
|
|
21
|
+
const btc = new hw_app_btc_1.default({ transport, currency: currency?.id });
|
|
22
|
+
(0, invariant_1.default)(currency.family === "bitcoin" && bitcoinLikeInfo, "currency of bitcoin family only");
|
|
23
|
+
const ledgerExplorer = (0, explorer_1.findCurrencyExplorer)(currency);
|
|
24
|
+
(0, invariant_1.default)(ledgerExplorer, "ledgerExplorer not found");
|
|
25
|
+
if (!ledgerExplorer)
|
|
26
|
+
throw new Error("ledgerExplorer not found");
|
|
27
|
+
const { endpoint, version, id } = ledgerExplorer;
|
|
28
|
+
const res = await (0, network_1.default)({
|
|
29
|
+
url: `${endpoint}/blockchain/${version}/${id}/transactions/${hash}/hex`,
|
|
88
30
|
});
|
|
89
|
-
|
|
31
|
+
const hex = res.data[0] && res.data[0].hex;
|
|
32
|
+
if (!hex)
|
|
33
|
+
return `Backend returned no hex for this hash`;
|
|
34
|
+
const hasExtraData = currency.id === "zcash" || currency.id === "komodo" || currency.id === "zencash";
|
|
35
|
+
const tx = btc.splitTransaction(hex, currency.supportsSegwit, hasExtraData, [currency.id]);
|
|
36
|
+
const outHash = await btc.getTrustedInput(0, tx, [currency.id]);
|
|
37
|
+
const ouHash = outHash.substring(8, 72);
|
|
38
|
+
const finalOut = Buffer.from(ouHash, "hex").reverse().toString("hex");
|
|
39
|
+
return {
|
|
40
|
+
inHash: hash,
|
|
41
|
+
finalOut,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
90
44
|
exports.default = {
|
|
91
45
|
args: [
|
|
92
46
|
scan_1.deviceOpt,
|
|
@@ -101,9 +55,6 @@ exports.default = {
|
|
|
101
55
|
type: String,
|
|
102
56
|
},
|
|
103
57
|
],
|
|
104
|
-
job:
|
|
105
|
-
var device = _a.device, currency = _a.currency, hash = _a.hash;
|
|
106
|
-
return (0, deviceAccess_1.withDevice)(device || "")(function (transport) { return (0, rxjs_1.from)(command(transport, currency, hash)); });
|
|
107
|
-
},
|
|
58
|
+
job: ({ device, currency, hash }) => (0, deviceAccess_1.withDevice)(device || "")(transport => (0, rxjs_1.from)(command(transport, currency, hash))),
|
|
108
59
|
};
|
|
109
60
|
//# sourceMappingURL=testGetTrustedInputFromTxHash.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testGetTrustedInputFromTxHash.js","sourceRoot":"","sources":["../../../src/commands/blockchain/testGetTrustedInputFromTxHash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testGetTrustedInputFromTxHash.js","sourceRoot":"","sources":["../../../src/commands/blockchain/testGetTrustedInputFromTxHash.ts"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,wEAAmE;AACnE,qCAAyD;AACzD,+BAA4B;AAC5B,0DAAkC;AAClC,sEAAuC;AACvC,6EAAqD;AACrD,6DAAsE;AACtE,yDAAgE;AAGhE,MAAM,OAAO,GAAG,KAAK,EAAE,SAAoB,EAAE,UAAkB,EAAE,IAAY,EAAE,EAAE;IAC/E,MAAM,QAAQ,GAAG,IAAA,qCAAsB,EAAC,UAAU,CAAC,CAAC;IACpD,IAAA,mBAAS,EAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IAC1C,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACrD,MAAM,EAAE,eAAe,EAAE,GAAG,QAAQ,CAAC;IACrC,MAAM,GAAG,GAAG,IAAI,oBAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3D,IAAA,mBAAS,EAAC,QAAQ,CAAC,MAAM,KAAK,SAAS,IAAI,eAAe,EAAE,iCAAiC,CAAC,CAAC;IAC/F,MAAM,cAAc,GAAG,IAAA,+BAAoB,EAAC,QAAQ,CAAC,CAAC;IACtD,IAAA,mBAAS,EAAC,cAAc,EAAE,0BAA0B,CAAC,CAAC;IACtD,IAAI,CAAC,cAAc;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACjE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,cAAc,CAAC;IACjD,MAAM,GAAG,GAAG,MAAM,IAAA,iBAAO,EAAC;QACxB,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CACxE,IAAA,yBAAU,EAAC,MAAM,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,IAAA,WAAI,EAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;CAClF,CAAC"}
|
|
@@ -1,44 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
-
if (ar || !(i in from)) {
|
|
21
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
-
ar[i] = from[i];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
-
};
|
|
27
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
4
|
};
|
|
30
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
6
|
+
const rxjs_1 = require("rxjs");
|
|
7
|
+
const operators_1 = require("rxjs/operators");
|
|
8
|
+
const deviceAccess_1 = require("@ledgerhq/live-common/hw/deviceAccess");
|
|
9
|
+
const getDeviceInfo_1 = __importDefault(require("@ledgerhq/live-common/hw/getDeviceInfo"));
|
|
10
|
+
const openApp_1 = __importDefault(require("@ledgerhq/live-common/hw/openApp"));
|
|
11
|
+
const quitApp_1 = __importDefault(require("@ledgerhq/live-common/hw/quitApp"));
|
|
12
|
+
const installApp_1 = __importDefault(require("@ledgerhq/live-common/hw/installApp"));
|
|
13
|
+
const uninstallApp_1 = __importDefault(require("@ledgerhq/live-common/hw/uninstallApp"));
|
|
14
|
+
const getAppsCatalogForDevice_1 = require("@ledgerhq/live-common/device/use-cases/getAppsCatalogForDevice");
|
|
15
|
+
const polyfill_1 = require("@ledgerhq/live-common/apps/polyfill");
|
|
16
|
+
const scan_1 = require("../../scan");
|
|
42
17
|
exports.default = {
|
|
43
18
|
description: "Manage Ledger device's apps",
|
|
44
19
|
args: [
|
|
@@ -81,45 +56,36 @@ exports.default = {
|
|
|
81
56
|
desc: "close current application",
|
|
82
57
|
},
|
|
83
58
|
],
|
|
84
|
-
job:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (!app) {
|
|
116
|
-
throw new Error("application '" + application + "' not found");
|
|
117
|
-
}
|
|
118
|
-
return (0, installApp_1.default)(t, targetId, app);
|
|
119
|
-
})), false));
|
|
120
|
-
}));
|
|
121
|
-
}), verbose ? (0, operators_1.map)(function (a) { return a; }) : (0, operators_1.ignoreElements)());
|
|
122
|
-
});
|
|
123
|
-
},
|
|
59
|
+
job: ({ device, verbose, install, uninstall, open, quit, debug }) => (0, deviceAccess_1.withDevice)(device || "")(t => {
|
|
60
|
+
if (quit)
|
|
61
|
+
return (0, rxjs_1.from)((0, quitApp_1.default)(t));
|
|
62
|
+
if (open)
|
|
63
|
+
return (0, rxjs_1.from)((0, openApp_1.default)(t, (0, scan_1.inferManagerApp)(open)));
|
|
64
|
+
if (debug)
|
|
65
|
+
return (0, rxjs_1.from)((0, getDeviceInfo_1.default)(t)).pipe((0, operators_1.mergeMap)((deviceInfo) => (0, rxjs_1.from)((0, getAppsCatalogForDevice_1.getAppsCatalogForDevice)(deviceInfo)).pipe((0, operators_1.mergeMap)(list => {
|
|
66
|
+
const app = list.find(item => item.versionName.toLowerCase() === (0, scan_1.inferManagerApp)(debug).toLowerCase());
|
|
67
|
+
if (!app) {
|
|
68
|
+
throw new Error("application '" + debug + "' not found");
|
|
69
|
+
}
|
|
70
|
+
return [app];
|
|
71
|
+
}))));
|
|
72
|
+
return (0, rxjs_1.from)((0, getDeviceInfo_1.default)(t)).pipe((0, operators_1.mergeMap)((deviceInfo) => (0, rxjs_1.from)((0, getAppsCatalogForDevice_1.getAppsCatalogForDevice)(deviceInfo)).pipe((0, operators_1.mergeMap)(v2List => (0, rxjs_1.concat)(...(uninstall || []).map(application => {
|
|
73
|
+
const { targetId } = deviceInfo;
|
|
74
|
+
const list = v2List.map(polyfill_1.mapApplicationV2ToApp);
|
|
75
|
+
const app = list.find(item => item.name.toLowerCase() === (0, scan_1.inferManagerApp)(application).toLowerCase());
|
|
76
|
+
if (!app) {
|
|
77
|
+
throw new Error("application '" + application + "' not found");
|
|
78
|
+
}
|
|
79
|
+
return (0, uninstallApp_1.default)(t, targetId, app);
|
|
80
|
+
}), ...(install || []).map(application => {
|
|
81
|
+
const { targetId } = deviceInfo;
|
|
82
|
+
const list = v2List.map(polyfill_1.mapApplicationV2ToApp);
|
|
83
|
+
const app = list.find(item => item.name.toLowerCase() === (0, scan_1.inferManagerApp)(application).toLowerCase());
|
|
84
|
+
if (!app) {
|
|
85
|
+
throw new Error("application '" + application + "' not found");
|
|
86
|
+
}
|
|
87
|
+
return (0, installApp_1.default)(t, targetId, app);
|
|
88
|
+
}))))), verbose ? (0, operators_1.map)(a => a) : (0, operators_1.ignoreElements)());
|
|
89
|
+
}),
|
|
124
90
|
};
|
|
125
91
|
//# sourceMappingURL=app.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/commands/device/app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/commands/device/app.ts"],"names":[],"mappings":";;;;;AAAA,+BAAoC;AACpC,8CAA+D;AAC/D,wEAAmE;AACnE,2FAAmE;AACnE,+EAAuD;AACvD,+EAAuD;AACvD,qFAA6D;AAC7D,yFAAiE;AACjE,4GAAyG;AACzG,kEAA4E;AAC5E,qCAA0E;AAa1E,kBAAe;IACb,WAAW,EAAE,6BAA6B;IAC1C,IAAI,EAAE;QACJ,gBAAS;QACT;YACE,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,qBAAqB;SAC5B;QACD;YACE,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,oCAAoC;YAC1C,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,sCAAsC;YAC5C,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,yCAAyC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C,WAAW,EAAE,CAC/E,CAAC;YAEF,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,MAAM,IAAI,KAAK,CAAC,eAAe,GAAG,WAAW,GAAG,aAAa,CAAC,CAAC;YACjE,CAAC;YAED,OAAO,IAAA,oBAAU,EAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;QACtC,CAAC,CAAC,CACH,CACF,CACF,CACF,EACD,OAAO,CAAC,CAAC,CAAC,IAAA,eAAG,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,0BAAc,GAAE,CACzC,CAAC;IACJ,CAAC,CAAC;CACL,CAAC"}
|
|
@@ -9,7 +9,7 @@ declare const _default: {
|
|
|
9
9
|
descOpt: string;
|
|
10
10
|
desc: string;
|
|
11
11
|
}[];
|
|
12
|
-
job: ({ device }: AppsUninstallAllJobOpts) => import("rxjs").Observable<string | import("@ledgerhq/live-common/apps/
|
|
12
|
+
job: ({ device }: AppsUninstallAllJobOpts) => import("rxjs").Observable<string | import("@ledgerhq/live-common/apps/index").State>;
|
|
13
13
|
};
|
|
14
14
|
export default _default;
|
|
15
15
|
//# sourceMappingURL=appUninstallAll.d.ts.map
|
|
@@ -4,37 +4,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
/* eslint-disable no-console */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
const rxjs_1 = require("rxjs");
|
|
8
|
+
const operators_1 = require("rxjs/operators");
|
|
9
|
+
const deviceAccess_1 = require("@ledgerhq/live-common/hw/deviceAccess");
|
|
10
|
+
const getDeviceInfo_1 = __importDefault(require("@ledgerhq/live-common/hw/getDeviceInfo"));
|
|
11
|
+
const index_1 = require("@ledgerhq/live-common/apps/index");
|
|
12
|
+
const listAppsUseCase_1 = require("@ledgerhq/live-common/device/use-cases/listAppsUseCase");
|
|
13
|
+
const execWithTransport_1 = require("@ledgerhq/live-common/device/use-cases/execWithTransport");
|
|
14
|
+
const uninstallAllApps_1 = require("@ledgerhq/live-common/hw/uninstallAllApps");
|
|
15
|
+
const scan_1 = require("../../scan");
|
|
16
16
|
exports.default = {
|
|
17
17
|
description: "uninstall all apps in the device",
|
|
18
18
|
args: [scan_1.deviceOpt],
|
|
19
|
-
job:
|
|
20
|
-
|
|
21
|
-
return (0,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
});
|
|
33
|
-
}), (0, operators_1.mergeMap)(function (s) { return (0, index_1.runAll)(s, exec); }));
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
}));
|
|
37
|
-
});
|
|
38
|
-
},
|
|
19
|
+
job: ({ device }) => (0, deviceAccess_1.withDevice)(device || "")(t => {
|
|
20
|
+
const exec = (0, execWithTransport_1.execWithTransport)(t);
|
|
21
|
+
return (0, rxjs_1.from)((0, uninstallAllApps_1.command)(t)).pipe((0, operators_1.mergeMap)((res) => {
|
|
22
|
+
if (res) {
|
|
23
|
+
return (0, rxjs_1.from)(["Uninstalled using bulk mode"]);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return (0, rxjs_1.from)((0, getDeviceInfo_1.default)(t)).pipe((0, operators_1.mergeMap)(deviceInfo => (0, listAppsUseCase_1.listAppsUseCase)(t, deviceInfo).pipe((0, operators_1.filter)(e => e.type === "result"), (0, operators_1.map)((e) => (0, index_1.reducer)(e.result, {
|
|
27
|
+
type: "wipe",
|
|
28
|
+
})), (0, operators_1.mergeMap)(s => (0, index_1.runAll)(s, exec)))));
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
}),
|
|
39
32
|
};
|
|
40
33
|
//# sourceMappingURL=appUninstallAll.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appUninstallAll.js","sourceRoot":"","sources":["../../../src/commands/device/appUninstallAll.ts"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B
|
|
1
|
+
{"version":3,"file":"appUninstallAll.js","sourceRoot":"","sources":["../../../src/commands/device/appUninstallAll.ts"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,+BAA4B;AAC5B,8CAAuD;AACvD,wEAAmE;AACnE,2FAAmE;AACnE,4DAAmE;AACnE,4FAAyF;AACzF,gGAA6F;AAC7F,gFAAwF;AACxF,qCAAyD;AAIzD,kBAAe;IACb,WAAW,EAAE,kCAAkC;IAC/C,IAAI,EAAE,CAAC,gBAAS,CAAC;IACjB,GAAG,EAAE,CAAC,EAAE,MAAM,EAA2B,EAAE,EAAE,CAC3C,IAAA,yBAAU,EAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE;QAC3B,MAAM,IAAI,GAAG,IAAA,qCAAiB,EAAC,CAAC,CAAC,CAAC;QAClC,OAAO,IAAA,WAAI,EAAC,IAAA,0BAAgB,EAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CACnC,IAAA,oBAAQ,EAAC,CAAC,GAAY,EAAE,EAAE;YACxB,IAAI,GAAG,EAAE,CAAC;gBACR,OAAO,IAAA,WAAI,EAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC;YAC/C,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAA,WAAI,EAAC,IAAA,uBAAa,EAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAChC,IAAA,oBAAQ,EAAC,UAAU,CAAC,EAAE,CACpB,IAAA,iCAAe,EAAC,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CACjC,IAAA,kBAAM,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,EAChC,IAAA,eAA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