@haven-fi/solauto-sdk 1.0.148 → 1.0.149

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"rebalanceUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/solauto/rebalanceUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,WAAW,EACX,aAAa,EAEb,yBAAyB,EACzB,SAAS,EACV,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAgJjD,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,yBAAyB,GAAG,SAAS,EAC/C,GAAG,EAAE,WAAW,GAAG,SAAS,EAC5B,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,eAAe,CAiEjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,aAAa,EACvB,cAAc,EAAE,MAAM,GACrB,gBAAgB,GAAG,SAAS,CAmE9B;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,aAAa,E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AA0B,CACxC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,eAAe,EACvB,2BAA2B,CAAC,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,cAAc,CAmChB"}
@@ -166,18 +166,18 @@ function getJupSwapRebalanceDetails(client, values, targetLiqUtilizationRateBps,
166
166
  ? (0, generalUtils_2.safeGetPrice)(client.debtMint)
167
167
  : (0, generalUtils_2.safeGetPrice)(client.supplyMint);
168
168
  const inputAmount = (0, numberUtils_1.toBaseUnit)(usdToSwap / inputPrice, input.decimals);
169
- const rebalancingToZero = targetLiqUtilizationRateBps === 0;
169
+ const exactOut = targetLiqUtilizationRateBps === 0;
170
170
  return {
171
171
  inputMint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(input.mint),
172
172
  outputMint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(output.mint),
173
173
  destinationWallet: client.solautoPosition,
174
174
  slippageIncFactor: 0.5 + (attemptNum ?? 0) * 0.2,
175
- amount: rebalancingToZero
175
+ amount: exactOut
176
176
  ? client.solautoPositionState.debt.amountUsed.baseUnit +
177
177
  BigInt(Math.round(Number(client.solautoPositionState.debt.amountUsed.baseUnit) *
178
178
  // Add this small percentage to account for the APR on the debt between now and the transaction
179
179
  0.0001))
180
- : inputAmount,
181
- exactOut: rebalancingToZero,
180
+ : BigInt(Math.round(Number(inputAmount) * 1.05)),
181
+ exactOut: exactOut,
182
182
  };
183
183
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.148",
3
+ "version": "1.0.149",
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,13 +342,14 @@ export function getJupSwapRebalanceDetails(
342
342
  : safeGetPrice(client.supplyMint);
343
343
  const inputAmount = toBaseUnit(usdToSwap / inputPrice!, input.decimals);
344
344
 
345
- const rebalancingToZero = targetLiqUtilizationRateBps === 0;
345
+ const exactOut = targetLiqUtilizationRateBps === 0;
346
+
346
347
  return {
347
348
  inputMint: toWeb3JsPublicKey(input.mint),
348
349
  outputMint: toWeb3JsPublicKey(output.mint),
349
350
  destinationWallet: client.solautoPosition,
350
351
  slippageIncFactor: 0.5 + (attemptNum ?? 0) * 0.2,
351
- amount: rebalancingToZero
352
+ amount: exactOut
352
353
  ? client.solautoPositionState!.debt.amountUsed.baseUnit +
353
354
  BigInt(
354
355
  Math.round(
@@ -357,7 +358,7 @@ export function getJupSwapRebalanceDetails(
357
358
  0.0001
358
359
  )
359
360
  )
360
- : inputAmount,
361
- exactOut: rebalancingToZero,
361
+ : BigInt(Math.round(Number(inputAmount) * 1.05)),
362
+ exactOut: exactOut,
362
363
  };
363
364
  }