@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.
Files changed (101) hide show
  1. package/cjs/aaveV3/index.d.ts +12 -2
  2. package/cjs/aaveV3/sgho.d.ts +16 -2
  3. package/cjs/aaveV4/lend.d.ts +43 -2
  4. package/cjs/claiming/aaveV3.d.ts +2 -2
  5. package/cjs/claiming/ethena.d.ts +1 -2
  6. package/cjs/claiming/king.d.ts +1 -2
  7. package/cjs/claiming/spark.d.ts +2 -2
  8. package/cjs/fluid/index.d.ts +49 -5
  9. package/cjs/liquity/index.d.ts +12 -2
  10. package/cjs/liquityV2/index.d.ts +23 -8
  11. package/cjs/liquityV2/index.js +19 -37
  12. package/cjs/markets/morphoBlue/index.d.ts +2 -0
  13. package/cjs/markets/morphoBlue/index.js +18 -1
  14. package/cjs/portfolio/index.d.ts +8 -16
  15. package/cjs/portfolio/index.js +520 -458
  16. package/cjs/savings/index.d.ts +2 -8
  17. package/cjs/savings/index.js +4 -33
  18. package/cjs/types/aave.d.ts +2 -98
  19. package/cjs/types/aaveV4.d.ts +0 -44
  20. package/cjs/types/compound.d.ts +2 -26
  21. package/cjs/types/curveUsd.d.ts +1 -9
  22. package/cjs/types/fluid.d.ts +0 -13
  23. package/cjs/types/index.d.ts +0 -1
  24. package/cjs/types/index.js +0 -1
  25. package/cjs/types/liquity.d.ts +0 -12
  26. package/cjs/types/liquityV2.d.ts +0 -24
  27. package/cjs/types/llamaLend.d.ts +1 -12
  28. package/cjs/types/morphoBlue.d.ts +1 -2
  29. package/cjs/types/morphoBlue.js +1 -0
  30. package/cjs/types/portfolio.d.ts +5 -125
  31. package/cjs/types/savings/index.d.ts +1 -9
  32. package/cjs/types/spark.d.ts +1 -21
  33. package/cjs/umbrella/index.d.ts +3 -2
  34. package/esm/aaveV3/index.d.ts +12 -2
  35. package/esm/aaveV3/sgho.d.ts +16 -2
  36. package/esm/aaveV4/lend.d.ts +43 -2
  37. package/esm/claiming/aaveV3.d.ts +2 -2
  38. package/esm/claiming/aaveV3.js +1 -1
  39. package/esm/claiming/ethena.d.ts +1 -2
  40. package/esm/claiming/king.d.ts +1 -2
  41. package/esm/claiming/spark.d.ts +2 -2
  42. package/esm/claiming/spark.js +1 -1
  43. package/esm/fluid/index.d.ts +49 -5
  44. package/esm/liquity/index.d.ts +12 -2
  45. package/esm/liquityV2/index.d.ts +23 -8
  46. package/esm/liquityV2/index.js +18 -35
  47. package/esm/markets/morphoBlue/index.d.ts +2 -0
  48. package/esm/markets/morphoBlue/index.js +16 -0
  49. package/esm/portfolio/index.d.ts +8 -16
  50. package/esm/portfolio/index.js +522 -458
  51. package/esm/savings/index.d.ts +2 -8
  52. package/esm/savings/index.js +3 -31
  53. package/esm/types/aave.d.ts +2 -98
  54. package/esm/types/aaveV4.d.ts +0 -44
  55. package/esm/types/compound.d.ts +2 -26
  56. package/esm/types/curveUsd.d.ts +1 -9
  57. package/esm/types/fluid.d.ts +0 -13
  58. package/esm/types/index.d.ts +0 -1
  59. package/esm/types/index.js +0 -1
  60. package/esm/types/liquity.d.ts +0 -12
  61. package/esm/types/liquityV2.d.ts +0 -24
  62. package/esm/types/llamaLend.d.ts +1 -12
  63. package/esm/types/morphoBlue.d.ts +1 -2
  64. package/esm/types/morphoBlue.js +1 -0
  65. package/esm/types/portfolio.d.ts +5 -125
  66. package/esm/types/savings/index.d.ts +1 -9
  67. package/esm/types/spark.d.ts +1 -21
  68. package/esm/umbrella/index.d.ts +3 -2
  69. package/package.json +2 -2
  70. package/src/aaveV3/index.ts +1 -2
  71. package/src/aaveV3/sgho.ts +17 -2
  72. package/src/aaveV4/lend.ts +48 -2
  73. package/src/claiming/aaveV3.ts +2 -4
  74. package/src/claiming/ethena.ts +5 -5
  75. package/src/claiming/king.ts +3 -3
  76. package/src/claiming/spark.ts +4 -6
  77. package/src/fluid/index.ts +3 -4
  78. package/src/liquity/index.ts +2 -2
  79. package/src/liquityV2/index.ts +22 -48
  80. package/src/markets/morphoBlue/index.ts +16 -0
  81. package/src/portfolio/index.ts +331 -306
  82. package/src/savings/index.ts +4 -41
  83. package/src/types/aave.ts +1 -104
  84. package/src/types/aaveV4.ts +0 -49
  85. package/src/types/compound.ts +2 -38
  86. package/src/types/curveUsd.ts +1 -17
  87. package/src/types/fluid.ts +0 -14
  88. package/src/types/index.ts +0 -1
  89. package/src/types/liquity.ts +1 -13
  90. package/src/types/liquityV2.ts +1 -26
  91. package/src/types/llamaLend.ts +1 -19
  92. package/src/types/morphoBlue.ts +1 -3
  93. package/src/types/portfolio.ts +5 -151
  94. package/src/types/savings/index.ts +1 -12
  95. package/src/types/spark.ts +1 -25
  96. package/src/umbrella/index.ts +1 -2
  97. package/cjs/portfolio/lendingProtocols.d.ts +0 -184
  98. package/cjs/portfolio/lendingProtocols.js +0 -196
  99. package/esm/portfolio/lendingProtocols.d.ts +0 -184
  100. package/esm/portfolio/lendingProtocols.js +0 -189
  101. package/src/portfolio/lendingProtocols.ts +0 -281
