@defisaver/positions-sdk 2.1.79-aave-v4-9-dev → 2.1.79-aave-v4-11-dev

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.
@@ -30,6 +30,16 @@ export interface AaveV4TokenizationSpokeDataParsed {
30
30
  key: string | null;
31
31
  symbol: string;
32
32
  hubKey: string;
33
+ spokeActive: boolean;
34
+ spokeHalted: boolean;
35
+ /** Deposit cap in asset units (wei string) */
36
+ spokeDepositCap: string;
37
+ /** Total assets currently in spoke in asset units (wei string) */
38
+ spokeTotalAssets: string;
39
+ /** Available hub liquidity in asset units (wei string) */
40
+ hubLiquidity: string;
41
+ /** The conversion rate from assets to shares expressed in asset units. */
42
+ convertToShares: string;
33
43
  userSuppliedAssetsEth: string;
34
44
  userSuppliedSharesEth: string;
35
45
  userSuppliedAssets: string;
@@ -108,7 +108,7 @@ function getAaveV4TokenizationSpokesData(provider, network, userAddress) {
108
108
  const viewContract = (0, contracts_1.AaveV4ViewContractViem)(client, network);
109
109
  const raw = yield viewContract.read.getTokenizationSpokesData([spokes, userAddress]);
110
110
  return raw.map((r, i) => {
111
- var _a, _b, _c, _d, _e;
111
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
112
112
  const vaultAddress = spokes[i];
113
113
  const key = (_a = AAVE_V4_TOKENIZED_SPOKE_ADDRESS_TO_KEY[vaultAddress.toLowerCase()]) !== null && _a !== void 0 ? _a : null;
114
114
  const symbol = (0, utils_1.wethToEth)((0, tokens_1.getAssetInfoByAddress)(r.underlyingAsset, network).symbol);
@@ -126,6 +126,12 @@ function getAaveV4TokenizationSpokesData(provider, network, userAddress) {
126
126
  key,
127
127
  symbol,
128
128
  hubKey,
129
+ spokeActive: (_f = r.spokeActive) !== null && _f !== void 0 ? _f : true,
130
+ spokeHalted: (_g = r.spokeHalted) !== null && _g !== void 0 ? _g : false,
131
+ spokeDepositCap: ((_h = r.spokeDepositCap) !== null && _h !== void 0 ? _h : 0).toString(),
132
+ spokeTotalAssets: ((_j = r.spokeTotalAssets) !== null && _j !== void 0 ? _j : 0).toString(),
133
+ hubLiquidity: ((_k = r.hubLiquidity) !== null && _k !== void 0 ? _k : 0).toString(),
134
+ convertToShares: ((_l = r.convertToShares) !== null && _l !== void 0 ? _l : 0).toString(),
129
135
  userSuppliedAssetsEth,
130
136
  userSuppliedSharesEth,
131
137
  userSuppliedAssets: userSuppliedAssetsRaw.toString(),
@@ -221,7 +221,7 @@ const aaveV4GetAggregatedPositionData = ({ usedAssets, assetsData, network, useU
221
221
  }
222
222
  payload.minCollRatio = new decimal_js_1.default(payload.suppliedCollateralUsd).div(payload.borrowLimitUsd).mul(100).toString();
223
223
  payload.collLiquidationRatio = new decimal_js_1.default(payload.suppliedCollateralUsd).div(payload.liquidationLimitUsd).mul(100).toString();
224
- // payload.healthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
224
+ payload.healthRatio = new decimal_js_1.default(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
225
225
  payload.minHealthRatio = new decimal_js_1.default(payload.liquidationLimitUsd).div(payload.borrowLimitUsd).toDP(4).toString();
226
226
  const { netApy, incentiveUsd, totalInterestUsd } = (0, exports.calculateNetApyAaveV4)({ usedAssets, assetsData });
227
227
  payload.netApy = netApy;
@@ -144,6 +144,7 @@ export interface AaveV4AggregatedPositionData {
144
144
  minCollRatio: string;
145
145
  collLiquidationRatio: string;
146
146
  minHealthRatio: string;
147
+ healthRatio: string;
147
148
  netApy: string;
148
149
  incentiveUsd: string;
149
150
  totalInterestUsd: string;
@@ -30,6 +30,16 @@ export interface AaveV4TokenizationSpokeDataParsed {
30
30
  key: string | null;
31
31
  symbol: string;
32
32
  hubKey: string;
33
+ spokeActive: boolean;
34
+ spokeHalted: boolean;
35
+ /** Deposit cap in asset units (wei string) */
36
+ spokeDepositCap: string;
37
+ /** Total assets currently in spoke in asset units (wei string) */
38
+ spokeTotalAssets: string;
39
+ /** Available hub liquidity in asset units (wei string) */
40
+ hubLiquidity: string;
41
+ /** The conversion rate from assets to shares expressed in asset units. */
42
+ convertToShares: string;
33
43
  userSuppliedAssetsEth: string;
34
44
  userSuppliedSharesEth: string;
35
45
  userSuppliedAssets: string;
@@ -101,7 +101,7 @@ export function getAaveV4TokenizationSpokesData(provider, network, userAddress)
101
101
  const viewContract = AaveV4ViewContractViem(client, network);
102
102
  const raw = yield viewContract.read.getTokenizationSpokesData([spokes, userAddress]);
103
103
  return raw.map((r, i) => {
104
- var _a, _b, _c, _d, _e;
104
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
105
105
  const vaultAddress = spokes[i];
106
106
  const key = (_a = AAVE_V4_TOKENIZED_SPOKE_ADDRESS_TO_KEY[vaultAddress.toLowerCase()]) !== null && _a !== void 0 ? _a : null;
107
107
  const symbol = wethToEth(getAssetInfoByAddress(r.underlyingAsset, network).symbol);
@@ -119,6 +119,12 @@ export function getAaveV4TokenizationSpokesData(provider, network, userAddress)
119
119
  key,
120
120
  symbol,
121
121
  hubKey,
122
+ spokeActive: (_f = r.spokeActive) !== null && _f !== void 0 ? _f : true,
123
+ spokeHalted: (_g = r.spokeHalted) !== null && _g !== void 0 ? _g : false,
124
+ spokeDepositCap: ((_h = r.spokeDepositCap) !== null && _h !== void 0 ? _h : 0).toString(),
125
+ spokeTotalAssets: ((_j = r.spokeTotalAssets) !== null && _j !== void 0 ? _j : 0).toString(),
126
+ hubLiquidity: ((_k = r.hubLiquidity) !== null && _k !== void 0 ? _k : 0).toString(),
127
+ convertToShares: ((_l = r.convertToShares) !== null && _l !== void 0 ? _l : 0).toString(),
122
128
  userSuppliedAssetsEth,
123
129
  userSuppliedSharesEth,
124
130
  userSuppliedAssets: userSuppliedAssetsRaw.toString(),
@@ -210,7 +210,7 @@ export const aaveV4GetAggregatedPositionData = ({ usedAssets, assetsData, networ
210
210
  }
211
211
  payload.minCollRatio = new Dec(payload.suppliedCollateralUsd).div(payload.borrowLimitUsd).mul(100).toString();
212
212
  payload.collLiquidationRatio = new Dec(payload.suppliedCollateralUsd).div(payload.liquidationLimitUsd).mul(100).toString();
213
- // payload.healthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
213
+ payload.healthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
214
214
  payload.minHealthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowLimitUsd).toDP(4).toString();
215
215
  const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApyAaveV4({ usedAssets, assetsData });
216
216
  payload.netApy = netApy;
@@ -144,6 +144,7 @@ export interface AaveV4AggregatedPositionData {
144
144
  minCollRatio: string;
145
145
  collLiquidationRatio: string;
146
146
  minHealthRatio: string;
147
+ healthRatio: string;
147
148
  netApy: string;
148
149
  incentiveUsd: string;
149
150
  totalInterestUsd: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "2.1.79-aave-v4-9-dev",
3
+ "version": "2.1.79-aave-v4-11-dev",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -115,6 +115,19 @@ export interface AaveV4TokenizationSpokeDataParsed {
115
115
  key: string | null;
116
116
  symbol: string;
117
117
  hubKey: string;
118
+ // ---- Spoke ----
119
+ spokeActive: boolean;
120
+ spokeHalted: boolean;
121
+ /** Deposit cap in asset units (wei string) */
122
+ spokeDepositCap: string;
123
+ /** Total assets currently in spoke in asset units (wei string) */
124
+ spokeTotalAssets: string;
125
+ // ---- Hub ----
126
+ /** Available hub liquidity in asset units (wei string) */
127
+ hubLiquidity: string;
128
+ /** The conversion rate from assets to shares expressed in asset units. */
129
+ convertToShares: string;
130
+ // ---- User ----
118
131
  userSuppliedAssetsEth: string;
119
132
  userSuppliedSharesEth: string;
120
133
  userSuppliedAssets: string;
@@ -166,6 +179,12 @@ export async function getAaveV4TokenizationSpokesData(
166
179
  key,
167
180
  symbol,
168
181
  hubKey,
182
+ spokeActive: r.spokeActive ?? true,
183
+ spokeHalted: r.spokeHalted ?? false,
184
+ spokeDepositCap: (r.spokeDepositCap ?? 0).toString(),
185
+ spokeTotalAssets: (r.spokeTotalAssets ?? 0).toString(),
186
+ hubLiquidity: (r.hubLiquidity ?? 0).toString(),
187
+ convertToShares: (r.convertToShares ?? 0).toString(),
169
188
  userSuppliedAssetsEth,
170
189
  userSuppliedSharesEth,
171
190
  userSuppliedAssets: userSuppliedAssetsRaw.toString(),
@@ -279,7 +279,7 @@ export const aaveV4GetAggregatedPositionData = ({
279
279
  }
280
280
  payload.minCollRatio = new Dec(payload.suppliedCollateralUsd).div(payload.borrowLimitUsd).mul(100).toString();
281
281
  payload.collLiquidationRatio = new Dec(payload.suppliedCollateralUsd).div(payload.liquidationLimitUsd).mul(100).toString();
282
- // payload.healthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
282
+ payload.healthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
283
283
  payload.minHealthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowLimitUsd).toDP(4).toString();
284
284
 
285
285
  const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApyAaveV4({ usedAssets, assetsData });
@@ -158,6 +158,7 @@ export interface AaveV4AggregatedPositionData {
158
158
  minCollRatio: string,
159
159
  collLiquidationRatio: string,
160
160
  minHealthRatio: string,
161
+ healthRatio: string,
161
162
  netApy: string,
162
163
  incentiveUsd: string,
163
164
  totalInterestUsd: string,