@ledgerhq/live-cli 21.32.2-nightly.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/README.md +520 -0
- package/bin/index.js +2 -0
- package/lib/cli.d.ts +2 -0
- package/lib/cli.d.ts.map +1 -0
- package/lib/cli.js +137 -0
- package/lib/cli.js.map +1 -0
- package/lib/commands/app.d.ts +45 -0
- package/lib/commands/app.d.ts.map +1 -0
- package/lib/commands/app.js +131 -0
- package/lib/commands/app.js.map +1 -0
- package/lib/commands/appUninstallAll.d.ts +15 -0
- package/lib/commands/appUninstallAll.d.ts.map +1 -0
- package/lib/commands/appUninstallAll.js +31 -0
- package/lib/commands/appUninstallAll.js.map +1 -0
- package/lib/commands/appsCheckAllAppVersions.d.ts +20 -0
- package/lib/commands/appsCheckAllAppVersions.d.ts.map +1 -0
- package/lib/commands/appsCheckAllAppVersions.js +484 -0
- package/lib/commands/appsCheckAllAppVersions.js.map +1 -0
- package/lib/commands/appsInstallAll.d.ts +15 -0
- package/lib/commands/appsInstallAll.d.ts.map +1 -0
- package/lib/commands/appsInstallAll.js +34 -0
- package/lib/commands/appsInstallAll.js.map +1 -0
- package/lib/commands/appsUpdateTestAll.d.ts +20 -0
- package/lib/commands/appsUpdateTestAll.d.ts.map +1 -0
- package/lib/commands/appsUpdateTestAll.js +101 -0
- package/lib/commands/appsUpdateTestAll.js.map +1 -0
- package/lib/commands/balanceHistory.d.ts +50 -0
- package/lib/commands/balanceHistory.d.ts.map +1 -0
- package/lib/commands/balanceHistory.js +110 -0
- package/lib/commands/balanceHistory.js.map +1 -0
- package/lib/commands/bot.d.ts +12 -0
- package/lib/commands/bot.d.ts.map +1 -0
- package/lib/commands/bot.js +33 -0
- package/lib/commands/bot.js.map +1 -0
- package/lib/commands/botPortfolio.d.ts +15 -0
- package/lib/commands/botPortfolio.d.ts.map +1 -0
- package/lib/commands/botPortfolio.js +41 -0
- package/lib/commands/botPortfolio.js.map +1 -0
- package/lib/commands/botTransfer.d.ts +7 -0
- package/lib/commands/botTransfer.d.ts.map +1 -0
- package/lib/commands/botTransfer.js +376 -0
- package/lib/commands/botTransfer.js.map +1 -0
- package/lib/commands/broadcast.d.ts +42 -0
- package/lib/commands/broadcast.d.ts.map +1 -0
- package/lib/commands/broadcast.js +48 -0
- package/lib/commands/broadcast.js.map +1 -0
- package/lib/commands/cleanSpeculos.d.ts +7 -0
- package/lib/commands/cleanSpeculos.d.ts.map +1 -0
- package/lib/commands/cleanSpeculos.js +20 -0
- package/lib/commands/cleanSpeculos.js.map +1 -0
- package/lib/commands/countervalues.d.ts +84 -0
- package/lib/commands/countervalues.d.ts.map +1 -0
- package/lib/commands/countervalues.js +302 -0
- package/lib/commands/countervalues.js.map +1 -0
- package/lib/commands/derivation.d.ts +6 -0
- package/lib/commands/derivation.d.ts.map +1 -0
- package/lib/commands/derivation.js +44 -0
- package/lib/commands/derivation.js.map +1 -0
- package/lib/commands/devDeviceAppsScenario.d.ts +24 -0
- package/lib/commands/devDeviceAppsScenario.d.ts.map +1 -0
- package/lib/commands/devDeviceAppsScenario.js +97 -0
- package/lib/commands/devDeviceAppsScenario.js.map +1 -0
- package/lib/commands/deviceAppVersion.d.ts +19 -0
- package/lib/commands/deviceAppVersion.d.ts.map +1 -0
- package/lib/commands/deviceAppVersion.js +17 -0
- package/lib/commands/deviceAppVersion.js.map +1 -0
- package/lib/commands/deviceInfo.d.ts +14 -0
- package/lib/commands/deviceInfo.d.ts.map +1 -0
- package/lib/commands/deviceInfo.js +17 -0
- package/lib/commands/deviceInfo.js.map +1 -0
- package/lib/commands/deviceVersion.d.ts +14 -0
- package/lib/commands/deviceVersion.d.ts.map +1 -0
- package/lib/commands/deviceVersion.js +17 -0
- package/lib/commands/deviceVersion.js.map +1 -0
- package/lib/commands/discoverDevices.d.ts +23 -0
- package/lib/commands/discoverDevices.d.ts.map +1 -0
- package/lib/commands/discoverDevices.js +86 -0
- package/lib/commands/discoverDevices.js.map +1 -0
- package/lib/commands/envs.d.ts +7 -0
- package/lib/commands/envs.d.ts.map +1 -0
- package/lib/commands/envs.js +15 -0
- package/lib/commands/envs.js.map +1 -0
- package/lib/commands/estimateMaxSpendable.d.ts +41 -0
- package/lib/commands/estimateMaxSpendable.d.ts.map +1 -0
- package/lib/commands/estimateMaxSpendable.js +65 -0
- package/lib/commands/estimateMaxSpendable.js.map +1 -0
- package/lib/commands/exportAccounts.d.ts +48 -0
- package/lib/commands/exportAccounts.d.ts.map +1 -0
- package/lib/commands/exportAccounts.js +69 -0
- package/lib/commands/exportAccounts.js.map +1 -0
- package/lib/commands/firmwareRepair.d.ts +22 -0
- package/lib/commands/firmwareRepair.d.ts.map +1 -0
- package/lib/commands/firmwareRepair.js +23 -0
- package/lib/commands/firmwareRepair.js.map +1 -0
- package/lib/commands/firmwareUpdate.d.ts +26 -0
- package/lib/commands/firmwareUpdate.d.ts.map +1 -0
- package/lib/commands/firmwareUpdate.js +154 -0
- package/lib/commands/firmwareUpdate.js.map +1 -0
- package/lib/commands/generateAppJsonFromDataset.d.ts +7 -0
- package/lib/commands/generateAppJsonFromDataset.d.ts.map +1 -0
- package/lib/commands/generateAppJsonFromDataset.js +212 -0
- package/lib/commands/generateAppJsonFromDataset.js.map +1 -0
- package/lib/commands/generateTestScanAccounts.d.ts +49 -0
- package/lib/commands/generateTestScanAccounts.d.ts.map +1 -0
- package/lib/commands/generateTestScanAccounts.js +60 -0
- package/lib/commands/generateTestScanAccounts.js.map +1 -0
- package/lib/commands/generateTestTransaction.d.ts +44 -0
- package/lib/commands/generateTestTransaction.d.ts.map +1 -0
- package/lib/commands/generateTestTransaction.js +118 -0
- package/lib/commands/generateTestTransaction.js.map +1 -0
- package/lib/commands/genuineCheck.d.ts +15 -0
- package/lib/commands/genuineCheck.d.ts.map +1 -0
- package/lib/commands/genuineCheck.js +22 -0
- package/lib/commands/genuineCheck.js.map +1 -0
- package/lib/commands/getAddress.d.ts +28 -0
- package/lib/commands/getAddress.d.ts.map +1 -0
- package/lib/commands/getAddress.js +53 -0
- package/lib/commands/getAddress.js.map +1 -0
- package/lib/commands/getTransactionStatus.d.ts +52 -0
- package/lib/commands/getTransactionStatus.d.ts.map +1 -0
- package/lib/commands/getTransactionStatus.js +86 -0
- package/lib/commands/getTransactionStatus.js.map +1 -0
- package/lib/commands/liveData.d.ts +49 -0
- package/lib/commands/liveData.d.ts.map +1 -0
- package/lib/commands/liveData.js +82 -0
- package/lib/commands/liveData.js.map +1 -0
- package/lib/commands/makeCompoundSummary.d.ts +54 -0
- package/lib/commands/makeCompoundSummary.d.ts.map +1 -0
- package/lib/commands/makeCompoundSummary.js +190 -0
- package/lib/commands/makeCompoundSummary.js.map +1 -0
- package/lib/commands/managerListApps.d.ts +21 -0
- package/lib/commands/managerListApps.d.ts.map +1 -0
- package/lib/commands/managerListApps.js +47 -0
- package/lib/commands/managerListApps.js.map +1 -0
- package/lib/commands/portfolio.d.ts +66 -0
- package/lib/commands/portfolio.d.ts.map +1 -0
- package/lib/commands/portfolio.js +138 -0
- package/lib/commands/portfolio.js.map +1 -0
- package/lib/commands/proxy.d.ts +36 -0
- package/lib/commands/proxy.d.ts.map +1 -0
- package/lib/commands/proxy.js +413 -0
- package/lib/commands/proxy.js.map +1 -0
- package/lib/commands/receive.d.ts +48 -0
- package/lib/commands/receive.d.ts.map +1 -0
- package/lib/commands/receive.js +68 -0
- package/lib/commands/receive.js.map +1 -0
- package/lib/commands/repl.d.ts +22 -0
- package/lib/commands/repl.d.ts.map +1 -0
- package/lib/commands/repl.js +26 -0
- package/lib/commands/repl.js.map +1 -0
- package/lib/commands/satstack.d.ts +37 -0
- package/lib/commands/satstack.d.ts.map +1 -0
- package/lib/commands/satstack.js +110 -0
- package/lib/commands/satstack.js.map +1 -0
- package/lib/commands/satstackStatus.d.ts +13 -0
- package/lib/commands/satstackStatus.d.ts.map +1 -0
- package/lib/commands/satstackStatus.js +24 -0
- package/lib/commands/satstackStatus.js.map +1 -0
- package/lib/commands/scanDescriptors.d.ts +15 -0
- package/lib/commands/scanDescriptors.d.ts.map +1 -0
- package/lib/commands/scanDescriptors.js +18 -0
- package/lib/commands/scanDescriptors.js.map +1 -0
- package/lib/commands/send.d.ts +48 -0
- package/lib/commands/send.d.ts.map +1 -0
- package/lib/commands/send.js +116 -0
- package/lib/commands/send.js.map +1 -0
- package/lib/commands/signMessage.d.ts +16 -0
- package/lib/commands/signMessage.d.ts.map +1 -0
- package/lib/commands/signMessage.js +58 -0
- package/lib/commands/signMessage.js.map +1 -0
- package/lib/commands/speculosList.d.ts +7 -0
- package/lib/commands/speculosList.d.ts.map +1 -0
- package/lib/commands/speculosList.js +71 -0
- package/lib/commands/speculosList.js.map +1 -0
- package/lib/commands/swap.d.ts +55 -0
- package/lib/commands/swap.d.ts.map +1 -0
- package/lib/commands/swap.js +341 -0
- package/lib/commands/swap.js.map +1 -0
- package/lib/commands/sync.d.ts +49 -0
- package/lib/commands/sync.d.ts.map +1 -0
- package/lib/commands/sync.js +135 -0
- package/lib/commands/sync.js.map +1 -0
- package/lib/commands/testDetectOpCollision.d.ts +41 -0
- package/lib/commands/testDetectOpCollision.d.ts.map +1 -0
- package/lib/commands/testDetectOpCollision.js +57 -0
- package/lib/commands/testDetectOpCollision.js.map +1 -0
- package/lib/commands/testGetTrustedInputFromTxHash.d.ts +23 -0
- package/lib/commands/testGetTrustedInputFromTxHash.d.ts.map +1 -0
- package/lib/commands/testGetTrustedInputFromTxHash.js +114 -0
- package/lib/commands/testGetTrustedInputFromTxHash.js.map +1 -0
- package/lib/commands/user.d.ts +6 -0
- package/lib/commands/user.d.ts.map +1 -0
- package/lib/commands/user.js +9 -0
- package/lib/commands/user.js.map +1 -0
- package/lib/commands/version.d.ts +7 -0
- package/lib/commands/version.d.ts.map +1 -0
- package/lib/commands/version.js +12 -0
- package/lib/commands/version.js.map +1 -0
- package/lib/commands/walletconnect.d.ts +62 -0
- package/lib/commands/walletconnect.d.ts.map +1 -0
- package/lib/commands/walletconnect.js +272 -0
- package/lib/commands/walletconnect.js.map +1 -0
- package/lib/commands-index.d.ts +1511 -0
- package/lib/commands-index.d.ts.map +1 -0
- package/lib/commands-index.js +106 -0
- package/lib/commands-index.js.map +1 -0
- package/lib/live-common-setup-base.d.ts +2 -0
- package/lib/live-common-setup-base.d.ts.map +1 -0
- package/lib/live-common-setup-base.js +131 -0
- package/lib/live-common-setup-base.js.map +1 -0
- package/lib/live-common-setup.d.ts +5 -0
- package/lib/live-common-setup.d.ts.map +1 -0
- package/lib/live-common-setup.js +318 -0
- package/lib/live-common-setup.js.map +1 -0
- package/lib/qr.d.ts +3 -0
- package/lib/qr.d.ts.map +1 -0
- package/lib/qr.js +18 -0
- package/lib/qr.js.map +1 -0
- package/lib/scan.d.ts +71 -0
- package/lib/scan.d.ts.map +1 -0
- package/lib/scan.js +299 -0
- package/lib/scan.js.map +1 -0
- package/lib/signedOperation.d.ts +13 -0
- package/lib/signedOperation.d.ts.map +1 -0
- package/lib/signedOperation.js +31 -0
- package/lib/signedOperation.js.map +1 -0
- package/lib/stream.d.ts +7 -0
- package/lib/stream.d.ts.map +1 -0
- package/lib/stream.js +82 -0
- package/lib/stream.js.map +1 -0
- package/lib/transaction.d.ts +31 -0
- package/lib/transaction.d.ts.map +1 -0
- package/lib/transaction.js +202 -0
- package/lib/transaction.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,202 @@
|
|
|
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 (_) 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
|
+
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);
|
|
44
|
+
}
|
|
45
|
+
catch (error) { e = { error: error }; }
|
|
46
|
+
finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
}
|
|
50
|
+
finally { if (e) throw e.error; }
|
|
51
|
+
}
|
|
52
|
+
return ar;
|
|
53
|
+
};
|
|
54
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
55
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
56
|
+
};
|
|
57
|
+
exports.__esModule = true;
|
|
58
|
+
exports.inferTransactions = exports.inferTransactionsOpts = void 0;
|
|
59
|
+
require("lodash.product");
|
|
60
|
+
// @ts-expect-error we imported lodash.product but not recognized by TS in lodash
|
|
61
|
+
var lodash_1 = require("lodash");
|
|
62
|
+
var uniqBy_1 = __importDefault(require("lodash/uniqBy"));
|
|
63
|
+
var shuffle_1 = __importDefault(require("lodash/shuffle"));
|
|
64
|
+
var flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
65
|
+
var bignumber_js_1 = require("bignumber.js");
|
|
66
|
+
var cli_transaction_1 = __importDefault(require("@ledgerhq/live-common/lib/generated/cli-transaction"));
|
|
67
|
+
var bridge_1 = require("@ledgerhq/live-common/lib/bridge");
|
|
68
|
+
var account_1 = require("@ledgerhq/live-common/lib/account");
|
|
69
|
+
var currencies_1 = require("@ledgerhq/live-common/lib/currencies");
|
|
70
|
+
var inferAmount = function (account, str) {
|
|
71
|
+
var currency = (0, account_1.getAccountCurrency)(account);
|
|
72
|
+
var units = currency.units;
|
|
73
|
+
if (str.endsWith("%")) {
|
|
74
|
+
return account.balance.times(0.01 * parseFloat(str.replace("%", "")));
|
|
75
|
+
}
|
|
76
|
+
var lowerCase = str.toLowerCase();
|
|
77
|
+
for (var i = 0; i < units.length; i++) {
|
|
78
|
+
var unit = units[i];
|
|
79
|
+
var code = unit.code.toLowerCase();
|
|
80
|
+
if (lowerCase.includes(code)) {
|
|
81
|
+
return (0, currencies_1.parseCurrencyUnit)(unit, lowerCase.replace(code, ""));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return (0, currencies_1.parseCurrencyUnit)(units[0], str);
|
|
85
|
+
};
|
|
86
|
+
exports.inferTransactionsOpts = (0, uniqBy_1["default"])([
|
|
87
|
+
{
|
|
88
|
+
name: "self-transaction",
|
|
89
|
+
type: Boolean,
|
|
90
|
+
desc: "Pre-fill the transaction for the account to send to itself"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "use-all-amount",
|
|
94
|
+
type: Boolean,
|
|
95
|
+
desc: "Send MAX of the account balance"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "recipient",
|
|
99
|
+
type: String,
|
|
100
|
+
desc: "the address to send funds to",
|
|
101
|
+
multiple: true
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "amount",
|
|
105
|
+
type: String,
|
|
106
|
+
desc: "how much to send in the main currency unit"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: "shuffle",
|
|
110
|
+
type: Boolean,
|
|
111
|
+
desc: "if using multiple token or recipient, order will be randomized"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "collection",
|
|
115
|
+
type: String,
|
|
116
|
+
desc: "collection of an NFT (in corelation with --tokenIds)"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "tokenIds",
|
|
120
|
+
type: String,
|
|
121
|
+
desc: "tokenId or list of tokenIds of an NFT separated by commas (order is kept in corelation with --quantities)"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "quantities",
|
|
125
|
+
type: String,
|
|
126
|
+
desc: "quantity or list of quantity of an ERC1155 NFT separated by commas (order is kept in corelation with --tokenIds)"
|
|
127
|
+
},
|
|
128
|
+
].concat((0, flatMap_1["default"])(Object.values(cli_transaction_1["default"]), function (m) { return (m && m.options) || []; })), "name");
|
|
129
|
+
function inferTransactions(mainAccount, opts) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
+
var bridge, specific, inferAccounts, inferTransactions, all, transactions;
|
|
132
|
+
var _this = this;
|
|
133
|
+
return __generator(this, function (_a) {
|
|
134
|
+
switch (_a.label) {
|
|
135
|
+
case 0:
|
|
136
|
+
bridge = (0, bridge_1.getAccountBridge)(mainAccount, null);
|
|
137
|
+
specific = cli_transaction_1["default"][mainAccount.currency.family];
|
|
138
|
+
inferAccounts = (specific && specific.inferAccounts) || (function (account, _opts) { return [account]; });
|
|
139
|
+
inferTransactions = (specific && specific.inferTransactions) ||
|
|
140
|
+
(function (transactions, _opts, _r) { return transactions; });
|
|
141
|
+
return [4 /*yield*/, Promise.all((0, lodash_1.product)(inferAccounts(mainAccount, opts), opts.recipient || [
|
|
142
|
+
opts["self-transaction"] ? mainAccount.freshAddress : "",
|
|
143
|
+
]).map(function (_a) {
|
|
144
|
+
var _b = __read(_a, 2), account = _b[0], recipient = _b[1];
|
|
145
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
146
|
+
var transaction;
|
|
147
|
+
var _c, _d;
|
|
148
|
+
return __generator(this, function (_e) {
|
|
149
|
+
transaction = bridge.createTransaction(mainAccount);
|
|
150
|
+
transaction.recipient = recipient;
|
|
151
|
+
transaction.useAllAmount = !!opts["use-all-amount"];
|
|
152
|
+
transaction.amount = transaction.useAllAmount
|
|
153
|
+
? new bignumber_js_1.BigNumber(0)
|
|
154
|
+
: inferAmount(account, opts.amount || "0");
|
|
155
|
+
// NFT collection and tokenId go by pair
|
|
156
|
+
if (opts.tokenIds && opts.collection) {
|
|
157
|
+
transaction.tokenIds = opts.tokenIds.split(",");
|
|
158
|
+
transaction.collection = opts.collection;
|
|
159
|
+
transaction.quantities = (_d = (_c = opts.quantities) === null || _c === void 0 ? void 0 : _c.split(",")) === null || _d === void 0 ? void 0 : _d.map(function (q) { return new bignumber_js_1.BigNumber(q); });
|
|
160
|
+
}
|
|
161
|
+
return [2 /*return*/, {
|
|
162
|
+
account: account,
|
|
163
|
+
transaction: transaction,
|
|
164
|
+
mainAccount: mainAccount
|
|
165
|
+
}];
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
}))];
|
|
169
|
+
case 1:
|
|
170
|
+
all = _a.sent();
|
|
171
|
+
if (opts.shuffle) {
|
|
172
|
+
all = (0, shuffle_1["default"])(all);
|
|
173
|
+
}
|
|
174
|
+
return [4 /*yield*/, Promise.all(inferTransactions(all, opts, {
|
|
175
|
+
inferAmount: inferAmount
|
|
176
|
+
}).map(function (transaction) { return __awaiter(_this, void 0, void 0, function () {
|
|
177
|
+
var tx, status, errorKeys;
|
|
178
|
+
return __generator(this, function (_a) {
|
|
179
|
+
switch (_a.label) {
|
|
180
|
+
case 0: return [4 /*yield*/, bridge.prepareTransaction(mainAccount, transaction)];
|
|
181
|
+
case 1:
|
|
182
|
+
tx = _a.sent();
|
|
183
|
+
return [4 /*yield*/, bridge.getTransactionStatus(mainAccount, tx)];
|
|
184
|
+
case 2:
|
|
185
|
+
status = _a.sent();
|
|
186
|
+
errorKeys = Object.keys(status.errors);
|
|
187
|
+
if (errorKeys.length) {
|
|
188
|
+
throw status.errors[errorKeys[0]];
|
|
189
|
+
}
|
|
190
|
+
return [2 /*return*/, [tx, status]];
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}); }))];
|
|
194
|
+
case 2:
|
|
195
|
+
transactions = _a.sent();
|
|
196
|
+
return [2 /*return*/, transactions];
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
exports.inferTransactions = inferTransactions;
|
|
202
|
+
//# sourceMappingURL=transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0BAAwB;AACxB,iFAAiF;AACjF,iCAAiC;AACjC,yDAAmC;AACnC,2DAAqC;AACrC,2DAAqC;AACrC,6CAAyC;AAOzC,wGAA4E;AAC5E,2DAAoE;AACpE,6DAAuE;AACvE,mEAAyE;AAEzE,IAAM,WAAW,GAAG,UAAC,OAAoB,EAAE,GAAW;IACpD,IAAM,QAAQ,GAAG,IAAA,4BAAkB,EAAC,OAAO,CAAC,CAAC;IACrC,IAAA,KAAK,GAAK,QAAQ,MAAb,CAAc;IAE3B,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;KACvE;IAED,IAAM,SAAS,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IAEpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,IAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QAErC,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAC5B,OAAO,IAAA,8BAAiB,EAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;SAC7D;KACF;IAED,OAAO,IAAA,8BAAiB,EAAC,KAAK,CAAC,CAAC,CAAC,EAAE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"ledger-live CLI version",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git://github.com/LedgerHQ/ledger-live-common"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"ledger-live": "./bin/index.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin",
|
|
14
|
+
"lib"
|
|
15
|
+
],
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@ledgerhq/hw-transport-node-ble": "^6.27.2-nightly.0"
|
|
18
|
+
},
|
|
19
|
+
"optionalDependencies": {
|
|
20
|
+
"@ledgerhq/hw-transport-node-ble": "^6.27.2-nightly.0"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@ledgerhq/cryptoassets": "^6.28.3-nightly.0",
|
|
24
|
+
"@ledgerhq/errors": "^6.10.1-nightly.0",
|
|
25
|
+
"@ledgerhq/hw-app-btc": "^6.27.2-nightly.0",
|
|
26
|
+
"@ledgerhq/hw-transport-http": "^6.27.2-nightly.0",
|
|
27
|
+
"@ledgerhq/hw-transport-mocker": "^6.27.2-nightly.0",
|
|
28
|
+
"@ledgerhq/hw-transport-node-hid": "^6.27.2-nightly.0",
|
|
29
|
+
"@ledgerhq/hw-transport-node-speculos": "^6.27.2-nightly.0",
|
|
30
|
+
"@ledgerhq/live-common": "^22.0.4-nightly.0",
|
|
31
|
+
"@ledgerhq/logs": "^6.10.1-nightly.0",
|
|
32
|
+
"@walletconnect/client": "^1.7.1",
|
|
33
|
+
"asciichart": "^1.5.25",
|
|
34
|
+
"bignumber.js": "^9.0.1",
|
|
35
|
+
"bip39": "^3.0.4",
|
|
36
|
+
"body-parser": "^1.19.1",
|
|
37
|
+
"command-line-args": "^5.2.1",
|
|
38
|
+
"cors": "^2.8.5",
|
|
39
|
+
"express": "^4.17.2",
|
|
40
|
+
"lodash": "^4.17.21",
|
|
41
|
+
"lodash.product": "^18.9.19",
|
|
42
|
+
"qrcode-terminal": "^0.12.0",
|
|
43
|
+
"qrloop": "^1.2.0",
|
|
44
|
+
"react": "^17.0.2",
|
|
45
|
+
"react-dom": "^17.0.2",
|
|
46
|
+
"react-redux": "^7.2.6",
|
|
47
|
+
"rxjs": "^6.6.7",
|
|
48
|
+
"winston": "^3.5.1"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/command-line-args": "^5.2.0",
|
|
52
|
+
"@types/lodash": "^4.14.177",
|
|
53
|
+
"@types/node": "^17.0.15",
|
|
54
|
+
"ts-node": "^10.4.0",
|
|
55
|
+
"typescript": "^4.5.5"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"prebuild": "./scripts/gen.sh",
|
|
59
|
+
"build": "tsc --project src/tsconfig.json",
|
|
60
|
+
"watch": "tsc --watch --project src/tsconfig.json",
|
|
61
|
+
"typecheck": "tsc --noEmit"
|
|
62
|
+
}
|
|
63
|
+
}
|