@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/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/constants/common.ts
|
|
2
2
|
var API_BASE_URL = "https://sui.api.scallop.io";
|
|
3
|
-
var SDK_API_BASE_URL = "https://
|
|
3
|
+
var SDK_API_BASE_URL = "https://sdk.api.scallop.io";
|
|
4
4
|
var ADDRESSES_ID = "6462a088a7ace142bb6d7e9b";
|
|
5
5
|
var PROTOCOL_OBJECT_ID = "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf";
|
|
6
6
|
var BORROW_FEE_PROTOCOL_ID = "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
|
|
@@ -2458,7 +2458,13 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
|
|
|
2458
2458
|
const requiredCollateralValue2 = depositedValue.multipliedBy(
|
|
2459
2459
|
marketCollateral.liquidationFactor
|
|
2460
2460
|
);
|
|
2461
|
-
const
|
|
2461
|
+
const poolSizeAmount = BigNumber3(marketCollateral.maxDepositAmount).minus(
|
|
2462
|
+
marketCollateral.depositAmount
|
|
2463
|
+
);
|
|
2464
|
+
const availableDepositAmount = minBigNumber(
|
|
2465
|
+
BigNumber3(coinAmount),
|
|
2466
|
+
poolSizeAmount
|
|
2467
|
+
);
|
|
2462
2468
|
const availableDepositCoin = availableDepositAmount.shiftedBy(
|
|
2463
2469
|
-1 * coinDecimal
|
|
2464
2470
|
);
|
|
@@ -2670,12 +2676,16 @@ var getTotalValueLocked = async (query, indexer = false) => {
|
|
|
2670
2676
|
let supplyValue = BigNumber3(0);
|
|
2671
2677
|
let borrowValue = BigNumber3(0);
|
|
2672
2678
|
if (indexer) {
|
|
2673
|
-
const
|
|
2674
|
-
|
|
2675
|
-
supplyValue:
|
|
2676
|
-
|
|
2677
|
-
|
|
2679
|
+
const tvlIndexer = await query.indexer.getTotalValueLocked();
|
|
2680
|
+
const tvl2 = {
|
|
2681
|
+
supplyValue: tvlIndexer.supplyValue,
|
|
2682
|
+
supplyValueChangeRatio: tvlIndexer.supplyValueChangeRatio,
|
|
2683
|
+
borrowValue: tvlIndexer.borrowValue,
|
|
2684
|
+
borrowValueChangeRatio: tvlIndexer.borrowValueChangeRatio,
|
|
2685
|
+
totalValue: tvlIndexer.totalValue,
|
|
2686
|
+
totalValueChangeRatio: tvlIndexer.totalValueChangeRatio
|
|
2678
2687
|
};
|
|
2688
|
+
return tvl2;
|
|
2679
2689
|
}
|
|
2680
2690
|
for (const pool of Object.values(market.pools)) {
|
|
2681
2691
|
supplyValue = supplyValue.plus(
|