@ledgerhq/live-cli 24.10.3-nightly.3 → 24.11.0-next.0
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 +63 -33
- 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 +26 -22
- package/lib/commands/blockchain/botPortfolio.js.map +1 -1
- package/lib/commands/blockchain/botTransfer.js +392 -219
- package/lib/commands/blockchain/botTransfer.js.map +1 -1
- package/lib/commands/blockchain/broadcast.js +42 -11
- package/lib/commands/blockchain/broadcast.js.map +1 -1
- package/lib/commands/blockchain/confirmOp.js +52 -12
- package/lib/commands/blockchain/confirmOp.js.map +1 -1
- package/lib/commands/blockchain/derivation.js +33 -31
- package/lib/commands/blockchain/derivation.js.map +1 -1
- package/lib/commands/blockchain/estimateMaxSpendable.js +56 -27
- package/lib/commands/blockchain/estimateMaxSpendable.js.map +1 -1
- package/lib/commands/blockchain/generateTestScanAccounts.js +37 -29
- package/lib/commands/blockchain/generateTestScanAccounts.js.map +1 -1
- package/lib/commands/blockchain/generateTestTransaction.js +96 -70
- package/lib/commands/blockchain/generateTestTransaction.js.map +1 -1
- package/lib/commands/blockchain/getAddress.js +24 -20
- package/lib/commands/blockchain/getAddress.js.map +1 -1
- package/lib/commands/blockchain/getTransactionStatus.js +69 -31
- package/lib/commands/blockchain/getTransactionStatus.js.map +1 -1
- package/lib/commands/blockchain/receive.js +42 -14
- package/lib/commands/blockchain/receive.js.map +1 -1
- package/lib/commands/blockchain/satstack.js +33 -30
- package/lib/commands/blockchain/satstack.js.map +1 -1
- package/lib/commands/blockchain/satstackStatus.js +5 -4
- package/lib/commands/blockchain/satstackStatus.js.map +1 -1
- package/lib/commands/blockchain/scanDescriptors.js +14 -8
- package/lib/commands/blockchain/scanDescriptors.js.map +1 -1
- package/lib/commands/blockchain/send.js +90 -61
- package/lib/commands/blockchain/send.js.map +1 -1
- package/lib/commands/blockchain/signMessage.d.ts +1 -1
- package/lib/commands/blockchain/signMessage.js +40 -15
- package/lib/commands/blockchain/signMessage.js.map +1 -1
- package/lib/commands/blockchain/sync.js +120 -27
- package/lib/commands/blockchain/sync.js.map +1 -1
- package/lib/commands/blockchain/testDetectOpCollision.js +48 -15
- package/lib/commands/blockchain/testDetectOpCollision.js.map +1 -1
- package/lib/commands/blockchain/testGetTrustedInputFromTxHash.js +86 -37
- package/lib/commands/blockchain/testGetTrustedInputFromTxHash.js.map +1 -1
- package/lib/commands/device/app.js +76 -42
- package/lib/commands/device/app.js.map +1 -1
- package/lib/commands/device/appUninstallAll.d.ts +1 -1
- package/lib/commands/device/appUninstallAll.js +29 -22
- package/lib/commands/device/appUninstallAll.js.map +1 -1
- package/lib/commands/device/appsCheckAllAppVersions.js +361 -208
- package/lib/commands/device/appsCheckAllAppVersions.js.map +1 -1
- package/lib/commands/device/appsInstallAll.js +24 -15
- package/lib/commands/device/appsInstallAll.js.map +1 -1
- package/lib/commands/device/appsUpdateTestAll.js +80 -69
- 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 +84 -37
- package/lib/commands/device/customLockScreenFetch.js.map +1 -1
- package/lib/commands/device/customLockScreenFetchAndRestore.js +110 -46
- package/lib/commands/device/customLockScreenFetchAndRestore.js.map +1 -1
- package/lib/commands/device/customLockScreenFetchHash.js +7 -5
- package/lib/commands/device/customLockScreenFetchHash.js.map +1 -1
- package/lib/commands/device/customLockScreenLoad.js +72 -25
- package/lib/commands/device/customLockScreenLoad.js.map +1 -1
- package/lib/commands/device/customLockScreenRemove.js +7 -5
- package/lib/commands/device/customLockScreenRemove.js.map +1 -1
- package/lib/commands/device/devDeviceAppsScenario.js +65 -33
- package/lib/commands/device/devDeviceAppsScenario.js.map +1 -1
- package/lib/commands/device/deviceAppVersion.js +8 -5
- package/lib/commands/device/deviceAppVersion.js.map +1 -1
- package/lib/commands/device/deviceInfo.js +8 -5
- package/lib/commands/device/deviceInfo.js.map +1 -1
- package/lib/commands/device/deviceSDKFirmwareUpdate.js +68 -22
- package/lib/commands/device/deviceSDKFirmwareUpdate.js.map +1 -1
- package/lib/commands/device/deviceSDKGetBatteryStatuses.js +8 -7
- package/lib/commands/device/deviceSDKGetBatteryStatuses.js.map +1 -1
- package/lib/commands/device/deviceSDKGetDeviceInfo.js +7 -6
- package/lib/commands/device/deviceSDKGetDeviceInfo.js.map +1 -1
- package/lib/commands/device/deviceSDKToggleOnboardingEarlyCheck.js +9 -8
- package/lib/commands/device/deviceSDKToggleOnboardingEarlyCheck.js.map +1 -1
- package/lib/commands/device/deviceVersion.js +8 -5
- package/lib/commands/device/deviceVersion.js.map +1 -1
- package/lib/commands/device/discoverDevices.js +50 -15
- package/lib/commands/device/discoverDevices.js.map +1 -1
- package/lib/commands/device/firmwareRepair.js +6 -3
- package/lib/commands/device/firmwareRepair.js.map +1 -1
- package/lib/commands/device/firmwareUpdate.js +123 -63
- package/lib/commands/device/firmwareUpdate.js.map +1 -1
- package/lib/commands/device/genuineCheck.js +12 -7
- package/lib/commands/device/genuineCheck.js.map +1 -1
- package/lib/commands/device/getBatteryStatus.js +9 -5
- package/lib/commands/device/getBatteryStatus.js.map +1 -1
- package/lib/commands/device/getDeviceRunningMode.js +10 -7
- package/lib/commands/device/getDeviceRunningMode.js.map +1 -1
- package/lib/commands/device/i18n.js +79 -27
- package/lib/commands/device/i18n.js.map +1 -1
- package/lib/commands/device/listApps.d.ts +1 -1
- package/lib/commands/device/listApps.js +12 -7
- package/lib/commands/device/listApps.js.map +1 -1
- package/lib/commands/device/managerListApps.js +28 -21
- package/lib/commands/device/managerListApps.js.map +1 -1
- package/lib/commands/device/proxy.js +350 -242
- package/lib/commands/device/proxy.js.map +1 -1
- package/lib/commands/device/reinstallConfigurationConsent.js +126 -36
- package/lib/commands/device/reinstallConfigurationConsent.js.map +1 -1
- package/lib/commands/device/repl.js +10 -5
- package/lib/commands/device/repl.js.map +1 -1
- package/lib/commands/device/speculosList.js +58 -12
- package/lib/commands/device/speculosList.js.map +1 -1
- package/lib/commands/live/balanceHistory.js +79 -44
- package/lib/commands/live/balanceHistory.js.map +1 -1
- package/lib/commands/live/countervalues.js +207 -111
- package/lib/commands/live/countervalues.js.map +1 -1
- package/lib/commands/live/envs.js +6 -4
- package/lib/commands/live/envs.js.map +1 -1
- package/lib/commands/live/exportAccounts.js +56 -30
- package/lib/commands/live/exportAccounts.js.map +1 -1
- package/lib/commands/live/ledgerKeyRingProtocol.d.ts +1 -1
- package/lib/commands/live/ledgerKeyRingProtocol.js +103 -63
- package/lib/commands/live/ledgerKeyRingProtocol.js.map +1 -1
- package/lib/commands/live/ledgerSync.js +60 -20
- package/lib/commands/live/ledgerSync.js.map +1 -1
- package/lib/commands/live/liveData.js +60 -34
- package/lib/commands/live/liveData.js.map +1 -1
- package/lib/commands/live/portfolio.js +98 -68
- package/lib/commands/live/portfolio.js.map +1 -1
- package/lib/commands/live/synchronousOnboarding.js +9 -6
- 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 +4 -2
- package/lib/commands/live/version.js.map +1 -1
- package/lib/commands/ptx/swap.js +282 -194
- 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 +48 -26
- package/lib/live-common-setup-base.js.map +1 -1
- package/lib/live-common-setup.js +123 -66
- package/lib/live-common-setup.js.map +1 -1
- package/lib/qr.js +10 -6
- package/lib/qr.js.map +1 -1
- package/lib/scan.js +92 -84
- package/lib/scan.js.map +1 -1
- package/lib/signedOperation.js +6 -6
- package/lib/signedOperation.js.map +1 -1
- package/lib/stream.js +68 -57
- package/lib/stream.js.map +1 -1
- package/lib/transaction.js +142 -60
- package/lib/transaction.js.map +1 -1
- package/package.json +9 -9
package/lib/commands/ptx/swap.js
CHANGED
|
@@ -1,204 +1,293 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const cryptoassets_1 = require("@ledgerhq/cryptoassets");
|
|
10
|
-
const rxjs_1 = require("rxjs");
|
|
11
|
-
const bignumber_js_1 = require("bignumber.js");
|
|
12
|
-
const command_line_args_1 = __importDefault(require("command-line-args"));
|
|
13
|
-
const promise_1 = require("@ledgerhq/live-common/promise");
|
|
14
|
-
const scan_1 = require("../../scan");
|
|
15
|
-
const index_2 = require("@ledgerhq/live-common/exchange/swap/index");
|
|
16
|
-
const index_3 = require("@ledgerhq/live-common/bridge/index");
|
|
17
|
-
const index_4 = require("@ledgerhq/live-common/currencies/index");
|
|
18
|
-
const invariant_1 = __importDefault(require("invariant"));
|
|
19
|
-
const exec = async (opts) => {
|
|
20
|
-
const { amount, useAllAmount, tokenId, useFloat, deviceId = "" } = opts;
|
|
21
|
-
(0, invariant_1.default)(amount || useAllAmount, `✖ amount in satoshis is needed or --useAllAmount `);
|
|
22
|
-
(0, invariant_1.default)(opts._unknown, `✖ second account information is missing`);
|
|
23
|
-
//Remove suffix from arguments before passing them to sync.
|
|
24
|
-
const secondAccountOpts = (0, command_line_args_1.default)([
|
|
25
|
-
...scan_1.scanCommonOpts,
|
|
26
|
-
{
|
|
27
|
-
name: "tokenId",
|
|
28
|
-
alias: "t",
|
|
29
|
-
type: String,
|
|
30
|
-
desc: "use a token account children of the account",
|
|
31
|
-
},
|
|
32
|
-
], {
|
|
33
|
-
argv: opts._unknown.map((a, i) => (i % 2 ? a : a.replace("_2", ""))),
|
|
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());
|
|
34
9
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(
|
|
40
|
-
|
|
41
|
-
throw new
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (fromParentAccount) {
|
|
63
|
-
console.log("\t:parentId:\t\t", fromParentAccount.id);
|
|
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 };
|
|
64
36
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
(0, invariant_1.default)(fromAccount.balance.gte(new bignumber_js_1.BigNumber(amount)), `✖ Not enough balance`);
|
|
73
|
-
console.log("• Open the destination currency app");
|
|
74
|
-
await (0, promise_1.delay)(8000);
|
|
75
|
-
let toParentAccount = null;
|
|
76
|
-
let toAccount = await (0, rxjs_1.firstValueFrom)((0, scan_1.scan)(secondAccountOpts).pipe((0, operators_1.take)(1)));
|
|
77
|
-
if (!toAccount) {
|
|
78
|
-
throw new Error(`✖ No account found`);
|
|
37
|
+
};
|
|
38
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
+
if (!m) return o;
|
|
41
|
+
var i = m.call(o), r, ar = [], e;
|
|
42
|
+
try {
|
|
43
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
79
44
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (!token) {
|
|
85
|
-
throw new Error(`✖ No token currency found with id ${tokenId2}`);
|
|
45
|
+
catch (error) { e = { error: error }; }
|
|
46
|
+
finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
86
49
|
}
|
|
87
|
-
|
|
88
|
-
const subAccount = subAccounts.find(t => {
|
|
89
|
-
const currency = (0, index_1.getAccountCurrency)(t);
|
|
90
|
-
return tokenId2 === currency.id;
|
|
91
|
-
});
|
|
92
|
-
// We have a token account, keep track of both now;
|
|
93
|
-
toParentAccount = toAccount;
|
|
94
|
-
toAccount = subAccount;
|
|
95
|
-
(0, invariant_1.default)(fromAccount, `✖ No account found`);
|
|
96
|
-
}
|
|
97
|
-
(0, invariant_1.default)(toAccount, `✖ No account found`);
|
|
98
|
-
if (!toAccount)
|
|
99
|
-
throw new Error(`✖ No account found`);
|
|
100
|
-
if (toParentAccount) {
|
|
101
|
-
console.log("\t:parentId:\t\t", toParentAccount.id);
|
|
102
|
-
}
|
|
103
|
-
console.log("\t:id:\t\t", toAccount.id);
|
|
104
|
-
const bridge = (0, index_3.getAccountBridge)(fromAccount, fromParentAccount);
|
|
105
|
-
let transaction = bridge.createTransaction((0, index_1.getMainAccount)(fromAccount, fromParentAccount));
|
|
106
|
-
transaction = bridge.updateTransaction(transaction, {
|
|
107
|
-
recipient: (0, cryptoassets_1.getAbandonSeedAddress)((0, index_1.getAccountCurrency)((0, index_1.getMainAccount)(fromAccount, fromParentAccount)).id),
|
|
108
|
-
subAccountId: fromParentAccount ? fromAccount.id : undefined,
|
|
109
|
-
});
|
|
110
|
-
if (!useAllAmount) {
|
|
111
|
-
transaction = bridge.updateTransaction(transaction, {
|
|
112
|
-
amount: new bignumber_js_1.BigNumber(amount),
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
const amount = await bridge.estimateMaxSpendable({
|
|
117
|
-
account: fromAccount,
|
|
118
|
-
parentAccount: fromParentAccount,
|
|
119
|
-
transaction,
|
|
120
|
-
});
|
|
121
|
-
transaction = bridge.updateTransaction(transaction, {
|
|
122
|
-
amount,
|
|
123
|
-
});
|
|
50
|
+
finally { if (e) throw e.error; }
|
|
124
51
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
toCurrency: toAccount.type === "TokenAccount" ? toAccount.token : toAccount.currency,
|
|
133
|
-
};
|
|
134
|
-
const exchangeRates = await (0, index_2.getExchangeRates)({ exchange, transaction });
|
|
135
|
-
console.log({ exchangeRates });
|
|
136
|
-
const exchangeRate = exchangeRates.find(er => {
|
|
137
|
-
if (er.tradeMethod === (useFloat ? "float" : "fixed")) {
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
return false;
|
|
141
|
-
});
|
|
142
|
-
(0, invariant_1.default)(exchangeRate, `✖ No valid rate available`);
|
|
143
|
-
console.log(`Using first ${useFloat ? "float" : "fixed"} rate:\n`, exchangeRate);
|
|
144
|
-
console.log({
|
|
145
|
-
transaction,
|
|
146
|
-
amount: transaction.amount.toString(),
|
|
147
|
-
});
|
|
148
|
-
console.log("• Open the Exchange app");
|
|
149
|
-
await (0, promise_1.delay)(8000);
|
|
150
|
-
const initSwapResult = await (0, rxjs_1.firstValueFrom)((0, index_2.initSwap)({
|
|
151
|
-
exchange,
|
|
152
|
-
exchangeRate: exchangeRate,
|
|
153
|
-
transaction,
|
|
154
|
-
deviceId,
|
|
155
|
-
}).pipe((0, operators_1.tap)((e) => {
|
|
156
|
-
switch (e.type) {
|
|
157
|
-
case "init-swap-requested":
|
|
158
|
-
console.log("• Confirm swap operation on your device");
|
|
159
|
-
break;
|
|
160
|
-
case "init-swap-error":
|
|
161
|
-
console.log(e);
|
|
162
|
-
(0, invariant_1.default)(false, "Something went wrong confirming the swap");
|
|
163
|
-
// $FlowFixMe
|
|
164
|
-
break;
|
|
165
|
-
case "init-swap-result":
|
|
166
|
-
console.log(e);
|
|
167
|
-
}
|
|
168
|
-
if (e.type === "init-swap-requested")
|
|
169
|
-
console.log("• Confirm swap operation on your device");
|
|
170
|
-
}), (0, operators_1.filter)((e) => e.type === "init-swap-result"), (0, operators_1.map)((e) => {
|
|
171
|
-
if (e.type === "init-swap-result") {
|
|
172
|
-
return e.initSwapResult;
|
|
52
|
+
return ar;
|
|
53
|
+
};
|
|
54
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
55
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
56
|
+
if (ar || !(i in from)) {
|
|
57
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
58
|
+
ar[i] = from[i];
|
|
173
59
|
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
60
|
+
}
|
|
61
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
62
|
+
};
|
|
63
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
64
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
65
|
+
};
|
|
66
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67
|
+
/* eslint-disable no-console */
|
|
68
|
+
var operators_1 = require("rxjs/operators");
|
|
69
|
+
var index_1 = require("@ledgerhq/live-common/account/index");
|
|
70
|
+
var cryptoassets_1 = require("@ledgerhq/cryptoassets");
|
|
71
|
+
var rxjs_1 = require("rxjs");
|
|
72
|
+
var bignumber_js_1 = require("bignumber.js");
|
|
73
|
+
var command_line_args_1 = __importDefault(require("command-line-args"));
|
|
74
|
+
var promise_1 = require("@ledgerhq/live-common/promise");
|
|
75
|
+
var scan_1 = require("../../scan");
|
|
76
|
+
var index_2 = require("@ledgerhq/live-common/exchange/swap/index");
|
|
77
|
+
var index_3 = require("@ledgerhq/live-common/bridge/index");
|
|
78
|
+
var index_4 = require("@ledgerhq/live-common/currencies/index");
|
|
79
|
+
var invariant_1 = __importDefault(require("invariant"));
|
|
80
|
+
var exec = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
|
|
81
|
+
var amount, useAllAmount, tokenId, useFloat, _a, deviceId, secondAccountOpts, fromParentAccount, fromAccount, token, subAccounts, subAccount, formattedAmount, toParentAccount, toAccount, tokenId2, token, subAccounts, subAccount, bridge, transaction, amount_1, exchange, exchangeRates, exchangeRate, initSwapResult, mainFromAccount, signedOperation, operation;
|
|
82
|
+
return __generator(this, function (_b) {
|
|
83
|
+
switch (_b.label) {
|
|
84
|
+
case 0:
|
|
85
|
+
amount = opts.amount, useAllAmount = opts.useAllAmount, tokenId = opts.tokenId, useFloat = opts.useFloat, _a = opts.deviceId, deviceId = _a === void 0 ? "" : _a;
|
|
86
|
+
(0, invariant_1.default)(amount || useAllAmount, "\u2716 amount in satoshis is needed or --useAllAmount ");
|
|
87
|
+
(0, invariant_1.default)(opts._unknown, "\u2716 second account information is missing");
|
|
88
|
+
secondAccountOpts = (0, command_line_args_1.default)(__spreadArray(__spreadArray([], __read(scan_1.scanCommonOpts), false), [
|
|
89
|
+
{
|
|
90
|
+
name: "tokenId",
|
|
91
|
+
alias: "t",
|
|
92
|
+
type: String,
|
|
93
|
+
desc: "use a token account children of the account",
|
|
94
|
+
},
|
|
95
|
+
], false), {
|
|
96
|
+
argv: opts._unknown.map(function (a, i) { return (i % 2 ? a : a.replace("_2", "")); }),
|
|
97
|
+
});
|
|
98
|
+
console.log("• Open the source currency app");
|
|
99
|
+
return [4 /*yield*/, (0, promise_1.delay)(8000)];
|
|
100
|
+
case 1:
|
|
101
|
+
_b.sent();
|
|
102
|
+
fromParentAccount = null;
|
|
103
|
+
return [4 /*yield*/, (0, rxjs_1.firstValueFrom)((0, scan_1.scan)(opts).pipe((0, operators_1.take)(1)))];
|
|
104
|
+
case 2:
|
|
105
|
+
fromAccount = _b.sent();
|
|
106
|
+
(0, invariant_1.default)(fromAccount, "\u2716 No account found, is the right currency app open?");
|
|
107
|
+
if (!fromAccount) {
|
|
108
|
+
throw new Error("\u2716 No account found, is the right currency app open?");
|
|
109
|
+
}
|
|
110
|
+
//Are we asking for a token account?
|
|
111
|
+
if (tokenId) {
|
|
112
|
+
token = (0, cryptoassets_1.findTokenById)(tokenId);
|
|
113
|
+
(0, invariant_1.default)(token, "\u2716 No token currency found with id ".concat(tokenId));
|
|
114
|
+
if (!token)
|
|
115
|
+
throw new Error("\u2716 No token currency found with id ".concat(tokenId));
|
|
116
|
+
subAccounts = (0, index_1.accountWithMandatoryTokens)(fromAccount, [token]).subAccounts || [];
|
|
117
|
+
subAccount = subAccounts.find(function (t) {
|
|
118
|
+
var currency = (0, index_1.getAccountCurrency)(t);
|
|
119
|
+
return tokenId === currency.id;
|
|
120
|
+
});
|
|
121
|
+
// We have a token account, keep track of both now;
|
|
122
|
+
fromParentAccount = fromAccount;
|
|
123
|
+
fromAccount = subAccount;
|
|
124
|
+
(0, invariant_1.default)(fromAccount, "\u2716 No account found, is the right currency app open?");
|
|
125
|
+
if (!fromAccount) {
|
|
126
|
+
throw new Error("\u2716 No account found, is the right currency app open?");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (fromParentAccount) {
|
|
130
|
+
console.log("\t:parentId:\t\t", fromParentAccount.id);
|
|
131
|
+
}
|
|
132
|
+
console.log("\t:id:\t\t", fromAccount.id);
|
|
133
|
+
formattedAmount = (0, index_4.formatCurrencyUnit)((0, index_1.getAccountCurrency)(fromAccount).units[0], fromAccount.balance, {
|
|
134
|
+
disableRounding: true,
|
|
135
|
+
alwaysShowSign: false,
|
|
136
|
+
showCode: true,
|
|
137
|
+
});
|
|
138
|
+
console.log("\t:balance:\t", fromAccount.spendableBalance.toString(), " [ ".concat(formattedAmount, " ]"));
|
|
139
|
+
(0, invariant_1.default)(fromAccount.balance.gte(new bignumber_js_1.BigNumber(amount)), "\u2716 Not enough balance");
|
|
140
|
+
console.log("• Open the destination currency app");
|
|
141
|
+
return [4 /*yield*/, (0, promise_1.delay)(8000)];
|
|
142
|
+
case 3:
|
|
143
|
+
_b.sent();
|
|
144
|
+
toParentAccount = null;
|
|
145
|
+
return [4 /*yield*/, (0, rxjs_1.firstValueFrom)((0, scan_1.scan)(secondAccountOpts).pipe((0, operators_1.take)(1)))];
|
|
146
|
+
case 4:
|
|
147
|
+
toAccount = _b.sent();
|
|
148
|
+
if (!toAccount) {
|
|
149
|
+
throw new Error("\u2716 No account found");
|
|
150
|
+
}
|
|
151
|
+
tokenId2 = secondAccountOpts.tokenId;
|
|
152
|
+
//Are we asking for a token account?
|
|
153
|
+
if (tokenId2) {
|
|
154
|
+
token = (0, cryptoassets_1.findTokenById)(tokenId2);
|
|
155
|
+
if (!token) {
|
|
156
|
+
throw new Error("\u2716 No token currency found with id ".concat(tokenId2));
|
|
157
|
+
}
|
|
158
|
+
subAccounts = (0, index_1.accountWithMandatoryTokens)(toAccount, [token]).subAccounts || [];
|
|
159
|
+
subAccount = subAccounts.find(function (t) {
|
|
160
|
+
var currency = (0, index_1.getAccountCurrency)(t);
|
|
161
|
+
return tokenId2 === currency.id;
|
|
162
|
+
});
|
|
163
|
+
// We have a token account, keep track of both now;
|
|
164
|
+
toParentAccount = toAccount;
|
|
165
|
+
toAccount = subAccount;
|
|
166
|
+
(0, invariant_1.default)(fromAccount, "\u2716 No account found");
|
|
167
|
+
}
|
|
168
|
+
(0, invariant_1.default)(toAccount, "\u2716 No account found");
|
|
169
|
+
if (!toAccount)
|
|
170
|
+
throw new Error("\u2716 No account found");
|
|
171
|
+
if (toParentAccount) {
|
|
172
|
+
console.log("\t:parentId:\t\t", toParentAccount.id);
|
|
173
|
+
}
|
|
174
|
+
console.log("\t:id:\t\t", toAccount.id);
|
|
175
|
+
bridge = (0, index_3.getAccountBridge)(fromAccount, fromParentAccount);
|
|
176
|
+
transaction = bridge.createTransaction((0, index_1.getMainAccount)(fromAccount, fromParentAccount));
|
|
177
|
+
transaction = bridge.updateTransaction(transaction, {
|
|
178
|
+
recipient: (0, cryptoassets_1.getAbandonSeedAddress)((0, index_1.getAccountCurrency)((0, index_1.getMainAccount)(fromAccount, fromParentAccount)).id),
|
|
179
|
+
subAccountId: fromParentAccount ? fromAccount.id : undefined,
|
|
180
|
+
});
|
|
181
|
+
if (!!useAllAmount) return [3 /*break*/, 5];
|
|
182
|
+
transaction = bridge.updateTransaction(transaction, {
|
|
183
|
+
amount: new bignumber_js_1.BigNumber(amount),
|
|
184
|
+
});
|
|
185
|
+
return [3 /*break*/, 7];
|
|
186
|
+
case 5: return [4 /*yield*/, bridge.estimateMaxSpendable({
|
|
187
|
+
account: fromAccount,
|
|
188
|
+
parentAccount: fromParentAccount,
|
|
189
|
+
transaction: transaction,
|
|
190
|
+
})];
|
|
191
|
+
case 6:
|
|
192
|
+
amount_1 = _b.sent();
|
|
193
|
+
transaction = bridge.updateTransaction(transaction, {
|
|
194
|
+
amount: amount_1,
|
|
195
|
+
});
|
|
196
|
+
_b.label = 7;
|
|
197
|
+
case 7: return [4 /*yield*/, bridge.prepareTransaction((0, index_1.getMainAccount)(fromAccount, fromParentAccount), transaction)];
|
|
198
|
+
case 8:
|
|
199
|
+
transaction = _b.sent();
|
|
200
|
+
exchange = {
|
|
201
|
+
fromAccount: fromAccount,
|
|
202
|
+
fromParentAccount: fromParentAccount,
|
|
203
|
+
fromCurrency: fromAccount.type === "TokenAccount" ? fromAccount.token : fromAccount.currency,
|
|
204
|
+
toAccount: toAccount,
|
|
205
|
+
toParentAccount: toParentAccount,
|
|
206
|
+
toCurrency: toAccount.type === "TokenAccount" ? toAccount.token : toAccount.currency,
|
|
207
|
+
};
|
|
208
|
+
return [4 /*yield*/, (0, index_2.getExchangeRates)({ exchange: exchange, transaction: transaction })];
|
|
209
|
+
case 9:
|
|
210
|
+
exchangeRates = _b.sent();
|
|
211
|
+
console.log({ exchangeRates: exchangeRates });
|
|
212
|
+
exchangeRate = exchangeRates.find(function (er) {
|
|
213
|
+
if (er.tradeMethod === (useFloat ? "float" : "fixed")) {
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
return false;
|
|
217
|
+
});
|
|
218
|
+
(0, invariant_1.default)(exchangeRate, "\u2716 No valid rate available");
|
|
219
|
+
console.log("Using first ".concat(useFloat ? "float" : "fixed", " rate:\n"), exchangeRate);
|
|
220
|
+
console.log({
|
|
221
|
+
transaction: transaction,
|
|
222
|
+
amount: transaction.amount.toString(),
|
|
223
|
+
});
|
|
224
|
+
console.log("• Open the Exchange app");
|
|
225
|
+
return [4 /*yield*/, (0, promise_1.delay)(8000)];
|
|
226
|
+
case 10:
|
|
227
|
+
_b.sent();
|
|
228
|
+
return [4 /*yield*/, (0, rxjs_1.firstValueFrom)((0, index_2.initSwap)({
|
|
229
|
+
exchange: exchange,
|
|
230
|
+
exchangeRate: exchangeRate,
|
|
231
|
+
transaction: transaction,
|
|
232
|
+
deviceId: deviceId,
|
|
233
|
+
}).pipe((0, operators_1.tap)(function (e) {
|
|
234
|
+
switch (e.type) {
|
|
235
|
+
case "init-swap-requested":
|
|
236
|
+
console.log("• Confirm swap operation on your device");
|
|
237
|
+
break;
|
|
238
|
+
case "init-swap-error":
|
|
239
|
+
console.log(e);
|
|
240
|
+
(0, invariant_1.default)(false, "Something went wrong confirming the swap");
|
|
241
|
+
// $FlowFixMe
|
|
242
|
+
break;
|
|
243
|
+
case "init-swap-result":
|
|
244
|
+
console.log(e);
|
|
245
|
+
}
|
|
246
|
+
if (e.type === "init-swap-requested")
|
|
247
|
+
console.log("• Confirm swap operation on your device");
|
|
248
|
+
}), (0, operators_1.filter)(function (e) { return e.type === "init-swap-result"; }), (0, operators_1.map)(function (e) {
|
|
249
|
+
if (e.type === "init-swap-result") {
|
|
250
|
+
return e.initSwapResult;
|
|
251
|
+
}
|
|
252
|
+
})))];
|
|
253
|
+
case 11:
|
|
254
|
+
initSwapResult = _b.sent();
|
|
255
|
+
transaction = initSwapResult.transaction;
|
|
256
|
+
console.log("Device app switch & silent signing");
|
|
257
|
+
return [4 /*yield*/, (0, promise_1.delay)(8000)];
|
|
258
|
+
case 12:
|
|
259
|
+
_b.sent();
|
|
260
|
+
mainFromAccount = (0, index_1.getMainAccount)(fromAccount, fromParentAccount);
|
|
261
|
+
return [4 /*yield*/, (0, rxjs_1.firstValueFrom)(bridge
|
|
262
|
+
.signOperation({
|
|
263
|
+
account: mainFromAccount,
|
|
264
|
+
deviceId: deviceId,
|
|
265
|
+
transaction: transaction,
|
|
266
|
+
})
|
|
267
|
+
.pipe((0, operators_1.tap)(function (e) { return console.log(e); }), (0, operators_1.first)(function (e) { return e.type === "signed"; }), (0, operators_1.map)(function (e) {
|
|
268
|
+
if (e.type === "signed") {
|
|
269
|
+
return e.signedOperation;
|
|
270
|
+
}
|
|
271
|
+
})))];
|
|
272
|
+
case 13:
|
|
273
|
+
signedOperation = _b.sent();
|
|
274
|
+
console.log("Broadcasting");
|
|
275
|
+
return [4 /*yield*/, bridge.broadcast({
|
|
276
|
+
account: mainFromAccount,
|
|
277
|
+
signedOperation: signedOperation,
|
|
278
|
+
})];
|
|
279
|
+
case 14:
|
|
280
|
+
operation = _b.sent();
|
|
281
|
+
console.log({
|
|
282
|
+
operation: operation,
|
|
283
|
+
});
|
|
284
|
+
return [2 /*return*/];
|
|
188
285
|
}
|
|
189
|
-
})));
|
|
190
|
-
console.log("Broadcasting");
|
|
191
|
-
const operation = await bridge.broadcast({
|
|
192
|
-
account: mainFromAccount,
|
|
193
|
-
signedOperation: signedOperation,
|
|
194
286
|
});
|
|
195
|
-
|
|
196
|
-
operation,
|
|
197
|
-
});
|
|
198
|
-
};
|
|
287
|
+
}); };
|
|
199
288
|
exports.default = {
|
|
200
289
|
description: "Perform an arbitrary swap between two currencies on the same seed",
|
|
201
|
-
args: [
|
|
290
|
+
args: __spreadArray([
|
|
202
291
|
{
|
|
203
292
|
name: "mock",
|
|
204
293
|
alias: "m",
|
|
@@ -228,9 +317,8 @@ exports.default = {
|
|
|
228
317
|
alias: "f",
|
|
229
318
|
type: Boolean,
|
|
230
319
|
desc: "Use first floating rate returned. Defaults to false.",
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
job: (opts) => (0, rxjs_1.from)(exec(opts)),
|
|
320
|
+
}
|
|
321
|
+
], __read(scan_1.scanCommonOpts), false),
|
|
322
|
+
job: function (opts) { return (0, rxjs_1.from)(exec(opts)); },
|
|
235
323
|
};
|
|
236
324
|
//# sourceMappingURL=swap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.js","sourceRoot":"","sources":["../../../src/commands/ptx/swap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"swap.js","sourceRoot":"","sources":["../../../src/commands/ptx/swap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AAC/B,4CAA+D;AAC/D,6DAI6C;AAC7C,uDAA8E;AAC9E,6BAA4C;AAC5C,6CAAyC;AACzC,wEAAgD;AAChD,yDAAsD;AACtD,mCAAkD;AAOlD,mEAAuF;AACvF,4DAAsE;AACtE,gEAA4E;AAC5E,wDAAkC;AAYlC,IAAM,IAAI,GAAG,UAAO,IAAiB;;;;;gBAC3B,MAAM,GAAqD,IAAI,OAAzD,EAAE,YAAY,GAAuC,IAAI,aAA3C,EAAE,OAAO,GAA8B,IAAI,QAAlC,EAAE,QAAQ,GAAoB,IAAI,SAAxB,EAAE,KAAkB,IAAI,SAAT,EAAb,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IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,+DAA+D;SACtE;QACD;YACE,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,6CAA6C;SACpD;QACD;YACE,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,sDAAsD;SAC7D;cACE,qBAAc,SAClB;IACD,GAAG,EAAE,UAAC,IAAiB,IAAK,OAAA,IAAA,WAAI,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAhB,CAAgB;CAC7C,CAAC"}
|
package/lib/commands-index.d.ts
CHANGED
|
@@ -380,7 +380,7 @@ declare const _default: {
|
|
|
380
380
|
type: BooleanConstructor;
|
|
381
381
|
desc: string;
|
|
382
382
|
}[];
|
|
383
|
-
job: ({ continuous }: import("./commands/blockchain/satstackStatus").SatstackStatusJobOpts) => import("rxjs").Observable<import("@ledgerhq/live-common/
|
|
383
|
+
job: ({ continuous }: import("./commands/blockchain/satstackStatus").SatstackStatusJobOpts) => import("rxjs").Observable<import("@ledgerhq/live-common/families/bitcoin/satstack").SatStackStatus>;
|
|
384
384
|
};
|
|
385
385
|
scanDescriptors: {
|
|
386
386
|
description: string;
|
|
@@ -477,7 +477,7 @@ declare const _default: {
|
|
|
477
477
|
desc: string;
|
|
478
478
|
default: string;
|
|
479
479
|
})[];
|
|
480
|
-
job: (opts: import("./commands/blockchain/signMessage").SignMessageJobOpts) => import("rxjs").Observable<import("@ledgerhq/live-common/
|
|
480
|
+
job: (opts: import("./commands/blockchain/signMessage").SignMessageJobOpts) => import("rxjs").Observable<import("@ledgerhq/live-common/hw/signMessage/types").Result>;
|
|
481
481
|
};
|
|
482
482
|
sync: {
|
|
483
483
|
description: string;
|
|
@@ -635,7 +635,7 @@ declare const _default: {
|
|
|
635
635
|
}[];
|
|
636
636
|
job: ({ device }: Partial<{
|
|
637
637
|
device: string;
|
|
638
|
-
}>) => import("rxjs").Observable<string | import("@ledgerhq/live-common/
|
|
638
|
+
}>) => import("rxjs").Observable<string | import("@ledgerhq/live-common/apps").State>;
|
|
639
639
|
};
|
|
640
640
|
appsCheckAllAppVersions: {
|
|
641
641
|
description: string;
|
|
@@ -663,7 +663,7 @@ declare const _default: {
|
|
|
663
663
|
}[];
|
|
664
664
|
job: ({ device }: Partial<{
|
|
665
665
|
device: string;
|
|
666
|
-
}>) => import("rxjs").Observable<import("@ledgerhq/live-common/
|
|
666
|
+
}>) => import("rxjs").Observable<import("@ledgerhq/live-common/apps").State>;
|
|
667
667
|
};
|
|
668
668
|
appsUpdateTestAll: {
|
|
669
669
|
description: string;
|
|
@@ -925,7 +925,7 @@ declare const _default: {
|
|
|
925
925
|
job: ({ module, interactive }: Partial<{
|
|
926
926
|
module: string;
|
|
927
927
|
interactive: boolean;
|
|
928
|
-
}>) => import("@ledgerhq/live-common/
|
|
928
|
+
}>) => import("@ledgerhq/live-common/hw").Discovery | import("rxjs").Observable<string>;
|
|
929
929
|
};
|
|
930
930
|
firmwareRepair: {
|
|
931
931
|
description: string;
|
|
@@ -1004,7 +1004,7 @@ declare const _default: {
|
|
|
1004
1004
|
desc: string;
|
|
1005
1005
|
type: NumberConstructor;
|
|
1006
1006
|
})[];
|
|
1007
|
-
job: ({ device, unresponsiveTimeoutMs, cantOpenDeviceRetryLimit, }: Partial<import("./commands/device/getDeviceRunningMode").GetDeviceRunningModeJobOpts>) => import("rxjs").Observable<import("@ledgerhq/live-common/
|
|
1007
|
+
job: ({ device, unresponsiveTimeoutMs, cantOpenDeviceRetryLimit, }: Partial<import("./commands/device/getDeviceRunningMode").GetDeviceRunningModeJobOpts>) => import("rxjs").Observable<import("@ledgerhq/live-common/hw/getDeviceRunningMode").GetDeviceRunningModeResult | null>;
|
|
1008
1008
|
};
|
|
1009
1009
|
i18n: {
|
|
1010
1010
|
description: string;
|
|
@@ -1033,7 +1033,7 @@ declare const _default: {
|
|
|
1033
1033
|
}[];
|
|
1034
1034
|
job: ({ device }: Partial<{
|
|
1035
1035
|
device: string;
|
|
1036
|
-
}>) => import("rxjs").Observable<import("@ledgerhq/live-common/
|
|
1036
|
+
}>) => import("rxjs").Observable<import("@ledgerhq/live-common/apps").ListAppResponse>;
|
|
1037
1037
|
};
|
|
1038
1038
|
managerListApps: {
|
|
1039
1039
|
description: string;
|
|
@@ -1319,7 +1319,7 @@ declare const _default: {
|
|
|
1319
1319
|
default: string;
|
|
1320
1320
|
desc: string;
|
|
1321
1321
|
})[];
|
|
1322
|
-
job: ({ device, initMemberCredentials, getKeyRingTree, encryptUserData, decryptUserData, getMembers, restoreKeyRingTree, destroyKeyRingTree, pubKey, privateKey, rootId, walletSyncEncryptionKey, applicationPath, message, applicationId, name, apiBaseUrl, }: import("./commands/live/ledgerKeyRingProtocol").LedgerKeyRingProtocolJobOpts) => Promise<string | void | import("@ledgerhq/ledger-key-ring-protocol/
|
|
1322
|
+
job: ({ device, initMemberCredentials, getKeyRingTree, encryptUserData, decryptUserData, getMembers, restoreKeyRingTree, destroyKeyRingTree, pubKey, privateKey, rootId, walletSyncEncryptionKey, applicationPath, message, applicationId, name, apiBaseUrl, }: import("./commands/live/ledgerKeyRingProtocol").LedgerKeyRingProtocolJobOpts) => Promise<string | void | import("@ledgerhq/ledger-key-ring-protocol/types").MemberCredentials | import("@ledgerhq/ledger-key-ring-protocol/types").Trustchain | import("@ledgerhq/ledger-key-ring-protocol/types").TrustchainMember[]>;
|
|
1323
1323
|
};
|
|
1324
1324
|
ledgerSync: {
|
|
1325
1325
|
description: string;
|
|
@@ -1470,7 +1470,7 @@ declare const _default: {
|
|
|
1470
1470
|
desc: string;
|
|
1471
1471
|
type: NumberConstructor;
|
|
1472
1472
|
})[];
|
|
1473
|
-
job: ({ device, pollingPeriodMs, }: import("./commands/live/synchronousOnboarding").SynchronousOnboardingJobOpts) => import("rxjs").Observable<import("@ledgerhq/live-common/
|
|
1473
|
+
job: ({ device, pollingPeriodMs, }: import("./commands/live/synchronousOnboarding").SynchronousOnboardingJobOpts) => import("rxjs").Observable<import("@ledgerhq/live-common/hw/getOnboardingStatePolling").OnboardingStatePollingResult | null>;
|
|
1474
1474
|
};
|
|
1475
1475
|
user: {
|
|
1476
1476
|
args: never[];
|