@ledgerhq/live-cli 24.25.0-nightly.6 → 24.25.1-nightly.0

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 +42 -24
  2. package/package.json +3 -3
package/lib/cli.js CHANGED
@@ -513744,7 +513744,7 @@ var require_package7 = __commonJS({
513744
513744
  module2.exports = {
513745
513745
  name: "@ledgerhq/live-common",
513746
513746
  description: "Common ground for the Ledger Live apps",
513747
- version: "34.50.0-nightly.6",
513747
+ version: "34.51.0-nightly.0",
513748
513748
  repository: {
513749
513749
  type: "git",
513750
513750
  url: "https://github.com/LedgerHQ/ledger-live.git"
@@ -514081,7 +514081,7 @@ var require_package8 = __commonJS({
514081
514081
  "package.json"(exports2, module2) {
514082
514082
  module2.exports = {
514083
514083
  name: "@ledgerhq/live-cli",
514084
- version: "24.25.0-nightly.6",
514084
+ version: "24.25.1-nightly.0",
514085
514085
  description: "ledger-live CLI version",
514086
514086
  repository: {
514087
514087
  type: "git",
@@ -846826,11 +846826,6 @@ var UnsupportedTransactionMode = createCustomErrorClass("UnsupportedTransactionM
846826
846826
 
846827
846827
  // ../../libs/coin-modules/coin-tezos/lib-es/utils.js
846828
846828
  var import_utils505 = __toESM(require_utils48());
846829
- var DEFAULT_LIMITS = {
846830
- GAS: 2169n,
846831
- STORAGE: 277n,
846832
- BASE_FEE: 491n
846833
- };
846834
846829
  var DUST_MARGIN_MUTEZ = 500;
846835
846830
  var MIN_SUGGESTED_FEE_SMALL_TRANSFER = 489;
846836
846831
  var OP_SIZE_XTZ_TRANSFER = 154;
@@ -846879,13 +846874,17 @@ function normalizePublicKeyForAddress(maybeKey, address3) {
846879
846874
  }
846880
846875
  }
846881
846876
  function createFallbackEstimation() {
846877
+ const config4 = config_default9.getCoinConfig();
846882
846878
  return {
846883
- fees: DEFAULT_LIMITS.BASE_FEE,
846884
- gasLimit: DEFAULT_LIMITS.GAS,
846885
- storageLimit: DEFAULT_LIMITS.STORAGE,
846886
- estimatedFees: DEFAULT_LIMITS.BASE_FEE
846879
+ fees: BigInt(config4.fees.minEstimatedFees),
846880
+ gasLimit: BigInt(config4.fees.minGasLimit),
846881
+ storageLimit: BigInt(config4.fees.minStorageLimit),
846882
+ estimatedFees: BigInt(config4.fees.minEstimatedFees)
846887
846883
  };
846888
846884
  }
846885
+ function hasEmptyBalance(account3) {
846886
+ return account3.type === "user" && account3.balance === 0 || account3.type === "empty";
846887
+ }
846889
846888
 
846890
846889
  // ../../libs/coin-modules/coin-tezos/lib-es/logic/craftTransaction.js
846891
846890
  async function craftTransaction8(account3, transaction, publicKey3) {
@@ -847559,11 +847558,12 @@ async function craft3(transactionIntent, customFees) {
847559
847558
  const totalFee = Number(fee.fees || "0");
847560
847559
  let txFee;
847561
847560
  if (customFees) {
847562
- txFee = totalFee;
847561
+ txFee = needsReveal ? Math.max(totalFee - getRevealFee(transactionIntent.sender), 0) : totalFee;
847563
847562
  } else if (estimation.parameters?.txFee !== void 0) {
847564
847563
  txFee = Number(estimation.parameters.txFee);
847565
847564
  } else {
847566
- txFee = needsReveal ? Math.max(totalFee - getRevealFee(transactionIntent.sender), 0) : totalFee;
847565
+ const calculatedTxFee = needsReveal ? Math.max(totalFee - getRevealFee(transactionIntent.sender), 0) : totalFee;
847566
+ txFee = calculatedTxFee;
847567
847567
  }
847568
847568
  const txForCraft = {
847569
847569
  type: mappedType,
@@ -847595,6 +847595,7 @@ async function craft3(transactionIntent, customFees) {
847595
847595
  return { transaction: tx };
847596
847596
  }
847597
847597
  async function estimate4(transactionIntent) {
847598
+ const config4 = config_default9.getCoinConfig();
847598
847599
  if (transactionIntent.type === "send" && transactionIntent.amount === 0n && !transactionIntent.useAllAmount) {
847599
847600
  return {
847600
847601
  value: BigInt(DUST_MARGIN_MUTEZ),
@@ -847650,14 +847651,33 @@ async function estimate4(transactionIntent) {
847650
847651
  };
847651
847652
  } catch (error) {
847652
847653
  if (error?.message?.includes("Public key not found")) {
847654
+ const apiAccount = await tzkt_default.getAccountByAddress(transactionIntent.recipient);
847655
+ const storageLimit = !hasEmptyBalance(apiAccount) || transactionIntent.type === "stake" ? 0n : 277n;
847656
+ const senderApiAcc = await tzkt_default.getAccountByAddress(transactionIntent.sender);
847657
+ const needsReveal = senderApiAcc.type === "user" && !senderApiAcc.revealed;
847658
+ const DEFAULT_TX_FEE_FALLBACK = 388;
847659
+ let baseTxFee;
847660
+ try {
847661
+ const toolkit = getTezosToolkit();
847662
+ const simpleEstimate = await toolkit.estimate.transfer({
847663
+ to: transactionIntent.recipient,
847664
+ amount: Number(transactionIntent.amount),
847665
+ mutez: true,
847666
+ source: transactionIntent.sender
847667
+ });
847668
+ baseTxFee = BigInt(Math.max(config4.fees.minFees, simpleEstimate.suggestedFeeMutez));
847669
+ } catch {
847670
+ baseTxFee = BigInt(Math.max(DEFAULT_TX_FEE_FALLBACK, config4.fees.minFees));
847671
+ }
847672
+ const revealFee = needsReveal ? BigInt(getRevealFee(transactionIntent.sender)) : 0n;
847673
+ const totalFee = baseTxFee + revealFee;
847653
847674
  return {
847654
- value: 1000n,
847655
- // Safe default with reveal fees (500 + 374 reveal + buffer)
847675
+ value: totalFee,
847656
847676
  parameters: {
847657
847677
  gasLimit: 10000n,
847658
- storageLimit: 300n,
847678
+ storageLimit,
847659
847679
  amount: 0n,
847660
- txFee: 1000n
847680
+ txFee: baseTxFee
847661
847681
  }
847662
847682
  };
847663
847683
  } else {
@@ -848231,7 +848251,8 @@ function genericPrepareTransaction(network, kind) {
848231
848251
  return async (account3, transaction) => {
848232
848252
  const { getAssetFromToken: getAssetFromToken3, computeIntentType: computeIntentType2, estimateFees: estimateFees9, validateIntent: validateIntent5 } = getAlpacaApi(account3.currency.id, kind);
848233
848253
  const { assetReference, assetOwner } = getAssetFromToken3 ? getAssetInfos(transaction, account3.freshAddress, getAssetFromToken3) : assetInfosFallback(transaction);
848234
- let fees2 = transaction.customFees?.parameters?.fees || null;
848254
+ const customParametersFees = transaction.customFees?.parameters?.fees;
848255
+ let fees2 = customParametersFees || null;
848235
848256
  if (fees2 === null) {
848236
848257
  fees2 = (await estimateFees9(transactionToIntent(account3, {
848237
848258
  ...transaction
@@ -848245,7 +848266,7 @@ function genericPrepareTransaction(network, kind) {
848245
848266
  assetOwner,
848246
848267
  customFees: {
848247
848268
  parameters: {
848248
- fees: new import_bignumber359.default(fees2.toString())
848269
+ fees: customParametersFees ? new import_bignumber359.default(customParametersFees.toString()) : void 0
848249
848270
  }
848250
848271
  }
848251
848272
  };
@@ -848257,9 +848278,6 @@ function genericPrepareTransaction(network, kind) {
848257
848278
  const storageLimit = params["storageLimit"];
848258
848279
  if (storageLimit !== void 0 && (typeof storageLimit === "bigint" || typeof storageLimit === "number" || typeof storageLimit === "string")) {
848259
848280
  next.storageLimit = new import_bignumber359.default(storageLimit.toString());
848260
- if (next.customFees?.parameters) {
848261
- next.customFees.parameters.storageLimit = new import_bignumber359.default(storageLimit.toString());
848262
- }
848263
848281
  }
848264
848282
  }
848265
848283
  if (transaction.useAllAmount || transaction["mode"] === "stake" || transaction["mode"] === "unstake") {
@@ -853157,8 +853175,8 @@ var tezosConfig = {
853157
853175
  minGasLimit: 600,
853158
853176
  minRevealGasLimit: 300,
853159
853177
  minStorageLimit: 0,
853160
- minFees: 500,
853161
- minEstimatedFees: 500
853178
+ minFees: 300,
853179
+ minEstimatedFees: 300
853162
853180
  }
853163
853181
  }
853164
853182
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.25.0-nightly.6",
3
+ "version": "24.25.1-nightly.0",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",
@@ -56,8 +56,8 @@
56
56
  "@types/ws": "8.5.10",
57
57
  "ts-node": "10.9.2",
58
58
  "tsup": "7.3.0",
59
- "@ledgerhq/types-cryptoassets": "^7.28.0-nightly.1",
60
- "@ledgerhq/types-live": "^6.86.0-nightly.0"
59
+ "@ledgerhq/types-cryptoassets": "^7.28.0",
60
+ "@ledgerhq/types-live": "^6.86.0"
61
61
  },
62
62
  "publishConfig": {
63
63
  "directory": "dist"