@haven-fi/solauto-sdk 1.0.335 → 1.0.337

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.
@@ -355,12 +355,12 @@ class TransactionsManager {
355
355
  txSigs = await (0, jitoUtils_1.sendJitoBundledTransactions)(this.txHandler.umi, this.txHandler.connection, this.txHandler.signer, transactions, this.txType, this.priorityFeeSetting);
356
356
  }
357
357
  catch (e) {
358
- error = e.message;
358
+ error = e;
359
359
  }
360
360
  if (error || !Boolean(txSigs) || txSigs?.length === 0) {
361
- this.updateStatusForSets(itemSets, TransactionStatus.Failed, attemptNum, txSigs, true, error);
361
+ this.updateStatusForSets(itemSets, TransactionStatus.Failed, attemptNum, txSigs, true, error?.message);
362
362
  if (error) {
363
- throw new Error(error ? error : "Unknown error");
363
+ throw error ? error : new Error("Unknown error");
364
364
  }
365
365
  }
366
366
  this.updateStatusForSets(itemSets, TransactionStatus.Successful, attemptNum, txSigs);
@@ -51,11 +51,11 @@ async function getTipInstruction(signer, tipLamports) {
51
51
  // );
52
52
  // }
53
53
  async function umiToVersionedTransactions(umi, signer, txs, sign, feeEstimates, computeUnitLimits) {
54
- const builtTxs = await Promise.all(txs.map(async (tx, i) => {
54
+ let builtTxs = await Promise.all(txs.map(async (tx, i) => {
55
55
  return (await (0, solanaUtils_1.assembleFinalTransaction)(signer, tx, feeEstimates ? feeEstimates[i] : undefined, computeUnitLimits ? computeUnitLimits[i] : undefined).setLatestBlockhash(umi)).build(umi);
56
56
  }));
57
57
  if (sign) {
58
- await signer.signAllTransactions(builtTxs);
58
+ builtTxs = await signer.signAllTransactions(builtTxs);
59
59
  }
60
60
  return builtTxs.map((x) => (0, umi_web3js_adapters_1.toWeb3JsTransaction)(x));
61
61
  }
@@ -98,7 +98,7 @@ function eligibleForRebalance(positionState, positionSettings, positionDca, curr
98
98
  0.95 >
99
99
  values.debtAdjustmentUsd;
100
100
  if (!sufficientLiquidity) {
101
- console.log("Insufficient debt liquidity to further boost");
101
+ (0, generalUtils_1.consoleLog)("Insufficient debt liquidity to further boost");
102
102
  }
103
103
  return sufficientLiquidity ? "boost" : undefined;
104
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.335",
3
+ "version": "1.0.337",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
@@ -554,7 +554,7 @@ export class TransactionsManager {
554
554
  );
555
555
 
556
556
  let txSigs: string[] | undefined;
557
- let error: string | undefined;
557
+ let error: Error | undefined;
558
558
  try {
559
559
  txSigs = await sendJitoBundledTransactions(
560
560
  this.txHandler.umi,
@@ -565,7 +565,7 @@ export class TransactionsManager {
565
565
  this.priorityFeeSetting
566
566
  );
567
567
  } catch (e: any) {
568
- error = e.message;
568
+ error = e as Error;
569
569
  }
570
570
 
571
571
  if (error || !Boolean(txSigs) || txSigs?.length === 0) {
@@ -575,10 +575,10 @@ export class TransactionsManager {
575
575
  attemptNum,
576
576
  txSigs,
577
577
  true,
578
- error
578
+ error?.message
579
579
  );
580
580
  if (error) {
581
- throw new Error(error ? error : "Unknown error");
581
+ throw error ? error : new Error("Unknown error");
582
582
  }
583
583
  }
584
584
 
@@ -74,7 +74,7 @@ async function umiToVersionedTransactions(
74
74
  feeEstimates?: number[],
75
75
  computeUnitLimits?: number[]
76
76
  ): Promise<VersionedTransaction[]> {
77
- const builtTxs = await Promise.all(
77
+ let builtTxs = await Promise.all(
78
78
  txs.map(async (tx, i) => {
79
79
  return (
80
80
  await assembleFinalTransaction(
@@ -88,7 +88,7 @@ async function umiToVersionedTransactions(
88
88
  );
89
89
 
90
90
  if (sign) {
91
- await signer.signAllTransactions(builtTxs);
91
+ builtTxs = await signer.signAllTransactions(builtTxs);
92
92
  }
93
93
 
94
94
  return builtTxs.map((x) => toWeb3JsTransaction(x));
@@ -22,7 +22,7 @@ import {
22
22
  getSolautoPositionAccountDataSerializer,
23
23
  getSolautoPositionSize,
24
24
  } from "../../generated";
25
- import { currentUnixSeconds } from "../generalUtils";
25
+ import { consoleLog, currentUnixSeconds } from "../generalUtils";
26
26
  import {
27
27
  fromBaseUnit,
28
28
  getLiqUtilzationRateBps,
@@ -184,7 +184,7 @@ export function eligibleForRebalance(
184
184
  0.95 >
185
185
  values.debtAdjustmentUsd;
186
186
  if (!sufficientLiquidity) {
187
- console.log("Insufficient debt liquidity to further boost");
187
+ consoleLog("Insufficient debt liquidity to further boost");
188
188
  }
189
189
  return sufficientLiquidity ? "boost" : undefined;
190
190
  }