@haven-fi/solauto-sdk 1.0.709 → 1.0.710

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,6 +1,10 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
2
  export declare const StrategyTypes: readonly ["Long", "Short", "Ratio"];
3
3
  export type StrategyType = (typeof StrategyTypes)[number];
4
+ export declare function ratioMintDetails(supplyMint?: PublicKey, debtMint?: PublicKey): {
5
+ order: (PublicKey | undefined)[];
6
+ strategyName: string;
7
+ };
4
8
  export declare function ratioName(supplyMint?: PublicKey, debtMint?: PublicKey): string;
5
9
  export declare function solautoStrategyName(supplyMint?: PublicKey, debtMint?: PublicKey): string;
6
10
  export declare function strategyType(supplyMint: PublicKey, debtMint: PublicKey): StrategyType;
@@ -1 +1 @@
1
- {"version":3,"file":"stringUtils.d.ts","sourceRoot":"","sources":["../../src/utils/stringUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C,eAAO,MAAM,aAAa,qCAAsC,CAAC;AACjE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAc1D,wBAAgB,SAAS,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,SAAS,UAYrE;AAED,wBAAgB,mBAAmB,CACjC,UAAU,CAAC,EAAE,SAAS,EACtB,QAAQ,CAAC,EAAE,SAAS,UAcrB;AAED,wBAAgB,YAAY,CAC1B,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,SAAS,GAClB,YAAY,CAWd"}
1
+ {"version":3,"file":"stringUtils.d.ts","sourceRoot":"","sources":["../../src/utils/stringUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C,eAAO,MAAM,aAAa,qCAAsC,CAAC;AACjE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAc1D,wBAAgB,gBAAgB,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,SAAS;;;EAY5E;AAED,wBAAgB,SAAS,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,SAAS,UAGrE;AAED,wBAAgB,mBAAmB,CACjC,UAAU,CAAC,EAAE,SAAS,EACtB,QAAQ,CAAC,EAAE,SAAS,UAcrB;AAED,wBAAgB,YAAY,CAC1B,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,SAAS,GAClB,YAAY,CAWd"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StrategyTypes = void 0;
4
+ exports.ratioMintDetails = ratioMintDetails;
4
5
  exports.ratioName = ratioName;
5
6
  exports.solautoStrategyName = solautoStrategyName;
6
7
  exports.strategyType = strategyType;
@@ -21,18 +22,22 @@ function adjustedTicker(mint) {
21
22
  return info.ticker;
22
23
  }
23
24
  }
24
- function ratioName(supplyMint, debtMint) {
25
+ function ratioMintDetails(supplyMint, debtMint) {
25
26
  if (((0, generalUtils_1.tokenInfo)(supplyMint).isLST && debtMint?.equals(spl_token_1.NATIVE_MINT)) ||
26
27
  (supplyMint &&
27
28
  debtMint &&
28
29
  constants_1.MAJORS_PRIO[supplyMint?.toString() ?? ""] >
29
30
  constants_1.MAJORS_PRIO[debtMint?.toString() ?? ""])) {
30
- return `${adjustedTicker(supplyMint)}/${adjustedTicker(debtMint)} Long`;
31
+ return { order: [supplyMint, debtMint], strategyName: "Long" };
31
32
  }
32
33
  else {
33
- return `${adjustedTicker(debtMint)}/${adjustedTicker(supplyMint)} Short`;
34
+ return { order: [debtMint, supplyMint], strategyName: "Short" };
34
35
  }
35
36
  }
37
+ function ratioName(supplyMint, debtMint) {
38
+ const { order, strategyName } = ratioMintDetails(supplyMint, debtMint);
39
+ return `${adjustedTicker(order[0])}/${adjustedTicker(order[1])} ${strategyName}`;
40
+ }
36
41
  function solautoStrategyName(supplyMint, debtMint) {
37
42
  const strat = strategyType(supplyMint ?? web3_js_1.PublicKey.default, debtMint ?? web3_js_1.PublicKey.default);
38
43
  if (strat === "Long") {
@@ -7,7 +7,6 @@ import {
7
7
  getSolanaRpcConnection,
8
8
  getSolautoManagedPositions,
9
9
  LOCAL_IRONFORGE_API_URL,
10
- PRICES,
11
10
  ProgramEnv,
12
11
  SOLAUTO_PROD_PROGRAM,
13
12
  SOLAUTO_TEST_PROGRAM,
@@ -109,7 +108,6 @@ async function main(filterWhitelist: boolean, programEnv: ProgramEnv = "Prod") {
109
108
  )
110
109
  );
111
110
  await fetchTokenPrices(tokensUsed.map((x) => new PublicKey(x)));
112
- console.log(PRICES);
113
111
 
114
112
  console.log("\n\n");
115
113
 
@@ -122,7 +120,7 @@ async function main(filterWhitelist: boolean, programEnv: ProgramEnv = "Prod") {
122
120
  const repayFrom = pos.settings!.repayToBps + pos.settings!.repayGap;
123
121
  const unhealthy = actionToTake === "repay";
124
122
  const healthText = unhealthy
125
- ? `(Unhealthy: ${pos.state.liqUtilizationRateBps - repayFrom}bps)`
123
+ ? `(Unhealthy: ${pos.liqUtilizationRateBps() - repayFrom}bps)`
126
124
  : "";
127
125
  if (unhealthy) {
128
126
  unhealthyPositions += 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.709",
3
+ "version": "1.0.710",
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",
@@ -18,7 +18,7 @@ function adjustedTicker(mint?: PublicKey) {
18
18
  }
19
19
  }
20
20
 
21
- export function ratioName(supplyMint?: PublicKey, debtMint?: PublicKey) {
21
+ export function ratioMintDetails(supplyMint?: PublicKey, debtMint?: PublicKey) {
22
22
  if (
23
23
  (tokenInfo(supplyMint).isLST && debtMint?.equals(NATIVE_MINT)) ||
24
24
  (supplyMint &&
@@ -26,12 +26,17 @@ export function ratioName(supplyMint?: PublicKey, debtMint?: PublicKey) {
26
26
  MAJORS_PRIO[supplyMint?.toString() ?? ""] >
27
27
  MAJORS_PRIO[debtMint?.toString() ?? ""])
28
28
  ) {
29
- return `${adjustedTicker(supplyMint)}/${adjustedTicker(debtMint)} Long`;
29
+ return { order: [supplyMint, debtMint], strategyName: "Long" };
30
30
  } else {
31
- return `${adjustedTicker(debtMint)}/${adjustedTicker(supplyMint)} Short`;
31
+ return { order: [debtMint, supplyMint], strategyName: "Short" };
32
32
  }
33
33
  }
34
34
 
35
+ export function ratioName(supplyMint?: PublicKey, debtMint?: PublicKey) {
36
+ const { order, strategyName } = ratioMintDetails(supplyMint, debtMint);
37
+ return `${adjustedTicker(order[0])}/${adjustedTicker(order[1])} ${strategyName}`;
38
+ }
39
+
35
40
  export function solautoStrategyName(
36
41
  supplyMint?: PublicKey,
37
42
  debtMint?: PublicKey