@ledgerhq/live-cli 24.21.0-nightly.1 → 24.21.0-nightly.3

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.
Files changed (2) hide show
  1. package/lib/cli.js +22 -80
  2. package/package.json +1 -1
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-nightly.1",
516681
+ version: "34.44.0-nightly.3",
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-nightly.1",
523484
+ version: "24.21.0-nightly.3",
523485
523485
  description: "ledger-live CLI version",
523486
523486
  repository: {
523487
523487
  type: "git",
@@ -581416,26 +581416,9 @@ 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
- `;
581432
581419
  var GetAccountTransactionsData = gql`
581433
581420
  query GetAccountTransactionsData($address: String, $limit: Int) {
581434
- account_transactions(
581435
- where: { account_address: { _eq: $address } }
581436
- order_by: { transaction_version: desc }
581437
- limit: $limit
581438
- ) {
581421
+ account_transactions(where: { account_address: { _eq: $address } }, limit: $limit) {
581439
581422
  transaction_version
581440
581423
  __typename
581441
581424
  }
@@ -581445,7 +581428,6 @@ var GetAccountTransactionsDataGt = gql`
581445
581428
  query GetAccountTransactionsDataGt($address: String, $limit: Int, $gt: bigint) {
581446
581429
  account_transactions(
581447
581430
  where: { account_address: { _eq: $address }, transaction_version: { _gt: $gt } }
581448
- order_by: { transaction_version: desc }
581449
581431
  limit: $limit
581450
581432
  ) {
581451
581433
  transaction_version
@@ -581453,36 +581435,6 @@ var GetAccountTransactionsDataGt = gql`
581453
581435
  }
581454
581436
  }
581455
581437
  `;
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
- `;
581486
581438
  var GetCurrentDelegatorBalancesData = gql`
581487
581439
  query GetCurrentDelegatorBalances {
581488
581440
  current_delegator_balances(distinct_on: pool_address) {
@@ -581705,7 +581657,7 @@ var AptosAPI = class {
581705
581657
  },
581706
581658
  fetchPolicy: "network-only"
581707
581659
  });
581708
- return Promise.all(queryResponse.data.account_transactions.map(({ transaction_version }) => {
581660
+ return Promise.all(queryResponse.data.account_transactions.slice().sort((a65, b16) => b16.transaction_version - a65.transaction_version).map(({ transaction_version }) => {
581709
581661
  return this.richItemByVersion(transaction_version);
581710
581662
  }));
581711
581663
  }
@@ -582263,11 +582215,7 @@ function setAptosPreloadData(data6, currency24) {
582263
582215
  var import_bignumber66 = __toESM(require("bignumber.js"));
582264
582216
  async function getValidators(currencyId) {
582265
582217
  const api7 = new AptosAPI(currencyId);
582266
- const query3 = GetCurrentDelegatorBalancesData;
582267
- const queryResponse = await api7.apolloClient.query({
582268
- query: query3,
582269
- fetchPolicy: "network-only"
582270
- });
582218
+ const queryResponse = await cachedValidators(api7, currencyId);
582271
582219
  const stakingData = queryResponse.data.current_delegator_balances;
582272
582220
  const list2 = await Promise.all(stakingData.map(async (pool) => {
582273
582221
  const aptosName = pool.staking_pool_metadata.operator_aptos_name;
@@ -582287,6 +582235,14 @@ async function getValidators(currencyId) {
582287
582235
  }));
582288
582236
  return list2.sort((a65, b16) => b16.activeStake.toNumber() - a65.activeStake.toNumber());
582289
582237
  }
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));
582290
582246
 
582291
582247
  // ../../libs/coin-modules/coin-aptos/lib-es/preload.js
582292
582248
  var PRELOAD_MAX_AGE = 15 * 60 * 1e3;
@@ -688006,6 +687962,7 @@ var getAccountShape8 = async (info6) => {
688006
687962
  balance: accountBalance.balance,
688007
687963
  spendableBalance: accountBalance.balance,
688008
687964
  operations: operations2,
687965
+ operationsCount: operations2.length,
688009
687966
  // NOTE: there are no "blocks" in hedera
688010
687967
  // Set a value just so that operations are considered confirmed according to isConfirmedOperation
688011
687968
  blockHeight: 10
@@ -690055,12 +690012,14 @@ var getAccountShape9 = async (info6) => {
690055
690012
  const balance = await fetchBalances(address4);
690056
690013
  const rawTxs = await fetchTxs2(address4);
690057
690014
  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());
690058
690016
  const result2 = {
690059
690017
  id: accountId2,
690060
690018
  subAccounts: tokenAccounts,
690061
690019
  balance: new import_bignumber185.BigNumber(balance.total_balance),
690062
690020
  spendableBalance: new import_bignumber185.BigNumber(balance.spendable_balance),
690063
- operations: (0, import_flatMap9.default)(processTxs(rawTxs), mapTxToOps2(accountId2, info6)).sort((a65, b16) => b16.date.getTime() - a65.date.getTime()),
690021
+ operations: operations2,
690022
+ operationsCount: operations2.length,
690064
690023
  blockHeight: blockHeight.current_block_identifier.index
690065
690024
  };
690066
690025
  return result2;
@@ -701691,7 +701650,7 @@ function getOperationType6(transaction, address4) {
701691
701650
  }
701692
701651
  }
701693
701652
  function getOperationValue2(transaction, type4) {
701694
- const amount = transaction.actions[0].data.deposit || 0;
701653
+ const amount = transaction.actions[0]?.data?.deposit || 0;
701695
701654
  if (type4 === "OUT") {
701696
701655
  return new import_bignumber221.BigNumber(amount).plus(transaction.fee);
701697
701656
  }
@@ -702703,7 +702662,6 @@ var PolkadotBondMinimumAmount = createCustomErrorClass("PolkadotBondMinimumAmoun
702703
702662
  var PolkadotBondMinimumAmountWarning = createCustomErrorClass("PolkadotBondMinimumAmountWarning");
702704
702663
  var PolkadotMaxUnbonding = createCustomErrorClass("PolkadotMaxUnbonding");
702705
702664
  var PolkadotValidatorsRequired = createCustomErrorClass("PolkadotValidatorsRequired");
702706
- var PolkadotDoMaxSendInstead = createCustomErrorClass("PolkadotDoMaxSendInstead");
702707
702665
 
702708
702666
  // ../../libs/coin-modules/coin-polkadot/lib-es/bridge/preload.js
702709
702667
  var import_bignumber234 = require("bignumber.js");
@@ -708555,10 +708513,6 @@ var calculateAmount4 = ({ account: account3, transaction }) => {
708555
708513
  }
708556
708514
  return amount.lt(0) ? new import_bignumber232.BigNumber(0) : amount;
708557
708515
  };
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
- };
708562
708516
 
708563
708517
  // ../../node_modules/.pnpm/@polkadot+types@11.2.1/node_modules/@polkadot/types/interfaces/definitions.js
708564
708518
  var definitions_exports = {};
@@ -749912,15 +749866,7 @@ var getSendTransactionStatus4 = async (account3, transaction) => {
749912
749866
  if (amount.lte(0) && !transaction.useAllAmount) {
749913
749867
  errors.amount = new AmountRequired();
749914
749868
  }
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()) {
749869
+ if (!errors.amount && !transaction.useAllAmount && account3.spendableBalance.isZero()) {
749924
749870
  errors.amount = new NotEnoughBalance();
749925
749871
  } else if (totalSpent.gt(account3.spendableBalance)) {
749926
749872
  errors.amount = new NotEnoughBalance();
@@ -772366,11 +772312,11 @@ var StellarSourceHasMultiSign = createCustomErrorClass("StellarSourceHasMultiSig
772366
772312
  var import_bignumber264 = __toESM(require("bignumber.js"));
772367
772313
  var currency = getCryptoCurrencyById("stellar");
772368
772314
  async function getAccountSpendableBalance2(balance, account3) {
772369
- const minimumBalance = getMinimumBalance3(account3);
772315
+ const minimumBalance = getMinimumBalance2(account3);
772370
772316
  const { recommendedFee } = await fetchBaseFee();
772371
772317
  return import_bignumber264.default.max(balance.minus(minimumBalance).minus(recommendedFee), 0);
772372
772318
  }
772373
- var getMinimumBalance3 = (account3) => {
772319
+ var getMinimumBalance2 = (account3) => {
772374
772320
  return parseCurrencyUnit(currency.units[0], getReservedBalance(account3).toString());
772375
772321
  };
772376
772322
  function getReservedBalance(account3) {
@@ -794088,6 +794034,7 @@ var getAccountShape17 = async ({ initialAccount, rest, currency: currency24, der
794088
794034
  xpub: publicKey3,
794089
794035
  freshAddress: address4,
794090
794036
  operations: operations2,
794037
+ operationsCount: operations2.length,
794091
794038
  balance,
794092
794039
  subAccounts,
794093
794040
  spendableBalance: balance,
@@ -825394,11 +825341,6 @@ var polkadot3 = {
825394
825341
  (0, import_invariant95.default)(account3.spendableBalance.gte(EXISTENTIAL_DEPOSIT4.plus(POLKADOT_MIN_SAFE)), "send is too low to activate account");
825395
825342
  amount = EXISTENTIAL_DEPOSIT4;
825396
825343
  }
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
- }
825402
825344
  return {
825403
825345
  transaction: bridge28.createTransaction(account3),
825404
825346
  updates: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.21.0-nightly.1",
3
+ "version": "24.21.0-nightly.3",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",