@@ -1,4 +1,4 @@
1
- import { SavingsData, SavingsDataWithErrors } from '../types';
1
+ import { MakerDsrType, MorphoVaultType, SkySavingsType, SparkSavingsVaultType, SummerVaultType, YearnV3VaultType, YearnVaultType } from '../types';
2
2
  import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
3
3
  import * as morphoVaults from './morphoVaults';
4
4
  import * as yearnVaults from './yearnVaults';
@@ -8,10 +8,4 @@ import * as sparkSavingsVaults from './sparkSavingsVaults';
8
8
  import * as summerVaults from './summerVaults';
9
9
  import * as yearnV3Vaults from './yearnV3Vaults';
10
10
  export { morphoVaults, yearnVaults, makerDsr, skyOptions, sparkSavingsVaults, summerVaults, yearnV3Vaults, };
11
- /**
12
- * Every savings vault of a network for the given accounts, and, for each vault that came back without data, why — so
13
- * a vault that failed is never mistaken for one the accounts have nothing in.
14
- */
15
- export declare const getSavingsDataWithErrors: (provider: EthereumProvider, network: NetworkNumber, accounts: EthAddress[]) => Promise<SavingsDataWithErrors>;
16
- /** Every savings vault of a network for the given accounts. A vault that failed is left out: use getSavingsDataWithErrors to tell why. */
17
- export declare const getSavingsData: (provider: EthereumProvider, network: NetworkNumber, accounts: EthAddress[]) => Promise<SavingsData>;
11
+ export declare const getSavingsData: (provider: EthereumProvider, network: NetworkNumber, accounts: EthAddress[]) => Promise<Partial<Record<MakerDsrType | MorphoVaultType | SkySavingsType | SparkSavingsVaultType | SummerVaultType | YearnV3VaultType | YearnVaultType, import("../types").SavingsVaultData>>>;
@@ -17,12 +17,7 @@ import * as sparkSavingsVaults from './sparkSavingsVaults';
17
17
  import * as summerVaults from './summerVaults';
