@ledgerhq/live-cli 24.21.0-nightly.2 → 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 +13 -57
  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.2",
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.2",
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.21.0-nightly.2",
3
+ "version": "24.21.0-nightly.3",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",