@ledgerhq/live-cli 24.22.1-nightly.8 → 24.22.1-nightly.9

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 +50 -44
  2. package/package.json +1 -1
package/lib/cli.js CHANGED
@@ -513840,7 +513840,7 @@ var require_package7 = __commonJS({
513840
513840
  module2.exports = {
513841
513841
  name: "@ledgerhq/live-common",
513842
513842
  description: "Common ground for the Ledger Live apps",
513843
- version: "34.48.0-nightly.8",
513843
+ version: "34.48.0-nightly.9",
513844
513844
  repository: {
513845
513845
  type: "git",
513846
513846
  url: "https://github.com/LedgerHQ/ledger-live.git"
@@ -514176,7 +514176,7 @@ var require_package8 = __commonJS({
514176
514176
  "package.json"(exports2, module2) {
514177
514177
  module2.exports = {
514178
514178
  name: "@ledgerhq/live-cli",
514179
- version: "24.22.1-nightly.8",
514179
+ version: "24.22.1-nightly.9",
514180
514180
  description: "ledger-live CLI version",
514181
514181
  repository: {
514182
514182
  type: "git",
@@ -583937,7 +583937,7 @@ async function craftTransaction(currency24, account3, transaction) {
583937
583937
  }
583938
583938
 
583939
583939
  // ../../libs/coin-modules/coin-canton/lib-es/common-logic/transaction/estimateFees.js
583940
- var feeValue = (currency24) => config_default3.getCoinConfig(currency24).fee ?? 1;
583940
+ var feeValue = (currency24) => config_default3.getCoinConfig(currency24).fee ?? 2n * 10n ** 38n;
583941
583941
  async function estimateFees(currency24) {
583942
583942
  return Promise.resolve(BigInt(feeValue(currency24)));
583943
583943
  }
@@ -584186,15 +584186,18 @@ var getAccountShape4 = async (info6) => {
584186
584186
  const reserveMin = config_default3.getCoinConfig(currency24).minReserve || 0;
584187
584187
  const lockedAmount = balanceData.locked ? balance : new import_bignumber115.default(0);
584188
584188
  const spendableBalance = import_bignumber115.default.max(0, balance.minus(lockedAmount).minus((0, import_bignumber115.default)(reserveMin)));
584189
- const oldOperations = initialAccount?.operations || [];
584190
- const startAt = oldOperations.length ? (oldOperations[0].blockHeight || 0) + 1 : 0;
584191
- const transactionData = await getOperations(currency24, partyId, {
584192
- cursor: startAt,
584193
- limit: 100
584194
- });
584189
+ let operations3 = [];
584190
+ if (xpubOrAddress) {
584191
+ const oldOperations = initialAccount?.operations || [];
584192
+ const startAt = oldOperations.length ? (oldOperations[0].blockHeight || 0) + 1 : 0;
584193
+ const transactionData = await getOperations(currency24, partyId, {
584194
+ cursor: startAt,
584195
+ limit: 100
584196
+ });
584197
+ const newOperations = filterOperations(transactionData.operations, accountId2, partyId);
584198
+ operations3 = mergeOps(oldOperations, newOperations);
584199
+ }
584195
584200
  const blockHeight = await getLedgerEnd(currency24);
584196
- const newOperations = filterOperations(transactionData.operations, accountId2, partyId);
584197
- const operations3 = mergeOps(oldOperations, newOperations);
584198
584201
  const shape = {
584199
584202
  id: accountId2,
584200
584203
  xpub: xpubOrAddress,
@@ -618929,7 +618932,7 @@ async function getBalance3(currency24, address3) {
618929
618932
  var getBalance_default = getBalance3;
618930
618933
 
618931
618934
  // ../../libs/coin-modules/coin-evm/lib-es/logic/estimateFees.js
618932
- var import_bignumber159 = __toESM(require("bignumber.js"));
618935
+ var import_bignumber160 = __toESM(require("bignumber.js"));
618933
618936
 
618934
618937
  // ../../libs/coin-modules/coin-evm/lib-es/types/assets.js
618935
618938
  function isNative(asset) {
@@ -618955,6 +618958,7 @@ var getGasTracker = (currency24) => {
618955
618958
  };
618956
618959
 
618957
618960
  // ../../libs/coin-modules/coin-evm/lib-es/logic/common.js
618961
+ var import_bignumber159 = __toESM(require("bignumber.js"));
618958
618962
  function isApiGasOptions(options24) {
618959
618963
  if (!options24 || typeof options24 !== "object")
618960
618964
  return false;
@@ -618983,6 +618987,27 @@ function getErc20Data(recipient, amount) {
618983
618987
  const data12 = contract.encodeFunctionData("transfer", [recipient, amount]);
618984
618988
  return Buffer.from(data12.slice(2), "hex");
618985
618989
  }
618990
+ async function prepareUnsignedTxParams(currency24, transactionIntent) {
618991
+ const { amount, asset, recipient, sender, type: type4 } = transactionIntent;
618992
+ const transactionType = getTransactionType(type4);
618993
+ const node3 = getNodeApi(currency24);
618994
+ const to = isNative(asset) ? recipient : asset.assetReference;
618995
+ const data12 = isNative(asset) ? Buffer.from([]) : getErc20Data(recipient, amount);
618996
+ const value5 = isNative(asset) ? amount : 0n;
618997
+ const gasLimit = await node3.getGasEstimation({ currency: currency24, freshAddress: sender }, { amount: (0, import_bignumber159.default)(value5.toString()), recipient: to, data: data12 });
618998
+ const feeData = await node3.getFeeData(currency24, {
618999
+ type: transactionType,
619000
+ feesStrategy: transactionIntent.feesStrategy
619001
+ });
619002
+ return {
619003
+ type: transactionType,
619004
+ to,
619005
+ data: "0x" + data12.toString("hex"),
619006
+ value: value5,
619007
+ gasLimit,
619008
+ feeData
619009
+ };
619010
+ }
618986
619011
 
618987
619012
  // ../../libs/coin-modules/coin-evm/lib-es/logic/estimateFees.js
618988
619013
  function toApiFeeData(feeData) {
@@ -619001,24 +619026,14 @@ function toApiGasOptions(options24) {
619001
619026
  };
619002
619027
  }
619003
619028
  async function estimateFees2(currency24, transactionIntent) {
619004
- const { amount, asset, recipient, sender, type: type4 } = transactionIntent;
619005
- const transactionType = getTransactionType(type4);
619006
- const node3 = getNodeApi(currency24);
619029
+ const { type: type4, gasLimit, feeData } = await prepareUnsignedTxParams(currency24, transactionIntent);
619007
619030
  const gasTracker2 = getGasTracker(currency24);
619008
- const to = isNative(asset) ? recipient : asset.assetReference;
619009
- const data12 = isNative(asset) ? Buffer.from([]) : getErc20Data(recipient, amount);
619010
- const value5 = isNative(asset) ? amount : 0n;
619011
- const gasLimit = await node3.getGasEstimation({ currency: currency24, freshAddress: sender }, { amount: (0, import_bignumber159.default)(value5.toString()), recipient: to, data: data12 });
619012
- const feeData = await node3.getFeeData(currency24, {
619013
- type: transactionType,
619014
- feesStrategy: transactionIntent.feesStrategy
619015
- });
619016
619031
  const gasOptions = await gasTracker2?.getGasOptions({
619017
619032
  currency: currency24,
619018
- options: { useEIP1559: transactionType === TransactionTypes2.eip1559 }
619033
+ options: { useEIP1559: type4 === TransactionTypes2.eip1559 }
619019
619034
  });
619020
- const gasPrice = transactionType === TransactionTypes2.legacy ? feeData.gasPrice : feeData.maxFeePerGas;
619021
- const fee = gasPrice?.multipliedBy(gasLimit) || new import_bignumber159.default(0);
619035
+ const gasPrice = type4 === TransactionTypes2.legacy ? feeData.gasPrice : feeData.maxFeePerGas;
619036
+ const fee = gasPrice?.multipliedBy(gasLimit) || new import_bignumber160.default(0);
619022
619037
  return {
619023
619038
  value: BigInt(fee.toString()),
619024
619039
  parameters: {
@@ -619099,9 +619114,6 @@ async function listOperations2(currency24, address3, minHeight) {
619099
619114
  ];
619100
619115
  }
619101
619116
 
619102
- // ../../libs/coin-modules/coin-evm/lib-es/logic/craftTransaction.js
619103
- var import_bignumber160 = __toESM(require("bignumber.js"));
619104
-
619105
619117
  // ../../libs/coin-modules/coin-evm/lib-es/logic/getSequence.js
619106
619118
  function getSequence(currency24, address3) {
619107
619119
  return getNodeApi(currency24).getTransactionCount(currency24, address3);
@@ -619109,32 +619121,26 @@ function getSequence(currency24, address3) {
619109
619121
 
619110
619122
  // ../../libs/coin-modules/coin-evm/lib-es/logic/craftTransaction.js
619111
619123
  async function craftTransaction2(currency24, { transactionIntent, customFees }) {
619112
- const { amount, asset, recipient, sender, type: type4 } = transactionIntent;
619113
- const transactionType = getTransactionType(type4);
619114
- const node3 = getNodeApi(currency24);
619115
- const to = isNative(asset) ? recipient : asset?.assetReference;
619124
+ const { sender } = transactionIntent;
619125
+ const { type: type4, to, data: data12, value: value5, gasLimit, feeData } = await prepareUnsignedTxParams(currency24, transactionIntent);
619116
619126
  const nonce = await getSequence(currency24, sender);
619117
- const data12 = isNative(asset) ? Buffer.from([]) : getErc20Data(recipient, amount);
619118
- const value5 = isNative(asset) ? amount : 0n;
619119
619127
  const chainId = currency24.ethereumLikeInfo?.chainId ?? 0;
619120
- const gasLimit = await node3.getGasEstimation({ currency: currency24, freshAddress: sender }, { amount: (0, import_bignumber160.default)(value5.toString()), recipient: to, data: data12 });
619121
- const fee = await node3.getFeeData(currency24, { type: transactionType });
619122
619128
  const unsignedTransaction = {
619123
- type: transactionType,
619129
+ type: type4,
619124
619130
  to,
619125
619131
  nonce,
619126
619132
  gasLimit: BigInt(gasLimit.toFixed(0)),
619127
- data: "0x" + data12.toString("hex"),
619133
+ data: data12,
619128
619134
  value: value5,
619129
619135
  chainId,
619130
- ...fee.gasPrice ? { gasPrice: BigInt(fee.gasPrice.toFixed(0)) } : {},
619131
- ...fee.maxFeePerGas ? { maxFeePerGas: BigInt(fee.maxFeePerGas.toFixed(0)) } : {},
619132
- ...fee.maxPriorityFeePerGas ? { maxPriorityFeePerGas: BigInt(fee.maxPriorityFeePerGas.toFixed(0)) } : {}
619136
+ ...feeData.gasPrice ? { gasPrice: BigInt(feeData.gasPrice.toFixed(0)) } : {},
619137
+ ...feeData.maxFeePerGas ? { maxFeePerGas: BigInt(feeData.maxFeePerGas.toFixed(0)) } : {},
619138
+ ...feeData.maxPriorityFeePerGas ? { maxPriorityFeePerGas: BigInt(feeData.maxPriorityFeePerGas.toFixed(0)) } : {}
619133
619139
  };
619134
- if (transactionType === TransactionTypes2.legacy && typeof customFees?.parameters?.gasPrice === "bigint") {
619140
+ if (type4 === TransactionTypes2.legacy && typeof customFees?.parameters?.gasPrice === "bigint") {
619135
619141
  unsignedTransaction.gasPrice = customFees.parameters.gasPrice;
619136
619142
  }
619137
- if (transactionType === TransactionTypes2.eip1559 && typeof customFees?.parameters?.maxFeePerGas === "bigint" && typeof customFees?.parameters?.maxPriorityFeePerGas === "bigint") {
619143
+ if (type4 === TransactionTypes2.eip1559 && typeof customFees?.parameters?.maxFeePerGas === "bigint" && typeof customFees?.parameters?.maxPriorityFeePerGas === "bigint") {
619138
619144
  unsignedTransaction.maxFeePerGas = customFees.parameters.maxFeePerGas;
619139
619145
  unsignedTransaction.maxPriorityFeePerGas = customFees.parameters.maxPriorityFeePerGas;
619140
619146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.22.1-nightly.8",
3
+ "version": "24.22.1-nightly.9",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",