@defisaver/positions-sdk 2.1.90 → 2.1.91

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.
@@ -73,7 +73,9 @@ const _getCompoundV3MarketsData = (provider, network, selectedMarket, defaultPro
73
73
  .forEach((market, i) => {
74
74
  payload[market.symbol] = Object.assign(Object.assign({}, market), { sortIndex: i });
75
75
  });
76
- return { assetsData: payload };
76
+ return {
77
+ assetsData: payload, isMarketBorrowPaused: isWithdrawPaused, isMarketSupplyPaused: isSupplyPaused, isMarketWithdrawPaused: isWithdrawPaused,
78
+ };
77
79
  });
78
80
  exports._getCompoundV3MarketsData = _getCompoundV3MarketsData;
79
81
  const getCompoundV3MarketsData = (provider, network, selectedMarket, defaultProvider) => __awaiter(void 0, void 0, void 0, function* () { return (0, exports._getCompoundV3MarketsData)((0, viem_1.getViemProvider)(provider, network), network, selectedMarket, (0, viem_1.getViemProvider)(defaultProvider, network)); });
@@ -50,7 +50,7 @@ const formatBaseData = (data, network, baseAssetPrice, isSupplyPaused, isWithdra
50
50
  .toString()), borrowRate: (0, moneymarket_1.aprToApy)(new decimal_js_1.default(data.borrowRate).div(1e18).mul(constants_1.SECONDS_PER_YEAR).mul(100)
51
51
  .toString()), utilization: (0, utils_1.getEthAmountForDecimals)(data.utilization, 16), // utilization is totalSupply/totalBorrow in 1e18, but we need % so when we mul with 100 it's 16 decimals
52
52
  totalSupply,
53
- totalBorrow, marketLiquidity: new decimal_js_1.default(totalSupply).minus(totalBorrow).toString(), symbol: (0, utils_1.wethToEth)(assetInfo.symbol), priceInBaseAsset: (0, utils_1.getEthAmountForDecimals)(data.price, 8), price: baseAssetPrice, collateralFactor: '0', liquidationRatio: '0', canBeBorrowed: true, canBeSupplied: !isSupplyPaused, canBeWithdrawn: !isWithdrawPaused, supplyCap: '0', rewardSupplySpeed: (0, utils_1.getEthAmountForDecimals)(data.baseTrackingSupplyRewardsSpeed, 15), rewardBorrowSpeed: (0, utils_1.getEthAmountForDecimals)(data.baseTrackingBorrowRewardsSpeed, 15), minDebt: (0, utils_1.getEthAmountForDecimals)(data.baseBorrowMin, assetInfo.decimals), isBase: true }));
53
+ totalBorrow, marketLiquidity: new decimal_js_1.default(totalSupply).minus(totalBorrow).toString(), symbol: (0, utils_1.wethToEth)(assetInfo.symbol), priceInBaseAsset: (0, utils_1.getEthAmountForDecimals)(data.price, 8), price: baseAssetPrice, collateralFactor: '0', liquidationRatio: '0', canBeBorrowed: !isWithdrawPaused, canBeSupplied: !isSupplyPaused, canBeWithdrawn: !isWithdrawPaused, supplyCap: '0', rewardSupplySpeed: (0, utils_1.getEthAmountForDecimals)(data.baseTrackingSupplyRewardsSpeed, 15), rewardBorrowSpeed: (0, utils_1.getEthAmountForDecimals)(data.baseTrackingBorrowRewardsSpeed, 15), minDebt: (0, utils_1.getEthAmountForDecimals)(data.baseBorrowMin, assetInfo.decimals), isBase: true }));
54
54
  };
55
55
  exports.formatBaseData = formatBaseData;
