@kamino-finance/klend-sdk 5.13.14 → 5.13.16
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.
- package/dist/classes/obligation.d.ts +1 -3
- package/dist/classes/obligation.d.ts.map +1 -1
- package/dist/classes/obligation.js +2 -4
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/obligationOrder.d.ts +2 -1
- package/dist/classes/obligationOrder.d.ts.map +1 -1
- package/dist/classes/obligationOrder.js +16 -3
- package/dist/classes/obligationOrder.js.map +1 -1
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +3 -2
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +35 -27
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +16 -7
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/lending_operations/repay_with_collateral_calcs.d.ts.map +1 -1
- package/dist/lending_operations/repay_with_collateral_calcs.js +2 -2
- package/dist/lending_operations/repay_with_collateral_calcs.js.map +1 -1
- package/package.json +2 -2
- package/src/classes/obligation.ts +9 -4
- package/src/classes/obligationOrder.ts +22 -3
- package/src/classes/reserve.ts +3 -2
- package/src/classes/vault.ts +37 -31
- package/src/client_kamino_manager.ts +19 -7
- package/src/lending_operations/repay_with_collateral_calcs.ts +2 -5
- package/src/lending_operations/repay_with_collateral_operations.ts +1 -1
|
@@ -129,10 +129,7 @@ export function calcMaxWithdrawCollateral(
|
|
|
129
129
|
.getDeposits()
|
|
130
130
|
.filter((p) => !p.reserveAddress.equals(deposit.reserveAddress))
|
|
131
131
|
.reduce((acc, d) => {
|
|
132
|
-
const { maxLtv, liquidationLtv } = obligation.getLtvForReserve(
|
|
133
|
-
market,
|
|
134
|
-
market.getExistingReserveByAddress(d.reserveAddress)
|
|
135
|
-
);
|
|
132
|
+
const { maxLtv, liquidationLtv } = obligation.getLtvForReserve(market, d.reserveAddress);
|
|
136
133
|
const maxWithdrawLtv =
|
|
137
134
|
maxWithdrawLtvCheck === MaxWithdrawLtvCheck.LIQUIDATION_THRESHOLD ? liquidationLtv : maxLtv;
|
|
138
135
|
return acc.add(d.marketValueRefreshed.mul(maxWithdrawLtv));
|
|
@@ -150,7 +147,7 @@ export function calcMaxWithdrawCollateral(
|
|
|
150
147
|
} else {
|
|
151
148
|
const { maxLtv: collMaxLtv, liquidationLtv: collLiquidationLtv } = obligation.getLtvForReserve(
|
|
152
149
|
market,
|
|
153
|
-
|
|
150
|
+
depositReserve.address
|
|
154
151
|
);
|
|
155
152
|
const maxWithdrawLtv =
|
|
156
153
|
maxWithdrawLtvCheck === MaxWithdrawLtvCheck.LIQUIDATION_THRESHOLD ? collLiquidationLtv : collMaxLtv;
|
|
@@ -424,7 +424,7 @@ function calculatePostOperationLtv(
|
|
|
424
424
|
new Decimal(0),
|
|
425
425
|
obligation.refreshedStats.userTotalDeposit.sub(collWithdrawValue)
|
|
426
426
|
);
|
|
427
|
-
|
|
427
|
+
|
|
428
428
|
const newMaxBorrowableValue = Decimal.max(
|
|
429
429
|
new Decimal(0),
|
|
430
430
|
obligation.refreshedStats.borrowLimit.sub(collWithdrawValue.mul(collReserve.stats.loanToValue))
|