@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.
@@ -100,5 +100,8 @@ export type TotalValueLocked = {
100
100
  supplyValue: number;
101
101
  borrowValue: number;
102
102
  totalValue: number;
103
+ supplyValueChangeRatio?: number;
104
+ borrowValueChangeRatio?: number;
105
+ totalValueChangeRatio?: number;
103
106
  };
104
107
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "0.44.8",
3
+ "version": "0.44.10",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -1,5 +1,5 @@
1
1
  export const API_BASE_URL = 'https://sui.api.scallop.io';
2
- export const SDK_API_BASE_URL = 'https://sui-scallop-sdk-api.vercel.app';
2
+ export const SDK_API_BASE_URL = 'https://sdk.api.scallop.io';
3
3
 
4
4
  export const ADDRESSES_ID = '6462a088a7ace142bb6d7e9b';
5
5
 
@@ -358,7 +358,14 @@ export const getObligationAccount = async (
358
358
  const requiredCollateralValue = depositedValue.multipliedBy(
359
359
  marketCollateral.liquidationFactor
360
360
  );
361
- const availableDepositAmount = BigNumber(coinAmount);
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 tvl = await query.indexer.getTotalValueLocked();
670
- return {
671
- supplyValue: tvl.supplyValue,
672
- borrowValue: tvl.borrowValue,
673
- totalValue: tvl.totalValue,
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)) {
@@ -124,4 +124,7 @@ export type TotalValueLocked = {
124
124
  supplyValue: number;
125
125
  borrowValue: number;
126
126
  totalValue: number;
127
+ supplyValueChangeRatio?: number;
128
+ borrowValueChangeRatio?: number;
129
+ totalValueChangeRatio?: number;
127
130
  };