18
18
  import * as yearnV3Vaults from './yearnV3Vaults';
19
19
  export { morphoVaults, yearnVaults, makerDsr, skyOptions, sparkSavingsVaults, summerVaults, yearnV3Vaults, };
20
- /**
21
- * Every savings vault of a network for the given accounts, and, for each vault that came back without data, why — so
22
- * a vault that failed is never mistaken for one the accounts have nothing in.
23
- */
24
- export const getSavingsDataWithErrors = (provider, network, accounts) => __awaiter(void 0, void 0, void 0, function* () {
25
- const isMainnet = network === NetworkNumber.Eth;
20
+ export const getSavingsData = (provider, network, accounts) => __awaiter(void 0, void 0, void 0, function* () {
26
21
  const morphoVaultsList = Object.keys(morphoVaults.morphoVaultsOptions.MORPHO_VAULTS)
27
22
  .filter((key) => morphoVaults.morphoVaultsOptions.getMorphoVault(key).network === network);
28
23
  const yearnVaultsList = Object.keys(yearnVaults.yearnVaultsOptions.YEARN_VAULTS);
@@ -30,16 +25,7 @@ export const getSavingsDataWithErrors = (provider, network, accounts) => __await
30
25
  const yearnV3VaultsList = Object.keys(yearnV3Vaults.yearnV3VaultsOptions.YEARN_V3_VAULTS);
31
26
  const summerVaultsList = Object.keys(summerVaults.summerVaultsOptions.SUMMER_VAULTS)
32
27
  .filter((key) => summerVaults.summerVaultsOptions.getSummerVault(key).network === network);
33
- // Every vault read on this network, so one left without data or an error can still be reported.
34
- const vaultKeys = [
35
- ...morphoVaultsList,
36
- ...(isMainnet ? [
37
- ...yearnVaultsList, ...sparkSavingsVaultsList, ...yearnV3VaultsList, MakerDsrType.MakerDsrVault, SkySavingsType.SkySavings,
38
- ] : []),
39
- ...summerVaultsList,
40
- ];
41
28
  const savingsData = {};
42
- const errors = {};
43
29
  yield Promise.all([
44
30
  ...(morphoVaultsList.length ? [
45
31
  (() => __awaiter(void 0, void 0, void 0, function* () {
@@ -50,11 +36,10 @@ export const getSavingsDataWithErrors = (provider, network, accounts) => __await
50
36
  }
51
37
  catch (err) {
52
38
  console.error('[getSavingsData] Error fetching morpho vaults:', err);
53
- morphoVaultsList.forEach((vaultKey) => { errors[vaultKey] = `Error fetching morpho vault ${vaultKey}`; });
54
39
  }
55
40
  }))(),
56
41
  ] : []),
57
- ...(isMainnet ? [
42
+ ...(network === NetworkNumber.Eth ? [
58
43
  ...yearnVaultsList.map((vaultKey) => __awaiter(void 0, void 0, void 0, function* () {
59
44
  try {
60
45
  const vault = yearnVaults.yearnVaultsOptions.getYearnVault(vaultKey);
@@ -63,7 +48,6 @@ export const getSavingsDataWithErrors = (provider, network, accounts) => __await
63
48
  }
64
49
  catch (err) {
65
50
  console.error(`[getSavingsData] Error fetching yearn vault ${vaultKey}:`, err);
66
- errors[vaultKey] = `Error fetching yearn vault ${vaultKey}`;
67
51
  }
68
52
  })),
69
53
  ...sparkSavingsVaultsList.map((vaultKey) => __awaiter(void 0, void 0, void 0, function* () {
@@ -74,7 +58,6 @@ export const getSavingsDataWithErrors = (provider, network, accounts) => __await
74
58
  }
75
59
  catch (err) {
76
60
  console.error(`[getSavingsData] Error fetching spark savings vault ${vaultKey}:`, err);
77
- errors[vaultKey] = `Error fetching spark savings vault ${vaultKey}`;
78
61
  }
79
62
  })),
80
63
  ...yearnV3VaultsList.map((vaultKey) => __awaiter(void 0, void 0, void 0, function* () {
@@ -85,7 +68,6 @@ export const getSavingsDataWithErrors = (provider, network, accounts) => __await
85
68
  }
86
69
  catch (err) {
87
70
  console.error(`[getSavingsData] Error fetching yearn v3 vault ${vaultKey}:`, err);
88
- errors[vaultKey] = `Error fetching yearn v3 vault ${vaultKey}`;
89
71
  }
90
72
  })),
91
73
  (() => __awaiter(void 0, void 0, void 0, function* () {
@@ -95,7 +77,6 @@ export const getSavingsDataWithErrors = (provider, network, accounts) => __await
95
77
  }
96
78
  catch (err) {
97
79
  console.error('[getSavingsData] Error fetching maker DSR data:', err);
98
- errors[MakerDsrType.MakerDsrVault] = 'Error fetching maker DSR data';
99
80
  }
100
81
  }))(),
101
82
  (() => __awaiter(void 0, void 0, void 0, function* () {
@@ -105,7 +86,6 @@ export const getSavingsDataWithErrors = (provider, network, accounts) => __await
105
86
  }
106
87
  catch (err) {
107
88
  console.error('[getSavingsData] Error fetching Sky savings data:', err);
108
- errors[SkySavingsType.SkySavings] = 'Error fetching Sky savings data';
109
89
  }
110
90
  }))(),
111
91
  ] : []),
@@ -117,16 +97,8 @@ export const getSavingsDataWithErrors = (provider, network, accounts) => __await
117
97
  }
118
98
  catch (err) {
119
99
  console.error(`[getSavingsData] Error fetching summer vault ${vaultKey}:`, err);
120
- errors[vaultKey] = `Error fetching summer vault ${vaultKey}`;
121
100
  }
122
101
  })),
