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

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 +46 -21
  2. package/package.json +2 -2
package/lib/cli.js CHANGED
@@ -536952,15 +536952,19 @@ var require_picomatch2 = __commonJS({
536952
536952
  }
536953
536953
  });
536954
536954
 
536955
- // ../../node_modules/.pnpm/micromatch@4.0.7/node_modules/micromatch/index.js
536955
+ // ../../node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js
536956
536956
  var require_micromatch = __commonJS({
536957
- "../../node_modules/.pnpm/micromatch@4.0.7/node_modules/micromatch/index.js"(exports2, module2) {
536957
+ "../../node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js"(exports2, module2) {
536958
536958
  "use strict";
536959
536959
  var util10 = require("util");
536960
536960
  var braces = require_braces();
536961
536961
  var picomatch = require_picomatch2();
536962
536962
  var utils6 = require_utils50();
536963
- var isEmptyString = (val) => val === "" || val === "./";
536963
+ var isEmptyString = (v64) => v64 === "" || v64 === "./";
536964
+ var hasBraces = (v64) => {
536965
+ const index = v64.indexOf("{");
536966
+ return index > -1 && v64.indexOf("}", index) > -1;
536967
+ };
536964
536968
  var micromatch = (list2, patterns, options24) => {
536965
536969
  patterns = [].concat(patterns);
536966
536970
  list2 = [].concat(list2);
@@ -537100,7 +537104,7 @@ var require_micromatch = __commonJS({
537100
537104
  micromatch.braces = (pattern, options24) => {
537101
537105
  if (typeof pattern !== "string")
537102
537106
  throw new TypeError("Expected a string");
537103
- if (options24 && options24.nobrace === true || !/\{.*\}/.test(pattern)) {
537107
+ if (options24 && options24.nobrace === true || !hasBraces(pattern)) {
537104
537108
  return [pattern];
537105
537109
  }
537106
537110
  return braces(pattern, options24);
@@ -537110,6 +537114,7 @@ var require_micromatch = __commonJS({
537110
537114
  throw new TypeError("Expected a string");
537111
537115
  return micromatch.braces(pattern, { ...options24, expand: true });
537112
537116
  };
537117
+ micromatch.hasBraces = hasBraces;
537113
537118
  module2.exports = micromatch;
537114
537119
  }
537115
537120
  });
@@ -543581,7 +543586,7 @@ var require_package8 = __commonJS({
543581
543586
  module2.exports = {
543582
543587
  name: "@ledgerhq/live-common",
543583
543588
  description: "Common ground for the Ledger Live apps",
543584
- version: "34.54.0-nightly.20251127103328",
543589
+ version: "34.54.0-nightly.20251128023740",
543585
543590
  repository: {
543586
543591
  type: "git",
543587
543592
  url: "https://github.com/LedgerHQ/ledger-live.git"
@@ -543934,7 +543939,7 @@ var require_package9 = __commonJS({
543934
543939
  "package.json"(exports2, module2) {
543935
543940
  module2.exports = {
543936
543941
  name: "@ledgerhq/live-cli",
543937
- version: "24.29.0-nightly.20251127103328",
543942
+ version: "24.29.0-nightly.20251128023740",
543938
543943
  description: "ledger-live CLI version",
543939
543944
  repository: {
543940
543945
  type: "git",
@@ -589064,9 +589069,8 @@ var getMaxSendBalance = (account3, parentAccount, gas, gasPrice) => {
589064
589069
  gas = gas ?? (0, import_bignumber58.default)(DEFAULT_GAS);
589065
589070
  gasPrice = gasPrice ?? (0, import_bignumber58.default)(DEFAULT_GAS_PRICE);
589066
589071
  const totalGas = gas.multipliedBy(gasPrice);
589067
- return parentAccount ? getMaxSendBalanceFromTokenAccount(account3, totalGas) : getMaxSendBalanceFromAccount(account3, totalGas);
589072
+ return parentAccount ? account3.spendableBalance : getMaxSendBalanceFromAccount(account3, totalGas);
589068
589073
  };
589069
- var getMaxSendBalanceFromTokenAccount = (tokenAccount, totalGas) => tokenAccount.spendableBalance.gt(totalGas) ? tokenAccount.spendableBalance.minus(totalGas) : new import_bignumber58.default(0);
589070
589074
  var getMaxSendBalanceFromAccount = (account3, totalGas) => account3.spendableBalance.gt(totalGas) ? account3.spendableBalance.minus(totalGas) : new import_bignumber58.default(0);
589071
589075
  var getBlankOperation = (tx, id5) => ({
589072
589076
  id: "",
@@ -602142,7 +602146,6 @@ var AptosAPI = class {
602142
602146
  return {
602143
602147
  value: BigInt(expectedGas.toString()),
602144
602148
  parameters: {
602145
- storageLimit: BigInt(0),
602146
602149
  gasLimit: BigInt(gasLimit.toString()),
602147
602150
  gasPrice: BigInt(gasPrice.toString())
602148
602151
  }
@@ -602385,17 +602388,12 @@ var getFee = async (account3, transaction, aptosClient2) => {
602385
602388
  };
602386
602389
  let gasLimit = DEFAULT_GAS;
602387
602390
  let gasPrice = DEFAULT_GAS_PRICE;
602388
- transaction.options = {
602389
- maxGasAmount: gasLimit.toString(),
602390
- gasUnitPrice: gasPrice.toString()
602391
- };
602392
602391
  if (account3.xpub) {
602393
602392
  try {
602394
602393
  const publicKeyEd = new f5(account3.xpub);
602395
602394
  const tx = await buildTransaction_default(account3, transaction, aptosClient2);
602396
602395
  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();
602396
+ gasLimit = new import_bignumber62.default(completedTx.gas_used).multipliedBy(getGasMultiplier(transaction)).integerValue();
602399
602397
  gasPrice = new import_bignumber62.default(completedTx.gas_unit_price);
602400
602398
  const expectedGas = gasPrice.multipliedBy(gasLimit);
602401
602399
  if (!completedTx.success) {
@@ -602408,6 +602406,10 @@ var getFee = async (account3, transaction, aptosClient2) => {
602408
602406
  res.fees = expectedGas;
602409
602407
  res.estimate.maxGasAmount = gasLimit.toString();
602410
602408
  res.estimate.gasUnitPrice = completedTx.gas_unit_price;
602409
+ transaction.options = {
602410
+ maxGasAmount: gasLimit.toString(),
602411
+ gasUnitPrice: completedTx.gas_unit_price
602412
+ };
602411
602413
  } catch (error) {
602412
602414
  log2(error.message);
602413
602415
  throw error;
@@ -602422,6 +602424,9 @@ var CACHE = makeLRUCache(getFee, (account3, transaction) => {
602422
602424
  var getEstimatedGas = async (account3, transaction, aptosClient2) => {
602423
602425
  return await CACHE(account3, transaction, aptosClient2);
602424
602426
  };
602427
+ var getGasMultiplier = (transaction) => {
602428
+ return STAKING_TX_MODES.includes(transaction.mode) ? ESTIMATE_GAS_MUL_FOR_STAKING : ESTIMATE_GAS_MUL;
602429
+ };
602425
602430
 
602426
602431
  // ../../libs/coin-modules/coin-aptos/lib-es/bridge/estimateMaxSpendable.js
602427
602432
  var estimateMaxSpendable2 = async ({ account: account3, parentAccount, transaction }) => {
@@ -602430,7 +602435,8 @@ var estimateMaxSpendable2 = async ({ account: account3, parentAccount, transacti
602430
602435
  let maxGasAmount = new import_bignumber63.BigNumber(DEFAULT_GAS);
602431
602436
  let gasUnitPrice = new import_bignumber63.BigNumber(DEFAULT_GAS_PRICE);
602432
602437
  if (transaction) {
602433
- const { estimate: estimate5 } = await getEstimatedGas(mainAccount, transaction, aptosClient2);
602438
+ const amount = transaction.amount.isZero() ? account3.spendableBalance : transaction.amount;
602439
+ const { estimate: estimate5 } = await getEstimatedGas(mainAccount, { ...transaction, amount }, aptosClient2);
602434
602440
  maxGasAmount = (0, import_bignumber63.BigNumber)(estimate5.maxGasAmount);
602435
602441
  gasUnitPrice = (0, import_bignumber63.BigNumber)(estimate5.gasUnitPrice);
602436
602442
  }
@@ -602470,16 +602476,19 @@ var prepareTransaction2 = async (account3, transaction) => {
602470
602476
  }
602471
602477
  const aptosClient2 = new AptosAPI(account3.currency.id);
602472
602478
  const tokenAccount = findSubAccountById(account3, transaction?.subAccountId ?? "");
602479
+ const { fees: fees2, estimate: estimate5, errors: errors2 } = await getEstimatedGas(account3, transaction, aptosClient2);
602480
+ const gas = (0, import_bignumber64.default)(estimate5.maxGasAmount);
602481
+ const gasPrice = (0, import_bignumber64.default)(estimate5.gasUnitPrice);
602473
602482
  if (transaction.useAllAmount) {
602483
+ const maxAmount = tokenAccount ? getMaxSendBalance(tokenAccount, account3, gas, gasPrice) : getMaxSendBalance(account3, void 0, gas, gasPrice);
602474
602484
  if (transaction.mode === "send") {
602475
- transaction.amount = getMaxSendBalance(tokenAccount || account3, account3);
602485
+ transaction.amount = maxAmount;
602476
602486
  } else if (transaction.mode === "restake" || transaction.mode === "unstake" || transaction.mode === "withdraw") {
602477
602487
  transaction.amount = getDelegationOpMaxAmount(account3, transaction.recipient, transaction.mode);
602478
602488
  } else if (transaction.mode === "stake") {
602479
- transaction.amount = getMaxSendBalance(tokenAccount || account3, account3).minus(APTOS_DELEGATION_RESERVE_IN_OCTAS);
602489
+ transaction.amount = maxAmount.minus(APTOS_DELEGATION_RESERVE_IN_OCTAS);
602480
602490
  }
602481
602491
  }
602482
- const { fees: fees2, estimate: estimate5, errors: errors2 } = await getEstimatedGas(account3, transaction, aptosClient2);
602483
602492
  transaction.fees = fees2;
602484
602493
  transaction.options = estimate5;
602485
602494
  transaction.errors = errors2;
@@ -615776,7 +615785,11 @@ function makeGetAccountShape3(signerContext4) {
615776
615785
  const balances = xpubOrAddress ? await getBalance2(currency24, xpubOrAddress) : [];
615777
615786
  const pendingTransferProposals = xpubOrAddress ? await getPendingTransferProposals(currency24, xpubOrAddress) : [];
615778
615787
  const balancesData = (balances || []).reduce((acc, balance2) => {
615779
- acc[balance2.instrumentId] = balance2;
615788
+ if (balance2.locked) {
615789
+ acc[`Locked${balance2.instrumentId}`] = balance2;
615790
+ } else {
615791
+ acc[balance2.instrumentId] = balance2;
615792
+ }
615780
615793
  return acc;
615781
615794
  }, {});
615782
615795
  const unlockedAmount = new import_bignumber118.default(balancesData[nativeInstrumentId]?.value.toString() || "0");
@@ -853677,6 +853690,7 @@ function getMemorySpeculosDeviceInternal(id5) {
853677
853690
  var modelMap = {
853678
853691
  stax: DeviceModelId.stax,
853679
853692
  flex: DeviceModelId.europa,
853693
+ apex_p: DeviceModelId.apex,
853680
853694
  nanos: DeviceModelId.nanoS,
853681
853695
  "nanos+": DeviceModelId.nanoSP,
853682
853696
  nanox: DeviceModelId.nanoX,
@@ -853686,6 +853700,16 @@ var reverseModelMap = {};
853686
853700
  for (const k26 in modelMap) {
853687
853701
  reverseModelMap[modelMap[k26]] = k26;
853688
853702
  }
853703
+ var getSpeculosModel = (model) => {
853704
+ switch (model) {
853705
+ case DeviceModelId.europa:
853706
+ return "flex";
853707
+ case DeviceModelId.apex:
853708
+ return "apex_p";
853709
+ default:
853710
+ return model.toLowerCase();
853711
+ }
853712
+ };
853689
853713
  async function releaseSpeculosDevice(id5) {
853690
853714
  log2("speculos", "release " + id5);
853691
853715
  const obj2 = data5[id5];
@@ -853763,7 +853787,7 @@ async function createSpeculosDevice(arg, maxRetry = 3) {
853763
853787
  `${speculosID}`,
853764
853788
  process.env.SPECULOS_IMAGE_TAG ?? "ghcr.io/ledgerhq/speculos:sha-e262a0c",
853765
853789
  "--model",
853766
- model.toLowerCase() === "europa" ? "flex" : model.toLowerCase(),
853790
+ getSpeculosModel(model),
853767
853791
  appPath,
853768
853792
  ...dependency ? [
853769
853793
  "-l",
@@ -853898,6 +853922,7 @@ async function createSpeculosDevice(arg, maxRetry = 3) {
853898
853922
 
853899
853923
  // ../../libs/ledger-live-common/lib-es/load/speculos.js
853900
853924
  var modelMapPriority = {
853925
+ apex_p: 7,
853901
853926
  flex: 6,
853902
853927
  stax: 5,
853903
853928
  nanos: 4,
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.20251128023740",
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.20251128023740"
63
63
  },
64
64
  "publishConfig": {
65
65
  "directory": "dist"