@defisaver/positions-sdk 2.1.161-portfolio-api-1-dev → 2.1.161-portfolio-api-3-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/aaveV2/index.js +2 -0
- package/cjs/aaveV3/index.d.ts +41 -12
- package/cjs/aaveV3/index.js +237 -2
- 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/curveUsd/index.d.ts +5 -2
- package/cjs/curveUsd/index.js +30 -15
- package/cjs/fluid/index.d.ts +10 -49
- package/cjs/fluid/index.js +36 -1
- package/cjs/helpers/aaveHelpers/index.d.ts +9 -1
- package/cjs/helpers/aaveHelpers/index.js +26 -6
- package/cjs/helpers/aaveV4Helpers/index.js +1 -0
- package/cjs/helpers/compoundHelpers/index.js +2 -0
- package/cjs/helpers/curveUsdHelpers/index.d.ts +3 -1
- package/cjs/helpers/curveUsdHelpers/index.js +15 -2
- package/cjs/helpers/fluidHelpers/index.js +1 -0
- package/cjs/helpers/liquityV2Helpers/index.js +1 -0
- package/cjs/helpers/llamaLendHelpers/index.js +1 -0
- package/cjs/helpers/makerHelpers/index.d.ts +1 -1
- package/cjs/helpers/makerHelpers/index.js +2 -2
- package/cjs/helpers/morphoBlueHelpers/index.js +2 -0
- package/cjs/helpers/morphoMidnightHelpers/index.js +2 -0
- package/cjs/helpers/sparkHelpers/index.js +1 -0
- package/cjs/liquity/index.d.ts +2 -12
- package/cjs/liquity/index.js +15 -2
- package/cjs/liquityV2/index.d.ts +8 -23
- package/cjs/liquityV2/index.js +37 -19
- package/cjs/maker/index.d.ts +7 -2
- package/cjs/maker/index.js +44 -12
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +3 -1
- package/cjs/markets/maker/index.d.ts +1 -0
- package/cjs/markets/maker/index.js +13 -0
- package/cjs/moneymarket/moneymarketCommonService.d.ts +9 -0
- package/cjs/moneymarket/moneymarketCommonService.js +13 -1
- package/cjs/portfolio/index.d.ts +17 -5
- package/cjs/portfolio/index.js +583 -381
- 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 +37 -5
- package/cjs/savings/morphoVaults/index.d.ts +1 -1
- package/cjs/savings/morphoVaults/index.js +56 -18
- package/cjs/savings/morphoVaults/options.d.ts +2 -0
- package/cjs/savings/morphoVaults/options.js +61 -1
- package/cjs/spark/index.js +1 -0
- package/cjs/staking/staking.d.ts +20 -0
- package/cjs/staking/staking.js +19 -1
- package/cjs/types/aave.d.ts +86 -0
- package/cjs/types/aaveV4.d.ts +45 -0
- package/cjs/types/compound.d.ts +2 -0
- package/cjs/types/curveUsd.d.ts +6 -0
- package/cjs/types/fluid.d.ts +14 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/liquity.d.ts +16 -0
- package/cjs/types/liquityV2.d.ts +26 -0
- package/cjs/types/maker.d.ts +4 -0
- package/cjs/types/morphoBlue.d.ts +2 -0
- package/cjs/types/morphoMidnight.d.ts +1 -0
- package/cjs/types/portfolio.d.ts +127 -6
- package/cjs/types/savings/index.d.ts +9 -1
- package/cjs/types/savings/morphoVaults.d.ts +10 -2
- package/cjs/types/savings/morphoVaults.js +9 -1
- package/cjs/types/spark.d.ts +2 -0
- package/cjs/umbrella/index.d.ts +2 -3
- package/esm/aaveV2/index.js +2 -0
- package/esm/aaveV3/index.d.ts +41 -12
- package/esm/aaveV3/index.js +231 -2
- 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/curveUsd/index.d.ts +5 -2
- package/esm/curveUsd/index.js +30 -15
- package/esm/fluid/index.d.ts +10 -49
- package/esm/fluid/index.js +33 -0
- package/esm/helpers/aaveHelpers/index.d.ts +9 -1
- package/esm/helpers/aaveHelpers/index.js +23 -5
- package/esm/helpers/aaveV4Helpers/index.js +1 -0
- package/esm/helpers/compoundHelpers/index.js +2 -0
- package/esm/helpers/curveUsdHelpers/index.d.ts +3 -1
- package/esm/helpers/curveUsdHelpers/index.js +16 -3
- package/esm/helpers/fluidHelpers/index.js +1 -0
- package/esm/helpers/liquityV2Helpers/index.js +1 -0
- package/esm/helpers/llamaLendHelpers/index.js +2 -1
- package/esm/helpers/makerHelpers/index.d.ts +1 -1
- package/esm/helpers/makerHelpers/index.js +2 -2
- package/esm/helpers/morphoBlueHelpers/index.js +2 -0
- package/esm/helpers/morphoMidnightHelpers/index.js +2 -0
- package/esm/helpers/sparkHelpers/index.js +1 -0
- package/esm/liquity/index.d.ts +2 -12
- package/esm/liquity/index.js +16 -3
- package/esm/liquityV2/index.d.ts +8 -23
- package/esm/liquityV2/index.js +35 -18
- package/esm/maker/index.d.ts +7 -2
- package/esm/maker/index.js +44 -14
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/markets/maker/index.d.ts +1 -0
- package/esm/markets/maker/index.js +10 -0
- package/esm/moneymarket/moneymarketCommonService.d.ts +9 -0
- package/esm/moneymarket/moneymarketCommonService.js +11 -0
- package/esm/portfolio/index.d.ts +17 -5
- package/esm/portfolio/index.js +584 -385
- 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 +35 -4
- package/esm/savings/morphoVaults/index.d.ts +1 -1
- package/esm/savings/morphoVaults/index.js +57 -19
- package/esm/savings/morphoVaults/options.d.ts +2 -0
- package/esm/savings/morphoVaults/options.js +61 -1
- package/esm/spark/index.js +1 -0
- package/esm/staking/staking.d.ts +20 -0
- package/esm/staking/staking.js +17 -0
- package/esm/types/aave.d.ts +86 -0
- package/esm/types/aaveV4.d.ts +45 -0
- package/esm/types/compound.d.ts +2 -0
- package/esm/types/curveUsd.d.ts +6 -0
- package/esm/types/fluid.d.ts +14 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/esm/types/liquity.d.ts +16 -0
- package/esm/types/liquityV2.d.ts +26 -0
- package/esm/types/maker.d.ts +4 -0
- package/esm/types/morphoBlue.d.ts +2 -0
- package/esm/types/morphoMidnight.d.ts +1 -0
- package/esm/types/portfolio.d.ts +127 -6
- package/esm/types/savings/index.d.ts +9 -1
- package/esm/types/savings/morphoVaults.d.ts +10 -2
- package/esm/types/savings/morphoVaults.js +8 -0
- package/esm/types/spark.d.ts +2 -0
- package/esm/umbrella/index.d.ts +2 -3
- package/package.json +3 -2
- package/src/aaveV2/index.ts +2 -0
- package/src/aaveV3/index.ts +293 -2
- 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/curveUsd/index.ts +33 -16
- package/src/fluid/index.ts +44 -3
- package/src/helpers/aaveHelpers/index.ts +27 -7
- package/src/helpers/aaveV4Helpers/index.ts +1 -0
- package/src/helpers/compoundHelpers/index.ts +2 -0
- package/src/helpers/curveUsdHelpers/index.ts +23 -3
- package/src/helpers/fluidHelpers/index.ts +1 -0
- package/src/helpers/liquityV2Helpers/index.ts +1 -0
- package/src/helpers/llamaLendHelpers/index.ts +2 -1
- package/src/helpers/makerHelpers/index.ts +2 -1
- package/src/helpers/morphoBlueHelpers/index.ts +2 -0
- package/src/helpers/morphoMidnightHelpers/index.ts +2 -0
- package/src/helpers/sparkHelpers/index.ts +1 -0
- package/src/liquity/index.ts +19 -5
- package/src/liquityV2/index.ts +48 -22
- package/src/maker/index.ts +77 -30
- package/src/markets/index.ts +2 -1
- package/src/markets/maker/index.ts +10 -0
- package/src/moneymarket/moneymarketCommonService.ts +15 -0
- package/src/portfolio/index.ts +477 -248
- package/src/portfolio/lendingProtocols.ts +281 -0
- package/src/savings/index.ts +45 -5
- package/src/savings/morphoVaults/index.ts +73 -21
- package/src/savings/morphoVaults/options.ts +67 -1
- package/src/spark/index.ts +1 -0
- package/src/staking/staking.ts +28 -0
- package/src/types/aave.ts +90 -0
- package/src/types/aaveV4.ts +50 -0
- package/src/types/compound.ts +2 -0
- package/src/types/curveUsd.ts +7 -0
- package/src/types/fluid.ts +15 -0
- package/src/types/index.ts +2 -1
- package/src/types/liquity.ts +19 -1
- package/src/types/liquityV2.ts +28 -1
- package/src/types/maker.ts +6 -0
- package/src/types/morphoBlue.ts +2 -0
- package/src/types/morphoMidnight.ts +1 -0
- package/src/types/portfolio.ts +153 -7
- package/src/types/savings/index.ts +12 -1
- package/src/types/savings/morphoVaults.ts +11 -1
- package/src/types/spark.ts +2 -0
- package/src/umbrella/index.ts +2 -1
package/src/types/portfolio.ts
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AaveV2MarketData, AaveV2PositionData, AaveV3MarketData, AaveV3PositionData, AaveVersions,
|
|
2
|
+
AaveV2MarketData, AaveV2PositionData, AaveV3MarketData, AaveV3PositionData, AaveVersions, StakeAaveData, UmbrellaStakingData,
|
|
3
3
|
} from './aave';
|
|
4
4
|
import { AaveV4AccountData, AaveV4SpokeData, AaveV4SpokesType } from './aaveV4';
|
|
5
|
+
import {
|
|
6
|
+
AaveRewardsClaimableToken,
|
|
7
|
+
EthenaAirdropClaimableToken,
|
|
8
|
+
KingRewardsClaimableToken,
|
|
9
|
+
MerklRewardsClaimableToken,
|
|
10
|
+
SparkAirdropClaimableToken,
|
|
11
|
+
SparkRewardsClaimableToken,
|
|
12
|
+
UniswapAirdropClaimableToken,
|
|
13
|
+
} from './claiming';
|
|
5
14
|
import { EthAddress } from './common';
|
|
6
15
|
import {
|
|
7
16
|
CompoundV2MarketsData, CompoundV2PositionData, CompoundV3MarketsData, CompoundV3PositionData, CompoundVersions,
|
|
8
17
|
} from './compound';
|
|
9
18
|
import { CrvUSDGlobalMarketData, CrvUSDUserData, CrvUSDVersions } from './curveUsd';
|
|
10
|
-
import { FluidVaultData } from './fluid';
|
|
11
|
-
import { LiquityTroveInfo } from './liquity';
|
|
12
|
-
import {
|
|
19
|
+
import { FluidEarnPositionData, FluidMarketData, FluidVaultData } from './fluid';
|
|
20
|
+
import { LiquityStakingData, LiquityTroveInfo } from './liquity';
|
|
21
|
+
import {
|
|
22
|
+
LiquityV2MarketData, LiquityV2SBoldYBoldData, LiquityV2StakingData, LiquityV2TroveData, LiquityV2Versions,
|
|
23
|
+
} from './liquityV2';
|
|
13
24
|
import { LlamaLendGlobalMarketData, LlamaLendUserData, LlamaLendVersionsType } from './llamaLend';
|
|
14
|
-
import { CdpData } from './maker';
|
|
15
|
-
import {
|
|
25
|
+
import { CdpData, IlkInfo } from './maker';
|
|
26
|
+
import {
|
|
27
|
+
MorphoBlueEarnData, MorphoBlueMarketInfo, MorphoBluePositionData, MorphoBlueVersions,
|
|
28
|
+
} from './morphoBlue';
|
|
16
29
|
import { MorphoMidnightMarketInfo, MorphoMidnightPositionData, MorphoMidnightVersions } from './morphoMidnight';
|
|
17
30
|
import { SparkMarketsData, SparkPositionData, SparkVersions } from './spark';
|
|
18
31
|
|
|
@@ -21,6 +34,35 @@ export interface PortfolioProtocolData<T> {
|
|
|
21
34
|
data: T | null,
|
|
22
35
|
}
|
|
23
36
|
|
|
37
|
+
/** A failed fetch of a protocol that, when it succeeds, getPortfolioData returns unwrapped rather than as `{ error, data }`. */
|
|
38
|
+
export interface PortfolioProtocolError {
|
|
39
|
+
error: string,
|
|
40
|
+
data: null,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** What getPortfolioData reads besides markets. */
|
|
44
|
+
export interface PortfolioDataOptions {
|
|
45
|
+
/** positions (lending); default true. With false it comes back as {} and no lending position is read. */
|
|
46
|
+
positions?: boolean,
|
|
47
|
+
/** stakingPositions; default true. With false it comes back as {} and no staking source is read. */
|
|
48
|
+
staking?: boolean,
|
|
49
|
+
/** rewardsData; default true. With false it comes back as {} and no rewards source is read. */
|
|
50
|
+
rewards?: boolean,
|
|
51
|
+
/**
|
|
52
|
+
* Liquity V2 troves in positions[address].liquityV2; default false, as the DeFi Saver app reads them on its own.
|
|
53
|
+
* Mainnet only: elsewhere liquityV2 is {}. Needs positions.
|
|
54
|
+
*/
|
|
55
|
+
liquityV2?: boolean,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** One Liquity V2 market's troves of an address, by trove id — with an error when the ids or any trove failed to load. */
|
|
59
|
+
export interface PortfolioLiquityV2Troves {
|
|
60
|
+
error: string,
|
|
61
|
+
data: {
|
|
62
|
+
[troveId: string]: LiquityV2TroveData;
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
24
66
|
export interface PortfolioPositionsDataForAddress {
|
|
25
67
|
aaveV3: {
|
|
26
68
|
[key in AaveVersions]?: PortfolioProtocolData<AaveV3PositionData>;
|
|
@@ -62,12 +104,70 @@ export interface PortfolioPositionsDataForAddress {
|
|
|
62
104
|
aaveV4: {
|
|
63
105
|
[key in AaveV4SpokesType]?: PortfolioProtocolData<AaveV4AccountData>;
|
|
64
106
|
};
|
|
107
|
+
/** Only with the liquityV2 option. Every trove the address holds, by market. */
|
|
108
|
+
liquityV2?: {
|
|
109
|
+
[key in LiquityV2Versions]?: PortfolioLiquityV2Troves;
|
|
110
|
+
};
|
|
65
111
|
}
|
|
66
112
|
|
|
67
113
|
export interface PortfolioPositionsData {
|
|
68
114
|
[key: EthAddress]: PortfolioPositionsDataForAddress;
|
|
69
115
|
}
|
|
70
116
|
|
|
117
|
+
/**
|
|
118
|
+
* The staking positions getPortfolioData returns for an address. The shapes are uneven, and the DeFi Saver app
|
|
119
|
+
* parses them as they are: a protocol read once per address comes back unwrapped on success, as
|
|
120
|
+
* `{ error, data: null }` on failure, and as {} (or Fluid's `{ error: '', data: {} }`) on a network it is not read on.
|
|
121
|
+
*/
|
|
122
|
+
export interface PortfolioStakingPositionsDataForAddress {
|
|
123
|
+
/** stkAAVE, stkGHO and sGHO; mainnet only. */
|
|
124
|
+
aaveV3: StakeAaveData | PortfolioProtocolError | {};
|
|
125
|
+
/** Morpho Blue supply without a borrow (Earn), by market; only markets with a deposit or an error. */
|
|
126
|
+
morphoBlue: {
|
|
127
|
+
[key in MorphoBlueVersions]?: PortfolioProtocolData<MorphoBlueEarnData>;
|
|
128
|
+
};
|
|
129
|
+
// Never filled; kept so the shape does not change under the app.
|
|
130
|
+
compoundV3: Record<string, never>;
|
|
131
|
+
spark: Record<string, never>;
|
|
132
|
+
aaveV2: Record<string, never>;
|
|
133
|
+
compoundV2: Record<string, never>;
|
|
134
|
+
/** LQTY staking and the LUSD stability pool; mainnet only. */
|
|
135
|
+
liquity: LiquityStakingData | PortfolioProtocolError | {};
|
|
136
|
+
/** Stability pool deposits, by market; mainnet only, legacy markets left out. */
|
|
137
|
+
liquityV2: {
|
|
138
|
+
[key in LiquityV2Versions]?: PortfolioProtocolData<LiquityV2StakingData>;
|
|
139
|
+
};
|
|
140
|
+
/** Fluid lending (fToken) deposits; `{ error: '', data: {} }` on a network without Fluid. */
|
|
141
|
+
fluid: FluidEarnPositionData[] | PortfolioProtocolError | { error: string, data: Record<string, never> };
|
|
142
|
+
/** Umbrella stakes; absent off mainnet. */
|
|
143
|
+
umbrella?: UmbrellaStakingData | PortfolioProtocolError;
|
|
144
|
+
/** sBOLD, yBOLD and stYBOLD; data is null off mainnet. */
|
|
145
|
+
liquityV2SBoldYBold: PortfolioProtocolData<LiquityV2SBoldYBoldData>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// A Record rather than an interface: the app casts getPortfolioData's result to its own Record<string, …> type, and an
|
|
149
|
+
// interface with an address index signature is not comparable to one.
|
|
150
|
+
export type PortfolioStakingPositionsData = Record<EthAddress, PortfolioStakingPositionsDataForAddress>;
|
|
151
|
+
|
|
152
|
+
/** The claimable rewards getPortfolioData returns for an address. Off mainnet only Merkl and Aave V3 are read. */
|
|
153
|
+
export interface PortfolioRewardsDataForAddress {
|
|
154
|
+
merkl: PortfolioProtocolData<MerklRewardsClaimableToken[]>;
|
|
155
|
+
aaveV3: {
|
|
156
|
+
[key in AaveVersions]?: PortfolioProtocolData<AaveRewardsClaimableToken[]>;
|
|
157
|
+
};
|
|
158
|
+
spark: {
|
|
159
|
+
[key in SparkVersions]?: PortfolioProtocolData<SparkRewardsClaimableToken[]>;
|
|
160
|
+
};
|
|
161
|
+
/** The SPK airdrop. */
|
|
162
|
+
spk: PortfolioProtocolData<SparkAirdropClaimableToken[]>;
|
|
163
|
+
king: PortfolioProtocolData<KingRewardsClaimableToken[]>;
|
|
164
|
+
/** {} off mainnet. */
|
|
165
|
+
ethena: PortfolioProtocolData<EthenaAirdropClaimableToken[]> | {};
|
|
166
|
+
uniswap: PortfolioProtocolData<UniswapAirdropClaimableToken[]>;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export type PortfolioRewardsData = Record<EthAddress, PortfolioRewardsDataForAddress>;
|
|
170
|
+
|
|
71
171
|
/** The `markets` getPortfolioData returns: every market it read, by protocol, keyed by market or spoke. */
|
|
72
172
|
export interface PortfolioMarketsData {
|
|
73
173
|
morphoMarketsData: Record<string, MorphoBlueMarketInfo>;
|
|
@@ -81,4 +181,50 @@ export interface PortfolioMarketsData {
|
|
|
81
181
|
llamaLendMarketsData: Record<string, LlamaLendGlobalMarketData>;
|
|
82
182
|
liquityV2MarketsData: Record<string, LiquityV2MarketData>;
|
|
83
183
|
aaveV4SpokesData: Record<string, AaveV4SpokeData>;
|
|
84
|
-
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The `markets` getShifterPortfolioData returns: the portfolio's markets, plus Fluid's and Maker's, which the shifter
|
|
188
|
+
* offers as destinations. Kept apart from PortfolioMarketsData, which getPortfolioData does not fill these into.
|
|
189
|
+
*/
|
|
190
|
+
export interface ShifterPortfolioMarketsData extends PortfolioMarketsData {
|
|
191
|
+
fluidMarketsData: Record<string, FluidMarketData>;
|
|
192
|
+
makerMarketsData: Record<string, IlkInfo>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** The markets that could not be read, by their key in PortfolioMarketsData, then by market or spoke: the error. */
|
|
196
|
+
export type PortfolioMarketsErrors = {
|
|
197
|
+
[key in keyof PortfolioMarketsData]?: Record<string, string>;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* What the portfolio fetch could not read and has no `{ error, data }` entry of its own to report it in. A key is
|
|
202
|
+
* present only when something under it failed; {} when everything was read.
|
|
203
|
+
*/
|
|
204
|
+
export interface PortfolioErrors {
|
|
205
|
+
/** Markets missing from `markets`; every position on such a market is an entry with an error. */
|
|
206
|
+
markets?: PortfolioMarketsErrors;
|
|
207
|
+
/** Addresses whose Maker vault list could not be read: their `maker` is {}, which would otherwise read as "no vaults". */
|
|
208
|
+
makerCdps?: Record<EthAddress, string>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** getPortfolioMarketsData's result. */
|
|
212
|
+
export interface PortfolioMarketsResult {
|
|
213
|
+
/** Every market read; one that failed is missing and named in `errors`. */
|
|
214
|
+
markets: PortfolioMarketsData;
|
|
215
|
+
errors: PortfolioMarketsErrors;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** getPortfolioUserData's result: what is read per address. */
|
|
219
|
+
export interface PortfolioUserData {
|
|
220
|
+
positions: PortfolioPositionsData;
|
|
221
|
+
stakingPositions: PortfolioStakingPositionsData;
|
|
222
|
+
rewardsData: PortfolioRewardsData;
|
|
223
|
+
errors: Pick<PortfolioErrors, 'makerCdps'>;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** getPortfolioData's result. */
|
|
227
|
+
export interface PortfolioData extends Omit<PortfolioUserData, 'errors'> {
|
|
228
|
+
markets: PortfolioMarketsData;
|
|
229
|
+
errors: PortfolioErrors;
|
|
230
|
+
}
|
|
@@ -23,4 +23,15 @@ export interface SavingsVaultData {
|
|
|
23
23
|
optionType: string,
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
/** The key of every savings vault getSavingsData reads. */
|
|
27
|
+
export type SavingsVaultKey = MorphoVaultType | YearnVaultType | MakerDsrType | SkySavingsType | SparkSavingsVaultType | SummerVaultType | YearnV3VaultType;
|
|
28
|
+
|
|
29
|
+
export type SavingsData = Partial<Record<SavingsVaultKey, SavingsVaultData>>;
|
|
30
|
+
|
|
31
|
+
/** Why each vault that was read for a network came back without data. */
|
|
32
|
+
export type SavingsErrors = Partial<Record<SavingsVaultKey, string>>;
|
|
33
|
+
|
|
34
|
+
export interface SavingsDataWithErrors {
|
|
35
|
+
data: SavingsData,
|
|
36
|
+
errors: SavingsErrors,
|
|
37
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthAddress } from '../common';
|
|
1
|
+
import { EthAddress, NetworkNumber } from '../common';
|
|
2
2
|
|
|
3
3
|
export enum MorphoVaultType {
|
|
4
4
|
MorphoVaultFlagshipEth = 'morpho_vault_flagship_eth',
|
|
@@ -21,6 +21,14 @@ export enum MorphoVaultType {
|
|
|
21
21
|
MorphoVaultSmokehouseUSDT = 'morpho_vault_smokehouse_usdt',
|
|
22
22
|
MorphoVaultSmokehouseUSDC = 'morpho_vault_smokehouse_usdc',
|
|
23
23
|
MorphoVaultSmokehouseDAI = 'morpho_vault_smokehouse_dai',
|
|
24
|
+
// Vault V2
|
|
25
|
+
MorphoVaultGauntletUSDGPremium = 'morpho_vault_gauntlet_usdg_premium',
|
|
26
|
+
MorphoVaultSteakhouseUSDGPro = 'morpho_vault_steakhouse_usdg_pro',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export enum MorphoVaultVersion {
|
|
30
|
+
V1 = 1,
|
|
31
|
+
V2 = 2,
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
export interface MorphoVault {
|
|
@@ -28,6 +36,8 @@ export interface MorphoVault {
|
|
|
28
36
|
name: string;
|
|
29
37
|
address: EthAddress;
|
|
30
38
|
asset: string;
|
|
39
|
+
network: NetworkNumber;
|
|
40
|
+
version: MorphoVaultVersion;
|
|
31
41
|
deploymentBlock: number;
|
|
32
42
|
isLegacy: boolean;
|
|
33
43
|
}
|
package/src/types/spark.ts
CHANGED
|
@@ -115,6 +115,7 @@ export interface SparkAggregatedPositionData {
|
|
|
115
115
|
leftToBorrowUsd: string,
|
|
116
116
|
ratio: string,
|
|
117
117
|
collRatio: string,
|
|
118
|
+
safetyRatio: string,
|
|
118
119
|
netApy: string,
|
|
119
120
|
incentiveUsd: string,
|
|
120
121
|
totalInterestUsd: string,
|
|
@@ -143,6 +144,7 @@ export interface SparkPositionData extends MMPositionData, SparkPositionAggregat
|
|
|
143
144
|
ratio: string,
|
|
144
145
|
minRatio: string,
|
|
145
146
|
collRatio: string,
|
|
147
|
+
safetyRatio?: string,
|
|
146
148
|
suppliedUsd: string,
|
|
147
149
|
borrowedUsd: string,
|
|
148
150
|
borrowLimitUsd: string,
|
package/src/umbrella/index.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { AaveUmbrellaViewViem, AaveV3ViewContractViem } from '../contracts';
|
|
3
3
|
import { EthAddress, NetworkNumber } from '../types/common';
|
|
4
|
+
import { UmbrellaStakingData } from '../types/aave';
|
|
4
5
|
import { compareAddresses, convertHybridArraysToObjects, getEthAmountForDecimals } from '../services/utils';
|
|
5
6
|
import { findMatching, tokenEntries } from './umbrellaUtils';
|
|
6
7
|
|
|
7
8
|
const umbrella = '0xD400fc38ED4732893174325693a63C30ee3881a8';
|
|
8
9
|
const aaveOracle = '0x54586bE62E3c3580375aE3723C145253060Ca0C2';
|
|
9
10
|
|
|
10
|
-
export const getUmbrellaData = async (provider: Client, network: NetworkNumber, address: EthAddress) => {
|
|
11
|
+
export const getUmbrellaData = async (provider: Client, network: NetworkNumber, address: EthAddress): Promise<UmbrellaStakingData> => {
|
|
11
12
|
const umbrellaView = AaveUmbrellaViewViem(provider, network);
|
|
12
13
|
const aaveV3View = AaveV3ViewContractViem(provider, network);
|
|
13
14
|
const [tokensAggregatedData, additionalUmbrellaStakingData, userAggregatedData] = await Promise.all([
|