@scallop-io/sui-scallop-sdk 0.44.8 → 0.44.10
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/constants/common.d.ts +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -7
- package/dist/index.mjs.map +1 -1
- package/dist/types/query/portfolio.d.ts +3 -0
- package/package.json +1 -1
- package/src/constants/common.ts +1 -1
- package/src/queries/portfolioQuery.ts +17 -6
- package/src/types/query/portfolio.ts +3 -0
package/package.json
CHANGED
package/src/constants/common.ts
CHANGED
|
@@ -358,7 +358,14 @@ export const getObligationAccount = async (
|
|
|
358
358
|
const requiredCollateralValue = depositedValue.multipliedBy(
|
|
359
359
|
marketCollateral.liquidationFactor
|
|
360
360
|
);
|
|
361
|
-
|
|
361
|
+
|
|
362
|
+
const poolSizeAmount = BigNumber(marketCollateral.maxDepositAmount).minus(
|
|
363
|
+
marketCollateral.depositAmount
|
|
364
|
+
);
|
|
365
|
+
const availableDepositAmount = minBigNumber(
|
|
366
|
+
BigNumber(coinAmount),
|
|
367
|
+
poolSizeAmount
|
|
368
|
+
);
|
|
362
369
|
const availableDepositCoin = availableDepositAmount.shiftedBy(
|
|
363
370
|
-1 * coinDecimal
|
|
364
371
|
);
|
|
@@ -666,12 +673,16 @@ export const getTotalValueLocked = async (
|
|
|
666
673
|
let borrowValue = BigNumber(0);
|
|
667
674
|
|
|
668
675
|
if (indexer) {
|
|
669
|
-
const
|
|
670
|
-
|
|
671
|
-
supplyValue:
|
|
672
|
-
|
|
673
|
-
|
|
676
|
+
const tvlIndexer = await query.indexer.getTotalValueLocked();
|
|
677
|
+
const tvl: TotalValueLocked = {
|
|
678
|
+
supplyValue: tvlIndexer.supplyValue,
|
|
679
|
+
supplyValueChangeRatio: tvlIndexer.supplyValueChangeRatio,
|
|
680
|
+
borrowValue: tvlIndexer.borrowValue,
|
|
681
|
+
borrowValueChangeRatio: tvlIndexer.borrowValueChangeRatio,
|
|
682
|
+
totalValue: tvlIndexer.totalValue,
|
|
683
|
+
totalValueChangeRatio: tvlIndexer.totalValueChangeRatio,
|
|
674
684
|
};
|
|
685
|
+
return tvl;
|
|
675
686
|
}
|
|
676
687
|
|
|
677
688
|
for (const pool of Object.values(market.pools)) {
|