@haven-fi/solauto-sdk 1.0.164 → 1.0.165

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,8 +53,8 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
53
53
  this.supplyPriceOracle = new web3_js_1.PublicKey(this.marginfiSupplyAccounts.priceOracle);
54
54
  this.debtPriceOracle = new web3_js_1.PublicKey(this.marginfiDebtAccounts.priceOracle);
55
55
  if (!this.solautoPositionState) {
56
- const [maxLtv, liqThreshold] = (await this.maxLtvAndLiqThreshold());
57
- this.solautoPositionState = (0, utils_1.createFakePositionState)({ mint: this.supplyMint }, { mint: this.debtMint }, (0, numberUtils_1.toBps)(maxLtv), (0, numberUtils_1.toBps)(liqThreshold));
56
+ const result = await this.maxLtvAndLiqThreshold();
57
+ this.solautoPositionState = (0, utils_1.createFakePositionState)({ mint: this.supplyMint }, { mint: this.debtMint }, result ? (0, numberUtils_1.toBps)(result[0]) : 0, result ? (0, numberUtils_1.toBps)(result[1]) : 0);
58
58
  }
59
59
  if (!this.initialized) {
60
60
  await this.setIntermediaryMarginfiDetails();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.164",
3
+ "version": "1.0.165",
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",
@@ -133,12 +133,12 @@ export class SolautoMarginfiClient extends SolautoClient {
133
133
  this.debtPriceOracle = new PublicKey(this.marginfiDebtAccounts.priceOracle);
134
134
 
135
135
  if (!this.solautoPositionState) {
136
- const [maxLtv, liqThreshold] = (await this.maxLtvAndLiqThreshold())!;
136
+ const result = await this.maxLtvAndLiqThreshold()!;
137
137
  this.solautoPositionState = createFakePositionState(
138
138
  { mint: this.supplyMint },
139
139
  { mint: this.debtMint },
140
- toBps(maxLtv),
141
- toBps(liqThreshold)
140
+ result ? toBps(result[0]) : 0,
141
+ result ? toBps(result[1]) : 0
142
142
  );
143
143
  }
144
144
 
@@ -21,10 +21,10 @@ import { USDC_MINT } from "../../src/constants";
21
21
  import { buildHeliusApiUrl } from "../../src/utils";
22
22
 
23
23
  describe("Solauto Marginfi tests", async () => {
24
- const signer = setupTest();
25
- // const signer = setupTest("solauto-manager");
24
+ // const signer = setupTest();
25
+ const signer = setupTest("solauto-manager");
26
26
 
27
- const payForTransactions = true;
27
+ const payForTransactions = false;
28
28
  const useJitoBundle = false;
29
29
  const positionId = 1;
30
30
 
@@ -124,7 +124,7 @@ describe("Solauto Marginfi tests", async () => {
124
124
  transactionItems.push(
125
125
  new TransactionItem(
126
126
  async (attemptNum) =>
127
- await buildSolautoRebalanceTransaction(client, 7200, attemptNum),
127
+ await buildSolautoRebalanceTransaction(client, undefined, attemptNum),
128
128
  "rebalance"
129
129
  )
130
130
  );