@ledgerhq/live-cli 24.18.4-next.0 → 24.18.4-next.1

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 -7
  2. package/package.json +1 -1
package/lib/cli.js CHANGED
@@ -530283,7 +530283,7 @@ var require_package8 = __commonJS({
530283
530283
  module2.exports = {
530284
530284
  name: "@ledgerhq/live-common",
530285
530285
  description: "Common ground for the Ledger Live apps",
530286
- version: "34.35.0-next.0",
530286
+ version: "34.35.0-next.1",
530287
530287
  repository: {
530288
530288
  type: "git",
530289
530289
  url: "https://github.com/LedgerHQ/ledger-live.git"
@@ -537082,7 +537082,7 @@ var require_package9 = __commonJS({
537082
537082
  "package.json"(exports2, module2) {
537083
537083
  module2.exports = {
537084
537084
  name: "@ledgerhq/live-cli",
537085
- version: "24.18.4-next.0",
537085
+ version: "24.18.4-next.1",
537086
537086
  description: "ledger-live CLI version",
537087
537087
  repository: {
537088
537088
  type: "git",
@@ -804282,6 +804282,10 @@ async function estimateFee(address4, body, initCode, initData) {
804282
804282
  async function broadcastTx4(bocBase64) {
804283
804283
  return (await send2("/message", { boc: bocBase64 })).message_hash;
804284
804284
  }
804285
+ async function fetchAdjacentTransactions(txHash, dir = "in") {
804286
+ const url4 = `/adjacentTransactions?hash=${encodeURIComponent(txHash)}&direction=${dir}`;
804287
+ return await fetch13(url4);
804288
+ }
804285
804289
 
804286
804290
  // ../../libs/coin-modules/coin-ton/lib-es/broadcast.js
804287
804291
  var broadcast22 = async ({ signedOperation: { signature: signature3, operation } }) => {
@@ -804911,7 +804915,6 @@ function mapTxToOps5(accountId2, addr, addressBook) {
804911
804915
  ops.push({
804912
804916
  id: encodeOperationId(accountId2, hash12, "OUT"),
804913
804917
  hash: tx.out_msgs[0].hash,
804914
- // this hash matches with in_msg.hash of IN transaction
804915
804918
  type: "OUT",
804916
804919
  value: (0, import_bignumber272.default)(tx.out_msgs[0].value ?? 0),
804917
804920
  fee: (0, import_bignumber272.default)(tx.total_fees),
@@ -804935,7 +804938,7 @@ function mapTxToOps5(accountId2, addr, addressBook) {
804935
804938
  return ops;
804936
804939
  };
804937
804940
  }
804938
- function mapJettonTxToOps(accountId2, addr, addressBook) {
804941
+ function mapJettonTxToOps(accountId2, addr, addressBook, jettonTxMessageHashesMap2) {
804939
804942
  return (tx) => {
804940
804943
  const accountAddr = import_core19.Address.parse(addr).toString({ urlSafe: true, bounceable: false });
804941
804944
  if (accountAddr !== addr)
@@ -804981,8 +804984,9 @@ function mapJettonTxToOps(accountId2, addr, addressBook) {
804981
804984
  });
804982
804985
  }
804983
804986
  if (isSending) {
804987
+ const hash_message = jettonTxMessageHashesMap2 ? jettonTxMessageHashesMap2.get(hash12) ?? hash12 : hash12;
804984
804988
  ops.push({
804985
- id: encodeOperationId(tokenAccountId, hash12, "OUT"),
804989
+ id: encodeOperationId(tokenAccountId, hash_message, "OUT"),
804986
804990
  hash: hash12,
804987
804991
  type: "OUT",
804988
804992
  value: (0, import_bignumber272.default)(tx.amount),
@@ -805064,6 +805068,7 @@ function getSyncHash2(currency24, blacklistedList) {
805064
805068
  }
805065
805069
 
805066
805070
  // ../../libs/coin-modules/coin-ton/lib-es/synchronisation.js
805071
+ var jettonTxMessageHashesMap = /* @__PURE__ */ new Map();
805067
805072
  var getAccountShape17 = async (info6, { blacklistedTokenIds }) => {
805068
805073
  const { address: address4, rest, currency: currency24, derivationMode, initialAccount } = info6;
805069
805074
  const publicKey3 = reconciliatePubkey(rest?.publicKey, initialAccount);
@@ -805103,8 +805108,22 @@ var getAccountShape17 = async (info6, { blacklistedTokenIds }) => {
805103
805108
  }
805104
805109
  }
805105
805110
  }
805111
+ for (const tx of newJettonTxs) {
805112
+ const hash12 = tx.transaction_hash;
805113
+ try {
805114
+ if (!jettonTxMessageHashesMap.has(hash12)) {
805115
+ const res = await fetchAdjacentTransactions(hash12);
805116
+ const hash_message = res.transactions.at(0)?.in_msg?.hash;
805117
+ if (hash_message) {
805118
+ jettonTxMessageHashesMap.set(hash12, hash_message);
805119
+ }
805120
+ }
805121
+ } catch (error) {
805122
+ console.error(`Error processing ton jetton hash ${hash12}:`, error);
805123
+ }
805124
+ }
805106
805125
  const newOps = (0, import_flatMap19.default)(newTxs.transactions, mapTxToOps5(accountId2, address4, newTxs.address_book));
805107
- const newJettonOps = (0, import_flatMap19.default)(newJettonTxs, mapJettonTxToOps(accountId2, address4, newTxs.address_book));
805126
+ const newJettonOps = (0, import_flatMap19.default)(newJettonTxs, mapJettonTxToOps(accountId2, address4, newTxs.address_book, jettonTxMessageHashesMap));
805108
805127
  const operations = shouldSyncFromScratch ? newOps : mergeOps(oldOps, newOps);
805109
805128
  const subAccounts = await getSubAccounts3(info6, accountId2, newJettonOps, blacklistedTokenIds, shouldSyncFromScratch);
805110
805129
  const toReturn = {
@@ -805145,7 +805164,7 @@ var getSubAccountShape3 = async (info6, parentId, token, ops, shouldSyncFromScra
805145
805164
  creationDate: operations.length > 0 ? operations[operations.length - 1].date : /* @__PURE__ */ new Date(),
805146
805165
  balanceHistoryCache: emptyHistoryCache,
805147
805166
  // calculated in the jsHelpers
805148
- swapHistory: [],
805167
+ swapHistory: maybeExistingSubAccount ? maybeExistingSubAccount.swapHistory : [],
805149
805168
  jettonWallet
805150
805169
  // Address of the jetton wallet contract that holds the token balance and handles transfers
805151
805170
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.18.4-next.0",
3
+ "version": "24.18.4-next.1",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",