@ledgerhq/live-cli 24.21.0-nightly.4 → 24.21.0-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 +33 -46
  2. package/package.json +1 -1
package/lib/cli.js CHANGED
@@ -212033,7 +212033,7 @@ var require_swarm = __commonJS({
212033
212033
  "../../node_modules/.pnpm/swarm-js@0.1.42/node_modules/swarm-js/lib/swarm.js"(exports2, module2) {
212034
212034
  "use strict";
212035
212035
  module2.exports = function(_ref) {
212036
- var fs15 = _ref.fs, files = _ref.files, os3 = _ref.os, path4 = _ref.path, child_process = _ref.child_process, mimetype2 = _ref.mimetype, defaultArchives = _ref.defaultArchives, request3 = _ref.request, downloadUrl = _ref.downloadUrl, bytes7 = _ref.bytes, hash11 = _ref.hash, pick2 = _ref.pick;
212036
+ var fs15 = _ref.fs, files = _ref.files, os3 = _ref.os, path4 = _ref.path, child_process = _ref.child_process, mimetype2 = _ref.mimetype, defaultArchives = _ref.defaultArchives, request3 = _ref.request, downloadUrl = _ref.downloadUrl, bytes7 = _ref.bytes, hash11 = _ref.hash, pick = _ref.pick;
212037
212037
  var impureInsert = function impureInsert2(key2) {
212038
212038
  return function(val) {
212039
212039
  return function(map129) {
@@ -212306,11 +212306,11 @@ var require_swarm = __commonJS({
212306
212306
  var _upload = function upload(swarmUrl) {
212307
212307
  return function(arg) {
212308
212308
  if (arg.pick === "data") {
212309
- return pick2.data().then(uploadData(swarmUrl));
212309
+ return pick.data().then(uploadData(swarmUrl));
212310
212310
  } else if (arg.pick === "file") {
212311
- return pick2.file().then(uploadFile(swarmUrl));
212311
+ return pick.file().then(uploadFile(swarmUrl));
212312
212312
  } else if (arg.pick === "directory") {
212313
- return pick2.directory().then(uploadDirectory(swarmUrl));
212313
+ return pick.directory().then(uploadDirectory(swarmUrl));
212314
212314
  } else if (arg.path) {
212315
212315
  switch (arg.kind) {
212316
212316
  case "data":
@@ -212493,7 +212493,7 @@ var require_swarm = __commonJS({
212493
212493
  uploadDirectory: uncurry(uploadDirectory(swarmUrl)),
212494
212494
  uploadDirectoryFromDisk: uncurry(uploadDirectoryFromDisk(swarmUrl)),
212495
212495
  uploadToManifest: uncurry(uploadToManifest(swarmUrl)),
212496
- pick: pick2,
212496
+ pick,
212497
212497
  hash: hash11,
212498
212498
  fromString: fromString4,
212499
212499
  toString: toString12
@@ -212521,7 +212521,7 @@ var require_swarm = __commonJS({
212521
212521
  uploadDirectory,
212522
212522
  uploadDirectoryFromDisk,
212523
212523
  uploadToManifest,
212524
- pick: pick2,
212524
+ pick,
212525
212525
  hash: hash11,
212526
212526
  fromString: fromString4,
212527
212527
  toString: toString12
@@ -212545,7 +212545,7 @@ var require_api_node = __commonJS({
212545
212545
  var downloadUrl = "http://ethereum-mist.s3.amazonaws.com/swarm/";
212546
212546
  var bytes7 = require_bytes5();
212547
212547
  var hash11 = require_swarm_hash();
212548
- var pick2 = require_pick();
212548
+ var pick = require_pick();
212549
212549
  var swarm = require_swarm();
212550
212550
  var request3 = function request4(url4, params, callback) {
212551
212551
  var newParams = {};
@@ -212569,7 +212569,7 @@ var require_api_node = __commonJS({
212569
212569
  downloadUrl,
212570
212570
  bytes: bytes7,
212571
212571
  hash: hash11,
212572
- pick: pick2
212572
+ pick
212573
212573
  });
212574
212574
  }
212575
212575
  });
@@ -440912,10 +440912,10 @@ var require_server4 = __commonJS({
440912
440912
  }
440913
440913
  }, _callee, this);
440914
440914
  }));
440915
- function getAccount12(_x) {
440915
+ function getAccount11(_x) {
440916
440916
  return _getAccount2.apply(this, arguments);
440917
440917
  }
440918
- return getAccount12;
440918
+ return getAccount11;
440919
440919
  }()
440920
440920
  }, {
440921
440921
  key: "getHealth",
@@ -516704,7 +516704,7 @@ var require_package8 = __commonJS({
516704
516704
  module2.exports = {
516705
516705
  name: "@ledgerhq/live-common",
516706
516706
  description: "Common ground for the Ledger Live apps",
516707
- version: "34.44.0-nightly.4",
516707
+ version: "34.44.0-nightly.5",
516708
516708
  repository: {
516709
516709
  type: "git",
516710
516710
  url: "https://github.com/LedgerHQ/ledger-live.git"
@@ -523507,7 +523507,7 @@ var require_package9 = __commonJS({
523507
523507
  "package.json"(exports2, module2) {
523508
523508
  module2.exports = {
523509
523509
  name: "@ledgerhq/live-cli",
523510
- version: "24.21.0-nightly.4",
523510
+ version: "24.21.0-nightly.5",
523511
523511
  description: "ledger-live CLI version",
523512
523512
  repository: {
523513
523513
  type: "git",
@@ -807628,25 +807628,17 @@ async function withApi2(execute2) {
807628
807628
  const result2 = await execute2(apiMap[url4]);
807629
807629
  return result2;
807630
807630
  }
807631
- var getBalanceCached = makeLRUCache(({ api: api7, owner }) => api7.getBalance({ owner }), (params) => params.owner, minutes(1));
807632
- var getAllBalancesCached = makeLRUCache(({ api: api7, owner }) => api7.getAllBalances({
807631
+ var getAllBalancesCached = makeLRUCache(async (owner) => withApi2(async (api7) => await api7.getAllBalances({
807633
807632
  owner
807634
- }), (params) => params.owner, minutes(1));
807635
- var getAccount10 = async (addr) => withApi2(async (api7) => {
807636
- const balance = await getBalanceCached({ api: api7, owner: addr });
807637
- return {
807638
- blockHeight: BLOCK_HEIGHT * 2,
807639
- balance: (0, import_bignumber316.BigNumber)(balance.totalBalance)
807640
- };
807641
- });
807642
- var getAccountBalances = async (addr) => withApi2(async (api7) => {
807643
- const balances = await getAllBalancesCached({ api: api7, owner: addr });
807633
+ })), (owner) => owner, minutes(1));
807634
+ var getAccountBalances = async (addr) => {
807635
+ const balances = await getAllBalancesCached(addr);
807644
807636
  return balances.map(({ coinType, totalBalance }) => ({
807645
807637
  coinType,
807646
807638
  blockHeight: BLOCK_HEIGHT * 2,
807647
807639
  balance: (0, import_bignumber316.BigNumber)(totalBalance)
807648
807640
  }));
807649
- });
807641
+ };
807650
807642
  function isSender4(addr, transaction) {
807651
807643
  return transaction?.sender === ensureAddressFormat(addr);
807652
807644
  }
@@ -807973,8 +807965,8 @@ var toStakeAmounts = (stake) => {
807973
807965
 
807974
807966
  // ../../libs/coin-modules/coin-sui/lib-es/network/index.js
807975
807967
  var network_default3 = {
807976
- getAccount: getAccount10,
807977
807968
  getAccountBalances,
807969
+ getAllBalancesCached,
807978
807970
  getOperations: getOperations5,
807979
807971
  getBlock: getBlock3,
807980
807972
  getBlockInfo,
@@ -807985,7 +807977,7 @@ var network_default3 = {
807985
807977
  };
807986
807978
 
807987
807979
  // ../../libs/coin-modules/coin-sui/lib-es/logic/craftTransaction.js
807988
- async function craftTransaction5({ sender, amount, recipient, asset, type: type4 }) {
807980
+ async function craftTransaction5({ amount, asset, recipient, sender, type: type4 }) {
807989
807981
  let coinType = DEFAULT_COIN_TYPE;
807990
807982
  if (asset.type === "token" && asset.assetReference) {
807991
807983
  coinType = asset.assetReference;
@@ -808001,14 +807993,18 @@ async function craftTransaction5({ sender, amount, recipient, asset, type: type4
808001
807993
 
808002
807994
  // ../../libs/coin-modules/coin-sui/lib-es/logic/estimateFees.js
808003
807995
  var import_bignumber318 = require("bignumber.js");
808004
- async function estimateFees6({ recipient, amount, sender }) {
807996
+ async function estimateFees6({ recipient, amount, sender, asset }) {
807997
+ let coinType = DEFAULT_COIN_TYPE;
807998
+ if (asset.type === "token" && asset.assetReference) {
807999
+ coinType = asset.assetReference;
808000
+ }
808005
808001
  const { gasBudget } = await network_default3.paymentInfo(sender, {
808006
808002
  mode: "send",
808007
808003
  family: "sui",
808008
808004
  recipient,
808009
808005
  amount: (0, import_bignumber318.BigNumber)(amount.toString()),
808010
808006
  errors: {},
808011
- coinType: "0x2::sui::SUI"
808007
+ coinType
808012
808008
  });
808013
808009
  return BigInt(gasBudget);
808014
808010
  }
@@ -808137,12 +808133,14 @@ async function getEstimatedFees12({ account: account3, transaction }) {
808137
808133
  })
808138
808134
  // Remove fees if present since we are fetching fees
808139
808135
  };
808136
+ const subAccount = findSubAccountById(account3, transaction.subAccountId ?? "");
808137
+ const asset = subAccount ? { type: "token", coinType: subAccount?.token.contractAddress } : { type: "native" };
808140
808138
  const fees2 = await estimateFees6({
808141
808139
  recipient: getAbandonSeedAddress(account3.currency.id),
808142
808140
  sender: account3.freshAddress,
808143
808141
  amount: BigInt(t43.amount.toString()),
808144
808142
  type: "send",
808145
- asset: { type: "native" }
808143
+ asset
808146
808144
  });
808147
808145
  return new import_bignumber321.BigNumber(fees2.toString());
808148
808146
  }
@@ -808917,24 +808915,13 @@ function optimisticOpcommons2(commandDescriptor) {
808917
808915
  }
808918
808916
 
808919
808917
  // ../../libs/coin-modules/coin-sui/lib-es/bridge/buildTransaction.js
808920
- var import_pick = __toESM(require("lodash/pick"));
808921
- var buildTransaction10 = async ({ freshAddress }, { recipient, mode, amount, coinType }) => {
808922
- const NATIVE_COIN_TYPE = "0x2::sui::SUI";
808923
- let asset = {
808924
- type: "native"
808925
- };
808926
- if (coinType !== NATIVE_COIN_TYPE) {
808927
- asset = {
808928
- type: "token",
808929
- assetReference: coinType
808930
- };
808931
- }
808918
+ var buildTransaction10 = async (account3, { recipient, mode, amount, coinType }) => {
808932
808919
  return craftTransaction5({
808933
- sender: freshAddress,
808920
+ sender: account3.freshAddress,
808934
808921
  recipient,
808935
808922
  type: mode,
808936
808923
  amount: BigInt(amount.toString()),
808937
- asset
808924
+ asset: toSuiAsset(coinType)
808938
808925
  });
808939
808926
  };
808940
808927
 
@@ -809657,7 +809644,7 @@ var rosettaSubmitTransaction = async (blob7) => {
809657
809644
 
809658
809645
  // ../../libs/coin-modules/coin-mina/lib-es/api/index.js
809659
809646
  init_lib_es2();
809660
- var getAccount11 = async (address4) => {
809647
+ var getAccount10 = async (address4) => {
809661
809648
  const networkStatus = await fetchNetworkStatus();
809662
809649
  let balance = new import_bignumber329.default(0);
809663
809650
  let spendableBalance = new import_bignumber329.default(0);
@@ -809851,7 +809838,7 @@ var getAccountShape22 = async (info6) => {
809851
809838
  xpubOrAddress: address4,
809852
809839
  derivationMode
809853
809840
  });
809854
- const { blockHeight, balance, spendableBalance } = await getAccount11(address4);
809841
+ const { blockHeight, balance, spendableBalance } = await getAccount10(address4);
809855
809842
  const rosettaTxns = await getTransactions6(address4, initialAccount?.operations.length);
809856
809843
  const newOperations = await Promise.all(rosettaTxns.flatMap((t43) => mapRosettaTxnToOperation(accountId2, address4, t43)));
809857
809844
  const operations2 = mergeOps(oldOperations, newOperations.flat());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.21.0-nightly.4",
3
+ "version": "24.21.0-nightly.5",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",