@haven-fi/solauto-sdk 1.0.109 → 1.0.111

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.
@@ -119,7 +119,7 @@ async function rebalanceChoresBefore(client, tx, accountsGettingCreated) {
119
119
  if (rebalanceInstructions.length === 0) {
120
120
  return (0, umi_1.transactionBuilder)();
121
121
  }
122
- const usesAccount = (key) => rebalanceInstructions.some((t) => t.keys.some((k) => (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(k.pubkey).equals(key)));
122
+ const usesAccount = (key) => tx.getInstructions().some((t) => t.keys.some((k) => (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(k.pubkey).equals(key)));
123
123
  const checkReferralSupplyTa = client.referredBySupplyTa && usesAccount(client.referredBySupplyTa);
124
124
  const checkSolautoFeesTa = usesAccount(client.solautoFeesSupplyTa);
125
125
  const checkIntermediaryMfiAccount = client.lendingPlatform === generated_1.LendingPlatform.Marginfi &&
@@ -32,7 +32,7 @@ async function getJupSwapTransaction(signer, swapDetails, attemptNum) {
32
32
  ? "ExactIn"
33
33
  : undefined,
34
34
  slippageBps: 10,
35
- maxAccounts: 60,
35
+ maxAccounts: !swapDetails.exactOut ? 60 : undefined,
36
36
  }), 3);
37
37
  const finalPriceSlippageBps = Math.round(Math.max(50, quoteResponse.slippageBps, Math.round((0, numberUtils_1.toBps)(parseFloat(quoteResponse.priceImpactPct))) + 1) *
38
38
  (1 + (swapDetails.slippageBpsIncFactor ?? 0)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.109",
3
+ "version": "1.0.111",
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",
@@ -235,10 +235,10 @@ export async function rebalanceChoresBefore(
235
235
  }
236
236
 
237
237
  const usesAccount = (key: PublicKey) =>
238
- rebalanceInstructions.some((t) =>
238
+ tx.getInstructions().some((t) =>
239
239
  t.keys.some((k) => toWeb3JsPublicKey(k.pubkey).equals(key))
240
240
  );
241
-
241
+
242
242
  const checkReferralSupplyTa =
243
243
  client.referredBySupplyTa && usesAccount(client.referredBySupplyTa);
244
244
  const checkSolautoFeesTa = usesAccount(client.solautoFeesSupplyTa);
@@ -66,7 +66,7 @@ export async function getJupSwapTransaction(
66
66
  ? "ExactIn"
67
67
  : undefined,
68
68
  slippageBps: 10,
69
- maxAccounts: 60,
69
+ maxAccounts: !swapDetails.exactOut ? 60 : undefined,
70
70
  }),
71
71
  3
72
72
  );
@@ -20,12 +20,12 @@ import { PublicKey } from "@solana/web3.js";
20
20
  import { USDC_MINT } from "../../src/constants";
21
21
 
22
22
  describe("Solauto Marginfi tests", async () => {
23
- // const signer = setupTest();
24
- const signer = setupTest("solauto-manager");
23
+ const signer = setupTest();
24
+ // const signer = setupTest("solauto-manager");
25
25
 
26
26
  const payForTransactions = false;
27
27
  const useJitoBundle = false;
28
- const positionId = 255;
28
+ const positionId = 1;
29
29
 
30
30
  it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
31
31
 
@@ -39,7 +39,7 @@ describe("Solauto Marginfi tests", async () => {
39
39
  {
40
40
  signer,
41
41
  positionId,
42
- authority: new PublicKey("92xmP49BQycn3t2HkGxLAweN3jjrExxSNpywA3xF7mYY")
42
+ // authority: new PublicKey("92xmP49BQycn3t2HkGxLAweN3jjrExxSNpywA3xF7mYY")
43
43
  // marginfiAccount: new PublicKey(
44
44
  // "4nNvUXF5YqHFcH2nGweSiuvy1ct7V5FXfoCLKFYUN36z"
45
45
  // ),
@@ -123,7 +123,7 @@ describe("Solauto Marginfi tests", async () => {
123
123
  transactionItems.push(
124
124
  new TransactionItem(
125
125
  async (attemptNum) =>
126
- await buildSolautoRebalanceTransaction(client, undefined, attemptNum),
126
+ await buildSolautoRebalanceTransaction(client, 1500, attemptNum),
127
127
  "rebalance"
128
128
  )
129
129
  );