56
56
  const getIncentiveApys = (baseData, compPrice) => __awaiter(void 0, void 0, void 0, function* () {
@@ -71,7 +71,11 @@ export type CompoundMarketsData<T> = {
71
71
  assetsData: T;
72
72
  };
73
73
  export type CompoundV2MarketsData = CompoundMarketsData<CompoundV2AssetsData>;
74
- export type CompoundV3MarketsData = CompoundMarketsData<CompoundV3AssetsData>;
74
+ export type CompoundV3MarketsData = CompoundMarketsData<CompoundV3AssetsData> & {
75
+ isMarketSupplyPaused: boolean;
76
+ isMarketWithdrawPaused: boolean;
77
+ isMarketBorrowPaused: boolean;
78
+ };
75
79
  export interface BaseAdditionalAssetData {
76
80
  totalBorrow: string;
77
81
  utilization: string;
@@ -67,7 +67,9 @@ export const _getCompoundV3MarketsData = (provider, network, selectedMarket, def
67
67
  .forEach((market, i) => {
68
68
  payload[market.symbol] = Object.assign(Object.assign({}, market), { sortIndex: i });
69
69
  });
70
- return { assetsData: payload };
70
+ return {
71
+ assetsData: payload, isMarketBorrowPaused: isWithdrawPaused, isMarketSupplyPaused: isSupplyPaused, isMarketWithdrawPaused: isWithdrawPaused,
72
+ };
71
73
  });
72
74
  export const getCompoundV3MarketsData = (provider, network, selectedMarket, defaultProvider) => __awaiter(void 0, void 0, void 0, function* () { return _getCompoundV3MarketsData(getViemProvider(provider, network), network, selectedMarket, getViemProvider(defaultProvider, network)); });
73
75
  export const EMPTY_COMPOUND_V3_DATA = {
@@ -43,7 +43,7 @@ export const formatBaseData = (data, network, baseAssetPrice, isSupplyPaused, is
43
43
  .toString()), borrowRate: aprToApy(new Dec(data.borrowRate).div(1e18).mul(SECONDS_PER_YEAR).mul(100)
44
44
  .toString()), utilization: getEthAmountForDecimals(data.utilization, 16), // utilization is totalSupply/totalBorrow in 1e18, but we need % so when we mul with 100 it's 16 decimals
45
45
  totalSupply,
46
- totalBorrow, marketLiquidity: new Dec(totalSupply).minus(totalBorrow).toString(), symbol: wethToEth(assetInfo.symbol), priceInBaseAsset: getEthAmountForDecimals(data.price, 8), price: baseAssetPrice, collateralFactor: '0', liquidationRatio: '0', canBeBorrowed: true, canBeSupplied: !isSupplyPaused, canBeWithdrawn: !isWithdrawPaused, supplyCap: '0', rewardSupplySpeed: getEthAmountForDecimals(data.baseTrackingSupplyRewardsSpeed, 15), rewardBorrowSpeed: getEthAmountForDecimals(data.baseTrackingBorrowRewardsSpeed, 15), minDebt: getEthAmountForDecimals(data.baseBorrowMin, assetInfo.decimals), isBase: true }));
46
+ totalBorrow, marketLiquidity: new Dec(totalSupply).minus(totalBorrow).toString(), symbol: wethToEth(assetInfo.symbol), priceInBaseAsset: getEthAmountForDecimals(data.price, 8), price: baseAssetPrice, collateralFactor: '0', liquidationRatio: '0', canBeBorrowed: !isWithdrawPaused, canBeSupplied: !isSupplyPaused, canBeWithdrawn: !isWithdrawPaused, supplyCap: '0', rewardSupplySpeed: getEthAmountForDecimals(data.baseTrackingSupplyRewardsSpeed, 15), rewardBorrowSpeed: getEthAmountForDecimals(data.baseTrackingBorrowRewardsSpeed, 15), minDebt: getEthAmountForDecimals(data.baseBorrowMin, assetInfo.decimals), isBase: true }));
47
47
  };
48
48
  export const getIncentiveApys = (baseData, compPrice) => __awaiter(void 0, void 0, void 0, function* () {
49
49
  return ({
@@ -71,7 +71,11 @@ export type CompoundMarketsData<T> = {
71
71
  assetsData: T;
72
72
  };
73
73
  export type CompoundV2MarketsData = CompoundMarketsData<CompoundV2AssetsData>;
74
- export type CompoundV3MarketsData = CompoundMarketsData<CompoundV3AssetsData>;
74
+ export type CompoundV3MarketsData = CompoundMarketsData<CompoundV3AssetsData> & {
75
+ isMarketSupplyPaused: boolean;
76
+ isMarketWithdrawPaused: boolean;
77
+ isMarketBorrowPaused: boolean;
78
+ };
75
79
  export interface BaseAdditionalAssetData {
76
80
  totalBorrow: string;
77
81
  utilization: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "2.1.90",
3
+ "version": "2.1.91",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -87,7 +87,9 @@ export const _getCompoundV3MarketsData = async (provider: Client, network: Netwo
87
87
  payload[market.symbol] = { ...market, sortIndex: i };
88
88
  });
89
89
 
90
- return { assetsData: payload };
90
+ return {
91
+ assetsData: payload, isMarketBorrowPaused: isWithdrawPaused, isMarketSupplyPaused: isSupplyPaused, isMarketWithdrawPaused: isWithdrawPaused,
92
+ };
91
93
  };
92
94
 
93
95
  export const getCompoundV3MarketsData = async (provider: EthereumProvider, network: NetworkNumber, selectedMarket: CompoundMarketData, defaultProvider: EthereumProvider): Promise<CompoundV3MarketsData> => _getCompoundV3MarketsData(getViemProvider(provider, network), network, selectedMarket, getViemProvider(defaultProvider, network));
@@ -71,7 +71,7 @@ export const formatBaseData = (data: any, network: NetworkNumber, baseAssetPrice
71
71
  price: baseAssetPrice,
72
72
  collateralFactor: '0',
73
73
  liquidationRatio: '0',
74
- canBeBorrowed: true,
74
+ canBeBorrowed: !isWithdrawPaused,
75
75
  canBeSupplied: !isSupplyPaused,
76
76
  canBeWithdrawn: !isWithdrawPaused,
77
77
  supplyCap: '0',
@@ -89,7 +89,7 @@ export type CompoundV3AssetsData = CompoundAssetsData<CompoundV3AssetData>;
89
89
 
90
90
  export type CompoundMarketsData<T> = { assetsData: T };
91
91
  export type CompoundV2MarketsData = CompoundMarketsData<CompoundV2AssetsData>;
92
- export type CompoundV3MarketsData = CompoundMarketsData<CompoundV3AssetsData>;
92
+ export type CompoundV3MarketsData = CompoundMarketsData<CompoundV3AssetsData> & { isMarketSupplyPaused: boolean, isMarketWithdrawPaused: boolean, isMarketBorrowPaused: boolean };
93
93
 
94
94
  export interface BaseAdditionalAssetData {
95
95
  totalBorrow: string,