@ledgerhq/live-cli 24.19.4-nightly.4 → 24.19.4-nightly.5

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 +26 -14
  2. package/package.json +1 -1
package/lib/cli.js CHANGED
@@ -516671,7 +516671,7 @@ var require_package8 = __commonJS({
516671
516671
  module2.exports = {
516672
516672
  name: "@ledgerhq/live-common",
516673
516673
  description: "Common ground for the Ledger Live apps",
516674
- version: "34.41.0-nightly.4",
516674
+ version: "34.41.0-nightly.5",
516675
516675
  repository: {
516676
516676
  type: "git",
516677
516677
  url: "https://github.com/LedgerHQ/ledger-live.git"
@@ -523472,7 +523472,7 @@ var require_package9 = __commonJS({
523472
523472
  "package.json"(exports2, module2) {
523473
523473
  module2.exports = {
523474
523474
  name: "@ledgerhq/live-cli",
523475
- version: "24.19.4-nightly.4",
523475
+ version: "24.19.4-nightly.5",
523476
523476
  description: "ledger-live CLI version",
523477
523477
  repository: {
523478
523478
  type: "git",
@@ -807217,8 +807217,10 @@ var FALLBACK_GAS_BUDGET = {
807217
807217
  var paymentInfo3 = async (sender, fakeTransaction) => withApi2(async (api7) => {
807218
807218
  const tx = new Transaction6();
807219
807219
  tx.setSender(ensureAddressFormat(sender));
807220
- const coinObjectId = await getCoinObjectId(sender, fakeTransaction);
807221
- const [coin] = tx.splitCoins(coinObjectId ?? tx.gas, [fakeTransaction.amount.toNumber()]);
807220
+ const coinObjects = await getCoinObjectIds(sender, fakeTransaction);
807221
+ const [coin] = tx.splitCoins(Array.isArray(coinObjects) ? coinObjects[0] : tx.gas, [
807222
+ fakeTransaction.amount.toNumber()
807223
+ ]);
807222
807224
  tx.transferObjects([coin], fakeTransaction.recipient);
807223
807225
  try {
807224
807226
  const txb = await tx.build({ client: api7 });
@@ -807232,29 +807234,38 @@ var paymentInfo3 = async (sender, fakeTransaction) => withApi2(async (api7) => {
807232
807234
  } catch (error) {
807233
807235
  console.warn("Fee estimation failed:", error);
807234
807236
  return {
807235
- gasBudget: coinObjectId ? FALLBACK_GAS_BUDGET.TOKEN_TRANSFER : FALLBACK_GAS_BUDGET.SUI_TRANSFER,
807237
+ gasBudget: Array.isArray(coinObjects) ? FALLBACK_GAS_BUDGET.TOKEN_TRANSFER : FALLBACK_GAS_BUDGET.SUI_TRANSFER,
807236
807238
  totalGasUsed: BigInt(1e6),
807237
807239
  fees: BigInt(1e6)
807238
807240
  };
807239
807241
  }
807240
807242
  });
807241
- var getCoinObjectId = async (address4, transaction) => withApi2(async (api7) => {
807242
- let coinObjectId = null;
807243
+ var getCoinObjectIds = async (address4, transaction) => withApi2(async (api7) => {
807244
+ const coinObjectId = null;
807243
807245
  if (transaction.coinType !== DEFAULT_COIN_TYPE) {
807244
807246
  const tokenInfo = await api7.getCoins({
807245
807247
  owner: address4,
807246
807248
  coinType: transaction.coinType
807247
807249
  });
807248
- coinObjectId = tokenInfo.data[0].coinObjectId;
807250
+ return tokenInfo.data.map((coin) => coin.coinObjectId);
807249
807251
  }
807250
807252
  return coinObjectId;
807251
807253
  });
807252
807254
  var createTransaction24 = async (address4, transaction) => withApi2(async (api7) => {
807253
807255
  const tx = new Transaction6();
807254
807256
  tx.setSender(ensureAddressFormat(address4));
807255
- const coinObjectId = await getCoinObjectId(address4, transaction);
807256
- const [coin] = tx.splitCoins(coinObjectId ?? tx.gas, [transaction.amount.toNumber()]);
807257
- tx.transferObjects([coin], transaction.recipient);
807257
+ const coinObjects = await getCoinObjectIds(address4, transaction);
807258
+ if (Array.isArray(coinObjects) && transaction.coinType !== DEFAULT_COIN_TYPE) {
807259
+ const coins = coinObjects.map((coinId) => tx.object(coinId));
807260
+ if (coins.length > 1) {
807261
+ tx.mergeCoins(coins[0], coins.slice(1));
807262
+ }
807263
+ const [coin] = tx.splitCoins(coins[0], [transaction.amount.toNumber()]);
807264
+ tx.transferObjects([coin], transaction.recipient);
807265
+ } else {
807266
+ const [coin] = tx.splitCoins(tx.gas, [transaction.amount.toNumber()]);
807267
+ tx.transferObjects([coin], transaction.recipient);
807268
+ }
807258
807269
  return tx.build({ client: api7 });
807259
807270
  });
807260
807271
  var executeTransactionBlock = async (params) => withApi2(async (api7) => {
@@ -807318,11 +807329,11 @@ var network_default3 = {
807318
807329
  };
807319
807330
 
807320
807331
  // ../../libs/coin-modules/coin-sui/lib-es/logic/craftTransaction.js
807321
- async function craftTransaction4({ sender, amount, recipient, type: type4 }) {
807332
+ async function craftTransaction4({ sender, amount, recipient, coinType, type: type4 }) {
807322
807333
  const unsigned2 = await network_default3.createTransaction(sender, {
807323
807334
  amount: (0, import_bignumber307.default)(amount.toString()),
807324
807335
  recipient,
807325
- coinType: DEFAULT_COIN_TYPE,
807336
+ coinType: coinType ?? DEFAULT_COIN_TYPE,
807326
807337
  mode: type4
807327
807338
  });
807328
807339
  return { unsigned: unsigned2 };
@@ -810284,11 +810295,12 @@ function optimisticOpcommons2(commandDescriptor) {
810284
810295
 
810285
810296
  // ../../libs/coin-modules/coin-sui/lib-es/bridge/buildTransaction.js
810286
810297
  var import_pick = __toESM(require("lodash/pick"));
810287
- var buildTransaction10 = async ({ freshAddress }, { recipient, mode, amount }) => {
810298
+ var buildTransaction10 = async ({ freshAddress }, { recipient, mode, amount, coinType }) => {
810288
810299
  return craftTransaction4({
810289
810300
  sender: freshAddress,
810290
810301
  recipient,
810291
810302
  type: mode,
810303
+ coinType,
810292
810304
  amount: BigInt(amount.toString()),
810293
810305
  asset: { type: "native" }
810294
810306
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.19.4-nightly.4",
3
+ "version": "24.19.4-nightly.5",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",