@defisaver/positions-sdk 2.1.169-portfolio-api-dev → 2.1.169
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.
- package/cjs/aaveV3/index.d.ts +12 -2
- package/cjs/aaveV3/sgho.d.ts +16 -2
- package/cjs/aaveV4/lend.d.ts +43 -2
- package/cjs/claiming/aaveV3.d.ts +2 -2
- package/cjs/claiming/ethena.d.ts +1 -2
- package/cjs/claiming/king.d.ts +1 -2
- package/cjs/claiming/spark.d.ts +2 -2
- package/cjs/fluid/index.d.ts +49 -5
- package/cjs/liquity/index.d.ts +12 -2
- package/cjs/liquityV2/index.d.ts +23 -8
- package/cjs/liquityV2/index.js +19 -37
- package/cjs/markets/morphoBlue/index.d.ts +2 -0
- package/cjs/markets/morphoBlue/index.js +18 -1
- package/cjs/portfolio/index.d.ts +8 -16
- package/cjs/portfolio/index.js +520 -458
- package/cjs/savings/index.d.ts +2 -8
- package/cjs/savings/index.js +4 -33
- package/cjs/types/aave.d.ts +2 -98
- package/cjs/types/aaveV4.d.ts +0 -44
- package/cjs/types/compound.d.ts +2 -26
- package/cjs/types/curveUsd.d.ts +1 -9
- package/cjs/types/fluid.d.ts +0 -13
- package/cjs/types/index.d.ts +0 -1
- package/cjs/types/index.js +0 -1
- package/cjs/types/liquity.d.ts +0 -12
- package/cjs/types/liquityV2.d.ts +0 -24
- package/cjs/types/llamaLend.d.ts +1 -12
- package/cjs/types/morphoBlue.d.ts +1 -2
- package/cjs/types/morphoBlue.js +1 -0
- package/cjs/types/portfolio.d.ts +5 -125
- package/cjs/types/savings/index.d.ts +1 -9
- package/cjs/types/spark.d.ts +1 -21
- package/cjs/umbrella/index.d.ts +3 -2
- package/esm/aaveV3/index.d.ts +12 -2
- package/esm/aaveV3/sgho.d.ts +16 -2
- package/esm/aaveV4/lend.d.ts +43 -2
- package/esm/claiming/aaveV3.d.ts +2 -2
- package/esm/claiming/aaveV3.js +1 -1
- package/esm/claiming/ethena.d.ts +1 -2
- package/esm/claiming/king.d.ts +1 -2
- package/esm/claiming/spark.d.ts +2 -2
- package/esm/claiming/spark.js +1 -1
- package/esm/fluid/index.d.ts +49 -5
- package/esm/liquity/index.d.ts +12 -2
- package/esm/liquityV2/index.d.ts +23 -8
- package/esm/liquityV2/index.js +18 -35
- package/esm/markets/morphoBlue/index.d.ts +2 -0
- package/esm/markets/morphoBlue/index.js +16 -0
- package/esm/portfolio/index.d.ts +8 -16
- package/esm/portfolio/index.js +522 -458
- package/esm/savings/index.d.ts +2 -8
- package/esm/savings/index.js +3 -31
- package/esm/types/aave.d.ts +2 -98
- package/esm/types/aaveV4.d.ts +0 -44
- package/esm/types/compound.d.ts +2 -26
- package/esm/types/curveUsd.d.ts +1 -9
- package/esm/types/fluid.d.ts +0 -13
- package/esm/types/index.d.ts +0 -1
- package/esm/types/index.js +0 -1
- package/esm/types/liquity.d.ts +0 -12
- package/esm/types/liquityV2.d.ts +0 -24
- package/esm/types/llamaLend.d.ts +1 -12
- package/esm/types/morphoBlue.d.ts +1 -2
- package/esm/types/morphoBlue.js +1 -0
- package/esm/types/portfolio.d.ts +5 -125
- package/esm/types/savings/index.d.ts +1 -9
- package/esm/types/spark.d.ts +1 -21
- package/esm/umbrella/index.d.ts +3 -2
- package/package.json +2 -2
- package/src/aaveV3/index.ts +1 -2
- package/src/aaveV3/sgho.ts +17 -2
- package/src/aaveV4/lend.ts +48 -2
- package/src/claiming/aaveV3.ts +2 -4
- package/src/claiming/ethena.ts +5 -5
- package/src/claiming/king.ts +3 -3
- package/src/claiming/spark.ts +4 -6
- package/src/fluid/index.ts +3 -4
- package/src/liquity/index.ts +2 -2
- package/src/liquityV2/index.ts +22 -48
- package/src/markets/morphoBlue/index.ts +16 -0
- package/src/portfolio/index.ts +331 -306
- package/src/savings/index.ts +4 -41
- package/src/types/aave.ts +1 -104
- package/src/types/aaveV4.ts +0 -49
- package/src/types/compound.ts +2 -38
- package/src/types/curveUsd.ts +1 -17
- package/src/types/fluid.ts +0 -14
- package/src/types/index.ts +0 -1
- package/src/types/liquity.ts +1 -13
- package/src/types/liquityV2.ts +1 -26
- package/src/types/llamaLend.ts +1 -19
- package/src/types/morphoBlue.ts +1 -3
- package/src/types/portfolio.ts +5 -151
- package/src/types/savings/index.ts +1 -12
- package/src/types/spark.ts +1 -25
- package/src/umbrella/index.ts +1 -2
- package/cjs/portfolio/lendingProtocols.d.ts +0 -184
- package/cjs/portfolio/lendingProtocols.js +0 -196
- package/esm/portfolio/lendingProtocols.d.ts +0 -184
- package/esm/portfolio/lendingProtocols.js +0 -189
- package/src/portfolio/lendingProtocols.ts +0 -281
package/src/savings/index.ts
CHANGED
|
@@ -2,9 +2,6 @@ import {
|
|
|
2
2
|
MakerDsrType,
|
|
3
3
|
MorphoVaultType,
|
|
4
4
|
SavingsData,
|
|
5
|
-
SavingsDataWithErrors,
|
|
6
|
-
SavingsErrors,
|
|
7
|
-
SavingsVaultKey,
|
|
8
5
|
SkySavingsType,
|
|
9
6
|
SparkSavingsVaultType,
|
|
10
7
|
SummerVaultType,
|
|
@@ -30,16 +27,11 @@ export {
|
|
|
30
27
|
yearnV3Vaults,
|
|
31
28
|
};
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
* Every savings vault of a network for the given accounts, and, for each vault that came back without data, why — so
|
|
35
|
-
* a vault that failed is never mistaken for one the accounts have nothing in.
|
|
36
|
-
*/
|
|
37
|
-
export const getSavingsDataWithErrors = async (
|
|
30
|
+
export const getSavingsData = async (
|
|
38
31
|
provider: EthereumProvider,
|
|
39
32
|
network: NetworkNumber,
|
|
40
33
|
accounts: EthAddress[],
|
|
41
|
-
)
|
|
42
|
-
const isMainnet = network === NetworkNumber.Eth;
|
|
34
|
+
) => {
|
|
43
35
|
const morphoVaultsList = (Object.keys(morphoVaults.morphoVaultsOptions.MORPHO_VAULTS) as MorphoVaultType[])
|
|
44
36
|
.filter((key) => morphoVaults.morphoVaultsOptions.getMorphoVault(key).network === network);
|
|
45
37
|
const yearnVaultsList = Object.keys(yearnVaults.yearnVaultsOptions.YEARN_VAULTS) as YearnVaultType[];
|
|
@@ -48,17 +40,7 @@ export const getSavingsDataWithErrors = async (
|
|
|
48
40
|
const summerVaultsList = (Object.keys(summerVaults.summerVaultsOptions.SUMMER_VAULTS) as SummerVaultType[])
|
|
49
41
|
.filter((key) => summerVaults.summerVaultsOptions.getSummerVault(key).network === network);
|
|
50
42
|
|
|
51
|
-
// Every vault read on this network, so one left without data or an error can still be reported.
|
|
52
|
-
const vaultKeys: SavingsVaultKey[] = [
|
|
53
|
-
...morphoVaultsList,
|
|
54
|
-
...(isMainnet ? [
|
|
55
|
-
...yearnVaultsList, ...sparkSavingsVaultsList, ...yearnV3VaultsList, MakerDsrType.MakerDsrVault, SkySavingsType.SkySavings,
|
|
56
|
-
] : []),
|
|
57
|
-
...summerVaultsList,
|
|
58
|
-
];
|
|
59
|
-
|
|
60
43
|
const savingsData: SavingsData = {};
|
|
61
|
-
const errors: SavingsErrors = {};
|
|
62
44
|
|
|
63
45
|
await Promise.all([
|
|
64
46
|
...(morphoVaultsList.length ? [
|
|
@@ -69,11 +51,10 @@ export const getSavingsDataWithErrors = async (
|
|
|
69
51
|
Object.assign(savingsData, data);
|
|
70
52
|
} catch (err) {
|
|
71
53
|
console.error('[getSavingsData] Error fetching morpho vaults:', err);
|
|
72
|
-
morphoVaultsList.forEach((vaultKey) => { errors[vaultKey] = `Error fetching morpho vault ${vaultKey}`; });
|
|
73
54
|
}
|
|
74
55
|
})(),
|
|
75
56
|
] : []),
|
|
76
|
-
...(
|
|
57
|
+
...(network === NetworkNumber.Eth ? [
|
|
77
58
|
...yearnVaultsList.map(async (vaultKey) => {
|
|
78
59
|
try {
|
|
79
60
|
const vault = yearnVaults.yearnVaultsOptions.getYearnVault(vaultKey);
|
|
@@ -81,7 +62,6 @@ export const getSavingsDataWithErrors = async (
|
|
|
81
62
|
savingsData[vaultKey] = data;
|
|
82
63
|
} catch (err) {
|
|
83
64
|
console.error(`[getSavingsData] Error fetching yearn vault ${vaultKey}:`, err);
|
|
84
|
-
errors[vaultKey] = `Error fetching yearn vault ${vaultKey}`;
|
|
85
65
|
}
|
|
86
66
|
}),
|
|
87
67
|
...sparkSavingsVaultsList.map(async (vaultKey) => {
|
|
@@ -91,7 +71,6 @@ export const getSavingsDataWithErrors = async (
|
|
|
91
71
|
savingsData[vaultKey] = data;
|
|
92
72
|
} catch (err) {
|
|
93
73
|
console.error(`[getSavingsData] Error fetching spark savings vault ${vaultKey}:`, err);
|
|
94
|
-
errors[vaultKey] = `Error fetching spark savings vault ${vaultKey}`;
|
|
95
74
|
}
|
|
96
75
|
}),
|
|
97
76
|
...yearnV3VaultsList.map(async (vaultKey) => {
|
|
@@ -101,7 +80,6 @@ export const getSavingsDataWithErrors = async (
|
|
|
101
80
|
savingsData[vaultKey] = data;
|
|
102
81
|
} catch (err) {
|
|
103
82
|
console.error(`[getSavingsData] Error fetching yearn v3 vault ${vaultKey}:`, err);
|
|
104
|
-
errors[vaultKey] = `Error fetching yearn v3 vault ${vaultKey}`;
|
|
105
83
|
}
|
|
106
84
|
}),
|
|
107
85
|
(async () => {
|
|
@@ -110,7 +88,6 @@ export const getSavingsDataWithErrors = async (
|
|
|
110
88
|
savingsData[MakerDsrType.MakerDsrVault] = data;
|
|
111
89
|
} catch (err) {
|
|
112
90
|
console.error('[getSavingsData] Error fetching maker DSR data:', err);
|
|
113
|
-
errors[MakerDsrType.MakerDsrVault] = 'Error fetching maker DSR data';
|
|
114
91
|
}
|
|
115
92
|
})(),
|
|
116
93
|
(async () => {
|
|
@@ -119,7 +96,6 @@ export const getSavingsDataWithErrors = async (
|
|
|
119
96
|
savingsData[SkySavingsType.SkySavings] = data;
|
|
120
97
|
} catch (err) {
|
|
121
98
|
console.error('[getSavingsData] Error fetching Sky savings data:', err);
|
|
122
|
-
errors[SkySavingsType.SkySavings] = 'Error fetching Sky savings data';
|
|
123
99
|
}
|
|
124
100
|
})(),
|
|
125
101
|
] : []),
|
|
@@ -130,22 +106,9 @@ export const getSavingsDataWithErrors = async (
|
|
|
130
106
|
savingsData[vaultKey] = data;
|
|
131
107
|
} catch (err) {
|
|
132
108
|
console.error(`[getSavingsData] Error fetching summer vault ${vaultKey}:`, err);
|
|
133
|
-
errors[vaultKey] = `Error fetching summer vault ${vaultKey}`;
|
|
134
109
|
}
|
|
135
110
|
}),
|
|
136
111
|
]);
|
|
137
112
|
|
|
138
|
-
|
|
139
|
-
vaultKeys.forEach((vaultKey) => {
|
|
140
|
-
if (!savingsData[vaultKey] && !errors[vaultKey]) errors[vaultKey] = `No data returned for savings vault ${vaultKey}`;
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
return { data: savingsData, errors };
|
|
113
|
+
return savingsData;
|
|
144
114
|
};
|
|
145
|
-
|
|
146
|
-
/** Every savings vault of a network for the given accounts. A vault that failed is left out: use getSavingsDataWithErrors to tell why. */
|
|
147
|
-
export const getSavingsData = async (
|
|
148
|
-
provider: EthereumProvider,
|
|
149
|
-
network: NetworkNumber,
|
|
150
|
-
accounts: EthAddress[],
|
|
151
|
-
): Promise<SavingsData> => (await getSavingsDataWithErrors(provider, network, accounts)).data;
|
package/src/types/aave.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
EthAddress,
|
|
3
2
|
IncentiveData,
|
|
4
3
|
LeverageType,
|
|
5
4
|
MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber,
|
|
@@ -98,9 +97,6 @@ export interface AaveV3AssetData extends AaveAssetData {
|
|
|
98
97
|
liquidationBonus: string,
|
|
99
98
|
supplyIncentives: IncentiveData[];
|
|
100
99
|
borrowIncentives: IncentiveData[];
|
|
101
|
-
// Set by _getAaveV3MarketData. Optional, so objects built by hand still type-check.
|
|
102
|
-
aTokenAddress?: EthAddress,
|
|
103
|
-
vTokenAddress?: EthAddress,
|
|
104
100
|
}
|
|
105
101
|
|
|
106
102
|
export type EModeCategoriesData = Record<number, EModeCategoryData>;
|
|
@@ -142,15 +138,7 @@ export type AaveV2UsedAssets = AaveUsedAssets<AaveV2UsedAsset>;
|
|
|
142
138
|
|
|
143
139
|
export type AaveV3UsedAssets = AaveUsedAssets<AaveV3UsedAsset>;
|
|
144
140
|
|
|
145
|
-
|
|
146
|
-
* Fields aaveAnyGetAggregatedPositionData adds to every Aave V2/V3 position at runtime, on top of those declared
|
|
147
|
-
* below. Optional, so code that builds a position by hand keeps compiling.
|
|
148
|
-
*/
|
|
149
|
-
export type AavePositionAggregatedFields = Partial<Omit<AaveV3AggregatedPositionData,
|
|
150
|
-
| keyof MMPositionData | 'ratio' | 'collRatio' | 'safetyRatioWithLtvZeroFallback' | 'suppliedUsd' | 'borrowedUsd'
|
|
151
|
-
| 'borrowLimitUsd' | 'suppliedCollateralUsd' | 'incentiveUsd' | 'totalInterestUsd'>>;
|
|
152
|
-
|
|
153
|
-
export interface AavePositionData extends MMPositionData, AavePositionAggregatedFields {
|
|
141
|
+
export interface AavePositionData extends MMPositionData {
|
|
154
142
|
ratio: string,
|
|
155
143
|
minRatio: string,
|
|
156
144
|
collRatio: string,
|
|
@@ -171,11 +159,6 @@ export interface AavePositionData extends MMPositionData, AavePositionAggregated
|
|
|
171
159
|
|
|
172
160
|
export interface AaveV2PositionData extends AavePositionData {
|
|
173
161
|
usedAssets: AaveV2UsedAssets,
|
|
174
|
-
// Always their empty values: _getAaveV2AccountData starts from Aave V3's EMPTY_AAVE_DATA, which carries them.
|
|
175
|
-
eModeCategory?: number,
|
|
176
|
-
isInIsolationMode?: boolean,
|
|
177
|
-
isInSiloedMode?: boolean,
|
|
178
|
-
eModeCategories?: { [key: number]: EModeCategoryDataMapping },
|
|
179
162
|
}
|
|
180
163
|
|
|
181
164
|
export interface AaveV3PositionData extends AavePositionData {
|
|
@@ -223,89 +206,3 @@ export interface AaveHelperCommon {
|
|
|
223
206
|
selectedMarket: Partial<AaveMarketInfo>,
|
|
224
207
|
network?: NetworkNumber,
|
|
225
208
|
}
|
|
226
|
-
|
|
227
|
-
export interface SghoUserData {
|
|
228
|
-
shares: string;
|
|
229
|
-
balance: string;
|
|
230
|
-
maxDeposit: string;
|
|
231
|
-
maxWithdraw: string;
|
|
232
|
-
underlyingBalance: string;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export interface SghoData {
|
|
236
|
-
totalAssets: string;
|
|
237
|
-
totalSupply: string;
|
|
238
|
-
supplyCap: string;
|
|
239
|
-
/** Target savings rate as an APY percent (e.g. "4.25" for 4.25%). */
|
|
240
|
-
targetRate: string;
|
|
241
|
-
paused: boolean;
|
|
242
|
-
user: SghoUserData;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/** stkAAVE, stkGHO and sGHO of an address, from getStakeAaveData. */
|
|
246
|
-
export interface StakeAaveData {
|
|
247
|
-
activatedCooldown: string,
|
|
248
|
-
activatedCooldownAmount: string,
|
|
249
|
-
stkAaveRewardsBalance: string,
|
|
250
|
-
aaveRewardsBalance: string,
|
|
251
|
-
stkAaveBalance: string,
|
|
252
|
-
stkGhoBalance: string,
|
|
253
|
-
ghoMeritApy: string,
|
|
254
|
-
stkAaveApy: string,
|
|
255
|
-
sgho: SghoData,
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
export interface UmbrellaTokenInfo {
|
|
259
|
-
token: EthAddress,
|
|
260
|
-
/** USD, converted from the oracle's 8 decimals. */
|
|
261
|
-
price: string,
|
|
262
|
-
name: string,
|
|
263
|
-
symbol: string,
|
|
264
|
-
decimals: number,
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export interface UmbrellaRewardTokenData {
|
|
268
|
-
rewardTokenData: UmbrellaTokenInfo,
|
|
269
|
-
maxEmissionPerSecond: bigint,
|
|
270
|
-
distributionEnd: bigint,
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export interface UmbrellaStakingAccountData {
|
|
274
|
-
stakeUserBalance: string,
|
|
275
|
-
rewardsTokenUserData: { reward: EthAddress, currentReward: string }[],
|
|
276
|
-
userCooldownAmount: string,
|
|
277
|
-
// Passed through unconverted: the view's bigint, or '0' when the view returns none.
|
|
278
|
-
userEndOfCooldown: bigint | string,
|
|
279
|
-
userWithdrawalWindow: bigint | string,
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* One Umbrella stake token of an address, from getUmbrellaData: the view contracts' structs merged, with the amounts
|
|
284
|
-
* the app reads converted to decimal strings. The bigint fields are the views' raw values, as the SDK passes them.
|
|
285
|
-
*/
|
|
286
|
-
export interface UmbrellaStakingTokenData {
|
|
287
|
-
stakeTokenData: UmbrellaTokenInfo,
|
|
288
|
-
totalAssets: string,
|
|
289
|
-
targetLiquidity: string,
|
|
290
|
-
isStakeConfigured: boolean,
|
|
291
|
-
rewardsTokenData: UmbrellaRewardTokenData[],
|
|
292
|
-
stakeToken: EthAddress,
|
|
293
|
-
stakeUserBalance: bigint,
|
|
294
|
-
rewardsTokenUserData: { reward: EthAddress, currentReward: bigint }[],
|
|
295
|
-
stkToken: EthAddress,
|
|
296
|
-
totalShares: string,
|
|
297
|
-
stkUnderlyingToken: EthAddress,
|
|
298
|
-
aToken: EthAddress,
|
|
299
|
-
cooldownPeriod: bigint,
|
|
300
|
-
unstakeWindow: bigint,
|
|
301
|
-
stkTokenToWaTokenRate: string,
|
|
302
|
-
waTokenToATokenRate: string,
|
|
303
|
-
rewardsEmissionRates: string[],
|
|
304
|
-
userCooldownAmount: bigint,
|
|
305
|
-
userEndOfCooldown: bigint,
|
|
306
|
-
userWithdrawalWindow: bigint,
|
|
307
|
-
account: UmbrellaStakingAccountData,
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/** Keyed by Umbrella stake (UmbrellaGHO, UmbrellaUSDC, UmbrellaUSDT, UmbrellaETH). */
|
|
311
|
-
export type UmbrellaStakingData = Record<string, UmbrellaStakingTokenData>;
|
package/src/types/aaveV4.ts
CHANGED
|
@@ -207,52 +207,3 @@ export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
|
|
|
207
207
|
healthFactor: string,
|
|
208
208
|
riskPremiumBps: number,
|
|
209
209
|
}
|
|
210
|
-
|
|
211
|
-
/** One Aave V4 tokenized spoke (Lend vault) as the view contract returns it for a user. */
|
|
212
|
-
export interface AaveV4TokenizationSpokeData {
|
|
213
|
-
underlyingAsset: EthAddress;
|
|
214
|
-
assetId: string;
|
|
215
|
-
decimals: number;
|
|
216
|
-
spoke: EthAddress;
|
|
217
|
-
spokeActive: boolean;
|
|
218
|
-
spokeHalted: boolean;
|
|
219
|
-
spokeDepositCap: string;
|
|
220
|
-
spokeTotalAssets: string;
|
|
221
|
-
spokeTotalShares: string;
|
|
222
|
-
hub: EthAddress;
|
|
223
|
-
hubLiquidity: string;
|
|
224
|
-
hubDrawnRate: string;
|
|
225
|
-
convertToShares: string;
|
|
226
|
-
convertToAssets: string;
|
|
227
|
-
user: EthAddress;
|
|
228
|
-
userSuppliedAssets: string;
|
|
229
|
-
userSuppliedShares: string;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/** Parsed tokenization spoke data with human-readable supplied amounts for display */
|
|
233
|
-
export interface AaveV4TokenizationSpokeDataParsed {
|
|
234
|
-
vaultAddress: EthAddress;
|
|
235
|
-
key: string | null;
|
|
236
|
-
symbol: string;
|
|
237
|
-
hubKey: string;
|
|
238
|
-
// ---- Spoke ----
|
|
239
|
-
spokeActive: boolean;
|
|
240
|
-
spokeHalted: boolean;
|
|
241
|
-
/** Deposit cap in asset units (wei string) */
|
|
242
|
-
spokeDepositCap: string;
|
|
243
|
-
/** Total assets currently in spoke in asset units (wei string) */
|
|
244
|
-
spokeTotalAssets: string;
|
|
245
|
-
// ---- Hub ----
|
|
246
|
-
/** Available hub liquidity in asset units (wei string) */
|
|
247
|
-
hubLiquidity: string;
|
|
248
|
-
/** The conversion rate from assets to shares expressed in asset units. */
|
|
249
|
-
convertToShares: string;
|
|
250
|
-
// ---- User ----
|
|
251
|
-
userSuppliedAssetsEth: string;
|
|
252
|
-
userSuppliedSharesEth: string;
|
|
253
|
-
userSuppliedAssets: string;
|
|
254
|
-
userSuppliedShares: string;
|
|
255
|
-
underlyingAsset: EthAddress;
|
|
256
|
-
spoke: EthAddress;
|
|
257
|
-
decimals: number;
|
|
258
|
-
}
|
package/src/types/compound.ts
CHANGED
|
@@ -70,8 +70,6 @@ export interface CompoundAssetData extends MMAssetData {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
export interface CompoundV2AssetData extends CompoundAssetData {
|
|
73
|
-
// Set by _getCompoundV2MarketsData. Optional, so objects built by hand still type-check.
|
|
74
|
-
exchangeRate?: string,
|
|
75
73
|
}
|
|
76
74
|
export interface CompoundV3AssetData extends CompoundAssetData {
|
|
77
75
|
borrowCollateralFactor: string,
|
|
@@ -83,20 +81,6 @@ export interface CompoundV3AssetData extends CompoundAssetData {
|
|
|
83
81
|
supplyCap: string,
|
|
84
82
|
priceInBaseAsset: string,
|
|
85
83
|
canBeWithdrawn: boolean,
|
|
86
|
-
// The rest are set by formatMarketData and formatBaseData, which also spread in the view contract's raw asset
|
|
87
|
-
// data. Optional, so objects built by hand still type-check.
|
|
88
|
-
tokenAddr?: EthAddress,
|
|
89
|
-
// The base asset's only.
|
|
90
|
-
isBase?: boolean,
|
|
91
|
-
baseBorrowMin?: string,
|
|
92
|
-
baseTrackingBorrowRewardsSpeed?: string,
|
|
93
|
-
baseTrackingSupplyRewardsSpeed?: string,
|
|
94
|
-
borrowIndex?: string,
|
|
95
|
-
supplyIndex?: string,
|
|
96
|
-
trackingBorrowIndex?: string,
|
|
97
|
-
trackingSupplyIndex?: string,
|
|
98
|
-
rewardSupplySpeed?: string,
|
|
99
|
-
rewardBorrowSpeed?: string,
|
|
100
84
|
}
|
|
101
85
|
|
|
102
86
|
export interface CompoundAssetsData<T> {
|
|
@@ -159,30 +143,10 @@ export interface CompoundPositionData extends MMPositionData {
|
|
|
159
143
|
automationResubscribeRequired?: boolean,
|
|
160
144
|
}
|
|
161
145
|
|
|
162
|
-
|
|
163
|
-
* Fields getCompoundV2AggregatedData adds to every Compound V2 position at runtime — a subset of
|
|
164
|
-
* CompoundAggregatedPositionData. Optional, so code that builds a position by hand keeps compiling.
|
|
165
|
-
*/
|
|
166
|
-
export type CompoundV2PositionAggregatedFields = Partial<Pick<CompoundAggregatedPositionData,
|
|
167
|
-
| 'suppliedCollateralUsd' | 'liquidationLimitUsd' | 'leftToBorrowUsd' | 'collRatio' | 'leveragedType'
|
|
168
|
-
| 'leveragedAsset' | 'liquidationPrice'>>;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Fields getCompoundV3AggregatedData adds to every Compound V3 position at runtime, on top of those declared in
|
|
172
|
-
* CompoundPositionData. Optional, so code that builds a position by hand keeps compiling.
|
|
173
|
-
*/
|
|
174
|
-
export type CompoundV3PositionAggregatedFields = Partial<Omit<CompoundAggregatedPositionData,
|
|
175
|
-
| keyof MMPositionData | 'ratio' | 'minRatio' | 'suppliedUsd' | 'borrowedUsd' | 'borrowLimitUsd' | 'incentiveUsd'
|
|
176
|
-
| 'totalInterestUsd'>>;
|
|
177
|
-
|
|
178
|
-
export interface CompoundV2PositionData extends CompoundPositionData, CompoundV2PositionAggregatedFields {
|
|
146
|
+
export interface CompoundV2PositionData extends CompoundPositionData {
|
|
179
147
|
usedAssets: CompoundV2UsedAssets,
|
|
180
|
-
// Always false: _getCompoundV2AccountData starts from EMPTY_COMPOUND_DATA, which carries it.
|
|
181
|
-
borrowStableSupplyUnstable?: boolean,
|
|
182
148
|
}
|
|
183
149
|
|
|
184
|
-
export interface CompoundV3PositionData extends CompoundPositionData
|
|
150
|
+
export interface CompoundV3PositionData extends CompoundPositionData {
|
|
185
151
|
usedAssets: CompoundV3UsedAssets,
|
|
186
|
-
// Whether the user's smart wallet is allowed to manage the account on Comet (Comet.isAllowed).
|
|
187
|
-
isAllowed?: boolean,
|
|
188
152
|
}
|
package/src/types/curveUsd.ts
CHANGED
|
@@ -66,9 +66,6 @@ export interface CrvUSDGlobalMarketData {
|
|
|
66
66
|
leftToBorrow: string,
|
|
67
67
|
bands: BandData[],
|
|
68
68
|
loanDiscount: string;
|
|
69
|
-
// crvUSDView's globalData field that _getCurveUsdGlobalData spreads in unconverted. Optional, so objects built by
|
|
70
|
-
// hand still type-check.
|
|
71
|
-
A?: bigint,
|
|
72
69
|
}
|
|
73
70
|
|
|
74
71
|
export interface CrvUSDAggregatedPositionData {
|
|
@@ -108,12 +105,7 @@ export interface CrvUSDUsedAssets {
|
|
|
108
105
|
[key: string]: CrvUSDUsedAsset,
|
|
109
106
|
}
|
|
110
107
|
|
|
111
|
-
|
|
112
|
-
// type-check.
|
|
113
|
-
export type CrvUSDPositionAggregatedFields = Partial<Pick<CrvUSDAggregatedPositionData,
|
|
114
|
-
| 'borrowLimitUsd' | 'minAllowedRatio' | 'collFactor' | 'leveragedType' | 'leveragedAsset' | 'liquidationPrice'>>;
|
|
115
|
-
|
|
116
|
-
export interface CrvUSDUserData extends CrvUSDPositionAggregatedFields {
|
|
108
|
+
export interface CrvUSDUserData {
|
|
117
109
|
debtAmount: string,
|
|
118
110
|
health: string,
|
|
119
111
|
healthPercent: string,
|
|
@@ -138,12 +130,4 @@ export interface CrvUSDUserData extends CrvUSDPositionAggregatedFields {
|
|
|
138
130
|
netApy: string,
|
|
139
131
|
totalInterestUsd: string,
|
|
140
132
|
incentiveUsd: string,
|
|
141
|
-
// Fields of crvUSDView's userData that _getCurveUsdUserData spreads in unconverted. Optional, so objects built by
|
|
142
|
-
// hand still type-check.
|
|
143
|
-
marketCollateralAmount?: bigint,
|
|
144
|
-
curveUsdCollateralAmount?: bigint,
|
|
145
|
-
N?: bigint,
|
|
146
|
-
bandRange?: readonly [bigint, bigint],
|
|
147
|
-
usersBands?: readonly [readonly bigint[], readonly bigint[]],
|
|
148
|
-
isInSoftLiquidation?: boolean,
|
|
149
133
|
}
|
package/src/types/fluid.ts
CHANGED
|
@@ -488,17 +488,3 @@ export interface FluidFTokenDataStructOutput {
|
|
|
488
488
|
rewardsRate: bigint;
|
|
489
489
|
withdrawable: bigint;
|
|
490
490
|
}
|
|
491
|
-
|
|
492
|
-
/** One Fluid lending (fToken) deposit of an address, from getAllUserEarnPositionsWithFTokens and getFluidDepositData. */
|
|
493
|
-
export interface FluidEarnPositionData {
|
|
494
|
-
fTokenAddress: string | undefined,
|
|
495
|
-
fTokenSymbol: string,
|
|
496
|
-
decimals: string,
|
|
497
|
-
totalDeposited: string,
|
|
498
|
-
withdrawable: string,
|
|
499
|
-
apy: string,
|
|
500
|
-
depositRate: string,
|
|
501
|
-
withdrawRate: string,
|
|
502
|
-
deposited: string,
|
|
503
|
-
depositedShares: string,
|
|
504
|
-
}
|
package/src/types/index.ts
CHANGED
package/src/types/liquity.ts
CHANGED
|
@@ -35,16 +35,4 @@ export interface LiquityTroveInfo {
|
|
|
35
35
|
netApy: string,
|
|
36
36
|
totalInterestUsd: string,
|
|
37
37
|
incentiveUsd: string,
|
|
38
|
-
}
|
|
39
|
-
/** LQTY staking and the LUSD stability pool deposit of an address, from getLiquityStakingData. */
|
|
40
|
-
export interface LiquityStakingData {
|
|
41
|
-
totalLUSDDeposited: string,
|
|
42
|
-
totalLQTYStaked: string,
|
|
43
|
-
stakedLQTY: string,
|
|
44
|
-
stakedLUSDBalance: string,
|
|
45
|
-
rewardETH: string,
|
|
46
|
-
rewardLUSD: string,
|
|
47
|
-
stabilityRewardETH: string,
|
|
48
|
-
stabilityRewardLQTY: string,
|
|
49
|
-
showStakingBalances: boolean,
|
|
50
|
-
}
|
|
38
|
+
}
|
package/src/types/liquityV2.ts
CHANGED
|
@@ -133,29 +133,4 @@ export interface LiquityV2TroveData {
|
|
|
133
133
|
debtInFront: string,
|
|
134
134
|
lastInterestRateAdjTime: string,
|
|
135
135
|
exposure: string,
|
|
136
|
-
}
|
|
137
|
-
/** The stability pool deposit of an address in one market, from getLiquityV2Staking. */
|
|
138
|
-
export interface LiquityV2StakingData {
|
|
139
|
-
totalBOLDDeposited: string,
|
|
140
|
-
stakedBOLDBalance: string,
|
|
141
|
-
stabilityRewardColl: string,
|
|
142
|
-
stabilityRewardYield: string,
|
|
143
|
-
showStakingBalances: boolean,
|
|
144
|
-
debtTokenBalance: string,
|
|
145
|
-
stabilityPoolApy: string,
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/** sBOLD, yBOLD and stYBOLD of an address, from getLiquitySAndYBold. */
|
|
149
|
-
export interface LiquityV2SBoldYBoldData {
|
|
150
|
-
spApy: string,
|
|
151
|
-
yBoldApy: string,
|
|
152
|
-
totalBoldDepositedSBold: string,
|
|
153
|
-
boldRateSBold: string,
|
|
154
|
-
maxWithdrawSBold: string,
|
|
155
|
-
totalBoldDepositedYBold: string,
|
|
156
|
-
boldRateYBold: string,
|
|
157
|
-
maxWithdrawYBold: string,
|
|
158
|
-
sBoldBalance: string,
|
|
159
|
-
yBoldBalance: string,
|
|
160
|
-
stYBoldBalance: string,
|
|
161
|
-
}
|
|
136
|
+
}
|
package/src/types/llamaLend.ts
CHANGED
|
@@ -141,13 +141,7 @@ export interface LlamaLendUsedAssets {
|
|
|
141
141
|
[key: string]: LlamaLendUsedAsset,
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
// type-check.
|
|
146
|
-
export type LlamaLendPositionAggregatedFields = Partial<Pick<LlamaLendAggregatedPositionData,
|
|
147
|
-
| 'borrowLimitUsd' | 'minAllowedRatio' | 'collFactor' | 'leveragedType' | 'leveragedAsset' | 'liquidationPrice'
|
|
148
|
-
| 'netApy' | 'incentiveUsd' | 'totalInterestUsd'>>;
|
|
149
|
-
|
|
150
|
-
export interface LlamaLendUserData extends LlamaLendPositionAggregatedFields {
|
|
144
|
+
export interface LlamaLendUserData {
|
|
151
145
|
debtAmount: string,
|
|
152
146
|
health: string,
|
|
153
147
|
healthPercent: string,
|
|
@@ -166,16 +160,4 @@ export interface LlamaLendUserData extends LlamaLendPositionAggregatedFields {
|
|
|
166
160
|
loanExists: boolean,
|
|
167
161
|
borrowRate?: string,
|
|
168
162
|
exposure: string,
|
|
169
|
-
// Fields of LlamaLendView's userData that _getLlamaLendUserData spreads in unconverted. Optional, so objects built
|
|
170
|
-
// by hand still type-check.
|
|
171
|
-
collateralPrice?: bigint,
|
|
172
|
-
marketCollateralAmount?: bigint,
|
|
173
|
-
debtTokenCollateralAmount?: bigint,
|
|
174
|
-
N?: bigint,
|
|
175
|
-
bandRange?: readonly [bigint, bigint],
|
|
176
|
-
usersBands?: readonly [readonly bigint[], readonly bigint[]],
|
|
177
|
-
collRatio?: bigint,
|
|
178
|
-
isInSoftLiquidation?: boolean,
|
|
179
|
-
debtTokenSuppliedShares?: bigint,
|
|
180
|
-
debtTokenSuppliedAssets?: bigint,
|
|
181
163
|
}
|
package/src/types/morphoBlue.ts
CHANGED
|
@@ -124,6 +124,7 @@ export enum MorphoBlueVersions {
|
|
|
124
124
|
MorphoBlueUSDeUSDC_915_Base = 'morphoblueusdeusdc_915_base', // USDe/USDC 0.915
|
|
125
125
|
MorphoBlueCbEthUSDC_770_Base = 'morphobluecbethusdc_770_base', // cbETH/USDC 0.77
|
|
126
126
|
MorphoBlueCbXRPUSDC_625_Base = 'morphobluecbxrpusdc_625_base', // cbXRP/USDC 0.625
|
|
127
|
+
MorphoBlueCbHYPEUSDC_625_Base = 'morphobluecbhypeusdc_625_base', // cbHYPE/USDC 0.625
|
|
127
128
|
|
|
128
129
|
// ARBITRUM
|
|
129
130
|
MorphoBlueSyrupUSDCUSDC_915_Arb = 'morphobluesyrupusdcusdc_915_arb', // syrupUSDC/USDC
|
|
@@ -237,9 +238,6 @@ export interface MorphoBluePositionData {
|
|
|
237
238
|
supplyShares: string,
|
|
238
239
|
borrowShares: string,
|
|
239
240
|
exposure: string,
|
|
240
|
-
// Set by getMorphoBlueAggregatedPositionData. Optional, so objects built by hand still type-check.
|
|
241
|
-
minCollRatio?: string,
|
|
242
|
-
collLiquidationRatio?: string,
|
|
243
241
|
}
|
|
244
242
|
|
|
245
243
|
export interface MorphoBlueEarnData {
|