123
102
  ]);
124
- // getMorphoVaultsData leaves out, without throwing, a vault whose on-chain reads failed or that the Morpho API did not return.
125
- vaultKeys.forEach((vaultKey) => {
126
- if (!savingsData[vaultKey] && !errors[vaultKey])
127
- errors[vaultKey] = `No data returned for savings vault ${vaultKey}`;
128
- });
129
- return { data: savingsData, errors };
103
+ return savingsData;
130
104
  });
131
- /** Every savings vault of a network for the given accounts. A vault that failed is left out: use getSavingsDataWithErrors to tell why. */
132
- export const getSavingsData = (provider, network, accounts) => __awaiter(void 0, void 0, void 0, function* () { return (yield getSavingsDataWithErrors(provider, network, accounts)).data; });
@@ -1,4 +1,4 @@
1
- import { EthAddress, IncentiveData, LeverageType, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
1
+ import { IncentiveData, LeverageType, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
2
2
  export declare enum AaveVersions {
3
3
  AaveV1 = "v1",
4
4
  AaveV2 = "v2default",
@@ -85,8 +85,6 @@ export interface AaveV3AssetData extends AaveAssetData {
85
85
  liquidationBonus: string;
86
86
  supplyIncentives: IncentiveData[];
87
87
  borrowIncentives: IncentiveData[];
88
- aTokenAddress?: EthAddress;
89
- vTokenAddress?: EthAddress;
90
88
  }
91
89
  export type EModeCategoriesData = Record<number, EModeCategoryData>;
92
90
  export type AaveAssetsData<T> = {
@@ -124,12 +122,7 @@ export type AaveUsedAssets<T> = {
124
122
  };
125
123
  export type AaveV2UsedAssets = AaveUsedAssets<AaveV2UsedAsset>;
126
124
  export type AaveV3UsedAssets = AaveUsedAssets<AaveV3UsedAsset>;
127
- /**
128
- * Fields aaveAnyGetAggregatedPositionData adds to every Aave V2/V3 position at runtime, on top of those declared
129
- * below. Optional, so code that builds a position by hand keeps compiling.
130
- */
131
- export type AavePositionAggregatedFields = Partial<Omit<AaveV3AggregatedPositionData, keyof MMPositionData | 'ratio' | 'collRatio' | 'safetyRatioWithLtvZeroFallback' | 'suppliedUsd' | 'borrowedUsd' | 'borrowLimitUsd' | 'suppliedCollateralUsd' | 'incentiveUsd' | 'totalInterestUsd'>>;
132
- export interface AavePositionData extends MMPositionData, AavePositionAggregatedFields {
125
+ export interface AavePositionData extends MMPositionData {
133
126
  ratio: string;
134
127
  minRatio: string;
135
128
  collRatio: string;
@@ -147,12 +140,6 @@ export interface AavePositionData extends MMPositionData, AavePositionAggregated
147
140
  }
148
141
  export interface AaveV2PositionData extends AavePositionData {
149
142
  usedAssets: AaveV2UsedAssets;
150
- eModeCategory?: number;
151
- isInIsolationMode?: boolean;
152
- isInSiloedMode?: boolean;
153
- eModeCategories?: {
154
- [key: number]: EModeCategoryDataMapping;
155
- };
156
143
  }
157
144
  export interface AaveV3PositionData extends AavePositionData {
158
145
  usedAssets: AaveV3UsedAssets;
@@ -201,86 +188,3 @@ export interface AaveHelperCommon {
201
188
  selectedMarket: Partial<AaveMarketInfo>;
202
189
  network?: NetworkNumber;
203
190
  }
204
- export interface SghoUserData {
205
- shares: string;
206
- balance: string;
207
- maxDeposit: string;
208
- maxWithdraw: string;
209
- underlyingBalance: string;
210
- }
211
- export interface SghoData {
212
- totalAssets: string;
213
- totalSupply: string;
214
- supplyCap: string;
215
- /** Target savings rate as an APY percent (e.g. "4.25" for 4.25%). */
216
- targetRate: string;
217
- paused: boolean;
218
- user: SghoUserData;
219
- }
220
- /** stkAAVE, stkGHO and sGHO of an address, from getStakeAaveData. */
221
- export interface StakeAaveData {
222
- activatedCooldown: string;
223
- activatedCooldownAmount: string;
224
- stkAaveRewardsBalance: string;
225
- aaveRewardsBalance: string;
226
- stkAaveBalance: string;
227
- stkGhoBalance: string;
228
- ghoMeritApy: string;
229
- stkAaveApy: string;
230
- sgho: SghoData;
231
- }
232
- export interface UmbrellaTokenInfo {
233
- token: EthAddress;
234
- /** USD, converted from the oracle's 8 decimals. */
235
- price: string;
236
- name: string;
237
- symbol: string;
238
- decimals: number;
239
- }
240
- export interface UmbrellaRewardTokenData {
241
- rewardTokenData: UmbrellaTokenInfo;
242
- maxEmissionPerSecond: bigint;
243
- distributionEnd: bigint;
244
- }
245
- export interface UmbrellaStakingAccountData {
246
- stakeUserBalance: string;
247
- rewardsTokenUserData: {
248
- reward: EthAddress;
249
- currentReward: string;
250
- }[];
251
- userCooldownAmount: string;
252
- userEndOfCooldown: bigint | string;
253
- userWithdrawalWindow: bigint | string;
254
- }
255
- /**
256
- * One Umbrella stake token of an address, from getUmbrellaData: the view contracts' structs merged, with the amounts
257
- * the app reads converted to decimal strings. The bigint fields are the views' raw values, as the SDK passes them.
258
- */
259
- export interface UmbrellaStakingTokenData {
260
- stakeTokenData: UmbrellaTokenInfo;
261
- totalAssets: string;
262
- targetLiquidity: string;
263
- isStakeConfigured: boolean;
264
- rewardsTokenData: UmbrellaRewardTokenData[];
265
- stakeToken: EthAddress;
266
- stakeUserBalance: bigint;
267
- rewardsTokenUserData: {
268
- reward: EthAddress;
269
- currentReward: bigint;
270
- }[];
271
- stkToken: EthAddress;
272
- totalShares: string;
273
- stkUnderlyingToken: EthAddress;
274
- aToken: EthAddress;
275
- cooldownPeriod: bigint;
276
- unstakeWindow: bigint;
277
- stkTokenToWaTokenRate: string;
278
- waTokenToATokenRate: string;
279
- rewardsEmissionRates: string[];
280
- userCooldownAmount: bigint;
281
- userEndOfCooldown: bigint;
282
- userWithdrawalWindow: bigint;
283
- account: UmbrellaStakingAccountData;
284
- }
285
- /** Keyed by Umbrella stake (UmbrellaGHO, UmbrellaUSDC, UmbrellaUSDT, UmbrellaETH). */
286
- export type UmbrellaStakingData = Record<string, UmbrellaStakingTokenData>;
@@ -191,47 +191,3 @@ 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
- }
@@ -52,7 +52,6 @@ export interface CompoundAssetData extends MMAssetData {
52
52
  sortIndex?: number;
53
53
  }
54
54
  export interface CompoundV2AssetData extends CompoundAssetData {
55
- exchangeRate?: string;
56
55
  }
57
56
  export interface CompoundV3AssetData extends CompoundAssetData {
58
57
  borrowCollateralFactor: string;
@@ -64,17 +63,6 @@ export interface CompoundV3AssetData extends CompoundAssetData {
64
63
  supplyCap: string;
65
64
  priceInBaseAsset: string;
66
65
  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;
78
66
  }
79
67
  export interface CompoundAssetsData<T> {
80
68
  [token: string]: T;
@@ -137,21 +125,9 @@ export interface CompoundPositionData extends MMPositionData {
137
125
  isSubscribedToAutomation?: boolean;
138
126
  automationResubscribeRequired?: boolean;
139
127
  }
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 {
128
+ export interface CompoundV2PositionData extends CompoundPositionData {
151
129
  usedAssets: CompoundV2UsedAssets;
152
- borrowStableSupplyUnstable?: boolean;
153
130
  }
154
- export interface CompoundV3PositionData extends CompoundPositionData, CompoundV3PositionAggregatedFields {
131
+ export interface CompoundV3PositionData extends CompoundPositionData {
155
132
  usedAssets: CompoundV3UsedAssets;
156
- isAllowed?: boolean;
157
133
  }
@@ -60,7 +60,6 @@ export interface CrvUSDGlobalMarketData {
60
60
  leftToBorrow: string;
61
61
  bands: BandData[];
62
62
  loanDiscount: string;
63
- A?: bigint;
64
63
  }
65
64
  export interface CrvUSDAggregatedPositionData {
66
65
  ratio: string;
@@ -95,8 +94,7 @@ export interface CrvUSDUsedAsset {
95
94
  export interface CrvUSDUsedAssets {
96
95
  [key: string]: CrvUSDUsedAsset;
97
96
  }
98
- export type CrvUSDPositionAggregatedFields = Partial<Pick<CrvUSDAggregatedPositionData, 'borrowLimitUsd' | 'minAllowedRatio' | 'collFactor' | 'leveragedType' | 'leveragedAsset' | 'liquidationPrice'>>;
99
- export interface CrvUSDUserData extends CrvUSDPositionAggregatedFields {
97
+ export interface CrvUSDUserData {
100
98
  debtAmount: string;
101
99
  health: string;
102
100
  healthPercent: string;
@@ -121,10 +119,4 @@ export interface CrvUSDUserData extends CrvUSDPositionAggregatedFields {
121
119
  netApy: string;
122
120
  totalInterestUsd: string;
123
121
  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;
130
122
  }
@@ -459,16 +459,3 @@ 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
- }
@@ -15,5 +15,4 @@ export * from './merkl';
15
15
  export * from './savings';
16
16
  export * from './common';
17
17
  export * from './aaveV4';
18
- export * from './claiming';
19
18
  export * from './lendingSummary';
@@ -15,5 +15,4 @@ export * from './merkl';
15
15
  export * from './savings';
16
16
  export * from './common';
17
17
  export * from './aaveV4';
18
- export * from './claiming';
19
18
  export * from './lendingSummary';
@@ -32,15 +32,3 @@ 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
- }
@@ -123,27 +123,3 @@ 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
- }
@@ -138,8 +138,7 @@ export interface LlamaLendUsedAsset {
138
138
  export interface LlamaLendUsedAssets {
139
139
  [key: string]: LlamaLendUsedAsset;
140
140
  }
141
- export type LlamaLendPositionAggregatedFields = Partial<Pick<LlamaLendAggregatedPositionData, 'borrowLimitUsd' | 'minAllowedRatio' | 'collFactor' | 'leveragedType' | 'leveragedAsset' | 'liquidationPrice' | 'netApy' | 'incentiveUsd' | 'totalInterestUsd'>>;
142
- export interface LlamaLendUserData extends LlamaLendPositionAggregatedFields {
141
+ export interface LlamaLendUserData {
143
142
  debtAmount: string;
144
143
  health: string;
145
144
  healthPercent: string;
@@ -158,14 +157,4 @@ export interface LlamaLendUserData extends LlamaLendPositionAggregatedFields {
158
157
  loanExists: boolean;
159
158
  borrowRate?: string;
160
159
  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;
171
160
  }
@@ -110,6 +110,7 @@ export declare enum MorphoBlueVersions {
110
110
  MorphoBlueUSDeUSDC_915_Base = "morphoblueusdeusdc_915_base",// USDe/USDC 0.915
111
111
  MorphoBlueCbEthUSDC_770_Base = "morphobluecbethusdc_770_base",// cbETH/USDC 0.77
112
112
  MorphoBlueCbXRPUSDC_625_Base = "morphobluecbxrpusdc_625_base",// cbXRP/USDC 0.625
113
+ MorphoBlueCbHYPEUSDC_625_Base = "morphobluecbhypeusdc_625_base",// cbHYPE/USDC 0.625
113
114
  MorphoBlueSyrupUSDCUSDC_915_Arb = "morphobluesyrupusdcusdc_915_arb",// syrupUSDC/USDC
114
115
  MorphoBlueWBTCUSDC_860_Arb = "morphobluewbtcusdc_860_arb",// WBTC/USDC
115
116
  MorphoBlueWstEthUSDC_860_Arb = "morphobluewstethusdc_860_arb",// wstETH/USDC
@@ -215,8 +216,6 @@ export interface MorphoBluePositionData {
215
216
  supplyShares: string;
216
217
  borrowShares: string;
217
218
  exposure: string;
218
- minCollRatio?: string;
219
- collLiquidationRatio?: string;
220
219
  }
221
220
  export interface MorphoBlueEarnData {
222
221
  apy: string;
@@ -117,6 +117,7 @@ export var MorphoBlueVersions;
117
117
  MorphoBlueVersions["MorphoBlueUSDeUSDC_915_Base"] = "morphoblueusdeusdc_915_base";
118
118
  MorphoBlueVersions["MorphoBlueCbEthUSDC_770_Base"] = "morphobluecbethusdc_770_base";
119
119
  MorphoBlueVersions["MorphoBlueCbXRPUSDC_625_Base"] = "morphobluecbxrpusdc_625_base";
120
+ MorphoBlueVersions["MorphoBlueCbHYPEUSDC_625_Base"] = "morphobluecbhypeusdc_625_base";
120
121
  // ARBITRUM
121
122
  MorphoBlueVersions["MorphoBlueSyrupUSDCUSDC_915_Arb"] = "morphobluesyrupusdcusdc_915_arb";
122
123
  MorphoBlueVersions["MorphoBlueWBTCUSDC_860_Arb"] = "morphobluewbtcusdc_860_arb";
@@ -1,47 +1,20 @@
1
- import { AaveV2MarketData, AaveV2PositionData, AaveV3MarketData, AaveV3PositionData, AaveVersions, StakeAaveData, UmbrellaStakingData } from './aave';
1
+ import { AaveV2MarketData, AaveV2PositionData, AaveV3MarketData, AaveV3PositionData, AaveVersions } from './aave';
2
2
  import { AaveV4AccountData, AaveV4SpokeData, AaveV4SpokesType } from './aaveV4';
3
- import { AaveRewardsClaimableToken, EthenaAirdropClaimableToken, KingRewardsClaimableToken, MerklRewardsClaimableToken, SparkAirdropClaimableToken, SparkRewardsClaimableToken, UniswapAirdropClaimableToken } from './claiming';
4
3
  import { EthAddress } from './common';
5
4
  import { CompoundV2MarketsData, CompoundV2PositionData, CompoundV3MarketsData, CompoundV3PositionData, CompoundVersions } from './compound';
6
5
  import { CrvUSDGlobalMarketData, CrvUSDUserData, CrvUSDVersions } from './curveUsd';
7
- import { FluidEarnPositionData, FluidMarketData, FluidVaultData } from './fluid';
8
- import { LiquityStakingData, LiquityTroveInfo } from './liquity';
9
- import { LiquityV2MarketData, LiquityV2SBoldYBoldData, LiquityV2StakingData, LiquityV2TroveData, LiquityV2Versions } from './liquityV2';
6
+ import { FluidMarketData, FluidVaultData } from './fluid';
7
+ import { LiquityTroveInfo } from './liquity';
8
+ import { LiquityV2MarketData } from './liquityV2';
10
9
  import { LlamaLendGlobalMarketData, LlamaLendUserData, LlamaLendVersionsType } from './llamaLend';
11
10
  import { CdpData, IlkInfo } from './maker';
12
- import { MorphoBlueEarnData, MorphoBlueMarketInfo, MorphoBluePositionData, MorphoBlueVersions } from './morphoBlue';
11
+ import { MorphoBlueMarketInfo, MorphoBluePositionData, MorphoBlueVersions } from './morphoBlue';
13
12
  import { MorphoMidnightMarketInfo, MorphoMidnightPositionData, MorphoMidnightVersions } from './morphoMidnight';
14
13
  import { SparkMarketsData, SparkPositionData, SparkVersions } from './spark';
15
14
  export interface PortfolioProtocolData<T> {
16
15
  error: string;
17
16
  data: T | null;
18
17
  }
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
- }
45
18
  export interface PortfolioPositionsDataForAddress {
46
19
  aaveV3: {
47
20
  [key in AaveVersions]?: PortfolioProtocolData<AaveV3PositionData>;
@@ -83,65 +56,10 @@ export interface PortfolioPositionsDataForAddress {
83
56
  aaveV4: {
84
57
  [key in AaveV4SpokesType]?: PortfolioProtocolData<AaveV4AccountData>;
85
58
  };
86
- /** Only with the liquityV2 option. Every trove the address holds, by market. */
87
- liquityV2?: {
88
- [key in LiquityV2Versions]?: PortfolioLiquityV2Troves;
89
- };
90
59
  }
91
60
  export interface PortfolioPositionsData {
92
61
  [key: EthAddress]: PortfolioPositionsDataForAddress;
93
62
  }
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. */
145
63
  export interface PortfolioMarketsData {
146
64
  morphoMarketsData: Record<string, MorphoBlueMarketInfo>;
147
65
  morphoMidnightMarketsData: Record<string, MorphoMidnightMarketInfo>;
@@ -154,44 +72,6 @@ export interface PortfolioMarketsData {
154
72
  llamaLendMarketsData: Record<string, LlamaLendGlobalMarketData>;
155
73
  liquityV2MarketsData: Record<string, LiquityV2MarketData>;
156
74
  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 {
163
75
  fluidMarketsData: Record<string, FluidMarketData>;
164
76
  makerMarketsData: Record<string, IlkInfo>;
165
77
  }
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
- }