@haven-fi/solauto-sdk 1.0.461 → 1.0.462

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.
@@ -127,7 +127,7 @@ function getBankLiquidityAvailableBaseUnit(bank, availableToDeposit) {
127
127
  const totalBorrowed = (0, numberUtils_1.bytesToI80F48)(bank.totalLiabilityShares.value) * liabilityShareValue;
128
128
  amountCanBeUsed = availableToDeposit
129
129
  ? Number(bank.config.depositLimit) - totalDeposited
130
- : Math.min(totalDeposited - totalBorrowed, Number(bank.config.borrowLimit) - totalBorrowed);
130
+ : Math.min(totalDeposited - totalBorrowed, Math.max(0, Number(bank.config.borrowLimit) - totalBorrowed));
131
131
  }
132
132
  return BigInt(Math.round(amountCanBeUsed));
133
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.461",
3
+ "version": "1.0.462",
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,7 +235,7 @@ export function getBankLiquidityAvailableBaseUnit(
235
235
  ? Number(bank.config.depositLimit) - totalDeposited
236
236
  : Math.min(
237
237
  totalDeposited - totalBorrowed,
238
- Number(bank.config.borrowLimit) - totalBorrowed
238
+ Math.max(0, Number(bank.config.borrowLimit) - totalBorrowed)
239
239
  );
240
240
  }
241
241