@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.
@@ -1,5 +1,5 @@
1
1
  export declare const API_BASE_URL = "https://sui.api.scallop.io";
2
- export declare const SDK_API_BASE_URL = "https://sui-scallop-sdk-api.vercel.app";
2
+ export declare const SDK_API_BASE_URL = "https://sdk.api.scallop.io";
3
3
  export declare const ADDRESSES_ID = "6462a088a7ace142bb6d7e9b";
4
4
  export declare const PROTOCOL_OBJECT_ID = "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf";
5
5
  export declare const BORROW_FEE_PROTOCOL_ID = "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
package/dist/index.js CHANGED
@@ -64,7 +64,7 @@ module.exports = __toCommonJS(src_exports);
64
64
 
65
65
  // src/constants/common.ts
66
66
  var API_BASE_URL = "https://sui.api.scallop.io";
67
- var SDK_API_BASE_URL = "https://sui-scallop-sdk-api.vercel.app";
67
+ var SDK_API_BASE_URL = "https://sdk.api.scallop.io";
68
68
  var ADDRESSES_ID = "6462a088a7ace142bb6d7e9b";
69
69
  var PROTOCOL_OBJECT_ID = "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf";
70
70
  var BORROW_FEE_PROTOCOL_ID = "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
@@ -2522,7 +2522,13 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
2522
2522
  const requiredCollateralValue2 = depositedValue.multipliedBy(
2523
2523
  marketCollateral.liquidationFactor
2524
2524
  );
2525
- const availableDepositAmount = (0, import_bignumber3.default)(coinAmount);
2525
+ const poolSizeAmount = (0, import_bignumber3.default)(marketCollateral.maxDepositAmount).minus(
2526
+ marketCollateral.depositAmount
2527
+ );
2528
+ const availableDepositAmount = minBigNumber(
2529
+ (0, import_bignumber3.default)(coinAmount),
2530
+ poolSizeAmount
2531
+ );
2526
2532
  const availableDepositCoin = availableDepositAmount.shiftedBy(
2527
2533
  -1 * coinDecimal
2528
2534
  );
@@ -2734,12 +2740,16 @@ var getTotalValueLocked = async (query, indexer = false) => {
2734
2740
  let supplyValue = (0, import_bignumber3.default)(0);
2735
2741
  let borrowValue = (0, import_bignumber3.default)(0);
2736
2742
  if (indexer) {
2737
- const tvl2 = await query.indexer.getTotalValueLocked();
2738
- return {
2739
- supplyValue: tvl2.supplyValue,
2740
- borrowValue: tvl2.borrowValue,
2741
- totalValue: tvl2.totalValue
2743
+ const tvlIndexer = await query.indexer.getTotalValueLocked();
2744
+ const tvl2 = {
2745
+ supplyValue: tvlIndexer.supplyValue,
2746
+ supplyValueChangeRatio: tvlIndexer.supplyValueChangeRatio,
2747
+ borrowValue: tvlIndexer.borrowValue,
2748
+ borrowValueChangeRatio: tvlIndexer.borrowValueChangeRatio,
2749
+ totalValue: tvlIndexer.totalValue,
2750
+ totalValueChangeRatio: tvlIndexer.totalValueChangeRatio
2742
2751
  };
2752
+ return tvl2;
2743
2753
  }
2744
2754
  for (const pool of Object.values(market.pools)) {
2745
2755
  supplyValue = supplyValue.plus(