@ledgerhq/live-cli 24.21.0-nightly.3 → 24.21.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 +80 -22
- package/package.json +3 -3
package/lib/cli.js
CHANGED
|
@@ -516678,7 +516678,7 @@ var require_package8 = __commonJS({
|
|
|
516678
516678
|
module2.exports = {
|
|
516679
516679
|
name: "@ledgerhq/live-common",
|
|
516680
516680
|
description: "Common ground for the Ledger Live apps",
|
|
516681
|
-
version: "34.44.0
|
|
516681
|
+
version: "34.44.0",
|
|
516682
516682
|
repository: {
|
|
516683
516683
|
type: "git",
|
|
516684
516684
|
url: "https://github.com/LedgerHQ/ledger-live.git"
|
|
@@ -523481,7 +523481,7 @@ var require_package9 = __commonJS({
|
|
|
523481
523481
|
"package.json"(exports2, module2) {
|
|
523482
523482
|
module2.exports = {
|
|
523483
523483
|
name: "@ledgerhq/live-cli",
|
|
523484
|
-
version: "24.21.0
|
|
523484
|
+
version: "24.21.0",
|
|
523485
523485
|
description: "ledger-live CLI version",
|
|
523486
523486
|
repository: {
|
|
523487
523487
|
type: "git",
|
|
@@ -581416,9 +581416,26 @@ var import_bignumber59 = __toESM(require("bignumber.js"));
|
|
|
581416
581416
|
var import_isUndefined = __toESM(require("lodash/isUndefined"));
|
|
581417
581417
|
|
|
581418
581418
|
// ../../libs/coin-modules/coin-aptos/lib-es/network/graphql/queries.js
|
|
581419
|
+
var GetDelegatedStakingActivities = gql`
|
|
581420
|
+
query getDelegatedStakingActivities($delegatorAddress: String) {
|
|
581421
|
+
delegated_staking_activities(
|
|
581422
|
+
where: { delegator_address: { _eq: $delegatorAddress } }
|
|
581423
|
+
order_by: { transaction_version: asc }
|
|
581424
|
+
) {
|
|
581425
|
+
amount
|
|
581426
|
+
delegator_address
|
|
581427
|
+
pool_address
|
|
581428
|
+
transaction_version
|
|
581429
|
+
}
|
|
581430
|
+
}
|
|
581431
|
+
`;
|
|
581419
581432
|
var GetAccountTransactionsData = gql`
|
|
581420
581433
|
query GetAccountTransactionsData($address: String, $limit: Int) {
|
|
581421
|
-
account_transactions(
|
|
581434
|
+
account_transactions(
|
|
581435
|
+
where: { account_address: { _eq: $address } }
|
|
581436
|
+
order_by: { transaction_version: desc }
|
|
581437
|
+
limit: $limit
|
|
581438
|
+
) {
|
|
581422
581439
|
transaction_version
|
|
581423
581440
|
__typename
|
|
581424
581441
|
}
|
|
@@ -581428,6 +581445,7 @@ var GetAccountTransactionsDataGt = gql`
|
|
|
581428
581445
|
query GetAccountTransactionsDataGt($address: String, $limit: Int, $gt: bigint) {
|
|
581429
581446
|
account_transactions(
|
|
581430
581447
|
where: { account_address: { _eq: $address }, transaction_version: { _gt: $gt } }
|
|
581448
|
+
order_by: { transaction_version: desc }
|
|
581431
581449
|
limit: $limit
|
|
581432
581450
|
) {
|
|
581433
581451
|
transaction_version
|
|
@@ -581435,6 +581453,36 @@ var GetAccountTransactionsDataGt = gql`
|
|
|
581435
581453
|
}
|
|
581436
581454
|
}
|
|
581437
581455
|
`;
|
|
581456
|
+
var GetAccountTransactionsDataLt = gql`
|
|
581457
|
+
query GetAccountTransactionsDataLt($address: String, $limit: Int, $lt: bigint) {
|
|
581458
|
+
account_transactions(
|
|
581459
|
+
where: { account_address: { _eq: $address }, transaction_version: { _lt: $lt } }
|
|
581460
|
+
order_by: { transaction_version: desc }
|
|
581461
|
+
limit: $limit
|
|
581462
|
+
) {
|
|
581463
|
+
transaction_version
|
|
581464
|
+
__typename
|
|
581465
|
+
}
|
|
581466
|
+
}
|
|
581467
|
+
`;
|
|
581468
|
+
var GetNumActiveDelegatorPerPoolData = gql`
|
|
581469
|
+
query GetNumActiveDelegatorPerPoolData {
|
|
581470
|
+
num_active_delegator_per_pool {
|
|
581471
|
+
num_active_delegator
|
|
581472
|
+
pool_address
|
|
581473
|
+
}
|
|
581474
|
+
delegated_staking_pools {
|
|
581475
|
+
staking_pool_address
|
|
581476
|
+
current_staking_pool {
|
|
581477
|
+
operator_address
|
|
581478
|
+
operator_aptos_name(where: { is_active: { _eq: true } }) {
|
|
581479
|
+
domain
|
|
581480
|
+
is_primary
|
|
581481
|
+
}
|
|
581482
|
+
}
|
|
581483
|
+
}
|
|
581484
|
+
}
|
|
581485
|
+
`;
|
|
581438
581486
|
var GetCurrentDelegatorBalancesData = gql`
|
|
581439
581487
|
query GetCurrentDelegatorBalances {
|
|
581440
581488
|
current_delegator_balances(distinct_on: pool_address) {
|
|
@@ -581657,7 +581705,7 @@ var AptosAPI = class {
|
|
|
581657
581705
|
},
|
|
581658
581706
|
fetchPolicy: "network-only"
|
|
581659
581707
|
});
|
|
581660
|
-
return Promise.all(queryResponse.data.account_transactions.
|
|
581708
|
+
return Promise.all(queryResponse.data.account_transactions.map(({ transaction_version }) => {
|
|
581661
581709
|
return this.richItemByVersion(transaction_version);
|
|
581662
581710
|
}));
|
|
581663
581711
|
}
|
|
@@ -582215,7 +582263,11 @@ function setAptosPreloadData(data6, currency24) {
|
|
|
582215
582263
|
var import_bignumber66 = __toESM(require("bignumber.js"));
|
|
582216
582264
|
async function getValidators(currencyId) {
|
|
582217
582265
|
const api7 = new AptosAPI(currencyId);
|
|
582218
|
-
const
|
|
582266
|
+
const query3 = GetCurrentDelegatorBalancesData;
|
|
582267
|
+
const queryResponse = await api7.apolloClient.query({
|
|
582268
|
+
query: query3,
|
|
582269
|
+
fetchPolicy: "network-only"
|
|
582270
|
+
});
|
|
582219
582271
|
const stakingData = queryResponse.data.current_delegator_balances;
|
|
582220
582272
|
const list2 = await Promise.all(stakingData.map(async (pool) => {
|
|
582221
582273
|
const aptosName = pool.staking_pool_metadata.operator_aptos_name;
|
|
@@ -582235,14 +582287,6 @@ async function getValidators(currencyId) {
|
|
|
582235
582287
|
}));
|
|
582236
582288
|
return list2.sort((a65, b16) => b16.activeStake.toNumber() - a65.activeStake.toNumber());
|
|
582237
582289
|
}
|
|
582238
|
-
var fetchValidatorsData = async (api7, _currencyId) => {
|
|
582239
|
-
const query3 = GetCurrentDelegatorBalancesData;
|
|
582240
|
-
return await api7.apolloClient.query({
|
|
582241
|
-
query: query3,
|
|
582242
|
-
fetchPolicy: "network-only"
|
|
582243
|
-
});
|
|
582244
|
-
};
|
|
582245
|
-
var cachedValidators = makeLRUCache(fetchValidatorsData, (_api, currencyId) => currencyId, minutes(30));
|
|
582246
582290
|
|
|
582247
582291
|
// ../../libs/coin-modules/coin-aptos/lib-es/preload.js
|
|
582248
582292
|
var PRELOAD_MAX_AGE = 15 * 60 * 1e3;
|
|
@@ -687962,7 +688006,6 @@ var getAccountShape8 = async (info6) => {
|
|
|
687962
688006
|
balance: accountBalance.balance,
|
|
687963
688007
|
spendableBalance: accountBalance.balance,
|
|
687964
688008
|
operations: operations2,
|
|
687965
|
-
operationsCount: operations2.length,
|
|
687966
688009
|
// NOTE: there are no "blocks" in hedera
|
|
687967
688010
|
// Set a value just so that operations are considered confirmed according to isConfirmedOperation
|
|
687968
688011
|
blockHeight: 10
|
|
@@ -690012,14 +690055,12 @@ var getAccountShape9 = async (info6) => {
|
|
|
690012
690055
|
const balance = await fetchBalances(address4);
|
|
690013
690056
|
const rawTxs = await fetchTxs2(address4);
|
|
690014
690057
|
const tokenAccounts = await buildTokenAccounts(address4, accountId2, info6.initialAccount);
|
|
690015
|
-
const operations2 = (0, import_flatMap9.default)(processTxs(rawTxs), mapTxToOps2(accountId2, info6)).sort((a65, b16) => b16.date.getTime() - a65.date.getTime());
|
|
690016
690058
|
const result2 = {
|
|
690017
690059
|
id: accountId2,
|
|
690018
690060
|
subAccounts: tokenAccounts,
|
|
690019
690061
|
balance: new import_bignumber185.BigNumber(balance.total_balance),
|
|
690020
690062
|
spendableBalance: new import_bignumber185.BigNumber(balance.spendable_balance),
|
|
690021
|
-
operations:
|
|
690022
|
-
operationsCount: operations2.length,
|
|
690063
|
+
operations: (0, import_flatMap9.default)(processTxs(rawTxs), mapTxToOps2(accountId2, info6)).sort((a65, b16) => b16.date.getTime() - a65.date.getTime()),
|
|
690023
690064
|
blockHeight: blockHeight.current_block_identifier.index
|
|
690024
690065
|
};
|
|
690025
690066
|
return result2;
|
|
@@ -701650,7 +701691,7 @@ function getOperationType6(transaction, address4) {
|
|
|
701650
701691
|
}
|
|
701651
701692
|
}
|
|
701652
701693
|
function getOperationValue2(transaction, type4) {
|
|
701653
|
-
const amount = transaction.actions[0]
|
|
701694
|
+
const amount = transaction.actions[0].data.deposit || 0;
|
|
701654
701695
|
if (type4 === "OUT") {
|
|
701655
701696
|
return new import_bignumber221.BigNumber(amount).plus(transaction.fee);
|
|
701656
701697
|
}
|
|
@@ -702662,6 +702703,7 @@ var PolkadotBondMinimumAmount = createCustomErrorClass("PolkadotBondMinimumAmoun
|
|
|
702662
702703
|
var PolkadotBondMinimumAmountWarning = createCustomErrorClass("PolkadotBondMinimumAmountWarning");
|
|
702663
702704
|
var PolkadotMaxUnbonding = createCustomErrorClass("PolkadotMaxUnbonding");
|
|
702664
702705
|
var PolkadotValidatorsRequired = createCustomErrorClass("PolkadotValidatorsRequired");
|
|
702706
|
+
var PolkadotDoMaxSendInstead = createCustomErrorClass("PolkadotDoMaxSendInstead");
|
|
702665
702707
|
|
|
702666
702708
|
// ../../libs/coin-modules/coin-polkadot/lib-es/bridge/preload.js
|
|
702667
702709
|
var import_bignumber234 = require("bignumber.js");
|
|
@@ -708513,6 +708555,10 @@ var calculateAmount4 = ({ account: account3, transaction }) => {
|
|
|
708513
708555
|
}
|
|
708514
708556
|
return amount.lt(0) ? new import_bignumber232.BigNumber(0) : amount;
|
|
708515
708557
|
};
|
|
708558
|
+
var getMinimumBalance2 = (a65) => {
|
|
708559
|
+
const lockedBalance = a65.balance.minus(a65.spendableBalance);
|
|
708560
|
+
return lockedBalance.lte(EXISTENTIAL_DEPOSIT2) ? EXISTENTIAL_DEPOSIT2.minus(lockedBalance) : new import_bignumber232.BigNumber(0);
|
|
708561
|
+
};
|
|
708516
708562
|
|
|
708517
708563
|
// ../../node_modules/.pnpm/@polkadot+types@11.2.1/node_modules/@polkadot/types/interfaces/definitions.js
|
|
708518
708564
|
var definitions_exports = {};
|
|
@@ -749866,7 +749912,15 @@ var getSendTransactionStatus4 = async (account3, transaction) => {
|
|
|
749866
749912
|
if (amount.lte(0) && !transaction.useAllAmount) {
|
|
749867
749913
|
errors.amount = new AmountRequired();
|
|
749868
749914
|
}
|
|
749869
|
-
|
|
749915
|
+
const minimumBalanceExistential = getMinimumBalance2(account3);
|
|
749916
|
+
const leftover = account3.spendableBalance.minus(totalSpent);
|
|
749917
|
+
if (minimumBalanceExistential.gt(0) && leftover.lt(minimumBalanceExistential) && leftover.gt(0)) {
|
|
749918
|
+
errors.amount = new PolkadotDoMaxSendInstead("", {
|
|
749919
|
+
minimumBalance: formatCurrencyUnit(account3.currency.units[0], EXISTENTIAL_DEPOSIT2, {
|
|
749920
|
+
showCode: true
|
|
749921
|
+
})
|
|
749922
|
+
});
|
|
749923
|
+
} else if (!errors.amount && !transaction.useAllAmount && account3.spendableBalance.isZero()) {
|
|
749870
749924
|
errors.amount = new NotEnoughBalance();
|
|
749871
749925
|
} else if (totalSpent.gt(account3.spendableBalance)) {
|
|
749872
749926
|
errors.amount = new NotEnoughBalance();
|
|
@@ -772312,11 +772366,11 @@ var StellarSourceHasMultiSign = createCustomErrorClass("StellarSourceHasMultiSig
|
|
|
772312
772366
|
var import_bignumber264 = __toESM(require("bignumber.js"));
|
|
772313
772367
|
var currency = getCryptoCurrencyById("stellar");
|
|
772314
772368
|
async function getAccountSpendableBalance2(balance, account3) {
|
|
772315
|
-
const minimumBalance =
|
|
772369
|
+
const minimumBalance = getMinimumBalance3(account3);
|
|
772316
772370
|
const { recommendedFee } = await fetchBaseFee();
|
|
772317
772371
|
return import_bignumber264.default.max(balance.minus(minimumBalance).minus(recommendedFee), 0);
|
|
772318
772372
|
}
|
|
772319
|
-
var
|
|
772373
|
+
var getMinimumBalance3 = (account3) => {
|
|
772320
772374
|
return parseCurrencyUnit(currency.units[0], getReservedBalance(account3).toString());
|
|
772321
772375
|
};
|
|
772322
772376
|
function getReservedBalance(account3) {
|
|
@@ -794034,7 +794088,6 @@ var getAccountShape17 = async ({ initialAccount, rest, currency: currency24, der
|
|
|
794034
794088
|
xpub: publicKey3,
|
|
794035
794089
|
freshAddress: address4,
|
|
794036
794090
|
operations: operations2,
|
|
794037
|
-
operationsCount: operations2.length,
|
|
794038
794091
|
balance,
|
|
794039
794092
|
subAccounts,
|
|
794040
794093
|
spendableBalance: balance,
|
|
@@ -825341,6 +825394,11 @@ var polkadot3 = {
|
|
|
825341
825394
|
(0, import_invariant95.default)(account3.spendableBalance.gte(EXISTENTIAL_DEPOSIT4.plus(POLKADOT_MIN_SAFE)), "send is too low to activate account");
|
|
825342
825395
|
amount = EXISTENTIAL_DEPOSIT4;
|
|
825343
825396
|
}
|
|
825397
|
+
const minimumBalanceExistential = getMinimumBalance2(account3);
|
|
825398
|
+
const leftover = account3.spendableBalance.minus(amount.plus(POLKADOT_MIN_SAFE));
|
|
825399
|
+
if (minimumBalanceExistential.gt(0) && leftover.lt(minimumBalanceExistential) && leftover.gt(0)) {
|
|
825400
|
+
throw new Error("risk of PolkadotDoMaxSendInstead");
|
|
825401
|
+
}
|
|
825344
825402
|
return {
|
|
825345
825403
|
transaction: bridge28.createTransaction(account3),
|
|
825346
825404
|
updates: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/live-cli",
|
|
3
|
-
"version": "24.21.0
|
|
3
|
+
"version": "24.21.0",
|
|
4
4
|
"description": "ledger-live CLI version",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"@types/ws": "8.5.10",
|
|
58
58
|
"ts-node": "10.9.2",
|
|
59
59
|
"tsup": "7.3.0",
|
|
60
|
-
"@ledgerhq/types-cryptoassets": "^7.
|
|
61
|
-
"@ledgerhq/types-live": "^6.
|
|
60
|
+
"@ledgerhq/types-cryptoassets": "^7.25.0",
|
|
61
|
+
"@ledgerhq/types-live": "^6.80.0"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"directory": "dist"
|