@ledgerhq/live-cli 24.28.0-nightly.20251120135143 → 24.28.0-nightly.20251121023744

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 +97 -67
  2. package/package.json +2 -2
package/lib/cli.js CHANGED
@@ -520455,7 +520455,7 @@ var require_package7 = __commonJS({
520455
520455
  module2.exports = {
520456
520456
  name: "@ledgerhq/live-common",
520457
520457
  description: "Common ground for the Ledger Live apps",
520458
- version: "34.53.0-nightly.20251120135143",
520458
+ version: "34.53.0-nightly.20251121023744",
520459
520459
  repository: {
520460
520460
  type: "git",
520461
520461
  url: "https://github.com/LedgerHQ/ledger-live.git"
@@ -520808,7 +520808,7 @@ var require_package8 = __commonJS({
520808
520808
  "package.json"(exports2, module2) {
520809
520809
  module2.exports = {
520810
520810
  name: "@ledgerhq/live-cli",
520811
- version: "24.28.0-nightly.20251120135143",
520811
+ version: "24.28.0-nightly.20251121023744",
520812
520812
  description: "ledger-live CLI version",
520813
520813
  repository: {
520814
520814
  type: "git",
@@ -592807,6 +592807,55 @@ var handleDeviceErrors = (error) => {
592807
592807
  return null;
592808
592808
  };
592809
592809
 
592810
+ // ../../libs/coin-modules/coin-canton/lib-es/bridge/serialization.js
592811
+ function isCantonAccount(account3) {
592812
+ return "cantonResources" in account3;
592813
+ }
592814
+ function isCantonAccountRaw(accountRaw) {
592815
+ return "cantonResources" in accountRaw;
592816
+ }
592817
+ function toResourcesRaw2(r49) {
592818
+ const { instrumentUtxoCounts, pendingTransferProposals } = r49;
592819
+ return {
592820
+ instrumentUtxoCounts,
592821
+ pendingTransferProposals
592822
+ };
592823
+ }
592824
+ function fromResourcesRaw2(r49) {
592825
+ return {
592826
+ instrumentUtxoCounts: r49.instrumentUtxoCounts,
592827
+ pendingTransferProposals: r49.pendingTransferProposals
592828
+ };
592829
+ }
592830
+ function assignToAccountRaw5(account3, accountRaw) {
592831
+ if (isCantonAccount(account3) && isCantonAccountRaw(accountRaw)) {
592832
+ if (account3.cantonResources) {
592833
+ accountRaw.cantonResources = toResourcesRaw2(account3.cantonResources);
592834
+ }
592835
+ }
592836
+ }
592837
+ function assignFromAccountRaw5(accountRaw, account3) {
592838
+ if (isCantonAccountRaw(accountRaw) && isCantonAccount(account3)) {
592839
+ if (accountRaw.cantonResources) {
592840
+ account3.cantonResources = fromResourcesRaw2(accountRaw.cantonResources);
592841
+ }
592842
+ }
592843
+ }
592844
+
592845
+ // ../../libs/coin-modules/coin-canton/lib-es/helpers.js
592846
+ function isCantonAccountEmpty(account3) {
592847
+ return account3.operationsCount === 0 && account3.balance.isZero() && !account3.subAccounts?.length && !account3.cantonResources?.pendingTransferProposals?.length;
592848
+ }
592849
+ function isAccountEmpty2(account3) {
592850
+ if (account3.type !== "Account") {
592851
+ return false;
592852
+ }
592853
+ if (!isCantonAccount(account3)) {
592854
+ return false;
592855
+ }
592856
+ return isCantonAccountEmpty(account3);
592857
+ }
592858
+
592810
592859
  // ../../libs/coin-modules/coin-canton/lib-es/bridge/sync.js
592811
592860
  var txInfoToOperationAdapter = (accountId2, partyId) => (txInfo) => {
592812
592861
  const { transaction_hash, uid, block: { height, hash: hash10 }, senders, recipients, transaction_timestamp, fee: { value: fee }, transfers: [{ value: transferValue, details }] } = txInfo;
@@ -592900,8 +592949,15 @@ function makeGetAccountShape3(signerContext4) {
592900
592949
  const newOperations = filterOperations(transactionData.operations, accountId2, xpubOrAddress);
592901
592950
  operations4 = mergeOps(oldOperations, newOperations);
592902
592951
  }
592903
- const isPreapproved = xpubOrAddress ? await isCantonCoinPreapproved(currency24, xpubOrAddress) : false;
592904
- const used = isPreapproved && totalBalance.gt(0);
592952
+ const used = !isCantonAccountEmpty({
592953
+ operationsCount: operations4.length,
592954
+ balance: totalBalance,
592955
+ subAccounts: initialAccount?.subAccounts ?? [],
592956
+ cantonResources: {
592957
+ instrumentUtxoCounts,
592958
+ pendingTransferProposals
592959
+ }
592960
+ });
592905
592961
  const blockHeight = await getLedgerEnd(currency24);
592906
592962
  const creationDate = operations4.length > 0 ? new Date(Math.min(...operations4.map((op) => op.date.getTime()))) : /* @__PURE__ */ new Date();
592907
592963
  const shape = {
@@ -592940,41 +592996,6 @@ var buildTransferInstruction = (signerContext4) => async (currency24, deviceId,
592940
592996
  await submitTransferInstruction(currency24, partyId, preparedTransaction.serialized, signature5);
592941
592997
  };
592942
592998
 
592943
- // ../../libs/coin-modules/coin-canton/lib-es/bridge/serialization.js
592944
- function isCantonAccount(account3) {
592945
- return "cantonResources" in account3;
592946
- }
592947
- function isCantonAccountRaw(accountRaw) {
592948
- return "cantonResources" in accountRaw;
592949
- }
592950
- function toResourcesRaw2(r49) {
592951
- const { instrumentUtxoCounts, pendingTransferProposals } = r49;
592952
- return {
592953
- instrumentUtxoCounts,
592954
- pendingTransferProposals
592955
- };
592956
- }
592957
- function fromResourcesRaw2(r49) {
592958
- return {
592959
- instrumentUtxoCounts: r49.instrumentUtxoCounts,
592960
- pendingTransferProposals: r49.pendingTransferProposals
592961
- };
592962
- }
592963
- function assignToAccountRaw5(account3, accountRaw) {
592964
- if (isCantonAccount(account3) && isCantonAccountRaw(accountRaw)) {
592965
- if (account3.cantonResources) {
592966
- accountRaw.cantonResources = toResourcesRaw2(account3.cantonResources);
592967
- }
592968
- }
592969
- }
592970
- function assignFromAccountRaw5(accountRaw, account3) {
592971
- if (isCantonAccountRaw(accountRaw) && isCantonAccount(account3)) {
592972
- if (accountRaw.cantonResources) {
592973
- account3.cantonResources = fromResourcesRaw2(accountRaw.cantonResources);
592974
- }
592975
- }
592976
- }
592977
-
592978
592999
  // ../../libs/coin-modules/coin-canton/lib-es/bridge/index.js
592979
593000
  function createBridges6(signerContext4, coinConfig19) {
592980
593001
  config_default3.setCoinConfig(coinConfig19);
@@ -627066,7 +627087,7 @@ var getMainMessage = (messages) => {
627066
627087
  const sortedTypes = messages.filter((m111) => messagePriorities.includes(m111.type)).sort((a107, b23) => messagePriorities.indexOf(a107.type) - messagePriorities.indexOf(b23.type));
627067
627088
  return sortedTypes[0];
627068
627089
  };
627069
- function isAccountEmpty2({ cosmosResources, balance: balance2 }) {
627090
+ function isAccountEmpty3({ cosmosResources, balance: balance2 }) {
627070
627091
  return cosmosResources.sequence === 0 && balance2.isZero();
627071
627092
  }
627072
627093
 
@@ -627119,7 +627140,7 @@ var getAccountShape6 = async (info6) => {
627119
627140
  operationsCount: operations4.length,
627120
627141
  blockHeight,
627121
627142
  cosmosResources,
627122
- used: !isAccountEmpty2({ balance: balance2, cosmosResources })
627143
+ used: !isAccountEmpty3({ balance: balance2, cosmosResources })
627123
627144
  };
627124
627145
  if (shape.spendableBalance && shape.spendableBalance.lt(0)) {
627125
627146
  shape.spendableBalance = new import_bignumber158.BigNumber(0);
@@ -628393,7 +628414,6 @@ function toOperation(asset, op) {
628393
628414
  },
628394
628415
  details: {
628395
628416
  sequence: op.transactionSequenceNumber,
628396
- status: op.hasFailed ? "failed" : "success",
628397
628417
  ...asset.type === "token" ? {
628398
628418
  ledgerOpType: op.type,
628399
628419
  assetAmount: op.value.toFixed(0),
@@ -780764,7 +780784,7 @@ async function getTronResources2(acc, txs, cacheTransactionInfoById = {}) {
780764
780784
  cacheTransactionInfoById
780765
780785
  };
780766
780786
  }
780767
- function isAccountEmpty3({ tronResources }) {
780787
+ function isAccountEmpty4({ tronResources }) {
780768
780788
  return tronResources.bandwidth.freeLimit.eq(0);
780769
780789
  }
780770
780790
 
@@ -781693,7 +781713,7 @@ var getAccountShape17 = async ({ initialAccount, currency: currency24, address:
781693
781713
  subAccounts: mergedSubAccounts,
781694
781714
  tronResources,
781695
781715
  blockHeight,
781696
- used: !isAccountEmpty3({ tronResources })
781716
+ used: !isAccountEmpty4({ tronResources })
781697
781717
  };
781698
781718
  };
781699
781719
  var postSync5 = (initial, parent) => {
@@ -789466,7 +789486,7 @@ var estimateGas = async (clauses, origin3) => {
789466
789486
  };
789467
789487
 
789468
789488
  // ../../libs/coin-modules/coin-vechain/lib-es/common-logic/calculateGasFees.js
789469
- var calculateGasFees = async (transaction, isTokenAccount2) => {
789489
+ var calculateGasFees = async (transaction, isTokenAccount2, originAddress) => {
789470
789490
  if (transaction.recipient && parseAddress(transaction.recipient)) {
789471
789491
  let clauses;
789472
789492
  if (isTokenAccount2) {
@@ -789474,7 +789494,7 @@ var calculateGasFees = async (transaction, isTokenAccount2) => {
789474
789494
  } else {
789475
789495
  clauses = await calculateClausesVet(transaction.recipient, transaction.amount);
789476
789496
  }
789477
- const gasEstimation = await estimateGas(clauses, transaction.recipient);
789497
+ const gasEstimation = await estimateGas(clauses, originAddress);
789478
789498
  const thorClient = getThorClient();
789479
789499
  const body = await thorClient.transactions.buildTransactionBody(clauses, gasEstimation.totalGas, {});
789480
789500
  return {
@@ -789493,12 +789513,13 @@ var calculateGasFees = async (transaction, isTokenAccount2) => {
789493
789513
  };
789494
789514
 
789495
789515
  // ../../libs/coin-modules/coin-vechain/lib-es/common-logic/calculateTransactionInfo.js
789516
+ var getTokenAccount2 = (subAccountId, subAccounts) => subAccountId && subAccounts ? subAccounts.find((subAccount) => {
789517
+ return subAccount.id === subAccountId;
789518
+ }) : void 0;
789496
789519
  var calculateTransactionInfo = async (account3, transaction, fixedMaxTokenFees) => {
789497
789520
  const { subAccounts } = account3;
789498
789521
  const { amount: oldAmount, subAccountId, useAllAmount } = transaction;
789499
- const tokenAccount = subAccountId && subAccounts ? subAccounts.find((subAccount) => {
789500
- return subAccount.id === subAccountId;
789501
- }) : void 0;
789522
+ const tokenAccount = getTokenAccount2(subAccountId, subAccounts);
789502
789523
  const isTokenAccount2 = !!tokenAccount;
789503
789524
  let amount = oldAmount;
789504
789525
  let amountBackup;
@@ -789514,7 +789535,7 @@ var calculateTransactionInfo = async (account3, transaction, fixedMaxTokenFees)
789514
789535
  let iterations = 0;
789515
789536
  do {
789516
789537
  amountBackup = amount;
789517
- const estimatedGasAndFees = fixedMaxTokenFees || await calculateGasFees(tempTransaction, isTokenAccount2);
789538
+ const estimatedGasAndFees = fixedMaxTokenFees || await calculateGasFees(tempTransaction, isTokenAccount2, account3.freshAddress);
789518
789539
  maxEstimatedGasFees = estimatedGasAndFees.estimatedGasFees;
789519
789540
  maxEstimatedGas = estimatedGasAndFees.estimatedGas;
789520
789541
  maxFeePerGas = estimatedGasAndFees.maxFeePerGas;
@@ -789611,14 +789632,22 @@ var getTransactionStatus22 = async (account3, transaction) => {
789611
789632
 
789612
789633
  // ../../libs/coin-modules/coin-vechain/lib-es/bridge/estimateMaxSpendable.js
789613
789634
  var import_bignumber303 = __toESM(require("bignumber.js"));
789614
- var estimateMaxSpendable22 = async ({ account: account3, transaction }) => {
789635
+ var PATTERN_ADDRESS_IN_TOKEN_ACCOUNT_ID = /:(0x\w+):/;
789636
+ var getAddressFromTokenAccountId = (tokenAccountId) => PATTERN_ADDRESS_IN_TOKEN_ACCOUNT_ID.exec(tokenAccountId)?.[1];
789637
+ var estimateMaxSpendable22 = async ({ account: account3, parentAccount, transaction }) => {
789615
789638
  if (account3.type === "Account" || !transaction) {
789616
789639
  return account3.balance;
789617
789640
  }
789618
- const { estimatedGasFees: maxTokenFees } = await calculateGasFees(transaction, true);
789619
- const spendable = account3.balance.minus(maxTokenFees);
789620
- if (spendable.gt(0))
789621
- return account3.balance.minus(maxTokenFees);
789641
+ if (account3.type === "TokenAccount") {
789642
+ const originAddress = parentAccount?.freshAddress || getAddressFromTokenAccountId(account3.id);
789643
+ if (originAddress) {
789644
+ const { estimatedGasFees: maxTokenFees } = await calculateGasFees(transaction, true, originAddress);
789645
+ const spendable = account3.balance.minus(maxTokenFees);
789646
+ if (spendable.gt(0)) {
789647
+ return spendable;
789648
+ }
789649
+ }
789650
+ }
789622
789651
  return new import_bignumber303.default(0);
789623
789652
  };
789624
789653
 
@@ -789680,7 +789709,7 @@ var import_bignumber305 = require("bignumber.js");
789680
789709
  var import_eip558 = __toESM(require_eip55());
789681
789710
 
789682
789711
  // ../../libs/coin-modules/coin-vechain/lib-es/bridge/helpers.js
789683
- function isAccountEmpty4(account3) {
789712
+ function isAccountEmpty5(account3) {
789684
789713
  const checkSubAccounts = account3.subAccounts && !account3.subAccounts[0].balance.isZero();
789685
789714
  return account3.operationsCount === 0 && account3.balance.isZero() && !checkSubAccounts;
789686
789715
  }
@@ -789745,7 +789774,7 @@ var getAccountShape18 = async (info6) => {
789745
789774
  };
789746
789775
  return {
789747
789776
  ...shape,
789748
- used: !isAccountEmpty4(shape)
789777
+ used: !isAccountEmpty5(shape)
789749
789778
  };
789750
789779
  };
789751
789780
 
@@ -809742,8 +809771,7 @@ var convertToCoreOperation2 = (operation) => {
809742
809771
  sequence: operation.transactionSequenceNumber?.toString(),
809743
809772
  ledgerOpType: operation.extra.ledgerOpType,
809744
809773
  assetAmount: operation.extra.assetAmount ? operation.extra.assetAmount : operation.value.toString(),
809745
- memo: operation.extra.memo,
809746
- status: operation.hasFailed ? "failed" : "success"
809774
+ memo: operation.extra.memo
809747
809775
  },
809748
809776
  type: operation.type,
809749
809777
  value: BigInt(operation.value.toString()),
@@ -830059,7 +830087,6 @@ function convertOperation(address3, operation) {
830059
830087
  counter: operation.counter,
830060
830088
  gasLimit: operation.gasLimit,
830061
830089
  storageLimit: operation.storageLimit,
830062
- status: hasFailed ? "failed" : operation.status,
830063
830090
  ledgerOpType: getLedgerOpType(operation, normalizedType)
830064
830091
  }
830065
830092
  };
@@ -830669,7 +830696,7 @@ function adaptCoreOperationToLiveOperation(accountId2, op) {
830669
830696
  extra.memo = op.details.memo;
830670
830697
  }
830671
830698
  const bnFees = new import_bignumber360.default(op.tx.fees.toString());
830672
- const hasFailed = op.details?.status === "failed";
830699
+ const hasFailed = op.tx.failed;
830673
830700
  let value2;
830674
830701
  if (hasFailed) {
830675
830702
  value2 = bnFees;
@@ -831853,16 +831880,19 @@ function formatOperation2(account3) {
831853
831880
  }
831854
831881
 
831855
831882
  // ../../libs/ledger-live-common/lib-es/account/helpers.js
831856
- var isAccountEmpty5 = (a107) => {
831883
+ var isAccountEmpty6 = (a107) => {
831857
831884
  if (a107.type === "Account") {
831858
831885
  if (isCosmosAccount(a107)) {
831859
- return isAccountEmpty2(a107);
831886
+ return isAccountEmpty3(a107);
831860
831887
  }
831861
831888
  if (isTronAccount(a107)) {
831862
- return isAccountEmpty3(a107);
831889
+ return isAccountEmpty4(a107);
831863
831890
  }
831864
831891
  if (a107.currency.family == "vechain") {
831865
- return isAccountEmpty4(a107);
831892
+ return isAccountEmpty5(a107);
831893
+ }
831894
+ if (a107.currency.family == "canton") {
831895
+ return isAccountEmpty2(a107);
831866
831896
  }
831867
831897
  }
831868
831898
  return isAccountEmpty(a107);
@@ -853480,7 +853510,7 @@ Please increase the account target to at least ${spec2.mutations.length + 1} acc
853480
853510
  reportLog(`Spec ${spec2.name} found ${accounts2.length} ${currency24.name} accounts${preloadStats}. Will use ${formatAppCandidate(appCandidate)}
853481
853511
  ${accounts2.map((a107) => formatAccount(a107, "head")).join("\n")}
853482
853512
  `);
853483
- if (accounts2.every(isAccountEmpty5)) {
853513
+ if (accounts2.every(isAccountEmpty6)) {
853484
853514
  reportLog(`This SEED does not have ${currency24.name}. Please send funds to ${accounts2.map((a107) => a107.freshAddress).join(" or ")}
853485
853515
  `);
853486
853516
  appReport.accountsAfter = accounts2;
@@ -854715,7 +854745,7 @@ async function bot({ disabled, filter: filter27 } = {}) {
854715
854745
  console.error(`/!\\ ${errorCases.length} failures out of ${mutationReports.length} mutations. Check above!
854716
854746
  `);
854717
854747
  }
854718
- const specsWithoutFunds = results2.filter((s104) => !s104.fatalError && (s104.accountsBefore && s104.accountsBefore.every(isAccountEmpty5) || s104.mutations && s104.mutations.every((r49) => !r49.mutation)));
854748
+ const specsWithoutFunds = results2.filter((s104) => !s104.fatalError && (s104.accountsBefore && s104.accountsBefore.every(isAccountEmpty6) || s104.mutations && s104.mutations.every((r49) => !r49.mutation)));
854719
854749
  const fullySuccessfulSpecs = results2.filter((s104) => !s104.fatalError && s104.mutations && !specsWithoutFunds.includes(s104) && s104.mutations.every((r49) => !r49.mutation || r49.operation));
854720
854750
  const specsWithErrors = results2.filter((s104) => !s104.fatalError && s104.mutations && !specsWithoutFunds.includes(s104) && s104.mutations.some((r49) => r49.error || r49.mutation && !r49.operation));
854721
854751
  const specsWithoutOperations = results2.filter((s104) => !s104.fatalError && !specsWithoutFunds.includes(s104) && !specsWithErrors.includes(s104) && s104.mutations && s104.mutations.every((r49) => !r49.operation));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.28.0-nightly.20251120135143",
3
+ "version": "24.28.0-nightly.20251121023744",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",
@@ -59,7 +59,7 @@
59
59
  "tsup": "7.3.0",
60
60
  "yaml": "2.8.1",
61
61
  "@ledgerhq/types-cryptoassets": "^7.30.0",
62
- "@ledgerhq/types-live": "^6.89.0-nightly.20251120135143"
62
+ "@ledgerhq/types-live": "^6.89.0-nightly.20251121023744"
63
63
  },
64
64
  "publishConfig": {
65
65
  "directory": "dist"