@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,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const operators_1 = require("rxjs/operators");
|
|
4
|
+
const satstack_1 = require("@ledgerhq/live-common/families/bitcoin/satstack");
|
|
5
|
+
const live_env_1 = require("@ledgerhq/live-env");
|
|
6
6
|
exports.default = {
|
|
7
7
|
description: "Check StackSats status",
|
|
8
8
|
args: [
|
|
@@ -12,8 +12,7 @@ exports.default = {
|
|
|
12
12
|
desc: "enable status polling",
|
|
13
13
|
},
|
|
14
14
|
],
|
|
15
|
-
job:
|
|
16
|
-
var continuous = _a.continuous;
|
|
15
|
+
job: ({ continuous }) => {
|
|
17
16
|
(0, live_env_1.setEnv)("SATSTACK", true);
|
|
18
17
|
if (!continuous) {
|
|
19
18
|
return satstack_1.statusObservable.pipe((0, operators_1.first)());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"satstackStatus.js","sourceRoot":"","sources":["../../../src/commands/blockchain/satstackStatus.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"satstackStatus.js","sourceRoot":"","sources":["../../../src/commands/blockchain/satstackStatus.ts"],"names":[],"mappings":";;AAAA,8CAAuC;AACvC,8EAAmF;AACnF,iDAA4C;AAI5C,kBAAe;IACb,WAAW,EAAE,wBAAwB;IACrC,IAAI,EAAE;QACJ;YACE,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,uBAAuB;SAC9B;KACF;IACD,GAAG,EAAE,CAAC,EAAE,UAAU,EAAyB,EAAE,EAAE;QAC7C,IAAA,iBAAM,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAEzB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,2BAAgB,CAAC,IAAI,CAAC,IAAA,iBAAK,GAAE,CAAC,CAAC;QACxC,CAAC;QAED,OAAO,2BAAgB,CAAC;IAC1B,CAAC;CACF,CAAC"}
|
|
@@ -3,27 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const scan_1 = require("../../scan");
|
|
7
|
+
const index_1 = require("@ledgerhq/live-common/currencies/index");
|
|
8
|
+
const descriptor_1 = require("@ledgerhq/coin-bitcoin/descriptor");
|
|
9
|
+
const hw_app_btc_1 = __importDefault(require("@ledgerhq/hw-app-btc"));
|
|
10
|
+
const rxjs_1 = require("rxjs");
|
|
11
|
+
const deviceAccess_1 = require("@ledgerhq/live-common/hw/deviceAccess");
|
|
12
12
|
function requiredCurrency(c) {
|
|
13
13
|
if (!c)
|
|
14
14
|
throw new Error("could not find currency");
|
|
15
15
|
return c;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
return function (deviceId, currency, fn) {
|
|
19
|
-
return (0, rxjs_1.firstValueFrom)((0, deviceAccess_1.withDevice)(deviceId)(function (transport) { return (0, rxjs_1.from)(fn(new hw_app_btc_1.default({ transport: transport, currency: currency.id }))); }));
|
|
20
|
-
};
|
|
21
|
-
};
|
|
17
|
+
const createBitcoinSignerContext = () => (deviceId, currency, fn) => (0, rxjs_1.firstValueFrom)((0, deviceAccess_1.withDevice)(deviceId)(transport => (0, rxjs_1.from)(fn(new hw_app_btc_1.default({ transport, currency: currency.id })))));
|
|
22
18
|
exports.default = {
|
|
23
19
|
description: "Synchronize accounts with blockchain",
|
|
24
20
|
args: [scan_1.deviceOpt, scan_1.currencyOpt],
|
|
25
|
-
job:
|
|
26
|
-
return (0, descriptor_1.scanDescriptors)(opts.device || "", requiredCurrency((0, index_1.findCryptoCurrencyByKeyword)(opts.currency || "bitcoin")), createBitcoinSignerContext());
|
|
27
|
-
},
|
|
21
|
+
job: (opts) => (0, descriptor_1.scanDescriptors)(opts.device || "", requiredCurrency((0, index_1.findCryptoCurrencyByKeyword)(opts.currency || "bitcoin")), createBitcoinSignerContext()),
|
|
28
22
|
};
|
|
29
23
|
//# sourceMappingURL=scanDescriptors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanDescriptors.js","sourceRoot":"","sources":["../../../src/commands/blockchain/scanDescriptors.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"scanDescriptors.js","sourceRoot":"","sources":["../../../src/commands/blockchain/scanDescriptors.ts"],"names":[],"mappings":";;;;;AAAA,qCAA0F;AAC1F,kEAAqF;AACrF,kEAAoE;AAEpE,sEAAuC;AACvC,+BAA4C;AAC5C,wEAAmE;AAGnE,SAAS,gBAAgB,CAAC,CAAoC;IAC5D,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,0BAA0B,GAC9B,GAAkB,EAAE,CACpB,CAAI,QAAgB,EAAE,QAAwB,EAAE,EAA+B,EAAc,EAAE,CAC7F,IAAA,qBAAc,EACZ,IAAA,yBAAU,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,IAAA,WAAI,EAAC,EAAE,CAAC,IAAI,oBAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAC3F,CAAC;AAIN,kBAAe;IACb,WAAW,EAAE,sCAAsC;IACnD,IAAI,EAAE,CAAC,gBAAS,EAAE,kBAAW,CAAC;IAC9B,GAAG,EAAE,CAAC,IAA4B,EAAE,EAAE,CACpC,IAAA,4BAAe,EACb,IAAI,CAAC,MAAM,IAAI,EAAE,EACjB,gBAAgB,CAAC,IAAA,mCAA2B,EAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,CAAC,CAAC,EACzE,0BAA0B,EAAE,CAC7B;CACJ,CAAC"}
|
|
@@ -1,41 +1,18 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
3
|
+
const rxjs_1 = require("rxjs");
|
|
4
|
+
const operators_1 = require("rxjs/operators");
|
|
5
|
+
const live_env_1 = require("@ledgerhq/live-env");
|
|
6
|
+
const index_1 = require("@ledgerhq/live-common/bridge/index");
|
|
7
|
+
const index_2 = require("@ledgerhq/live-common/account/index");
|
|
8
|
+
const index_3 = require("@ledgerhq/live-common/transaction/index");
|
|
9
|
+
const scan_1 = require("../../scan");
|
|
10
|
+
const transaction_1 = require("../../transaction");
|
|
36
11
|
exports.default = {
|
|
37
12
|
description: "Send crypto-assets",
|
|
38
|
-
args:
|
|
13
|
+
args: [
|
|
14
|
+
...scan_1.scanCommonOpts,
|
|
15
|
+
...transaction_1.inferTransactionsOpts,
|
|
39
16
|
{
|
|
40
17
|
name: "ignore-errors",
|
|
41
18
|
type: Boolean,
|
|
@@ -51,63 +28,57 @@ exports.default = {
|
|
|
51
28
|
type: String,
|
|
52
29
|
desc: "default | json | silent",
|
|
53
30
|
},
|
|
54
|
-
],
|
|
55
|
-
job:
|
|
56
|
-
|
|
57
|
-
?
|
|
58
|
-
:
|
|
59
|
-
return (0, scan_1.scan)(opts).pipe((0, operators_1.tap)(
|
|
60
|
-
l(
|
|
61
|
-
}), (0, operators_1.switchMap)(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
31
|
+
],
|
|
32
|
+
job: (opts) => {
|
|
33
|
+
const l = opts.format !== "json" && opts.format !== "silent" // eslint-disable-next-line no-console
|
|
34
|
+
? (l) => console.log(l)
|
|
35
|
+
: (_l) => { };
|
|
36
|
+
return (0, scan_1.scan)(opts).pipe((0, operators_1.tap)(account => {
|
|
37
|
+
l(`→ FROM ${(0, index_2.formatAccount)(account, "basic")}`);
|
|
38
|
+
}), (0, operators_1.switchMap)(account => (0, rxjs_1.from)((0, transaction_1.inferTransactions)(account, opts)).pipe((0, operators_1.concatMap)(inferred => inferred.reduce((acc, [t, status]) => (0, rxjs_1.concat)(acc, (0, rxjs_1.from)((0, rxjs_1.defer)(() => {
|
|
39
|
+
l(`✔️ transaction ${(0, index_3.formatTransaction)(t, account)}`);
|
|
40
|
+
l(`STATUS ${(0, index_3.formatTransactionStatus)(t, status, account)}`);
|
|
41
|
+
const bridge = (0, index_1.getAccountBridge)(account);
|
|
42
|
+
return bridge
|
|
43
|
+
.signOperation({
|
|
44
|
+
account,
|
|
45
|
+
transaction: t,
|
|
46
|
+
deviceId: opts.device || "",
|
|
47
|
+
})
|
|
48
|
+
.pipe((0, operators_1.map)(index_3.toSignOperationEventRaw),
|
|
49
|
+
// @ts-expect-error more voodoo stuff
|
|
50
|
+
...(opts["disable-broadcast"] || (0, live_env_1.getEnv)("DISABLE_TRANSACTION_BROADCAST")
|
|
51
|
+
? []
|
|
52
|
+
: [
|
|
53
|
+
(0, operators_1.concatMap)((e) => {
|
|
54
|
+
if (e.type === "signed") {
|
|
55
|
+
l(`✔️ has been signed! ${JSON.stringify(e.signedOperation)}`);
|
|
56
|
+
return (0, rxjs_1.from)(bridge
|
|
57
|
+
.broadcast({
|
|
58
|
+
account,
|
|
59
|
+
signedOperation: e.signedOperation,
|
|
60
|
+
})
|
|
61
|
+
.then(op => {
|
|
62
|
+
l(`✔️ broadcasted! optimistic operation: ${(0, index_2.formatOperation)(account)(
|
|
63
|
+
// @ts-expect-error we are supposed to give an OperationRaw and yet it's an Operation
|
|
64
|
+
(0, index_2.fromOperationRaw)(op, account.id))}`);
|
|
65
|
+
return op;
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
return (0, rxjs_1.of)(e);
|
|
69
|
+
}),
|
|
70
|
+
]), ...(opts["ignore-errors"]
|
|
71
|
+
? [
|
|
72
|
+
(0, operators_1.catchError)(e => {
|
|
73
|
+
return (0, rxjs_1.of)({
|
|
74
|
+
type: "error",
|
|
75
|
+
error: e,
|
|
73
76
|
transaction: t,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
(0, operators_1.concatMap)(function (e) {
|
|
80
|
-
if (e.type === "signed") {
|
|
81
|
-
l("\u2714\uFE0F has been signed! ".concat(JSON.stringify(e.signedOperation)));
|
|
82
|
-
return (0, rxjs_1.from)(bridge
|
|
83
|
-
.broadcast({
|
|
84
|
-
account: account,
|
|
85
|
-
signedOperation: e.signedOperation,
|
|
86
|
-
})
|
|
87
|
-
.then(function (op) {
|
|
88
|
-
l("\u2714\uFE0F broadcasted! optimistic operation: ".concat((0, index_2.formatOperation)(account)(
|
|
89
|
-
// @ts-expect-error we are supposed to give an OperationRaw and yet it's an Operation
|
|
90
|
-
(0, index_2.fromOperationRaw)(op, account.id))));
|
|
91
|
-
return op;
|
|
92
|
-
}));
|
|
93
|
-
}
|
|
94
|
-
return (0, rxjs_1.of)(e);
|
|
95
|
-
}),
|
|
96
|
-
])), false), __read((opts["ignore-errors"]
|
|
97
|
-
? [
|
|
98
|
-
(0, operators_1.catchError)(function (e) {
|
|
99
|
-
return (0, rxjs_1.of)({
|
|
100
|
-
type: "error",
|
|
101
|
-
error: e,
|
|
102
|
-
transaction: t,
|
|
103
|
-
});
|
|
104
|
-
}),
|
|
105
|
-
]
|
|
106
|
-
: [])), false));
|
|
107
|
-
})));
|
|
108
|
-
}, rxjs_1.EMPTY);
|
|
109
|
-
}), (0, operators_1.mergeMap)(function (obj) { return (opts.format !== "json" ? rxjs_1.EMPTY : (0, rxjs_1.of)(JSON.stringify(obj))); }));
|
|
110
|
-
}));
|
|
77
|
+
});
|
|
78
|
+
}),
|
|
79
|
+
]
|
|
80
|
+
: []));
|
|
81
|
+
}))), rxjs_1.EMPTY)), (0, operators_1.mergeMap)(obj => (opts.format !== "json" ? rxjs_1.EMPTY : (0, rxjs_1.of)(JSON.stringify(obj)))))));
|
|
111
82
|
},
|
|
112
83
|
};
|
|
113
84
|
//# sourceMappingURL=send.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../../src/commands/blockchain/send.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../../src/commands/blockchain/send.ts"],"names":[],"mappings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,CAAC;wBAED,OAAO,IAAA,SAAE,EAAC,CAAC,CAAC,CAAC;oBACf,CAAC,CAAC;iBACH,CAAC,EACN,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC;gBACvB,CAAC,CAAC;oBACE,IAAA,sBAAU,EAAC,CAAC,CAAC,EAAE;wBACb,OAAO,IAAA,SAAE,EAAC;4BACR,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,CAAC;4BACR,WAAW,EAAE,CAAC;yBACf,CAAC,CAAC;oBACL,CAAC,CAAC;iBACH;gBACH,CAAC,CAAC,EAAE,CAAC,CACR,CAAC;QACN,CAAC,CAAC,CACH,CACF,EACH,YAAwB,CACzB,CACF,EACD,IAAA,oBAAQ,EAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,YAAK,CAAC,CAAC,CAAC,IAAA,SAAE,EAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAC5E,CACF,CACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -50,7 +50,7 @@ declare const _default: {
|
|
|
50
50
|
desc: string;
|
|
51
51
|
default: string;
|
|
52
52
|
})[];
|
|
53
|
-
job: (opts: SignMessageJobOpts) => import("rxjs").Observable<import("@ledgerhq/live-common/hw/signMessage/types").Result>;
|
|
53
|
+
job: (opts: SignMessageJobOpts) => import("rxjs").Observable<import("@ledgerhq/live-common/lib/hw/signMessage/types").Result>;
|
|
54
54
|
};
|
|
55
55
|
export default _default;
|
|
56
56
|
//# sourceMappingURL=signMessage.d.ts.map
|
|
@@ -22,44 +22,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
26
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
27
|
-
if (!m) return o;
|
|
28
|
-
var i = m.call(o), r, ar = [], e;
|
|
29
|
-
try {
|
|
30
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
31
|
-
}
|
|
32
|
-
catch (error) { e = { error: error }; }
|
|
33
|
-
finally {
|
|
34
|
-
try {
|
|
35
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
36
|
-
}
|
|
37
|
-
finally { if (e) throw e.error; }
|
|
38
|
-
}
|
|
39
|
-
return ar;
|
|
40
|
-
};
|
|
41
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
42
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
43
|
-
if (ar || !(i in from)) {
|
|
44
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
45
|
-
ar[i] = from[i];
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
49
|
-
};
|
|
50
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
51
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
52
27
|
};
|
|
53
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
29
|
+
const fs_1 = __importDefault(require("fs"));
|
|
30
|
+
const rxjs_1 = require("rxjs");
|
|
31
|
+
const operators_1 = require("rxjs/operators");
|
|
32
|
+
const deviceAccess_1 = require("@ledgerhq/live-common/hw/deviceAccess");
|
|
33
|
+
const index_1 = __importStar(require("@ledgerhq/live-common/hw/signMessage/index"));
|
|
34
|
+
const scan_1 = require("../../scan");
|
|
60
35
|
exports.default = {
|
|
61
36
|
description: "Sign a message with the device on specific derivations (advanced)",
|
|
62
|
-
args:
|
|
37
|
+
args: [
|
|
38
|
+
...scan_1.scanCommonOpts,
|
|
63
39
|
{
|
|
64
40
|
name: "path",
|
|
65
41
|
type: String,
|
|
@@ -76,24 +52,23 @@ exports.default = {
|
|
|
76
52
|
desc: "parser used for the message. Default: String",
|
|
77
53
|
default: "String",
|
|
78
54
|
},
|
|
79
|
-
],
|
|
80
|
-
job:
|
|
81
|
-
return (0, scan_1.scan)(opts).pipe((0, operators_1.switchMap)(
|
|
82
|
-
var _a, _b;
|
|
55
|
+
],
|
|
56
|
+
job: (opts) => {
|
|
57
|
+
return (0, scan_1.scan)(opts).pipe((0, operators_1.switchMap)(account => {
|
|
83
58
|
if (!account.currency) {
|
|
84
59
|
throw new Error("no currency provided");
|
|
85
60
|
}
|
|
86
|
-
switch (
|
|
61
|
+
switch (opts.parser?.toLowerCase()) {
|
|
87
62
|
case "file":
|
|
88
63
|
opts.message = fs_1.default.readFileSync(opts.message, "utf8");
|
|
89
64
|
break;
|
|
90
65
|
case "string":
|
|
91
66
|
default:
|
|
92
|
-
opts.message =
|
|
67
|
+
opts.message = opts.message?.toString();
|
|
93
68
|
break;
|
|
94
69
|
}
|
|
95
|
-
|
|
96
|
-
return (0, deviceAccess_1.withDevice)(opts.device || "")(
|
|
70
|
+
const preparedMessage = (0, index_1.prepareMessageToSign)(account, Buffer.from(opts.message).toString("hex"));
|
|
71
|
+
return (0, deviceAccess_1.withDevice)(opts.device || "")(t => (0, rxjs_1.from)((0, index_1.default)(t, account, preparedMessage)));
|
|
97
72
|
}));
|
|
98
73
|
},
|
|
99
74
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../src/commands/blockchain/signMessage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../src/commands/blockchain/signMessage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,+BAA4B;AAC5B,8CAA2C;AAC3C,wEAAmE;AACnE,oFAA+F;AAC/F,qCAAkE;AAQlE,kBAAe;IACb,WAAW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CAAC,CAAC;QAC5F,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,85 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
-
if (!m) return o;
|
|
52
|
-
var i = m.call(o), r, ar = [], e;
|
|
53
|
-
try {
|
|
54
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
-
}
|
|
56
|
-
catch (error) { e = { error: error }; }
|
|
57
|
-
finally {
|
|
58
|
-
try {
|
|
59
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
-
}
|
|
61
|
-
finally { if (e) throw e.error; }
|
|
62
|
-
}
|
|
63
|
-
return ar;
|
|
64
|
-
};
|
|
65
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
66
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
67
|
-
if (ar || !(i in from)) {
|
|
68
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
69
|
-
ar[i] = from[i];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
73
|
-
};
|
|
74
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
3
|
+
const operators_1 = require("rxjs/operators");
|
|
4
|
+
const index_1 = require("@ledgerhq/live-common/account/index");
|
|
5
|
+
const index_2 = require("@ledgerhq/live-common/currencies/index");
|
|
6
|
+
const index_3 = require("@ledgerhq/live-common/bridge/index");
|
|
7
|
+
const scan_1 = require("../../scan");
|
|
80
8
|
exports.default = {
|
|
81
9
|
description: "Synchronize accounts with blockchain",
|
|
82
|
-
args:
|
|
10
|
+
args: [
|
|
11
|
+
...scan_1.scanCommonOpts,
|
|
83
12
|
{
|
|
84
13
|
name: "format",
|
|
85
14
|
alias: "f",
|
|
@@ -87,47 +16,25 @@ exports.default = {
|
|
|
87
16
|
typeDesc: Object.keys(index_1.accountFormatters).join(" | "),
|
|
88
17
|
desc: "how to display the data",
|
|
89
18
|
},
|
|
90
|
-
],
|
|
91
|
-
job:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
case 0: return [4 /*yield*/, nftResolvers.nftMetadata({
|
|
111
|
-
contract: nft.contract,
|
|
112
|
-
tokenId: nft.tokenId,
|
|
113
|
-
currencyId: nft.currencyId,
|
|
114
|
-
})];
|
|
115
|
-
case 1:
|
|
116
|
-
metadata = (_a.sent()).result;
|
|
117
|
-
return [2 /*return*/, __assign(__assign({}, nft), { metadata: metadata })];
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}); })).catch(function () { return account.nfts; })];
|
|
121
|
-
case 1:
|
|
122
|
-
_a = __assign.apply(void 0, _b.concat([(_c.nfts = _e.sent(), _c)]));
|
|
123
|
-
return [3 /*break*/, 3];
|
|
124
|
-
case 2:
|
|
125
|
-
_a = account;
|
|
126
|
-
_e.label = 3;
|
|
127
|
-
case 3: return [2 /*return*/, _a];
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}); }), (0, operators_1.map)(function (account) { return (index_1.accountFormatters[opts.format] || index_1.accountFormatters.default)(account); }));
|
|
131
|
-
},
|
|
19
|
+
],
|
|
20
|
+
job: (opts) => (0, scan_1.scan)(opts).pipe((0, operators_1.switchMap)(async (account) => {
|
|
21
|
+
const { currencyId } = (0, index_1.decodeAccountId)(account.id);
|
|
22
|
+
const currency = (0, index_2.getCryptoCurrencyById)(currencyId);
|
|
23
|
+
const currencyBridge = (0, index_3.getCurrencyBridge)(currency);
|
|
24
|
+
const { nftResolvers } = currencyBridge;
|
|
25
|
+
return account.nfts?.length && nftResolvers?.nftMetadata
|
|
26
|
+
? {
|
|
27
|
+
...account,
|
|
28
|
+
nfts: await Promise.all(account.nfts.map(async (nft) => {
|
|
29
|
+
const { result: metadata } = await nftResolvers.nftMetadata({
|
|
30
|
+
contract: nft.contract,
|
|
31
|
+
tokenId: nft.tokenId,
|
|
32
|
+
currencyId: nft.currencyId,
|
|
33
|
+
});
|
|
34
|
+
return { ...nft, metadata };
|
|
35
|
+
})).catch(() => account.nfts),
|
|
36
|
+
}
|
|
37
|
+
: account;
|
|
38
|
+
}), (0, operators_1.map)(account => (index_1.accountFormatters[opts.format] || index_1.accountFormatters.default)(account))),
|
|
132
39
|
};
|
|
133
40
|
//# sourceMappingURL=sync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/blockchain/sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/blockchain/sync.ts"],"names":[],"mappings":";;AAAA,8CAAgD;AAChD,+DAAyF;AACzF,kEAA+E;AAC/E,8DAAuE;AACvE,qCAAkD;AAOlD,kBAAe;IACb,WAAW,EAAE,sCAAsC;IACnD,IAAI,EAAE;QACJ,GAAG,qBAAc;QACjB;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,yBAAiB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YACpD,IAAI,EAAE,yBAAyB;SAChC;KACF;IACD,GAAG,EAAE,CAAC,IAAiB,EAAE,EAAE,CACzB,IAAA,WAAI,EAAC,IAAI,CAAC,CAAC,IAAI,CACb,IAAA,qBAAS,EAAC,KAAK,EAAC,OAAO,EAAC,EAAE;QACxB,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,uBAAe,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,IAAA,6BAAqB,EAAC,UAAU,CAAC,CAAC;QACnD,MAAM,cAAc,GAAG,IAAA,yBAAiB,EAAC,QAAQ,CAAC,CAAC;QACnD,MAAM,EAAE,YAAY,EAAE,GAAG,cAAc,CAAC;QAExC,OAAO,OAAO,CAAC,IAAI,EAAE,MAAM,IAAI,YAAY,EAAE,WAAW;YACtD,CAAC,CAAC;gBACE,GAAG,OAAO;gBACV,IAAI,EAAE,MAAM,OAAO,CAAC,GAAG,CACrB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAC,GAAG,EAAC,EAAE;oBAC3B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,YAAY,CAAC,WAAW,CAAC;wBAC1D,QAAQ,EAAE,GAAG,CAAC,QAAQ;wBACtB,OAAO,EAAE,GAAG,CAAC,OAAO;wBACpB,UAAU,EAAE,GAAG,CAAC,UAAU;qBAC3B,CAAC,CAAC;oBAEH,OAAO,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,CAAC;gBAC9B,CAAC,CAAC,CACH,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;aAC5B;YACH,CAAC,CAAC,OAAO,CAAC;IACd,CAAC,CAAC,EACF,IAAA,eAAG,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,yBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,yBAAiB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CACvF;CACJ,CAAC"}
|
|
@@ -1,57 +1,24 @@
|
|
|
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
|
-
|
|
6
|
+
const toPairs_1 = __importDefault(require("lodash/toPairs"));
|
|
7
|
+
const flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
8
|
+
const groupBy_1 = __importDefault(require("lodash/groupBy"));
|
|
9
|
+
const rxjs_1 = require("rxjs");
|
|
10
|
+
const operators_1 = require("rxjs/operators");
|
|
11
|
+
const index_1 = require("@ledgerhq/live-common/account/index");
|
|
12
|
+
const scan_1 = require("../../scan");
|
|
38
13
|
exports.default = {
|
|
39
14
|
description: "Detect operation collisions",
|
|
40
|
-
args:
|
|
41
|
-
job:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})
|
|
49
|
-
.map(function (_a) {
|
|
50
|
-
var _b = __read(_a, 2), _ = _b[0], coll = _b[1];
|
|
51
|
-
return coll;
|
|
52
|
-
});
|
|
53
|
-
return (0, rxjs_1.from)(operationIdCollisions);
|
|
54
|
-
}));
|
|
55
|
-
},
|
|
15
|
+
args: [...scan_1.scanCommonOpts],
|
|
16
|
+
job: (opts) => (0, scan_1.scan)(opts).pipe((0, operators_1.reduce)((all, a) => all.concat(a), []), (0, operators_1.concatMap)(accounts => {
|
|
17
|
+
const allOps = (0, flatMap_1.default)((0, index_1.flattenAccounts)(accounts), a => a.operations);
|
|
18
|
+
const operationIdCollisions = (0, toPairs_1.default)((0, groupBy_1.default)(allOps, "id"))
|
|
19
|
+
.filter(([_, coll]) => coll.length > 1)
|
|
20
|
+
.map(([_, coll]) => coll);
|
|
21
|
+
return (0, rxjs_1.from)(operationIdCollisions);
|
|
22
|
+
})),
|
|
56
23
|
};
|
|
57
24
|
//# sourceMappingURL=testDetectOpCollision.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testDetectOpCollision.js","sourceRoot":"","sources":["../../../src/commands/blockchain/testDetectOpCollision.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testDetectOpCollision.js","sourceRoot":"","sources":["../../../src/commands/blockchain/testDetectOpCollision.ts"],"names":[],"mappings":";;;;;AAAA,6DAAqC;AACrC,6DAAqC;AACrC,6DAAqC;AACrC,+BAA4B;AAC5B,8CAAmD;AACnD,+DAAsE;AACtE,qCAAkD;AAMlD,kBAAe;IACb,WAAW,EAAE,6BAA6B;IAC1C,IAAI,EAAE,CAAC,GAAG,qBAAc,CAAC;IACzB,GAAG,EAAE,CAAC,IAAkC,EAAE,EAAE,CAC1C,IAAA,WAAI,EAAC,IAAI,CAAC,CAAC,IAAI,CACb,IAAA,kBAAM,EAAC,CAAC,GAAc,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAChD,IAAA,qBAAS,EAAC,QAAQ,CAAC,EAAE;QACnB,MAAM,MAAM,GAAG,IAAA,iBAAO,EAAC,IAAA,uBAAe,EAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QACrE,MAAM,qBAAqB,GAAG,IAAA,iBAAO,EAAC,IAAA,iBAAO,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;aACzD,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;aACtC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;QAC5B,OAAO,IAAA,WAAI,EAAC,qBAAqB,CAAC,CAAC;IACrC,CAAC,CAAC,CACH;CACJ,CAAC"}
|