@ledgerhq/live-cli 24.18.4-nightly.4 → 24.18.4-nightly.6

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 +60 -50
  2. package/package.json +2 -2
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.4",
530286
+ version: "34.35.0-nightly.6",
530287
530287
  repository: {
530288
530288
  type: "git",
530289
530289
  url: "https://github.com/LedgerHQ/ledger-live.git"
@@ -537083,7 +537083,7 @@ var require_package9 = __commonJS({
537083
537083
  "package.json"(exports2, module2) {
537084
537084
  module2.exports = {
537085
537085
  name: "@ledgerhq/live-cli",
537086
- version: "24.18.4-nightly.4",
537086
+ version: "24.18.4-nightly.6",
537087
537087
  description: "ledger-live CLI version",
537088
537088
  repository: {
537089
537089
  type: "git",
@@ -559660,6 +559660,10 @@ var modes = Object.freeze({
559660
559660
  solanaSub: {
559661
559661
  overridesDerivation: "44'/501'/<account>'"
559662
559662
  },
559663
+ solanaBip44Change: {
559664
+ overridesDerivation: "44'/501'/<account>'/0'",
559665
+ mandatoryEmptyAccountSkip: 10
559666
+ },
559663
559667
  hederaBip44: {
559664
559668
  overridesDerivation: "44/3030"
559665
559669
  },
@@ -559718,7 +559722,7 @@ var legacyDerivations = {
559718
559722
  ton: ["ton"],
559719
559723
  ethereum: ["ethM", "ethMM"],
559720
559724
  ethereum_classic: ["ethM", "ethMM", "etcM"],
559721
- solana: ["solanaMain", "solanaSub"],
559725
+ solana: ["solanaMain", "solanaBip44Change", "solanaSub"],
559722
559726
  solana_devnet: ["solanaMain", "solanaSub"],
559723
559727
  solana_testnet: ["solanaMain", "solanaSub"],
559724
559728
  sui: ["sui"],
@@ -581541,7 +581545,11 @@ var DIRECTION;
581541
581545
  DIRECTION2["OUT"] = "OUT";
581542
581546
  DIRECTION2["UNKNOWN"] = "UNKNOWN";
581543
581547
  })(DIRECTION || (DIRECTION = {}));
581544
- var SUPPORTED_TOKEN_TYPES = ["coin", "fungible_asset"];
581548
+ var TOKEN_TYPE;
581549
+ (function(TOKEN_TYPE2) {
581550
+ TOKEN_TYPE2["COIN"] = "coin";
581551
+ TOKEN_TYPE2["FUNGIBLE_ASSET"] = "fungible_asset";
581552
+ })(TOKEN_TYPE || (TOKEN_TYPE = {}));
581545
581553
  var DEFAULT_GAS = new import_bignumber52.default(200);
581546
581554
  var DEFAULT_GAS_PRICE = new import_bignumber52.default(100);
581547
581555
 
@@ -581722,7 +581730,7 @@ var detectType = (address4, tx, value5) => {
581722
581730
  return type4;
581723
581731
  };
581724
581732
  function transactionsToOperations(address4, txs) {
581725
- const operations = [[], []];
581733
+ const operations = [];
581726
581734
  return txs.reduce((acc, tx) => {
581727
581735
  if (tx === null) {
581728
581736
  return acc;
@@ -581759,19 +581767,17 @@ function transactionsToOperations(address4, txs) {
581759
581767
  processRecipients(payload, address4, op, function_address);
581760
581768
  if (op.type !== DIRECTION.UNKNOWN && coin_id !== null) {
581761
581769
  if (coin_id === APTOS_ASSET_ID) {
581762
- acc[0].push(op);
581770
+ acc.push(op);
581763
581771
  return acc;
581764
581772
  }
581765
581773
  const token = findTokenByAddressInCurrency(coin_id.toLowerCase(), "aptos");
581766
581774
  if (token !== void 0) {
581767
- acc[1].push(op);
581768
- if (op.type === DIRECTION.OUT) {
581769
- acc[0].push({
581770
- ...op,
581771
- value: op.tx.fees,
581772
- type: "FEES"
581773
- });
581774
- }
581775
+ op.asset = {
581776
+ type: "token",
581777
+ standard: token.tokenType,
581778
+ contractAddress: token.contractAddress
581779
+ };
581780
+ acc.push(op);
581775
581781
  }
581776
581782
  }
581777
581783
  return acc;
@@ -594748,7 +594754,7 @@ var AptosAPI = class {
594748
594754
  }
594749
594755
  async listOperations(address4, pagination) {
594750
594756
  const transactions3 = await this.getAccountInfo(address4, pagination.minHeight.toString());
594751
- const [newOperations, _15] = transactionsToOperations(address4, transactions3.transactions);
594757
+ const newOperations = transactionsToOperations(address4, transactions3.transactions);
594752
594758
  return [newOperations, ""];
594753
594759
  }
594754
594760
  async fetchTransactions(address4, gt2) {
@@ -594816,7 +594822,7 @@ var AptosAPI = class {
594816
594822
  }
594817
594823
  });
594818
594824
  return response.map((x23) => ({
594819
- asset_type: x23.asset_type ?? "-",
594825
+ contractAddress: x23.asset_type ?? "-",
594820
594826
  amount: (0, import_bignumber57.default)(x23.amount)
594821
594827
  }));
594822
594828
  }
@@ -594855,44 +594861,44 @@ function normalizeTransactionOptions(options22) {
594855
594861
  }
594856
594862
 
594857
594863
  // ../../libs/coin-modules/coin-aptos/lib-es/logic/buildTransaction.js
594858
- var buildTransaction = async (account3, transaction, aptosClient2) => {
594864
+ var buildTransaction = async (account3, transaction, aptosClient2, contractAddress, tokenType) => {
594859
594865
  const subAccount = findSubAccountById(account3, transaction.subAccountId ?? "");
594860
- const txPayload = getPayload(subAccount, transaction);
594866
+ const payloadContracAddress = subAccount ? subAccount.token.contractAddress : contractAddress;
594867
+ const payloadTokenType = subAccount?.token?.tokenType ?? tokenType;
594868
+ const txPayload = getPayload({
594869
+ amount: transaction.amount,
594870
+ recipient: transaction.recipient,
594871
+ contractAddress: payloadContracAddress,
594872
+ tokenType: payloadTokenType
594873
+ });
594861
594874
  const txOptions = normalizeTransactionOptions(transaction.options);
594862
594875
  const tx = await aptosClient2.generateTransaction(account3.freshAddress, txPayload, txOptions);
594863
594876
  return tx;
594864
594877
  };
594865
- var getPayload = (tokenAccount, transaction) => {
594866
- if (tokenAccount && isTokenAccount(tokenAccount)) {
594867
- const { tokenType } = tokenAccount.token;
594868
- if (!SUPPORTED_TOKEN_TYPES.includes(tokenType)) {
594869
- throw new Error(`Token type ${tokenType} not supported`);
594870
- }
594871
- if (tokenType === "fungible_asset") {
594872
- return {
594873
- function: `0x1::primary_fungible_store::transfer`,
594874
- typeArguments: ["0x1::fungible_asset::Metadata"],
594875
- functionArguments: [
594876
- tokenAccount.token.contractAddress,
594877
- transaction.recipient,
594878
- transaction.amount.toString()
594879
- ]
594880
- };
594881
- }
594882
- if (tokenType === "coin") {
594883
- return {
594884
- function: `0x1::aptos_account::transfer_coins`,
594885
- typeArguments: [tokenAccount.token.contractAddress],
594886
- functionArguments: [transaction.recipient, transaction.amount.toString()]
594887
- };
594888
- }
594878
+ var getPayload = (args3) => {
594879
+ if (args3.tokenType !== void 0 && !isTokenType(args3.tokenType)) {
594880
+ throw new Error(`Token type ${args3.tokenType} not supported`);
594881
+ }
594882
+ if (args3.tokenType === TOKEN_TYPE.FUNGIBLE_ASSET) {
594883
+ return {
594884
+ function: "0x1::primary_fungible_store::transfer",
594885
+ typeArguments: ["0x1::fungible_asset::Metadata"],
594886
+ functionArguments: [args3.contractAddress, args3.recipient, args3.amount.toString()]
594887
+ };
594888
+ }
594889
+ let address4 = args3.contractAddress ?? "";
594890
+ if (address4 === "") {
594891
+ address4 = APTOS_ASSET_ID;
594889
594892
  }
594890
594893
  return {
594891
594894
  function: "0x1::aptos_account::transfer_coins",
594892
- typeArguments: [APTOS_ASSET_ID],
594893
- functionArguments: [transaction.recipient, transaction.amount.toString()]
594895
+ typeArguments: [address4],
594896
+ functionArguments: [args3.recipient, args3.amount.toString()]
594894
594897
  };
594895
594898
  };
594899
+ var isTokenType = (value5) => {
594900
+ return Object.values(TOKEN_TYPE).includes(value5);
594901
+ };
594896
594902
  var buildTransaction_default = buildTransaction;
594897
594903
 
594898
594904
  // ../../libs/coin-modules/coin-aptos/lib-es/bridge/getFeesForTransaction.js
@@ -804712,13 +804718,13 @@ var estimateMaxSpendable19 = async ({ account: account3, parentAccount, transact
804712
804718
  if (balance.eq(0))
804713
804719
  return balance;
804714
804720
  const accountInfo = await fetchAccountInfo(mainAccount.freshAddress);
804715
- const isTokenType = isTokenAccount(account3);
804721
+ const isTokenType2 = isTokenAccount(account3);
804716
804722
  if (transaction && !transaction.subAccountId) {
804717
- transaction.subAccountId = isTokenType ? account3.id : null;
804723
+ transaction.subAccountId = isTokenType2 ? account3.id : null;
804718
804724
  }
804719
804725
  let tokenAccountTxn = false;
804720
804726
  let subAccount;
804721
- if (isTokenType) {
804727
+ if (isTokenType2) {
804722
804728
  tokenAccountTxn = true;
804723
804729
  subAccount = account3;
804724
804730
  }
@@ -832398,9 +832404,13 @@ var SpeculosHttpTransport = class _SpeculosHttpTransport extends Transport {
832398
832404
  }).then((response) => {
832399
832405
  response.data.on("data", (chunk5) => {
832400
832406
  log2("speculos-event", chunk5.toString());
832401
- const split10 = chunk5.toString().replace("data: ", "");
832402
- const json2 = JSON.parse(split10);
832403
- transport.automationEvents.next(json2);
832407
+ chunk5.toString().split("\n").forEach((line) => {
832408
+ if (line.startsWith("data: ")) {
832409
+ const jsonStr = line.slice("data: ".length);
832410
+ const json2 = JSON.parse(jsonStr);
832411
+ transport.automationEvents.next(json2);
832412
+ }
832413
+ });
832404
832414
  });
832405
832415
  response.data.on("close", () => {
832406
832416
  log2("speculos-event", "close");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.18.4-nightly.4",
3
+ "version": "24.18.4-nightly.6",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",
@@ -56,7 +56,7 @@
56
56
  "ts-node": "10.9.2",
57
57
  "tsup": "7.3.0",
58
58
  "@ledgerhq/types-cryptoassets": "^7.23.0",
59
- "@ledgerhq/types-live": "^6.71.0-nightly.2"
59
+ "@ledgerhq/types-live": "^6.71.0-nightly.3"
60
60
  },
61
61
  "publishConfig": {
62
62
  "directory": "dist"