@haven-fi/solauto-sdk 1.0.187 → 1.0.189

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,CA0JpC;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,9 @@ 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[(0, umi_web3js_adapters_1.toWeb3JsPublicKey)(supplyBank.mint).toString()].isStableCoin && debtBank === null) {
187
+ return undefined;
188
+ }
185
189
  if (!debtUsage) {
186
190
  debtUsage = await getTokenUsage(umi, debtBank, false, 0, livePositionUpdates?.debtAdjustment);
187
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.187",
3
+ "version": "1.0.189",
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,10 @@ export async function getMarginfiAccountPositionState(
342
343
  );
343
344
  }
344
345
 
346
+ if (TOKEN_INFO[toWeb3JsPublicKey(supplyBank.mint).toString()].isStableCoin && debtBank === null) {
347
+ return undefined;
348
+ }
349
+
345
350
  if (!debtUsage) {
346
351
  debtUsage = await getTokenUsage(
347
352
  umi,
@@ -31,8 +31,7 @@ describe("Solauto Marginfi tests", async () => {
31
31
  it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
32
32
 
33
33
  const client = new SolautoMarginfiClient(
34
- // buildHeliusApiUrl(process.env.HELIUS_API_KEY!),
35
- "https://rpc.ironforge.network/mainnet?apiKey=01HXAPSF0WWCD3N9TXZMD1VBYM",
34
+ buildHeliusApiUrl(process.env.HELIUS_API_KEY!),
36
35
  true
37
36
  );
38
37