@haven-fi/solauto-sdk 1.0.188 → 1.0.190

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"marginfiUtils.d.ts","sourceRoot":"","sources":["../../src/utils/marginfiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EACL,IAAI,EAKL,MAAM,iBAAiB,CAAC;AAczB,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,GAAG,qBAAqB,CAU3E;AAED,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,GAAG,EACR,MAAM,EAAE;IACN,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB,EACD,IAAI,EAAE;IACJ,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB,EACD,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA+D3B;AAED,wBAAsB,iCAAiC,CACrD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CACR;IAAE,eAAe,EAAE,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,EAAE,CAC/E,CAwDA;AAgED,wBAAsB,+BAA+B,CACnD,GAAG,EAAE,GAAG,EACR,iBAAiB,EAAE,SAAS,EAC5B,UAAU,CAAC,EAAE,SAAS,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AS,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,EAAE,CAC/E,CAwDA;AAgED,wBAAsB,+BAA+B,CACnD,GAAG,EAAE,GAAG,EACR,iBAAiB,EAAE,SAAS,EAC5B,UAAU,CAAC,EAAE,SAAS,EACtB,QAAQ,CAAC,EAAE,SAAS,EACpB,mBAAmB,CAAC,EAAE,mBAAmB,GACxC,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CA6JpC;AA+DD,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAyB3B"}
@@ -13,6 +13,7 @@ const generalUtils_1 = require("./generalUtils");
13
13
  const numberUtils_1 = require("./numberUtils");
14
14
  const marginfiAccounts_1 = require("../constants/marginfiAccounts");
15
15
  const generalAccounts_1 = require("../constants/generalAccounts");
16
+ const constants_1 = require("../constants");
16
17
  function findMarginfiAccounts(bank) {
17
18
  for (const key in marginfiAccounts_1.MARGINFI_ACCOUNTS) {
18
19
  const account = marginfiAccounts_1.MARGINFI_ACCOUNTS[key];
@@ -182,6 +183,10 @@ async function getMarginfiAccountPositionState(umi, marginfiAccountPk, supplyMin
182
183
  if (!supplyUsage) {
183
184
  supplyUsage = await getTokenUsage(umi, supplyBank, true, 0, livePositionUpdates?.supplyAdjustment);
184
185
  }
186
+ if (constants_1.TOKEN_INFO[supplyBank.mint.toString()].isStableCoin &&
187
+ (debtBank === null || constants_1.TOKEN_INFO[debtBank.mint.toString()].isStableCoin)) {
188
+ return undefined;
189
+ }
185
190
  if (!debtUsage) {
186
191
  debtUsage = await getTokenUsage(umi, debtBank, false, 0, livePositionUpdates?.debtAdjustment);
187
192
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.188",
3
+ "version": "1.0.190",
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",
@@ -25,6 +25,7 @@ import { MarginfiAssetAccounts } from "../types/accounts";
25
25
  import { PositionState, PositionTokenUsage } from "../generated";
26
26
  import { USD_DECIMALS } from "../constants/generalAccounts";
27
27
  import { LivePositionUpdates } from "./solauto/generalUtils";
28
+ import { TOKEN_INFO } from "../constants";
28
29
 
29
30
  export function findMarginfiAccounts(bank: PublicKey): MarginfiAssetAccounts {
30
31
  for (const key in MARGINFI_ACCOUNTS) {
@@ -342,6 +343,13 @@ export async function getMarginfiAccountPositionState(
342
343
  );
343
344
  }
344
345
 
346
+ if (
347
+ TOKEN_INFO[supplyBank.mint.toString()].isStableCoin &&
348
+ (debtBank === null || TOKEN_INFO[debtBank.mint.toString()].isStableCoin)
349
+ ) {
350
+ return undefined;
351
+ }
352
+
345
353
  if (!debtUsage) {
346
354
  debtUsage = await getTokenUsage(
347
355
  umi,
@@ -18,7 +18,7 @@ import {
18
18
  } from "../../src/transactions/transactionsManager";
19
19
  import { PublicKey } from "@solana/web3.js";
20
20
  import { USDC_MINT } from "../../src/constants";
21
- import { buildHeliusApiUrl } from "../../src/utils";
21
+ import { buildHeliusApiUrl, getMarginfiAccountPositionState } from "../../src/utils";
22
22
 
23
23
  describe("Solauto Marginfi tests", async () => {
24
24
  // const signer = setupTest();
@@ -159,11 +159,13 @@ describe("Solauto Marginfi tests", async () => {
159
159
  // )
160
160
  // );
161
161
 
162
- await new TransactionsManager(
163
- client,
164
- undefined,
165
- !payForTransactions ? "only-simulate" : "normal",
166
- useJitoBundle
167
- ).clientSend(transactionItems);
162
+ // await new TransactionsManager(
163
+ // client,
164
+ // undefined,
165
+ // !payForTransactions ? "only-simulate" : "normal",
166
+ // useJitoBundle
167
+ // ).clientSend(transactionItems);
168
+
169
+ console.log(await getMarginfiAccountPositionState(client.umi, new PublicKey("8SZUhT1Jwiz1LKkeSsBwvwZyKH1UrzW3r8yiC6R3LLf7")));
168
170
  });
169
171
  });