@haven-fi/solauto-sdk 1.0.447 → 1.0.448

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.
@@ -451,7 +451,7 @@ function getErrorInfo(umi, txs, error, simulationSuccessful) {
451
451
  let canBeIgnored = false;
452
452
  let errorName = undefined;
453
453
  let errorInfo = undefined;
454
- let errTxIdx;
454
+ let errTxIdx = 0;
455
455
  let errIxIdx;
456
456
  let errCode;
457
457
  let errName;
@@ -19,7 +19,6 @@ import { NATIVE_MINT } from "@solana/spl-token";
19
19
  import { toWeb3JsPublicKey } from "@metaplex-foundation/umi-web3js-adapters";
20
20
  import path from "path";
21
21
  import { config } from "dotenv";
22
- import { safeFetchMarginfiAccount } from "../src/marginfi-sdk";
23
22
 
24
23
  config({ path: path.join(__dirname, ".env") });
25
24
 
@@ -203,16 +202,17 @@ async function main(filterWhitelist: boolean) {
203
202
  );
204
203
 
205
204
  const repayFrom = pos.position.settingParams.repayToBps + pos.position.settingParams.repayGap;
206
- const unhealthy = pos.state.liqUtilizationRateBps > repayFrom;
207
- const healthText = unhealthy ? `(Unhealthy: ${pos.state.liqUtilizationRateBps - repayFrom}` : "";
205
+ const unhealthy = latestState.liqUtilizationRateBps > repayFrom;
206
+ const healthText = unhealthy ? `(Unhealthy: ${latestState.liqUtilizationRateBps - repayFrom}bps)` : "";
208
207
  if (unhealthy) {
209
208
  unhealthyPositions += 1;
210
209
  }
211
210
 
212
- console.log(pos.publicKey.toString(), `(${pos.authority.toString()})`);
211
+ console.log(pos.publicKey.toString(), `(${pos.authority.toString()} ${pos.positionId})`);
213
212
  console.log(
214
213
  `${strategy}: $${formatNumber(fromBaseUnit(latestState.netWorth.baseAmountUsdValue, USD_DECIMALS), 2, 10000, 2)} ${healthText}`
215
214
  );
215
+ // console.log(latestState.liqUtilizationRateBps, repayFrom);
216
216
  }
217
217
 
218
218
  console.log("\nTotal positions:", solautoPositionsData.length, unhealthyPositions ? ` (unhealthy: ${unhealthyPositions})` : "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.447",
3
+ "version": "1.0.448",
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",
@@ -845,7 +845,7 @@ export function getErrorInfo(
845
845
  let errorName: string | undefined = undefined;
846
846
  let errorInfo: string | undefined = undefined;
847
847
 
848
- let errTxIdx: number | undefined;
848
+ let errTxIdx: number = 0;
849
849
  let errIxIdx: number | undefined;
850
850
  let errCode: number | undefined;
851
851
  let errName: string | undefined;
@@ -34,19 +34,19 @@ import {
34
34
  getSolautoManagedPositions,
35
35
  } from "../../src/utils";
36
36
  import { PriorityFeeSetting } from "../../src/types";
37
+ import { buildIronforgeApiUrl } from "../../dist";
37
38
 
38
39
  describe("Solauto Marginfi tests", async () => {
39
40
  // const signer = setupTest();
40
41
  const signer = setupTest("solauto-manager");
41
42
 
42
- const payForTransactions = true;
43
+ const payForTransactions = false;
43
44
  const testProgram = false;
44
45
  const positionId = 1;
45
46
 
46
47
  it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
47
48
  const client = new SolautoMarginfiClient(
48
- // buildHeliusApiUrl(process.env.HELIUS_API_KEY!),
49
- "https://staked.helius-rpc.com?api-key=6a7423cf-35ef-44ce-b02b-02567f57d181",
49
+ buildIronforgeApiUrl(process.env.IRONFORGE_API_KEY!),
50
50
  true,
51
51
  testProgram ? SOLAUTO_TEST_PROGRAM : SOLAUTO_PROD_PROGRAM
52
52
  );
@@ -58,13 +58,13 @@ describe("Solauto Marginfi tests", async () => {
58
58
  await client.initialize({
59
59
  signer,
60
60
  positionId,
61
- authority: new PublicKey("5bFfSCsGUgEzYH8kwwRtFnWkKZ1by8uD8RHvKQPnQReB"),
61
+ authority: new PublicKey("He4ka5Q3N1UvZikZvykdi47xyk5PoVP2tcQL5sVp31Sz"),
62
62
  // new: true,
63
63
  // marginfiAccount: new PublicKey(
64
- // "4nNvUXF5YqHFcH2nGweSiuvy1ct7V5FXfoCLKFYUN36z"
64
+ // ""
65
65
  // ),
66
- // marginfiGroup: new PublicKey("G1rt3EpQ43K3bY457rhukQGRAo2QxydFAGRKqnjKzyr5"),
67
- // supplyMint: new PublicKey("3B5wuUrMEi5yATD7on46hKfej3pfmd7t1RKgrsN3pump"),
66
+ // marginfiGroup: new PublicKey(""),
67
+ // supplyMint: new PublicKey(""),
68
68
  // debtMint: new PublicKey(USDC),
69
69
  });
70
70
 
@@ -168,7 +168,7 @@ describe("Solauto Marginfi tests", async () => {
168
168
  client,
169
169
  undefined,
170
170
  !payForTransactions ? "only-simulate" : "normal",
171
- PriorityFeeSetting.High,
171
+ PriorityFeeSetting.Min,
172
172
  true
173
173
  ).clientSend(transactionItems);
174
174