@defisaver/positions-sdk 2.1.1 → 2.1.3

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.
Files changed (129) hide show
  1. package/cjs/aaveV2/index.js +1 -0
  2. package/cjs/aaveV3/index.d.ts +12 -0
  3. package/cjs/aaveV3/index.js +93 -1
  4. package/cjs/claiming/aaveV3.d.ts +5 -0
  5. package/cjs/claiming/aaveV3.js +139 -0
  6. package/cjs/claiming/compV3.d.ts +15 -0
  7. package/cjs/claiming/compV3.js +34 -0
  8. package/cjs/claiming/index.d.ts +6 -0
  9. package/cjs/claiming/index.js +46 -0
  10. package/cjs/claiming/king.d.ts +4 -0
  11. package/cjs/claiming/king.js +72 -0
  12. package/cjs/claiming/morphoBlue.d.ts +5 -0
  13. package/cjs/claiming/morphoBlue.js +113 -0
  14. package/cjs/claiming/spark.d.ts +6 -0
  15. package/cjs/claiming/spark.js +188 -0
  16. package/cjs/config/contracts.d.ts +2681 -0
  17. package/cjs/config/contracts.js +103 -2
  18. package/cjs/constants/index.d.ts +4 -0
  19. package/cjs/constants/index.js +6 -2
  20. package/cjs/contracts.d.ts +3027 -23
  21. package/cjs/contracts.js +10 -1
  22. package/cjs/helpers/aaveHelpers/index.d.ts +4 -0
  23. package/cjs/helpers/aaveHelpers/index.js +25 -8
  24. package/cjs/helpers/morphoBlueHelpers/index.d.ts +1 -0
  25. package/cjs/helpers/morphoBlueHelpers/index.js +7 -1
  26. package/cjs/index.d.ts +2 -1
  27. package/cjs/index.js +3 -1
  28. package/cjs/liquity/index.d.ts +11 -0
  29. package/cjs/liquity/index.js +39 -1
  30. package/cjs/liquityV2/index.d.ts +35 -0
  31. package/cjs/liquityV2/index.js +142 -1
  32. package/cjs/morphoBlue/index.d.ts +5 -0
  33. package/cjs/morphoBlue/index.js +35 -0
  34. package/cjs/portfolio/index.d.ts +6 -1
  35. package/cjs/portfolio/index.js +293 -10
  36. package/cjs/services/utils.d.ts +5 -0
  37. package/cjs/services/utils.js +33 -1
  38. package/cjs/services/viem.d.ts +12 -12
  39. package/cjs/spark/index.js +1 -0
  40. package/cjs/staking/eligibility.d.ts +4 -2
  41. package/cjs/staking/eligibility.js +3 -4
  42. package/cjs/staking/staking.d.ts +2 -1
  43. package/cjs/staking/staking.js +3 -3
  44. package/cjs/types/claiming.d.ts +93 -0
  45. package/cjs/types/claiming.js +27 -0
  46. package/cjs/types/common.d.ts +1 -1
  47. package/cjs/types/common.js +1 -1
  48. package/cjs/umbrella/index.d.ts +5 -0
  49. package/cjs/umbrella/index.js +50 -0
  50. package/cjs/umbrella/umbrellaUtils.d.ts +22 -0
  51. package/cjs/umbrella/umbrellaUtils.js +34 -0
  52. package/esm/aaveV2/index.js +1 -0
  53. package/esm/aaveV3/index.d.ts +12 -0
  54. package/esm/aaveV3/index.js +91 -1
  55. package/esm/claiming/aaveV3.d.ts +5 -0
  56. package/esm/claiming/aaveV3.js +132 -0
  57. package/esm/claiming/compV3.d.ts +15 -0
  58. package/esm/claiming/compV3.js +30 -0
  59. package/esm/claiming/index.d.ts +6 -0
  60. package/esm/claiming/index.js +6 -0
  61. package/esm/claiming/king.d.ts +4 -0
  62. package/esm/claiming/king.js +64 -0
  63. package/esm/claiming/morphoBlue.d.ts +5 -0
  64. package/esm/claiming/morphoBlue.js +105 -0
  65. package/esm/claiming/spark.d.ts +6 -0
  66. package/esm/claiming/spark.js +179 -0
  67. package/esm/config/contracts.d.ts +2681 -0
  68. package/esm/config/contracts.js +102 -1
  69. package/esm/constants/index.d.ts +4 -0
  70. package/esm/constants/index.js +5 -1
  71. package/esm/contracts.d.ts +3027 -23
  72. package/esm/contracts.js +9 -0
  73. package/esm/helpers/aaveHelpers/index.d.ts +4 -0
  74. package/esm/helpers/aaveHelpers/index.js +23 -7
  75. package/esm/helpers/morphoBlueHelpers/index.d.ts +1 -0
  76. package/esm/helpers/morphoBlueHelpers/index.js +6 -1
  77. package/esm/index.d.ts +2 -1
  78. package/esm/index.js +2 -1
  79. package/esm/liquity/index.d.ts +11 -0
  80. package/esm/liquity/index.js +38 -1
  81. package/esm/liquityV2/index.d.ts +35 -0
  82. package/esm/liquityV2/index.js +142 -3
  83. package/esm/morphoBlue/index.d.ts +5 -0
  84. package/esm/morphoBlue/index.js +35 -1
  85. package/esm/portfolio/index.d.ts +6 -1
  86. package/esm/portfolio/index.js +298 -15
  87. package/esm/services/utils.d.ts +5 -0
  88. package/esm/services/utils.js +31 -0
  89. package/esm/services/viem.d.ts +12 -12
  90. package/esm/spark/index.js +1 -0
  91. package/esm/staking/eligibility.d.ts +4 -2
  92. package/esm/staking/eligibility.js +3 -4
  93. package/esm/staking/staking.d.ts +2 -1
  94. package/esm/staking/staking.js +3 -3
  95. package/esm/types/claiming.d.ts +93 -0
  96. package/esm/types/claiming.js +24 -0
  97. package/esm/types/common.d.ts +1 -1
  98. package/esm/types/common.js +1 -1
  99. package/esm/umbrella/index.d.ts +5 -0
  100. package/esm/umbrella/index.js +46 -0
  101. package/esm/umbrella/umbrellaUtils.d.ts +22 -0
  102. package/esm/umbrella/umbrellaUtils.js +28 -0
  103. package/package.json +1 -1
  104. package/src/aaveV2/index.ts +2 -1
  105. package/src/aaveV3/index.ts +100 -2
  106. package/src/claiming/aaveV3.ts +155 -0
  107. package/src/claiming/compV3.ts +23 -0
  108. package/src/claiming/index.ts +13 -0
  109. package/src/claiming/king.ts +66 -0
  110. package/src/claiming/morphoBlue.ts +119 -0
  111. package/src/claiming/spark.ts +226 -0
  112. package/src/config/contracts.ts +104 -4
  113. package/src/constants/index.ts +5 -1
  114. package/src/contracts.ts +14 -1
  115. package/src/helpers/aaveHelpers/index.ts +24 -7
  116. package/src/helpers/morphoBlueHelpers/index.ts +7 -2
  117. package/src/index.ts +2 -0
  118. package/src/liquity/index.ts +57 -2
  119. package/src/liquityV2/index.ts +244 -4
  120. package/src/morphoBlue/index.ts +40 -2
  121. package/src/portfolio/index.ts +300 -15
  122. package/src/services/utils.ts +37 -1
  123. package/src/spark/index.ts +2 -1
  124. package/src/staking/eligibility.ts +3 -4
  125. package/src/staking/staking.ts +4 -4
  126. package/src/types/claiming.ts +109 -0
  127. package/src/types/common.ts +1 -1
  128. package/src/umbrella/index.ts +70 -0
  129. package/src/umbrella/umbrellaUtils.ts +30 -0
