@ledgerhq/live-cli 24.18.2-nightly.0 → 24.18.2-nightly.2

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 +50 -42
  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.34.0-nightly.0",
530286
+ version: "34.34.0-nightly.2",
530287
530287
  repository: {
530288
530288
  type: "git",
530289
530289
  url: "https://github.com/LedgerHQ/ledger-live.git"
@@ -537084,7 +537084,7 @@ var require_package9 = __commonJS({
537084
537084
  "package.json"(exports2, module2) {
537085
537085
  module2.exports = {
537086
537086
  name: "@ledgerhq/live-cli",
537087
- version: "24.18.2-nightly.0",
537087
+ version: "24.18.2-nightly.2",
537088
537088
  description: "ledger-live CLI version",
537089
537089
  repository: {
537090
537090
  type: "git",
@@ -594409,11 +594409,11 @@ gql["default"] = gql;
594409
594409
  // ../../node_modules/.pnpm/@apollo+client@3.12.6_graphql@16.10.0_react@18.3.1/node_modules/@apollo/client/core/index.js
594410
594410
  setVerbosity(globalThis.__DEV__ !== false ? "log" : "silent");
594411
594411
 
594412
- // ../../libs/coin-modules/coin-aptos/lib-es/api/index.js
594412
+ // ../../libs/coin-modules/coin-aptos/lib-es/network/client.js
594413
594413
  var import_bignumber54 = __toESM(require("bignumber.js"));
594414
594414
  var import_isUndefined = __toESM(require("lodash/isUndefined"));
594415
594415
 
594416
- // ../../libs/coin-modules/coin-aptos/lib-es/api/graphql/queries.js
594416
+ // ../../libs/coin-modules/coin-aptos/lib-es/network/graphql/queries.js
594417
594417
  var GetDelegatedStakingActivities = gql`
594418
594418
  query getDelegatedStakingActivities($delegatorAddress: String) {
594419
594419
  delegated_staking_activities(
@@ -594466,25 +594466,25 @@ var GetAccountTransactionsDataLt = gql`
594466
594466
  }
594467
594467
  `;
594468
594468
 
594469
- // ../../libs/coin-modules/coin-aptos/lib-es/api/index.js
594469
+ // ../../libs/coin-modules/coin-aptos/lib-es/network/client.js
594470
594470
  var getApiEndpoint = (currencyId) => isTestnet(currencyId) ? getEnv("APTOS_TESTNET_API_ENDPOINT") : getEnv("APTOS_API_ENDPOINT");
594471
594471
  var getIndexerEndpoint = (currencyId) => isTestnet(currencyId) ? getEnv("APTOS_TESTNET_INDEXER_ENDPOINT") : getEnv("APTOS_INDEXER_ENDPOINT");
594472
594472
  var AptosAPI = class {
594473
- apiUrl;
594474
- indexerUrl;
594475
594473
  aptosConfig;
594476
594474
  aptosClient;
594477
594475
  apolloClient;
594478
- constructor(currencyId) {
594479
- this.apiUrl = getApiEndpoint(currencyId);
594480
- this.indexerUrl = getIndexerEndpoint(currencyId);
594481
- this.aptosConfig = new l14({
594482
- fullnode: this.apiUrl,
594483
- indexer: this.indexerUrl
594484
- });
594476
+ constructor(currencyIdOrSettings) {
594477
+ if (typeof currencyIdOrSettings === "string") {
594478
+ this.aptosConfig = new l14({
594479
+ fullnode: getApiEndpoint(currencyIdOrSettings),
594480
+ indexer: getIndexerEndpoint(currencyIdOrSettings)
594481
+ });
594482
+ } else {
594483
+ this.aptosConfig = new l14(currencyIdOrSettings);
594484
+ }
594485
594485
  this.aptosClient = new t30(this.aptosConfig);
594486
594486
  this.apolloClient = new ApolloClient({
594487
- uri: this.indexerUrl,
594487
+ uri: this.aptosConfig.indexer || "",
594488
594488
  cache: new InMemoryCache(),
594489
594489
  headers: {
594490
594490
  "x-client": "ledger-live"
@@ -594562,6 +594562,15 @@ var AptosAPI = class {
594562
594562
  }
594563
594563
  return balance;
594564
594564
  }
594565
+ async getLastBlock() {
594566
+ const { block_height } = await this.aptosClient.getLedgerInfo();
594567
+ const block2 = await this.aptosClient.getBlockByHeight({ blockHeight: Number(block_height) });
594568
+ return {
594569
+ height: Number(block2.block_height),
594570
+ hash: block2.block_hash,
594571
+ time: new Date(Number(block2.block_timestamp))
594572
+ };
594573
+ }
594565
594574
  async getCoinBalance(address4, contract_address) {
594566
594575
  try {
594567
594576
  const [balanceStr] = await this.aptosClient.view({
@@ -594630,7 +594639,7 @@ var AptosAPI = class {
594630
594639
  async getHeight() {
594631
594640
  const { data: data6 } = await lib_es_default({
594632
594641
  method: "GET",
594633
- url: this.apiUrl
594642
+ url: this.aptosConfig.fullnode || ""
594634
594643
  });
594635
594644
  return parseInt(data6.block_height);
594636
594645
  }
@@ -594643,6 +594652,29 @@ var AptosAPI = class {
594643
594652
  }
594644
594653
  };
594645
594654
 
594655
+ // ../../libs/coin-modules/coin-aptos/lib-es/network/index.js
594656
+ async function signTransaction2(signerContext3, account3, deviceId, rawTxn) {
594657
+ const { freshAddressPath: derivationPath } = account3;
594658
+ if (!account3.xpub) {
594659
+ throw Error("Account must have a public signing key");
594660
+ }
594661
+ const publicKey3 = Buffer.from(l2.from(account3.xpub).toUint8Array());
594662
+ const hash12 = sha3_256.create();
594663
+ hash12.update(publicKey3.toString("hex"));
594664
+ hash12.update("\0");
594665
+ const signingMessage = S5({
594666
+ rawTransaction: rawTxn
594667
+ });
594668
+ const response = await signerContext3(deviceId, async (signer) => await signer.signTransaction(derivationPath, Buffer.from(signingMessage)));
594669
+ const sigHexStr = a.fromHexString(response.signature.toString("hex"));
594670
+ const signature3 = new h9(sigHexStr.toUint8Array());
594671
+ const authenticator = new u12(new f6(publicKey3.toString("hex")), signature3);
594672
+ return wn({
594673
+ transaction: { rawTransaction: rawTxn },
594674
+ senderAuthenticator: authenticator
594675
+ });
594676
+ }
594677
+
594646
594678
  // ../../libs/coin-modules/coin-aptos/lib-es/bridge/getFeesForTransaction.js
594647
594679
  init_lib_es2();
594648
594680
  var import_bignumber55 = __toESM(require("bignumber.js"));
@@ -594917,31 +594949,6 @@ var getAccountShape2 = async (info6) => {
594917
594949
  // ../../libs/coin-modules/coin-aptos/lib-es/bridge/signOperation.js
594918
594950
  var import_rxjs10 = require("rxjs");
594919
594951
  var import_bignumber59 = __toESM(require("bignumber.js"));
594920
-
594921
- // ../../libs/coin-modules/coin-aptos/lib-es/network/index.js
594922
- async function signTransaction2(signerContext3, account3, deviceId, rawTxn) {
594923
- const { freshAddressPath: derivationPath } = account3;
594924
- if (!account3.xpub) {
594925
- throw Error("Account must have a public signing key");
594926
- }
594927
- const publicKey3 = Buffer.from(l2.from(account3.xpub).toUint8Array());
594928
- const hash12 = sha3_256.create();
594929
- hash12.update(publicKey3.toString("hex"));
594930
- hash12.update("\0");
594931
- const signingMessage = S5({
594932
- rawTransaction: rawTxn
594933
- });
594934
- const response = await signerContext3(deviceId, async (signer) => await signer.signTransaction(derivationPath, Buffer.from(signingMessage)));
594935
- const sigHexStr = a.fromHexString(response.signature.toString("hex"));
594936
- const signature3 = new h9(sigHexStr.toUint8Array());
594937
- const authenticator = new u12(new f6(publicKey3.toString("hex")), signature3);
594938
- return wn({
594939
- transaction: { rawTransaction: rawTxn },
594940
- senderAuthenticator: authenticator
594941
- });
594942
- }
594943
-
594944
- // ../../libs/coin-modules/coin-aptos/lib-es/bridge/signOperation.js
594945
594952
  var buildSignOperation2 = (signerContext3) => ({ account: account3, transaction, deviceId }) => new import_rxjs10.Observable((o48) => {
594946
594953
  async function main2() {
594947
594954
  o48.next({ type: "device-signature-requested" });
@@ -595004,7 +595011,8 @@ var signOperation_default = buildSignOperation2;
595004
595011
  // ../../libs/coin-modules/coin-aptos/lib-es/bridge/broadcast.js
595005
595012
  var broadcast3 = async ({ signedOperation, account: account3 }) => {
595006
595013
  const { signature: signature3, operation } = signedOperation;
595007
- const hash12 = await new AptosAPI(account3.currency.id).broadcast(signature3);
595014
+ const client = new AptosAPI(account3.currency.id);
595015
+ const hash12 = await client.broadcast(signature3);
595008
595016
  return patchOperationWithHash(operation, hash12);
595009
595017
  };
595010
595018
  var broadcast_default = broadcast3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-cli",
3
- "version": "24.18.2-nightly.0",
3
+ "version": "24.18.2-nightly.2",
4
4
  "description": "ledger-live CLI version",
5
5
  "repository": {
6
6
  "type": "git",