@ledgerhq/live-cli 24.18.2 → 24.18.3-hotfix.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 +418 -412
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -530282,7 +530282,7 @@ var require_package8 = __commonJS({
|
|
|
530282
530282
|
module2.exports = {
|
|
530283
530283
|
name: "@ledgerhq/live-common",
|
|
530284
530284
|
description: "Common ground for the Ledger Live apps",
|
|
530285
|
-
version: "34.33.
|
|
530285
|
+
version: "34.33.2-hotfix.0",
|
|
530286
530286
|
repository: {
|
|
530287
530287
|
type: "git",
|
|
530288
530288
|
url: "https://github.com/LedgerHQ/ledger-live.git"
|
|
@@ -537083,7 +537083,7 @@ var require_package9 = __commonJS({
|
|
|
537083
537083
|
"package.json"(exports2, module2) {
|
|
537084
537084
|
module2.exports = {
|
|
537085
537085
|
name: "@ledgerhq/live-cli",
|
|
537086
|
-
version: "24.18.
|
|
537086
|
+
version: "24.18.3-hotfix.0",
|
|
537087
537087
|
description: "ledger-live CLI version",
|
|
537088
537088
|
repository: {
|
|
537089
537089
|
type: "git",
|
|
@@ -558505,7 +558505,7 @@ var value = "cli/0.0.0";
|
|
|
558505
558505
|
setEnv("LEDGER_CLIENT_VERSION", value);
|
|
558506
558506
|
|
|
558507
558507
|
// src/live-common-setup.ts
|
|
558508
|
-
var
|
|
558508
|
+
var import_invariant68 = __toESM(require("invariant"));
|
|
558509
558509
|
|
|
558510
558510
|
// ../../libs/ledgerjs/packages/hw-transport-mocker/lib-es/RecordStore.js
|
|
558511
558511
|
function RecordStoreInvalidSynthax(message2) {
|
|
@@ -559225,7 +559225,7 @@ var disconnect = (deviceId) => {
|
|
|
559225
559225
|
|
|
559226
559226
|
// ../../libs/ledger-live-common/lib-es/load/speculos.js
|
|
559227
559227
|
var import_sample = __toESM(require("lodash/sample"));
|
|
559228
|
-
var
|
|
559228
|
+
var import_invariant67 = __toESM(require("invariant"));
|
|
559229
559229
|
var import_path2 = __toESM(require("path"));
|
|
559230
559230
|
var import_semver16 = __toESM(require_semver2());
|
|
559231
559231
|
var import_fs2 = require("fs");
|
|
@@ -560376,7 +560376,7 @@ var getDefaultAccountName = (account3) => {
|
|
|
560376
560376
|
|
|
560377
560377
|
// ../../libs/ledger-live-common/lib-es/account/formatters.js
|
|
560378
560378
|
var import_bignumber340 = require("bignumber.js");
|
|
560379
|
-
var
|
|
560379
|
+
var import_invariant66 = __toESM(require("invariant"));
|
|
560380
560380
|
|
|
560381
560381
|
// ../../libs/ledger-live-common/lib-es/account/serialization.js
|
|
560382
560382
|
var import_memoize2 = __toESM(require("lodash/memoize"));
|
|
@@ -581521,11 +581521,11 @@ function wrapConsoleMethod(name3) {
|
|
|
581521
581521
|
}
|
|
581522
581522
|
};
|
|
581523
581523
|
}
|
|
581524
|
-
(function(
|
|
581525
|
-
|
|
581526
|
-
|
|
581527
|
-
|
|
581528
|
-
|
|
581524
|
+
(function(invariant126) {
|
|
581525
|
+
invariant126.debug = wrapConsoleMethod("debug");
|
|
581526
|
+
invariant126.log = wrapConsoleMethod("log");
|
|
581527
|
+
invariant126.warn = wrapConsoleMethod("warn");
|
|
581528
|
+
invariant126.error = wrapConsoleMethod("error");
|
|
581529
581529
|
})(invariant9 || (invariant9 = {}));
|
|
581530
581530
|
function setVerbosity(level2) {
|
|
581531
581531
|
var old = verbosityLevels[verbosityLevel];
|
|
@@ -777417,17 +777417,23 @@ function toOffChainMessage(message2, signerAddress, isLegacy) {
|
|
|
777417
777417
|
|
|
777418
777418
|
// ../../libs/coin-modules/coin-solana/lib-es/hw-signMessage.js
|
|
777419
777419
|
var import_bs587 = __toESM(require_bs58());
|
|
777420
|
+
var import_invariant41 = __toESM(require("invariant"));
|
|
777420
777421
|
var signMessage7 = (signerContext3) => async (deviceId, account3, messageOptions) => {
|
|
777421
777422
|
const message2 = messageOptions.message;
|
|
777422
777423
|
if (!message2 || typeof message2 !== "string") {
|
|
777423
777424
|
throw new Error("Sign off-chain message on Solana must be only used with DefaultMessage type");
|
|
777424
777425
|
}
|
|
777426
|
+
let signedMessage;
|
|
777425
777427
|
const result2 = await signerContext3(deviceId, async (signer) => {
|
|
777426
777428
|
const { version: version33 } = await signer.getAppConfiguration();
|
|
777427
777429
|
const isLegacy = import_semver12.default.lt(version33, config_default5.getCoinConfig().legacyOCMSMaxVersion);
|
|
777428
|
-
|
|
777430
|
+
signedMessage = toOffChainMessage(message2, account3.freshAddress, isLegacy);
|
|
777431
|
+
return signer.signMessage(account3.freshAddressPath, signedMessage.toString("hex"));
|
|
777429
777432
|
});
|
|
777430
|
-
|
|
777433
|
+
(0, import_invariant41.default)(signedMessage, "signedMessage should exist");
|
|
777434
|
+
const signatureCount = Buffer.from([1]);
|
|
777435
|
+
const envelope = Buffer.concat([signatureCount, result2.signature, signedMessage]);
|
|
777436
|
+
return { signature: import_bs587.default.encode(envelope) };
|
|
777431
777437
|
};
|
|
777432
777438
|
|
|
777433
777439
|
// ../../libs/ledger-live-common/lib-es/families/solana/setup.js
|
|
@@ -781404,7 +781410,7 @@ var getTransactionStatus16 = async (account3, transaction) => {
|
|
|
781404
781410
|
|
|
781405
781411
|
// ../../libs/coin-modules/coin-stacks/lib-es/bridge/estimateMaxSpendable.js
|
|
781406
781412
|
var import_bignumber241 = __toESM(require("bignumber.js"));
|
|
781407
|
-
var
|
|
781413
|
+
var import_invariant42 = __toESM(require("invariant"));
|
|
781408
781414
|
|
|
781409
781415
|
// ../../libs/coin-modules/coin-stacks/lib-es/bridge/createTransaction.js
|
|
781410
781416
|
var import_bignumber240 = __toESM(require("bignumber.js"));
|
|
@@ -781421,7 +781427,7 @@ var createTransaction18 = () => ({
|
|
|
781421
781427
|
var estimateMaxSpendable16 = async ({ account: account3, parentAccount, transaction }) => {
|
|
781422
781428
|
const mainAccount = getMainAccount(account3, parentAccount);
|
|
781423
781429
|
const { spendableBalance, xpub } = mainAccount;
|
|
781424
|
-
(0,
|
|
781430
|
+
(0, import_invariant42.default)(xpub, "xpub is required");
|
|
781425
781431
|
const dummyTx = {
|
|
781426
781432
|
...createTransaction18(account3),
|
|
781427
781433
|
...transaction,
|
|
@@ -781447,11 +781453,11 @@ var estimateMaxSpendable16 = async ({ account: account3, parentAccount, transact
|
|
|
781447
781453
|
// ../../libs/coin-modules/coin-stacks/lib-es/bridge/prepareTransaction.js
|
|
781448
781454
|
var import_bignumber242 = __toESM(require("bignumber.js"));
|
|
781449
781455
|
var import_c32check7 = __toESM(require_lib63());
|
|
781450
|
-
var
|
|
781456
|
+
var import_invariant43 = __toESM(require("invariant"));
|
|
781451
781457
|
var prepareTransaction17 = async (account3, transaction) => {
|
|
781452
781458
|
const { spendableBalance, pendingOperations, xpub } = account3;
|
|
781453
781459
|
const { recipient, useAllAmount } = transaction;
|
|
781454
|
-
(0,
|
|
781460
|
+
(0, import_invariant43.default)(xpub, "xpub is required");
|
|
781455
781461
|
const patch = {};
|
|
781456
781462
|
if (xpub && recipient && validateAddress3(recipient).isValid) {
|
|
781457
781463
|
const { anchorMode, memo: memo3, amount } = transaction;
|
|
@@ -781478,11 +781484,11 @@ var prepareTransaction17 = async (account3, transaction) => {
|
|
|
781478
781484
|
|
|
781479
781485
|
// ../../libs/coin-modules/coin-stacks/lib-es/bridge/synchronization.js
|
|
781480
781486
|
var import_bignumber243 = __toESM(require("bignumber.js"));
|
|
781481
|
-
var
|
|
781487
|
+
var import_invariant44 = __toESM(require("invariant"));
|
|
781482
781488
|
var getAccountShape14 = async (info6) => {
|
|
781483
781489
|
const { initialAccount, currency: currency24, rest = {}, derivationMode } = info6;
|
|
781484
781490
|
const pubKey = reconciliatePublicKey2(rest.publicKey, initialAccount);
|
|
781485
|
-
(0,
|
|
781491
|
+
(0, import_invariant44.default)(pubKey, "publicKey is required");
|
|
781486
781492
|
const accountId2 = encodeAccountId({
|
|
781487
781493
|
type: "js",
|
|
781488
781494
|
version: "2",
|
|
@@ -781516,7 +781522,7 @@ var sync13 = makeSync({ getAccountShape: getAccountShape14 });
|
|
|
781516
781522
|
|
|
781517
781523
|
// ../../libs/coin-modules/coin-stacks/lib-es/bridge/signOperation.js
|
|
781518
781524
|
init_lib_es();
|
|
781519
|
-
var
|
|
781525
|
+
var import_invariant45 = __toESM(require("invariant"));
|
|
781520
781526
|
var import_rxjs138 = require("rxjs");
|
|
781521
781527
|
|
|
781522
781528
|
// ../../libs/coin-modules/coin-stacks/lib-es/bridge/buildOptimisticOperation.js
|
|
@@ -781549,7 +781555,7 @@ var buildSignOperation17 = (signerContext3) => ({ account: account3, deviceId, t
|
|
|
781549
781555
|
async function main2() {
|
|
781550
781556
|
const { derivationPath } = getAddress7(account3);
|
|
781551
781557
|
const { xpub } = account3;
|
|
781552
|
-
(0,
|
|
781558
|
+
(0, import_invariant45.default)(xpub, "xpub is required");
|
|
781553
781559
|
const { recipient, fee, anchorMode, network, memo: memo3, amount, nonce } = transaction;
|
|
781554
781560
|
if (!xpub) {
|
|
781555
781561
|
throw new InvalidAddress("", {
|
|
@@ -781603,9 +781609,9 @@ var buildSignOperation17 = (signerContext3) => ({ account: account3, deviceId, t
|
|
|
781603
781609
|
});
|
|
781604
781610
|
|
|
781605
781611
|
// ../../libs/coin-modules/coin-stacks/lib-es/bridge/broadcast.js
|
|
781606
|
-
var
|
|
781612
|
+
var import_invariant46 = __toESM(require("invariant"));
|
|
781607
781613
|
var broadcast17 = async ({ signedOperation: { operation, signature: signature3, rawData } }) => {
|
|
781608
|
-
(0,
|
|
781614
|
+
(0, import_invariant46.default)(operation, "StacksOperation expected");
|
|
781609
781615
|
const tx = await getTxToBroadcast2(operation, signature3, rawData ?? {});
|
|
781610
781616
|
const hash12 = await broadcastTx3(tx);
|
|
781611
781617
|
const result2 = patchOperationWithHash(operation, hash12);
|
|
@@ -781652,16 +781658,16 @@ function createBridges17(signerContext3) {
|
|
|
781652
781658
|
}
|
|
781653
781659
|
|
|
781654
781660
|
// ../../libs/coin-modules/coin-stacks/lib-es/test/cli.js
|
|
781655
|
-
var
|
|
781661
|
+
var import_invariant47 = __toESM(require("invariant"));
|
|
781656
781662
|
var import_flatMap17 = __toESM(require("lodash/flatMap"));
|
|
781657
781663
|
function inferAccounts10(account3) {
|
|
781658
|
-
(0,
|
|
781664
|
+
(0, import_invariant47.default)(account3.currency.family === "stacks", "stacks family");
|
|
781659
781665
|
const accounts2 = [account3];
|
|
781660
781666
|
return accounts2;
|
|
781661
781667
|
}
|
|
781662
781668
|
function inferTransactions16(transactions3) {
|
|
781663
781669
|
return (0, import_flatMap17.default)(transactions3, ({ transaction }) => {
|
|
781664
|
-
(0,
|
|
781670
|
+
(0, import_invariant47.default)(transaction.family === "stacks", "stacks family");
|
|
781665
781671
|
return {
|
|
781666
781672
|
...transaction,
|
|
781667
781673
|
family: "stacks"
|
|
@@ -782289,10 +782295,10 @@ var getTransactionStatus17 = async (account3, transaction) => {
|
|
|
782289
782295
|
};
|
|
782290
782296
|
|
|
782291
782297
|
// ../../libs/coin-modules/coin-stellar/lib-es/bridge/prepareTransaction.js
|
|
782292
|
-
var
|
|
782298
|
+
var import_invariant48 = __toESM(require("invariant"));
|
|
782293
782299
|
var prepareTransaction18 = async (account3, transaction) => {
|
|
782294
782300
|
const networkInfo = transaction.networkInfo || await fetchAccountNetworkInfo(account3);
|
|
782295
|
-
(0,
|
|
782301
|
+
(0, import_invariant48.default)(networkInfo.family === "stellar", "stellar networkInfo expected");
|
|
782296
782302
|
const fees2 = transaction.fees || networkInfo.fees;
|
|
782297
782303
|
const baseReserve = transaction.baseReserve || networkInfo.baseReserve;
|
|
782298
782304
|
const [assetCode, assetIssuer] = getAssetCodeIssuer(transaction);
|
|
@@ -782346,7 +782352,7 @@ init_lib_es();
|
|
|
782346
782352
|
|
|
782347
782353
|
// ../../libs/coin-modules/coin-stellar/lib-es/bridge/buildTransaction.js
|
|
782348
782354
|
init_lib_es();
|
|
782349
|
-
var
|
|
782355
|
+
var import_invariant49 = __toESM(require("invariant"));
|
|
782350
782356
|
|
|
782351
782357
|
// ../../libs/coin-modules/coin-stellar/lib-es/logic/broadcast.js
|
|
782352
782358
|
async function broadcast18(signature3) {
|
|
@@ -782459,7 +782465,7 @@ function buildMemo(memoType, memoValue) {
|
|
|
782459
782465
|
// ../../libs/coin-modules/coin-stellar/lib-es/bridge/buildTransaction.js
|
|
782460
782466
|
async function buildTransaction9(account3, transaction) {
|
|
782461
782467
|
const { recipient, networkInfo, fees: fees2, memoType, memoValue, mode, assetCode, assetIssuer } = transaction;
|
|
782462
|
-
(0,
|
|
782468
|
+
(0, import_invariant49.default)(networkInfo && networkInfo.family === "stellar", "stellar family");
|
|
782463
782469
|
if (!fees2) {
|
|
782464
782470
|
throw new FeeNotLoaded();
|
|
782465
782471
|
}
|
|
@@ -782763,7 +782769,7 @@ function createBridges18(signerContext3, coinConfig17) {
|
|
|
782763
782769
|
}
|
|
782764
782770
|
|
|
782765
782771
|
// ../../libs/coin-modules/coin-stellar/lib-es/test/cli.js
|
|
782766
|
-
var
|
|
782772
|
+
var import_invariant50 = __toESM(require("invariant"));
|
|
782767
782773
|
var options14 = [
|
|
782768
782774
|
{
|
|
782769
782775
|
name: "fee",
|
|
@@ -782798,7 +782804,7 @@ var options14 = [
|
|
|
782798
782804
|
];
|
|
782799
782805
|
function inferTransactions17(transactions3, opts) {
|
|
782800
782806
|
return transactions3.map(({ transaction, account: account3 }) => {
|
|
782801
|
-
(0,
|
|
782807
|
+
(0, import_invariant50.default)(transaction.family === "stellar", "stellar family");
|
|
782802
782808
|
return {
|
|
782803
782809
|
...transaction,
|
|
782804
782810
|
subAccountId: account3.type === "TokenAccount" ? account3.id : null,
|
|
@@ -782811,7 +782817,7 @@ function inferTransactions17(transactions3, opts) {
|
|
|
782811
782817
|
});
|
|
782812
782818
|
}
|
|
782813
782819
|
function inferAccounts11(account3, opts) {
|
|
782814
|
-
(0,
|
|
782820
|
+
(0, import_invariant50.default)(account3.currency.family === "stellar", "stellar family");
|
|
782815
782821
|
if (opts.subAccountId) {
|
|
782816
782822
|
const assetSubAccount = account3.subAccounts?.find((a65) => a65.id === opts.subAccountId);
|
|
782817
782823
|
if (!assetSubAccount) {
|
|
@@ -801835,7 +801841,7 @@ var getTransactionStatus18 = async (account3, transaction) => {
|
|
|
801835
801841
|
};
|
|
801836
801842
|
|
|
801837
801843
|
// ../../libs/coin-modules/coin-tezos/lib-es/bridge/synchronization.js
|
|
801838
|
-
var
|
|
801844
|
+
var import_invariant51 = __toESM(require("invariant"));
|
|
801839
801845
|
var import_bignumber263 = require("bignumber.js");
|
|
801840
801846
|
|
|
801841
801847
|
// ../../libs/coin-modules/coin-tezos/lib-es/bridge/logic.js
|
|
@@ -801981,7 +801987,7 @@ function isStringHex(s49) {
|
|
|
801981
801987
|
// ../../libs/coin-modules/coin-tezos/lib-es/bridge/synchronization.js
|
|
801982
801988
|
var getAccountShape16 = async ({ initialAccount, rest, currency: currency24, derivationMode }) => {
|
|
801983
801989
|
const publicKey3 = reconciliatePublicKey3(rest?.publicKey, initialAccount);
|
|
801984
|
-
(0,
|
|
801990
|
+
(0, import_invariant51.default)(isStringHex(publicKey3), `Invalid public key (${publicKey3}). Please reimport your Tezos accounts`);
|
|
801985
801991
|
const hex4 = Buffer.from(publicKey3, "hex");
|
|
801986
801992
|
const address4 = encodeAddress5(hex4);
|
|
801987
801993
|
const accountId2 = encodeAccountId({
|
|
@@ -802201,7 +802207,7 @@ function createBridges19(signerContext3, coinConfig17) {
|
|
|
802201
802207
|
// ../../libs/coin-modules/coin-tezos/lib-es/test/cli.js
|
|
802202
802208
|
var import_rxjs142 = require("rxjs");
|
|
802203
802209
|
var import_operators9 = require("rxjs/operators");
|
|
802204
|
-
var
|
|
802210
|
+
var import_invariant52 = __toESM(require("invariant"));
|
|
802205
802211
|
var import_bignumber265 = require("bignumber.js");
|
|
802206
802212
|
var import_flatMap18 = __toESM(require("lodash/flatMap"));
|
|
802207
802213
|
var options15 = [
|
|
@@ -802233,22 +802239,22 @@ var options15 = [
|
|
|
802233
802239
|
}
|
|
802234
802240
|
];
|
|
802235
802241
|
function inferAccounts12(account3, opts) {
|
|
802236
|
-
(0,
|
|
802242
|
+
(0, import_invariant52.default)(account3.currency.family === "tezos", "tezos family");
|
|
802237
802243
|
if (!opts.subAccount) {
|
|
802238
802244
|
const accounts2 = [account3];
|
|
802239
802245
|
return accounts2;
|
|
802240
802246
|
}
|
|
802241
802247
|
const { subAccounts } = account3;
|
|
802242
|
-
(0,
|
|
802248
|
+
(0, import_invariant52.default)(subAccounts, "no sub accounts");
|
|
802243
802249
|
return opts.subAccount.map((i86) => {
|
|
802244
802250
|
const acc = subAccounts[i86];
|
|
802245
|
-
(0,
|
|
802251
|
+
(0, import_invariant52.default)(acc, "sub account not found (index %s)", i86);
|
|
802246
802252
|
return acc;
|
|
802247
802253
|
});
|
|
802248
802254
|
}
|
|
802249
802255
|
function inferTransactions18(transactions3, opts, { inferAmount: inferAmount2 }) {
|
|
802250
802256
|
return (0, import_flatMap18.default)(transactions3, ({ transaction, account: account3 }) => {
|
|
802251
|
-
(0,
|
|
802257
|
+
(0, import_invariant52.default)(transaction.family === "tezos", "tezos family");
|
|
802252
802258
|
let subAccountId;
|
|
802253
802259
|
return {
|
|
802254
802260
|
...transaction,
|
|
@@ -802294,7 +802300,7 @@ function makeCliTools19() {
|
|
|
802294
802300
|
}
|
|
802295
802301
|
|
|
802296
802302
|
// ../../libs/ledgerjs/packages/hw-app-tezos/lib-es/Tezos.js
|
|
802297
|
-
var
|
|
802303
|
+
var import_invariant53 = __toESM(require("invariant"));
|
|
802298
802304
|
var import_bs58check9 = __toESM(require_bs58check());
|
|
802299
802305
|
var import_blake2b6 = __toESM(require_blake2b7());
|
|
802300
802306
|
var Tezos = class {
|
|
@@ -802384,7 +802390,7 @@ var Tezos = class {
|
|
|
802384
802390
|
}
|
|
802385
802391
|
response = await this.transport.send(128, 4, code, curve2, data6);
|
|
802386
802392
|
}
|
|
802387
|
-
(0,
|
|
802393
|
+
(0, import_invariant53.default)(response, "hw-app-xtz: response is set");
|
|
802388
802394
|
const signature3 = response.slice(0, response.length - 2).toString("hex");
|
|
802389
802395
|
return {
|
|
802390
802396
|
signature: signature3
|
|
@@ -802440,7 +802446,7 @@ var curves = [
|
|
|
802440
802446
|
];
|
|
802441
802447
|
var encodeAddress6 = (publicKey3, curve2) => {
|
|
802442
802448
|
const curveData = curves[curve2];
|
|
802443
|
-
(0,
|
|
802449
|
+
(0, import_invariant53.default)(curveData, "%s curve not supported", curve2);
|
|
802444
802450
|
const publicKeyBuf = curveData.compressPublicKey(publicKey3, curve2);
|
|
802445
802451
|
const key2 = publicKeyBuf.slice(1);
|
|
802446
802452
|
const keyHashSize = 20;
|
|
@@ -803547,15 +803553,15 @@ function createBridges20(signerContext3, coinConfig17) {
|
|
|
803547
803553
|
}
|
|
803548
803554
|
|
|
803549
803555
|
// ../../libs/coin-modules/coin-ton/lib-es/cli-transaction.js
|
|
803550
|
-
var
|
|
803556
|
+
var import_invariant54 = __toESM(require("invariant"));
|
|
803551
803557
|
var import_flatMap20 = __toESM(require("lodash/flatMap"));
|
|
803552
803558
|
function inferTransactions19(transactions3, opts) {
|
|
803553
803559
|
return (0, import_flatMap20.default)(transactions3, ({ transaction, account: account3 }) => {
|
|
803554
|
-
(0,
|
|
803560
|
+
(0, import_invariant54.default)(transaction.family === "ton", "ton family");
|
|
803555
803561
|
const isTokenAccount2 = account3.type === "TokenAccount";
|
|
803556
803562
|
if (isTokenAccount2) {
|
|
803557
803563
|
const isDelisted = account3.token.delisted === true;
|
|
803558
|
-
(0,
|
|
803564
|
+
(0, import_invariant54.default)(!isDelisted, "token is delisted");
|
|
803559
803565
|
}
|
|
803560
803566
|
return {
|
|
803561
803567
|
...transaction,
|
|
@@ -805486,7 +805492,7 @@ function createBridges21(signerContext3, coinConfig17) {
|
|
|
805486
805492
|
}
|
|
805487
805493
|
|
|
805488
805494
|
// ../../libs/coin-modules/coin-tron/lib-es/test/cli.js
|
|
805489
|
-
var
|
|
805495
|
+
var import_invariant55 = __toESM(require("invariant"));
|
|
805490
805496
|
var import_flatMap21 = __toESM(require("lodash/flatMap"));
|
|
805491
805497
|
var import_zipWith2 = __toESM(require("lodash/zipWith"));
|
|
805492
805498
|
var import_rxjs145 = require("rxjs");
|
|
@@ -805527,7 +805533,7 @@ var options16 = [
|
|
|
805527
805533
|
}
|
|
805528
805534
|
];
|
|
805529
805535
|
function inferAccounts13(account3, opts) {
|
|
805530
|
-
(0,
|
|
805536
|
+
(0, import_invariant55.default)(account3.currency.family === "tron", "tron family");
|
|
805531
805537
|
if (!opts.token) {
|
|
805532
805538
|
const accounts2 = [account3];
|
|
805533
805539
|
return accounts2;
|
|
@@ -805548,7 +805554,7 @@ function inferAccounts13(account3, opts) {
|
|
|
805548
805554
|
}
|
|
805549
805555
|
function inferTransactions20(transactions3, opts) {
|
|
805550
805556
|
const mode = opts.mode || "send";
|
|
805551
|
-
(0,
|
|
805557
|
+
(0, import_invariant55.default)([
|
|
805552
805558
|
"send",
|
|
805553
805559
|
"freeze",
|
|
805554
805560
|
"unfreeze",
|
|
@@ -805560,11 +805566,11 @@ function inferTransactions20(transactions3, opts) {
|
|
|
805560
805566
|
].includes(mode), `Unexpected mode: ${mode}`);
|
|
805561
805567
|
const resource = opts.resource ? opts.resource.toUpperCase() : void 0;
|
|
805562
805568
|
if (resource) {
|
|
805563
|
-
(0,
|
|
805569
|
+
(0, import_invariant55.default)(["BANDWIDTH", "ENERGY"].includes(resource), `Unexpected resource: ${resource}`);
|
|
805564
805570
|
}
|
|
805565
805571
|
const voteAddresses = opts["tronVoteAddress"] || [];
|
|
805566
805572
|
const voteCounts = (opts["tronVoteCount"] || []).map((value6) => {
|
|
805567
|
-
(0,
|
|
805573
|
+
(0, import_invariant55.default)(Number.isInteger(Number(value6)), `Invalid integer: ${value6}`);
|
|
805568
805574
|
return parseInt(value6);
|
|
805569
805575
|
});
|
|
805570
805576
|
const votes2 = (0, import_zipWith2.default)(voteAddresses, voteCounts, (a65, c56) => ({
|
|
@@ -805572,13 +805578,13 @@ function inferTransactions20(transactions3, opts) {
|
|
|
805572
805578
|
voteCount: c56
|
|
805573
805579
|
}));
|
|
805574
805580
|
return (0, import_flatMap21.default)(transactions3, ({ transaction, account: account3 }) => {
|
|
805575
|
-
(0,
|
|
805581
|
+
(0, import_invariant55.default)(transaction.family === "tron", "tron family");
|
|
805576
805582
|
if (account3.type === "Account") {
|
|
805577
|
-
(0,
|
|
805583
|
+
(0, import_invariant55.default)(account3.tronResources, "unactivated account");
|
|
805578
805584
|
}
|
|
805579
805585
|
if (account3.type === "TokenAccount") {
|
|
805580
805586
|
const isDelisted = account3.token.delisted === true;
|
|
805581
|
-
(0,
|
|
805587
|
+
(0, import_invariant55.default)(!isDelisted, "token is delisted");
|
|
805582
805588
|
}
|
|
805583
805589
|
return {
|
|
805584
805590
|
...transaction,
|
|
@@ -808143,7 +808149,7 @@ var import_ripple_binary_codec = __toESM(require_dist32());
|
|
|
808143
808149
|
|
|
808144
808150
|
// ../../libs/coin-modules/coin-xrp/lib-es/logic/craftTransaction.js
|
|
808145
808151
|
var import_bignumber298 = __toESM(require("bignumber.js"));
|
|
808146
|
-
var
|
|
808152
|
+
var import_invariant56 = __toESM(require("invariant"));
|
|
808147
808153
|
var import_ripple_binary_codec2 = __toESM(require_dist32());
|
|
808148
808154
|
var import_definitions76 = __toESM(require_definitions());
|
|
808149
808155
|
|
|
@@ -808210,7 +808216,7 @@ async function craftTransaction4(account3, transaction, publicKey3) {
|
|
|
808210
808216
|
xrplTransaction.Memos = transaction.memos.map(memoMapper);
|
|
808211
808217
|
}
|
|
808212
808218
|
if (transaction.destinationTag) {
|
|
808213
|
-
(0,
|
|
808219
|
+
(0, import_invariant56.default)(validateTag(new import_bignumber298.default(transaction.destinationTag)), `tag is set but is not in a valid format, should be between [0 - ${UINT32_MAX.toString()}]`);
|
|
808214
808220
|
xrplTransaction.DestinationTag = transaction.destinationTag;
|
|
808215
808221
|
}
|
|
808216
808222
|
const serializedTransaction = publicKey3 ? (0, import_ripple_binary_codec2.encode)({
|
|
@@ -808662,7 +808668,7 @@ function createBridges23(signerContext3, coinConfig17) {
|
|
|
808662
808668
|
}
|
|
808663
808669
|
|
|
808664
808670
|
// ../../libs/coin-modules/coin-xrp/lib-es/test/cli.js
|
|
808665
|
-
var
|
|
808671
|
+
var import_invariant57 = __toESM(require("invariant"));
|
|
808666
808672
|
var options18 = [
|
|
808667
808673
|
{
|
|
808668
808674
|
name: "fee",
|
|
@@ -808677,7 +808683,7 @@ var options18 = [
|
|
|
808677
808683
|
];
|
|
808678
808684
|
function inferTransactions22(transactions3, opts, { inferAmount: inferAmount2 }) {
|
|
808679
808685
|
return transactions3.flatMap(({ transaction, account: account3 }) => {
|
|
808680
|
-
(0,
|
|
808686
|
+
(0, import_invariant57.default)(transaction.family === "xrp", "XRP family");
|
|
808681
808687
|
return {
|
|
808682
808688
|
...transaction,
|
|
808683
808689
|
fee: inferAmount2(account3, opts.fee || "0.001xrp"),
|
|
@@ -817920,13 +817926,13 @@ function reEncodeRawSignature(rawSignature) {
|
|
|
817920
817926
|
}
|
|
817921
817927
|
|
|
817922
817928
|
// ../../libs/coin-modules/coin-mina/lib-es/signer/getAddress.js
|
|
817923
|
-
var
|
|
817929
|
+
var import_invariant58 = __toESM(require("invariant"));
|
|
817924
817930
|
var resolver44 = (signerContext3) => {
|
|
817925
817931
|
return async (deviceId, { path: path4, verify: verify9 }) => {
|
|
817926
817932
|
const account3 = getAccountNumFromPath(path4);
|
|
817927
|
-
(0,
|
|
817933
|
+
(0, import_invariant58.default)(account3 !== void 0, "Invalid account path, supported: 44'/12586'/<account>'/0/0");
|
|
817928
817934
|
const r38 = await signerContext3(deviceId, (signer) => signer.getAddress(account3, verify9 || false));
|
|
817929
|
-
(0,
|
|
817935
|
+
(0, import_invariant58.default)(r38.publicKey, "[mina] getAddress: expected publicKey to be defined");
|
|
817930
817936
|
return {
|
|
817931
817937
|
address: r38.publicKey,
|
|
817932
817938
|
publicKey: r38.publicKey,
|
|
@@ -818152,7 +818158,7 @@ var getNonce4 = async (txn, address4) => {
|
|
|
818152
818158
|
// ../../libs/coin-modules/coin-mina/lib-es/bridge/synchronisation.js
|
|
818153
818159
|
var import_bignumber315 = __toESM(require("bignumber.js"));
|
|
818154
818160
|
init_lib_es2();
|
|
818155
|
-
var
|
|
818161
|
+
var import_invariant59 = __toESM(require("invariant"));
|
|
818156
818162
|
var mapRosettaTxnToOperation = async (accountId2, address4, txn) => {
|
|
818157
818163
|
try {
|
|
818158
818164
|
const hash12 = txn.transaction.transaction_identifier.hash;
|
|
@@ -818209,8 +818215,8 @@ var mapRosettaTxnToOperation = async (accountId2, address4, txn) => {
|
|
|
818209
818215
|
}
|
|
818210
818216
|
}
|
|
818211
818217
|
}
|
|
818212
|
-
(0,
|
|
818213
|
-
(0,
|
|
818218
|
+
(0, import_invariant59.default)(fromAccount, "mina: missing fromAccount");
|
|
818219
|
+
(0, import_invariant59.default)(toAccount, "mina: missing toAccount");
|
|
818214
818220
|
const op = {
|
|
818215
818221
|
id: "",
|
|
818216
818222
|
type: "NONE",
|
|
@@ -818423,11 +818429,11 @@ init_lib_es();
|
|
|
818423
818429
|
|
|
818424
818430
|
// ../../libs/coin-modules/coin-mina/lib-es/bridge/buildTransaction.js
|
|
818425
818431
|
init_lib_es2();
|
|
818426
|
-
var
|
|
818432
|
+
var import_invariant60 = __toESM(require("invariant"));
|
|
818427
818433
|
var buildTransaction11 = async (a65, t61) => {
|
|
818428
818434
|
try {
|
|
818429
818435
|
const accountNum = getAccountNumFromPath(a65.freshAddressPath);
|
|
818430
|
-
(0,
|
|
818436
|
+
(0, import_invariant60.default)(accountNum !== void 0, "mina: accountNum is required to build transaction");
|
|
818431
818437
|
return {
|
|
818432
818438
|
txType: MINA_PAYMENT_TYPE_ID,
|
|
818433
818439
|
senderAccount: accountNum,
|
|
@@ -818450,7 +818456,7 @@ var buildTransaction11 = async (a65, t61) => {
|
|
|
818450
818456
|
};
|
|
818451
818457
|
|
|
818452
818458
|
// ../../libs/coin-modules/coin-mina/lib-es/bridge/signOperation.js
|
|
818453
|
-
var
|
|
818459
|
+
var import_invariant61 = __toESM(require("invariant"));
|
|
818454
818460
|
var buildOptimisticOperation21 = (account3, transaction, fee) => {
|
|
818455
818461
|
let value6 = new import_bignumber319.BigNumber(transaction.amount).plus(fee);
|
|
818456
818462
|
if (transaction.fees?.accountCreationFee.gt(0)) {
|
|
@@ -818484,7 +818490,7 @@ var buildSignOperation25 = (signerContext3) => ({ account: account3, transaction
|
|
|
818484
818490
|
}
|
|
818485
818491
|
const unsigned2 = await buildTransaction11(account3, transaction);
|
|
818486
818492
|
const { signature: signature3 } = await signerContext3(deviceId, (signer) => signer.signTransaction(unsigned2));
|
|
818487
|
-
(0,
|
|
818493
|
+
(0, import_invariant61.default)(signature3, "signature should be defined if user accepted");
|
|
818488
818494
|
const encodedSignature = reEncodeRawSignature(signature3);
|
|
818489
818495
|
const signedTransaction = {
|
|
818490
818496
|
transaction: unsigned2,
|
|
@@ -818506,7 +818512,7 @@ var buildSignOperation25 = (signerContext3) => ({ account: account3, transaction
|
|
|
818506
818512
|
var signOperation_default2 = buildSignOperation25;
|
|
818507
818513
|
|
|
818508
818514
|
// ../../libs/coin-modules/coin-mina/lib-es/bridge/cli-transaction.js
|
|
818509
|
-
var
|
|
818515
|
+
var import_invariant62 = __toESM(require("invariant"));
|
|
818510
818516
|
var import_flatMap23 = __toESM(require("lodash/flatMap"));
|
|
818511
818517
|
var options20 = [
|
|
818512
818518
|
{
|
|
@@ -818516,12 +818522,12 @@ var options20 = [
|
|
|
818516
818522
|
}
|
|
818517
818523
|
];
|
|
818518
818524
|
function inferAccounts14(account3) {
|
|
818519
|
-
(0,
|
|
818525
|
+
(0, import_invariant62.default)(account3.currency.family === "mina", "mina family");
|
|
818520
818526
|
return [account3];
|
|
818521
818527
|
}
|
|
818522
818528
|
function inferTransactions23(transactions3, opts) {
|
|
818523
818529
|
return (0, import_flatMap23.default)(transactions3, ({ transaction }) => {
|
|
818524
|
-
(0,
|
|
818530
|
+
(0, import_invariant62.default)(transaction.family === "mina", "mina family");
|
|
818525
818531
|
return {
|
|
818526
818532
|
...transaction,
|
|
818527
818533
|
family: "mina",
|
|
@@ -821094,7 +821100,7 @@ function genAccount2(id5, opts = {}) {
|
|
|
821094
821100
|
}
|
|
821095
821101
|
|
|
821096
821102
|
// ../../libs/coin-modules/coin-evm/lib-es/operation.js
|
|
821097
|
-
var
|
|
821103
|
+
var import_invariant63 = __toESM(require("invariant"));
|
|
821098
821104
|
|
|
821099
821105
|
// ../../libs/ledger-live-common/lib-es/bridge/mockHelpers.js
|
|
821100
821106
|
var MOCK_DATA_SEED = getEnv("MOCK") || "MOCK";
|
|
@@ -821324,10 +821330,10 @@ init_lib_es();
|
|
|
821324
821330
|
// ../../libs/ledger-live-common/lib-es/families/bitcoin/bridge/api.js
|
|
821325
821331
|
init_lib_es();
|
|
821326
821332
|
var import_bignumber327 = require("bignumber.js");
|
|
821327
|
-
var
|
|
821333
|
+
var import_invariant64 = __toESM(require("invariant"));
|
|
821328
821334
|
var getEstimatedFees14 = makeLRUCache(async (currency24) => {
|
|
821329
821335
|
const baseURL2 = blockchainBaseURL(currency24);
|
|
821330
|
-
(0,
|
|
821336
|
+
(0, import_invariant64.default)(baseURL2, `Fees for ${currency24.id} are not supported`);
|
|
821331
821337
|
const { data: data6, status } = await network_default({
|
|
821332
821338
|
method: "GET",
|
|
821333
821339
|
url: `${baseURL2}/fees`
|
|
@@ -823135,7 +823141,7 @@ function getMockedAPIs() {
|
|
|
823135
823141
|
var mock_default14 = makeBridges(getMockedAPIs());
|
|
823136
823142
|
|
|
823137
823143
|
// ../../libs/ledger-live-common/lib-es/families/stellar/bridge/mock.js
|
|
823138
|
-
var
|
|
823144
|
+
var import_invariant65 = __toESM(require("invariant"));
|
|
823139
823145
|
var import_bignumber336 = require("bignumber.js");
|
|
823140
823146
|
init_lib_es();
|
|
823141
823147
|
var receive11 = makeAccountBridgeReceive2();
|
|
@@ -823256,7 +823262,7 @@ var prepareTransaction35 = async (a65, t61) => {
|
|
|
823256
823262
|
fees: new import_bignumber336.BigNumber("100"),
|
|
823257
823263
|
baseReserve: new import_bignumber336.BigNumber("100000")
|
|
823258
823264
|
};
|
|
823259
|
-
(0,
|
|
823265
|
+
(0, import_invariant65.default)(networkInfo.family === "stellar", "stellar networkInfo expected");
|
|
823260
823266
|
const fees2 = t61.fees || networkInfo.fees;
|
|
823261
823267
|
const baseReserve = t61.baseReserve || networkInfo.baseReserve;
|
|
823262
823268
|
if (t61.networkInfo !== networkInfo || t61.fees !== fees2 || t61.baseReserve !== baseReserve) {
|
|
@@ -823898,7 +823904,7 @@ var accountFormatters = {
|
|
|
823898
823904
|
};
|
|
823899
823905
|
function formatAccount(account3, format6 = "full") {
|
|
823900
823906
|
const f43 = accountFormatters[format6];
|
|
823901
|
-
(0,
|
|
823907
|
+
(0, import_invariant66.default)(f43, "missing account formatter=" + format6);
|
|
823902
823908
|
return f43(account3);
|
|
823903
823909
|
}
|
|
823904
823910
|
function formatOperation2(account3) {
|
|
@@ -826510,15 +826516,15 @@ function parseAppSearch(query3) {
|
|
|
826510
826516
|
}
|
|
826511
826517
|
async function createImplicitSpeculos(query3) {
|
|
826512
826518
|
const coinapps = getEnv("COINAPPS");
|
|
826513
|
-
(0,
|
|
826519
|
+
(0, import_invariant67.default)(coinapps, "COINAPPS folder is missing!");
|
|
826514
826520
|
const seed = getEnv("SEED");
|
|
826515
|
-
(0,
|
|
826521
|
+
(0, import_invariant67.default)(seed, "SEED is missing!");
|
|
826516
826522
|
const apps = await listAppCandidates(coinapps);
|
|
826517
826523
|
const match = parseAppSearch(query3);
|
|
826518
|
-
(0,
|
|
826524
|
+
(0, import_invariant67.default)(match, "speculos: invalid format of '%s'. Usage example: speculos:nanoS:bitcoin@1.3.x", query3);
|
|
826519
826525
|
const { search, dependency, appName } = match;
|
|
826520
826526
|
const appCandidate = findAppCandidate(apps, search);
|
|
826521
|
-
(0,
|
|
826527
|
+
(0, import_invariant67.default)(appCandidate, "could not find an app that matches '%s'", query3);
|
|
826522
826528
|
log2("speculos", "using app " + formatAppCandidate(appCandidate));
|
|
826523
826529
|
return appCandidate ? {
|
|
826524
826530
|
device: await createSpeculosDevice({
|
|
@@ -828080,14 +828086,14 @@ var import_bignumber393 = require("bignumber.js");
|
|
|
828080
828086
|
var import_uniq2 = __toESM(require("lodash/uniq"));
|
|
828081
828087
|
var import_groupBy6 = __toESM(require("lodash/groupBy"));
|
|
828082
828088
|
init_lib_es2();
|
|
828083
|
-
var
|
|
828089
|
+
var import_invariant102 = __toESM(require("invariant"));
|
|
828084
828090
|
var import_flatMap25 = __toESM(require("lodash/flatMap"));
|
|
828085
828091
|
|
|
828086
828092
|
// ../../libs/coin-framework/lib-es/bot/specs.js
|
|
828087
828093
|
init_lib_es2();
|
|
828088
828094
|
var import_bignumber369 = __toESM(require("bignumber.js"));
|
|
828089
828095
|
var import_expect = __toESM(require_build21());
|
|
828090
|
-
var
|
|
828096
|
+
var import_invariant69 = __toESM(require("invariant"));
|
|
828091
828097
|
var import_sample2 = __toESM(require("lodash/sample"));
|
|
828092
828098
|
var stepValueTransformDefault = (s49) => s49.trim();
|
|
828093
828099
|
function pickSiblings(siblings, maxAccount10 = 5) {
|
|
@@ -828215,7 +828221,7 @@ function formatDeviceAmount(currency24, value6, options22 = defaultFormatOptions
|
|
|
828215
828221
|
function expectSiblingsHaveSpendablePartGreaterThan(siblings, threshold) {
|
|
828216
828222
|
const spendableTotal = siblings.reduce((acc, a65) => acc.plus(a65.spendableBalance), new import_bignumber369.default(0));
|
|
828217
828223
|
const total = siblings.reduce((acc, a65) => acc.plus(a65.balance), new import_bignumber369.default(0));
|
|
828218
|
-
(0,
|
|
828224
|
+
(0, import_invariant69.default)(spendableTotal.div(total).gt(threshold), "the spendable part of accounts is sufficient (threshold: %s)", threshold);
|
|
828219
828225
|
}
|
|
828220
828226
|
var genericTestDestination = ({ destination, operation, destinationBeforeTransaction, sendingOperation }) => {
|
|
828221
828227
|
const amount = sendingOperation.value.minus(sendingOperation.fee);
|
|
@@ -828233,7 +828239,7 @@ var genericTestDestination = ({ destination, operation, destinationBeforeTransac
|
|
|
828233
828239
|
init_lib_es5();
|
|
828234
828240
|
var import_bignumber370 = require("bignumber.js");
|
|
828235
828241
|
var import_expect2 = __toESM(require_build21());
|
|
828236
|
-
var
|
|
828242
|
+
var import_invariant70 = __toESM(require("invariant"));
|
|
828237
828243
|
var import_sample3 = __toESM(require("lodash/sample"));
|
|
828238
828244
|
|
|
828239
828245
|
// ../../libs/coin-modules/coin-algorand/lib-es/speculos-deviceActions.js
|
|
@@ -828335,7 +828341,7 @@ var currency6 = getCryptoCurrencyById("algorand");
|
|
|
828335
828341
|
var minBalanceNewAccount = parseCurrencyUnit(currency6.units[0], "0.1");
|
|
828336
828342
|
var checkSendableToEmptyAccount = (amount, recipient) => {
|
|
828337
828343
|
if (isAccountEmpty(recipient) && amount.lte(minBalanceNewAccount)) {
|
|
828338
|
-
(0,
|
|
828344
|
+
(0, import_invariant70.default)(amount.gt(minBalanceNewAccount), "not enough funds to send to new account");
|
|
828339
828345
|
}
|
|
828340
828346
|
};
|
|
828341
828347
|
var getAssetsWithBalance = (account3) => {
|
|
@@ -828355,7 +828361,7 @@ var getRandomAssetId = (account3) => {
|
|
|
828355
828361
|
}, []);
|
|
828356
828362
|
const ASAs = listTokensForCryptoCurrency(account3.currency).map((asa) => asa.id);
|
|
828357
828363
|
const diff = ASAs?.filter((asa) => !optedInASA?.includes(asa));
|
|
828358
|
-
(0,
|
|
828364
|
+
(0, import_invariant70.default)(diff && diff.length > 0, "already got all optin");
|
|
828359
828365
|
return (0, import_sample3.default)(diff);
|
|
828360
828366
|
};
|
|
828361
828367
|
var algorand = {
|
|
@@ -828373,7 +828379,7 @@ var algorand = {
|
|
|
828373
828379
|
maxRun: 1,
|
|
828374
828380
|
testDestination: genericTestDestination,
|
|
828375
828381
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
828376
|
-
(0,
|
|
828382
|
+
(0, import_invariant70.default)(maxSpendable.gt(0), "Spendable balance is too low");
|
|
828377
828383
|
const sibling = pickSiblings(siblings, 4);
|
|
828378
828384
|
const recipient = sibling.freshAddress;
|
|
828379
828385
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -828403,7 +828409,7 @@ var algorand = {
|
|
|
828403
828409
|
maxRun: 1,
|
|
828404
828410
|
testDestination: genericTestDestination,
|
|
828405
828411
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
828406
|
-
(0,
|
|
828412
|
+
(0, import_invariant70.default)(maxSpendable.gt(0), "Spendable balance is too low");
|
|
828407
828413
|
const sibling = pickSiblings(siblings, 4);
|
|
828408
828414
|
const amount = maxSpendable;
|
|
828409
828415
|
checkSendableToEmptyAccount(amount, sibling);
|
|
@@ -828428,9 +828434,9 @@ var algorand = {
|
|
|
828428
828434
|
feature: "tokens",
|
|
828429
828435
|
maxRun: 1,
|
|
828430
828436
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
828431
|
-
(0,
|
|
828437
|
+
(0, import_invariant70.default)(maxSpendable.gt(0), "Spendable balance is too low");
|
|
828432
828438
|
const subAccount = (0, import_sample3.default)(getAssetsWithBalance(account3));
|
|
828433
|
-
(0,
|
|
828439
|
+
(0, import_invariant70.default)(subAccount && subAccount.type === "TokenAccount", "no subAccount with ASA");
|
|
828434
828440
|
const assetId = subAccount.token.id;
|
|
828435
828441
|
const sibling = pickSiblingsOptedIn(siblings, assetId);
|
|
828436
828442
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -828466,12 +828472,12 @@ var algorand = {
|
|
|
828466
828472
|
feature: "tokens",
|
|
828467
828473
|
maxRun: 1,
|
|
828468
828474
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
828469
|
-
(0,
|
|
828475
|
+
(0, import_invariant70.default)(maxSpendable.gt(new import_bignumber370.BigNumber(1e5)), "Spendable balance is too low");
|
|
828470
828476
|
const transaction = bridge28.createTransaction(account3);
|
|
828471
828477
|
const mode = "optIn";
|
|
828472
828478
|
const assetId = getRandomAssetId(account3);
|
|
828473
828479
|
const subAccount = account3.subAccounts ? account3.subAccounts.find((a65) => a65.id.includes(assetId)) : null;
|
|
828474
|
-
(0,
|
|
828480
|
+
(0, import_invariant70.default)(!subAccount, "already opt-in");
|
|
828475
828481
|
const updates7 = [
|
|
828476
828482
|
{
|
|
828477
828483
|
mode
|
|
@@ -828487,7 +828493,7 @@ var algorand = {
|
|
|
828487
828493
|
},
|
|
828488
828494
|
// eslint-disable-next-line no-unused-vars
|
|
828489
828495
|
test: ({ account: account3, transaction }) => {
|
|
828490
|
-
(0,
|
|
828496
|
+
(0, import_invariant70.default)(transaction.assetId, "should have an assetId");
|
|
828491
828497
|
const assetId = extractTokenId(transaction.assetId);
|
|
828492
828498
|
botTest("have sub account with asset id", () => (0, import_expect2.default)(account3.subAccounts && account3.subAccounts.some((a65) => a65.id.endsWith(assetId))).toBe(true));
|
|
828493
828499
|
}
|
|
@@ -828498,8 +828504,8 @@ var algorand = {
|
|
|
828498
828504
|
maxRun: 1,
|
|
828499
828505
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
828500
828506
|
const rewards = account3.algorandResources?.rewards;
|
|
828501
|
-
(0,
|
|
828502
|
-
(0,
|
|
828507
|
+
(0, import_invariant70.default)(rewards && rewards.gt(0), "No pending rewards");
|
|
828508
|
+
(0, import_invariant70.default)(maxSpendable.gt(0), "Spendable balance is too low");
|
|
828503
828509
|
const transaction = bridge28.createTransaction(account3);
|
|
828504
828510
|
const mode = "claimReward";
|
|
828505
828511
|
const updates7 = [
|
|
@@ -828523,7 +828529,7 @@ var specs_default = {
|
|
|
828523
828529
|
};
|
|
828524
828530
|
|
|
828525
828531
|
// ../../libs/coin-modules/coin-aptos/lib-es/test/bot-specs.js
|
|
828526
|
-
var
|
|
828532
|
+
var import_invariant71 = __toESM(require("invariant"));
|
|
828527
828533
|
var import_expect3 = __toESM(require_build21());
|
|
828528
828534
|
init_lib_es5();
|
|
828529
828535
|
var import_bignumber371 = __toESM(require("bignumber.js"));
|
|
@@ -828584,7 +828590,7 @@ var aptosSpecs = {
|
|
|
828584
828590
|
testTimeout: 6 * 60 * 1e3,
|
|
828585
828591
|
minViableAmount: MIN_SAFE,
|
|
828586
828592
|
transactionCheck: ({ maxSpendable }) => {
|
|
828587
|
-
(0,
|
|
828593
|
+
(0, import_invariant71.default)(maxSpendable.gt(MIN_SAFE), "balance is too low");
|
|
828588
828594
|
},
|
|
828589
828595
|
mutations: [
|
|
828590
828596
|
{
|
|
@@ -828593,7 +828599,7 @@ var aptosSpecs = {
|
|
|
828593
828599
|
maxRun: 1,
|
|
828594
828600
|
testDestination: genericTestDestination,
|
|
828595
828601
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
828596
|
-
(0,
|
|
828602
|
+
(0, import_invariant71.default)(maxSpendable.gt(MIN_SAFE), "balance is too low");
|
|
828597
828603
|
const sibling = pickSiblings(siblings, maxAccount);
|
|
828598
828604
|
const recipient = sibling.freshAddress;
|
|
828599
828605
|
const amount = maxSpendable.div(2).integerValue();
|
|
@@ -828645,7 +828651,7 @@ var bot_specs_default = {
|
|
|
828645
828651
|
// ../../libs/coin-modules/coin-bitcoin/lib-es/specs.js
|
|
828646
828652
|
var import_expect4 = __toESM(require_build21());
|
|
828647
828653
|
var import_bignumber372 = require("bignumber.js");
|
|
828648
|
-
var
|
|
828654
|
+
var import_invariant72 = __toESM(require("invariant"));
|
|
828649
828655
|
var import_bchaddrjs2 = __toESM(require_bchaddr());
|
|
828650
828656
|
var import_sample4 = __toESM(require("lodash/sample"));
|
|
828651
828657
|
init_lib_es2();
|
|
@@ -828712,13 +828718,13 @@ var acceptTransaction3 = deviceActionFlow({
|
|
|
828712
828718
|
|
|
828713
828719
|
// ../../libs/coin-modules/coin-bitcoin/lib-es/specs.js
|
|
828714
828720
|
var genericTest = ({ operation, account: account3, transaction, status, accountBeforeTransaction }) => {
|
|
828715
|
-
(0,
|
|
828721
|
+
(0, import_invariant72.default)(Date.now() - operation.date.getTime() < 1e6, "operation time to be recent");
|
|
828716
828722
|
botTest("account balance decreased with operation value", () => (0, import_expect4.default)(account3.balance.toString()).toBe(accountBeforeTransaction.balance.minus(operation.value).toString()));
|
|
828717
828723
|
const { txInputs, txOutputs } = status;
|
|
828718
|
-
(0,
|
|
828719
|
-
(0,
|
|
828724
|
+
(0, import_invariant72.default)(txInputs, "tx inputs defined");
|
|
828725
|
+
(0, import_invariant72.default)(txOutputs, "tx outputs defined");
|
|
828720
828726
|
const { bitcoinResources } = accountBeforeTransaction;
|
|
828721
|
-
(0,
|
|
828727
|
+
(0, import_invariant72.default)(bitcoinResources, "bitcoin resources");
|
|
828722
828728
|
const nonDeterministicPicking = transaction.utxoStrategy.strategy === bitcoinPickingStrategy.OPTIMIZE_SIZE;
|
|
828723
828729
|
const asSorted = (opShape) => ({
|
|
828724
828730
|
senders: opShape.senders.slice(0).sort(),
|
|
@@ -828747,7 +828753,7 @@ var bitcoinLikeMutations = ({ minimalAmount: minimalAmount11 = genericMinimalAmo
|
|
|
828747
828753
|
feature: "send",
|
|
828748
828754
|
maxRun: 1,
|
|
828749
828755
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
828750
|
-
(0,
|
|
828756
|
+
(0, import_invariant72.default)(maxSpendable.gt(minimalAmount11), "balance is too low");
|
|
828751
828757
|
const sibling = pickSiblings(siblings, targetAccountSize);
|
|
828752
828758
|
const recipient = recipientVariation(sibling.freshAddress);
|
|
828753
828759
|
const amount = maxSpendable.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
@@ -828781,7 +828787,7 @@ var bitcoinLikeMutations = ({ minimalAmount: minimalAmount11 = genericMinimalAmo
|
|
|
828781
828787
|
feature: "send",
|
|
828782
828788
|
maxRun: 1,
|
|
828783
828789
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
828784
|
-
(0,
|
|
828790
|
+
(0, import_invariant72.default)(maxSpendable.gt(minimalAmount11), "balance is too low");
|
|
828785
828791
|
const sibling = pickSiblings(siblings, targetAccountSize);
|
|
828786
828792
|
const transaction = {
|
|
828787
828793
|
...bridge28.createTransaction(account3),
|
|
@@ -828814,16 +828820,16 @@ var bitcoinLikeMutations = ({ minimalAmount: minimalAmount11 = genericMinimalAmo
|
|
|
828814
828820
|
feature: "send",
|
|
828815
828821
|
maxRun: 1,
|
|
828816
828822
|
transaction: ({ account: account3, bridge: bridge28, siblings, maxSpendable }) => {
|
|
828817
|
-
(0,
|
|
828823
|
+
(0, import_invariant72.default)(maxSpendable.gt(minimalAmount11), "balance is too low");
|
|
828818
828824
|
const sibling = pickSiblings(siblings, targetAccountSize);
|
|
828819
828825
|
const { bitcoinResources } = account3;
|
|
828820
|
-
(0,
|
|
828826
|
+
(0, import_invariant72.default)(bitcoinResources, "bitcoin resources");
|
|
828821
828827
|
const transaction = {
|
|
828822
828828
|
...bridge28.createTransaction(account3),
|
|
828823
828829
|
feePerByte: new import_bignumber372.BigNumber(1e-4)
|
|
828824
828830
|
};
|
|
828825
828831
|
const utxo = (0, import_sample4.default)(bitcoinResources.utxos.filter((u50) => u50.blockHeight && u50.value.gt(genericMinimalAmount)));
|
|
828826
|
-
(0,
|
|
828832
|
+
(0, import_invariant72.default)(utxo, "no confirmed utxo");
|
|
828827
828833
|
return {
|
|
828828
828834
|
transaction,
|
|
828829
828835
|
updates: [
|
|
@@ -828849,7 +828855,7 @@ var bitcoinLikeMutations = ({ minimalAmount: minimalAmount11 = genericMinimalAmo
|
|
|
828849
828855
|
testDestination,
|
|
828850
828856
|
test: ({ accountBeforeTransaction, account: account3, operation, transaction }) => {
|
|
828851
828857
|
const utxo = (accountBeforeTransaction.bitcoinResources?.utxos || []).find((utxo2) => !transaction.utxoStrategy.excludeUTXOs.some((u50) => u50.hash === utxo2.hash && u50.outputIndex === utxo2.outputIndex));
|
|
828852
|
-
(0,
|
|
828858
|
+
(0, import_invariant72.default)(utxo, "utxo available");
|
|
828853
828859
|
botTest("sender is only the utxo address", () => {
|
|
828854
828860
|
let expectedSender = utxo.address;
|
|
828855
828861
|
if (account3.currency.id === "bitcoin_cash" && expectedSender) {
|
|
@@ -828867,10 +828873,10 @@ var bitcoinLikeMutations = ({ minimalAmount: minimalAmount11 = genericMinimalAmo
|
|
|
828867
828873
|
feature: "send",
|
|
828868
828874
|
maxRun: 1,
|
|
828869
828875
|
transaction: ({ account: account3, bridge: bridge28, siblings, maxSpendable }) => {
|
|
828870
|
-
(0,
|
|
828876
|
+
(0, import_invariant72.default)(maxSpendable.gt(minimalAmount11), "balance is too low");
|
|
828871
828877
|
const sibling = pickSiblings(siblings, targetAccountSize);
|
|
828872
828878
|
const { bitcoinResources } = account3;
|
|
828873
|
-
(0,
|
|
828879
|
+
(0, import_invariant72.default)(bitcoinResources, "bitcoin resources");
|
|
828874
828880
|
const transaction = {
|
|
828875
828881
|
...bridge28.createTransaction(account3),
|
|
828876
828882
|
feePerByte: new import_bignumber372.BigNumber(1e-4),
|
|
@@ -828899,7 +828905,7 @@ var bitcoinLikeMutations = ({ minimalAmount: minimalAmount11 = genericMinimalAmo
|
|
|
828899
828905
|
feature: "sendMax",
|
|
828900
828906
|
maxRun: 1,
|
|
828901
828907
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
828902
|
-
(0,
|
|
828908
|
+
(0, import_invariant72.default)(maxSpendable.gt(minimalAmount11), "balance is too low");
|
|
828903
828909
|
const sibling = pickSiblings(siblings, targetAccountSize);
|
|
828904
828910
|
const recipient = recipientVariation(sibling.freshAddress);
|
|
828905
828911
|
const transaction = {
|
|
@@ -829170,7 +829176,7 @@ var specs_default2 = {
|
|
|
829170
829176
|
var import_expect5 = __toESM(require_build21());
|
|
829171
829177
|
init_lib_es5();
|
|
829172
829178
|
var import_bignumber373 = __toESM(require("bignumber.js"));
|
|
829173
|
-
var
|
|
829179
|
+
var import_invariant73 = __toESM(require("invariant"));
|
|
829174
829180
|
var import_typhonjs13 = __toESM(require_dist7());
|
|
829175
829181
|
|
|
829176
829182
|
// ../../libs/coin-modules/coin-cardano/lib-es/speculos-deviceActions.js
|
|
@@ -829322,12 +829328,12 @@ var cardano = {
|
|
|
829322
829328
|
feature: "tokens",
|
|
829323
829329
|
maxRun: 1,
|
|
829324
829330
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
829325
|
-
(0,
|
|
829331
|
+
(0, import_invariant73.default)(maxSpendable.gte(minSpendableRequiredForTokenTx), "balance is too low");
|
|
829326
829332
|
const sibling = pickSiblings(siblings, maxAccounts);
|
|
829327
829333
|
const recipient = sibling.freshAddress;
|
|
829328
829334
|
const transaction = bridge28.createTransaction(account3);
|
|
829329
829335
|
const subAccount = account3.subAccounts?.find((subAccount2) => subAccount2.balance.gt(1));
|
|
829330
|
-
(0,
|
|
829336
|
+
(0, import_invariant73.default)(subAccount, "No token account with balance");
|
|
829331
829337
|
const updates7 = [
|
|
829332
829338
|
{ subAccountId: subAccount.id },
|
|
829333
829339
|
{ recipient },
|
|
@@ -829353,7 +829359,7 @@ var cardano = {
|
|
|
829353
829359
|
feature: "send",
|
|
829354
829360
|
maxRun: 1,
|
|
829355
829361
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
829356
|
-
(0,
|
|
829362
|
+
(0, import_invariant73.default)(maxSpendable.gt(minBalanceRequired), "balance is too low");
|
|
829357
829363
|
const sibling = pickSiblings(siblings, maxAccounts);
|
|
829358
829364
|
const recipient = sibling.freshAddress;
|
|
829359
829365
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -829390,7 +829396,7 @@ var cardano = {
|
|
|
829390
829396
|
maxRun: 1,
|
|
829391
829397
|
testDestination: genericTestDestination,
|
|
829392
829398
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
829393
|
-
(0,
|
|
829399
|
+
(0, import_invariant73.default)(maxSpendable.gt(minBalanceRequiredForMaxSend), "balance is too low");
|
|
829394
829400
|
const sibling = pickSiblings(siblings, maxAccounts);
|
|
829395
829401
|
const recipient = sibling.freshAddress;
|
|
829396
829402
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -829418,7 +829424,7 @@ var cardano = {
|
|
|
829418
829424
|
feature: "staking",
|
|
829419
829425
|
maxRun: 1,
|
|
829420
829426
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
829421
|
-
(0,
|
|
829427
|
+
(0, import_invariant73.default)(maxSpendable.gte(minBalanceRequiredForDelegate), "balance is too low");
|
|
829422
829428
|
const transaction = bridge28.createTransaction(account3);
|
|
829423
829429
|
return {
|
|
829424
829430
|
transaction,
|
|
@@ -829450,8 +829456,8 @@ var cardano = {
|
|
|
829450
829456
|
feature: "staking",
|
|
829451
829457
|
maxRun: 1,
|
|
829452
829458
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
829453
|
-
(0,
|
|
829454
|
-
(0,
|
|
829459
|
+
(0, import_invariant73.default)(maxSpendable.gte(minBalanceRequiredForDelegate), "balance is too low");
|
|
829460
|
+
(0, import_invariant73.default)(account3.cardanoResources.delegation?.poolId, "account should already be delegated to redelegate");
|
|
829455
829461
|
const transaction = bridge28.createTransaction(account3);
|
|
829456
829462
|
return {
|
|
829457
829463
|
transaction,
|
|
@@ -829477,8 +829483,8 @@ var cardano = {
|
|
|
829477
829483
|
feature: "staking",
|
|
829478
829484
|
maxRun: 1,
|
|
829479
829485
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
829480
|
-
(0,
|
|
829481
|
-
(0,
|
|
829486
|
+
(0, import_invariant73.default)(maxSpendable.gte(minBalanceRequiredForDelegate), "balance is too low");
|
|
829487
|
+
(0, import_invariant73.default)(account3.cardanoResources.delegation?.poolId, "account should already be delegated to undelegate");
|
|
829482
829488
|
const transaction = bridge28.createTransaction(account3);
|
|
829483
829489
|
return {
|
|
829484
829490
|
transaction,
|
|
@@ -829503,7 +829509,7 @@ var cardano = {
|
|
|
829503
829509
|
var specs_default3 = { cardano };
|
|
829504
829510
|
|
|
829505
829511
|
// ../../libs/coin-modules/coin-casper/lib-es/test/bot-specs.js
|
|
829506
|
-
var
|
|
829512
|
+
var import_invariant74 = __toESM(require("invariant"));
|
|
829507
829513
|
init_lib_es5();
|
|
829508
829514
|
var import_bignumber374 = __toESM(require("bignumber.js"));
|
|
829509
829515
|
var import_expect6 = __toESM(require_build21());
|
|
@@ -829571,7 +829577,7 @@ var casperSpecs = {
|
|
|
829571
829577
|
testTimeout: 6 * 60 * 1e3,
|
|
829572
829578
|
minViableAmount: MIN_SAFE2,
|
|
829573
829579
|
transactionCheck: ({ maxSpendable }) => {
|
|
829574
|
-
(0,
|
|
829580
|
+
(0, import_invariant74.default)(maxSpendable.gt(MIN_SAFE2), "balance is too low");
|
|
829575
829581
|
},
|
|
829576
829582
|
mutations: [
|
|
829577
829583
|
{
|
|
@@ -829580,7 +829586,7 @@ var casperSpecs = {
|
|
|
829580
829586
|
maxRun: 1,
|
|
829581
829587
|
testDestination: genericTestDestination,
|
|
829582
829588
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
829583
|
-
(0,
|
|
829589
|
+
(0, import_invariant74.default)(maxSpendable.gt(MIN_SAFE2), "balance is too low");
|
|
829584
829590
|
const sibling = pickSiblings(siblings, maxAccount2);
|
|
829585
829591
|
const recipient = sibling.freshAddress;
|
|
829586
829592
|
const amount = maxSpendable.div(2).integerValue();
|
|
@@ -829658,7 +829664,7 @@ var bot_specs_default2 = {
|
|
|
829658
829664
|
init_lib_es5();
|
|
829659
829665
|
|
|
829660
829666
|
// ../../libs/coin-modules/coin-celo/lib-es/test/specs/createSendMutation.js
|
|
829661
|
-
var
|
|
829667
|
+
var import_invariant75 = __toESM(require("invariant"));
|
|
829662
829668
|
var maxAccount3 = 10;
|
|
829663
829669
|
var currency8 = getCryptoCurrencyById("celo");
|
|
829664
829670
|
var minimalAmount = parseCurrencyUnit(currency8.units[0], "0.01");
|
|
@@ -829667,7 +829673,7 @@ var createSend50PercentMutation = () => ({
|
|
|
829667
829673
|
feature: "send",
|
|
829668
829674
|
maxRun: 1,
|
|
829669
829675
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
829670
|
-
(0,
|
|
829676
|
+
(0, import_invariant75.default)(maxSpendable.gt(minimalAmount), "Celo: Move 50% | balance is too low");
|
|
829671
829677
|
const sibling = pickSiblings(siblings, maxAccount3);
|
|
829672
829678
|
const recipient = sibling.freshAddress;
|
|
829673
829679
|
const amount = maxSpendable.div(2).integerValue();
|
|
@@ -829682,7 +829688,7 @@ var createSendMaxMutation = () => ({
|
|
|
829682
829688
|
feature: "sendMax",
|
|
829683
829689
|
maxRun: 1,
|
|
829684
829690
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
829685
|
-
(0,
|
|
829691
|
+
(0, import_invariant75.default)(maxSpendable.gt(minimalAmount), "Celo: Send Max | Balance is too low");
|
|
829686
829692
|
const sibling = pickSiblings(siblings, maxAccount3);
|
|
829687
829693
|
const recipient = sibling.freshAddress;
|
|
829688
829694
|
return {
|
|
@@ -829693,7 +829699,7 @@ var createSendMaxMutation = () => ({
|
|
|
829693
829699
|
});
|
|
829694
829700
|
|
|
829695
829701
|
// ../../libs/coin-modules/coin-celo/lib-es/test/specs/createLockMutation.js
|
|
829696
|
-
var
|
|
829702
|
+
var import_invariant76 = __toESM(require("invariant"));
|
|
829697
829703
|
var currency9 = getCryptoCurrencyById("celo");
|
|
829698
829704
|
var minimalAmount2 = parseCurrencyUnit(currency9.units[0], "0.005");
|
|
829699
829705
|
var createLockMutation = () => ({
|
|
@@ -829702,10 +829708,10 @@ var createLockMutation = () => ({
|
|
|
829702
829708
|
maxRun: 1,
|
|
829703
829709
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
829704
829710
|
const { celoResources } = account3;
|
|
829705
|
-
(0,
|
|
829706
|
-
(0,
|
|
829711
|
+
(0, import_invariant76.default)(celoResources?.registrationStatus, "Celo: Lock Vote | Account is not registered");
|
|
829712
|
+
(0, import_invariant76.default)(maxSpendable.gt(minimalAmount2), "Celo: Lock | balance is too low");
|
|
829707
829713
|
const amount = minimalAmount2.times(Math.random()).integerValue().precision(8);
|
|
829708
|
-
(0,
|
|
829714
|
+
(0, import_invariant76.default)(amount.gt(0), "Celo: Lock | Not enough funds to lock tokens");
|
|
829709
829715
|
const transaction = {
|
|
829710
829716
|
amount
|
|
829711
829717
|
};
|
|
@@ -829722,7 +829728,7 @@ var createLockMutation = () => ({
|
|
|
829722
829728
|
});
|
|
829723
829729
|
|
|
829724
829730
|
// ../../libs/coin-modules/coin-celo/lib-es/test/specs/createUnlockMutation.js
|
|
829725
|
-
var
|
|
829731
|
+
var import_invariant77 = __toESM(require("invariant"));
|
|
829726
829732
|
var import_bignumber375 = __toESM(require("bignumber.js"));
|
|
829727
829733
|
var currency10 = getCryptoCurrencyById("celo");
|
|
829728
829734
|
var minimalAmount3 = parseCurrencyUnit(currency10.units[0], "0.001");
|
|
@@ -829731,11 +829737,11 @@ var createUnlockMutation = () => ({
|
|
|
829731
829737
|
feature: "staking",
|
|
829732
829738
|
maxRun: 1,
|
|
829733
829739
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
829734
|
-
(0,
|
|
829740
|
+
(0, import_invariant77.default)(maxSpendable.gt(minimalAmount3), "Celo: Unlock | balance is too low");
|
|
829735
829741
|
const { celoResources } = account3;
|
|
829736
|
-
(0,
|
|
829742
|
+
(0, import_invariant77.default)(celoResources?.registrationStatus, "Celo: Unlock | Account is not registered");
|
|
829737
829743
|
const nonvotingLockedBalance = celoResources?.nonvotingLockedBalance || new import_bignumber375.default(0);
|
|
829738
|
-
(0,
|
|
829744
|
+
(0, import_invariant77.default)(nonvotingLockedBalance.gt(0), "Celo: Unlock | No non voting locked balance");
|
|
829739
829745
|
return {
|
|
829740
829746
|
transaction: bridge28.createTransaction(account3),
|
|
829741
829747
|
updates: [
|
|
@@ -829751,7 +829757,7 @@ var createUnlockMutation = () => ({
|
|
|
829751
829757
|
});
|
|
829752
829758
|
|
|
829753
829759
|
// ../../libs/coin-modules/coin-celo/lib-es/test/specs/createRegisterAccountMutation.js
|
|
829754
|
-
var
|
|
829760
|
+
var import_invariant78 = __toESM(require("invariant"));
|
|
829755
829761
|
var currency11 = getCryptoCurrencyById("celo");
|
|
829756
829762
|
var minimalAmount4 = parseCurrencyUnit(currency11.units[0], "0.001");
|
|
829757
829763
|
var createRegisterAccountMutation = () => ({
|
|
@@ -829760,8 +829766,8 @@ var createRegisterAccountMutation = () => ({
|
|
|
829760
829766
|
maxRun: 1,
|
|
829761
829767
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
829762
829768
|
const { celoResources } = account3;
|
|
829763
|
-
(0,
|
|
829764
|
-
(0,
|
|
829769
|
+
(0, import_invariant78.default)(!celoResources?.registrationStatus, "Celo: Register Account | Celo account is already registered");
|
|
829770
|
+
(0, import_invariant78.default)(maxSpendable.gt(minimalAmount4), "Celo: Register Account | Celo account balance is too low to register account");
|
|
829765
829771
|
return {
|
|
829766
829772
|
transaction: bridge28.createTransaction(account3),
|
|
829767
829773
|
updates: [
|
|
@@ -829774,7 +829780,7 @@ var createRegisterAccountMutation = () => ({
|
|
|
829774
829780
|
});
|
|
829775
829781
|
|
|
829776
829782
|
// ../../libs/coin-modules/coin-celo/lib-es/test/specs/createVoteMutation.js
|
|
829777
|
-
var
|
|
829783
|
+
var import_invariant79 = __toESM(require("invariant"));
|
|
829778
829784
|
var import_bignumber376 = __toESM(require("bignumber.js"));
|
|
829779
829785
|
var import_sampleSize = __toESM(require("lodash/sampleSize"));
|
|
829780
829786
|
var currency12 = getCryptoCurrencyById("celo");
|
|
@@ -829784,16 +829790,16 @@ var createVoteMutation = () => ({
|
|
|
829784
829790
|
feature: "staking",
|
|
829785
829791
|
maxRun: 1,
|
|
829786
829792
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
829787
|
-
(0,
|
|
829793
|
+
(0, import_invariant79.default)(maxSpendable.gt(minimalAmount5), "Celo: Vote | balance is too low");
|
|
829788
829794
|
const { celoResources } = account3;
|
|
829789
|
-
(0,
|
|
829795
|
+
(0, import_invariant79.default)(celoResources?.registrationStatus, "Celo: Vote | Account is not registered");
|
|
829790
829796
|
const nonvotingLockedBalance = celoResources?.nonvotingLockedBalance || new import_bignumber376.default(0);
|
|
829791
|
-
(0,
|
|
829797
|
+
(0, import_invariant79.default)(nonvotingLockedBalance.gt(0), "Celo: Vote | No non voting locked balance");
|
|
829792
829798
|
const votes2 = celoResources.votes || [];
|
|
829793
829799
|
const { validatorGroups } = getCurrentCeloPreloadData();
|
|
829794
829800
|
const validatorGroupWithoutVotes = (0, import_sampleSize.default)(getValidatorGroupsWithoutVotes(validatorGroups, votes2), 1)[0];
|
|
829795
829801
|
const amount = nonvotingLockedBalance.times(0.5).precision(8).integerValue();
|
|
829796
|
-
(0,
|
|
829802
|
+
(0, import_invariant79.default)(amount.gt(0), "Celo: Vote | Not enough funds to vote");
|
|
829797
829803
|
const transaction = {
|
|
829798
829804
|
recipient: validatorGroupWithoutVotes.address,
|
|
829799
829805
|
amount
|
|
@@ -829811,7 +829817,7 @@ var createVoteMutation = () => ({
|
|
|
829811
829817
|
});
|
|
829812
829818
|
|
|
829813
829819
|
// ../../libs/coin-modules/coin-celo/lib-es/test/specs/createActivateVoteMutation.js
|
|
829814
|
-
var
|
|
829820
|
+
var import_invariant80 = __toESM(require("invariant"));
|
|
829815
829821
|
var currency13 = getCryptoCurrencyById("celo");
|
|
829816
829822
|
var minimalAmount6 = parseCurrencyUnit(currency13.units[0], "0.001");
|
|
829817
829823
|
var createActivateVoteMutation = () => ({
|
|
@@ -829820,10 +829826,10 @@ var createActivateVoteMutation = () => ({
|
|
|
829820
829826
|
maxRun: 1,
|
|
829821
829827
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
829822
829828
|
const { celoResources } = account3;
|
|
829823
|
-
(0,
|
|
829824
|
-
(0,
|
|
829829
|
+
(0, import_invariant80.default)(celoResources?.registrationStatus, "Celo: Activate Vote | Account is not registered");
|
|
829830
|
+
(0, import_invariant80.default)(maxSpendable.gt(minimalAmount6), "Celo: Activate Vote | balance is too low");
|
|
829825
829831
|
const activatableVote = celoResources?.votes?.find((vote) => vote.activatable);
|
|
829826
|
-
(0,
|
|
829832
|
+
(0, import_invariant80.default)(!!activatableVote, "Celo: Activate Vote | No activatable votes");
|
|
829827
829833
|
const transaction = {
|
|
829828
829834
|
recipient: activatableVote.validatorGroup
|
|
829829
829835
|
};
|
|
@@ -829840,7 +829846,7 @@ var createActivateVoteMutation = () => ({
|
|
|
829840
829846
|
});
|
|
829841
829847
|
|
|
829842
829848
|
// ../../libs/coin-modules/coin-celo/lib-es/test/specs/createRevokeVoteMutation.js
|
|
829843
|
-
var
|
|
829849
|
+
var import_invariant81 = __toESM(require("invariant"));
|
|
829844
829850
|
var currency14 = getCryptoCurrencyById("celo");
|
|
829845
829851
|
var minimalAmount7 = parseCurrencyUnit(currency14.units[0], "0.001");
|
|
829846
829852
|
var createRevokeVoteMutation = () => ({
|
|
@@ -829848,11 +829854,11 @@ var createRevokeVoteMutation = () => ({
|
|
|
829848
829854
|
feature: "staking",
|
|
829849
829855
|
maxRun: 1,
|
|
829850
829856
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
829851
|
-
(0,
|
|
829857
|
+
(0, import_invariant81.default)(maxSpendable.gt(minimalAmount7), "Celo: Revoke Vote | balance is too low");
|
|
829852
829858
|
const { celoResources } = account3;
|
|
829853
|
-
(0,
|
|
829859
|
+
(0, import_invariant81.default)(celoResources?.registrationStatus, "Celo: RevokeVote | Account is not registered");
|
|
829854
829860
|
const revokableVote = celoResources?.votes?.find((vote) => vote.revokable);
|
|
829855
|
-
(0,
|
|
829861
|
+
(0, import_invariant81.default)(!!revokableVote, "Celo: RevokeVote | Revokable vote not found");
|
|
829856
829862
|
return {
|
|
829857
829863
|
transaction: bridge28.createTransaction(account3),
|
|
829858
829864
|
updates: [
|
|
@@ -829870,7 +829876,7 @@ var createRevokeVoteMutation = () => ({
|
|
|
829870
829876
|
});
|
|
829871
829877
|
|
|
829872
829878
|
// ../../libs/coin-modules/coin-celo/lib-es/test/specs/createWithdrawMutation.js
|
|
829873
|
-
var
|
|
829879
|
+
var import_invariant82 = __toESM(require("invariant"));
|
|
829874
829880
|
var currency15 = getCryptoCurrencyById("celo");
|
|
829875
829881
|
var minimalAmount8 = parseCurrencyUnit(currency15.units[0], "0.001");
|
|
829876
829882
|
var createWithdrawMutation = () => ({
|
|
@@ -829880,10 +829886,10 @@ var createWithdrawMutation = () => ({
|
|
|
829880
829886
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
829881
829887
|
const celoAccount = account3;
|
|
829882
829888
|
const { celoResources } = celoAccount;
|
|
829883
|
-
(0,
|
|
829889
|
+
(0, import_invariant82.default)(celoResources?.registrationStatus, "Celo: Withdraw | Account is not registered");
|
|
829884
829890
|
const pendingWithdrawals = availablePendingWithdrawals(celoAccount);
|
|
829885
|
-
(0,
|
|
829886
|
-
(0,
|
|
829891
|
+
(0, import_invariant82.default)(pendingWithdrawals.length > 0, "Celo: Withdraw | No withdrawable balance");
|
|
829892
|
+
(0, import_invariant82.default)(maxSpendable.gt(minimalAmount8), "Celo: Withdraw Vote | balance is too low");
|
|
829887
829893
|
return {
|
|
829888
829894
|
transaction: bridge28.createTransaction(celoAccount),
|
|
829889
829895
|
updates: [
|
|
@@ -829992,7 +829998,7 @@ var bot_specs_default3 = {
|
|
|
829992
829998
|
// ../../libs/coin-modules/coin-cosmos/lib-es/specs.js
|
|
829993
829999
|
var import_bignumber377 = require("bignumber.js");
|
|
829994
830000
|
var import_expect7 = __toESM(require_build21());
|
|
829995
|
-
var
|
|
830001
|
+
var import_invariant83 = __toESM(require("invariant"));
|
|
829996
830002
|
var import_sample5 = __toESM(require("lodash/sample"));
|
|
829997
830003
|
var import_sampleSize2 = __toESM(require("lodash/sampleSize"));
|
|
829998
830004
|
init_lib_es5();
|
|
@@ -830173,9 +830179,9 @@ function cosmosLikeMutations(minimalTransactionAmount) {
|
|
|
830173
830179
|
(0, import_expect7.default)(account3.balance.toString()).toBe(accountBeforeTransaction.balance.minus(operation.value).toString());
|
|
830174
830180
|
},
|
|
830175
830181
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
830176
|
-
(0,
|
|
830182
|
+
(0, import_invariant83.default)(maxSpendable.gt(minimalTransactionAmount), "balance is too low for send");
|
|
830177
830183
|
const amount = maxSpendable.times(0.3 + 0.4 * Math.random()).integerValue();
|
|
830178
|
-
(0,
|
|
830184
|
+
(0, import_invariant83.default)(amount.gt(0), "random amount to be positive");
|
|
830179
830185
|
return {
|
|
830180
830186
|
transaction: bridge28.createTransaction(account3),
|
|
830181
830187
|
updates: [
|
|
@@ -830198,7 +830204,7 @@ function cosmosLikeMutations(minimalTransactionAmount) {
|
|
|
830198
830204
|
maxRun: 1,
|
|
830199
830205
|
testDestination: genericTestDestination,
|
|
830200
830206
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
830201
|
-
(0,
|
|
830207
|
+
(0, import_invariant83.default)(maxSpendable.gt(minimalTransactionAmount), "balance is too low for send max");
|
|
830202
830208
|
return {
|
|
830203
830209
|
transaction: bridge28.createTransaction(account3),
|
|
830204
830210
|
updates: [
|
|
@@ -830221,20 +830227,20 @@ function cosmosLikeMutations(minimalTransactionAmount) {
|
|
|
830221
830227
|
maxRun: 1,
|
|
830222
830228
|
transaction: ({ account: account3, bridge: bridge28, siblings }) => {
|
|
830223
830229
|
expectSiblingsHaveSpendablePartGreaterThan(siblings, 0.5);
|
|
830224
|
-
(0,
|
|
830225
|
-
(0,
|
|
830230
|
+
(0, import_invariant83.default)(account3.index % 2 > 0, "only one out of 2 accounts is not going to delegate");
|
|
830231
|
+
(0, import_invariant83.default)(canDelegate(account3), "can delegate");
|
|
830226
830232
|
const { cosmosResources } = account3;
|
|
830227
|
-
(0,
|
|
830228
|
-
(0,
|
|
830233
|
+
(0, import_invariant83.default)(cosmosResources, "cosmos");
|
|
830234
|
+
(0, import_invariant83.default)(cosmosResources.delegations.length < 3, "already enough delegations");
|
|
830229
830235
|
const data6 = getCurrentCosmosPreloadData()[account3.currency.id];
|
|
830230
830236
|
const count = 1;
|
|
830231
830237
|
let remaining = getMaxDelegationAvailable(account3, count).minus(minimalTransactionAmount.times(2)).times(0.1 * Math.random());
|
|
830232
|
-
(0,
|
|
830238
|
+
(0, import_invariant83.default)(remaining.gt(0), "not enough funds in account for delegate");
|
|
830233
830239
|
const all8 = data6.validators.filter((v38) => !cosmosResources.delegations.some(
|
|
830234
830240
|
// new delegations only
|
|
830235
830241
|
(d56) => d56.validatorAddress === v38.validatorAddress
|
|
830236
830242
|
));
|
|
830237
|
-
(0,
|
|
830243
|
+
(0, import_invariant83.default)(all8.length > 0, "no validators found");
|
|
830238
830244
|
const validators7 = (0, import_sampleSize2.default)(all8, count).map((delegation) => {
|
|
830239
830245
|
const amount = remaining.times(Math.random() * Math.random()).integerValue();
|
|
830240
830246
|
remaining = remaining.minus(amount);
|
|
@@ -830243,7 +830249,7 @@ function cosmosLikeMutations(minimalTransactionAmount) {
|
|
|
830243
830249
|
amount
|
|
830244
830250
|
};
|
|
830245
830251
|
}).filter((v38) => v38.amount.gt(0));
|
|
830246
|
-
(0,
|
|
830252
|
+
(0, import_invariant83.default)(validators7.length > 0, "no possible delegation found");
|
|
830247
830253
|
return {
|
|
830248
830254
|
transaction: bridge28.createTransaction(account3),
|
|
830249
830255
|
updates: [
|
|
@@ -830260,10 +830266,10 @@ function cosmosLikeMutations(minimalTransactionAmount) {
|
|
|
830260
830266
|
},
|
|
830261
830267
|
test: ({ account: account3, transaction }) => {
|
|
830262
830268
|
const { cosmosResources } = account3;
|
|
830263
|
-
(0,
|
|
830269
|
+
(0, import_invariant83.default)(cosmosResources, "cosmos");
|
|
830264
830270
|
transaction.validators.forEach((v38) => {
|
|
830265
830271
|
const d56 = cosmosResources.delegations.find((d57) => d57.validatorAddress === v38.address);
|
|
830266
|
-
(0,
|
|
830272
|
+
(0, import_invariant83.default)(d56, "delegated %s must be found in account", v38.address);
|
|
830267
830273
|
botTest("delegator have planned address and amount", () => {
|
|
830268
830274
|
(0, import_expect7.default)(v38.address).toBe(d56.validatorAddress);
|
|
830269
830275
|
checkAmountsCloseEnough(v38.amount, d56.amount);
|
|
@@ -830276,15 +830282,15 @@ function cosmosLikeMutations(minimalTransactionAmount) {
|
|
|
830276
830282
|
feature: "staking",
|
|
830277
830283
|
maxRun: 1,
|
|
830278
830284
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
830279
|
-
(0,
|
|
830285
|
+
(0, import_invariant83.default)(canUndelegate(account3), "can undelegate");
|
|
830280
830286
|
const { cosmosResources } = account3;
|
|
830281
|
-
(0,
|
|
830282
|
-
(0,
|
|
830283
|
-
(0,
|
|
830287
|
+
(0, import_invariant83.default)(cosmosResources, "cosmos");
|
|
830288
|
+
(0, import_invariant83.default)(maxSpendable.gt(minimalTransactionAmount.times(2)), "balance is too low");
|
|
830289
|
+
(0, import_invariant83.default)(cosmosResources.delegations.length > 0, "already enough delegations");
|
|
830284
830290
|
const undelegateCandidate = (0, import_sample5.default)(cosmosResources.delegations.filter((d56) => !cosmosResources.redelegations.some((r38) => r38.validatorSrcAddress === d56.validatorAddress || r38.validatorDstAddress === d56.validatorAddress) && !cosmosResources.unbondings.some((r38) => r38.validatorAddress === d56.validatorAddress)));
|
|
830285
|
-
(0,
|
|
830291
|
+
(0, import_invariant83.default)(undelegateCandidate, "already pending");
|
|
830286
830292
|
const amount = undelegateCandidate.amount.times(Math.random() > 0.2 ? 1 : Math.random()).integerValue();
|
|
830287
|
-
(0,
|
|
830293
|
+
(0, import_invariant83.default)(amount.gt(0), "random amount to be positive");
|
|
830288
830294
|
return {
|
|
830289
830295
|
transaction: bridge28.createTransaction(account3),
|
|
830290
830296
|
updates: [
|
|
@@ -830305,10 +830311,10 @@ function cosmosLikeMutations(minimalTransactionAmount) {
|
|
|
830305
830311
|
},
|
|
830306
830312
|
test: ({ account: account3, transaction }) => {
|
|
830307
830313
|
const { cosmosResources } = account3;
|
|
830308
|
-
(0,
|
|
830314
|
+
(0, import_invariant83.default)(cosmosResources, "cosmos");
|
|
830309
830315
|
transaction.validators.forEach((v38) => {
|
|
830310
830316
|
const d56 = cosmosResources.unbondings.find((d57) => d57.validatorAddress === v38.address);
|
|
830311
|
-
(0,
|
|
830317
|
+
(0, import_invariant83.default)(d56, "undelegated %s must be found in account", v38.address);
|
|
830312
830318
|
botTest("validator have planned address and amount", () => {
|
|
830313
830319
|
(0, import_expect7.default)(v38.address).toBe(d56.validatorAddress);
|
|
830314
830320
|
checkAmountsCloseEnough(v38.amount, d56.amount);
|
|
@@ -830322,16 +830328,16 @@ function cosmosLikeMutations(minimalTransactionAmount) {
|
|
|
830322
830328
|
maxRun: 1,
|
|
830323
830329
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
830324
830330
|
const { cosmosResources } = account3;
|
|
830325
|
-
(0,
|
|
830326
|
-
(0,
|
|
830331
|
+
(0, import_invariant83.default)(cosmosResources, "cosmos");
|
|
830332
|
+
(0, import_invariant83.default)(maxSpendable.gt(minimalTransactionAmount.times(3)), "balance is too low for redelegate");
|
|
830327
830333
|
const sourceDelegation = (0, import_sample5.default)(cosmosResources.delegations.filter((d56) => canRedelegate(account3, d56)));
|
|
830328
|
-
(0,
|
|
830334
|
+
(0, import_invariant83.default)(sourceDelegation, "none can redelegate");
|
|
830329
830335
|
const delegation = (0, import_sample5.default)(cosmosResources.delegations.filter((d56) => d56.validatorAddress !== sourceDelegation.validatorAddress));
|
|
830330
830336
|
const amount = sourceDelegation.amount.times(
|
|
830331
830337
|
// most of the time redelegate all
|
|
830332
830338
|
Math.random() > 0.2 ? 1 : Math.random()
|
|
830333
830339
|
).integerValue();
|
|
830334
|
-
(0,
|
|
830340
|
+
(0, import_invariant83.default)(amount.gt(0), "random amount to be positive");
|
|
830335
830341
|
return {
|
|
830336
830342
|
transaction: bridge28.createTransaction(account3),
|
|
830337
830343
|
updates: [
|
|
@@ -830351,7 +830357,7 @@ function cosmosLikeMutations(minimalTransactionAmount) {
|
|
|
830351
830357
|
},
|
|
830352
830358
|
test: ({ account: account3, transaction }) => {
|
|
830353
830359
|
const { cosmosResources } = account3;
|
|
830354
|
-
(0,
|
|
830360
|
+
(0, import_invariant83.default)(cosmosResources, "cosmos");
|
|
830355
830361
|
transaction.validators.forEach((v38) => {
|
|
830356
830362
|
const existing = cosmosResources.delegations.find((d56) => d56.validatorAddress === v38.address);
|
|
830357
830363
|
if (!existing) {
|
|
@@ -830359,7 +830365,7 @@ function cosmosLikeMutations(minimalTransactionAmount) {
|
|
|
830359
830365
|
// FIXME: valueOf for date arithmetic operations in typescript
|
|
830360
830366
|
(a65, b19) => b19.completionDate.valueOf() - a65.completionDate.valueOf()
|
|
830361
830367
|
).find((d57) => d57.validatorDstAddress === v38.address && d57.validatorSrcAddress === transaction.sourceValidator);
|
|
830362
|
-
(0,
|
|
830368
|
+
(0, import_invariant83.default)(d56, "redelegated %s must be found in account", v38.address);
|
|
830363
830369
|
botTest("validator have planned address and amount", () => {
|
|
830364
830370
|
(0, import_expect7.default)(v38.address).toBe(d56.validatorDstAddress);
|
|
830365
830371
|
checkAmountsCloseEnough(v38.amount, d56.amount);
|
|
@@ -830374,10 +830380,10 @@ function cosmosLikeMutations(minimalTransactionAmount) {
|
|
|
830374
830380
|
maxRun: 1,
|
|
830375
830381
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
830376
830382
|
const { cosmosResources } = account3;
|
|
830377
|
-
(0,
|
|
830378
|
-
(0,
|
|
830383
|
+
(0, import_invariant83.default)(cosmosResources, "cosmos");
|
|
830384
|
+
(0, import_invariant83.default)(maxSpendable.gt(minimalTransactionAmount.times(2)), "balance is too low for claim rewards");
|
|
830379
830385
|
const delegation = (0, import_sample5.default)(cosmosResources.delegations.filter((d56) => d56.pendingRewards.gt(1e3)));
|
|
830380
|
-
(0,
|
|
830386
|
+
(0, import_invariant83.default)(delegation, "no delegation to claim");
|
|
830381
830387
|
return {
|
|
830382
830388
|
transaction: bridge28.createTransaction(account3),
|
|
830383
830389
|
updates: [
|
|
@@ -830396,11 +830402,11 @@ function cosmosLikeMutations(minimalTransactionAmount) {
|
|
|
830396
830402
|
},
|
|
830397
830403
|
test: ({ account: account3, transaction }) => {
|
|
830398
830404
|
const { cosmosResources } = account3;
|
|
830399
|
-
(0,
|
|
830405
|
+
(0, import_invariant83.default)(cosmosResources, "cosmos");
|
|
830400
830406
|
transaction.validators.forEach((v38) => {
|
|
830401
830407
|
const d56 = cosmosResources.delegations.find((d57) => d57.validatorAddress === v38.address);
|
|
830402
|
-
botTest("delegation exists in account", () => (0,
|
|
830403
|
-
botTest("reward is no longer claimable after claim", () => (0,
|
|
830408
|
+
botTest("delegation exists in account", () => (0, import_invariant83.default)(d56, "delegation %s must be found in account", v38.address));
|
|
830409
|
+
botTest("reward is no longer claimable after claim", () => (0, import_invariant83.default)(d56?.pendingRewards.lte(d56.amount.multipliedBy(0.1)), "pending reward is not reset"));
|
|
830404
830410
|
});
|
|
830405
830411
|
}
|
|
830406
830412
|
}
|
|
@@ -830607,7 +830613,7 @@ var specs_default4 = {
|
|
|
830607
830613
|
|
|
830608
830614
|
// ../../libs/coin-modules/coin-evm/lib-es/specs.js
|
|
830609
830615
|
var import_expect8 = __toESM(require_build21());
|
|
830610
|
-
var
|
|
830616
|
+
var import_invariant84 = __toESM(require("invariant"));
|
|
830611
830617
|
var import_sample6 = __toESM(require("lodash/sample"));
|
|
830612
830618
|
var import_bignumber378 = __toESM(require("bignumber.js"));
|
|
830613
830619
|
init_lib_es5();
|
|
@@ -830814,7 +830820,7 @@ var testCoinBalance = ({ account: account3, accountBeforeTransaction, operation
|
|
|
830814
830820
|
var transactionCheck = (currencyId) => ({ maxSpendable }) => {
|
|
830815
830821
|
const currency24 = getCryptoCurrencyById(currencyId);
|
|
830816
830822
|
const minBalance = parseCurrencyUnit(currency24.units[0], `${minBalancePerCurrencyId[currency24.id] || 1}`);
|
|
830817
|
-
(0,
|
|
830823
|
+
(0, import_invariant84.default)(maxSpendable.gt(minBalance), `${currencyId} balance is too low`);
|
|
830818
830824
|
};
|
|
830819
830825
|
var evmBasicMutations = ({ maxAccount: maxAccount10 }) => [
|
|
830820
830826
|
{
|
|
@@ -830890,7 +830896,7 @@ var moveErc20Mutation = {
|
|
|
830890
830896
|
testDestination: testTokenDestination,
|
|
830891
830897
|
transaction: ({ account: account3, siblings, bridge: bridge28 }) => {
|
|
830892
830898
|
const erc20Account = (0, import_sample6.default)((account3.subAccounts || []).filter((a65) => a65.balance.gt(0)));
|
|
830893
|
-
(0,
|
|
830899
|
+
(0, import_invariant84.default)(erc20Account, "no erc20 account");
|
|
830894
830900
|
const sibling = pickSiblings(siblings, 3);
|
|
830895
830901
|
const recipient = sibling.freshAddress;
|
|
830896
830902
|
return {
|
|
@@ -830909,12 +830915,12 @@ var moveErc20Mutation = {
|
|
|
830909
830915
|
};
|
|
830910
830916
|
},
|
|
830911
830917
|
test: ({ accountBeforeTransaction, account: account3, transaction }) => {
|
|
830912
|
-
(0,
|
|
830918
|
+
(0, import_invariant84.default)(accountBeforeTransaction.subAccounts, "sub accounts before");
|
|
830913
830919
|
const erc20accountBefore = accountBeforeTransaction.subAccounts?.find((s49) => s49.id === transaction.subAccountId);
|
|
830914
|
-
(0,
|
|
830915
|
-
(0,
|
|
830920
|
+
(0, import_invariant84.default)(erc20accountBefore, "erc20 acc was here before");
|
|
830921
|
+
(0, import_invariant84.default)(account3.subAccounts, "sub accounts");
|
|
830916
830922
|
const erc20account = account3.subAccounts.find((s49) => s49.id === transaction.subAccountId);
|
|
830917
|
-
(0,
|
|
830923
|
+
(0, import_invariant84.default)(erc20account, "erc20 acc is still here");
|
|
830918
830924
|
if (transaction.useAllAmount) {
|
|
830919
830925
|
botTest("erc20 account is empty", () => (0, import_expect8.default)(erc20account.balance.toString()).toBe("0"));
|
|
830920
830926
|
} else {
|
|
@@ -830994,7 +831000,7 @@ var specs_default5 = Object.values(cryptocurrenciesById).filter((currency24) =>
|
|
|
830994
831000
|
|
|
830995
831001
|
// ../../libs/coin-modules/coin-hedera/lib-es/test/bot-specs.js
|
|
830996
831002
|
var import_expect9 = __toESM(require_build21());
|
|
830997
|
-
var
|
|
831003
|
+
var import_invariant85 = __toESM(require("invariant"));
|
|
830998
831004
|
init_lib_es5();
|
|
830999
831005
|
|
|
831000
831006
|
// ../../libs/coin-modules/coin-hedera/lib-es/test/speculos-deviceActions.js
|
|
@@ -831063,7 +831069,7 @@ var memoTestMessage = "This is a test memo.";
|
|
|
831063
831069
|
var checkSendableToEmptyAccount2 = (amount, recipient) => {
|
|
831064
831070
|
const minBalanceNewAccount2 = parseCurrencyUnit(currency17.units[0], "0.1");
|
|
831065
831071
|
if (isAccountEmpty(recipient) && amount.lte(minBalanceNewAccount2)) {
|
|
831066
|
-
(0,
|
|
831072
|
+
(0, import_invariant85.default)(amount.gt(minBalanceNewAccount2), "not enough funds to send to new account");
|
|
831067
831073
|
}
|
|
831068
831074
|
};
|
|
831069
831075
|
var hedera = {
|
|
@@ -831078,7 +831084,7 @@ var hedera = {
|
|
|
831078
831084
|
genericDeviceAction: acceptTransaction9,
|
|
831079
831085
|
currency: currency17,
|
|
831080
831086
|
transactionCheck: ({ maxSpendable }) => {
|
|
831081
|
-
(0,
|
|
831087
|
+
(0, import_invariant85.default)(maxSpendable.gt(0), "Balance is too low");
|
|
831082
831088
|
},
|
|
831083
831089
|
allowEmptyAccounts: true,
|
|
831084
831090
|
mutations: [
|
|
@@ -831147,12 +831153,12 @@ var hedera = {
|
|
|
831147
831153
|
var bot_specs_default4 = { hedera };
|
|
831148
831154
|
|
|
831149
831155
|
// ../../libs/coin-modules/coin-filecoin/lib-es/test/bot-specs.js
|
|
831150
|
-
var
|
|
831156
|
+
var import_invariant87 = __toESM(require("invariant"));
|
|
831151
831157
|
init_lib_es5();
|
|
831152
831158
|
var import_bignumber379 = __toESM(require("bignumber.js"));
|
|
831153
831159
|
|
|
831154
831160
|
// ../../libs/coin-modules/coin-filecoin/lib-es/test/speculos-deviceActions.js
|
|
831155
|
-
var
|
|
831161
|
+
var import_invariant86 = __toESM(require("invariant"));
|
|
831156
831162
|
var generateDeviceActionFlow = (scenario) => {
|
|
831157
831163
|
const data6 = { steps: [] };
|
|
831158
831164
|
data6.steps = data6.steps.concat([
|
|
@@ -831215,7 +831221,7 @@ var generateDeviceActionFlow = (scenario) => {
|
|
|
831215
831221
|
button: SpeculosButton2.RIGHT,
|
|
831216
831222
|
expectedValue: ({ account: account3, transaction }) => {
|
|
831217
831223
|
const subAccount = getSubAccount(account3, transaction);
|
|
831218
|
-
(0,
|
|
831224
|
+
(0, import_invariant86.default)(subAccount, "subAccount is required for token transfer");
|
|
831219
831225
|
return formatDeviceAmount(subAccount.token, transaction.amount, {
|
|
831220
831226
|
hideCode: false,
|
|
831221
831227
|
showAllDigits: true
|
|
@@ -831310,7 +831316,7 @@ var filecoinSpecs = {
|
|
|
831310
831316
|
testTimeout: 16 * 60 * 1e3,
|
|
831311
831317
|
minViableAmount: MIN_SAFE3,
|
|
831312
831318
|
transactionCheck: ({ maxSpendable }) => {
|
|
831313
|
-
(0,
|
|
831319
|
+
(0, import_invariant87.default)(maxSpendable.gt(MIN_SAFE3), "balance is too low");
|
|
831314
831320
|
},
|
|
831315
831321
|
mutations: [
|
|
831316
831322
|
{
|
|
@@ -831364,7 +831370,7 @@ var filecoinSpecs = {
|
|
|
831364
831370
|
const sibling = pickSiblings(siblings, maxAccount4);
|
|
831365
831371
|
let amount = account3.spendableBalance.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
831366
831372
|
if (!sibling.used && amount.lt(MIN_SAFE3)) {
|
|
831367
|
-
(0,
|
|
831373
|
+
(0, import_invariant87.default)(account3.spendableBalance.gt(MIN_SAFE3), "send is too low to activate account");
|
|
831368
831374
|
amount = MIN_SAFE3;
|
|
831369
831375
|
}
|
|
831370
831376
|
return {
|
|
@@ -831404,9 +831410,9 @@ var filecoinSpecs = {
|
|
|
831404
831410
|
maxRun: 1,
|
|
831405
831411
|
deviceAction: generateDeviceActionFlow(BotScenario.TOKEN_TRANSFER),
|
|
831406
831412
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
831407
|
-
(0,
|
|
831413
|
+
(0, import_invariant87.default)(maxSpendable.gt(0), "Spendable balance is too low");
|
|
831408
831414
|
const subAccount = account3.subAccounts?.find((a65) => a65.type === AccountType2.TokenAccount && a65.spendableBalance.gt(0));
|
|
831409
|
-
(0,
|
|
831415
|
+
(0, import_invariant87.default)(subAccount && subAccount.type === AccountType2.TokenAccount, "no subAccount with WFIL");
|
|
831410
831416
|
const amount = subAccount.balance.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
831411
831417
|
return {
|
|
831412
831418
|
transaction: bridge28.createTransaction(account3),
|
|
@@ -831437,7 +831443,7 @@ var bot_specs_default5 = {
|
|
|
831437
831443
|
};
|
|
831438
831444
|
|
|
831439
831445
|
// ../../libs/coin-modules/coin-internet_computer/lib-es/test/bot-specs.js
|
|
831440
|
-
var
|
|
831446
|
+
var import_invariant88 = __toESM(require("invariant"));
|
|
831441
831447
|
init_lib_es5();
|
|
831442
831448
|
var import_expect10 = __toESM(require_build21());
|
|
831443
831449
|
var import_bignumber380 = __toESM(require("bignumber.js"));
|
|
@@ -831507,7 +831513,7 @@ var internetComputerSpecs = {
|
|
|
831507
831513
|
testTimeout: 6 * 60 * 1e3,
|
|
831508
831514
|
minViableAmount: MIN_SAFE4,
|
|
831509
831515
|
transactionCheck: ({ maxSpendable }) => {
|
|
831510
|
-
(0,
|
|
831516
|
+
(0, import_invariant88.default)(maxSpendable.gt(MIN_SAFE4), "balance is too low");
|
|
831511
831517
|
},
|
|
831512
831518
|
mutations: [
|
|
831513
831519
|
{
|
|
@@ -831516,7 +831522,7 @@ var internetComputerSpecs = {
|
|
|
831516
831522
|
maxRun: 1,
|
|
831517
831523
|
testDestination: genericTestDestination,
|
|
831518
831524
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
831519
|
-
(0,
|
|
831525
|
+
(0, import_invariant88.default)(maxSpendable.gt(MIN_SAFE4), "balance is too low");
|
|
831520
831526
|
const sibling = pickSiblings(siblings, maxAccount5);
|
|
831521
831527
|
const recipient = sibling.freshAddress;
|
|
831522
831528
|
const amount = maxSpendable.div(2).integerValue();
|
|
@@ -831587,7 +831593,7 @@ var bot_specs_default6 = {
|
|
|
831587
831593
|
};
|
|
831588
831594
|
|
|
831589
831595
|
// ../../libs/coin-modules/coin-icon/lib-es/specs.js
|
|
831590
|
-
var
|
|
831596
|
+
var import_invariant89 = __toESM(require("invariant"));
|
|
831591
831597
|
init_lib_es5();
|
|
831592
831598
|
var import_bignumber381 = __toESM(require("bignumber.js"));
|
|
831593
831599
|
var import_expect11 = __toESM(require_build21());
|
|
@@ -831649,7 +831655,7 @@ var icon = {
|
|
|
831649
831655
|
genericDeviceAction: acceptTransaction11,
|
|
831650
831656
|
testTimeout: 2 * 60 * 1e3,
|
|
831651
831657
|
transactionCheck: ({ maxSpendable }) => {
|
|
831652
|
-
(0,
|
|
831658
|
+
(0, import_invariant89.default)(maxSpendable.gt(EXISTENTIAL_DEPOSIT_RECOMMENDED_MARGIN.multipliedBy(2)), "balance is too low");
|
|
831653
831659
|
},
|
|
831654
831660
|
test: ({ operation, optimisticOperation }) => {
|
|
831655
831661
|
const opExpected = toOperationRaw({
|
|
@@ -831669,11 +831675,11 @@ var icon = {
|
|
|
831669
831675
|
feature: "send",
|
|
831670
831676
|
maxRun: 1,
|
|
831671
831677
|
transaction: ({ account: account3, siblings, bridge: bridge28 }) => {
|
|
831672
|
-
(0,
|
|
831678
|
+
(0, import_invariant89.default)(account3.spendableBalance.gt(0), "balance is 0");
|
|
831673
831679
|
const sibling = pickSiblings(siblings, maxAccounts3);
|
|
831674
831680
|
let amount = account3.spendableBalance.div(2).integerValue();
|
|
831675
831681
|
if (!sibling.used && amount.lt(EXISTENTIAL_DEPOSIT)) {
|
|
831676
|
-
(0,
|
|
831682
|
+
(0, import_invariant89.default)(account3.spendableBalance.gt(EXISTENTIAL_DEPOSIT), "send is too low to activate account");
|
|
831677
831683
|
amount = EXISTENTIAL_DEPOSIT;
|
|
831678
831684
|
}
|
|
831679
831685
|
return {
|
|
@@ -831697,7 +831703,7 @@ var icon = {
|
|
|
831697
831703
|
feature: "sendMax",
|
|
831698
831704
|
maxRun: 1,
|
|
831699
831705
|
transaction: ({ account: account3, siblings, bridge: bridge28 }) => {
|
|
831700
|
-
(0,
|
|
831706
|
+
(0, import_invariant89.default)(account3.spendableBalance.gt(0), "balance is 0");
|
|
831701
831707
|
const sibling = pickSiblings(siblings, maxAccounts3);
|
|
831702
831708
|
return {
|
|
831703
831709
|
transaction: bridge28.createTransaction(account3),
|
|
@@ -831722,7 +831728,7 @@ var specs_default6 = {
|
|
|
831722
831728
|
};
|
|
831723
831729
|
|
|
831724
831730
|
// ../../libs/coin-modules/coin-multiversx/lib-es/specs.js
|
|
831725
|
-
var
|
|
831731
|
+
var import_invariant90 = __toESM(require("invariant"));
|
|
831726
831732
|
init_lib_es5();
|
|
831727
831733
|
var import_expect12 = __toESM(require_build21());
|
|
831728
831734
|
|
|
@@ -832043,7 +832049,7 @@ var multiversx = {
|
|
|
832043
832049
|
testTimeout: 2 * 60 * 1e3,
|
|
832044
832050
|
minViableAmount: minimalAmount9,
|
|
832045
832051
|
transactionCheck: ({ maxSpendable }) => {
|
|
832046
|
-
(0,
|
|
832052
|
+
(0, import_invariant90.default)(maxSpendable.gt(minimalAmount9), "balance is too low");
|
|
832047
832053
|
},
|
|
832048
832054
|
test: (input) => {
|
|
832049
832055
|
expectCorrectOptimisticOperation(input);
|
|
@@ -832055,11 +832061,11 @@ var multiversx = {
|
|
|
832055
832061
|
maxRun: 1,
|
|
832056
832062
|
deviceAction: acceptMoveBalanceTransaction,
|
|
832057
832063
|
transaction: ({ account: account3, siblings, bridge: bridge28 }) => {
|
|
832058
|
-
(0,
|
|
832064
|
+
(0, import_invariant90.default)(account3.spendableBalance.gt(0), "balance is 0");
|
|
832059
832065
|
const sibling = pickSiblings(siblings, maxAccounts4);
|
|
832060
832066
|
let amount = account3.spendableBalance.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
832061
832067
|
if (!sibling.used && amount.lt(MULTIVERSX_MIN_ACTIVATION_SAFE)) {
|
|
832062
|
-
(0,
|
|
832068
|
+
(0, import_invariant90.default)(account3.spendableBalance.gt(MULTIVERSX_MIN_ACTIVATION_SAFE), "send is too low to activate account");
|
|
832063
832069
|
amount = MULTIVERSX_MIN_ACTIVATION_SAFE;
|
|
832064
832070
|
}
|
|
832065
832071
|
return {
|
|
@@ -832085,10 +832091,10 @@ var multiversx = {
|
|
|
832085
832091
|
maxRun: 1,
|
|
832086
832092
|
deviceAction: acceptMoveBalanceTransaction,
|
|
832087
832093
|
transaction: ({ account: account3, siblings, bridge: bridge28 }) => {
|
|
832088
|
-
(0,
|
|
832094
|
+
(0, import_invariant90.default)(account3.spendableBalance.gt(0), "balance is 0");
|
|
832089
832095
|
const sibling = pickSiblings(siblings, maxAccounts4);
|
|
832090
832096
|
if (!sibling.used) {
|
|
832091
|
-
(0,
|
|
832097
|
+
(0, import_invariant90.default)(account3.spendableBalance.gt(MULTIVERSX_MIN_ACTIVATION_SAFE), "send is too low to activate account");
|
|
832092
832098
|
}
|
|
832093
832099
|
return {
|
|
832094
832100
|
transaction: bridge28.createTransaction(account3),
|
|
@@ -832114,8 +832120,8 @@ var multiversx = {
|
|
|
832114
832120
|
deviceAction: acceptEsdtTransferTransaction,
|
|
832115
832121
|
transaction: ({ account: account3, siblings, bridge: bridge28 }) => {
|
|
832116
832122
|
const esdtAccount = (0, import_sample7.default)((account3.subAccounts || []).filter((a65) => a65.balance.gt(0)));
|
|
832117
|
-
(0,
|
|
832118
|
-
(0,
|
|
832123
|
+
(0, import_invariant90.default)(esdtAccount, "no esdt account");
|
|
832124
|
+
(0, import_invariant90.default)(esdtAccount?.balance.gt(0), "esdt balance is 0");
|
|
832119
832125
|
const sibling = pickSiblings(siblings, 2);
|
|
832120
832126
|
const recipient = sibling.freshAddress;
|
|
832121
832127
|
const amount = esdtAccount?.balance.times(Math.random()).integerValue();
|
|
@@ -832145,7 +832151,7 @@ var multiversx = {
|
|
|
832145
832151
|
maxRun: 1,
|
|
832146
832152
|
deviceAction: acceptDelegateTransaction,
|
|
832147
832153
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
832148
|
-
(0,
|
|
832154
|
+
(0, import_invariant90.default)(account3.spendableBalance.gt(MIN_DELEGATION_AMOUNT), `spendable balance is less than minimum delegation amount`);
|
|
832149
832155
|
const amount = MIN_DELEGATION_AMOUNT;
|
|
832150
832156
|
return {
|
|
832151
832157
|
transaction: bridge28.createTransaction(account3),
|
|
@@ -832170,8 +832176,8 @@ var multiversx = {
|
|
|
832170
832176
|
deviceAction: acceptUndelegateTransaction,
|
|
832171
832177
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
832172
832178
|
const delegations = account3?.multiversxResources?.delegations;
|
|
832173
|
-
(0,
|
|
832174
|
-
(0,
|
|
832179
|
+
(0, import_invariant90.default)(delegations?.length, "account doesn't have any delegations");
|
|
832180
|
+
(0, import_invariant90.default)(delegations.some((d56) => new import_bignumber383.default(d56.userActiveStake).gt(0)), "no active stake for account");
|
|
832175
832181
|
const amount = MIN_DELEGATION_AMOUNT;
|
|
832176
832182
|
return {
|
|
832177
832183
|
transaction: bridge28.createTransaction(account3),
|
|
@@ -832196,8 +832202,8 @@ var multiversx = {
|
|
|
832196
832202
|
deviceAction: acceptWithdrawTransaction,
|
|
832197
832203
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
832198
832204
|
const delegations = account3?.multiversxResources?.delegations;
|
|
832199
|
-
(0,
|
|
832200
|
-
(0,
|
|
832205
|
+
(0, import_invariant90.default)(delegations?.length, "account doesn't have any delegations");
|
|
832206
|
+
(0, import_invariant90.default)(
|
|
832201
832207
|
// among all delegations
|
|
832202
832208
|
delegations.some((d56) => (
|
|
832203
832209
|
// among all undelegating amounts
|
|
@@ -832232,7 +832238,7 @@ var specs_default7 = {
|
|
|
832232
832238
|
};
|
|
832233
832239
|
|
|
832234
832240
|
// ../../libs/coin-modules/coin-near/lib-es/specs.js
|
|
832235
|
-
var
|
|
832241
|
+
var import_invariant91 = __toESM(require("invariant"));
|
|
832236
832242
|
var import_expect13 = __toESM(require_build21());
|
|
832237
832243
|
var import_bignumber384 = require("bignumber.js");
|
|
832238
832244
|
init_lib_es5();
|
|
@@ -832324,7 +832330,7 @@ var near = {
|
|
|
832324
832330
|
feature: "send",
|
|
832325
832331
|
maxRun: 1,
|
|
832326
832332
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
832327
|
-
(0,
|
|
832333
|
+
(0, import_invariant91.default)(maxSpendable.gt(minimalAmount10), "balance is too low");
|
|
832328
832334
|
const sibling = pickSiblings(siblings, maxAccount6);
|
|
832329
832335
|
const recipient = sibling.freshAddress;
|
|
832330
832336
|
const amount = maxSpendable.div(2).integerValue();
|
|
@@ -832342,7 +832348,7 @@ var near = {
|
|
|
832342
832348
|
feature: "sendMax",
|
|
832343
832349
|
maxRun: 1,
|
|
832344
832350
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
832345
|
-
(0,
|
|
832351
|
+
(0, import_invariant91.default)(maxSpendable.gt(minimalAmount10), "balance is too low");
|
|
832346
832352
|
const sibling = pickSiblings(siblings, maxAccount6);
|
|
832347
832353
|
const recipient = sibling.freshAddress;
|
|
832348
832354
|
return {
|
|
@@ -832359,7 +832365,7 @@ var near = {
|
|
|
832359
832365
|
feature: "staking",
|
|
832360
832366
|
maxRun: 1,
|
|
832361
832367
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
832362
|
-
(0,
|
|
832368
|
+
(0, import_invariant91.default)(maxSpendable.gt(minimalAmount10.plus(stakingFee)), "balance is too low");
|
|
832363
832369
|
const amount = minimalAmount10.times(10).times(Math.random()).integerValue();
|
|
832364
832370
|
return {
|
|
832365
832371
|
transaction: bridge28.createTransaction(account3),
|
|
@@ -832380,10 +832386,10 @@ var near = {
|
|
|
832380
832386
|
feature: "staking",
|
|
832381
832387
|
maxRun: 1,
|
|
832382
832388
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
832383
|
-
(0,
|
|
832389
|
+
(0, import_invariant91.default)(maxSpendable.gt(stakingFee), "balance is too low for fees");
|
|
832384
832390
|
const { nearResources } = account3;
|
|
832385
832391
|
const staked = nearResources?.stakedBalance || new import_bignumber384.BigNumber(0);
|
|
832386
|
-
(0,
|
|
832392
|
+
(0, import_invariant91.default)(staked.gt(minimalAmount10), "staked balance is too low for unstaking");
|
|
832387
832393
|
const halfStaked = staked.div(2);
|
|
832388
832394
|
const amount = halfStaked.gt(minimalAmount10) ? halfStaked.integerValue() : staked.integerValue();
|
|
832389
832395
|
return {
|
|
@@ -832402,10 +832408,10 @@ var near = {
|
|
|
832402
832408
|
feature: "staking",
|
|
832403
832409
|
maxRun: 1,
|
|
832404
832410
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
832405
|
-
(0,
|
|
832411
|
+
(0, import_invariant91.default)(maxSpendable.gt(stakingFee), "balance is too low for fees");
|
|
832406
832412
|
const { nearResources } = account3;
|
|
832407
832413
|
const available = nearResources?.availableBalance || new import_bignumber384.BigNumber(0);
|
|
832408
|
-
(0,
|
|
832414
|
+
(0, import_invariant91.default)(available.gt(minimalAmount10), "available balance is too low for withdrawing");
|
|
832409
832415
|
const halfAvailable = available.div(2);
|
|
832410
832416
|
const amount = halfAvailable.gt(minimalAmount10) ? halfAvailable.integerValue() : available.integerValue();
|
|
832411
832417
|
return {
|
|
@@ -832427,7 +832433,7 @@ var specs_default8 = {
|
|
|
832427
832433
|
|
|
832428
832434
|
// ../../libs/coin-modules/coin-polkadot/lib-es/test/bot-specs.js
|
|
832429
832435
|
var import_expect14 = __toESM(require_build21());
|
|
832430
|
-
var
|
|
832436
|
+
var import_invariant92 = __toESM(require("invariant"));
|
|
832431
832437
|
var import_sampleSize3 = __toESM(require("lodash/sampleSize"));
|
|
832432
832438
|
var import_bignumber385 = require("bignumber.js");
|
|
832433
832439
|
init_lib_es5();
|
|
@@ -832531,7 +832537,7 @@ var polkadot3 = {
|
|
|
832531
832537
|
genericDeviceAction: acceptTransaction13,
|
|
832532
832538
|
minViableAmount: POLKADOT_MIN_SAFE,
|
|
832533
832539
|
transactionCheck: ({ maxSpendable }) => {
|
|
832534
|
-
(0,
|
|
832540
|
+
(0, import_invariant92.default)(maxSpendable.gt(POLKADOT_MIN_SAFE), "balance is too low");
|
|
832535
832541
|
},
|
|
832536
832542
|
test: ({ operation, optimisticOperation }) => {
|
|
832537
832543
|
const opExpected = toOperationRaw({
|
|
@@ -832551,12 +832557,12 @@ var polkadot3 = {
|
|
|
832551
832557
|
maxRun: 1,
|
|
832552
832558
|
testDestination: genericTestDestination,
|
|
832553
832559
|
transaction: ({ account: account3, siblings, bridge: bridge28 }) => {
|
|
832554
|
-
(0,
|
|
832560
|
+
(0, import_invariant92.default)(account3.polkadotResources, "polkadot resource");
|
|
832555
832561
|
const sibling = pickSiblings(siblings, maxAccounts5);
|
|
832556
832562
|
let amount = account3.spendableBalance.minus(EXISTENTIAL_DEPOSIT4).div(1.9 + 0.2 * Math.random()).integerValue();
|
|
832557
|
-
(0,
|
|
832563
|
+
(0, import_invariant92.default)(amount.gte(0), "not enough balance to do a transfer");
|
|
832558
832564
|
if (sibling.balance.eq(0) && amount.lt(EXISTENTIAL_DEPOSIT4)) {
|
|
832559
|
-
(0,
|
|
832565
|
+
(0, import_invariant92.default)(account3.spendableBalance.gte(EXISTENTIAL_DEPOSIT4.plus(POLKADOT_MIN_SAFE)), "send is too low to activate account");
|
|
832560
832566
|
amount = EXISTENTIAL_DEPOSIT4;
|
|
832561
832567
|
}
|
|
832562
832568
|
const minimumBalanceExistential = getMinimumBalance2(account3);
|
|
@@ -832583,9 +832589,9 @@ var polkadot3 = {
|
|
|
832583
832589
|
maxRun: 1,
|
|
832584
832590
|
testDestination: genericTestDestination,
|
|
832585
832591
|
transaction: ({ account: account3, siblings, bridge: bridge28 }) => {
|
|
832586
|
-
(0,
|
|
832592
|
+
(0, import_invariant92.default)(account3.polkadotResources, "polkadot resources");
|
|
832587
832593
|
const sibling = pickSiblings(siblings, maxAccounts5);
|
|
832588
|
-
(0,
|
|
832594
|
+
(0, import_invariant92.default)(sibling.balance.eq(0) && account3.spendableBalance.lte(EXISTENTIAL_DEPOSIT4), "send is too low to activate account");
|
|
832589
832595
|
return {
|
|
832590
832596
|
transaction: bridge28.createTransaction(account3),
|
|
832591
832597
|
updates: [
|
|
@@ -832605,12 +832611,12 @@ var polkadot3 = {
|
|
|
832605
832611
|
maxRun: 1,
|
|
832606
832612
|
transaction: ({ siblings, account: account3, bridge: bridge28 }) => {
|
|
832607
832613
|
expectSiblingsHaveSpendablePartGreaterThan(siblings, 0.5);
|
|
832608
|
-
(0,
|
|
832609
|
-
(0,
|
|
832610
|
-
(0,
|
|
832614
|
+
(0, import_invariant92.default)(account3.polkadotResources, "polkadot");
|
|
832615
|
+
(0, import_invariant92.default)(canBond(account3), "can't bond");
|
|
832616
|
+
(0, import_invariant92.default)(hasMinimumBondBalance(account3), "not enough balance to bond");
|
|
832611
832617
|
const options22 = [];
|
|
832612
832618
|
if (isFirstBond(account3)) {
|
|
832613
|
-
(0,
|
|
832619
|
+
(0, import_invariant92.default)(account3.balance.gt(EXISTENTIAL_DEPOSIT4.plus(POLKADOT_MIN_SAFE)), "cant cover fee + bonding amount");
|
|
832614
832620
|
options22.push({
|
|
832615
832621
|
recipient: account3.freshAddress,
|
|
832616
832622
|
rewardDestination: "Stash"
|
|
@@ -832619,7 +832625,7 @@ var polkadot3 = {
|
|
|
832619
832625
|
amount: EXISTENTIAL_DEPOSIT4
|
|
832620
832626
|
});
|
|
832621
832627
|
} else {
|
|
832622
|
-
(0,
|
|
832628
|
+
(0, import_invariant92.default)(account3.spendableBalance.gt(POLKADOT_MIN_SAFE), "cant cover fee + bonding amount");
|
|
832623
832629
|
options22.push({
|
|
832624
832630
|
amount: new import_bignumber385.BigNumber(1e5)
|
|
832625
832631
|
});
|
|
@@ -832641,9 +832647,9 @@ var polkadot3 = {
|
|
|
832641
832647
|
maxRun: 1,
|
|
832642
832648
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
832643
832649
|
const { polkadotResources } = account3;
|
|
832644
|
-
(0,
|
|
832645
|
-
(0,
|
|
832646
|
-
(0,
|
|
832650
|
+
(0, import_invariant92.default)(polkadotResources, "polkadot");
|
|
832651
|
+
(0, import_invariant92.default)(canUnbond(account3), "can't unbond");
|
|
832652
|
+
(0, import_invariant92.default)(account3.spendableBalance.gt(POLKADOT_MIN_SAFE), "can't cover fee");
|
|
832647
832653
|
const amount = polkadotResources.lockedBalance.minus(polkadotResources.unlockingBalance).times(0.2);
|
|
832648
832654
|
return {
|
|
832649
832655
|
transaction: bridge28.createTransaction(account3),
|
|
@@ -832664,9 +832670,9 @@ var polkadot3 = {
|
|
|
832664
832670
|
maxRun: 1,
|
|
832665
832671
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
832666
832672
|
const { polkadotResources } = account3;
|
|
832667
|
-
(0,
|
|
832668
|
-
(0,
|
|
832669
|
-
(0,
|
|
832673
|
+
(0, import_invariant92.default)(polkadotResources, "polkadot");
|
|
832674
|
+
(0, import_invariant92.default)(polkadotResources?.unlockingBalance.gt(MIN_LOCKED_BALANCE_REQ), "can't rebond");
|
|
832675
|
+
(0, import_invariant92.default)(account3.spendableBalance.gt(POLKADOT_MIN_SAFE), "can't cover fee");
|
|
832670
832676
|
const amount = import_bignumber385.BigNumber.maximum(polkadotResources.unlockingBalance.times(0.2), MIN_LOCKED_BALANCE_REQ);
|
|
832671
832677
|
return {
|
|
832672
832678
|
transaction: bridge28.createTransaction(account3),
|
|
@@ -832686,9 +832692,9 @@ var polkadot3 = {
|
|
|
832686
832692
|
feature: "staking",
|
|
832687
832693
|
maxRun: 1,
|
|
832688
832694
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
832689
|
-
(0,
|
|
832690
|
-
(0,
|
|
832691
|
-
(0,
|
|
832695
|
+
(0, import_invariant92.default)(account3.polkadotResources, "polkadot");
|
|
832696
|
+
(0, import_invariant92.default)(canNominate(account3), "can't nominate");
|
|
832697
|
+
(0, import_invariant92.default)(account3.spendableBalance.gt(POLKADOT_MIN_SAFE), "cant cover fee");
|
|
832692
832698
|
const data6 = getCurrentPolkadotPreloadData();
|
|
832693
832699
|
const validators7 = (0, import_sampleSize3.default)(data6.validators.map((v38) => v38.address), 2);
|
|
832694
832700
|
return {
|
|
@@ -832710,9 +832716,9 @@ var polkadot3 = {
|
|
|
832710
832716
|
maxRun: 1,
|
|
832711
832717
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
832712
832718
|
const { polkadotResources } = account3;
|
|
832713
|
-
(0,
|
|
832714
|
-
(0,
|
|
832715
|
-
(0,
|
|
832719
|
+
(0, import_invariant92.default)(polkadotResources, "polkadot");
|
|
832720
|
+
(0, import_invariant92.default)(polkadotResources?.unlockedBalance.gt(0), "nothing to withdraw");
|
|
832721
|
+
(0, import_invariant92.default)(account3.spendableBalance.gt(POLKADOT_MIN_SAFE), "can't cover fee");
|
|
832716
832722
|
return {
|
|
832717
832723
|
transaction: bridge28.createTransaction(account3),
|
|
832718
832724
|
updates: [
|
|
@@ -832730,7 +832736,7 @@ var bot_specs_default7 = {
|
|
|
832730
832736
|
};
|
|
832731
832737
|
|
|
832732
832738
|
// ../../libs/coin-modules/coin-solana/lib-es/specs.js
|
|
832733
|
-
var
|
|
832739
|
+
var import_invariant93 = __toESM(require("invariant"));
|
|
832734
832740
|
var import_expect15 = __toESM(require_build21());
|
|
832735
832741
|
init_lib_es5();
|
|
832736
832742
|
|
|
@@ -833120,7 +833126,7 @@ var solana = {
|
|
|
833120
833126
|
testDestination: genericTestDestination,
|
|
833121
833127
|
deviceAction: acceptTransferTransaction,
|
|
833122
833128
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
833123
|
-
(0,
|
|
833129
|
+
(0, import_invariant93.default)(maxSpendable.gt(0), "balance is 0");
|
|
833124
833130
|
const transaction = bridge28.createTransaction(account3);
|
|
833125
833131
|
const sibling = pickSiblings(siblings, maxAccount7);
|
|
833126
833132
|
const recipient = sibling.freshAddress;
|
|
@@ -833141,7 +833147,7 @@ var solana = {
|
|
|
833141
833147
|
maxRun: 1,
|
|
833142
833148
|
deviceAction: acceptTransferTransaction,
|
|
833143
833149
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
833144
|
-
(0,
|
|
833150
|
+
(0, import_invariant93.default)(maxSpendable.gt(0), "balance is 0");
|
|
833145
833151
|
const transaction = bridge28.createTransaction(account3);
|
|
833146
833152
|
const sibling = pickSiblings(siblings, maxAccount7);
|
|
833147
833153
|
const recipient = sibling.freshAddress;
|
|
@@ -833170,8 +833176,8 @@ var solana = {
|
|
|
833170
833176
|
if (solanaResources === void 0) {
|
|
833171
833177
|
throw new Error("solana resources required");
|
|
833172
833178
|
}
|
|
833173
|
-
(0,
|
|
833174
|
-
(0,
|
|
833179
|
+
(0, import_invariant93.default)(solanaResources.stakes.length < 10, "already enough delegations");
|
|
833180
|
+
(0, import_invariant93.default)(account3.spendableBalance.gte(3e6), "not enough balance");
|
|
833175
833181
|
const { validators: validators7 } = getCurrentSolanaPreloadData(account3.currency);
|
|
833176
833182
|
const notUsedValidators = validators7.filter((v38) => solanaResources.stakes.every((s49) => s49.delegation?.voteAccAddr !== v38.voteAccount));
|
|
833177
833183
|
const validator2 = (0, import_fp6.sample)(notUsedValidators);
|
|
@@ -833219,7 +833225,7 @@ var solana = {
|
|
|
833219
833225
|
maxRun: 1,
|
|
833220
833226
|
deviceAction: acceptStakeUndelegateTransaction,
|
|
833221
833227
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
833222
|
-
(0,
|
|
833228
|
+
(0, import_invariant93.default)(account3.spendableBalance.gt(0), "not enough balance");
|
|
833223
833229
|
const { solanaResources } = account3;
|
|
833224
833230
|
if (solanaResources === void 0) {
|
|
833225
833231
|
throw new Error("solana resources required");
|
|
@@ -833266,7 +833272,7 @@ var solana = {
|
|
|
833266
833272
|
maxRun: 1,
|
|
833267
833273
|
deviceAction: acceptStakeUndelegateTransaction,
|
|
833268
833274
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
833269
|
-
(0,
|
|
833275
|
+
(0, import_invariant93.default)(account3.spendableBalance.gt(0), "not enough balance");
|
|
833270
833276
|
const { solanaResources } = account3;
|
|
833271
833277
|
if (solanaResources === void 0) {
|
|
833272
833278
|
throw new Error("solana resources required");
|
|
@@ -833313,7 +833319,7 @@ var solana = {
|
|
|
833313
833319
|
maxRun: 1,
|
|
833314
833320
|
deviceAction: acceptStakeDelegateTransaction,
|
|
833315
833321
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
833316
|
-
(0,
|
|
833322
|
+
(0, import_invariant93.default)(account3.spendableBalance.gt(0), "not enough balance");
|
|
833317
833323
|
const { solanaResources } = account3;
|
|
833318
833324
|
if (solanaResources === void 0) {
|
|
833319
833325
|
throw new Error("solana resources required");
|
|
@@ -833364,7 +833370,7 @@ var solana = {
|
|
|
833364
833370
|
maxRun: 1,
|
|
833365
833371
|
deviceAction: acceptStakeDelegateTransaction,
|
|
833366
833372
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
833367
|
-
(0,
|
|
833373
|
+
(0, import_invariant93.default)(account3.spendableBalance.gt(0), "not enough balance");
|
|
833368
833374
|
const { solanaResources } = account3;
|
|
833369
833375
|
if (solanaResources === void 0) {
|
|
833370
833376
|
throw new Error("solana resources required");
|
|
@@ -833415,7 +833421,7 @@ var solana = {
|
|
|
833415
833421
|
maxRun: 1,
|
|
833416
833422
|
deviceAction: acceptStakeWithdrawTransaction,
|
|
833417
833423
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
833418
|
-
(0,
|
|
833424
|
+
(0, import_invariant93.default)(account3.spendableBalance.gt(0), "not enough balance");
|
|
833419
833425
|
const { solanaResources } = account3;
|
|
833420
833426
|
if (solanaResources === void 0) {
|
|
833421
833427
|
throw new Error("solana resources required");
|
|
@@ -833459,12 +833465,12 @@ var solana = {
|
|
|
833459
833465
|
feature: "tokens",
|
|
833460
833466
|
deviceAction: acceptTransferTokensWithATACreationTransaction,
|
|
833461
833467
|
transaction: ({ account: account3, bridge: bridge28, siblings, maxSpendable }) => {
|
|
833462
|
-
(0,
|
|
833468
|
+
(0, import_invariant93.default)(maxSpendable.gt(0), "balance is 0");
|
|
833463
833469
|
const senderTokenAcc = findTokenSubAccountWithBalance(account3);
|
|
833464
|
-
(0,
|
|
833470
|
+
(0, import_invariant93.default)(senderTokenAcc, "Sender token account with available balance not found");
|
|
833465
833471
|
const token = senderTokenAcc.token;
|
|
833466
833472
|
const siblingWithoutToken = siblings.find((acc) => !findTokenSubAccount(acc, token.id));
|
|
833467
|
-
(0,
|
|
833473
|
+
(0, import_invariant93.default)(siblingWithoutToken, `Recipient without ${token.ticker} ATA not found`);
|
|
833468
833474
|
const amount = senderTokenAcc.balance.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
833469
833475
|
const recipient = siblingWithoutToken.freshAddress;
|
|
833470
833476
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -833489,12 +833495,12 @@ var solana = {
|
|
|
833489
833495
|
feature: "tokens",
|
|
833490
833496
|
deviceAction: acceptTransferTokensTransaction,
|
|
833491
833497
|
transaction: ({ account: account3, bridge: bridge28, siblings, maxSpendable }) => {
|
|
833492
|
-
(0,
|
|
833498
|
+
(0, import_invariant93.default)(maxSpendable.gt(0), "balance is 0");
|
|
833493
833499
|
const senderTokenAcc = findTokenSubAccountWithBalance(account3);
|
|
833494
|
-
(0,
|
|
833500
|
+
(0, import_invariant93.default)(senderTokenAcc, "Sender token account with available balance not found");
|
|
833495
833501
|
const token = senderTokenAcc.token;
|
|
833496
833502
|
const siblingTokenAccount = siblings.find((acc) => findTokenSubAccount(acc, token.id));
|
|
833497
|
-
(0,
|
|
833503
|
+
(0, import_invariant93.default)(siblingTokenAccount, `Sibling with ${token.ticker} token ATA not found`);
|
|
833498
833504
|
const amount = senderTokenAcc.balance.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
833499
833505
|
const recipient = siblingTokenAccount.freshAddress;
|
|
833500
833506
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -833513,12 +833519,12 @@ var solana = {
|
|
|
833513
833519
|
maxRun: 1,
|
|
833514
833520
|
deviceAction: acceptTransferTokensWithATACreationTransaction,
|
|
833515
833521
|
transaction: ({ account: account3, bridge: bridge28, siblings, maxSpendable }) => {
|
|
833516
|
-
(0,
|
|
833522
|
+
(0, import_invariant93.default)(maxSpendable.gt(0), "balance is 0");
|
|
833517
833523
|
const senderTokenAcc = findTokenAccountWithExtensionAndBalance(account3, "transferFee");
|
|
833518
|
-
(0,
|
|
833524
|
+
(0, import_invariant93.default)(senderTokenAcc, "Sender token2022 account with transfer fee extension and available balance not found");
|
|
833519
833525
|
const token = senderTokenAcc.token;
|
|
833520
833526
|
const siblingWithoutToken = siblings.find((acc) => !findTokenSubAccount(acc, token.id));
|
|
833521
|
-
(0,
|
|
833527
|
+
(0, import_invariant93.default)(siblingWithoutToken, `Recipient without ${token.ticker} ATA not found`);
|
|
833522
833528
|
const amount = senderTokenAcc.balance.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
833523
833529
|
const recipient = siblingWithoutToken.freshAddress;
|
|
833524
833530
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -833540,12 +833546,12 @@ var solana = {
|
|
|
833540
833546
|
maxRun: 1,
|
|
833541
833547
|
deviceAction: acceptTransferTokensTransaction,
|
|
833542
833548
|
transaction: ({ account: account3, bridge: bridge28, siblings, maxSpendable }) => {
|
|
833543
|
-
(0,
|
|
833549
|
+
(0, import_invariant93.default)(maxSpendable.gt(0), "balance is 0");
|
|
833544
833550
|
const senderTokenAcc = findTokenAccountWithExtensionAndBalance(account3, "transferFee");
|
|
833545
|
-
(0,
|
|
833551
|
+
(0, import_invariant93.default)(senderTokenAcc, "Sender token2022 account with transfer fee extension and available balance not found");
|
|
833546
833552
|
const token = senderTokenAcc.token;
|
|
833547
833553
|
const siblingTokenAccount = siblings.find((acc) => findTokenSubAccount(acc, token.id));
|
|
833548
|
-
(0,
|
|
833554
|
+
(0, import_invariant93.default)(siblingTokenAccount, `Recipient without ${token.ticker} ATA not found`);
|
|
833549
833555
|
const amount = senderTokenAcc.balance.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
833550
833556
|
const recipient = siblingTokenAccount.freshAddress;
|
|
833551
833557
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -833562,12 +833568,12 @@ var solana = {
|
|
|
833562
833568
|
maxRun: 1,
|
|
833563
833569
|
deviceAction: acceptTransferTokensWithATACreationTransaction,
|
|
833564
833570
|
transaction: ({ account: account3, bridge: bridge28, siblings, maxSpendable }) => {
|
|
833565
|
-
(0,
|
|
833571
|
+
(0, import_invariant93.default)(maxSpendable.gt(0), "balance is 0");
|
|
833566
833572
|
const senderTokenAcc = findTokenAccountWithExtensionAndBalance(account3, "transferFee");
|
|
833567
|
-
(0,
|
|
833573
|
+
(0, import_invariant93.default)(senderTokenAcc, "Sender token2022 account with transfer fee extension and available balance not found");
|
|
833568
833574
|
const token = senderTokenAcc.token;
|
|
833569
833575
|
const siblingWithoutToken = siblings.find((acc) => !findTokenSubAccount(acc, token.id));
|
|
833570
|
-
(0,
|
|
833576
|
+
(0, import_invariant93.default)(siblingWithoutToken, `Recipient without ${token.ticker} ATA not found`);
|
|
833571
833577
|
const amount = senderTokenAcc.balance.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
833572
833578
|
const recipient = siblingWithoutToken.freshAddress;
|
|
833573
833579
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -833589,12 +833595,12 @@ var solana = {
|
|
|
833589
833595
|
maxRun: 1,
|
|
833590
833596
|
deviceAction: acceptTransferTokensTransaction,
|
|
833591
833597
|
transaction: ({ account: account3, bridge: bridge28, siblings, maxSpendable }) => {
|
|
833592
|
-
(0,
|
|
833598
|
+
(0, import_invariant93.default)(maxSpendable.gt(0), "balance is 0");
|
|
833593
833599
|
const senderTokenAcc = findTokenAccountWithExtensionAndBalance(account3, "transferFee");
|
|
833594
|
-
(0,
|
|
833600
|
+
(0, import_invariant93.default)(senderTokenAcc, "Sender token2022 account with transfer fee extension and available balance not found");
|
|
833595
833601
|
const token = senderTokenAcc.token;
|
|
833596
833602
|
const siblingTokenAccount = siblings.find((acc) => findTokenSubAccount(acc, token.id));
|
|
833597
|
-
(0,
|
|
833603
|
+
(0, import_invariant93.default)(siblingTokenAccount, `Recipient without ${token.ticker} ATA not found`);
|
|
833598
833604
|
const amount = senderTokenAcc.balance.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
833599
833605
|
const recipient = siblingTokenAccount.freshAddress;
|
|
833600
833606
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -833689,7 +833695,7 @@ var specs_default9 = {
|
|
|
833689
833695
|
};
|
|
833690
833696
|
|
|
833691
833697
|
// ../../libs/coin-modules/coin-stacks/lib-es/test/bot-specs.js
|
|
833692
|
-
var
|
|
833698
|
+
var import_invariant94 = __toESM(require("invariant"));
|
|
833693
833699
|
init_lib_es5();
|
|
833694
833700
|
var import_bignumber388 = __toESM(require("bignumber.js"));
|
|
833695
833701
|
var import_expect16 = __toESM(require_build21());
|
|
@@ -833753,7 +833759,7 @@ var stacksSpecs = {
|
|
|
833753
833759
|
// Need an evolution of the bot to tolerate unconfirmed ops and just warn maybe instead of error
|
|
833754
833760
|
testTimeout: 25 * 60 * 1e3,
|
|
833755
833761
|
transactionCheck: ({ maxSpendable }) => {
|
|
833756
|
-
(0,
|
|
833762
|
+
(0, import_invariant94.default)(maxSpendable.gt(MIN_SAFE5), "balance is too low");
|
|
833757
833763
|
},
|
|
833758
833764
|
mutations: [
|
|
833759
833765
|
{
|
|
@@ -833765,7 +833771,7 @@ var stacksSpecs = {
|
|
|
833765
833771
|
const recipient = sibling.freshAddress;
|
|
833766
833772
|
let amount = account3.spendableBalance.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
833767
833773
|
if (!sibling.used && amount.lt(MIN_SAFE5)) {
|
|
833768
|
-
(0,
|
|
833774
|
+
(0, import_invariant94.default)(account3.spendableBalance.gt(MIN_SAFE5), "send is too low to activate account");
|
|
833769
833775
|
amount = MIN_SAFE5;
|
|
833770
833776
|
}
|
|
833771
833777
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -833805,7 +833811,7 @@ var bot_specs_default8 = {
|
|
|
833805
833811
|
|
|
833806
833812
|
// ../../libs/coin-modules/coin-stellar/lib-es/test/bot-specs.js
|
|
833807
833813
|
var import_expect17 = __toESM(require_build21());
|
|
833808
|
-
var
|
|
833814
|
+
var import_invariant95 = __toESM(require("invariant"));
|
|
833809
833815
|
var import_bignumber389 = __toESM(require("bignumber.js"));
|
|
833810
833816
|
init_lib_es5();
|
|
833811
833817
|
|
|
@@ -833933,13 +833939,13 @@ var stellar2 = {
|
|
|
833933
833939
|
feature: "send",
|
|
833934
833940
|
maxRun: 1,
|
|
833935
833941
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
833936
|
-
(0,
|
|
833942
|
+
(0, import_invariant95.default)(maxSpendable.gt(minAmountCutoff), "XLM balance is too low");
|
|
833937
833943
|
const transaction = bridge28.createTransaction(account3);
|
|
833938
833944
|
const sibling = pickSiblings(siblings, 4);
|
|
833939
833945
|
const recipient = sibling.freshAddress;
|
|
833940
833946
|
let amount = maxSpendable.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
833941
833947
|
if (!sibling.used && amount.lt(reserve)) {
|
|
833942
|
-
(0,
|
|
833948
|
+
(0, import_invariant95.default)(maxSpendable.gt(reserve.plus(minAmountCutoff)), "not enough XLM funds to send to new account");
|
|
833943
833949
|
amount = reserve;
|
|
833944
833950
|
}
|
|
833945
833951
|
const updates7 = [
|
|
@@ -833989,7 +833995,7 @@ var stellar2 = {
|
|
|
833989
833995
|
feature: "sendMax",
|
|
833990
833996
|
maxRun: 1,
|
|
833991
833997
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
833992
|
-
(0,
|
|
833998
|
+
(0, import_invariant95.default)(maxSpendable.gt(minAmountCutoff), "XLM balance is too low");
|
|
833993
833999
|
const transaction = bridge28.createTransaction(account3);
|
|
833994
834000
|
const sibling = pickSiblings(siblings, 4);
|
|
833995
834001
|
const recipient = sibling.freshAddress;
|
|
@@ -834040,10 +834046,10 @@ var stellar2 = {
|
|
|
834040
834046
|
feature: "tokens",
|
|
834041
834047
|
maxRun: 1,
|
|
834042
834048
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable }) => {
|
|
834043
|
-
(0,
|
|
834044
|
-
(0,
|
|
834049
|
+
(0, import_invariant95.default)(maxSpendable.gt(reserve), "XLM balance is too low 1");
|
|
834050
|
+
(0, import_invariant95.default)(account3.subAccounts && !findAssetUSDC(account3.subAccounts), "already have subaccounts");
|
|
834045
834051
|
const assetUSDC = findAssetUSDC(listTokensForCryptoCurrency(account3.currency));
|
|
834046
|
-
(0,
|
|
834052
|
+
(0, import_invariant95.default)(assetUSDC, "USDC asset not found");
|
|
834047
834053
|
const transaction = bridge28.createTransaction(account3);
|
|
834048
834054
|
const updates7 = [
|
|
834049
834055
|
{
|
|
@@ -834073,12 +834079,12 @@ var stellar2 = {
|
|
|
834073
834079
|
feature: "tokens",
|
|
834074
834080
|
maxRun: 1,
|
|
834075
834081
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
834076
|
-
(0,
|
|
834082
|
+
(0, import_invariant95.default)(maxSpendable.gt(minAmountCutoff), "XLM balance is too low");
|
|
834077
834083
|
const usdcSubAccount = findAssetUSDC(account3?.subAccounts);
|
|
834078
|
-
(0,
|
|
834079
|
-
(0,
|
|
834084
|
+
(0, import_invariant95.default)(usdcSubAccount, "USDC asset not found");
|
|
834085
|
+
(0, import_invariant95.default)(usdcSubAccount?.balance.gt(MIN_ASSET_BALANCE), "USDC balance is too low");
|
|
834080
834086
|
const siblingWithAssetUSDC = siblings.find((s49) => findAssetUSDC(s49.subAccounts));
|
|
834081
|
-
(0,
|
|
834087
|
+
(0, import_invariant95.default)(siblingWithAssetUSDC, "No siblings with USDC asset");
|
|
834082
834088
|
if (!usdcSubAccount || !siblingWithAssetUSDC) {
|
|
834083
834089
|
throw new Error("No USDC asset or sibling with USDC asset");
|
|
834084
834090
|
}
|
|
@@ -834129,7 +834135,7 @@ var bot_specs_default9 = {
|
|
|
834129
834135
|
|
|
834130
834136
|
// ../../libs/coin-modules/coin-tezos/lib-es/test/bot-specs.js
|
|
834131
834137
|
var import_sample8 = __toESM(require("lodash/sample"));
|
|
834132
|
-
var
|
|
834138
|
+
var import_invariant96 = __toESM(require("invariant"));
|
|
834133
834139
|
init_lib_es5();
|
|
834134
834140
|
|
|
834135
834141
|
// ../../libs/coin-modules/coin-tezos/lib-es/types/bridge.js
|
|
@@ -834236,12 +834242,12 @@ var maxAccount8 = 12;
|
|
|
834236
834242
|
function expectUnrevealed(account3) {
|
|
834237
834243
|
if (!isTezosAccount(account3))
|
|
834238
834244
|
throw Error("Not TezosAccount type");
|
|
834239
|
-
(0,
|
|
834245
|
+
(0, import_invariant96.default)(account3.tezosResources?.revealed === false, "account must be unreleaved");
|
|
834240
834246
|
}
|
|
834241
834247
|
function expectRevealed(account3) {
|
|
834242
834248
|
if (!isTezosAccount(account3))
|
|
834243
834249
|
throw Error("Not TezosAccount type");
|
|
834244
|
-
(0,
|
|
834250
|
+
(0, import_invariant96.default)(account3.tezosResources?.revealed === true, "account must be releaved");
|
|
834245
834251
|
}
|
|
834246
834252
|
var tezosUnit = getCryptoCurrencyById("tezos").units[0];
|
|
834247
834253
|
var safeMinimumForDestinationNotCreated = parseCurrencyUnit(tezosUnit, "0.6");
|
|
@@ -834258,7 +834264,7 @@ var tezos = {
|
|
|
834258
834264
|
testTimeout: 2 * 60 * 1e3,
|
|
834259
834265
|
minViableAmount: strictMin,
|
|
834260
834266
|
transactionCheck: ({ maxSpendable }) => {
|
|
834261
|
-
(0,
|
|
834267
|
+
(0, import_invariant96.default)(maxSpendable.gt(strictMin), "balance is too low");
|
|
834262
834268
|
},
|
|
834263
834269
|
mutations: [
|
|
834264
834270
|
{
|
|
@@ -834305,7 +834311,7 @@ var tezos = {
|
|
|
834305
834311
|
maxRun: 1,
|
|
834306
834312
|
testDestination: genericTestDestination,
|
|
834307
834313
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
834308
|
-
(0,
|
|
834314
|
+
(0, import_invariant96.default)(!isAccountDelegating(account3), "account must not be delegating");
|
|
834309
834315
|
const sibling = pickSiblings(siblings, maxAccount8);
|
|
834310
834316
|
const recipient = sibling.freshAddress;
|
|
834311
834317
|
if (sibling.balance.eq(0) && maxSpendable.lt(safeMinimumForDestinationNotCreated)) {
|
|
@@ -834350,7 +834356,7 @@ var tezos = {
|
|
|
834350
834356
|
feature: "staking",
|
|
834351
834357
|
maxRun: 1,
|
|
834352
834358
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
834353
|
-
(0,
|
|
834359
|
+
(0, import_invariant96.default)(getAccountDelegationSync(account3), "account must be delegating");
|
|
834354
834360
|
expectUnrevealed(account3);
|
|
834355
834361
|
return {
|
|
834356
834362
|
transaction: bridge28.createTransaction(account3),
|
|
@@ -834363,7 +834369,7 @@ var tezos = {
|
|
|
834363
834369
|
feature: "staking",
|
|
834364
834370
|
maxRun: 1,
|
|
834365
834371
|
transaction: ({ account: account3, bridge: bridge28 }) => {
|
|
834366
|
-
(0,
|
|
834372
|
+
(0, import_invariant96.default)(getAccountDelegationSync(account3), "account must be delegating");
|
|
834367
834373
|
expectRevealed(account3);
|
|
834368
834374
|
return {
|
|
834369
834375
|
transaction: bridge28.createTransaction(account3),
|
|
@@ -834381,7 +834387,7 @@ var bot_specs_default10 = {
|
|
|
834381
834387
|
init_lib_es5();
|
|
834382
834388
|
var import_bignumber390 = __toESM(require("bignumber.js"));
|
|
834383
834389
|
var import_expect18 = __toESM(require_build21());
|
|
834384
|
-
var
|
|
834390
|
+
var import_invariant97 = __toESM(require("invariant"));
|
|
834385
834391
|
|
|
834386
834392
|
// ../../libs/coin-modules/coin-ton/lib-es/speculos-deviceActions.js
|
|
834387
834393
|
var generateDeviceActionFlow2 = (scenario) => {
|
|
@@ -834481,7 +834487,7 @@ var tonSpecs = {
|
|
|
834481
834487
|
testTimeout: 6 * 60 * 1e3,
|
|
834482
834488
|
minViableAmount: MIN_SAFE6,
|
|
834483
834489
|
transactionCheck: ({ maxSpendable }) => {
|
|
834484
|
-
(0,
|
|
834490
|
+
(0, import_invariant97.default)(maxSpendable.gt(MIN_SAFE6), "balance is too low");
|
|
834485
834491
|
},
|
|
834486
834492
|
mutations: [
|
|
834487
834493
|
{
|
|
@@ -834490,7 +834496,7 @@ var tonSpecs = {
|
|
|
834490
834496
|
maxRun: 1,
|
|
834491
834497
|
testDestination: testDestination2,
|
|
834492
834498
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
834493
|
-
(0,
|
|
834499
|
+
(0, import_invariant97.default)(maxSpendable.gt(MIN_SAFE6), "balance is too low");
|
|
834494
834500
|
const updates7 = [
|
|
834495
834501
|
{ recipient: pickSiblings(siblings).freshAddress },
|
|
834496
834502
|
{ amount: maxSpendable.div(2).integerValue() },
|
|
@@ -834543,10 +834549,10 @@ var tonSpecs = {
|
|
|
834543
834549
|
maxRun: 1,
|
|
834544
834550
|
deviceAction: generateDeviceActionFlow2(BotScenario2.TOKEN_TRANSFER),
|
|
834545
834551
|
transaction: ({ account: account3, bridge: bridge28, maxSpendable, siblings }) => {
|
|
834546
|
-
(0,
|
|
834552
|
+
(0, import_invariant97.default)(maxSpendable.gt(0), "Spendable balance is too low");
|
|
834547
834553
|
const subAccount = account3.subAccounts?.find((a65) => a65.type === "TokenAccount" && a65.spendableBalance.gt(0));
|
|
834548
834554
|
const recipient = siblings[0].freshAddress;
|
|
834549
|
-
(0,
|
|
834555
|
+
(0, import_invariant97.default)(subAccount && subAccount.type === "TokenAccount", "no subAccount with jUSDT");
|
|
834550
834556
|
const amount = subAccount.balance.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
834551
834557
|
const updates7 = [
|
|
834552
834558
|
{
|
|
@@ -834584,7 +834590,7 @@ var specs_default10 = {
|
|
|
834584
834590
|
|
|
834585
834591
|
// ../../libs/coin-modules/coin-vechain/lib-es/test/bot-specs.js
|
|
834586
834592
|
var import_bignumber391 = __toESM(require("bignumber.js"));
|
|
834587
|
-
var
|
|
834593
|
+
var import_invariant98 = __toESM(require("invariant"));
|
|
834588
834594
|
init_lib_es5();
|
|
834589
834595
|
|
|
834590
834596
|
// ../../libs/coin-modules/coin-vechain/lib-es/test/bot-deviceActions.js
|
|
@@ -834648,8 +834654,8 @@ var vet = {
|
|
|
834648
834654
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
834649
834655
|
if (!account3.subAccounts?.[0])
|
|
834650
834656
|
throw new Error("no VTHO account");
|
|
834651
|
-
(0,
|
|
834652
|
-
(0,
|
|
834657
|
+
(0, import_invariant98.default)(account3.balance.gt(MIN_VET_TRANSACTION_AMOUNT), "Vechain: VET balance is empty");
|
|
834658
|
+
(0, import_invariant98.default)(account3.subAccounts[0].balance.gt(MAX_VTHO_FEE_FOR_VET_TRANSACTION), "Vechain: VTHO balance is not enough");
|
|
834653
834659
|
const sibling = pickSiblings(siblings, 2);
|
|
834654
834660
|
const recipient = sibling.freshAddress;
|
|
834655
834661
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -834671,8 +834677,8 @@ var vet = {
|
|
|
834671
834677
|
transaction: ({ account: account3, siblings, bridge: bridge28 }) => {
|
|
834672
834678
|
if (!account3.subAccounts?.[0])
|
|
834673
834679
|
throw new Error("no VTHO account");
|
|
834674
|
-
(0,
|
|
834675
|
-
(0,
|
|
834680
|
+
(0, import_invariant98.default)(account3.balance.gt(MIN_VET_TRANSACTION_AMOUNT), "Vechain: VET balance is empty");
|
|
834681
|
+
(0, import_invariant98.default)(account3.subAccounts?.[0].balance.gt(MAX_VTHO_FEE_FOR_VET_TRANSACTION), "Vechain: VTHO balance is not enough");
|
|
834676
834682
|
const sibling = pickSiblings(siblings, 4);
|
|
834677
834683
|
const recipient = sibling.freshAddress;
|
|
834678
834684
|
const transaction = bridge28.createTransaction(account3);
|
|
@@ -834700,7 +834706,7 @@ var vtho = {
|
|
|
834700
834706
|
transaction: ({ account: account3, siblings, bridge: bridge28 }) => {
|
|
834701
834707
|
if (!account3.subAccounts?.[0])
|
|
834702
834708
|
throw new Error("no VTHO account");
|
|
834703
|
-
(0,
|
|
834709
|
+
(0, import_invariant98.default)(account3.subAccounts?.[0].balance.gt(MAX_VTHO_FEE_FOR_VTHO_TRANSACTION * 2), "Vechain: VTHO balance is not enough");
|
|
834704
834710
|
const sibling = pickSiblings(siblings, 2);
|
|
834705
834711
|
const recipient = sibling.freshAddress;
|
|
834706
834712
|
if (!account3.subAccounts || !account3.subAccounts[0] || !(account3.subAccounts[0].type == "TokenAccount"))
|
|
@@ -834725,7 +834731,7 @@ var vtho = {
|
|
|
834725
834731
|
transaction: ({ account: account3, siblings, bridge: bridge28 }) => {
|
|
834726
834732
|
if (!account3.subAccounts?.[0])
|
|
834727
834733
|
throw new Error("no VTHO account");
|
|
834728
|
-
(0,
|
|
834734
|
+
(0, import_invariant98.default)(account3.subAccounts?.[0].balance.gt(MAX_VTHO_FEE_FOR_VTHO_TRANSACTION), "Vechain: VTHO balance is not enough");
|
|
834729
834735
|
const sibling = pickSiblings(siblings, 4);
|
|
834730
834736
|
const recipient = sibling.freshAddress;
|
|
834731
834737
|
if (!account3.subAccounts || !account3.subAccounts[0] || !(account3.subAccounts[0].type == "TokenAccount"))
|
|
@@ -834750,7 +834756,7 @@ var vtho = {
|
|
|
834750
834756
|
var bot_specs_default11 = { vtho, vet };
|
|
834751
834757
|
|
|
834752
834758
|
// ../../libs/coin-modules/coin-xrp/lib-es/test/bot-specs.js
|
|
834753
|
-
var
|
|
834759
|
+
var import_invariant99 = __toESM(require("invariant"));
|
|
834754
834760
|
var import_expect19 = __toESM(require_build21());
|
|
834755
834761
|
init_lib_es5();
|
|
834756
834762
|
|
|
@@ -834820,13 +834826,13 @@ var xrp = {
|
|
|
834820
834826
|
maxRun: 1,
|
|
834821
834827
|
testDestination: genericTestDestination,
|
|
834822
834828
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
834823
|
-
(0,
|
|
834829
|
+
(0, import_invariant99.default)(maxSpendable.gt(minAmountCutoff2), "balance is too low");
|
|
834824
834830
|
const transaction = bridge28.createTransaction(account3);
|
|
834825
834831
|
const sibling = pickSiblings(siblings, 3);
|
|
834826
834832
|
const recipient = sibling.freshAddress;
|
|
834827
834833
|
let amount = maxSpendable.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
834828
834834
|
if (!sibling.used && amount.lt(reserve2)) {
|
|
834829
|
-
(0,
|
|
834835
|
+
(0, import_invariant99.default)(maxSpendable.gt(reserve2.plus(minAmountCutoff2)), "not enough funds to send to new account");
|
|
834830
834836
|
amount = reserve2;
|
|
834831
834837
|
}
|
|
834832
834838
|
return {
|
|
@@ -834855,7 +834861,7 @@ var bot_specs_default12 = {
|
|
|
834855
834861
|
};
|
|
834856
834862
|
|
|
834857
834863
|
// ../../libs/coin-modules/coin-mina/lib-es/test/bot-specs.js
|
|
834858
|
-
var
|
|
834864
|
+
var import_invariant100 = __toESM(require("invariant"));
|
|
834859
834865
|
init_lib_es5();
|
|
834860
834866
|
var import_bignumber392 = __toESM(require("bignumber.js"));
|
|
834861
834867
|
var import_expect20 = __toESM(require_build21());
|
|
@@ -834943,7 +834949,7 @@ var minaSpecs = {
|
|
|
834943
834949
|
testTimeout: 15 * 60 * 1e3,
|
|
834944
834950
|
minViableAmount: MIN_SAFE7,
|
|
834945
834951
|
transactionCheck: ({ maxSpendable }) => {
|
|
834946
|
-
(0,
|
|
834952
|
+
(0, import_invariant100.default)(maxSpendable.gt(MIN_SAFE7), "balance is too low");
|
|
834947
834953
|
},
|
|
834948
834954
|
mutations: [
|
|
834949
834955
|
{
|
|
@@ -834952,7 +834958,7 @@ var minaSpecs = {
|
|
|
834952
834958
|
testDestination: genericTestDestination,
|
|
834953
834959
|
feature: "send",
|
|
834954
834960
|
transaction: ({ account: account3, siblings, bridge: bridge28, maxSpendable }) => {
|
|
834955
|
-
(0,
|
|
834961
|
+
(0, import_invariant100.default)(maxSpendable.gt(MIN_SAFE7), "balance is too low");
|
|
834956
834962
|
const sibling = pickSiblings(siblings, maxAccount9);
|
|
834957
834963
|
const recipient = sibling.freshAddress;
|
|
834958
834964
|
const amount = maxSpendable.div(2).integerValue();
|
|
@@ -835051,7 +835057,7 @@ var specs_default11 = {
|
|
|
835051
835057
|
|
|
835052
835058
|
// ../../libs/ledger-live-common/lib-es/bot/engine.js
|
|
835053
835059
|
var import_expect21 = __toESM(require_build21());
|
|
835054
|
-
var
|
|
835060
|
+
var import_invariant101 = __toESM(require("invariant"));
|
|
835055
835061
|
var import_performance_now = __toESM(require_performance_now());
|
|
835056
835062
|
var import_sample9 = __toESM(require("lodash/sample"));
|
|
835057
835063
|
var import_rxjs156 = require("rxjs");
|
|
@@ -835115,9 +835121,9 @@ var delayBetweenScanAccountRetries = 5e3;
|
|
|
835115
835121
|
async function runWithAppSpec(spec2, reportLog) {
|
|
835116
835122
|
log2("engine", `spec ${spec2.name}`);
|
|
835117
835123
|
const seed = getEnv("SEED");
|
|
835118
|
-
(0,
|
|
835124
|
+
(0, import_invariant101.default)(seed, "SEED is not set");
|
|
835119
835125
|
const coinapps = getEnv("COINAPPS");
|
|
835120
|
-
(0,
|
|
835126
|
+
(0, import_invariant101.default)(coinapps, "COINAPPS is not set");
|
|
835121
835127
|
if (!appCandidates) {
|
|
835122
835128
|
appCandidates = await listAppCandidates(coinapps);
|
|
835123
835129
|
}
|
|
@@ -835129,7 +835135,7 @@ async function runWithAppSpec(spec2, reportLog) {
|
|
|
835129
835135
|
console.warn(appQuery);
|
|
835130
835136
|
console.warn(JSON.stringify(appCandidates, void 0, 2));
|
|
835131
835137
|
}
|
|
835132
|
-
(0,
|
|
835138
|
+
(0, import_invariant101.default)(appCandidate, "%s: no app found. Are you sure your COINAPPS is up to date?", spec2.name, coinapps);
|
|
835133
835139
|
log2("engine", `spec ${spec2.name} will use ${formatAppCandidate(appCandidate)}`);
|
|
835134
835140
|
const deviceParams = {
|
|
835135
835141
|
...appCandidate,
|
|
@@ -835185,7 +835191,7 @@ Please increase the account target to at least ${spec2.mutations.length + 1} acc
|
|
|
835185
835191
|
}
|
|
835186
835192
|
appReport.accountsBefore = accounts2;
|
|
835187
835193
|
if (!spec2.allowEmptyAccounts) {
|
|
835188
|
-
(0,
|
|
835194
|
+
(0, import_invariant101.default)(accounts2.length > 0, "unexpected empty accounts for " + currency24.name);
|
|
835189
835195
|
}
|
|
835190
835196
|
const preloadStats = preloadDuration > 10 ? ` (preload: ${formatTime(preloadDuration)})` : "";
|
|
835191
835197
|
reportLog(`Spec ${spec2.name} found ${accounts2.length} ${currency24.name} accounts${preloadStats}. Will use ${formatAppCandidate(appCandidate)}
|
|
@@ -835322,7 +835328,7 @@ async function runOnAccount({ appCandidate, spec: spec2, device: device2, accoun
|
|
|
835322
835328
|
for (const mutation2 of mutations) {
|
|
835323
835329
|
try {
|
|
835324
835330
|
const count = mutationsCount[mutation2.name] || 0;
|
|
835325
|
-
(0,
|
|
835331
|
+
(0, import_invariant101.default)(count < (mutation2.maxRun || Infinity), "maximum mutation run reached (%s)", count);
|
|
835326
835332
|
const arg = {
|
|
835327
835333
|
appCandidate,
|
|
835328
835334
|
account: account3,
|
|
@@ -835443,7 +835449,7 @@ async function runOnAccount({ appCandidate, spec: spec2, device: device2, accoun
|
|
|
835443
835449
|
account: account3,
|
|
835444
835450
|
transaction,
|
|
835445
835451
|
status
|
|
835446
|
-
}), (0, import_operators13.first)((e37) => e37.type === "signed"), (0, import_operators13.map)((e37) => ((0,
|
|
835452
|
+
}), (0, import_operators13.first)((e37) => e37.type === "signed"), (0, import_operators13.map)((e37) => ((0, import_invariant101.default)(e37.type === "signed", "signed operation"), e37.signedOperation))));
|
|
835447
835453
|
deepFreezeSignedOperation(signedOperation);
|
|
835448
835454
|
report.signedOperation = signedOperation;
|
|
835449
835455
|
report.signedTime = (0, import_performance_now.default)();
|
|
@@ -835528,7 +835534,7 @@ async function runOnAccount({ appCandidate, spec: spec2, device: device2, accoun
|
|
|
835528
835534
|
let operation2;
|
|
835529
835535
|
try {
|
|
835530
835536
|
operation2 = account4.operations.find((op) => op.hash === sendingOperation.hash);
|
|
835531
|
-
botTest("destination account should receive an operation (by tx hash)", () => (0,
|
|
835537
|
+
botTest("destination account should receive an operation (by tx hash)", () => (0, import_invariant101.default)(operation2, "no operation found with hash %s", sendingOperation.hash));
|
|
835532
835538
|
if (!operation2)
|
|
835533
835539
|
throw new Error();
|
|
835534
835540
|
const arg = {
|
|
@@ -835684,7 +835690,7 @@ function transactionTest({ operation, optimisticOperation, account: account3, ac
|
|
|
835684
835690
|
if (blockAvgTime && account3.blockHeight) {
|
|
835685
835691
|
const expected = getOperationConfirmationNumber(operation, account3);
|
|
835686
835692
|
const expectedMax = Math.ceil(upperThreshold / blockAvgTime);
|
|
835687
|
-
botTest("low amount of confirmations", () => (0,
|
|
835693
|
+
botTest("low amount of confirmations", () => (0, import_invariant101.default)(expected <= expectedMax, "There are way too much operation confirmation for a small amount of time. %s < %s", expected, expectedMax));
|
|
835688
835694
|
}
|
|
835689
835695
|
botTest("optimisticOperation.value must not be NaN", () => (0, import_expect21.default)(!optimisticOperation.value.isNaN()).toBe(true));
|
|
835690
835696
|
botTest("optimisticOperation.fee must not be NaN", () => (0, import_expect21.default)(!optimisticOperation.fee.isNaN()).toBe(true));
|
|
@@ -836347,7 +836353,7 @@ function getSpecs({ disabled, filter: filter26 }) {
|
|
|
836347
836353
|
}
|
|
836348
836354
|
async function bot({ disabled, filter: filter26 } = {}) {
|
|
836349
836355
|
const SEED = getEnv("SEED");
|
|
836350
|
-
(0,
|
|
836356
|
+
(0, import_invariant102.default)(SEED, "SEED required");
|
|
836351
836357
|
const specsLogs = [];
|
|
836352
836358
|
const specs = getSpecs({ disabled, filter: filter26 });
|
|
836353
836359
|
const timeBefore = Date.now();
|
|
@@ -837431,7 +837437,7 @@ var import_operators19 = require("rxjs/operators");
|
|
|
837431
837437
|
|
|
837432
837438
|
// src/signedOperation.ts
|
|
837433
837439
|
var import_operators18 = require("rxjs/operators");
|
|
837434
|
-
var
|
|
837440
|
+
var import_invariant103 = __toESM(require("invariant"));
|
|
837435
837441
|
var inferSignedOperationsOpts = [
|
|
837436
837442
|
{
|
|
837437
837443
|
name: "signed-operation",
|
|
@@ -837442,13 +837448,13 @@ var inferSignedOperationsOpts = [
|
|
|
837442
837448
|
];
|
|
837443
837449
|
function inferSignedOperations(mainAccount, opts) {
|
|
837444
837450
|
const file = opts["signed-operation"];
|
|
837445
|
-
(0,
|
|
837451
|
+
(0, import_invariant103.default)(file, "--signed-operation file is required");
|
|
837446
837452
|
return jsonFromFile(file).pipe(
|
|
837447
837453
|
(0, import_operators18.map)((json2) => {
|
|
837448
|
-
(0,
|
|
837449
|
-
(0,
|
|
837450
|
-
(0,
|
|
837451
|
-
(0,
|
|
837454
|
+
(0, import_invariant103.default)(typeof json2 === "object", "not an object JSON");
|
|
837455
|
+
(0, import_invariant103.default)(typeof json2.signature === "string", "missing signature");
|
|
837456
|
+
(0, import_invariant103.default)(typeof json2.operation === "object", "missing operation object");
|
|
837457
|
+
(0, import_invariant103.default)(
|
|
837452
837458
|
json2.operation.accountId === mainAccount.id,
|
|
837453
837459
|
"the operation does not match the specified account"
|
|
837454
837460
|
);
|
|
@@ -837901,7 +837907,7 @@ var import_rxjs166 = require("rxjs");
|
|
|
837901
837907
|
var import_operators24 = require("rxjs/operators");
|
|
837902
837908
|
|
|
837903
837909
|
// ../../libs/ledger-live-common/lib-es/hw/getAddress/index.js
|
|
837904
|
-
var
|
|
837910
|
+
var import_invariant104 = __toESM(require("invariant"));
|
|
837905
837911
|
init_lib_es();
|
|
837906
837912
|
init_lib_es2();
|
|
837907
837913
|
|
|
@@ -837938,7 +837944,7 @@ var hw_getAddress_default12 = {
|
|
|
837938
837944
|
var dispatch3 = (transport, opts) => {
|
|
837939
837945
|
const { currency: currency24, verify: verify9 } = opts;
|
|
837940
837946
|
const getAddress12 = hw_getAddress_default12[currency24.family];
|
|
837941
|
-
(0,
|
|
837947
|
+
(0, import_invariant104.default)(getAddress12, `getAddress is not implemented for ${currency24.id}`);
|
|
837942
837948
|
return getAddress12(transport, opts).then((result2) => {
|
|
837943
837949
|
log2("hw", `getAddress ${currency24.id} on ${opts.path}`, result2);
|
|
837944
837950
|
return result2;
|
|
@@ -838093,14 +838099,14 @@ var receive_default = {
|
|
|
838093
838099
|
|
|
838094
838100
|
// src/commands/blockchain/satstack.ts
|
|
838095
838101
|
var import_fs6 = __toESM(require("fs"));
|
|
838096
|
-
var
|
|
838102
|
+
var import_invariant106 = __toESM(require("invariant"));
|
|
838097
838103
|
var import_rxjs172 = require("rxjs");
|
|
838098
838104
|
var import_operators29 = require("rxjs/operators");
|
|
838099
838105
|
|
|
838100
838106
|
// ../../libs/coin-modules/coin-bitcoin/lib-es/descriptor.js
|
|
838101
838107
|
var import_rxjs170 = require("rxjs");
|
|
838102
838108
|
var import_operators27 = require("rxjs/operators");
|
|
838103
|
-
var
|
|
838109
|
+
var import_invariant105 = __toESM(require("invariant"));
|
|
838104
838110
|
var import_bs589 = __toESM(require_bs58());
|
|
838105
838111
|
|
|
838106
838112
|
// ../../libs/coin-modules/coin-bitcoin/lib-es/crypto-util.js
|
|
@@ -838167,12 +838173,12 @@ function makeXpub2({ version: version33, depth, parentFingerprint, index, chainC
|
|
|
838167
838173
|
return import_bs589.default.encode(Buffer.concat([extendedKeyBytes, checksum8]));
|
|
838168
838174
|
}
|
|
838169
838175
|
function inferDescriptorFromDeviceInfo({ derivationMode, currency: currency24, index, parentDerivation, accountDerivation }) {
|
|
838170
|
-
(0,
|
|
838176
|
+
(0, import_invariant105.default)(currency24.bitcoinLikeInfo, "bitcoin currency expected");
|
|
838171
838177
|
const { bitcoinLikeInfo } = currency24;
|
|
838172
838178
|
const { XPUBVersion } = bitcoinLikeInfo;
|
|
838173
|
-
(0,
|
|
838179
|
+
(0, import_invariant105.default)(XPUBVersion, "unsupported bitcoin fork %s", currency24.id);
|
|
838174
838180
|
const { chainCode } = accountDerivation;
|
|
838175
|
-
(0,
|
|
838181
|
+
(0, import_invariant105.default)(chainCode, "chainCode is required");
|
|
838176
838182
|
const fingerprint = makeFingerprint2(compressPublicKeySECP2563(Buffer.from(parentDerivation.publicKey, "hex")));
|
|
838177
838183
|
const xpub = makeXpub2({
|
|
838178
838184
|
version: XPUBVersion,
|
|
@@ -838414,7 +838420,7 @@ var statusObservable = (0, import_rxjs171.interval)(1e3).pipe((0, import_operato
|
|
|
838414
838420
|
// src/commands/blockchain/satstack.ts
|
|
838415
838421
|
var bitcoin2 = getCryptoCurrencyById("bitcoin");
|
|
838416
838422
|
function requiredNodeConfig(nodeConfig) {
|
|
838417
|
-
(0,
|
|
838423
|
+
(0, import_invariant106.default)(nodeConfig, "--rpcHOST,--rpcUSER,--rpcPASSWORD config required");
|
|
838418
838424
|
const errors = validateRPCNodeConfig(nodeConfig);
|
|
838419
838425
|
if (errors.length) {
|
|
838420
838426
|
throw new Error(errors.map((e37) => e37.field + ": " + e37.error.message).join(", "));
|
|
@@ -838660,7 +838666,7 @@ var import_operators34 = require("rxjs/operators");
|
|
|
838660
838666
|
// ../../libs/ledger-live-common/lib-es/hw/signMessage/index.js
|
|
838661
838667
|
init_lib_es();
|
|
838662
838668
|
init_lib_es2();
|
|
838663
|
-
var
|
|
838669
|
+
var import_invariant109 = __toESM(require("invariant"));
|
|
838664
838670
|
var import_react3 = require("react");
|
|
838665
838671
|
var import_rxjs179 = require("rxjs");
|
|
838666
838672
|
|
|
@@ -838982,7 +838988,7 @@ var hw_signMessage_default = {
|
|
|
838982
838988
|
};
|
|
838983
838989
|
|
|
838984
838990
|
// ../../libs/ledger-live-common/lib-es/hw/actions/app.js
|
|
838985
|
-
var
|
|
838991
|
+
var import_invariant108 = __toESM(require("invariant"));
|
|
838986
838992
|
var import_rxjs177 = require("rxjs");
|
|
838987
838993
|
var import_operators33 = require("rxjs/operators");
|
|
838988
838994
|
var import_react2 = require("react");
|
|
@@ -838993,7 +838999,7 @@ var import_rxjs175 = require("rxjs");
|
|
|
838993
838999
|
var import_react = require("react");
|
|
838994
839000
|
|
|
838995
839001
|
// ../../libs/coin-modules/coin-cardano/lib-es/account.js
|
|
838996
|
-
var
|
|
839002
|
+
var import_invariant107 = __toESM(require("invariant"));
|
|
838997
839003
|
|
|
838998
839004
|
// ../../libs/ledger-live-common/lib-es/hw/actions/implementations.js
|
|
838999
839005
|
var import_rxjs176 = require("rxjs");
|
|
@@ -839099,7 +839105,7 @@ var signMessage11 = (transport, account3, opts) => {
|
|
|
839099
839105
|
break;
|
|
839100
839106
|
}
|
|
839101
839107
|
}
|
|
839102
|
-
(0,
|
|
839108
|
+
(0, import_invariant109.default)(signMessage12, `signMessage is not implemented for ${currency24.id}`);
|
|
839103
839109
|
return signMessage12(transport, account3, opts).then((result2) => {
|
|
839104
839110
|
const path4 = "path" in opts && opts.path ? opts.path : account3.freshAddressPath;
|
|
839105
839111
|
log2("hw", `signMessage ${currency24.id} on ${path4} with message [${opts.message}]`, result2);
|
|
@@ -839223,7 +839229,7 @@ var testDetectOpCollision_default = {
|
|
|
839223
839229
|
|
|
839224
839230
|
// src/commands/blockchain/testGetTrustedInputFromTxHash.ts
|
|
839225
839231
|
var import_rxjs182 = require("rxjs");
|
|
839226
|
-
var
|
|
839232
|
+
var import_invariant110 = __toESM(require("invariant"));
|
|
839227
839233
|
|
|
839228
839234
|
// ../../libs/ledger-live-common/lib-es/explorer.js
|
|
839229
839235
|
var findCurrencyExplorer2 = (currency24) => {
|
|
@@ -839247,14 +839253,14 @@ var findCurrencyExplorer2 = (currency24) => {
|
|
|
839247
839253
|
// src/commands/blockchain/testGetTrustedInputFromTxHash.ts
|
|
839248
839254
|
var command = async (transport, currencyId, hash12) => {
|
|
839249
839255
|
const currency24 = findCryptoCurrencyById(currencyId);
|
|
839250
|
-
(0,
|
|
839256
|
+
(0, import_invariant110.default)(currency24, "currency not found");
|
|
839251
839257
|
if (!currency24)
|
|
839252
839258
|
throw new Error("currency not found");
|
|
839253
839259
|
const { bitcoinLikeInfo } = currency24;
|
|
839254
839260
|
const btc = new Btc({ transport, currency: currency24?.id });
|
|
839255
|
-
(0,
|
|
839261
|
+
(0, import_invariant110.default)(currency24.family === "bitcoin" && bitcoinLikeInfo, "currency of bitcoin family only");
|
|
839256
839262
|
const ledgerExplorer = findCurrencyExplorer2(currency24);
|
|
839257
|
-
(0,
|
|
839263
|
+
(0, import_invariant110.default)(ledgerExplorer, "ledgerExplorer not found");
|
|
839258
839264
|
if (!ledgerExplorer)
|
|
839259
839265
|
throw new Error("ledgerExplorer not found");
|
|
839260
839266
|
const { endpoint: endpoint2, version: version33, id: id5 } = ledgerExplorer;
|
|
@@ -840246,7 +840252,7 @@ init_lib_es();
|
|
|
840246
840252
|
// ../../libs/ledger-live-common/lib-es/manager/api.js
|
|
840247
840253
|
init_lib_es();
|
|
840248
840254
|
init_lib_es2();
|
|
840249
|
-
var
|
|
840255
|
+
var import_invariant111 = __toESM(require("invariant"));
|
|
840250
840256
|
var import_rxjs185 = require("rxjs");
|
|
840251
840257
|
var import_operators38 = require("rxjs/operators");
|
|
840252
840258
|
var import_semver22 = __toESM(require_semver2());
|
|
@@ -840783,7 +840789,7 @@ var genuineCheck = (transport, { targetId, perso }) => {
|
|
|
840783
840789
|
var listInstalledApps = (transport, { targetId, perso }) => {
|
|
840784
840790
|
if (getEnv("MOCK")) {
|
|
840785
840791
|
const result2 = global._listInstalledApps_mock_result;
|
|
840786
|
-
(0,
|
|
840792
|
+
(0, import_invariant111.default)(result2, "using MOCK, global._listInstalledApps_mock_result must be set");
|
|
840787
840793
|
return createMockSocket(secureChannelMock(false), resultMock(result2));
|
|
840788
840794
|
}
|
|
840789
840795
|
log2("manager", "listInstalledApps", {
|
|
@@ -840804,10 +840810,10 @@ var listInstalledApps = (transport, { targetId, perso }) => {
|
|
|
840804
840810
|
return {
|
|
840805
840811
|
type: "result",
|
|
840806
840812
|
payload: [...o48.payload].map((a65) => {
|
|
840807
|
-
(0,
|
|
840813
|
+
(0, import_invariant111.default)(typeof a65 === "object" && a65, "payload array item are objects");
|
|
840808
840814
|
const { hash: hash12, name: name3, hash_code_data } = a65;
|
|
840809
|
-
(0,
|
|
840810
|
-
(0,
|
|
840815
|
+
(0, import_invariant111.default)(typeof hash12 === "string", "hash is defined");
|
|
840816
|
+
(0, import_invariant111.default)(typeof name3 === "string", "name is defined");
|
|
840811
840817
|
return {
|
|
840812
840818
|
hash: hash12,
|
|
840813
840819
|
name: name3,
|
|
@@ -841668,7 +841674,7 @@ var appUninstallAll_default = {
|
|
|
841668
841674
|
};
|
|
841669
841675
|
|
|
841670
841676
|
// src/commands/device/appsCheckAllAppVersions.ts
|
|
841671
|
-
var
|
|
841677
|
+
var import_invariant112 = __toESM(require("invariant"));
|
|
841672
841678
|
var import_fs8 = __toESM(require("fs"));
|
|
841673
841679
|
var import_rxjs200 = require("rxjs");
|
|
841674
841680
|
var import_operators44 = require("rxjs/operators");
|
|
@@ -841877,7 +841883,7 @@ var appsCheckAllAppVersions_default = {
|
|
|
841877
841883
|
Promise.all([getDeviceInfo_default(t61), api_default4.listApps()]).then(
|
|
841878
841884
|
async ([deviceInfo, applications]) => {
|
|
841879
841885
|
const { deviceModel } = t61;
|
|
841880
|
-
(0,
|
|
841886
|
+
(0, import_invariant112.default)(deviceModel, "device model mandatory");
|
|
841881
841887
|
const candidates2 = await findCandidates(deviceModel, applications, deviceInfo);
|
|
841882
841888
|
let candidatesErrors = [];
|
|
841883
841889
|
let candidatesNew = [...candidates2];
|
|
@@ -842862,7 +842868,7 @@ var deviceInfo_default = {
|
|
|
842862
842868
|
};
|
|
842863
842869
|
|
|
842864
842870
|
// src/commands/device/deviceSDKFirmwareUpdate.ts
|
|
842865
|
-
var
|
|
842871
|
+
var import_invariant113 = __toESM(require("invariant"));
|
|
842866
842872
|
var import_rxjs226 = require("rxjs");
|
|
842867
842873
|
var import_operators63 = require("rxjs/operators");
|
|
842868
842874
|
|
|
@@ -843698,7 +843704,7 @@ var deviceSDKFirmwareUpdate_default = {
|
|
|
843698
843704
|
osuVersion,
|
|
843699
843705
|
"to-my-own-risk": toMyOwnRisk,
|
|
843700
843706
|
listOSUs
|
|
843701
|
-
}) => ((0,
|
|
843707
|
+
}) => ((0, import_invariant113.default)(!osuVersion || toMyOwnRisk, "--to-my-own-risk is required: " + disclaimer), listOSUs ? (0, import_rxjs226.from)(listFirmwareOSU()).pipe((0, import_operators63.mergeMap)((d56) => (0, import_rxjs226.from)(d56.map((d57) => d57.name)))) : withDevice(device2 || "")((t61) => (0, import_rxjs226.from)(getDeviceInfo_default(t61))).pipe(
|
|
843702
843708
|
(0, import_operators63.mergeMap)(() => {
|
|
843703
843709
|
return (0, import_rxjs226.concat)(
|
|
843704
843710
|
(0, import_rxjs226.of)(`Attempting to install firmware`),
|
|
@@ -844325,7 +844331,7 @@ var firmwareRepair_default = {
|
|
|
844325
844331
|
};
|
|
844326
844332
|
|
|
844327
844333
|
// src/commands/device/firmwareUpdate.ts
|
|
844328
|
-
var
|
|
844334
|
+
var import_invariant114 = __toESM(require("invariant"));
|
|
844329
844335
|
var import_rxjs241 = require("rxjs");
|
|
844330
844336
|
var import_operators76 = require("rxjs/operators");
|
|
844331
844337
|
init_lib_es();
|
|
@@ -844542,7 +844548,7 @@ var firmwareUpdate_default = {
|
|
|
844542
844548
|
osuVersion,
|
|
844543
844549
|
"to-my-own-risk": toMyOwnRisk,
|
|
844544
844550
|
listOSUs
|
|
844545
|
-
}) => ((0,
|
|
844551
|
+
}) => ((0, import_invariant114.default)(!osuVersion || toMyOwnRisk, "--to-my-own-risk is required: " + disclaimer2), listOSUs ? (0, import_rxjs241.from)(listFirmwareOSU2()).pipe((0, import_operators76.mergeMap)((d56) => (0, import_rxjs241.from)(d56.map((d57) => d57.name)))) : withDevice(device2 || "")((t61) => (0, import_rxjs241.from)(getDeviceInfo_default(t61))).pipe(
|
|
844546
844552
|
(0, import_operators76.mergeMap)(
|
|
844547
844553
|
osuVersion ? (deviceInfo) => customGetLatestFirmwareForDevice(deviceInfo, osuVersion) : (deviceInfo) => getLatestFirmwareForDeviceUseCase(deviceInfo)
|
|
844548
844554
|
),
|
|
@@ -845228,7 +845234,7 @@ var repl_default = {
|
|
|
845228
845234
|
|
|
845229
845235
|
// src/commands/device/speculosList.ts
|
|
845230
845236
|
var import_rxjs252 = require("rxjs");
|
|
845231
|
-
var
|
|
845237
|
+
var import_invariant115 = __toESM(require("invariant"));
|
|
845232
845238
|
var import_operators83 = require("rxjs/operators");
|
|
845233
845239
|
var speculosList_default = {
|
|
845234
845240
|
description: "list apps available for speculos",
|
|
@@ -845236,7 +845242,7 @@ var speculosList_default = {
|
|
|
845236
845242
|
job: () => {
|
|
845237
845243
|
async function main2() {
|
|
845238
845244
|
const coinapps = getEnv("COINAPPS");
|
|
845239
|
-
(0,
|
|
845245
|
+
(0, import_invariant115.default)(coinapps, "COINAPPS is not set");
|
|
845240
845246
|
const candidates2 = await listAppCandidates(coinapps);
|
|
845241
845247
|
return candidates2.map(formatAppCandidate);
|
|
845242
845248
|
}
|
|
@@ -845247,7 +845253,7 @@ var speculosList_default = {
|
|
|
845247
845253
|
// src/commands/live/balanceHistory.ts
|
|
845248
845254
|
var import_bignumber397 = require("bignumber.js");
|
|
845249
845255
|
var import_asciichart = require("asciichart");
|
|
845250
|
-
var
|
|
845256
|
+
var import_invariant116 = __toESM(require("invariant"));
|
|
845251
845257
|
var import_operators84 = require("rxjs/operators");
|
|
845252
845258
|
var histoFormatters = {
|
|
845253
845259
|
default: (histo, account3) => histo.map(
|
|
@@ -845279,7 +845285,7 @@ var histoFormatters = {
|
|
|
845279
845285
|
};
|
|
845280
845286
|
function asPortfolioRange(period) {
|
|
845281
845287
|
const ranges2 = getRanges();
|
|
845282
|
-
(0,
|
|
845288
|
+
(0, import_invariant116.default)(ranges2.includes(period), "invalid period. valid values are %s", ranges2.join(" | "));
|
|
845283
845289
|
return period;
|
|
845284
845290
|
}
|
|
845285
845291
|
var balanceHistory_default = {
|
|
@@ -845315,7 +845321,7 @@ var balanceHistory_default = {
|
|
|
845315
845321
|
var import_uniq3 = __toESM(require("lodash/uniq"));
|
|
845316
845322
|
var import_bignumber398 = require("bignumber.js");
|
|
845317
845323
|
var import_asciichart2 = require("asciichart");
|
|
845318
|
-
var
|
|
845324
|
+
var import_invariant117 = __toESM(require("invariant"));
|
|
845319
845325
|
var import_rxjs253 = require("rxjs");
|
|
845320
845326
|
var histoFormatters2 = {
|
|
845321
845327
|
stats: (histo, currency24, countervalue) => (currency24.ticker + " to " + countervalue.ticker).padEnd(12) + " availability=" + (100 * histo.filter((h27) => h27.value).length / histo.length).toFixed(0) + "%",
|
|
@@ -845417,7 +845423,7 @@ var countervalues_default = {
|
|
|
845417
845423
|
job: (opts) => import_rxjs253.Observable.create((o48) => {
|
|
845418
845424
|
async function f43() {
|
|
845419
845425
|
const currencies2 = await getCurrencies(opts);
|
|
845420
|
-
(0,
|
|
845426
|
+
(0, import_invariant117.default)(currencies2, "no currency found");
|
|
845421
845427
|
const countervalues = getCountervalues(opts);
|
|
845422
845428
|
const format6 = histoFormatters2[opts.format || "default"];
|
|
845423
845429
|
const startDate = getStartDate(opts) || /* @__PURE__ */ new Date();
|
|
@@ -845472,7 +845478,7 @@ var countervalues_default = {
|
|
|
845472
845478
|
};
|
|
845473
845479
|
function asPortfolioRange2(period) {
|
|
845474
845480
|
const ranges2 = getRanges();
|
|
845475
|
-
(0,
|
|
845481
|
+
(0, import_invariant117.default)(ranges2.includes(period), "invalid period. valid values are %s", ranges2.join(" | "));
|
|
845476
845482
|
return period;
|
|
845477
845483
|
}
|
|
845478
845484
|
async function getCurrencies(opts) {
|
|
@@ -845496,7 +845502,7 @@ function getStartDate(opts) {
|
|
|
845496
845502
|
if (!opts.startDate || opts.latest)
|
|
845497
845503
|
return null;
|
|
845498
845504
|
const date2 = new Date(opts.startDate);
|
|
845499
|
-
(0,
|
|
845505
|
+
(0, import_invariant117.default)(!isNaN(date2.valueOf()), "invalid startDate");
|
|
845500
845506
|
return date2;
|
|
845501
845507
|
}
|
|
845502
845508
|
function getDatesWithOpts(opts) {
|
|
@@ -848219,7 +848225,7 @@ var SDK = class {
|
|
|
848219
848225
|
}
|
|
848220
848226
|
}
|
|
848221
848227
|
}
|
|
848222
|
-
|
|
848228
|
+
invariant121(trustchainRootId, "trustchainRootId should be defined");
|
|
848223
848229
|
log2("trustchain", "getOrCreateTrustchain rootId=" + trustchainRootId);
|
|
848224
848230
|
let { streamTree } = await withJwt((jwt) => this.fetchTrustchain(jwt, trustchainRootId));
|
|
848225
848231
|
const path4 = streamTree.getApplicationRootPath(this.context.applicationId);
|
|
@@ -848268,14 +848274,14 @@ var SDK = class {
|
|
|
848268
848274
|
this.invalidateJwt();
|
|
848269
848275
|
const withJwt = (job2) => this.hwDeviceProvider.withJwt(deviceId, job2, "cache", callbacks);
|
|
848270
848276
|
const withHw = (job2) => this.hwDeviceProvider.withHw(deviceId, job2, callbacks);
|
|
848271
|
-
|
|
848277
|
+
invariant121(memberCredentials.pubkey !== member2.id, "removeMember must not be used to remove the current member.");
|
|
848272
848278
|
const afterRotation = await this.lifecycle?.onTrustchainRotation(this, trustchain, memberCredentials);
|
|
848273
848279
|
const applicationId = this.context.applicationId;
|
|
848274
848280
|
const trustchainId = trustchain.rootId;
|
|
848275
848281
|
let { resolved, streamTree, applicationRootPath } = await withJwt((jwt) => this.fetchTrustchainAndResolve(jwt, trustchainId, applicationId));
|
|
848276
848282
|
const members7 = resolved.getMembersData();
|
|
848277
848283
|
const withoutMember = members7.filter((m45) => m45.id !== member2.id);
|
|
848278
|
-
|
|
848284
|
+
invariant121(withoutMember.length < members7.length, "member not found");
|
|
848279
848285
|
const withoutMemberOrMe = withoutMember.filter((m45) => m45.id !== memberCredentials.pubkey);
|
|
848280
848286
|
const softwareDevice = getSoftwareDevice(memberCredentials);
|
|
848281
848287
|
const newPath = streamTree.getApplicationRootPath(applicationId, 1);
|
|
@@ -848336,7 +848342,7 @@ var SDK = class {
|
|
|
848336
848342
|
const { streamTree } = await this.fetchTrustchain(jwt, trustchainId);
|
|
848337
848343
|
const applicationRootPath = streamTree.getApplicationRootPath(applicationId);
|
|
848338
848344
|
const applicationNode = streamTree.getChild(applicationRootPath);
|
|
848339
|
-
|
|
848345
|
+
invariant121(applicationNode, "could not find the application stream.");
|
|
848340
848346
|
const resolved = await applicationNode.resolve();
|
|
848341
848347
|
return { resolved, streamTree, applicationRootPath, applicationNode };
|
|
848342
848348
|
}
|
|
@@ -848369,7 +848375,7 @@ var SDK = class {
|
|
|
848369
848375
|
const isNewDerivation = !streamTree.getChild(path4);
|
|
848370
848376
|
streamTree = await withDevice2((device2) => streamTree.share(path4, device2, crypto35.from_hex(member2.id), member2.name, member2.permissions));
|
|
848371
848377
|
const child = streamTree.getChild(path4);
|
|
848372
|
-
|
|
848378
|
+
invariant121(child, "StreamTree.share failed to create the child stream.");
|
|
848373
848379
|
await child.resolve();
|
|
848374
848380
|
if (isNewDerivation) {
|
|
848375
848381
|
const commandStream = CommandStreamEncoder.encode(child.blocks);
|
|
@@ -848387,7 +848393,7 @@ var SDK = class {
|
|
|
848387
848393
|
async closeStream(streamTree, path4, trustchainId, withJwt, withDevice2) {
|
|
848388
848394
|
streamTree = await withDevice2((device2) => streamTree.close(path4, device2));
|
|
848389
848395
|
const child = streamTree.getChild(path4);
|
|
848390
|
-
|
|
848396
|
+
invariant121(child, "StreamTree.close failed to create the child stream.");
|
|
848391
848397
|
await child.resolve();
|
|
848392
848398
|
const commandStream = CommandStreamEncoder.encode([child.blocks[child.blocks.length - 1]]);
|
|
848393
848399
|
const request3 = {
|
|
@@ -848437,7 +848443,7 @@ function liveAuthentication(rootId) {
|
|
|
848437
848443
|
function credentialForPubKey(publicKey3) {
|
|
848438
848444
|
return { version: 0, curveId: 33, signAlgorithm: 1, publicKey: publicKey3 };
|
|
848439
848445
|
}
|
|
848440
|
-
function
|
|
848446
|
+
function invariant121(condition, message2) {
|
|
848441
848447
|
if (!condition) {
|
|
848442
848448
|
throw new Error(message2);
|
|
848443
848449
|
}
|
|
@@ -849568,12 +849574,12 @@ var liveData_default = {
|
|
|
849568
849574
|
// src/commands/live/portfolio.ts
|
|
849569
849575
|
var import_bignumber400 = require("bignumber.js");
|
|
849570
849576
|
var import_asciichart3 = require("asciichart");
|
|
849571
|
-
var
|
|
849577
|
+
var import_invariant118 = __toESM(require("invariant"));
|
|
849572
849578
|
var import_rxjs260 = require("rxjs");
|
|
849573
849579
|
var import_operators88 = require("rxjs/operators");
|
|
849574
849580
|
function asPortfolioRange3(period) {
|
|
849575
849581
|
const ranges2 = getRanges();
|
|
849576
|
-
(0,
|
|
849582
|
+
(0, import_invariant118.default)(ranges2.includes(period), "invalid period. valid values are %s", ranges2.join(" | "));
|
|
849577
849583
|
return period;
|
|
849578
849584
|
}
|
|
849579
849585
|
var portfolio_default = {
|
|
@@ -849600,7 +849606,7 @@ var portfolio_default = {
|
|
|
849600
849606
|
],
|
|
849601
849607
|
job: (opts) => {
|
|
849602
849608
|
const countervalue = findCurrencyByTicker(opts.countervalue || "USD");
|
|
849603
|
-
(0,
|
|
849609
|
+
(0, import_invariant118.default)(countervalue, "currency not found with ticker=" + opts.countervalue);
|
|
849604
849610
|
return scan3(opts).pipe(
|
|
849605
849611
|
(0, import_operators88.reduce)((all8, a65) => all8.concat(a65), []),
|
|
849606
849612
|
(0, import_operators88.concatMap)(
|
|
@@ -849924,7 +849930,7 @@ var ErrorStatus = {
|
|
|
849924
849930
|
|
|
849925
849931
|
// ../../libs/ledgerjs/packages/hw-app-exchange/lib-es/Exchange.js
|
|
849926
849932
|
init_lib_es();
|
|
849927
|
-
var
|
|
849933
|
+
var import_invariant119 = __toESM(require("invariant"));
|
|
849928
849934
|
var ExchangeTypeNg = [
|
|
849929
849935
|
3,
|
|
849930
849936
|
4,
|
|
@@ -849951,7 +849957,7 @@ var P2_NONE = 0 << 4;
|
|
|
849951
849957
|
var P2_EXTEND2 = 1 << 4;
|
|
849952
849958
|
var P2_MORE5 = 2 << 4;
|
|
849953
849959
|
var maybeThrowProtocolError = (result2) => {
|
|
849954
|
-
(0,
|
|
849960
|
+
(0, import_invariant119.default)(result2.length >= 2, "ExchangeTransport: Unexpected result length");
|
|
849955
849961
|
const resultCode = result2.readUInt16BE(result2.length - 2);
|
|
849956
849962
|
if (resultCode !== OkStatus) {
|
|
849957
849963
|
throw new TransportStatusError(resultCode);
|
|
@@ -850062,9 +850068,9 @@ var Exchange = class {
|
|
|
850062
850068
|
maybeThrowProtocolError(result2);
|
|
850063
850069
|
}
|
|
850064
850070
|
async validatePayoutOrAsset(payoutCurrencyConfig, currencyConfigSignature, addressParameters) {
|
|
850065
|
-
(0,
|
|
850066
|
-
(0,
|
|
850067
|
-
(0,
|
|
850071
|
+
(0, import_invariant119.default)(payoutCurrencyConfig.length <= 255, "Currency config is too big");
|
|
850072
|
+
(0, import_invariant119.default)(addressParameters.length <= 255, "Address parameter is too big.");
|
|
850073
|
+
(0, import_invariant119.default)(currencyConfigSignature.length >= 67 && currencyConfigSignature.length <= 73, "Signature should be DER serialized and have length in [67, 73] bytes.");
|
|
850068
850074
|
const bufferToSend = Buffer.concat([
|
|
850069
850075
|
Buffer.from([payoutCurrencyConfig.length]),
|
|
850070
850076
|
payoutCurrencyConfig,
|
|
@@ -850076,9 +850082,9 @@ var Exchange = class {
|
|
|
850076
850082
|
maybeThrowProtocolError(result2);
|
|
850077
850083
|
}
|
|
850078
850084
|
async checkRefundAddress(refundCurrencyConfig, currencyConfigSignature, addressParameters) {
|
|
850079
|
-
(0,
|
|
850080
|
-
(0,
|
|
850081
|
-
(0,
|
|
850085
|
+
(0, import_invariant119.default)(refundCurrencyConfig.length <= 255, "Currency config is too big");
|
|
850086
|
+
(0, import_invariant119.default)(addressParameters.length <= 255, "Address parameter is too big.");
|
|
850087
|
+
(0, import_invariant119.default)(currencyConfigSignature.length >= 67 && currencyConfigSignature.length <= 73, "Signature should be DER serialized and have length in [67, 73] bytes.");
|
|
850082
850088
|
const bufferToSend = Buffer.concat([
|
|
850083
850089
|
Buffer.from([refundCurrencyConfig.length]),
|
|
850084
850090
|
refundCurrencyConfig,
|
|
@@ -850304,7 +850310,7 @@ var lib_es_default4 = Exchange;
|
|
|
850304
850310
|
// ../../libs/ledger-live-common/lib-es/exchange/swap/initSwap.js
|
|
850305
850311
|
init_lib_es2();
|
|
850306
850312
|
var import_bignumber402 = require("bignumber.js");
|
|
850307
|
-
var
|
|
850313
|
+
var import_invariant120 = __toESM(require("invariant"));
|
|
850308
850314
|
var import_rxjs265 = require("rxjs");
|
|
850309
850315
|
var import_secp256k116 = __toESM(require_secp256k12());
|
|
850310
850316
|
|
|
@@ -850723,15 +850729,15 @@ var initSwap = (input) => {
|
|
|
850723
850729
|
transaction = accountBridge14.updateTransaction(transaction, {
|
|
850724
850730
|
tag: new import_bignumber402.BigNumber(swapResult.payinExtraId).toNumber()
|
|
850725
850731
|
});
|
|
850726
|
-
(0,
|
|
850732
|
+
(0, import_invariant120.default)(transaction.tag, "Refusing to swap xrp without a destination tag");
|
|
850727
850733
|
} else if (refundCurrency.id === "stellar") {
|
|
850728
850734
|
transaction = accountBridge14.updateTransaction(transaction, {
|
|
850729
850735
|
memoValue: swapResult.payinExtraId,
|
|
850730
850736
|
memoType: "MEMO_TEXT"
|
|
850731
850737
|
});
|
|
850732
|
-
(0,
|
|
850738
|
+
(0, import_invariant120.default)(transaction.memoValue, "Refusing to swap xlm without a destination memo");
|
|
850733
850739
|
}
|
|
850734
|
-
(0,
|
|
850740
|
+
(0, import_invariant120.default)(transaction.recipient !== getAbandonSeedAddress(refundCurrency.type === "TokenCurrency" ? refundCurrency.parentCurrency.id : refundCurrency.id), "Recipient address should never be the abandonseed address");
|
|
850735
850741
|
transaction = await accountBridge14.prepareTransaction(refundAccount, transaction);
|
|
850736
850742
|
if (unsubscribed)
|
|
850737
850743
|
return;
|
|
@@ -850759,7 +850765,7 @@ var initSwap = (input) => {
|
|
|
850759
850765
|
if (unsubscribed)
|
|
850760
850766
|
return;
|
|
850761
850767
|
const mainPayoutCurrency = getAccountCurrency(payoutAccount);
|
|
850762
|
-
(0,
|
|
850768
|
+
(0, import_invariant120.default)(mainPayoutCurrency.type === "CryptoCurrency", "This should be a cryptocurrency");
|
|
850763
850769
|
if (mainPayoutCurrency.type !== "CryptoCurrency") {
|
|
850764
850770
|
throw new Error("This should be a cryptocurrency");
|
|
850765
850771
|
}
|
|
@@ -850784,7 +850790,7 @@ var initSwap = (input) => {
|
|
|
850784
850790
|
if (unsubscribed)
|
|
850785
850791
|
return;
|
|
850786
850792
|
const mainRefundCurrency = getAccountCurrency(refundAccount);
|
|
850787
|
-
(0,
|
|
850793
|
+
(0, import_invariant120.default)(mainRefundCurrency.type === "CryptoCurrency", "This should be a cryptocurrency");
|
|
850788
850794
|
if (mainRefundCurrency.type !== "CryptoCurrency") {
|
|
850789
850795
|
throw new Error("This should be a cryptocurrency");
|
|
850790
850796
|
}
|
|
@@ -851011,11 +851017,11 @@ var getSwapAPIError = (errorCode, errorMessage) => {
|
|
|
851011
851017
|
};
|
|
851012
851018
|
|
|
851013
851019
|
// src/commands/ptx/swap.ts
|
|
851014
|
-
var
|
|
851020
|
+
var import_invariant121 = __toESM(require("invariant"));
|
|
851015
851021
|
var exec6 = async (opts) => {
|
|
851016
851022
|
const { amount, useAllAmount, tokenId, useFloat, deviceId = "" } = opts;
|
|
851017
|
-
(0,
|
|
851018
|
-
(0,
|
|
851023
|
+
(0, import_invariant121.default)(amount || useAllAmount, `\u2716 amount in satoshis is needed or --useAllAmount `);
|
|
851024
|
+
(0, import_invariant121.default)(opts._unknown, `\u2716 second account information is missing`);
|
|
851019
851025
|
const secondAccountOpts = (0, import_command_line_args.default)(
|
|
851020
851026
|
[
|
|
851021
851027
|
...scanCommonOpts,
|
|
@@ -851036,13 +851042,13 @@ var exec6 = async (opts) => {
|
|
|
851036
851042
|
let fromAccount = await (0, import_rxjs266.firstValueFrom)(
|
|
851037
851043
|
scan3(opts).pipe((0, import_operators90.take)(1))
|
|
851038
851044
|
);
|
|
851039
|
-
(0,
|
|
851045
|
+
(0, import_invariant121.default)(fromAccount, `\u2716 No account found, is the right currency app open?`);
|
|
851040
851046
|
if (!fromAccount) {
|
|
851041
851047
|
throw new Error(`\u2716 No account found, is the right currency app open?`);
|
|
851042
851048
|
}
|
|
851043
851049
|
if (tokenId) {
|
|
851044
851050
|
const token = findTokenById(tokenId);
|
|
851045
|
-
(0,
|
|
851051
|
+
(0, import_invariant121.default)(token, `\u2716 No token currency found with id ${tokenId}`);
|
|
851046
851052
|
if (!token)
|
|
851047
851053
|
throw new Error(`\u2716 No token currency found with id ${tokenId}`);
|
|
851048
851054
|
const subAccounts = accountWithMandatoryTokens(fromAccount, [token]).subAccounts || [];
|
|
@@ -851052,7 +851058,7 @@ var exec6 = async (opts) => {
|
|
|
851052
851058
|
});
|
|
851053
851059
|
fromParentAccount = fromAccount;
|
|
851054
851060
|
fromAccount = subAccount;
|
|
851055
|
-
(0,
|
|
851061
|
+
(0, import_invariant121.default)(fromAccount, `\u2716 No account found, is the right currency app open?`);
|
|
851056
851062
|
if (!fromAccount) {
|
|
851057
851063
|
throw new Error(`\u2716 No account found, is the right currency app open?`);
|
|
851058
851064
|
}
|
|
@@ -851071,7 +851077,7 @@ var exec6 = async (opts) => {
|
|
|
851071
851077
|
}
|
|
851072
851078
|
);
|
|
851073
851079
|
console.log(" :balance: ", fromAccount.spendableBalance.toString(), ` [ ${formattedAmount} ]`);
|
|
851074
|
-
(0,
|
|
851080
|
+
(0, import_invariant121.default)(fromAccount.balance.gte(new import_bignumber404.BigNumber(amount)), `\u2716 Not enough balance`);
|
|
851075
851081
|
console.log("\u2022 Open the destination currency app");
|
|
851076
851082
|
await delay(8e3);
|
|
851077
851083
|
let toParentAccount = null;
|
|
@@ -851094,9 +851100,9 @@ var exec6 = async (opts) => {
|
|
|
851094
851100
|
});
|
|
851095
851101
|
toParentAccount = toAccount;
|
|
851096
851102
|
toAccount = subAccount;
|
|
851097
|
-
(0,
|
|
851103
|
+
(0, import_invariant121.default)(fromAccount, `\u2716 No account found`);
|
|
851098
851104
|
}
|
|
851099
|
-
(0,
|
|
851105
|
+
(0, import_invariant121.default)(toAccount, `\u2716 No account found`);
|
|
851100
851106
|
if (!toAccount)
|
|
851101
851107
|
throw new Error(`\u2716 No account found`);
|
|
851102
851108
|
if (toParentAccount) {
|
|
@@ -851145,7 +851151,7 @@ var exec6 = async (opts) => {
|
|
|
851145
851151
|
}
|
|
851146
851152
|
return false;
|
|
851147
851153
|
});
|
|
851148
|
-
(0,
|
|
851154
|
+
(0, import_invariant121.default)(exchangeRate, `\u2716 No valid rate available`);
|
|
851149
851155
|
console.log(`Using first ${useFloat ? "float" : "fixed"} rate:
|
|
851150
851156
|
`, exchangeRate);
|
|
851151
851157
|
console.log({
|
|
@@ -851168,7 +851174,7 @@ var exec6 = async (opts) => {
|
|
|
851168
851174
|
break;
|
|
851169
851175
|
case "init-swap-error":
|
|
851170
851176
|
console.log(e37);
|
|
851171
|
-
(0,
|
|
851177
|
+
(0, import_invariant121.default)(false, "Something went wrong confirming the swap");
|
|
851172
851178
|
break;
|
|
851173
851179
|
case "init-swap-result":
|
|
851174
851180
|
console.log(e37);
|