package/cjs/contracts.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.FluidViewContractViem = exports.LiquityV2LegacyViewContractViem = exports.LiquityV2ViewContractViem = exports.LiquityActivePoolContractViem = exports.LiquityPriceFeedContractViem = exports.LiquityTroveManagerContractViem = exports.LiquityCollSurplusPoolContractViem = exports.LiquityViewContractViem = exports.BTCPriceFeedContractViem = exports.WeETHPriceFeedContractViem = exports.ComptrollerContractViem = exports.CompoundLoanInfoContractViem = exports.McdJugContractViem = exports.McdDogContractViem = exports.McdSpotterContractViem = exports.McdVatContractViem = exports.McdViewContractViem = exports.McdGetCdpsContractViem = exports.LlamaLendViewContractViem = exports.CrvUSDFactoryContractViem = exports.CrvUSDViewContractViem = exports.EulerV2ViewContractViem = exports.SparkIncentiveDataProviderContractViem = exports.SparkViewContractViem = exports.CompV3ViewContractViem = exports.WstETHPriceFeedContractViem = exports.USDCPriceFeedContractViem = exports.ETHPriceFeedContractViem = exports.COMPPriceFeedContractViem = exports.DFSFeedRegistryContractViem = exports.FeedRegistryContractViem = exports.AaveIncentiveDataProviderV3ContractViem = exports.AaveV3ViewContractViem = exports.AaveLoanInfoV2ContractViem = exports.MorphoBlueViewContractViem = exports.createViemContractFromConfigFunc = exports.getConfigContractAbi = exports.getConfigContractAddress = void 0;
36
+ exports.StkAAVEViem = exports.LiquityV2sBoldVaultViem = exports.AaveRewardsControllerViem = exports.SparkRewardsControllerViem = exports.UUPSViem = exports.LiquityStabilityPoolViem = exports.LiquityLQTYStakingViem = exports.AaveUmbrellaViewViem = exports.AaveIncentivesControllerViem = exports.FluidViewContractViem = exports.LiquityV2LegacyViewContractViem = exports.LiquityV2ViewContractViem = exports.LiquityActivePoolContractViem = exports.LiquityPriceFeedContractViem = exports.LiquityTroveManagerContractViem = exports.LiquityCollSurplusPoolContractViem = exports.LiquityViewContractViem = exports.BTCPriceFeedContractViem = exports.WeETHPriceFeedContractViem = exports.ComptrollerContractViem = exports.CompoundLoanInfoContractViem = exports.McdJugContractViem = exports.McdDogContractViem = exports.McdSpotterContractViem = exports.McdVatContractViem = exports.McdViewContractViem = exports.McdGetCdpsContractViem = exports.LlamaLendViewContractViem = exports.CrvUSDFactoryContractViem = exports.CrvUSDViewContractViem = exports.EulerV2ViewContractViem = exports.SparkIncentiveDataProviderContractViem = exports.SparkViewContractViem = exports.CompV3ViewContractViem = exports.WstETHPriceFeedContractViem = exports.USDCPriceFeedContractViem = exports.ETHPriceFeedContractViem = exports.COMPPriceFeedContractViem = exports.DFSFeedRegistryContractViem = exports.FeedRegistryContractViem = exports.AaveIncentiveDataProviderV3ContractViem = exports.AaveV3ViewContractViem = exports.AaveLoanInfoV2ContractViem = exports.MorphoBlueViewContractViem = exports.createViemContractFromConfigFunc = exports.getConfigContractAbi = exports.getConfigContractAddress = void 0;
37
37
  const viem_1 = require("viem");
38
38
  const configRaw = __importStar(require("./config/contracts"));
39
39
  // @ts-ignore
