@haven-fi/solauto-sdk 1.0.753 → 1.0.755

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.
@@ -1 +1 @@
1
- {"version":3,"file":"rebalanceSwapManager.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceSwapManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAkB,UAAU,EAAa,MAAM,SAAS,CAAC;AAChE,OAAO,EAA0B,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAiC,MAAM,iBAAiB,CAAC;AAY3E,qBAAa,oBAAoB;IAS7B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,2BAA2B,CAAC;IACpC,OAAO,CAAC,SAAS,CAAC;IAZb,UAAU,EAAG,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IAE/B,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,aAAa,CAAU;gBAGrB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,eAAe,EACvB,cAAc,CAAC,EAAE,qBAAqB,YAAA,EACtC,2BAA2B,CAAC,EAAE,MAAM,YAAA,EACpC,SAAS,CAAC,EAAE,SAAS,YAAA;IAU/B,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,WAAW;IAsCnB,OAAO,CAAC,kCAAkC;YAsE5B,mBAAmB;IA4CjC,OAAO,CAAC,mBAAmB;IAIrB,aAAa,CAAC,UAAU,EAAE,MAAM;IAwEhC,aAAa;;;;;;CAWpB"}
1
+ {"version":3,"file":"rebalanceSwapManager.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceSwapManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAkB,UAAU,EAAa,MAAM,SAAS,CAAC;AAChE,OAAO,EAA0B,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAiC,MAAM,iBAAiB,CAAC;AAY3E,qBAAa,oBAAoB;IAS7B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,2BAA2B,CAAC;IACpC,OAAO,CAAC,SAAS,CAAC;IAZb,UAAU,EAAG,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IAE/B,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,aAAa,CAAU;gBAGrB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,eAAe,EACvB,cAAc,CAAC,EAAE,qBAAqB,YAAA,EACtC,2BAA2B,CAAC,EAAE,MAAM,YAAA,EACpC,SAAS,CAAC,EAAE,SAAS,YAAA;IAU/B,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,WAAW;IAsCnB,OAAO,CAAC,kCAAkC;YAsE5B,mBAAmB;IA4CjC,OAAO,CAAC,mBAAmB;IAIrB,aAAa,CAAC,UAAU,EAAE,MAAM;IAmEhC,aAAa;;;;;;CAWpB"}
@@ -124,8 +124,7 @@ class RebalanceSwapManager {
124
124
  let { input, output, biasedOutputPrice, inputAmount } = this.swapDetails();
125
125
  let outputAmount = rebalanceToZero
126
126
  ? output.amountUsed.baseUnit +
127
- BigInt(Math.round(Number(output.amountUsed.baseUnit) *
128
- ((0, utils_1.fromBps)(this.solautoFeeBps) + 0.0001)))
127
+ BigInt(Math.round(Number(output.amountUsed.baseUnit) * 0.0001))
129
128
  : (0, utils_1.toBaseUnit)(this.usdToSwap() / biasedOutputPrice, output.decimals);
130
129
  const flashLoanRepayFromDebt = !this.isBoost() &&
131
130
  this.flRequirements &&
@@ -64,7 +64,7 @@ class TransactionsManager {
64
64
  ]);
65
65
  for (let j = i; j >= 0; j--) {
66
66
  const tx = txItems[j];
67
- if ((await newSet.fitsWith(tx))) {
67
+ if ((await newSet.fitsWith(tx)) && !tx.name?.includes("rebalance")) {
68
68
  newSet.prepend(tx);
69
69
  i--;
70
70
  }
@@ -1,9 +1,10 @@
1
1
  import { Keypair, PublicKey } from "@solana/web3.js";
2
- import { createSignerFromKeypair } from "@metaplex-foundation/umi";
2
+ import { createSignerFromKeypair, publicKey } from "@metaplex-foundation/umi";
3
3
  import { fromWeb3JsKeypair } from "@metaplex-foundation/umi-web3js-adapters";
4
4
  import {
5
5
  ClientTransactionsManager,
6
6
  consoleLog,
7
+ fetchSolautoPosition,
7
8
  getBatches,
8
9
  getClient,
9
10
  getPositionExBulk,
@@ -47,14 +48,14 @@ export async function main() {
47
48
  });
48
49
 
49
50
  await client.initializeExistingSolautoPosition({
50
- positionId: 2,
51
- authority: new PublicKey("EBhRj7jbF2EVE21i19JSuCX1BAbnZFYhoKW64HnaZ3kf"),
51
+ positionId: 1,
52
+ authority: new PublicKey("HqpPtE5WbBh3xU9C1Tzz125iYDQyoyodvFCRpwHwQpNc"),
52
53
  // lpUserAccount: new PublicKey(
53
54
  // "GEokw9jqbh6d1xUNA3qaeYFFetbSR5Y1nt7C3chwwgSz"
54
55
  // ),
55
56
  });
56
57
 
57
- const transactionItems = [rebalance(client)];
58
+ const transactionItems = [rebalance(client, undefined, 150)];
58
59
 
59
60
  const txManager = new ClientTransactionsManager({
60
61
  txHandler: client,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.753",
3
+ "version": "1.0.755",
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",
@@ -209,12 +209,7 @@ export class RebalanceSwapManager {
209
209
 
210
210
  let outputAmount = rebalanceToZero
211
211
  ? output.amountUsed.baseUnit +
212
- BigInt(
213
- Math.round(
214
- Number(output.amountUsed.baseUnit) *
215
- (fromBps(this.solautoFeeBps) + 0.0001)
216
- )
217
- )
212
+ BigInt(Math.round(Number(output.amountUsed.baseUnit) * 0.0001))
218
213
  : toBaseUnit(this.usdToSwap() / biasedOutputPrice, output.decimals);
219
214
 
220
215
  const flashLoanRepayFromDebt =
@@ -126,7 +126,7 @@ export class TransactionsManager<T extends TxHandler> {
126
126
  ]);
127
127
  for (let j = i; j >= 0; j--) {
128
128
  const tx = txItems[j];
129
- if ((await newSet.fitsWith(tx))) {
129
+ if ((await newSet.fitsWith(tx)) && !tx.name?.includes("rebalance")) {
130
130
  newSet.prepend(tx);
131
131
  i--;
132
132
  } else {