@haven-fi/solauto-sdk 1.0.251 → 1.0.253

Sign up to get free protection for your applications and to get access to all the features.
@@ -239,8 +239,8 @@ class TransactionsManager {
239
239
  this.updateStatus(itemSet.name(), TransactionStatus.Queued, 0);
240
240
  });
241
241
  }
242
- async updateLut(tx) {
243
- const updateLutTxName = "create lookup table";
242
+ async updateLut(tx, newLut) {
243
+ const updateLutTxName = `${newLut ? "create" : "update"} lookup table`;
244
244
  await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum, prevError) => await this.sendTransaction(tx, updateLutTxName, attemptNum, this.getUpdatedPriorityFeeSetting(prevError)), 3, 150, this.errorsToThrow);
245
245
  }
246
246
  async clientSend(transactions) {
@@ -260,8 +260,8 @@ class TransactionsManager {
260
260
  }, 0);
261
261
  isolatedLutTx = Boolean(newAccountsUsage);
262
262
  }
263
- if (updateLookupTable && updateLookupTable?.new) {
264
- await this.updateLut(updateLookupTable.tx);
263
+ if (updateLookupTable && isolatedLutTx) {
264
+ await this.updateLut(updateLookupTable.tx, updateLookupTable.new);
265
265
  }
266
266
  this.lookupTables.defaultLuts = client.defaultLookupTables();
267
267
  if (!items[0].initialized || (updateLookupTable && isolatedLutTx)) {
@@ -150,7 +150,7 @@ function getJupSwapRebalanceDetails(client, values, targetLiqUtilizationRateBps,
150
150
  ? output.amountUsed.baseUnit +
151
151
  BigInt(Math.round(Number(output.amountUsed.baseUnit) *
152
152
  // Add this small percentage to account for the APR on the debt between now and the transaction
153
- 0.00001))
153
+ 0.0001))
154
154
  : (0, numberUtils_1.toBaseUnit)(usdToSwap / (0, generalUtils_2.safeGetPrice)(output.mint), output.decimals);
155
155
  const exactOut = targetLiqUtilizationRateBps === 0 || values.repayingCloseToMaxLtv;
156
156
  const exactIn = !exactOut;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.251",
3
+ "version": "1.0.253",
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",
@@ -342,8 +342,8 @@ export class TransactionsManager {
342
342
  });
343
343
  }
344
344
 
345
- private async updateLut(tx: TransactionBuilder) {
346
- const updateLutTxName = "create lookup table";
345
+ private async updateLut(tx: TransactionBuilder, newLut: boolean) {
346
+ const updateLutTxName = `${newLut ? "create" : "update"} lookup table`;
347
347
  await retryWithExponentialBackoff(
348
348
  async (attemptNum, prevError) =>
349
349
  await this.sendTransaction(
@@ -383,8 +383,8 @@ export class TransactionsManager {
383
383
  }, 0);
384
384
  isolatedLutTx = Boolean(newAccountsUsage);
385
385
  }
386
- if (updateLookupTable && updateLookupTable?.new) {
387
- await this.updateLut(updateLookupTable.tx);
386
+ if (updateLookupTable && isolatedLutTx) {
387
+ await this.updateLut(updateLookupTable.tx, updateLookupTable.new);
388
388
  }
389
389
  this.lookupTables.defaultLuts = client.defaultLookupTables();
390
390
 
@@ -325,7 +325,7 @@ export function getJupSwapRebalanceDetails(
325
325
  Math.round(
326
326
  Number(output.amountUsed.baseUnit) *
327
327
  // Add this small percentage to account for the APR on the debt between now and the transaction
328
- 0.00001
328
+ 0.0001
329
329
  )
330
330
  )
331
331
  : toBaseUnit(usdToSwap / safeGetPrice(output.mint)!, output.decimals);