@@ -119,3 +119,12 @@ exports.LiquityActivePoolContractViem = (0, exports.createViemContractFromConfig
119
119
  exports.LiquityV2ViewContractViem = (0, exports.createViemContractFromConfigFunc)('LiquityV2View');
120
120
  exports.LiquityV2LegacyViewContractViem = (0, exports.createViemContractFromConfigFunc)('LiquityV2LegacyView');
121
121
  exports.FluidViewContractViem = (0, exports.createViemContractFromConfigFunc)('FluidView');
122
+ exports.AaveIncentivesControllerViem = (0, exports.createViemContractFromConfigFunc)('AaveIncentivesController');
123
+ exports.AaveUmbrellaViewViem = (0, exports.createViemContractFromConfigFunc)('AaveUmbrellaView');
124
+ exports.LiquityLQTYStakingViem = (0, exports.createViemContractFromConfigFunc)('LiquityLQTYStaking');
125
+ exports.LiquityStabilityPoolViem = (0, exports.createViemContractFromConfigFunc)('LiquityStabilityPool');
126
+ exports.UUPSViem = (0, exports.createViemContractFromConfigFunc)('UUPS');
127
+ exports.SparkRewardsControllerViem = (0, exports.createViemContractFromConfigFunc)('SparkRewardsController');
128
+ exports.AaveRewardsControllerViem = (0, exports.createViemContractFromConfigFunc)('AaveRewardsController');
129
+ exports.LiquityV2sBoldVaultViem = (0, exports.createViemContractFromConfigFunc)('LiquityV2sBoldVault');
130
+ exports.StkAAVEViem = (0, exports.createViemContractFromConfigFunc)('StkAAVE');
@@ -41,3 +41,7 @@ export declare const getApyAfterValuesEstimation: (selectedMarket: AaveMarketInf
41
41
  borrowRate: string;
42
42
  };
43
43
  }>;
44
+ /**
45
+ * won't cover all cases
46
+ */
47
+ export declare const getAaveUnderlyingSymbol: (_symbol?: string) => any;
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getApyAfterValuesEstimation = exports.aaveAnyGetAggregatedPositionData = exports.aaveAnyGetEmodeMutableProps = exports.aaveAnyGetSuppliableAsCollAssets = exports.aaveAnyGetSuppliableAssets = exports.aaveAnyGetCollSuppliedAssets = exports.aaveV3IsInSiloedMode = exports.aaveV3IsInIsolationMode = exports.isAaveV3 = exports.isAaveV2 = exports.AAVE_V3_MARKETS = void 0;
26
+ exports.getAaveUnderlyingSymbol = exports.getApyAfterValuesEstimation = exports.aaveAnyGetAggregatedPositionData = exports.aaveAnyGetEmodeMutableProps = exports.aaveAnyGetSuppliableAsCollAssets = exports.aaveAnyGetSuppliableAssets = exports.aaveAnyGetCollSuppliedAssets = exports.aaveV3IsInSiloedMode = exports.aaveV3IsInIsolationMode = exports.isAaveV3 = exports.isAaveV2 = exports.AAVE_V3_MARKETS = void 0;
27
27
  const decimal_js_1 = __importDefault(require("decimal.js"));
28
28
  const tokens_1 = require("@defisaver/tokens");
29
29
  const types_1 = require("../../types");
