@ledgerhq/live-cli 24.26.1-nightly.3 → 24.26.1-nightly.4

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 +27 -30
  2. package/package.json +1 -1
package/lib/cli.js CHANGED
@@ -520291,7 +520291,7 @@ var require_package7 = __commonJS({
520291
520291
  module2.exports = {
520292
520292
  name: "@ledgerhq/live-common",
520293
520293
  description: "Common ground for the Ledger Live apps",
520294
- version: "34.52.0-nightly.3",
520294
+ version: "34.52.0-nightly.4",
520295
520295
  repository: {
520296
520296
  type: "git",
520297
520297
  url: "https://github.com/LedgerHQ/ledger-live.git"
@@ -520625,7 +520625,7 @@ var require_package8 = __commonJS({
520625
520625
  "package.json"(exports2, module2) {
520626
520626
  module2.exports = {
520627
520627
  name: "@ledgerhq/live-cli",
520628
- version: "24.26.1-nightly.3",
520628
+ version: "24.26.1-nightly.4",
520629
520629
  description: "ledger-live CLI version",
520630
520630
  repository: {
520631
520631
  type: "git",
@@ -552961,10 +552961,8 @@ async function buildSubAccount({ parentAccountId, parentAccountAddress, token, i
552961
552961
  };
552962
552962
  return tokenAccount;
552963
552963
  }
552964
- async function buildSubAccounts({ currency: currency24, accountId: accountId2, initialAccount, initialAccountAddress, assets, newTransactions, syncConfig }) {
552964
+ async function buildSubAccounts({ accountId: accountId2, initialAccount, initialAccountAddress, assets, newTransactions, syncConfig }) {
552965
552965
  const { blacklistedTokenIds = [] } = syncConfig;
552966
- if (listTokensForCryptoCurrency(currency24).length === 0)
552967
- return void 0;
552968
552966
  const tokenAccounts = [];
552969
552967
  const existingAccountByTicker = {};
552970
552968
  const existingAccountTickers = [];
@@ -627812,13 +627810,14 @@ async function getTokenBalances(currency24, address3, nodeApi, explorerApi2) {
627812
627810
  const contractsArray = Array.from(contracts);
627813
627811
  for (let i57 = 0; i57 < contractsArray.length; i57 += TOKEN_BALANCE_BATCH_SIZE) {
627814
627812
  const chunk5 = contractsArray.slice(i57, i57 + TOKEN_BALANCE_BATCH_SIZE);
627815
- const chunkBalances = await Promise.all(chunk5.map(async (contract) => {
627813
+ const chunkBalancesPromises = await Promise.allSettled(chunk5.map(async (contract) => {
627816
627814
  const asset = assets.get(contract);
627817
627815
  if (asset === void 0)
627818
627816
  throw new Error(`No asset defined for contract ${contract}`);
627819
627817
  const balance2 = await nodeApi.getTokenBalance(currency24, address3, contract);
627820
627818
  return { asset, value: BigInt(balance2.toFixed(0)) };
627821
627819
  }));
627820
+ const chunkBalances = chunkBalancesPromises.filter((p70) => p70.status === "fulfilled").map((balance2) => balance2.value);
627822
627821
  balances.push(...chunkBalances);
627823
627822
  }
627824
627823
  return balances;
@@ -663215,6 +663214,8 @@ var DmkSignerEth = class {
663215
663214
  return new Error(error._tag);
663216
663215
  }
663217
663216
  switch (error.errorCode) {
663217
+ case "5515":
663218
+ return new LockedDeviceError();
663218
663219
  case "6985":
663219
663220
  return new UserRefusedOnDevice();
663220
663221
  case "6a80":
@@ -715151,11 +715152,8 @@ async function syncESDTTokenAccountOperations(tokenAccount, address3) {
715151
715152
  copy10.operationsCount = operations4.length;
715152
715153
  return copy10;
715153
715154
  }
715154
- async function MultiversXBuildESDTTokenAccounts({ currency: currency24, accountId: accountId2, accountAddress, existingAccount, syncConfig }) {
715155
+ async function MultiversXBuildESDTTokenAccounts({ accountId: accountId2, accountAddress, existingAccount, syncConfig }) {
715155
715156
  const { blacklistedTokenIds = [] } = syncConfig;
715156
- if (listTokensForCryptoCurrency(currency24).length === 0) {
715157
- return void 0;
715158
- }
715159
715157
  const tokenAccounts = [];
715160
715158
  const existingAccountByTicker = {};
715161
715159
  const existingAccountTickers = [];
@@ -825482,20 +825480,21 @@ var getAccountShape19 = async (info6, syncConfig) => {
825482
825480
  syncHash = latestHash(operations4);
825483
825481
  const mainAccountOperations = operations4.filter(({ extra }) => extra.coinType === DEFAULT_COIN_TYPE);
825484
825482
  const accountBalances = await getAccountBalances(address3);
825485
- const tokensCurrencies = listTokensForCryptoCurrency(currency24);
825486
- const tokensCurrenciesMap = tokensCurrencies.reduce((acc, token) => {
825487
- acc[token.contractAddress] = token;
825488
- return acc;
825489
- }, {});
825490
825483
  const balance2 = accountBalances.find(({ coinType }) => coinType === DEFAULT_COIN_TYPE)?.balance ?? (0, import_bignumber313.default)(0);
825491
- const subAccountsBalances = accountBalances.filter(({ coinType }) => tokensCurrenciesMap[coinType]);
825484
+ const subAccountsBalances = [];
825485
+ for (const accountBalance of accountBalances) {
825486
+ const token = await getCryptoAssetsStore().findTokenByAddressInCurrency(accountBalance.coinType, currency24.id);
825487
+ if (token) {
825488
+ subAccountsBalances.push(accountBalance);
825489
+ }
825490
+ }
825492
825491
  const subAccounts = await buildSubAccounts3({
825493
825492
  accountId: accountId2,
825494
- initialAccount,
825495
825493
  operations: operations4,
825496
825494
  subAccountsBalances,
825497
825495
  syncConfig,
825498
- tokensCurrenciesMap
825496
+ currencyId: currency24.id,
825497
+ subAccounts: initialAccount?.subAccounts ?? []
825499
825498
  }) || [];
825500
825499
  return {
825501
825500
  id: accountId2,
@@ -825512,26 +825511,24 @@ var getAccountShape19 = async (info6, syncConfig) => {
825512
825511
  };
825513
825512
  };
825514
825513
  var sync19 = makeSync({ getAccountShape: getAccountShape19, shouldMergeOps: false });
825515
- async function buildSubAccounts3({ accountId: accountId2, initialAccount, operations: operations4, subAccountsBalances, syncConfig, tokensCurrenciesMap }) {
825516
- if (Object.keys(tokensCurrenciesMap).length === 0)
825514
+ async function buildSubAccounts3({ accountId: accountId2, operations: operations4, subAccountsBalances, syncConfig, currencyId, subAccounts }) {
825515
+ if (subAccountsBalances.length === 0)
825517
825516
  return void 0;
825518
825517
  const { blacklistedTokenIds = [] } = syncConfig;
825519
825518
  const tokenAccounts = [];
825520
825519
  const existingAccountByTicker = {};
825521
825520
  const existingAccountTickers = [];
825522
- if (initialAccount?.subAccounts) {
825523
- for (const existingSubAccount of initialAccount.subAccounts) {
825524
- if (existingSubAccount.type === "TokenAccount") {
825525
- const { ticker, id: id7 } = existingSubAccount.token;
825526
- if (!blacklistedTokenIds.includes(id7)) {
825527
- existingAccountTickers.push(ticker);
825528
- existingAccountByTicker[ticker] = existingSubAccount;
825529
- }
825521
+ for (const existingSubAccount of subAccounts) {
825522
+ if (existingSubAccount.type === "TokenAccount") {
825523
+ const { ticker, id: id7 } = existingSubAccount.token;
825524
+ if (!blacklistedTokenIds.includes(id7)) {
825525
+ existingAccountTickers.push(ticker);
825526
+ existingAccountByTicker[ticker] = existingSubAccount;
825530
825527
  }
825531
825528
  }
825532
825529
  }
825533
825530
  await promiseAllBatched(3, subAccountsBalances, async (accountBalance) => {
825534
- const token = tokensCurrenciesMap[accountBalance.coinType];
825531
+ const token = await getCryptoAssetsStore().findTokenByAddressInCurrency(accountBalance.coinType, currencyId);
825535
825532
  if (token && !blacklistedTokenIds.includes(token.id)) {
825536
825533
  const initialTokenAccount = existingAccountByTicker[token.ticker];
825537
825534
  const tokenAccount = await buildSubAccount2({
@@ -861823,7 +861820,7 @@ var evmConfig = {
861823
861820
  },
861824
861821
  node: {
861825
861822
  type: "external",
861826
- uri: "https://developer-access-mainnet.base.org"
861823
+ uri: "https://base-rpc.publicnode.com"
861827
861824
  },
861828
861825
  explorer: {
861829
861826
  type: "etherscan",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.26.1-nightly.3",
3
+ "version": "24.26.1-nightly.4",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",