@defisaver/positions-sdk 2.1.168-stable-pair-dev → 2.1.169-portfolio-api-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.
- package/cjs/aaveV3/index.d.ts +2 -12
- package/cjs/aaveV3/sgho.d.ts +2 -16
- package/cjs/aaveV4/lend.d.ts +2 -43
- package/cjs/claiming/aaveV3.d.ts +2 -2
- package/cjs/claiming/ethena.d.ts +2 -1
- package/cjs/claiming/king.d.ts +2 -1
- package/cjs/claiming/spark.d.ts +2 -2
- package/cjs/fluid/index.d.ts +5 -49
- package/cjs/helpers/aaveV4Helpers/index.js +1 -11
- package/cjs/liquity/index.d.ts +2 -12
- package/cjs/liquityV2/index.d.ts +8 -23
- package/cjs/liquityV2/index.js +37 -19
- package/cjs/moneymarket/moneymarketCommonService.js +2 -12
- package/cjs/portfolio/index.d.ts +16 -8
- package/cjs/portfolio/index.js +458 -520
- package/cjs/portfolio/lendingProtocols.d.ts +184 -0
- package/cjs/portfolio/lendingProtocols.js +196 -0
- package/cjs/savings/index.d.ts +8 -2
- package/cjs/savings/index.js +33 -4
- package/cjs/types/aave.d.ts +98 -2
- package/cjs/types/aaveV4.d.ts +44 -0
- package/cjs/types/common.d.ts +0 -1
- package/cjs/types/common.js +0 -1
- package/cjs/types/compound.d.ts +26 -2
- package/cjs/types/curveUsd.d.ts +9 -1
- package/cjs/types/fluid.d.ts +13 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/liquity.d.ts +12 -0
- package/cjs/types/liquityV2.d.ts +24 -0
- package/cjs/types/llamaLend.d.ts +12 -1
- package/cjs/types/morphoBlue.d.ts +2 -0
- package/cjs/types/portfolio.d.ts +125 -5
- package/cjs/types/savings/index.d.ts +9 -1
- package/cjs/types/spark.d.ts +21 -1
- package/cjs/umbrella/index.d.ts +2 -3
- package/esm/aaveV3/index.d.ts +2 -12
- package/esm/aaveV3/sgho.d.ts +2 -16
- package/esm/aaveV4/lend.d.ts +2 -43
- package/esm/claiming/aaveV3.d.ts +2 -2
- package/esm/claiming/aaveV3.js +1 -1
- package/esm/claiming/ethena.d.ts +2 -1
- package/esm/claiming/king.d.ts +2 -1
- package/esm/claiming/spark.d.ts +2 -2
- package/esm/claiming/spark.js +1 -1
- package/esm/fluid/index.d.ts +5 -49
- package/esm/helpers/aaveV4Helpers/index.js +1 -11
- package/esm/liquity/index.d.ts +2 -12
- package/esm/liquityV2/index.d.ts +8 -23
- package/esm/liquityV2/index.js +35 -18
- package/esm/moneymarket/moneymarketCommonService.js +2 -12
- package/esm/portfolio/index.d.ts +16 -8
- package/esm/portfolio/index.js +458 -522
- package/esm/portfolio/lendingProtocols.d.ts +184 -0
- package/esm/portfolio/lendingProtocols.js +189 -0
- package/esm/savings/index.d.ts +8 -2
- package/esm/savings/index.js +31 -3
- package/esm/types/aave.d.ts +98 -2
- package/esm/types/aaveV4.d.ts +44 -0
- package/esm/types/common.d.ts +0 -1
- package/esm/types/common.js +0 -1
- package/esm/types/compound.d.ts +26 -2
- package/esm/types/curveUsd.d.ts +9 -1
- package/esm/types/fluid.d.ts +13 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/esm/types/liquity.d.ts +12 -0
- package/esm/types/liquityV2.d.ts +24 -0
- package/esm/types/llamaLend.d.ts +12 -1
- package/esm/types/morphoBlue.d.ts +2 -0
- package/esm/types/portfolio.d.ts +125 -5
- package/esm/types/savings/index.d.ts +9 -1
- package/esm/types/spark.d.ts +21 -1
- package/esm/umbrella/index.d.ts +2 -3
- package/package.json +1 -1
- package/src/aaveV3/index.ts +2 -1
- package/src/aaveV3/sgho.ts +2 -17
- package/src/aaveV4/lend.ts +2 -48
- package/src/claiming/aaveV3.ts +4 -2
- package/src/claiming/ethena.ts +5 -5
- package/src/claiming/king.ts +3 -3
- package/src/claiming/spark.ts +6 -4
- package/src/fluid/index.ts +4 -3
- package/src/helpers/aaveV4Helpers/index.ts +1 -12
- package/src/liquity/index.ts +2 -2
- package/src/liquityV2/index.ts +48 -22
- package/src/moneymarket/moneymarketCommonService.ts +2 -13
- package/src/portfolio/index.ts +306 -331
- package/src/portfolio/lendingProtocols.ts +281 -0
- package/src/savings/index.ts +41 -4
- package/src/types/aave.ts +104 -1
- package/src/types/aaveV4.ts +49 -0
- package/src/types/common.ts +0 -1
- package/src/types/compound.ts +38 -2
- package/src/types/curveUsd.ts +17 -1
- package/src/types/fluid.ts +14 -0
- package/src/types/index.ts +1 -0
- package/src/types/liquity.ts +13 -1
- package/src/types/liquityV2.ts +26 -1
- package/src/types/llamaLend.ts +19 -1
- package/src/types/morphoBlue.ts +3 -0
- package/src/types/portfolio.ts +151 -5
- package/src/types/savings/index.ts +12 -1
- package/src/types/spark.ts +25 -1
- package/src/umbrella/index.ts +2 -1
package/esm/types/aaveV4.d.ts
CHANGED
|
@@ -191,3 +191,47 @@ export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
|
|
|
191
191
|
healthFactor: string;
|
|
192
192
|
riskPremiumBps: number;
|
|
193
193
|
}
|
|
194
|
+
/** One Aave V4 tokenized spoke (Lend vault) as the view contract returns it for a user. */
|
|
195
|
+
export interface AaveV4TokenizationSpokeData {
|
|
196
|
+
underlyingAsset: EthAddress;
|
|
197
|
+
assetId: string;
|
|
198
|
+
decimals: number;
|
|
199
|
+
spoke: EthAddress;
|
|
200
|
+
spokeActive: boolean;
|
|
201
|
+
spokeHalted: boolean;
|
|
202
|
+
spokeDepositCap: string;
|
|
203
|
+
spokeTotalAssets: string;
|
|
204
|
+
spokeTotalShares: string;
|
|
205
|
+
hub: EthAddress;
|
|
206
|
+
hubLiquidity: string;
|
|
207
|
+
hubDrawnRate: string;
|
|
208
|
+
convertToShares: string;
|
|
209
|
+
convertToAssets: string;
|
|
210
|
+
user: EthAddress;
|
|
211
|
+
userSuppliedAssets: string;
|
|
212
|
+
userSuppliedShares: string;
|
|
213
|
+
}
|
|
214
|
+
/** Parsed tokenization spoke data with human-readable supplied amounts for display */
|
|
215
|
+
export interface AaveV4TokenizationSpokeDataParsed {
|
|
216
|
+
vaultAddress: EthAddress;
|
|
217
|
+
key: string | null;
|
|
218
|
+
symbol: string;
|
|
219
|
+
hubKey: string;
|
|
220
|
+
spokeActive: boolean;
|
|
221
|
+
spokeHalted: boolean;
|
|
222
|
+
/** Deposit cap in asset units (wei string) */
|
|
223
|
+
spokeDepositCap: string;
|
|
224
|
+
/** Total assets currently in spoke in asset units (wei string) */
|
|
225
|
+
spokeTotalAssets: string;
|
|
226
|
+
/** Available hub liquidity in asset units (wei string) */
|
|
227
|
+
hubLiquidity: string;
|
|
228
|
+
/** The conversion rate from assets to shares expressed in asset units. */
|
|
229
|
+
convertToShares: string;
|
|
230
|
+
userSuppliedAssetsEth: string;
|
|
231
|
+
userSuppliedSharesEth: string;
|
|
232
|
+
userSuppliedAssets: string;
|
|
233
|
+
userSuppliedShares: string;
|
|
234
|
+
underlyingAsset: EthAddress;
|
|
235
|
+
spoke: EthAddress;
|
|
236
|
+
decimals: number;
|
|
237
|
+
}
|
package/esm/types/common.d.ts
CHANGED
package/esm/types/common.js
CHANGED
|
@@ -27,7 +27,6 @@ export var LeverageType;
|
|
|
27
27
|
LeverageType["Short"] = "short";
|
|
28
28
|
LeverageType["VolatilePair"] = "volatile-pair";
|
|
29
29
|
LeverageType["VolatilePairReverse"] = "volatile-pair-reverse";
|
|
30
|
-
LeverageType["StablePair"] = "stable-pair";
|
|
31
30
|
LeverageType["None"] = "";
|
|
32
31
|
})(LeverageType || (LeverageType = {}));
|
|
33
32
|
export var NetworkNumber;
|
package/esm/types/compound.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export interface CompoundAssetData extends MMAssetData {
|
|
|
52
52
|
sortIndex?: number;
|
|
53
53
|
}
|
|
54
54
|
export interface CompoundV2AssetData extends CompoundAssetData {
|
|
55
|
+
exchangeRate?: string;
|
|
55
56
|
}
|
|
56
57
|
export interface CompoundV3AssetData extends CompoundAssetData {
|
|
57
58
|
borrowCollateralFactor: string;
|
|
@@ -63,6 +64,17 @@ export interface CompoundV3AssetData extends CompoundAssetData {
|
|
|
63
64
|
supplyCap: string;
|
|
64
65
|
priceInBaseAsset: string;
|
|
65
66
|
canBeWithdrawn: boolean;
|
|
67
|
+
tokenAddr?: EthAddress;
|
|
68
|
+
isBase?: boolean;
|
|
69
|
+
baseBorrowMin?: string;
|
|
70
|
+
baseTrackingBorrowRewardsSpeed?: string;
|
|
71
|
+
baseTrackingSupplyRewardsSpeed?: string;
|
|
72
|
+
borrowIndex?: string;
|
|
73
|
+
supplyIndex?: string;
|
|
74
|
+
trackingBorrowIndex?: string;
|
|
75
|
+
trackingSupplyIndex?: string;
|
|
76
|
+
rewardSupplySpeed?: string;
|
|
77
|
+
rewardBorrowSpeed?: string;
|
|
66
78
|
}
|
|
67
79
|
export interface CompoundAssetsData<T> {
|
|
68
80
|
[token: string]: T;
|
|
@@ -125,9 +137,21 @@ export interface CompoundPositionData extends MMPositionData {
|
|
|
125
137
|
isSubscribedToAutomation?: boolean;
|
|
126
138
|
automationResubscribeRequired?: boolean;
|
|
127
139
|
}
|
|
128
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Fields getCompoundV2AggregatedData adds to every Compound V2 position at runtime — a subset of
|
|
142
|
+
* CompoundAggregatedPositionData. Optional, so code that builds a position by hand keeps compiling.
|
|
143
|
+
*/
|
|
144
|
+
export type CompoundV2PositionAggregatedFields = Partial<Pick<CompoundAggregatedPositionData, 'suppliedCollateralUsd' | 'liquidationLimitUsd' | 'leftToBorrowUsd' | 'collRatio' | 'leveragedType' | 'leveragedAsset' | 'liquidationPrice'>>;
|
|
145
|
+
/**
|
|
146
|
+
* Fields getCompoundV3AggregatedData adds to every Compound V3 position at runtime, on top of those declared in
|
|
147
|
+
* CompoundPositionData. Optional, so code that builds a position by hand keeps compiling.
|
|
148
|
+
*/
|
|
149
|
+
export type CompoundV3PositionAggregatedFields = Partial<Omit<CompoundAggregatedPositionData, keyof MMPositionData | 'ratio' | 'minRatio' | 'suppliedUsd' | 'borrowedUsd' | 'borrowLimitUsd' | 'incentiveUsd' | 'totalInterestUsd'>>;
|
|
150
|
+
export interface CompoundV2PositionData extends CompoundPositionData, CompoundV2PositionAggregatedFields {
|
|
129
151
|
usedAssets: CompoundV2UsedAssets;
|
|
152
|
+
borrowStableSupplyUnstable?: boolean;
|
|
130
153
|
}
|
|
131
|
-
export interface CompoundV3PositionData extends CompoundPositionData {
|
|
154
|
+
export interface CompoundV3PositionData extends CompoundPositionData, CompoundV3PositionAggregatedFields {
|
|
132
155
|
usedAssets: CompoundV3UsedAssets;
|
|
156
|
+
isAllowed?: boolean;
|
|
133
157
|
}
|
package/esm/types/curveUsd.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ export interface CrvUSDGlobalMarketData {
|
|
|
60
60
|
leftToBorrow: string;
|
|
61
61
|
bands: BandData[];
|
|
62
62
|
loanDiscount: string;
|
|
63
|
+
A?: bigint;
|
|
63
64
|
}
|
|
64
65
|
export interface CrvUSDAggregatedPositionData {
|
|
65
66
|
ratio: string;
|
|
@@ -94,7 +95,8 @@ export interface CrvUSDUsedAsset {
|
|
|
94
95
|
export interface CrvUSDUsedAssets {
|
|
95
96
|
[key: string]: CrvUSDUsedAsset;
|
|
96
97
|
}
|
|
97
|
-
export
|
|
98
|
+
export type CrvUSDPositionAggregatedFields = Partial<Pick<CrvUSDAggregatedPositionData, 'borrowLimitUsd' | 'minAllowedRatio' | 'collFactor' | 'leveragedType' | 'leveragedAsset' | 'liquidationPrice'>>;
|
|
99
|
+
export interface CrvUSDUserData extends CrvUSDPositionAggregatedFields {
|
|
98
100
|
debtAmount: string;
|
|
99
101
|
health: string;
|
|
100
102
|
healthPercent: string;
|
|
@@ -119,4 +121,10 @@ export interface CrvUSDUserData {
|
|
|
119
121
|
netApy: string;
|
|
120
122
|
totalInterestUsd: string;
|
|
121
123
|
incentiveUsd: string;
|
|
124
|
+
marketCollateralAmount?: bigint;
|
|
125
|
+
curveUsdCollateralAmount?: bigint;
|
|
126
|
+
N?: bigint;
|
|
127
|
+
bandRange?: readonly [bigint, bigint];
|
|
128
|
+
usersBands?: readonly [readonly bigint[], readonly bigint[]];
|
|
129
|
+
isInSoftLiquidation?: boolean;
|
|
122
130
|
}
|
package/esm/types/fluid.d.ts
CHANGED
|
@@ -459,3 +459,16 @@ export interface FluidFTokenDataStructOutput {
|
|
|
459
459
|
rewardsRate: bigint;
|
|
460
460
|
withdrawable: bigint;
|
|
461
461
|
}
|
|
462
|
+
/** One Fluid lending (fToken) deposit of an address, from getAllUserEarnPositionsWithFTokens and getFluidDepositData. */
|
|
463
|
+
export interface FluidEarnPositionData {
|
|
464
|
+
fTokenAddress: string | undefined;
|
|
465
|
+
fTokenSymbol: string;
|
|
466
|
+
decimals: string;
|
|
467
|
+
totalDeposited: string;
|
|
468
|
+
withdrawable: string;
|
|
469
|
+
apy: string;
|
|
470
|
+
depositRate: string;
|
|
471
|
+
withdrawRate: string;
|
|
472
|
+
deposited: string;
|
|
473
|
+
depositedShares: string;
|
|
474
|
+
}
|
package/esm/types/index.d.ts
CHANGED
package/esm/types/index.js
CHANGED
package/esm/types/liquity.d.ts
CHANGED
|
@@ -32,3 +32,15 @@ export interface LiquityTroveInfo {
|
|
|
32
32
|
totalInterestUsd: string;
|
|
33
33
|
incentiveUsd: string;
|
|
34
34
|
}
|
|
35
|
+
/** LQTY staking and the LUSD stability pool deposit of an address, from getLiquityStakingData. */
|
|
36
|
+
export interface LiquityStakingData {
|
|
37
|
+
totalLUSDDeposited: string;
|
|
38
|
+
totalLQTYStaked: string;
|
|
39
|
+
stakedLQTY: string;
|
|
40
|
+
stakedLUSDBalance: string;
|
|
41
|
+
rewardETH: string;
|
|
42
|
+
rewardLUSD: string;
|
|
43
|
+
stabilityRewardETH: string;
|
|
44
|
+
stabilityRewardLQTY: string;
|
|
45
|
+
showStakingBalances: boolean;
|
|
46
|
+
}
|
package/esm/types/liquityV2.d.ts
CHANGED
|
@@ -123,3 +123,27 @@ export interface LiquityV2TroveData {
|
|
|
123
123
|
lastInterestRateAdjTime: string;
|
|
124
124
|
exposure: string;
|
|
125
125
|
}
|
|
126
|
+
/** The stability pool deposit of an address in one market, from getLiquityV2Staking. */
|
|
127
|
+
export interface LiquityV2StakingData {
|
|
128
|
+
totalBOLDDeposited: string;
|
|
129
|
+
stakedBOLDBalance: string;
|
|
130
|
+
stabilityRewardColl: string;
|
|
131
|
+
stabilityRewardYield: string;
|
|
132
|
+
showStakingBalances: boolean;
|
|
133
|
+
debtTokenBalance: string;
|
|
134
|
+
stabilityPoolApy: string;
|
|
135
|
+
}
|
|
136
|
+
/** sBOLD, yBOLD and stYBOLD of an address, from getLiquitySAndYBold. */
|
|
137
|
+
export interface LiquityV2SBoldYBoldData {
|
|
138
|
+
spApy: string;
|
|
139
|
+
yBoldApy: string;
|
|
140
|
+
totalBoldDepositedSBold: string;
|
|
141
|
+
boldRateSBold: string;
|
|
142
|
+
maxWithdrawSBold: string;
|
|
143
|
+
totalBoldDepositedYBold: string;
|
|
144
|
+
boldRateYBold: string;
|
|
145
|
+
maxWithdrawYBold: string;
|
|
146
|
+
sBoldBalance: string;
|
|
147
|
+
yBoldBalance: string;
|
|
148
|
+
stYBoldBalance: string;
|
|
149
|
+
}
|
package/esm/types/llamaLend.d.ts
CHANGED
|
@@ -138,7 +138,8 @@ export interface LlamaLendUsedAsset {
|
|
|
138
138
|
export interface LlamaLendUsedAssets {
|
|
139
139
|
[key: string]: LlamaLendUsedAsset;
|
|
140
140
|
}
|
|
141
|
-
export
|
|
141
|
+
export type LlamaLendPositionAggregatedFields = Partial<Pick<LlamaLendAggregatedPositionData, 'borrowLimitUsd' | 'minAllowedRatio' | 'collFactor' | 'leveragedType' | 'leveragedAsset' | 'liquidationPrice' | 'netApy' | 'incentiveUsd' | 'totalInterestUsd'>>;
|
|
142
|
+
export interface LlamaLendUserData extends LlamaLendPositionAggregatedFields {
|
|
142
143
|
debtAmount: string;
|
|
143
144
|
health: string;
|
|
144
145
|
healthPercent: string;
|
|
@@ -157,4 +158,14 @@ export interface LlamaLendUserData {
|
|
|
157
158
|
loanExists: boolean;
|
|
158
159
|
borrowRate?: string;
|
|
159
160
|
exposure: string;
|
|
161
|
+
collateralPrice?: bigint;
|
|
162
|
+
marketCollateralAmount?: bigint;
|
|
163
|
+
debtTokenCollateralAmount?: bigint;
|
|
164
|
+
N?: bigint;
|
|
165
|
+
bandRange?: readonly [bigint, bigint];
|
|
166
|
+
usersBands?: readonly [readonly bigint[], readonly bigint[]];
|
|
167
|
+
collRatio?: bigint;
|
|
168
|
+
isInSoftLiquidation?: boolean;
|
|
169
|
+
debtTokenSuppliedShares?: bigint;
|
|
170
|
+
debtTokenSuppliedAssets?: bigint;
|
|
160
171
|
}
|
package/esm/types/portfolio.d.ts
CHANGED
|
@@ -1,20 +1,47 @@
|
|
|
1
|
-
import { AaveV2MarketData, AaveV2PositionData, AaveV3MarketData, AaveV3PositionData, AaveVersions } from './aave';
|
|
1
|
+
import { AaveV2MarketData, AaveV2PositionData, AaveV3MarketData, AaveV3PositionData, AaveVersions, StakeAaveData, UmbrellaStakingData } from './aave';
|
|
2
2
|
import { AaveV4AccountData, AaveV4SpokeData, AaveV4SpokesType } from './aaveV4';
|
|
3
|
+
import { AaveRewardsClaimableToken, EthenaAirdropClaimableToken, KingRewardsClaimableToken, MerklRewardsClaimableToken, SparkAirdropClaimableToken, SparkRewardsClaimableToken, UniswapAirdropClaimableToken } from './claiming';
|
|
3
4
|
import { EthAddress } from './common';
|
|
4
5
|
import { CompoundV2MarketsData, CompoundV2PositionData, CompoundV3MarketsData, CompoundV3PositionData, CompoundVersions } from './compound';
|
|
5
6
|
import { CrvUSDGlobalMarketData, CrvUSDUserData, CrvUSDVersions } from './curveUsd';
|
|
6
|
-
import { FluidMarketData, FluidVaultData } from './fluid';
|
|
7
|
-
import { LiquityTroveInfo } from './liquity';
|
|
8
|
-
import { LiquityV2MarketData } from './liquityV2';
|
|
7
|
+
import { FluidEarnPositionData, FluidMarketData, FluidVaultData } from './fluid';
|
|
8
|
+
import { LiquityStakingData, LiquityTroveInfo } from './liquity';
|
|
9
|
+
import { LiquityV2MarketData, LiquityV2SBoldYBoldData, LiquityV2StakingData, LiquityV2TroveData, LiquityV2Versions } from './liquityV2';
|
|
9
10
|
import { LlamaLendGlobalMarketData, LlamaLendUserData, LlamaLendVersionsType } from './llamaLend';
|
|
10
11
|
import { CdpData, IlkInfo } from './maker';
|
|
11
|
-
import { MorphoBlueMarketInfo, MorphoBluePositionData, MorphoBlueVersions } from './morphoBlue';
|
|
12
|
+
import { MorphoBlueEarnData, MorphoBlueMarketInfo, MorphoBluePositionData, MorphoBlueVersions } from './morphoBlue';
|
|
12
13
|
import { MorphoMidnightMarketInfo, MorphoMidnightPositionData, MorphoMidnightVersions } from './morphoMidnight';
|
|
13
14
|
import { SparkMarketsData, SparkPositionData, SparkVersions } from './spark';
|
|
14
15
|
export interface PortfolioProtocolData<T> {
|
|
15
16
|
error: string;
|
|
16
17
|
data: T | null;
|
|
17
18
|
}
|
|
19
|
+
/** A failed fetch of a protocol that, when it succeeds, getPortfolioData returns unwrapped rather than as `{ error, data }`. */
|
|
20
|
+
export interface PortfolioProtocolError {
|
|
21
|
+
error: string;
|
|
22
|
+
data: null;
|
|
23
|
+
}
|
|
24
|
+
/** What getPortfolioData reads besides markets. */
|
|
25
|
+
export interface PortfolioDataOptions {
|
|
26
|
+
/** positions (lending); default true. With false it comes back as {} and no lending position is read. */
|
|
27
|
+
positions?: boolean;
|
|
28
|
+
/** stakingPositions; default true. With false it comes back as {} and no staking source is read. */
|
|
29
|
+
staking?: boolean;
|
|
30
|
+
/** rewardsData; default true. With false it comes back as {} and no rewards source is read. */
|
|
31
|
+
rewards?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Liquity V2 troves in positions[address].liquityV2; default false, as the DeFi Saver app reads them on its own.
|
|
34
|
+
* Mainnet only: elsewhere liquityV2 is {}. Needs positions.
|
|
35
|
+
*/
|
|
36
|
+
liquityV2?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** One Liquity V2 market's troves of an address, by trove id — with an error when the ids or any trove failed to load. */
|
|
39
|
+
export interface PortfolioLiquityV2Troves {
|
|
40
|
+
error: string;
|
|
41
|
+
data: {
|
|
42
|
+
[troveId: string]: LiquityV2TroveData;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
18
45
|
export interface PortfolioPositionsDataForAddress {
|
|
19
46
|
aaveV3: {
|
|
20
47
|
[key in AaveVersions]?: PortfolioProtocolData<AaveV3PositionData>;
|
|
@@ -56,10 +83,65 @@ export interface PortfolioPositionsDataForAddress {
|
|
|
56
83
|
aaveV4: {
|
|
57
84
|
[key in AaveV4SpokesType]?: PortfolioProtocolData<AaveV4AccountData>;
|
|
58
85
|
};
|
|
86
|
+
/** Only with the liquityV2 option. Every trove the address holds, by market. */
|
|
87
|
+
liquityV2?: {
|
|
88
|
+
[key in LiquityV2Versions]?: PortfolioLiquityV2Troves;
|
|
89
|
+
};
|
|
59
90
|
}
|
|
60
91
|
export interface PortfolioPositionsData {
|
|
61
92
|
[key: EthAddress]: PortfolioPositionsDataForAddress;
|
|
62
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* The staking positions getPortfolioData returns for an address. The shapes are uneven, and the DeFi Saver app
|
|
96
|
+
* parses them as they are: a protocol read once per address comes back unwrapped on success, as
|
|
97
|
+
* `{ error, data: null }` on failure, and as {} (or Fluid's `{ error: '', data: {} }`) on a network it is not read on.
|
|
98
|
+
*/
|
|
99
|
+
export interface PortfolioStakingPositionsDataForAddress {
|
|
100
|
+
/** stkAAVE, stkGHO and sGHO; mainnet only. */
|
|
101
|
+
aaveV3: StakeAaveData | PortfolioProtocolError | {};
|
|
102
|
+
/** Morpho Blue supply without a borrow (Earn), by market; only markets with a deposit or an error. */
|
|
103
|
+
morphoBlue: {
|
|
104
|
+
[key in MorphoBlueVersions]?: PortfolioProtocolData<MorphoBlueEarnData>;
|
|
105
|
+
};
|
|
106
|
+
compoundV3: Record<string, never>;
|
|
107
|
+
spark: Record<string, never>;
|
|
108
|
+
aaveV2: Record<string, never>;
|
|
109
|
+
compoundV2: Record<string, never>;
|
|
110
|
+
/** LQTY staking and the LUSD stability pool; mainnet only. */
|
|
111
|
+
liquity: LiquityStakingData | PortfolioProtocolError | {};
|
|
112
|
+
/** Stability pool deposits, by market; mainnet only, legacy markets left out. */
|
|
113
|
+
liquityV2: {
|
|
114
|
+
[key in LiquityV2Versions]?: PortfolioProtocolData<LiquityV2StakingData>;
|
|
115
|
+
};
|
|
116
|
+
/** Fluid lending (fToken) deposits; `{ error: '', data: {} }` on a network without Fluid. */
|
|
117
|
+
fluid: FluidEarnPositionData[] | PortfolioProtocolError | {
|
|
118
|
+
error: string;
|
|
119
|
+
data: Record<string, never>;
|
|
120
|
+
};
|
|
121
|
+
/** Umbrella stakes; absent off mainnet. */
|
|
122
|
+
umbrella?: UmbrellaStakingData | PortfolioProtocolError;
|
|
123
|
+
/** sBOLD, yBOLD and stYBOLD; data is null off mainnet. */
|
|
124
|
+
liquityV2SBoldYBold: PortfolioProtocolData<LiquityV2SBoldYBoldData>;
|
|
125
|
+
}
|
|
126
|
+
export type PortfolioStakingPositionsData = Record<EthAddress, PortfolioStakingPositionsDataForAddress>;
|
|
127
|
+
/** The claimable rewards getPortfolioData returns for an address. Off mainnet only Merkl and Aave V3 are read. */
|
|
128
|
+
export interface PortfolioRewardsDataForAddress {
|
|
129
|
+
merkl: PortfolioProtocolData<MerklRewardsClaimableToken[]>;
|
|
130
|
+
aaveV3: {
|
|
131
|
+
[key in AaveVersions]?: PortfolioProtocolData<AaveRewardsClaimableToken[]>;
|
|
132
|
+
};
|
|
133
|
+
spark: {
|
|
134
|
+
[key in SparkVersions]?: PortfolioProtocolData<SparkRewardsClaimableToken[]>;
|
|
135
|
+
};
|
|
136
|
+
/** The SPK airdrop. */
|
|
137
|
+
spk: PortfolioProtocolData<SparkAirdropClaimableToken[]>;
|
|
138
|
+
king: PortfolioProtocolData<KingRewardsClaimableToken[]>;
|
|
139
|
+
/** {} off mainnet. */
|
|
140
|
+
ethena: PortfolioProtocolData<EthenaAirdropClaimableToken[]> | {};
|
|
141
|
+
uniswap: PortfolioProtocolData<UniswapAirdropClaimableToken[]>;
|
|
142
|
+
}
|
|
143
|
+
export type PortfolioRewardsData = Record<EthAddress, PortfolioRewardsDataForAddress>;
|
|
144
|
+
/** The `markets` getPortfolioData returns: every market it read, by protocol, keyed by market or spoke. */
|
|
63
145
|
export interface PortfolioMarketsData {
|
|
64
146
|
morphoMarketsData: Record<string, MorphoBlueMarketInfo>;
|
|
65
147
|
morphoMidnightMarketsData: Record<string, MorphoMidnightMarketInfo>;
|
|
@@ -72,6 +154,44 @@ export interface PortfolioMarketsData {
|
|
|
72
154
|
llamaLendMarketsData: Record<string, LlamaLendGlobalMarketData>;
|
|
73
155
|
liquityV2MarketsData: Record<string, LiquityV2MarketData>;
|
|
74
156
|
aaveV4SpokesData: Record<string, AaveV4SpokeData>;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The `markets` getShifterPortfolioData returns: the portfolio's markets, plus Fluid's and Maker's, which the shifter
|
|
160
|
+
* offers as destinations. Kept apart from PortfolioMarketsData, which getPortfolioData does not fill these into.
|
|
161
|
+
*/
|
|
162
|
+
export interface ShifterPortfolioMarketsData extends PortfolioMarketsData {
|
|
75
163
|
fluidMarketsData: Record<string, FluidMarketData>;
|
|
76
164
|
makerMarketsData: Record<string, IlkInfo>;
|
|
77
165
|
}
|
|
166
|
+
/** The markets that could not be read, by their key in PortfolioMarketsData, then by market or spoke: the error. */
|
|
167
|
+
export type PortfolioMarketsErrors = {
|
|
168
|
+
[key in keyof PortfolioMarketsData]?: Record<string, string>;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* What the portfolio fetch could not read and has no `{ error, data }` entry of its own to report it in. A key is
|
|
172
|
+
* present only when something under it failed; {} when everything was read.
|
|
173
|
+
*/
|
|
174
|
+
export interface PortfolioErrors {
|
|
175
|
+
/** Markets missing from `markets`; every position on such a market is an entry with an error. */
|
|
176
|
+
markets?: PortfolioMarketsErrors;
|
|
177
|
+
/** Addresses whose Maker vault list could not be read: their `maker` is {}, which would otherwise read as "no vaults". */
|
|
178
|
+
makerCdps?: Record<EthAddress, string>;
|
|
179
|
+
}
|
|
180
|
+
/** getPortfolioMarketsData's result. */
|
|
181
|
+
export interface PortfolioMarketsResult {
|
|
182
|
+
/** Every market read; one that failed is missing and named in `errors`. */
|
|
183
|
+
markets: PortfolioMarketsData;
|
|
184
|
+
errors: PortfolioMarketsErrors;
|
|
185
|
+
}
|
|
186
|
+
/** getPortfolioUserData's result: what is read per address. */
|
|
187
|
+
export interface PortfolioUserData {
|
|
188
|
+
positions: PortfolioPositionsData;
|
|
189
|
+
stakingPositions: PortfolioStakingPositionsData;
|
|
190
|
+
rewardsData: PortfolioRewardsData;
|
|
191
|
+
errors: Pick<PortfolioErrors, 'makerCdps'>;
|
|
192
|
+
}
|
|
193
|
+
/** getPortfolioData's result. */
|
|
194
|
+
export interface PortfolioData extends Omit<PortfolioUserData, 'errors'> {
|
|
195
|
+
markets: PortfolioMarketsData;
|
|
196
|
+
errors: PortfolioErrors;
|
|
197
|
+
}
|
|
@@ -20,4 +20,12 @@ export interface SavingsVaultData {
|
|
|
20
20
|
asset: string;
|
|
21
21
|
optionType: string;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
/** The key of every savings vault getSavingsData reads. */
|
|
24
|
+
export type SavingsVaultKey = MorphoVaultType | YearnVaultType | MakerDsrType | SkySavingsType | SparkSavingsVaultType | SummerVaultType | YearnV3VaultType;
|
|
25
|
+
export type SavingsData = Partial<Record<SavingsVaultKey, SavingsVaultData>>;
|
|
26
|
+
/** Why each vault that was read for a network came back without data. */
|
|
27
|
+
export type SavingsErrors = Partial<Record<SavingsVaultKey, string>>;
|
|
28
|
+
export interface SavingsDataWithErrors {
|
|
29
|
+
data: SavingsData;
|
|
30
|
+
errors: SavingsErrors;
|
|
31
|
+
}
|
package/esm/types/spark.d.ts
CHANGED
|
@@ -46,6 +46,21 @@ export interface SparkAssetData extends MMAssetData {
|
|
|
46
46
|
eModeCategory: number;
|
|
47
47
|
liquidationBonus: string;
|
|
48
48
|
liquidationRatio: string;
|
|
49
|
+
debtCeilingForIsolationMode?: string;
|
|
50
|
+
isSiloed?: boolean;
|
|
51
|
+
isolationModeTotalDebt?: string;
|
|
52
|
+
isolationModeBorrowingEnabled?: boolean;
|
|
53
|
+
assetId?: number;
|
|
54
|
+
borrowRateStable?: string;
|
|
55
|
+
supplyCap?: string;
|
|
56
|
+
isInactive?: boolean;
|
|
57
|
+
isFrozen?: boolean;
|
|
58
|
+
isPaused?: boolean;
|
|
59
|
+
canBeWithdrawn?: boolean;
|
|
60
|
+
canBePayBacked?: boolean;
|
|
61
|
+
disabledStableBorrowing?: boolean;
|
|
62
|
+
isFlashLoanEnabled?: boolean;
|
|
63
|
+
aTokenAddress?: EthAddress;
|
|
49
64
|
}
|
|
50
65
|
export interface SparkAssetsData {
|
|
51
66
|
[token: string]: SparkAssetData;
|
|
@@ -101,7 +116,12 @@ export interface SparkAggregatedPositionData {
|
|
|
101
116
|
minHealthRatio: string;
|
|
102
117
|
exposure: string;
|
|
103
118
|
}
|
|
104
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Fields sparkGetAggregatedPositionData adds to every Spark position at runtime, on top of those declared below.
|
|
121
|
+
* Optional, so code that builds a position by hand keeps compiling.
|
|
122
|
+
*/
|
|
123
|
+
export type SparkPositionAggregatedFields = Partial<Omit<SparkAggregatedPositionData, keyof MMPositionData | 'ratio' | 'collRatio' | 'suppliedUsd' | 'borrowedUsd' | 'borrowLimitUsd' | 'suppliedCollateralUsd' | 'incentiveUsd' | 'totalInterestUsd'>>;
|
|
124
|
+
export interface SparkPositionData extends MMPositionData, SparkPositionAggregatedFields {
|
|
105
125
|
ratio: string;
|
|
106
126
|
minRatio: string;
|
|
107
127
|
collRatio: string;
|
package/esm/umbrella/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { EthAddress, NetworkNumber } from '../types/common';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}>;
|
|
3
|
+
import { UmbrellaStakingData } from '../types/aave';
|
|
4
|
+
export declare const getUmbrellaData: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<UmbrellaStakingData>;
|
package/package.json
CHANGED
package/src/aaveV3/index.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
EModeCategoriesData,
|
|
32
32
|
EModeCategoryData,
|
|
33
33
|
EModeCategoryDataMapping,
|
|
34
|
+
StakeAaveData,
|
|
34
35
|
} from '../types';
|
|
35
36
|
import {
|
|
36
37
|
Blockish,
|
|
@@ -852,7 +853,7 @@ export const fetchYearlyMeritApyForStakingGho = async () => {
|
|
|
852
853
|
}
|
|
853
854
|
};
|
|
854
855
|
|
|
855
|
-
export const getStakeAaveData = async (provider: Client, network: NetworkNumber, address: EthAddress) => {
|
|
856
|
+
export const getStakeAaveData = async (provider: Client, network: NetworkNumber, address: EthAddress): Promise<StakeAaveData> => {
|
|
856
857
|
const stkGhoAddress = getAssetInfo('stkGHO').address as HexString;
|
|
857
858
|
const stkAaveAddress = getAssetInfo('stkAAVE').address as HexString;
|
|
858
859
|
|
package/src/aaveV3/sgho.ts
CHANGED
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
import Dec from 'decimal.js';
|
|
2
2
|
import { EthAddress, NetworkNumber } from '../types/common';
|
|
3
|
+
import { SghoData } from '../types/aave';
|
|
3
4
|
import { DEFAULT_TIMEOUT } from '../services/utils';
|
|
4
5
|
import { ZERO_ADDRESS } from '../constants';
|
|
5
6
|
|
|
6
|
-
export
|
|
7
|
-
shares: string;
|
|
8
|
-
balance: string;
|
|
9
|
-
maxDeposit: string;
|
|
10
|
-
maxWithdraw: string;
|
|
11
|
-
underlyingBalance: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface SghoData {
|
|
15
|
-
totalAssets: string;
|
|
16
|
-
totalSupply: string;
|
|
17
|
-
supplyCap: string;
|
|
18
|
-
/** Target savings rate as an APY percent (e.g. "4.25" for 4.25%). */
|
|
19
|
-
targetRate: string;
|
|
20
|
-
paused: boolean;
|
|
21
|
-
user: SghoUserData;
|
|
22
|
-
}
|
|
7
|
+
export type { SghoData, SghoUserData } from '../types/aave';
|
|
23
8
|
|
|
24
9
|
const EMPTY_SGHO_DATA: SghoData = {
|
|
25
10
|
totalAssets: '0',
|
package/src/aaveV4/lend.ts
CHANGED
|
@@ -7,26 +7,9 @@ import {
|
|
|
7
7
|
EthereumProvider,
|
|
8
8
|
NetworkNumber,
|
|
9
9
|
} from '../types/common';
|
|
10
|
+
import { AaveV4TokenizationSpokeDataParsed } from '../types/aaveV4';
|
|
10
11
|
|
|
11
|
-
export
|
|
12
|
-
underlyingAsset: EthAddress;
|
|
13
|
-
assetId: string;
|
|
14
|
-
decimals: number;
|
|
15
|
-
spoke: EthAddress;
|
|
16
|
-
spokeActive: boolean;
|
|
17
|
-
spokeHalted: boolean;
|
|
18
|
-
spokeDepositCap: string;
|
|
19
|
-
spokeTotalAssets: string;
|
|
20
|
-
spokeTotalShares: string;
|
|
21
|
-
hub: EthAddress;
|
|
22
|
-
hubLiquidity: string;
|
|
23
|
-
hubDrawnRate: string;
|
|
24
|
-
convertToShares: string;
|
|
25
|
-
convertToAssets: string;
|
|
26
|
-
user: EthAddress;
|
|
27
|
-
userSuppliedAssets: string;
|
|
28
|
-
userSuppliedShares: string;
|
|
29
|
-
}
|
|
12
|
+
export type { AaveV4TokenizationSpokeData, AaveV4TokenizationSpokeDataParsed } from '../types/aaveV4';
|
|
30
13
|
|
|
31
14
|
export const AAVE_V4_TOKENIZED_SPOKES: Record<string, EthAddress> = {
|
|
32
15
|
EURC_CORE: '0x6D9e2Cdd61CaF69af99b275704B6e272C41c6718',
|
|
@@ -102,34 +85,6 @@ export const aaveV4GetTokenizedVaultAddress = (
|
|
|
102
85
|
return AAVE_V4_TOKENIZED_SPOKES[key];
|
|
103
86
|
};
|
|
104
87
|
|
|
105
|
-
/** Parsed tokenization spoke data with human-readable supplied amounts for display */
|
|
106
|
-
export interface AaveV4TokenizationSpokeDataParsed {
|
|
107
|
-
vaultAddress: EthAddress;
|
|
108
|
-
key: string | null;
|
|
109
|
-
symbol: string;
|
|
110
|
-
hubKey: string;
|
|
111
|
-
// ---- Spoke ----
|
|
112
|
-
spokeActive: boolean;
|
|
113
|
-
spokeHalted: boolean;
|
|
114
|
-
/** Deposit cap in asset units (wei string) */
|
|
115
|
-
spokeDepositCap: string;
|
|
116
|
-
/** Total assets currently in spoke in asset units (wei string) */
|
|
117
|
-
spokeTotalAssets: string;
|
|
118
|
-
// ---- Hub ----
|
|
119
|
-
/** Available hub liquidity in asset units (wei string) */
|
|
120
|
-
hubLiquidity: string;
|
|
121
|
-
/** The conversion rate from assets to shares expressed in asset units. */
|
|
122
|
-
convertToShares: string;
|
|
123
|
-
// ---- User ----
|
|
124
|
-
userSuppliedAssetsEth: string;
|
|
125
|
-
userSuppliedSharesEth: string;
|
|
126
|
-
userSuppliedAssets: string;
|
|
127
|
-
userSuppliedShares: string;
|
|
128
|
-
underlyingAsset: EthAddress;
|
|
129
|
-
spoke: EthAddress;
|
|
130
|
-
decimals: number;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
88
|
const AAVE_V4_TOKENIZED_SPOKE_ADDRESS_TO_KEY: Record<string, string> = Object.entries(
|
|
134
89
|
AAVE_V4_TOKENIZED_SPOKES,
|
|
135
90
|
).reduce((acc, [k, v]) => {
|
|
@@ -189,4 +144,3 @@ export async function getAaveV4TokenizationSpokesData(
|
|
|
189
144
|
}).filter(item => item != null);
|
|
190
145
|
}
|
|
191
146
|
|
|
192
|
-
|
package/src/claiming/aaveV3.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import Dec from 'decimal.js';
|
|
3
3
|
import { EthAddress, NetworkNumber } from '../types';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
AaveRewardsClaimableToken, ClaimableToken, ClaimType, MerklRewardsClaimableToken,
|
|
6
|
+
} from '../types/claiming';
|
|
5
7
|
import {
|
|
6
8
|
AaveIncentiveDataProviderV3ContractViem,
|
|
7
9
|
AaveRewardsControllerViem,
|
|
@@ -37,7 +39,7 @@ export async function getUnclaimedRewardsForAllMarkets(
|
|
|
37
39
|
network: NetworkNumber,
|
|
38
40
|
walletAddress: EthAddress,
|
|
39
41
|
marketAddress: EthAddress,
|
|
40
|
-
): Promise<
|
|
42
|
+
): Promise<AaveRewardsClaimableToken[]> {
|
|
41
43
|
const contract = AaveIncentiveDataProviderV3ContractViem(provider, network);
|
|
42
44
|
const tokensData = await contract.read.getUserReservesIncentivesData([marketAddress, walletAddress]);
|
|
43
45
|
const allTokensDataArrays = tokensData.reduce((acc: any[], val) => {
|