@@ -91,13 +91,6 @@ const aaveAnyGetAggregatedPositionData = (_a) => {
91
91
  payload.leftToBorrowUsd = leftToBorrowUsd.lte('0') ? '0' : leftToBorrowUsd.toString();
92
92
  payload.ratio = +payload.suppliedUsd ? new decimal_js_1.default(payload.borrowLimitUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
93
93
  payload.collRatio = +payload.suppliedUsd ? new decimal_js_1.default(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
94
- const { netApy, incentiveUsd, totalInterestUsd } = (0, staking_1.calculateNetApy)({
95
- usedAssets,
96
- assetsData,
97
- });
98
- payload.netApy = netApy;
99
- payload.incentiveUsd = incentiveUsd;
100
- payload.totalInterestUsd = totalInterestUsd;
101
94
  payload.liqRatio = new decimal_js_1.default(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).toString();
102
95
  payload.liqPercent = new decimal_js_1.default(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).mul(100).toString();
103
96
  const { leveragedType, leveragedAsset } = (0, moneymarket_1.isLeveragedPos)(usedAssets);
@@ -117,6 +110,14 @@ const aaveAnyGetAggregatedPositionData = (_a) => {
117
110
  payload.collLiquidationRatio = new decimal_js_1.default(payload.suppliedCollateralUsd).div(payload.liquidationLimitUsd).mul(100).toString();
118
111
  payload.healthRatio = new decimal_js_1.default(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
119
112
  payload.minHealthRatio = new decimal_js_1.default(payload.liquidationLimitUsd).div(payload.borrowLimitUsd).toDP(4).toString();
113
+ const { netApy, incentiveUsd, totalInterestUsd } = (0, staking_1.calculateNetApy)({
114
+ usedAssets,
115
+ assetsData,
116
+ optionalData: { healthRatio: payload.healthRatio },
117
+ });
118
+ payload.netApy = netApy;
119
+ payload.incentiveUsd = incentiveUsd;
120
+ payload.totalInterestUsd = totalInterestUsd;
120
121
  return payload;
121
122
  };
122
123
  exports.aaveAnyGetAggregatedPositionData = aaveAnyGetAggregatedPositionData;
@@ -156,3 +157,19 @@ const getApyAfterValuesEstimationInner = (selectedMarket, actions, client, netwo
156
157
  });
157
158
  const getApyAfterValuesEstimation = (selectedMarket, actions, provider, network) => __awaiter(void 0, void 0, void 0, function* () { return getApyAfterValuesEstimationInner(selectedMarket, actions, (0, viem_1.getViemProvider)(provider, network), network); });
158
159
  exports.getApyAfterValuesEstimation = getApyAfterValuesEstimation;
160
+ /**
161
+ * won't cover all cases
162
+ */
163
+ const getAaveUnderlyingSymbol = (_symbol = '') => {
164
+ let symbol = _symbol
165
+ .replace(/^aEthLido/, '')
166
+ .replace(/^aEthEtherFi/, '')
167
+ .replace(/^aEth/, '')
168
+ .replace(/^aArb/, '')
169
+ .replace(/^aOpt/, '')
170
+ .replace(/^aBas/, '');
171
+ if (symbol.startsWith('a'))
172
+ symbol = symbol.slice(1);
173
+ return (0, utils_1.wethToEth)(symbol);
174
+ };
175
+ exports.getAaveUnderlyingSymbol = getAaveUnderlyingSymbol;
@@ -56,3 +56,4 @@ export declare const getRewardsForMarket: (marketId: string, network?: NetworkNu
56
56
  supplyApy: string;
57
57
  borrowApy: string;
58
58
  }>;
59
+ export declare const getMorphoUnderlyingSymbol: (_symbol: string) => any;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getRewardsForMarket = exports.getReallocation = exports.getLiquidityToAllocate = exports.getReallocatableLiquidity = exports.getApyAfterValuesEstimation = exports.getBorrowRate = exports.getSupplyRate = exports.getMorphoBlueAggregatedPositionData = void 0;
15
+ exports.getMorphoUnderlyingSymbol = exports.getRewardsForMarket = exports.getReallocation = exports.getLiquidityToAllocate = exports.getReallocatableLiquidity = exports.getApyAfterValuesEstimation = exports.getBorrowRate = exports.getSupplyRate = exports.getMorphoBlueAggregatedPositionData = void 0;
16
16
  const decimal_js_1 = __importDefault(require("decimal.js"));
17
17
  const tokens_1 = require("@defisaver/tokens");
18
18
  const moneymarket_1 = require("../../moneymarket");
@@ -362,3 +362,9 @@ const getRewardsForMarket = (marketId_1, ...args_1) => __awaiter(void 0, [market
362
362
  return { supplyApy: (0, moneymarket_1.aprToApy)(supplyAprPercent), borrowApy: (0, moneymarket_1.aprToApy)(borrowAprPercent) };
363
363
  });
364
364
  exports.getRewardsForMarket = getRewardsForMarket;
365
+ const getMorphoUnderlyingSymbol = (_symbol) => {
366
+ if (_symbol === 'MORPHO Legacy')
367
+ return 'MORPHO';
368
+ return (0, utils_1.wethToEth)(_symbol);
369
+ };
370
+ exports.getMorphoUnderlyingSymbol = getMorphoUnderlyingSymbol;
package/cjs/index.d.ts CHANGED
@@ -18,5 +18,6 @@ import * as morphoBlue from './morphoBlue';
18
18
  import * as llamaLend from './llamaLend';
19
19
  import * as eulerV2 from './eulerV2';
20
20
  import * as portfolio from './portfolio';
21
+ import * as claiming from './claiming';
21
22
  export * from './types';
22
- export { aaveV2, aaveV3, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, };
23
+ export { aaveV2, aaveV3, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, };
package/cjs/index.js CHANGED
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.portfolio = exports.fluid = exports.eulerV2 = exports.llamaLend = exports.morphoBlue = exports.helpers = exports.markets = exports.moneymarket = exports.staking = exports.exchange = exports.maker = exports.liquityV2 = exports.liquity = exports.curveUsd = exports.spark = exports.compoundV3 = exports.compoundV2 = exports.aaveV3 = exports.aaveV2 = void 0;
39
+ exports.claiming = exports.portfolio = exports.fluid = exports.eulerV2 = exports.llamaLend = exports.morphoBlue = exports.helpers = exports.markets = exports.moneymarket = exports.staking = exports.exchange = exports.maker = exports.liquityV2 = exports.liquity = exports.curveUsd = exports.spark = exports.compoundV3 = exports.compoundV2 = exports.aaveV3 = exports.aaveV2 = void 0;
40
40
  require("./setup");
41
41
  const fluid = __importStar(require("./fluid"));
42
42
  exports.fluid = fluid;
@@ -76,4 +76,6 @@ const eulerV2 = __importStar(require("./eulerV2"));
76
76
  exports.eulerV2 = eulerV2;
77
77
  const portfolio = __importStar(require("./portfolio"));
78
78
  exports.portfolio = portfolio;
79
+ const claiming = __importStar(require("./claiming"));
80
+ exports.claiming = claiming;
79
81
  __exportStar(require("./types"), exports);
@@ -8,3 +8,14 @@ export declare const getLiquityAccountBalances: (provider: EthereumProvider, net
8
8
  export declare const getDebtInFront: (provider: EthereumProvider, address: EthAddress) => Promise<string>;
9
9
  export declare const _getLiquityTroveInfo: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<LiquityTroveInfo>;
10
10
  export declare const getLiquityTroveInfo: (provider: EthereumProvider, network: NetworkNumber, address: EthAddress) => Promise<LiquityTroveInfo>;
11
+ export declare const getLiquityStakingData: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<{
12
+ totalLUSDDeposited: string;
13
+ totalLQTYStaked: string;
14
+ stakedLQTY: string;
15
+ stakedLUSDBalance: string;
16
+ rewardETH: string;
17
+ rewardLUSD: string;
18
+ stabilityRewardETH: string;
19
+ stabilityRewardLQTY: string;
20
+ showStakingBalances: boolean;
21
+ }>;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getLiquityTroveInfo = exports._getLiquityTroveInfo = exports.getDebtInFront = exports.getLiquityAccountBalances = exports._getLiquityAccountBalances = exports.LIQUITY_RECOVERY_MODE_RATIO = exports.LIQUITY_NORMAL_MODE_RATIO = void 0;
15
+ exports.getLiquityStakingData = exports.getLiquityTroveInfo = exports._getLiquityTroveInfo = exports.getDebtInFront = exports.getLiquityAccountBalances = exports._getLiquityAccountBalances = exports.LIQUITY_RECOVERY_MODE_RATIO = exports.LIQUITY_NORMAL_MODE_RATIO = void 0;
16
16
  const decimal_js_1 = __importDefault(require("decimal.js"));
17
17
  const tokens_1 = require("@defisaver/tokens");
18
18
  const common_1 = require("../types/common");
@@ -20,6 +20,7 @@ const contracts_1 = require("../contracts");
20
20
  const types_1 = require("../types");
21
21
  const constants_1 = require("../constants");
22
22
  const viem_1 = require("../services/viem");
23
+ const utils_1 = require("../services/utils");
23
24
  exports.LIQUITY_NORMAL_MODE_RATIO = 110; // MCR
24
25
  exports.LIQUITY_RECOVERY_MODE_RATIO = 150; // CCR
25
26
  const _getLiquityAccountBalances = (provider, network, block, addressMapping, address) => __awaiter(void 0, void 0, void 0, function* () {
@@ -96,3 +97,40 @@ const _getLiquityTroveInfo = (provider, network, address) => __awaiter(void 0, v
96
97
  exports._getLiquityTroveInfo = _getLiquityTroveInfo;
97
98
  const getLiquityTroveInfo = (provider, network, address) => __awaiter(void 0, void 0, void 0, function* () { return (0, exports._getLiquityTroveInfo)((0, viem_1.getViemProvider)(provider, network, { batch: { multicall: true } }), network, address); });
98
99
  exports.getLiquityTroveInfo = getLiquityTroveInfo;
100
+ const getLiquityStakingData = (provider, network, address) => __awaiter(void 0, void 0, void 0, function* () {
101
+ const lqtyStakingView = (0, contracts_1.LiquityLQTYStakingViem)(provider, network);
102
+ const stabilityPoolView = (0, contracts_1.LiquityStabilityPoolViem)(provider, network);
103
+ const [stakes, pendingETHGain, pendingLUSDGain, totalLQTYStakes, stabilityPoolETHGain, stabilityPoolLQTYGain, compoundedLUSDDeposit, totalLUSDDeposits,] = yield Promise.all([
104
+ lqtyStakingView.read.stakes([address]),
105
+ lqtyStakingView.read.getPendingETHGain([address]),
106
+ lqtyStakingView.read.getPendingLUSDGain([address]),
107
+ lqtyStakingView.read.totalLQTYStaked(),
108
+ stabilityPoolView.read.getDepositorETHGain([address]),
109
+ stabilityPoolView.read.getDepositorLQTYGain([address]),
110
+ stabilityPoolView.read.getCompoundedLUSDDeposit([address]),
111
+ stabilityPoolView.read.getTotalLUSDDeposits(),
112
+ ]);
113
+ const totalLUSDDeposited = (0, utils_1.getEthAmountForDecimals)(totalLUSDDeposits, 18);
114
+ const totalLQTYStaked = (0, utils_1.getEthAmountForDecimals)(totalLQTYStakes, 18);
115
+ const stakedLQTY = (0, utils_1.getEthAmountForDecimals)(stakes, 18);
116
+ const stakedLUSDBalance = (0, utils_1.getEthAmountForDecimals)(compoundedLUSDDeposit, 18);
117
+ const rewardETH = (0, utils_1.getEthAmountForDecimals)(pendingETHGain, 18);
118
+ const rewardLUSD = (0, utils_1.getEthAmountForDecimals)(pendingLUSDGain, 18);
119
+ const stabilityRewardETH = (0, utils_1.getEthAmountForDecimals)(stabilityPoolETHGain, 18);
120
+ const stabilityRewardLQTY = (0, utils_1.getEthAmountForDecimals)(stabilityPoolLQTYGain, 18);
121
+ const showStakingBalances = !!(+stakedLQTY || +stakedLUSDBalance
122
+ || +rewardETH || +rewardLUSD
123
+ || +stabilityRewardETH || +stabilityRewardLQTY);
124
+ return {
125
+ totalLUSDDeposited,
126
+ totalLQTYStaked,
127
+ stakedLQTY,
128
+ stakedLUSDBalance,
129
+ rewardETH,
130
+ rewardLUSD,
131
+ stabilityRewardETH,
132
+ stabilityRewardLQTY,
133
+ showStakingBalances,
134
+ };
135
+ });
136
+ exports.getLiquityStakingData = getLiquityStakingData;
@@ -1,6 +1,14 @@
1
1
  import { Client, PublicClient } from 'viem';
2
2
  import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
3
3
  import { LiquityV2AssetsData, LiquityV2MarketData, LiquityV2MarketInfo, LiquityV2TroveData, LiquityV2Versions } from '../types';
4
+ export type SPYieldGainParameters = {
5
+ P: string;
6
+ aggWeightedDebtSum: string;
7
+ currentScale: string;
8
+ lastAggUpdateTime: string;
9
+ totalBoldDeposits: string;
10
+ yieldGainsPending: string;
11
+ };
4
12
  export declare const _getLiquityV2MarketData: (provider: Client, network: NetworkNumber, selectedMarket: LiquityV2MarketInfo) => Promise<LiquityV2MarketData>;
5
13
  export declare const getLiquityV2MarketData: (provider: EthereumProvider, network: NetworkNumber, selectedMarket: LiquityV2MarketInfo) => Promise<LiquityV2MarketData>;
6
14
  export declare const _getLiquityV2UserTroveIds: (provider: PublicClient, network: NetworkNumber, selectedMarket: LiquityV2MarketInfo, troveNFTAddress: EthAddress, limitBlocksForEventFetching: boolean, account: EthAddress) => Promise<{
@@ -29,3 +37,30 @@ export declare const getLiquityV2TroveData: (provider: EthereumProvider, network
29
37
  allMarketsData: Record<LiquityV2Versions, LiquityV2MarketData>;
30
38
  }, fetchDebtInFront?: boolean) => Promise<LiquityV2TroveData>;
31
39
  export declare const getLiquityV2ClaimableCollateral: (collSurplusPoolAddress: EthAddress, account: EthAddress, provider: EthereumProvider, network: NetworkNumber) => Promise<string>;
40
+ export type sBoldYieldParameters = {
41
+ WETH: string;
42
+ wsETH: string;
43
+ rETH: string;
44
+ };
45
+ export declare const getLiquityV2Staking: (provider: Client, network: NetworkNumber, market: LiquityV2Versions, user: EthAddress) => Promise<{
46
+ totalBOLDDeposited: string;
47
+ stakedBOLDBalance: string;
48
+ stabilityRewardColl: string;
49
+ stabilityRewardYield: string;
50
+ showStakingBalances: boolean;
51
+ debtTokenBalance: string;
52
+ stabilityPoolApy: string;
53
+ }>;
54
+ export declare const getLiquitySAndYBold: (provider: Client, network: NetworkNumber, markets: any, user: EthAddress) => Promise<{
55
+ spApy: string;
56
+ yBoldApy: string;
57
+ totalBoldDepositedSBold: string;
58
+ boldRateSBold: string;
59
+ maxWithdrawSBold: string;
60
+ totalBoldDepositedYBold: string;
61
+ boldRateYBold: string;
62
+ maxWithdrawYBold: string;
63
+ sBoldBalance: string;
64
+ yBoldBalance: string;
65
+ stYBoldBalance: string;
66
+ }>;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getLiquityV2ClaimableCollateral = exports.getLiquityV2TroveData = exports._getLiquityV2TroveData = exports.getDebtInFrontForInterestRateLiquityV2 = exports.getLiquityV2UserTroveIds = exports._getLiquityV2UserTroveIds = exports.getLiquityV2MarketData = exports._getLiquityV2MarketData = void 0;
15
+ exports.getLiquitySAndYBold = exports.getLiquityV2Staking = exports.getLiquityV2ClaimableCollateral = exports.getLiquityV2TroveData = exports._getLiquityV2TroveData = exports.getDebtInFrontForInterestRateLiquityV2 = exports.getLiquityV2UserTroveIds = exports._getLiquityV2UserTroveIds = exports.getLiquityV2MarketData = exports._getLiquityV2MarketData = void 0;
16
16
  const decimal_js_1 = __importDefault(require("decimal.js"));
17
17
  const tokens_1 = require("@defisaver/tokens");
18
18
  const contracts_1 = require("../contracts");
@@ -308,3 +308,144 @@ const getLiquityV2ClaimableCollateral = (collSurplusPoolAddress, account, provid
308
308
  return claimableCollateral.toString();
309
309
  });
310
310
  exports.getLiquityV2ClaimableCollateral = getLiquityV2ClaimableCollateral;
311
+ const stabilityPoolAddrForMarket = {
312
+ [types_1.LiquityV2Versions.LiquityV2Eth]: '0x5721cbbd64fc7Ae3Ef44A0A3F9a790A9264Cf9BF',
313
+ [types_1.LiquityV2Versions.LiquityV2WstEth]: '0x9502b7c397e9aa22fe9db7ef7daf21cd2aebe56b',
314
+ [types_1.LiquityV2Versions.LiquityV2REth]: '0xd442e41019b7f5c4dd78f50dc03726c446148695',
315
+ [types_1.LiquityV2Versions.LiquityV2EthLegacy]: constants_1.ZERO_ADDRESS,
316
+ [types_1.LiquityV2Versions.LiquityV2REthLegacy]: constants_1.ZERO_ADDRESS,
317
+ [types_1.LiquityV2Versions.LiquityV2WstEthLegacy]: constants_1.ZERO_ADDRESS,
318
+ };
319
+ const activePoolAddrForMarket = {
320
+ [types_1.LiquityV2Versions.LiquityV2Eth]: '0xeB5A8C825582965f1d84606E078620a84ab16AfE',
321
+ [types_1.LiquityV2Versions.LiquityV2WstEth]: '0x531a8f99c70d6a56a7cee02d6b4281650d7919a0',
322
+ [types_1.LiquityV2Versions.LiquityV2REth]: '0x9074d72cc82dad1e13e454755aa8f144c479532f',
323
+ [types_1.LiquityV2Versions.LiquityV2EthLegacy]: constants_1.ZERO_ADDRESS,
324
+ [types_1.LiquityV2Versions.LiquityV2WstEthLegacy]: constants_1.ZERO_ADDRESS,
325
+ [types_1.LiquityV2Versions.LiquityV2REthLegacy]: constants_1.ZERO_ADDRESS,
326
+ };
327
+ function ceilDiv(a, b) {
328
+ return new decimal_js_1.default(a).add(new decimal_js_1.default(b).sub(1)).div(b).toString();
329
+ }
330
+ const SP_YIELD_SPLIT = new decimal_js_1.default(75).mul(Math.pow(10, 16)).toString(); // 75%
331
+ const calcPendingSPYield = (aggWeightedDebtSum, lastAggUpdateTime, currentTime) => {
332
+ const a = new decimal_js_1.default(aggWeightedDebtSum).mul(new decimal_js_1.default(currentTime).sub(new decimal_js_1.default(lastAggUpdateTime))).toString();
333
+ const b = new decimal_js_1.default(constants_1.SECONDS_PER_YEAR).mul(1000).mul(1e18).toString();
334
+ return new decimal_js_1.default(ceilDiv(a, b)).mul(SP_YIELD_SPLIT).div(1e18).toString();
335
+ };
336
+ const calculateStabilityPoolApy = (spYieldGainParams) => {
337
+ const { aggWeightedDebtSum, totalBoldDeposits, lastAggUpdateTime, yieldGainsPending, } = spYieldGainParams;
338
+ if (new decimal_js_1.default(totalBoldDeposits).eq(0)) {
339
+ return '0';
340
+ }
341
+ const now = Date.now().toString();
342
+ const lastAggUpdateTimeScaled = new decimal_js_1.default(lastAggUpdateTime).mul(1000).toString();
343
+ const pendingSPYield = new decimal_js_1.default(calcPendingSPYield(aggWeightedDebtSum, lastAggUpdateTimeScaled, now)).add(yieldGainsPending).toString();
344
+ const annualizedYield = new decimal_js_1.default(pendingSPYield).mul(constants_1.SECONDS_PER_YEAR).mul(1000).div(new decimal_js_1.default(now).minus(lastAggUpdateTimeScaled))
345
+ .toString();
346
+ return new decimal_js_1.default(annualizedYield).div(totalBoldDeposits).mul(100).toString();
347
+ };
348
+ const getYBoldApyApi = () => __awaiter(void 0, void 0, void 0, function* () {
349
+ try {
350
+ const url = 'https://ydaemon.yearn.fi/1/vaults/0x23346B04a7f55b8760E5860AA5A77383D63491cD?strategiesDetails=withDetails&strategiesCondition=inQueue';
351
+ const yBoldData = yield fetch(url)
352
+ .then(res => res.json())
353
+ .catch(console.error);
354
+ return new decimal_js_1.default(yBoldData.apr.netAPR).mul(100).toString();
355
+ }
356
+ catch (error) {
357
+ console.error('External API Failure: YBold ', error);
358
+ return '0';
359
+ }
360
+ });
361
+ const calculateSPApy = (spYieldGainParams, spAPYs) => {
362
+ const { WETH, wsETH, rETH, } = spYieldGainParams;
363
+ const apy = new decimal_js_1.default(WETH).mul(spAPYs.apyEth).add(new decimal_js_1.default(wsETH).mul(spAPYs.apyWstEth)).add(new decimal_js_1.default(rETH).mul(spAPYs.apyREth))
364
+ .toString();
365
+ return apy;
366
+ };
367
+ const getLiquityV2Staking = (provider, network, market, user) => __awaiter(void 0, void 0, void 0, function* () {
368
+ const stabilityPoolView = (0, contracts_1.createViemContractFromConfigFunc)('LiquityV2StabilityPool', stabilityPoolAddrForMarket[market])(provider, network);
369
+ const activePoolView = (0, contracts_1.createViemContractFromConfigFunc)('LiquityV2ActivePool', activePoolAddrForMarket[market])(provider, network);
370
+ const debtTokenInfo = (0, tokens_1.getAssetInfo)((0, markets_1.LiquityV2Markets)(network)[market].debtToken, network);
371
+ const debtTokenContract = (0, contracts_1.createViemContractFromConfigFunc)('Erc20', debtTokenInfo.address)(provider, network);
372
+ const [stabilityRewardColl, stabilityRewardYield, compoundedBoldDeposit, totalBoldDeposits, P, currentScale, yieldGainsPending, debtTokenBalance, aggWeightedDebtSum, lastAggUpdateTime,] = yield Promise.all([
373
+ stabilityPoolView.read.getDepositorCollGain([user]),
374
+ stabilityPoolView.read.getDepositorYieldGain([user]),
375
+ stabilityPoolView.read.getCompoundedBoldDeposit([user]),
376
+ stabilityPoolView.read.getTotalBoldDeposits(),
377
+ stabilityPoolView.read.P(),
378
+ stabilityPoolView.read.currentScale(),
379
+ stabilityPoolView.read.getYieldGainsPending(),
380
+ debtTokenContract.read.balanceOf([user]),
381
+ activePoolView.read.aggWeightedDebtSum(),
382
+ activePoolView.read.lastAggUpdateTime(),
383
+ ]);
384
+ const stabilityPoolYieldParams = {
385
+ aggWeightedDebtSum: aggWeightedDebtSum.toString(),
386
+ lastAggUpdateTime: lastAggUpdateTime.toString(),
387
+ P: P.toString(),
388
+ currentScale: currentScale.toString(),
389
+ yieldGainsPending: yieldGainsPending.toString(),
390
+ totalBoldDeposits: totalBoldDeposits.toString(),
391
+ };
392
+ const stabilityPoolApy = calculateStabilityPoolApy(stabilityPoolYieldParams);
393
+ const stakedBOLDBalanceForUser = (0, utils_1.getEthAmountForDecimals)(compoundedBoldDeposit.toString(), 18);
394
+ const stabilityRewardCollForUser = (0, utils_1.getEthAmountForDecimals)(stabilityRewardColl.toString(), 18);
395
+ const stabilityRewardYieldForUser = (0, utils_1.getEthAmountForDecimals)(stabilityRewardYield.toString(), 18);
396
+ return {
397
+ totalBOLDDeposited: (0, utils_1.getEthAmountForDecimals)(totalBoldDeposits.toString(), 18),
398
+ stakedBOLDBalance: stakedBOLDBalanceForUser,
399
+ stabilityRewardColl: stabilityRewardCollForUser,
400
+ stabilityRewardYield: stabilityRewardYieldForUser,
401
+ showStakingBalances: !!(+stakedBOLDBalanceForUser || +stabilityRewardCollForUser || +stabilityRewardYieldForUser),
402
+ debtTokenBalance: (0, utils_1.getEthAmountForDecimals)(debtTokenBalance.toString(), debtTokenInfo.decimals),
403
+ stabilityPoolApy,
404
+ };
405
+ });
406
+ exports.getLiquityV2Staking = getLiquityV2Staking;
407
+ const getLiquitySAndYBold = (provider, network, markets, user) => __awaiter(void 0, void 0, void 0, function* () {
408
+ const sBold = (0, contracts_1.LiquityV2sBoldVaultViem)(provider, network);
409
+ const yBold = (0, contracts_1.createViemContractFromConfigFunc)('Erc4626', '0x9F4330700a36B29952869fac9b33f45EEdd8A3d8')(provider, network);
410
+ const stYBold = (0, contracts_1.createViemContractFromConfigFunc)('Erc4626', '0x23346B04a7f55b8760E5860AA5A77383D63491cD')(provider, network);
411
+ const spAPYs = {
412
+ apyEth: markets[types_1.LiquityV2Versions.LiquityV2Eth].data.stabilityPoolApy,
413
+ apyWstEth: markets[types_1.LiquityV2Versions.LiquityV2WstEth].data.stabilityPoolApy,
414
+ apyREth: markets[types_1.LiquityV2Versions.LiquityV2REth].data.stabilityPoolApy,
415
+ };
416
+ const [sBoldTotalAssets, sBoldConvertToShares, sBoldMaxWithdraw, wethApy, wsETHApy, rETHApy, yBoldTotalAssets, yBoldMaxWithdraw, stYBoldConvertToShares, yBoldApy, sBoldBalance, yBoldBalance, stYBoldBalance,] = yield Promise.all([
417
+ sBold.read.totalAssets(),
418
+ sBold.read.convertToShares([BigInt(1e18)]),
419
+ sBold.read.maxWithdraw([user]),
420
+ sBold.read.sps([BigInt(0)]),
421
+ sBold.read.sps([BigInt(1)]),
422
+ sBold.read.sps([BigInt(2)]),
423
+ yBold.read.totalAssets(),
424
+ yBold.read.maxWithdraw([user]),
425
+ stYBold.read.convertToShares([BigInt(1e18)]),
426
+ getYBoldApyApi(),
427
+ sBold.read.balanceOf([user]),
428
+ yBold.read.balanceOf([user]),
429
+ stYBold.read.balanceOf([user]),
430
+ ]);
431
+ const spMarketRes = {
432
+ WETH: new decimal_js_1.default(wethApy[1]).div(10000).toString(),
433
+ wsETH: new decimal_js_1.default(wsETHApy[1]).div(10000).toString(),
434
+ rETH: new decimal_js_1.default(rETHApy[1]).div(10000).toString(),
435
+ };
436
+ const spApy = calculateSPApy(spMarketRes, spAPYs);
437
+ return {
438
+ spApy,
439
+ yBoldApy,
440
+ totalBoldDepositedSBold: (0, tokens_1.assetAmountInEth)(sBoldTotalAssets.toString(), 'sBOLD'),
441
+ boldRateSBold: (0, tokens_1.assetAmountInEth)(sBoldConvertToShares.toString(), 'sBOLD'),
442
+ maxWithdrawSBold: (0, tokens_1.assetAmountInEth)(sBoldMaxWithdraw.toString(), 'sBOLD'),
443
+ totalBoldDepositedYBold: (0, tokens_1.assetAmountInEth)(yBoldTotalAssets.toString(), 'yBOLD'),
444
+ boldRateYBold: (0, tokens_1.assetAmountInEth)(stYBoldConvertToShares.toString(), 'yBOLD'),
445
+ maxWithdrawYBold: (0, tokens_1.assetAmountInEth)(yBoldMaxWithdraw.toString(), 'yBOLD'),
446
+ sBoldBalance: (0, tokens_1.assetAmountInEth)(sBoldBalance.toString(), 'sBOLD'),
447
+ yBoldBalance: (0, tokens_1.assetAmountInEth)(yBoldBalance.toString(), 'yBOLD'),
448
+ stYBoldBalance: (0, tokens_1.assetAmountInEth)(stYBoldBalance.toString(), 'yBOLD'),
449
+ };
450
+ });
451
+ exports.getLiquitySAndYBold = getLiquitySAndYBold;
@@ -7,3 +7,8 @@ export declare const _getMorphoBlueAccountBalances: (provider: Client, network:
7
7
  export declare const getMorphoBlueAccountBalances: (provider: EthereumProvider, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress, selectedMarket: MorphoBlueMarketData) => Promise<PositionBalances>;
8
8
  export declare function _getMorphoBlueAccountData(provider: Client, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoBlueMarketData, marketInfo: MorphoBlueMarketInfo): Promise<MorphoBluePositionData>;
9
9
  export declare function getMorphoBlueAccountData(provider: EthereumProvider, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoBlueMarketData, marketInfo: MorphoBlueMarketInfo): Promise<MorphoBluePositionData>;
10
+ export declare function getMorphoEarn(provider: Client, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoBlueMarketData, marketInfo: MorphoBlueMarketInfo): Promise<{
11
+ apy: string;
12
+ amount: string;
13
+ amountUsd: string;
14
+ }>;
@@ -17,6 +17,7 @@ exports._getMorphoBlueMarketData = _getMorphoBlueMarketData;
17
17
  exports.getMorphoBlueMarketData = getMorphoBlueMarketData;
18
18
  exports._getMorphoBlueAccountData = _getMorphoBlueAccountData;
19
19
  exports.getMorphoBlueAccountData = getMorphoBlueAccountData;
20
+ exports.getMorphoEarn = getMorphoEarn;
20
21
  const decimal_js_1 = __importDefault(require("decimal.js"));
21
22
  const tokens_1 = require("@defisaver/tokens");
22
23
  const common_1 = require("../types/common");
@@ -213,3 +214,37 @@ function getMorphoBlueAccountData(provider, network, account, selectedMarket, ma
213
214
  return _getMorphoBlueAccountData((0, viem_1.getViemProvider)(provider, network), network, account, selectedMarket, marketInfo);
214
215
  });
215
216
  }
217
+ function getMorphoEarn(provider, network, account, selectedMarket, marketInfo) {
218
+ return __awaiter(this, void 0, void 0, function* () {
219
+ const { loanToken, collateralToken, oracle, irm, lltv, } = selectedMarket;
220
+ const lltvInWei = new decimal_js_1.default(lltv).mul(constants_1.WAD).toString();
221
+ const viewContract = (0, contracts_1.MorphoBlueViewContractViem)(provider, network);
222
+ const loanInfo = (yield viewContract.read.getUserInfo([
223
+ {
224
+ loanToken, collateralToken, oracle, irm, lltv: BigInt(lltvInWei),
225
+ },
226
+ account
227
+ ]));
228
+ const loanTokenInfo = marketInfo.assetsData[marketInfo.loanToken];
229
+ const loanTokenSupplied = (0, tokens_1.assetAmountInEth)(loanInfo.suppliedInAssets.toString(), marketInfo.loanToken);
230
+ const loanTokenSuppliedUsd = new decimal_js_1.default(loanTokenSupplied).mul(loanTokenInfo.price).toString();
231
+ const usedAssets = {
232
+ [marketInfo.loanToken]: {
233
+ symbol: loanTokenInfo.symbol,
234
+ supplied: loanTokenSupplied,
235
+ borrowed: '0',
236
+ isSupplied: new decimal_js_1.default(loanInfo.suppliedInAssets.toString()).gt(0),
237
+ isBorrowed: false,
238
+ collateral: false,
239
+ suppliedUsd: loanTokenSuppliedUsd,
240
+ borrowedUsd: '0',
241
+ },
242
+ };
243
+ const { netApy } = (0, staking_1.calculateNetApy)({ usedAssets, assetsData: marketInfo.assetsData });
244
+ return {
245
+ apy: netApy,
246
+ amount: loanTokenSupplied,
247
+ amountUsd: loanTokenSuppliedUsd,
248
+ };
249
+ });
250
+ }
@@ -1,3 +1,8 @@
1
1
  import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
2
2
  import { PortfolioPositionsData } from '../types';
3
- export declare function getPortfolioData(provider: EthereumProvider, network: NetworkNumber, defaultProvider: EthereumProvider, addresses: EthAddress[], summerFiAddresses: EthAddress[]): Promise<PortfolioPositionsData>;
3
+ export declare function getPortfolioData(provider: EthereumProvider, network: NetworkNumber, defaultProvider: EthereumProvider, addresses: EthAddress[], summerFiAddresses: EthAddress[]): Promise<{
4
+ positions: PortfolioPositionsData;
5
+ stakingPositions: any;
6
+ rewardsData: any;
7
+ markets: any;
8
+ }>;