@ledgerhq/live-cli 24.29.0-nightly.20251127103328 → 24.29.0-nightly.20251127130943

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 +24 -16
  2. package/package.json +2 -2
package/lib/cli.js CHANGED
@@ -543581,7 +543581,7 @@ var require_package8 = __commonJS({
543581
543581
  module2.exports = {
543582
543582
  name: "@ledgerhq/live-common",
543583
543583
  description: "Common ground for the Ledger Live apps",
543584
- version: "34.54.0-nightly.20251127103328",
543584
+ version: "34.54.0-nightly.20251127130943",
543585
543585
  repository: {
543586
543586
  type: "git",
543587
543587
  url: "https://github.com/LedgerHQ/ledger-live.git"
@@ -543934,7 +543934,7 @@ var require_package9 = __commonJS({
543934
543934
  "package.json"(exports2, module2) {
543935
543935
  module2.exports = {
543936
543936
  name: "@ledgerhq/live-cli",
543937
- version: "24.29.0-nightly.20251127103328",
543937
+ version: "24.29.0-nightly.20251127130943",
543938
543938
  description: "ledger-live CLI version",
543939
543939
  repository: {
543940
543940
  type: "git",
@@ -589064,9 +589064,8 @@ var getMaxSendBalance = (account3, parentAccount, gas, gasPrice) => {
589064
589064
  gas = gas ?? (0, import_bignumber58.default)(DEFAULT_GAS);
589065
589065
  gasPrice = gasPrice ?? (0, import_bignumber58.default)(DEFAULT_GAS_PRICE);
589066
589066
  const totalGas = gas.multipliedBy(gasPrice);
589067
- return parentAccount ? getMaxSendBalanceFromTokenAccount(account3, totalGas) : getMaxSendBalanceFromAccount(account3, totalGas);
589067
+ return parentAccount ? account3.spendableBalance : getMaxSendBalanceFromAccount(account3, totalGas);
589068
589068
  };
589069
- var getMaxSendBalanceFromTokenAccount = (tokenAccount, totalGas) => tokenAccount.spendableBalance.gt(totalGas) ? tokenAccount.spendableBalance.minus(totalGas) : new import_bignumber58.default(0);
589070
589069
  var getMaxSendBalanceFromAccount = (account3, totalGas) => account3.spendableBalance.gt(totalGas) ? account3.spendableBalance.minus(totalGas) : new import_bignumber58.default(0);
589071
589070
  var getBlankOperation = (tx, id5) => ({
589072
589071
  id: "",
@@ -602142,7 +602141,6 @@ var AptosAPI = class {
602142
602141
  return {
602143
602142
  value: BigInt(expectedGas.toString()),
602144
602143
  parameters: {
602145
- storageLimit: BigInt(0),
602146
602144
  gasLimit: BigInt(gasLimit.toString()),
602147
602145
  gasPrice: BigInt(gasPrice.toString())
602148
602146
  }
@@ -602385,17 +602383,12 @@ var getFee = async (account3, transaction, aptosClient2) => {
602385
602383
  };
602386
602384
  let gasLimit = DEFAULT_GAS;
602387
602385
  let gasPrice = DEFAULT_GAS_PRICE;
602388
- transaction.options = {
602389
- maxGasAmount: gasLimit.toString(),
602390
- gasUnitPrice: gasPrice.toString()
602391
- };
602392
602386
  if (account3.xpub) {
602393
602387
  try {
602394
602388
  const publicKeyEd = new f5(account3.xpub);
602395
602389
  const tx = await buildTransaction_default(account3, transaction, aptosClient2);
602396
602390
  const [completedTx] = await aptosClient2.simulateTransaction(publicKeyEd, tx);
602397
- const gasMultiplier = STAKING_TX_MODES.includes(transaction.mode) ? ESTIMATE_GAS_MUL_FOR_STAKING : ESTIMATE_GAS_MUL;
602398
- gasLimit = new import_bignumber62.default(completedTx.gas_used).multipliedBy(gasMultiplier).integerValue();
602391
+ gasLimit = new import_bignumber62.default(completedTx.gas_used).multipliedBy(getGasMultiplier(transaction)).integerValue();
602399
602392
  gasPrice = new import_bignumber62.default(completedTx.gas_unit_price);
602400
602393
  const expectedGas = gasPrice.multipliedBy(gasLimit);
602401
602394
  if (!completedTx.success) {
@@ -602408,6 +602401,10 @@ var getFee = async (account3, transaction, aptosClient2) => {
602408
602401
  res.fees = expectedGas;
602409
602402
  res.estimate.maxGasAmount = gasLimit.toString();
602410
602403
  res.estimate.gasUnitPrice = completedTx.gas_unit_price;
602404
+ transaction.options = {
602405
+ maxGasAmount: gasLimit.toString(),
602406
+ gasUnitPrice: completedTx.gas_unit_price
602407
+ };
602411
602408
  } catch (error) {
602412
602409
  log2(error.message);
602413
602410
  throw error;
@@ -602422,6 +602419,9 @@ var CACHE = makeLRUCache(getFee, (account3, transaction) => {
602422
602419
  var getEstimatedGas = async (account3, transaction, aptosClient2) => {
602423
602420
  return await CACHE(account3, transaction, aptosClient2);
602424
602421
  };
602422
+ var getGasMultiplier = (transaction) => {
602423
+ return STAKING_TX_MODES.includes(transaction.mode) ? ESTIMATE_GAS_MUL_FOR_STAKING : ESTIMATE_GAS_MUL;
602424
+ };
602425
602425
 
602426
602426
  // ../../libs/coin-modules/coin-aptos/lib-es/bridge/estimateMaxSpendable.js
602427
602427
  var estimateMaxSpendable2 = async ({ account: account3, parentAccount, transaction }) => {
@@ -602430,7 +602430,8 @@ var estimateMaxSpendable2 = async ({ account: account3, parentAccount, transacti
602430
602430
  let maxGasAmount = new import_bignumber63.BigNumber(DEFAULT_GAS);
602431
602431
  let gasUnitPrice = new import_bignumber63.BigNumber(DEFAULT_GAS_PRICE);
602432
602432
  if (transaction) {
602433
- const { estimate: estimate5 } = await getEstimatedGas(mainAccount, transaction, aptosClient2);
602433
+ const amount = transaction.amount.isZero() ? account3.spendableBalance : transaction.amount;
602434
+ const { estimate: estimate5 } = await getEstimatedGas(mainAccount, { ...transaction, amount }, aptosClient2);
602434
602435
  maxGasAmount = (0, import_bignumber63.BigNumber)(estimate5.maxGasAmount);
602435
602436
  gasUnitPrice = (0, import_bignumber63.BigNumber)(estimate5.gasUnitPrice);
602436
602437
  }
@@ -602470,16 +602471,19 @@ var prepareTransaction2 = async (account3, transaction) => {
602470
602471
  }
602471
602472
  const aptosClient2 = new AptosAPI(account3.currency.id);
602472
602473
  const tokenAccount = findSubAccountById(account3, transaction?.subAccountId ?? "");
602474
+ const { fees: fees2, estimate: estimate5, errors: errors2 } = await getEstimatedGas(account3, transaction, aptosClient2);
602475
+ const gas = (0, import_bignumber64.default)(estimate5.maxGasAmount);
602476
+ const gasPrice = (0, import_bignumber64.default)(estimate5.gasUnitPrice);
602473
602477
  if (transaction.useAllAmount) {
602478
+ const maxAmount = tokenAccount ? getMaxSendBalance(tokenAccount, account3, gas, gasPrice) : getMaxSendBalance(account3, void 0, gas, gasPrice);
602474
602479
  if (transaction.mode === "send") {
602475
- transaction.amount = getMaxSendBalance(tokenAccount || account3, account3);
602480
+ transaction.amount = maxAmount;
602476
602481
  } else if (transaction.mode === "restake" || transaction.mode === "unstake" || transaction.mode === "withdraw") {
602477
602482
  transaction.amount = getDelegationOpMaxAmount(account3, transaction.recipient, transaction.mode);
602478
602483
  } else if (transaction.mode === "stake") {
602479
- transaction.amount = getMaxSendBalance(tokenAccount || account3, account3).minus(APTOS_DELEGATION_RESERVE_IN_OCTAS);
602484
+ transaction.amount = maxAmount.minus(APTOS_DELEGATION_RESERVE_IN_OCTAS);
602480
602485
  }
602481
602486
  }
602482
- const { fees: fees2, estimate: estimate5, errors: errors2 } = await getEstimatedGas(account3, transaction, aptosClient2);
602483
602487
  transaction.fees = fees2;
602484
602488
  transaction.options = estimate5;
602485
602489
  transaction.errors = errors2;
@@ -615776,7 +615780,11 @@ function makeGetAccountShape3(signerContext4) {
615776
615780
  const balances = xpubOrAddress ? await getBalance2(currency24, xpubOrAddress) : [];
615777
615781
  const pendingTransferProposals = xpubOrAddress ? await getPendingTransferProposals(currency24, xpubOrAddress) : [];
615778
615782
  const balancesData = (balances || []).reduce((acc, balance2) => {
615779
- acc[balance2.instrumentId] = balance2;
615783
+ if (balance2.locked) {
615784
+ acc[`Locked${balance2.instrumentId}`] = balance2;
615785
+ } else {
615786
+ acc[balance2.instrumentId] = balance2;
615787
+ }
615780
615788
  return acc;
615781
615789
  }, {});
615782
615790
  const unlockedAmount = new import_bignumber118.default(balancesData[nativeInstrumentId]?.value.toString() || "0");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.29.0-nightly.20251127103328",
3
+ "version": "24.29.0-nightly.20251127130943",
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.90.0-nightly.20251127103328"
62
+ "@ledgerhq/types-live": "^6.90.0-nightly.20251127130943"
63
63
  },
64
64
  "publishConfig": {
65
65
  "directory": "dist"