@haven-fi/solauto-sdk 1.0.477 → 1.0.478

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.
@@ -60,7 +60,7 @@ async function getJupSwapTransaction(signer, swapDetails, attemptNum) {
60
60
  (0, generalUtils_1.consoleLog)("Increased price impact bps:", finalPriceImpactBps);
61
61
  if (swapDetails.addPadding) {
62
62
  (0, generalUtils_1.consoleLog)("Raw inAmount:", quoteResponse.inAmount);
63
- const inc = Math.max((0, numberUtils_1.fromBps)(finalPriceImpactBps) * 1.1, (0, numberUtils_1.fromBps)(finalPriceSlippageBps) * 0.05);
63
+ const inc = Math.max((0, numberUtils_1.fromBps)(finalPriceImpactBps) * 1.1, (0, numberUtils_1.fromBps)(finalPriceSlippageBps) * 0.025);
64
64
  (0, generalUtils_1.consoleLog)("Inc:", inc);
65
65
  quoteResponse.inAmount = Math.round(parseInt(quoteResponse.inAmount) + parseInt(quoteResponse.inAmount) * inc).toString();
66
66
  (0, generalUtils_1.consoleLog)("Increased inAmount:", quoteResponse.inAmount);
@@ -180,7 +180,13 @@ async function main(filterWhitelist: boolean) {
180
180
  );
181
181
  })
182
182
  )
183
- ).flat();
183
+ )
184
+ .flat()
185
+ .sort(
186
+ (a, b) =>
187
+ fromBaseUnit(a.state.netWorth.baseAmountUsdValue, USD_DECIMALS) -
188
+ fromBaseUnit(b.state.netWorth.baseAmountUsdValue, USD_DECIMALS)
189
+ );
184
190
 
185
191
  const tokensUsed = Array.from(
186
192
  new Set(
@@ -205,6 +211,11 @@ async function main(filterWhitelist: boolean) {
205
211
  let awaitingBoostPositions = 0;
206
212
 
207
213
  for (const pos of solautoPositionsData) {
214
+ const strategy = solautoStrategyName(
215
+ toWeb3JsPublicKey(pos.state.supply.mint),
216
+ toWeb3JsPublicKey(pos.state.debt.mint)
217
+ );
218
+
208
219
  const latestState = await positionStateWithLatestPrices(
209
220
  pos.state,
210
221
  safeGetPrice(pos.state.supply.mint),
@@ -212,18 +223,13 @@ async function main(filterWhitelist: boolean) {
212
223
  );
213
224
  latestStates.push(latestState);
214
225
 
215
- const strategy = solautoStrategyName(
216
- toWeb3JsPublicKey(pos.state.supply.mint),
217
- toWeb3JsPublicKey(pos.state.debt.mint)
218
- );
219
-
220
226
  const actionToTake = eligibleForRebalance(
221
- pos.state,
227
+ latestState,
222
228
  pos.position.settingParams,
223
229
  pos.position.dca,
224
230
  currentUnixSeconds(),
225
- safeGetPrice(pos.state.supply.mint)!,
226
- safeGetPrice(pos.state.debt.mint)!,
231
+ safeGetPrice(latestState.supply.mint)!,
232
+ safeGetPrice(latestState.debt.mint)!,
227
233
  0
228
234
  );
229
235
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.477",
3
+ "version": "1.0.478",
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",
@@ -119,7 +119,7 @@ export async function getJupSwapTransaction(
119
119
  consoleLog("Raw inAmount:", quoteResponse.inAmount);
120
120
  const inc = Math.max(
121
121
  fromBps(finalPriceImpactBps) * 1.1,
122
- fromBps(finalPriceSlippageBps) * 0.05
122
+ fromBps(finalPriceSlippageBps) * 0.025
123
123
  );
124
124
  consoleLog("Inc:", inc);
125
125
  quoteResponse.inAmount = Math.round(