@ledgerhq/live-cli 24.18.4-nightly.0 → 24.18.4-nightly.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 +96 -56
  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-nightly.0",
530286
+ version: "34.35.0-nightly.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-nightly.0",
537085
+ version: "24.18.4-nightly.1",
537086
537086
  description: "ledger-live CLI version",
537087
537087
  repository: {
537088
537088
  type: "git",
@@ -581498,8 +581498,6 @@ var import_bignumber53 = __toESM(require("bignumber.js"));
581498
581498
 
581499
581499
  // ../../libs/coin-modules/coin-aptos/lib-es/constants.js
581500
581500
  var import_bignumber52 = __toESM(require("bignumber.js"));
581501
- var DEFAULT_GAS = new import_bignumber52.default(200);
581502
- var DEFAULT_GAS_PRICE = new import_bignumber52.default(100);
581503
581501
  var ESTIMATE_GAS_MUL = new import_bignumber52.default(1);
581504
581502
  var TX_STATUS;
581505
581503
  (function(TX_STATUS2) {
@@ -581532,6 +581530,8 @@ var DIRECTION;
581532
581530
  DIRECTION2["UNKNOWN"] = "UNKNOWN";
581533
581531
  })(DIRECTION || (DIRECTION = {}));
581534
581532
  var SUPPORTED_TOKEN_TYPES = ["coin", "fungible_asset"];
581533
+ var DEFAULT_GAS = new import_bignumber52.default(200);
581534
+ var DEFAULT_GAS_PRICE = new import_bignumber52.default(100);
581535
581535
 
581536
581536
  // ../../libs/coin-modules/coin-aptos/lib-es/bridge/logic.js
581537
581537
  var CLEAN_HEX_REGEXP = /^0x0*|^0+/;
@@ -581544,13 +581544,6 @@ var getMaxSendBalance = (gas, gasPrice, account3, transaction) => {
581544
581544
  const totalGas = gas.multipliedBy(gasPrice);
581545
581545
  return fromTokenAccount ? tokenAccount.spendableBalance : account3.spendableBalance.gt(totalGas) ? account3.spendableBalance.minus(totalGas) : new import_bignumber53.default(0);
581546
581546
  };
581547
- function normalizeTransactionOptions(options22) {
581548
- const check3 = (v37) => (v37 ?? "").toString().trim() ? v37 : void 0;
581549
- return {
581550
- maxGasAmount: check3(options22.maxGasAmount),
581551
- gasUnitPrice: check3(options22.gasUnitPrice)
581552
- };
581553
- }
581554
581547
  var getBlankOperation = (tx, id5) => ({
581555
581548
  id: "",
581556
581549
  hash: tx.hash,
@@ -581794,6 +581787,15 @@ var getTransactionStatus_default = getTransactionStatus2;
581794
581787
  // ../../libs/coin-modules/coin-aptos/lib-es/bridge/estimateMaxSpendable.js
581795
581788
  var import_bignumber57 = require("bignumber.js");
581796
581789
 
581790
+ // ../../libs/coin-modules/coin-aptos/lib-es/logic/combine.js
581791
+ function combineSignedTransaction(txRaw, signature3, pubkey) {
581792
+ const authenticator = new u12(pubkey, signature3);
581793
+ return wn({
581794
+ transaction: { rawTransaction: txRaw },
581795
+ senderAuthenticator: authenticator
581796
+ });
581797
+ }
581798
+
581797
581799
  // ../../node_modules/.pnpm/@apollo+client@3.12.6_graphql@16.10.0_react@18.3.1/node_modules/@apollo/client/core/ApolloClient.js
581798
581800
  init_tslib_es6();
581799
581801
 
@@ -594541,15 +594543,14 @@ var AptosAPI = class {
594541
594543
  options: options22
594542
594544
  });
594543
594545
  }
594544
- async broadcast(signature3) {
594545
- const txBytes = Uint8Array.from(Buffer.from(signature3, "hex"));
594546
- const pendingTx = await o5({
594547
- contentType: g7.BCS_SIGNED_TRANSACTION,
594546
+ async broadcast(tx) {
594547
+ const txBytes = a.fromHexString(tx).toUint8Array();
594548
+ const pendingTx = await q2({
594548
594549
  aptosConfig: this.aptosClient.config,
594549
594550
  body: txBytes,
594550
594551
  path: "transactions",
594551
- type: t17.FULLNODE,
594552
- originMethod: ""
594552
+ originMethod: "",
594553
+ contentType: g7.BCS_SIGNED_TRANSACTION
594553
594554
  });
594554
594555
  return pendingTx.data.hash;
594555
594556
  }
@@ -594699,20 +594700,25 @@ async function signTransaction2(signerContext3, account3, deviceId, rawTxn) {
594699
594700
  rawTransaction: rawTxn
594700
594701
  });
594701
594702
  const response = await signerContext3(deviceId, async (signer) => await signer.signTransaction(derivationPath, Buffer.from(signingMessage)));
594702
- const sigHexStr = a.fromHexString(response.signature.toString("hex"));
594703
- const signature3 = new h9(sigHexStr.toUint8Array());
594704
- const authenticator = new u12(new f6(publicKey3.toString("hex")), signature3);
594705
- return wn({
594706
- transaction: { rawTransaction: rawTxn },
594707
- senderAuthenticator: authenticator
594708
- });
594703
+ const signature3 = new h9(response.signature.toString("hex"));
594704
+ const pubkey = new f6(publicKey3.toString("hex"));
594705
+ return combineSignedTransaction(rawTxn, signature3, pubkey);
594709
594706
  }
594710
594707
 
594711
594708
  // ../../libs/coin-modules/coin-aptos/lib-es/bridge/getFeesForTransaction.js
594712
594709
  init_lib_es2();
594713
594710
  var import_bignumber56 = __toESM(require("bignumber.js"));
594714
594711
 
594715
- // ../../libs/coin-modules/coin-aptos/lib-es/bridge/buildTransaction.js
594712
+ // ../../libs/coin-modules/coin-aptos/lib-es/logic/normalizeTransactionOptions.js
594713
+ function normalizeTransactionOptions(options22) {
594714
+ const check3 = (v37) => (v37 ?? "").toString().trim() ? v37 : void 0;
594715
+ return {
594716
+ maxGasAmount: check3(options22.maxGasAmount),
594717
+ gasUnitPrice: check3(options22.gasUnitPrice)
594718
+ };
594719
+ }
594720
+
594721
+ // ../../libs/coin-modules/coin-aptos/lib-es/logic/buildTransaction.js
594716
594722
  var buildTransaction = async (account3, transaction, aptosClient2) => {
594717
594723
  const subAccount = findSubAccountById(account3, transaction.subAccountId ?? "");
594718
594724
  const txPayload = getPayload(subAccount, transaction);
@@ -594845,21 +594851,6 @@ var prepareTransaction2 = async (account3, transaction) => {
594845
594851
  };
594846
594852
  var prepareTransaction_default = prepareTransaction2;
594847
594853
 
594848
- // ../../libs/coin-modules/coin-aptos/lib-es/bridge/createTransaction.js
594849
- var import_bignumber59 = __toESM(require("bignumber.js"));
594850
- var createTransaction2 = () => ({
594851
- family: "aptos",
594852
- mode: "send",
594853
- amount: (0, import_bignumber59.default)(0),
594854
- recipient: "",
594855
- useAllAmount: false,
594856
- options: {
594857
- maxGasAmount: DEFAULT_GAS.toString(),
594858
- gasUnitPrice: DEFAULT_GAS_PRICE.toString()
594859
- }
594860
- });
594861
- var createTransaction_default2 = createTransaction2;
594862
-
594863
594854
  // ../../libs/coin-modules/coin-aptos/lib-es/bridge/synchronisation.js
594864
594855
  var updatableSubAccountProperties = [
594865
594856
  { name: "balance", isOps: false },
@@ -594981,7 +594972,7 @@ var getAccountShape2 = async (info6) => {
594981
594972
 
594982
594973
  // ../../libs/coin-modules/coin-aptos/lib-es/bridge/signOperation.js
594983
594974
  var import_rxjs10 = require("rxjs");
594984
- var import_bignumber60 = __toESM(require("bignumber.js"));
594975
+ var import_bignumber59 = __toESM(require("bignumber.js"));
594985
594976
  var buildSignOperation2 = (signerContext3) => ({ account: account3, transaction, deviceId }) => new import_rxjs10.Observable((o47) => {
594986
594977
  async function main2() {
594987
594978
  o47.next({ type: "device-signature-requested" });
@@ -594993,7 +594984,7 @@ var buildSignOperation2 = (signerContext3) => ({ account: account3, transaction,
594993
594984
  const accountId2 = account3.id;
594994
594985
  const hash12 = "";
594995
594986
  const type4 = "OUT";
594996
- const fee = transaction.fees || new import_bignumber60.default(0);
594987
+ const fee = transaction.fees || new import_bignumber59.default(0);
594997
594988
  const extra = {};
594998
594989
  const senders = [];
594999
594990
  const recipients = [];
@@ -595050,6 +595041,21 @@ var broadcast3 = async ({ signedOperation, account: account3 }) => {
595050
595041
  };
595051
595042
  var broadcast_default = broadcast3;
595052
595043
 
595044
+ // ../../libs/coin-modules/coin-aptos/lib-es/logic/createTransaction.js
595045
+ var import_bignumber60 = __toESM(require("bignumber.js"));
595046
+ var createTransaction2 = () => ({
595047
+ family: "aptos",
595048
+ mode: "send",
595049
+ amount: (0, import_bignumber60.default)(0),
595050
+ recipient: "",
595051
+ useAllAmount: false,
595052
+ options: {
595053
+ maxGasAmount: DEFAULT_GAS.toString(),
595054
+ gasUnitPrice: DEFAULT_GAS_PRICE.toString()
595055
+ }
595056
+ });
595057
+ var createTransaction_default2 = createTransaction2;
595058
+
595053
595059
  // ../../libs/coin-modules/coin-aptos/lib-es/bridge/index.js
595054
595060
  function buildCurrencyBridge2(signerContext3) {
595055
595061
  const getAddress12 = signer_default(signerContext3);
@@ -699644,15 +699650,30 @@ async function getAccountsForPublicKey(publicKey3) {
699644
699650
  }
699645
699651
  return accounts2;
699646
699652
  }
699653
+ async function getAccountTransactions2(address4, since) {
699654
+ const transactions3 = [];
699655
+ const params = new URLSearchParams({
699656
+ "account.id": address4,
699657
+ order: "desc",
699658
+ limit: "100"
699659
+ });
699660
+ if (since) {
699661
+ params.append("timestamp", `gt:${since}`);
699662
+ }
699663
+ let nextUrl = `/api/v1/transactions?${params.toString()}`;
699664
+ while (nextUrl) {
699665
+ const res = await fetch5(nextUrl);
699666
+ const newTransactions = res.data.transactions;
699667
+ if (newTransactions.length === 0)
699668
+ break;
699669
+ transactions3.push(...newTransactions);
699670
+ nextUrl = res.data.links.next;
699671
+ }
699672
+ return transactions3;
699673
+ }
699647
699674
  async function getOperationsForAccount(ledgerAccountId, address4, latestOperationTimestamp) {
699675
+ const rawOperations = await getAccountTransactions2(address4, latestOperationTimestamp);
699648
699676
  const operations = [];
699649
- let r38 = await fetch5(`/api/v1/transactions?account.id=${address4}&timestamp=gt:${latestOperationTimestamp}`);
699650
- const rawOperations = r38.data.transactions;
699651
- while (r38.data.links.next) {
699652
- r38 = await fetch5(r38.data.links.next);
699653
- const newOperations = r38.data.transactions;
699654
- rawOperations.push(...newOperations);
699655
- }
699656
699677
  for (const raw of rawOperations) {
699657
699678
  const { consensus_timestamp } = raw;
699658
699679
  const timestamp = new Date(parseInt(consensus_timestamp.split(".")[0], 10) * 1e3);
@@ -699727,8 +699748,8 @@ var getAccountShape7 = async (info6) => {
699727
699748
  });
699728
699749
  const accountBalance = await getAccountBalance(address4);
699729
699750
  const oldOperations = initialAccount?.operations ?? [];
699730
- const latestOperationTimestamp = oldOperations[0] ? Math.floor(oldOperations[0].date.getTime() / 1e3) : 0;
699731
- const newOperations = await getOperationsForAccount(liveAccountId, address4, new import_bignumber166.BigNumber(latestOperationTimestamp).toString());
699751
+ const latestOperationTimestamp = oldOperations[0] ? new import_bignumber166.BigNumber(Math.floor(oldOperations[0].date.getTime() / 1e3)) : null;
699752
+ const newOperations = await getOperationsForAccount(liveAccountId, address4, latestOperationTimestamp ? latestOperationTimestamp.toString() : null);
699732
699753
  const operations = mergeOps(oldOperations, newOperations);
699733
699754
  return {
699734
699755
  id: liveAccountId,
@@ -804282,6 +804303,10 @@ async function estimateFee(address4, body, initCode, initData) {
804282
804303
  async function broadcastTx4(bocBase64) {
804283
804304
  return (await send2("/message", { boc: bocBase64 })).message_hash;
804284
804305
  }
804306
+ async function fetchAdjacentTransactions(txHash, dir = "in") {
804307
+ const url4 = `/adjacentTransactions?hash=${encodeURIComponent(txHash)}&direction=${dir}`;
804308
+ return await fetch13(url4);
804309
+ }
804285
804310
 
804286
804311
  // ../../libs/coin-modules/coin-ton/lib-es/broadcast.js
804287
804312
  var broadcast22 = async ({ signedOperation: { signature: signature3, operation } }) => {
@@ -804911,7 +804936,6 @@ function mapTxToOps5(accountId2, addr, addressBook) {
804911
804936
  ops.push({
804912
804937
  id: encodeOperationId(accountId2, hash12, "OUT"),
804913
804938
  hash: tx.out_msgs[0].hash,
804914
- // this hash matches with in_msg.hash of IN transaction
804915
804939
  type: "OUT",
804916
804940
  value: (0, import_bignumber272.default)(tx.out_msgs[0].value ?? 0),
804917
804941
  fee: (0, import_bignumber272.default)(tx.total_fees),
@@ -804935,7 +804959,7 @@ function mapTxToOps5(accountId2, addr, addressBook) {
804935
804959
  return ops;
804936
804960
  };
804937
804961
  }
804938
- function mapJettonTxToOps(accountId2, addr, addressBook) {
804962
+ function mapJettonTxToOps(accountId2, addr, addressBook, jettonTxMessageHashesMap2) {
804939
804963
  return (tx) => {
804940
804964
  const accountAddr = import_core19.Address.parse(addr).toString({ urlSafe: true, bounceable: false });
804941
804965
  if (accountAddr !== addr)
@@ -804981,8 +805005,9 @@ function mapJettonTxToOps(accountId2, addr, addressBook) {
804981
805005
  });
804982
805006
  }
804983
805007
  if (isSending) {
805008
+ const hash_message = jettonTxMessageHashesMap2 ? jettonTxMessageHashesMap2.get(hash12) ?? hash12 : hash12;
804984
805009
  ops.push({
804985
- id: encodeOperationId(tokenAccountId, hash12, "OUT"),
805010
+ id: encodeOperationId(tokenAccountId, hash_message, "OUT"),
804986
805011
  hash: hash12,
804987
805012
  type: "OUT",
804988
805013
  value: (0, import_bignumber272.default)(tx.amount),
@@ -805064,6 +805089,7 @@ function getSyncHash2(currency24, blacklistedList) {
805064
805089
  }
805065
805090
 
805066
805091
  // ../../libs/coin-modules/coin-ton/lib-es/synchronisation.js
805092
+ var jettonTxMessageHashesMap = /* @__PURE__ */ new Map();
805067
805093
  var getAccountShape17 = async (info6, { blacklistedTokenIds }) => {
805068
805094
  const { address: address4, rest, currency: currency24, derivationMode, initialAccount } = info6;
805069
805095
  const publicKey3 = reconciliatePubkey(rest?.publicKey, initialAccount);
@@ -805103,8 +805129,22 @@ var getAccountShape17 = async (info6, { blacklistedTokenIds }) => {
805103
805129
  }
805104
805130
  }
805105
805131
  }
805132
+ for (const tx of newJettonTxs) {
805133
+ const hash12 = tx.transaction_hash;
805134
+ try {
805135
+ if (!jettonTxMessageHashesMap.has(hash12)) {
805136
+ const res = await fetchAdjacentTransactions(hash12);
805137
+ const hash_message = res.transactions.at(0)?.in_msg?.hash;
805138
+ if (hash_message) {
805139
+ jettonTxMessageHashesMap.set(hash12, hash_message);
805140
+ }
805141
+ }
805142
+ } catch (error) {
805143
+ console.error(`Error processing ton jetton hash ${hash12}:`, error);
805144
+ }
805145
+ }
805106
805146
  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));
805147
+ const newJettonOps = (0, import_flatMap19.default)(newJettonTxs, mapJettonTxToOps(accountId2, address4, newTxs.address_book, jettonTxMessageHashesMap));
805108
805148
  const operations = shouldSyncFromScratch ? newOps : mergeOps(oldOps, newOps);
805109
805149
  const subAccounts = await getSubAccounts3(info6, accountId2, newJettonOps, blacklistedTokenIds, shouldSyncFromScratch);
805110
805150
  const toReturn = {
@@ -805145,7 +805185,7 @@ var getSubAccountShape3 = async (info6, parentId, token, ops, shouldSyncFromScra
805145
805185
  creationDate: operations.length > 0 ? operations[operations.length - 1].date : /* @__PURE__ */ new Date(),
805146
805186
  balanceHistoryCache: emptyHistoryCache,
805147
805187
  // calculated in the jsHelpers
805148
- swapHistory: [],
805188
+ swapHistory: maybeExistingSubAccount ? maybeExistingSubAccount.swapHistory : [],
805149
805189
  jettonWallet
805150
805190
  // Address of the jetton wallet contract that holds the token balance and handles transfers
805151
805191
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.18.4-nightly.0",
3
+ "version": "24.18.4-nightly.1",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",