@ledgerhq/live-cli 24.18.0-nightly.3 → 24.18.0-nightly.4

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 +59 -46
  2. package/package.json +3 -3
package/lib/cli.js CHANGED
@@ -537781,7 +537781,7 @@ var require_package8 = __commonJS({
537781
537781
  module2.exports = {
537782
537782
  name: "@ledgerhq/live-common",
537783
537783
  description: "Common ground for the Ledger Live apps",
537784
- version: "34.32.0-nightly.3",
537784
+ version: "34.32.0-nightly.4",
537785
537785
  repository: {
537786
537786
  type: "git",
537787
537787
  url: "https://github.com/LedgerHQ/ledger-live.git"
@@ -544582,7 +544582,7 @@ var require_package9 = __commonJS({
544582
544582
  "package.json"(exports2, module2) {
544583
544583
  module2.exports = {
544584
544584
  name: "@ledgerhq/live-cli",
544585
- version: "24.18.0-nightly.3",
544585
+ version: "24.18.0-nightly.4",
544586
544586
  description: "ledger-live CLI version",
544587
544587
  repository: {
544588
544588
  type: "git",
@@ -619650,17 +619650,17 @@ var BaseContract = class {
619650
619650
  }
619651
619651
  }
619652
619652
  }
619653
- queryFilter(event, fromBlockOrBlockhash, toBlock) {
619653
+ queryFilter(event, fromBlockOrBlockhash, toBlock2) {
619654
619654
  const runningEvent = this._getRunningEvent(event);
619655
619655
  const filter26 = shallowCopy2(runningEvent.filter);
619656
619656
  if (typeof fromBlockOrBlockhash === "string" && isHexString2(fromBlockOrBlockhash, 32)) {
619657
- if (toBlock != null) {
619658
- logger20.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock);
619657
+ if (toBlock2 != null) {
619658
+ logger20.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock2);
619659
619659
  }
619660
619660
  filter26.blockHash = fromBlockOrBlockhash;
619661
619661
  } else {
619662
619662
  filter26.fromBlock = fromBlockOrBlockhash != null ? fromBlockOrBlockhash : 0;
619663
- filter26.toBlock = toBlock != null ? toBlock : "latest";
619663
+ filter26.toBlock = toBlock2 != null ? toBlock2 : "latest";
619664
619664
  }
619665
619665
  return this.provider.getLogs(filter26).then((logs) => {
619666
619666
  return logs.map((log5) => this._wrapEvent(runningEvent, log5, null));
@@ -630509,7 +630509,7 @@ async function fetchWithRetries2(params, retries = DEFAULT_RETRIES_API2) {
630509
630509
  throw e38;
630510
630510
  }
630511
630511
  }
630512
- var getLastCoinOperations = async (currency24, address4, accountId2, fromBlock, toBlock) => {
630512
+ var getLastCoinOperations = async (currency24, address4, accountId2, fromBlock, toBlock2) => {
630513
630513
  const config4 = getCoinConfig(currency24).info;
630514
630514
  const { explorer } = config4 || /* istanbul ignore next */
630515
630515
  {};
@@ -630524,12 +630524,12 @@ var getLastCoinOperations = async (currency24, address4, accountId2, fromBlock,
630524
630524
  page: 1,
630525
630525
  sort: "desc",
630526
630526
  startBlock: fromBlock,
630527
- endBlock: toBlock
630527
+ endBlock: toBlock2
630528
630528
  }
630529
630529
  });
630530
630530
  return ops.map((tx) => etherscanOperationToOperations(accountId2, tx)).flat();
630531
630531
  };
630532
- var getLastTokenOperations = async (currency24, address4, accountId2, fromBlock, toBlock) => {
630532
+ var getLastTokenOperations = async (currency24, address4, accountId2, fromBlock, toBlock2) => {
630533
630533
  const config4 = getCoinConfig(currency24).info;
630534
630534
  const { explorer } = config4 || /* istanbul ignore next */
630535
630535
  {};
@@ -630544,7 +630544,7 @@ var getLastTokenOperations = async (currency24, address4, accountId2, fromBlock,
630544
630544
  page: 1,
630545
630545
  sort: "desc",
630546
630546
  startBlock: fromBlock,
630547
- endBlock: toBlock
630547
+ endBlock: toBlock2
630548
630548
  }
630549
630549
  });
630550
630550
  const opsByHash = {};
@@ -630556,7 +630556,7 @@ var getLastTokenOperations = async (currency24, address4, accountId2, fromBlock,
630556
630556
  }
630557
630557
  return Object.values(opsByHash).map((events2) => events2.map((event, index) => etherscanERC20EventToOperations(accountId2, event, index))).flat(2);
630558
630558
  };
630559
- var getLastERC721Operations = async (currency24, address4, accountId2, fromBlock, toBlock) => {
630559
+ var getLastERC721Operations = async (currency24, address4, accountId2, fromBlock, toBlock2) => {
630560
630560
  const config4 = getCoinConfig(currency24).info;
630561
630561
  const { explorer } = config4 || /* istanbul ignore next */
630562
630562
  {};
@@ -630571,7 +630571,7 @@ var getLastERC721Operations = async (currency24, address4, accountId2, fromBlock
630571
630571
  page: 1,
630572
630572
  sort: "desc",
630573
630573
  startBlock: fromBlock,
630574
- endBlock: toBlock
630574
+ endBlock: toBlock2
630575
630575
  }
630576
630576
  });
630577
630577
  const opsByHash = {};
@@ -630583,7 +630583,7 @@ var getLastERC721Operations = async (currency24, address4, accountId2, fromBlock
630583
630583
  }
630584
630584
  return Object.values(opsByHash).map((events2) => events2.map((event, index) => etherscanERC721EventToOperations(accountId2, event, index))).flat(2);
630585
630585
  };
630586
- var getLastERC1155Operations = async (currency24, address4, accountId2, fromBlock, toBlock) => {
630586
+ var getLastERC1155Operations = async (currency24, address4, accountId2, fromBlock, toBlock2) => {
630587
630587
  const config4 = getCoinConfig(currency24).info;
630588
630588
  const { explorer } = config4 || /* istanbul ignore next */
630589
630589
  {};
@@ -630601,7 +630601,7 @@ var getLastERC1155Operations = async (currency24, address4, accountId2, fromBloc
630601
630601
  page: 1,
630602
630602
  sort: "desc",
630603
630603
  startBlock: fromBlock,
630604
- endBlock: toBlock
630604
+ endBlock: toBlock2
630605
630605
  }
630606
630606
  });
630607
630607
  const opsByHash = {};
@@ -630613,15 +630613,15 @@ var getLastERC1155Operations = async (currency24, address4, accountId2, fromBloc
630613
630613
  }
630614
630614
  return Object.values(opsByHash).map((events2) => events2.map((event, index) => etherscanERC1155EventToOperations(accountId2, event, index))).flat(2);
630615
630615
  };
630616
- var getLastNftOperations = async (currency24, address4, accountId2, fromBlock, toBlock) => {
630617
- const erc721Ops = await getLastERC721Operations(currency24, address4, accountId2, fromBlock, toBlock);
630618
- const erc1155Ops = await getLastERC1155Operations(currency24, address4, accountId2, fromBlock, toBlock);
630616
+ var getLastNftOperations = async (currency24, address4, accountId2, fromBlock, toBlock2) => {
630617
+ const erc721Ops = await getLastERC721Operations(currency24, address4, accountId2, fromBlock, toBlock2);
630618
+ const erc1155Ops = await getLastERC1155Operations(currency24, address4, accountId2, fromBlock, toBlock2);
630619
630619
  return [...erc721Ops, ...erc1155Ops].sort(
630620
630620
  // sorting DESC order
630621
630621
  (a62, b19) => b19.date.getTime() - a62.date.getTime()
630622
630622
  );
630623
630623
  };
630624
- var getLastInternalOperations = async (currency24, address4, accountId2, fromBlock, toBlock) => {
630624
+ var getLastInternalOperations = async (currency24, address4, accountId2, fromBlock, toBlock2) => {
630625
630625
  const config4 = getCoinConfig(currency24).info;
630626
630626
  const { explorer } = config4 || /* istanbul ignore next */
630627
630627
  {};
@@ -630636,7 +630636,7 @@ var getLastInternalOperations = async (currency24, address4, accountId2, fromBlo
630636
630636
  page: 1,
630637
630637
  sort: "desc",
630638
630638
  startBlock: fromBlock,
630639
- endBlock: toBlock
630639
+ endBlock: toBlock2
630640
630640
  }
630641
630641
  });
630642
630642
  const opsByHash = {};
@@ -630648,12 +630648,12 @@ var getLastInternalOperations = async (currency24, address4, accountId2, fromBlo
630648
630648
  }
630649
630649
  return Object.values(opsByHash).map((internalTxs) => internalTxs.map((internalTx, index) => etherscanInternalTransactionToOperations(accountId2, internalTx, index))).flat(2);
630650
630650
  };
630651
- var getLastOperations = makeLRUCache(async (currency24, address4, accountId2, fromBlock, toBlock) => {
630651
+ var getLastOperations = makeLRUCache(async (currency24, address4, accountId2, fromBlock, toBlock2) => {
630652
630652
  try {
630653
- const lastCoinOperations = await getLastCoinOperations(currency24, address4, accountId2, fromBlock, toBlock);
630654
- const lastInternalOperations = await getLastInternalOperations(currency24, address4, accountId2, fromBlock, toBlock);
630655
- const lastTokenOperations = await getLastTokenOperations(currency24, address4, accountId2, fromBlock, toBlock);
630656
- const lastNftOperations = isNFTActive(currency24) ? await getLastNftOperations(currency24, address4, accountId2, fromBlock, toBlock) : [];
630653
+ const lastCoinOperations = await getLastCoinOperations(currency24, address4, accountId2, fromBlock, toBlock2);
630654
+ const lastInternalOperations = await getLastInternalOperations(currency24, address4, accountId2, fromBlock, toBlock2);
630655
+ const lastTokenOperations = await getLastTokenOperations(currency24, address4, accountId2, fromBlock, toBlock2);
630656
+ const lastNftOperations = isNFTActive(currency24) ? await getLastNftOperations(currency24, address4, accountId2, fromBlock, toBlock2) : [];
630657
630657
  return {
630658
630658
  lastCoinOperations,
630659
630659
  lastTokenOperations,
@@ -630664,7 +630664,7 @@ var getLastOperations = makeLRUCache(async (currency24, address4, accountId2, fr
630664
630664
  log2("EVM getLastOperations", "Error while fetching data from Etherscan like API", err);
630665
630665
  throw new InvalidExplorerResponse("", { currencyName: currency24.name });
630666
630666
  }
630667
- }, (currency24, address4, accountId2, fromBlock, toBlock) => accountId2 + fromBlock + toBlock, { ttl: ETHERSCAN_TIMEOUT });
630667
+ }, (currency24, address4, accountId2, fromBlock, toBlock2) => accountId2 + fromBlock + toBlock2, { ttl: ETHERSCAN_TIMEOUT });
630668
630668
  var explorerApi = {
630669
630669
  getLastOperations
630670
630670
  };
@@ -657526,17 +657526,17 @@ var BaseContract2 = class _BaseContract {
657526
657526
  * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``)
657527
657527
  * inclusive.
657528
657528
  */
657529
- async queryFilter(event, fromBlock, toBlock) {
657529
+ async queryFilter(event, fromBlock, toBlock2) {
657530
657530
  if (fromBlock == null) {
657531
657531
  fromBlock = 0;
657532
657532
  }
657533
- if (toBlock == null) {
657534
- toBlock = "latest";
657533
+ if (toBlock2 == null) {
657534
+ toBlock2 = "latest";
657535
657535
  }
657536
657536
  const { addr, addrPromise } = getInternal(this);
657537
657537
  const address4 = addr ? addr : await addrPromise;
657538
657538
  const { fragment, topics } = await getSubInfo(this, event);
657539
- const filter26 = { address: address4, topics, fromBlock, toBlock };
657539
+ const filter26 = { address: address4, topics, fromBlock, toBlock: toBlock2 };
657540
657540
  const provider = getProvider(this.runner);
657541
657541
  assert3(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" });
657542
657542
  return (await provider.getLogs(filter26)).map((log5) => {
@@ -659575,7 +659575,7 @@ var AbstractProvider = class {
659575
659575
  return t59.toLowerCase();
659576
659576
  });
659577
659577
  const blockHash = "blockHash" in filter26 ? filter26.blockHash : void 0;
659578
- const resolve = (_address, fromBlock2, toBlock2) => {
659578
+ const resolve = (_address, fromBlock2, toBlock3) => {
659579
659579
  let address5 = void 0;
659580
659580
  switch (_address.length) {
659581
659581
  case 0:
@@ -659588,7 +659588,7 @@ var AbstractProvider = class {
659588
659588
  address5 = _address;
659589
659589
  }
659590
659590
  if (blockHash) {
659591
- if (fromBlock2 != null || toBlock2 != null) {
659591
+ if (fromBlock2 != null || toBlock3 != null) {
659592
659592
  throw new Error("invalid filter");
659593
659593
  }
659594
659594
  }
@@ -659602,8 +659602,8 @@ var AbstractProvider = class {
659602
659602
  if (fromBlock2) {
659603
659603
  filter27.fromBlock = fromBlock2;
659604
659604
  }
659605
- if (toBlock2) {
659606
- filter27.toBlock = toBlock2;
659605
+ if (toBlock3) {
659606
+ filter27.toBlock = toBlock3;
659607
659607
  }
659608
659608
  if (blockHash) {
659609
659609
  filter27.blockHash = blockHash;
@@ -659624,16 +659624,16 @@ var AbstractProvider = class {
659624
659624
  if ("fromBlock" in filter26) {
659625
659625
  fromBlock = this._getBlockTag(filter26.fromBlock);
659626
659626
  }
659627
- let toBlock = void 0;
659627
+ let toBlock2 = void 0;
659628
659628
  if ("toBlock" in filter26) {
659629
- toBlock = this._getBlockTag(filter26.toBlock);
659629
+ toBlock2 = this._getBlockTag(filter26.toBlock);
659630
659630
  }
659631
- if (address4.filter((a62) => typeof a62 !== "string").length || fromBlock != null && typeof fromBlock !== "string" || toBlock != null && typeof toBlock !== "string") {
659632
- return Promise.all([Promise.all(address4), fromBlock, toBlock]).then((result2) => {
659631
+ if (address4.filter((a62) => typeof a62 !== "string").length || fromBlock != null && typeof fromBlock !== "string" || toBlock2 != null && typeof toBlock2 !== "string") {
659632
+ return Promise.all([Promise.all(address4), fromBlock, toBlock2]).then((result2) => {
659633
659633
  return resolve(result2[0], result2[1], result2[2]);
659634
659634
  });
659635
659635
  }
659636
- return resolve(address4, fromBlock, toBlock);
659636
+ return resolve(address4, fromBlock, toBlock2);
659637
659637
  }
659638
659638
  /**
659639
659639
  * Returns or resolves to a transaction for %%request%%, resolving
@@ -810919,11 +810919,18 @@ async function fetchTronAccount(addr) {
810919
810919
  }
810920
810920
  async function getLastBlock4() {
810921
810921
  const data6 = await fetch14(`/wallet/getnowblock`);
810922
- return {
810922
+ return toBlock(data6);
810923
+ }
810924
+ function toBlock(data6) {
810925
+ const timestamp = data6.block_header.raw_data.timestamp;
810926
+ const ret2 = {
810923
810927
  height: data6.block_header.raw_data.number,
810924
- hash: data6.blockID,
810925
- time: new Date(data6.block_header.raw_data.timestamp)
810928
+ hash: data6.blockID
810926
810929
  };
810930
+ if (timestamp) {
810931
+ ret2.time = new Date(timestamp);
810932
+ }
810933
+ return ret2;
810927
810934
  }
810928
810935
  async function fetchTronTxDetail(txId) {
810929
810936
  const { fee, blockNumber, withdraw_amount, unfreeze_amount } = await fetch14(`/wallet/gettransactioninfobyid?value=${encodeURIComponent(txId)}`);
@@ -810968,8 +810975,13 @@ var getTrc20 = async (url4) => {
810968
810975
  nextUrl: transactions3.meta.links?.next?.replace(/https:\/\/api(\.[a-z]*)?.trongrid.io/, getBaseApiUrl2())
810969
810976
  };
810970
810977
  };
810971
- async function fetchTronAccountTxs(addr, shouldFetchMoreTxs, cacheTransactionInfoById) {
810972
- const entireTxs = (await getAllTransactions(`${getBaseApiUrl2()}/v1/accounts/${addr}/transactions?limit=100`, shouldFetchMoreTxs, getTransactions4(cacheTransactionInfoById))).filter((tx) => isTransactionTronAPI(tx)).filter((tx) => {
810978
+ var defaultFetchParams = {
810979
+ limit: 100,
810980
+ minTimestamp: 0
810981
+ };
810982
+ async function fetchTronAccountTxs(addr, shouldFetchMoreTxs, cacheTransactionInfoById, params) {
810983
+ const queryParamsNativeTxs = `limit=${params.limit}&min_timestamp=${params.minTimestamp}`;
810984
+ const nativeTxs = (await getAllTransactions(`${getBaseApiUrl2()}/v1/accounts/${addr}/transactions?${queryParamsNativeTxs}`, shouldFetchMoreTxs, getTransactions4(cacheTransactionInfoById))).filter(isTransactionTronAPI).filter((tx) => {
810973
810985
  const hasInternalTxs = tx.txID && tx.internal_transactions && tx.internal_transactions.length > 0;
810974
810986
  const isDuplicated = tx.tx_id;
810975
810987
  const type5 = tx.raw_data.contract[0].type;
@@ -810978,8 +810990,9 @@ async function fetchTronAccountTxs(addr, shouldFetchMoreTxs, cacheTransactionInf
810978
810990
  }
810979
810991
  return !isDuplicated && !hasInternalTxs && type5 !== "TriggerSmartContract";
810980
810992
  }).map((tx) => formatTrongridTxResponse(tx));
810981
- const entireTrc20Txs = (await getAllTransactions(`${getBaseApiUrl2()}/v1/accounts/${addr}/transactions/trc20?get_detail=true`, shouldFetchMoreTxs, getTrc20)).map((tx) => formatTrongridTrc20TxResponse(tx));
810982
- const txInfos = (0, import_compact5.default)(entireTxs.concat(entireTrc20Txs)).sort((a62, b19) => b19.date.getTime() - a62.date.getTime());
810993
+ const queryParamsTrc20Txs = `limit=${params.limit}&min_timestamp=${params.minTimestamp}`;
810994
+ const trc20Txs = (await getAllTransactions(`${getBaseApiUrl2()}/v1/accounts/${addr}/transactions/trc20?${queryParamsTrc20Txs}&get_detail=true`, shouldFetchMoreTxs, getTrc20)).map((tx) => formatTrongridTrc20TxResponse(tx));
810995
+ const txInfos = (0, import_compact5.default)(nativeTxs.concat(trc20Txs)).sort((a62, b19) => b19.date.getTime() - a62.date.getTime());
810983
810996
  return txInfos;
810984
810997
  }
810985
810998
  var getContractUserEnergyRatioConsumption = async (address4) => {
@@ -812270,7 +812283,7 @@ var getAccountShape18 = async ({ initialAccount, currency: currency24, address:
812270
812283
  ...initialAccount?.tronResources?.cacheTransactionInfoById || {}
812271
812284
  } : {};
812272
812285
  const operationsPageSize = Math.min(1e3, getOperationsPageSize(initialAccount && initialAccount.id, syncConfig));
812273
- const txs = await fetchTronAccountTxs(address4, (txs2) => txs2.length < operationsPageSize, cacheTransactionInfoById);
812286
+ const txs = await fetchTronAccountTxs(address4, (txs2) => txs2.length < operationsPageSize, cacheTransactionInfoById, defaultFetchParams);
812274
812287
  const tronResources = await getTronResources2(acc, txs, cacheTransactionInfoById);
812275
812288
  const spendableBalance = acc.balance ? new import_bignumber286.default(acc.balance) : new import_bignumber286.default(0);
812276
812289
  const balance = computeBalanceBridge(acc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.18.0-nightly.3",
3
+ "version": "24.18.0-nightly.4",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",
@@ -55,8 +55,8 @@
55
55
  "@types/ws": "8.5.10",
56
56
  "ts-node": "10.9.2",
57
57
  "tsup": "7.3.0",
58
- "@ledgerhq/types-live": "^6.69.0-nightly.1",
59
- "@ledgerhq/types-cryptoassets": "^7.23.0-nightly.0"
58
+ "@ledgerhq/types-cryptoassets": "^7.23.0-nightly.0",
59
+ "@ledgerhq/types-live": "^6.69.0-nightly.2"
60
60
  },
61
61
  "publishConfig": {
62
62
  "directory": "dist"