@ledgerhq/live-cli 24.10.3-nightly.0 → 24.10.3-nightly.1
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,46 +1,10 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
3
|
+
const index_1 = require("@ledgerhq/ledger-key-ring-protocol/index");
|
|
4
|
+
const hw_ledger_key_ring_protocol_1 = require("@ledgerhq/hw-ledger-key-ring-protocol");
|
|
5
|
+
const deviceAccess_1 = require("@ledgerhq/live-common/hw/deviceAccess");
|
|
6
|
+
const live_env_1 = require("@ledgerhq/live-env");
|
|
7
|
+
const scan_1 = require("../../scan");
|
|
44
8
|
exports.default = {
|
|
45
9
|
description: "Ledger Key Ring Protocol command",
|
|
46
10
|
args: [
|
|
@@ -129,69 +93,65 @@ exports.default = {
|
|
|
129
93
|
desc: "api base url for Ledger Key Ring Protocol",
|
|
130
94
|
},
|
|
131
95
|
],
|
|
132
|
-
job:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (getKeyRingTree) {
|
|
152
|
-
if (!pubKey || !privateKey) {
|
|
153
|
-
return [2 /*return*/, Promise.reject("pubKey and privateKey are required")];
|
|
154
|
-
}
|
|
155
|
-
return [2 /*return*/, sdk
|
|
156
|
-
.getOrCreateTrustchain(device || "", { pubkey: pubKey, privatekey: privateKey })
|
|
157
|
-
.then(function (result) { return result.trustchain; })];
|
|
158
|
-
}
|
|
159
|
-
if (getMembers || restoreKeyRingTree || destroyKeyRingTree) {
|
|
160
|
-
if (!pubKey || !privateKey)
|
|
161
|
-
return [2 /*return*/, Promise.reject("pubKey and privateKey are required")];
|
|
162
|
-
if (!rootId)
|
|
163
|
-
return [2 /*return*/, Promise.reject("rootId is required")];
|
|
164
|
-
if (!walletSyncEncryptionKey)
|
|
165
|
-
return [2 /*return*/, Promise.reject("walletSyncEncryptionKey is required")];
|
|
166
|
-
if (!applicationPath)
|
|
167
|
-
return [2 /*return*/, Promise.reject("applicationPath is required")];
|
|
168
|
-
sdkMethod = getMembers
|
|
169
|
-
? "getMembers"
|
|
170
|
-
: restoreKeyRingTree
|
|
171
|
-
? "restoreTrustchain"
|
|
172
|
-
: "destroyTrustchain";
|
|
173
|
-
return [2 /*return*/, sdk[sdkMethod]({ rootId: rootId, walletSyncEncryptionKey: walletSyncEncryptionKey, applicationPath: applicationPath }, { pubkey: pubKey, privatekey: privateKey })];
|
|
96
|
+
job: async ({ device, initMemberCredentials, getKeyRingTree, encryptUserData, decryptUserData, getMembers, restoreKeyRingTree, destroyKeyRingTree, pubKey, privateKey, rootId, walletSyncEncryptionKey, applicationPath, message, applicationId = 16, name = "CLI", apiBaseUrl = (0, live_env_1.getEnv)("TRUSTCHAIN_API_STAGING"), }) => {
|
|
97
|
+
if (!applicationId)
|
|
98
|
+
return Promise.reject("applicationId is required");
|
|
99
|
+
if (!name)
|
|
100
|
+
return Promise.reject("name is required");
|
|
101
|
+
if (!apiBaseUrl)
|
|
102
|
+
return Promise.reject("apiBaseUrl is required");
|
|
103
|
+
const context = {
|
|
104
|
+
applicationId,
|
|
105
|
+
name,
|
|
106
|
+
apiBaseUrl,
|
|
107
|
+
};
|
|
108
|
+
const sdk = (0, index_1.getSdk)(false, context, deviceAccess_1.withDevice);
|
|
109
|
+
if (initMemberCredentials) {
|
|
110
|
+
return sdk.initMemberCredentials();
|
|
111
|
+
}
|
|
112
|
+
if (getKeyRingTree) {
|
|
113
|
+
if (!pubKey || !privateKey) {
|
|
114
|
+
return Promise.reject("pubKey and privateKey are required");
|
|
174
115
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
116
|
+
return sdk
|
|
117
|
+
.getOrCreateTrustchain(device || "", { pubkey: pubKey, privatekey: privateKey })
|
|
118
|
+
.then(result => result.trustchain);
|
|
119
|
+
}
|
|
120
|
+
if (getMembers || restoreKeyRingTree || destroyKeyRingTree) {
|
|
121
|
+
if (!pubKey || !privateKey)
|
|
122
|
+
return Promise.reject("pubKey and privateKey are required");
|
|
123
|
+
if (!rootId)
|
|
124
|
+
return Promise.reject("rootId is required");
|
|
125
|
+
if (!walletSyncEncryptionKey)
|
|
126
|
+
return Promise.reject("walletSyncEncryptionKey is required");
|
|
127
|
+
if (!applicationPath)
|
|
128
|
+
return Promise.reject("applicationPath is required");
|
|
129
|
+
const sdkMethod = getMembers
|
|
130
|
+
? "getMembers"
|
|
131
|
+
: restoreKeyRingTree
|
|
132
|
+
? "restoreTrustchain"
|
|
133
|
+
: "destroyTrustchain";
|
|
134
|
+
return sdk[sdkMethod]({ rootId, walletSyncEncryptionKey, applicationPath }, { pubkey: pubKey, privatekey: privateKey });
|
|
135
|
+
}
|
|
136
|
+
if (encryptUserData || decryptUserData) {
|
|
137
|
+
if (!rootId)
|
|
138
|
+
return Promise.reject("rootId is required");
|
|
139
|
+
if (!walletSyncEncryptionKey)
|
|
140
|
+
return Promise.reject("walletSyncEncryptionKey is required");
|
|
141
|
+
if (!applicationPath)
|
|
142
|
+
return Promise.reject("applicationPath is required");
|
|
143
|
+
if (!message)
|
|
144
|
+
return Promise.reject("message is required");
|
|
145
|
+
if (encryptUserData) {
|
|
146
|
+
return sdk
|
|
147
|
+
.encryptUserData({ rootId, walletSyncEncryptionKey, applicationPath }, new TextEncoder().encode(message))
|
|
148
|
+
.then(array => Buffer.from(array).toString("hex"));
|
|
192
149
|
}
|
|
193
|
-
return
|
|
194
|
-
|
|
195
|
-
|
|
150
|
+
return sdk
|
|
151
|
+
.decryptUserData({ rootId, walletSyncEncryptionKey, applicationPath }, hw_ledger_key_ring_protocol_1.crypto.from_hex(message))
|
|
152
|
+
.then(array => new TextDecoder().decode(array));
|
|
153
|
+
}
|
|
154
|
+
return Promise.reject("command does not exist");
|
|
155
|
+
},
|
|
196
156
|
};
|
|
197
157
|
//# sourceMappingURL=ledgerKeyRingProtocol.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ledgerKeyRingProtocol.js","sourceRoot":"","sources":["../../../src/commands/live/ledgerKeyRingProtocol.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ledgerKeyRingProtocol.js","sourceRoot":"","sources":["../../../src/commands/live/ledgerKeyRingProtocol.ts"],"names":[],"mappings":";;AAAA,oEAAkE;AAClE,uFAA+D;AAC/D,wEAAmE;AACnE,iDAA4C;AAC5C,qCAAyD;AAsBzD,kBAAe;IACb,WAAW,EAAE,kCAAkC;IAC/C,IAAI,EAAE;QACJ,gBAAS;QACT;YACE,IAAI,EAAE,uBAAuB;YAC7B,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,sDAAsD;SAC7D;QACD;YACE,IAAI,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ACd,EAAE,MAAM,EAAE,uBAAuB,EAAE,eAAe,EAAE,EACpD,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAClC;qBACA,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YACvD,CAAC;YACD,OAAO,GAAG;iBACP,eAAe,CACd,EAAE,MAAM,EAAE,uBAAuB,EAAE,eAAe,EAAE,EACpD,oCAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CACzB;iBACA,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACpD,CAAC;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAClD,CAAC;CACF,CAAC"}
|
|
@@ -22,48 +22,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
-
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;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
26
|
+
const index_1 = require("@ledgerhq/ledger-key-ring-protocol/index");
|
|
27
|
+
const index_2 = require("@ledgerhq/live-wallet/cloudsync/index");
|
|
28
|
+
const index_3 = __importStar(require("@ledgerhq/live-wallet/walletsync/index"));
|
|
29
|
+
const deviceAccess_1 = require("@ledgerhq/live-common/hw/deviceAccess");
|
|
30
|
+
const live_env_1 = require("@ledgerhq/live-env");
|
|
67
31
|
exports.default = {
|
|
68
32
|
description: "Ledger Sync command",
|
|
69
33
|
args: [
|
|
@@ -137,8 +101,7 @@ exports.default = {
|
|
|
137
101
|
desc: "api base url for Cloud Sync",
|
|
138
102
|
},
|
|
139
103
|
],
|
|
140
|
-
job:
|
|
141
|
-
var push = _a.push, pull = _a.pull, pubKey = _a.pubKey, privateKey = _a.privateKey, rootId = _a.rootId, walletSyncEncryptionKey = _a.walletSyncEncryptionKey, applicationPath = _a.applicationPath, data = _a.data, version = _a.version, _b = _a.applicationId, applicationId = _b === void 0 ? 16 : _b, _c = _a.name, name = _c === void 0 ? "CLI" : _c, _d = _a.apiBaseUrl, apiBaseUrl = _d === void 0 ? (0, live_env_1.getEnv)("TRUSTCHAIN_API_STAGING") : _d, _e = _a.cloudSyncApiBaseUrl, cloudSyncApiBaseUrl = _e === void 0 ? (0, live_env_1.getEnv)("CLOUD_SYNC_API_STAGING") : _e;
|
|
104
|
+
job: ({ push, pull, pubKey, privateKey, rootId, walletSyncEncryptionKey, applicationPath, data, version, applicationId = 16, name = "CLI", apiBaseUrl = (0, live_env_1.getEnv)("TRUSTCHAIN_API_STAGING"), cloudSyncApiBaseUrl = (0, live_env_1.getEnv)("CLOUD_SYNC_API_STAGING"), }) => {
|
|
142
105
|
if (!applicationId)
|
|
143
106
|
return "applicationId is required";
|
|
144
107
|
if (!name)
|
|
@@ -155,34 +118,31 @@ exports.default = {
|
|
|
155
118
|
return "applicationPath is required";
|
|
156
119
|
if (push && !data)
|
|
157
120
|
return "data is required";
|
|
158
|
-
|
|
159
|
-
applicationId
|
|
160
|
-
name
|
|
161
|
-
apiBaseUrl
|
|
121
|
+
const context = {
|
|
122
|
+
applicationId,
|
|
123
|
+
name,
|
|
124
|
+
apiBaseUrl,
|
|
162
125
|
};
|
|
163
|
-
|
|
164
|
-
|
|
126
|
+
const ledgerKeyRingProtocolSDK = (0, index_1.getSdk)(false, context, deviceAccess_1.withDevice);
|
|
127
|
+
const cloudSyncSDK = new index_2.CloudSyncSDK({
|
|
165
128
|
apiBaseUrl: cloudSyncApiBaseUrl,
|
|
166
129
|
slug: index_3.liveSlug,
|
|
167
130
|
schema: index_3.default.schema,
|
|
168
131
|
trustchainSdk: ledgerKeyRingProtocolSDK,
|
|
169
|
-
getCurrentVersion:
|
|
170
|
-
saveNewUpdate:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return [2 /*return*/];
|
|
174
|
-
});
|
|
175
|
-
}); },
|
|
132
|
+
getCurrentVersion: () => version || 1,
|
|
133
|
+
saveNewUpdate: async (event) => {
|
|
134
|
+
console.log(event);
|
|
135
|
+
},
|
|
176
136
|
});
|
|
177
137
|
if (push) {
|
|
178
138
|
return cloudSyncSDK
|
|
179
|
-
.push({ rootId
|
|
180
|
-
.then(
|
|
139
|
+
.push({ rootId, walletSyncEncryptionKey, applicationPath }, { pubkey: pubKey, privatekey: privateKey }, JSON.parse(data))
|
|
140
|
+
.then(result => JSON.stringify(result, null, 2));
|
|
181
141
|
}
|
|
182
142
|
if (pull) {
|
|
183
143
|
return cloudSyncSDK
|
|
184
|
-
.pull({ rootId
|
|
185
|
-
.then(
|
|
144
|
+
.pull({ rootId, walletSyncEncryptionKey, applicationPath }, { pubkey: pubKey, privatekey: privateKey })
|
|
145
|
+
.then(result => JSON.stringify(result, null, 2));
|
|
186
146
|
}
|
|
187
147
|
return "command does not exist";
|
|
188
148
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ledgerSync.js","sourceRoot":"","sources":["../../../src/commands/live/ledgerSync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ledgerS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AAE,gBAAQ;YACd,MAAM,EAAE,eAAU,CAAC,MAAM;YACzB,aAAa,EAAE,wBAAwB;YACvC,iBAAiB,EAAE,GAAG,EAAE,CAAC,OAAO,IAAI,CAAC;YACrC,aAAa,EAAE,KAAK,EAAE,KAA4B,EAAE,EAAE;gBACpD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;SACF,CAAC,CAAC;QAEH,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,YAAY;iBAChB,IAAI,CACH,EAAE,MAAM,EAAE,uBAAuB,EAAE,eAAe,EAAE,EACpD,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,EAC1C,IAAI,CAAC,KAAK,CAAC,IAAK,CAAa,CAC9B;iBACA,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACrD,CAAC;QAED,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,YAAY;iBAChB,IAAI,CACH,EAAE,MAAM,EAAE,uBAAuB,EAAE,eAAe,EAAE,EACpD,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,CAC3C;iBACA,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,wBAAwB,CAAC;IAClC,CAAC;CACF,CAAC"}
|
|
@@ -1,41 +1,17 @@
|
|
|
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
|
-
|
|
6
|
+
const rxjs_1 = require("rxjs");
|
|
7
|
+
const operators_1 = require("rxjs/operators");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const scan_1 = require("../../scan");
|
|
10
|
+
const serialization_1 = require("@ledgerhq/live-common/account/serialization");
|
|
36
11
|
exports.default = {
|
|
37
12
|
description: "utility for Ledger Live app.json file",
|
|
38
|
-
args:
|
|
13
|
+
args: [
|
|
14
|
+
...scan_1.scanCommonOpts,
|
|
39
15
|
{
|
|
40
16
|
name: "appjson",
|
|
41
17
|
type: String,
|
|
@@ -48,35 +24,33 @@ exports.default = {
|
|
|
48
24
|
type: Boolean,
|
|
49
25
|
desc: "add accounts to live data",
|
|
50
26
|
},
|
|
51
|
-
],
|
|
52
|
-
job:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
: {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
version: 1,
|
|
70
|
-
}); });
|
|
71
|
-
appjsondata.data.accounts = appjsondata.data.accounts.concat(append);
|
|
72
|
-
if (opts.appjson) {
|
|
73
|
-
fs_1.default.writeFileSync(opts.appjson, JSON.stringify(appjsondata), "utf-8");
|
|
74
|
-
return (0, rxjs_1.of)(append.length + " accounts added.");
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
return (0, rxjs_1.of)(JSON.stringify(appjsondata));
|
|
78
|
-
}
|
|
27
|
+
],
|
|
28
|
+
job: (opts) => (0, scan_1.scan)(opts).pipe((0, operators_1.reduce)((accounts, account) => accounts.concat(account), []), (0, operators_1.mergeMap)(accounts => {
|
|
29
|
+
const appjsondata = opts.appjson
|
|
30
|
+
? JSON.parse(fs_1.default.readFileSync(opts.appjson, "utf-8"))
|
|
31
|
+
: {
|
|
32
|
+
data: {
|
|
33
|
+
accounts: [],
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
if (typeof appjsondata.data.accounts === "string") {
|
|
37
|
+
return (0, rxjs_1.throwError)(() => new Error("encrypted ledger live data is not supported"));
|
|
38
|
+
}
|
|
39
|
+
const existingIds = appjsondata.data.accounts.map((a) => a.data.id);
|
|
40
|
+
const append = accounts
|
|
41
|
+
.filter(a => !existingIds.includes(a.id))
|
|
42
|
+
.map(account => ({
|
|
43
|
+
data: (0, serialization_1.toAccountRaw)(account),
|
|
44
|
+
version: 1,
|
|
79
45
|
}));
|
|
80
|
-
|
|
46
|
+
appjsondata.data.accounts = appjsondata.data.accounts.concat(append);
|
|
47
|
+
if (opts.appjson) {
|
|
48
|
+
fs_1.default.writeFileSync(opts.appjson, JSON.stringify(appjsondata), "utf-8");
|
|
49
|
+
return (0, rxjs_1.of)(append.length + " accounts added.");
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return (0, rxjs_1.of)(JSON.stringify(appjsondata));
|
|
53
|
+
}
|
|
54
|
+
})),
|
|
81
55
|
};
|
|
82
56
|
//# sourceMappingURL=liveData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveData.js","sourceRoot":"","sources":["../../../src/commands/live/liveData.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"liveData.js","sourceRoot":"","sources":["../../../src/commands/live/liveData.ts"],"names":[],"mappings":";;;;;AAAA,+BAAsC;AACtC,8CAAkD;AAClD,4CAAoB;AACpB,qCAAkD;AAElD,+EAA2E;AAS3E,kBAAe;IACb,WAAW,EAAE,uCAAuC;IACpD,IAAI,EAAE;QACJ,GAAG,qBAAc;QACjB;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,iCAAiC;SACxC;QACD;YACE,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,2BAA2B;SAClC;KACF;IACD,GAAG,EAAE,CAAC,IAAqB,EAAE,EAAE,CAC7B,IAAA,WAAI,EAAC,IAAI,CAAC,CAAC,IAAI,CACb,IAAA,kBAAM,EAAqB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,EAC/E,IAAA,oBAAQ,EAAC,QAAQ,CAAC,EAAE;QAClB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO;YAC9B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACpD,CAAC,CAAC;gBACE,IAAI,EAAE;oBACJ,QAAQ,EAAE,EAAE;iBACb;aACF,CAAC;QAEN,IAAI,OAAO,WA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