@defisaver/positions-sdk 2.1.169-portfolio-api-dev → 2.1.169
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/aaveV3/index.d.ts +12 -2
- package/cjs/aaveV3/sgho.d.ts +16 -2
- package/cjs/aaveV4/lend.d.ts +43 -2
- package/cjs/claiming/aaveV3.d.ts +2 -2
- package/cjs/claiming/ethena.d.ts +1 -2
- package/cjs/claiming/king.d.ts +1 -2
- package/cjs/claiming/spark.d.ts +2 -2
- package/cjs/fluid/index.d.ts +49 -5
- package/cjs/liquity/index.d.ts +12 -2
- package/cjs/liquityV2/index.d.ts +23 -8
- package/cjs/liquityV2/index.js +19 -37
- package/cjs/markets/morphoBlue/index.d.ts +2 -0
- package/cjs/markets/morphoBlue/index.js +18 -1
- package/cjs/portfolio/index.d.ts +8 -16
- package/cjs/portfolio/index.js +520 -458
- package/cjs/savings/index.d.ts +2 -8
- package/cjs/savings/index.js +4 -33
- package/cjs/types/aave.d.ts +2 -98
- package/cjs/types/aaveV4.d.ts +0 -44
- package/cjs/types/compound.d.ts +2 -26
- package/cjs/types/curveUsd.d.ts +1 -9
- package/cjs/types/fluid.d.ts +0 -13
- package/cjs/types/index.d.ts +0 -1
- package/cjs/types/index.js +0 -1
- package/cjs/types/liquity.d.ts +0 -12
- package/cjs/types/liquityV2.d.ts +0 -24
- package/cjs/types/llamaLend.d.ts +1 -12
- package/cjs/types/morphoBlue.d.ts +1 -2
- package/cjs/types/morphoBlue.js +1 -0
- package/cjs/types/portfolio.d.ts +5 -125
- package/cjs/types/savings/index.d.ts +1 -9
- package/cjs/types/spark.d.ts +1 -21
- package/cjs/umbrella/index.d.ts +3 -2
- package/esm/aaveV3/index.d.ts +12 -2
- package/esm/aaveV3/sgho.d.ts +16 -2
- package/esm/aaveV4/lend.d.ts +43 -2
- package/esm/claiming/aaveV3.d.ts +2 -2
- package/esm/claiming/aaveV3.js +1 -1
- package/esm/claiming/ethena.d.ts +1 -2
- package/esm/claiming/king.d.ts +1 -2
- package/esm/claiming/spark.d.ts +2 -2
- package/esm/claiming/spark.js +1 -1
- package/esm/fluid/index.d.ts +49 -5
- package/esm/liquity/index.d.ts +12 -2
- package/esm/liquityV2/index.d.ts +23 -8
- package/esm/liquityV2/index.js +18 -35
- package/esm/markets/morphoBlue/index.d.ts +2 -0
- package/esm/markets/morphoBlue/index.js +16 -0
- package/esm/portfolio/index.d.ts +8 -16
- package/esm/portfolio/index.js +522 -458
- package/esm/savings/index.d.ts +2 -8
- package/esm/savings/index.js +3 -31
- package/esm/types/aave.d.ts +2 -98
- package/esm/types/aaveV4.d.ts +0 -44
- package/esm/types/compound.d.ts +2 -26
- package/esm/types/curveUsd.d.ts +1 -9
- package/esm/types/fluid.d.ts +0 -13
- package/esm/types/index.d.ts +0 -1
- package/esm/types/index.js +0 -1
- package/esm/types/liquity.d.ts +0 -12
- package/esm/types/liquityV2.d.ts +0 -24
- package/esm/types/llamaLend.d.ts +1 -12
- package/esm/types/morphoBlue.d.ts +1 -2
- package/esm/types/morphoBlue.js +1 -0
- package/esm/types/portfolio.d.ts +5 -125
- package/esm/types/savings/index.d.ts +1 -9
- package/esm/types/spark.d.ts +1 -21
- package/esm/umbrella/index.d.ts +3 -2
- package/package.json +2 -2
- package/src/aaveV3/index.ts +1 -2
- package/src/aaveV3/sgho.ts +17 -2
- package/src/aaveV4/lend.ts +48 -2
- package/src/claiming/aaveV3.ts +2 -4
- package/src/claiming/ethena.ts +5 -5
- package/src/claiming/king.ts +3 -3
- package/src/claiming/spark.ts +4 -6
- package/src/fluid/index.ts +3 -4
- package/src/liquity/index.ts +2 -2
- package/src/liquityV2/index.ts +22 -48
- package/src/markets/morphoBlue/index.ts +16 -0
- package/src/portfolio/index.ts +331 -306
- package/src/savings/index.ts +4 -41
- package/src/types/aave.ts +1 -104
- package/src/types/aaveV4.ts +0 -49
- package/src/types/compound.ts +2 -38
- package/src/types/curveUsd.ts +1 -17
- package/src/types/fluid.ts +0 -14
- package/src/types/index.ts +0 -1
- package/src/types/liquity.ts +1 -13
- package/src/types/liquityV2.ts +1 -26
- package/src/types/llamaLend.ts +1 -19
- package/src/types/morphoBlue.ts +1 -3
- package/src/types/portfolio.ts +5 -151
- package/src/types/savings/index.ts +1 -12
- package/src/types/spark.ts +1 -25
- package/src/umbrella/index.ts +1 -2
- package/cjs/portfolio/lendingProtocols.d.ts +0 -184
- package/cjs/portfolio/lendingProtocols.js +0 -196
- package/esm/portfolio/lendingProtocols.d.ts +0 -184
- package/esm/portfolio/lendingProtocols.js +0 -189
- package/src/portfolio/lendingProtocols.ts +0 -281
package/cjs/types/portfolio.d.ts
CHANGED
|
@@ -1,47 +1,20 @@
|
|
|
1
|
-
import { AaveV2MarketData, AaveV2PositionData, AaveV3MarketData, AaveV3PositionData, AaveVersions
|
|
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 {
|
|
8
|
-
import {
|
|
9
|
-
import { LiquityV2MarketData
|
|
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 {
|
|
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
|
-
}
|
|
@@ -20,12 +20,4 @@ export interface SavingsVaultData {
|
|
|
20
20
|
asset: string;
|
|
21
21
|
optionType: string;
|
|
22
22
|
}
|
|
23
|
-
|
|
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
|
-
}
|
|
23
|
+
export type SavingsData = Partial<Record<MorphoVaultType | YearnVaultType | MakerDsrType | SkySavingsType | SparkSavingsVaultType | SummerVaultType | YearnV3VaultType, SavingsVaultData>>;
|
package/cjs/types/spark.d.ts
CHANGED
|
@@ -46,21 +46,6 @@ 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;
|
|
64
49
|
}
|
|
65
50
|
export interface SparkAssetsData {
|
|
66
51
|
[token: string]: SparkAssetData;
|
|
@@ -116,12 +101,7 @@ export interface SparkAggregatedPositionData {
|
|
|
116
101
|
minHealthRatio: string;
|
|
117
102
|
exposure: string;
|
|
118
103
|
}
|
|
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 {
|
|
104
|
+
export interface SparkPositionData extends MMPositionData {
|
|
125
105
|
ratio: string;
|
|
126
106
|
minRatio: string;
|
|
127
107
|
collRatio: string;
|
package/cjs/umbrella/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { EthAddress, NetworkNumber } from '../types/common';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export declare const getUmbrellaData: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<{
|
|
4
|
+
[k: string]: any;
|
|
5
|
+
}>;
|
package/esm/aaveV3/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
|
-
import { AaveMarketInfo, AaveV3MarketData, AaveV3PositionData, AaveV3UsedAssets, EModeCategoryDataMapping
|
|
2
|
+
import { AaveMarketInfo, AaveV3MarketData, AaveV3PositionData, AaveV3UsedAssets, EModeCategoryDataMapping } from '../types';
|
|
3
3
|
import { Blockish, EthAddress, EthereumProvider, NetworkNumber, PositionBalances } from '../types/common';
|
|
4
4
|
import { getMeritCampaigns } from './merit';
|
|
5
5
|
import { getMerkleCampaigns } from './merkl';
|
|
@@ -76,7 +76,17 @@ export declare const getAaveV3AccountData: (provider: EthereumProvider, network:
|
|
|
76
76
|
export declare const getAaveV3FullPositionData: (provider: EthereumProvider, network: NetworkNumber, address: EthAddress, market: AaveMarketInfo) => Promise<AaveV3PositionData>;
|
|
77
77
|
export declare const REWARDABLE_ASSETS: readonly ["0x028171bCA77440897B824Ca71D1c56caC55b68A3", "0x6C3c78838c761c6Ac7bE9F59fe808ea2A6E4379d", "0xD37EE7e4f452C6638c96536e68090De8cBcdb583", "0x279AF5b99540c1A3A7E3CDd326e19659401eF99e", "0xBcca60bB61934080951369a648Fb03DF4F96263C", "0x619beb58998eD2278e08620f97007e1116D5D25b", "0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811", "0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec", "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656", "0x9c39809Dec7F95F5e0713634a4D0701329B3b4d2", "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e", "0xF63B34710400CAd3e044cFfDcAb00a0f32E33eCf", "0xa06bC25B5805d5F8d82847D191Cb4Af5A3e873E0", "0x0b8f12b1788BFdE65Aa1ca52E3e9F3Ba401be16D", "0x6C5024Cd4F8A59110119C56f8933403A539555EB", "0xdC6a3Ab17299D9C2A412B0e0a4C1f55446AE0817", "0x5165d24277cD063F5ac44Efd447B27025e888f37", "0x7EbD09022Be45AD993BAA1CEc61166Fcc8644d97", "0xF256CC7847E919FAc9B808cC216cAc87CCF2f47a", "0xfAFEDF95E21184E3d880bd56D4806c4b8d31c69A", "0xB9D7CB55f463405CDfBe4E90a6D2Df01C2B92BF1", "0x5BdB050A92CADcCfCDcCCBFC17204a1C9cC0Ab73", "0xc713e5E149D5D0715DcD1c156a020976e7E56B88", "0xba728eAd5e496BE00DCF66F650b6d7758eCB50f8", "0x101cc05f4A51C0319f570d5E146a8C625198e636", "0x01C0eb1f8c6F1C1bF74ae028697ce7AA2a8b0E92", "0xc9BC48c72154ef3e5425641a3c747242112a46AF", "0xB5385132EE8321977FfF44b60cDE9fE9AB0B4e6b", "0x272F97b7a56a387aE942350bBC7Df5700f8a4576", "0x13210D4Fe0d5402bd7Ecbc4B5bC5cFcA3b71adB0", "0x2e8f4bdbe3d47d7d7de490437aea9915d930f1a3", "0xfdb93b3b10936cf81fa59a02a7523b6e2149b2b7", "0xA361718326c15715591c299427c62086F69923D9", "0xbA429f7011c9fa04cDd46a2Da24dc0FF0aC6099c", "0xd4937682df3C8aEF4FE912A96A74121C0829E664", "0xfE8F19B17fFeF0fDbfe2671F248903055AFAA8Ca", "0x683923dB55Fead99A79Fa01A27EeC3cB19679cC3", "0xC2e10006AccAb7B45D9184FcF5b7EC7763f5BaAe", "0x8dAE6Cb04688C62d939ed9B68d32Bc62e49970b1", "0x00ad8eBF64F141f1C81e9f8f792d3d1631c6c684", "0x6F634c6135D2EBD550000ac92F494F9CB8183dAe", "0x4dDff5885a67E4EffeC55875a3977D7E60F82ae0"];
|
|
78
78
|
export declare const fetchYearlyMeritApyForStakingGho: () => Promise<string>;
|
|
79
|
-
export declare const getStakeAaveData: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<
|
|
79
|
+
export declare const getStakeAaveData: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<{
|
|
80
|
+
activatedCooldown: string;
|
|
81
|
+
activatedCooldownAmount: string;
|
|
82
|
+
stkAaveRewardsBalance: string;
|
|
83
|
+
aaveRewardsBalance: string;
|
|
84
|
+
stkAaveBalance: string;
|
|
85
|
+
stkGhoBalance: string;
|
|
86
|
+
ghoMeritApy: string;
|
|
87
|
+
stkAaveApy: string;
|
|
88
|
+
sgho: import("./sgho").SghoData;
|
|
89
|
+
}>;
|
|
80
90
|
export { getMeritCampaigns, getMerkleCampaigns, };
|
|
81
91
|
export { getSghoData } from './sgho';
|
|
82
92
|
export type { SghoData, SghoUserData } from './sgho';
|
package/esm/aaveV3/sgho.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { EthAddress, NetworkNumber } from '../types/common';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export interface SghoUserData {
|
|
3
|
+
shares: string;
|
|
4
|
+
balance: string;
|
|
5
|
+
maxDeposit: string;
|
|
6
|
+
maxWithdraw: string;
|
|
7
|
+
underlyingBalance: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SghoData {
|
|
10
|
+
totalAssets: string;
|
|
11
|
+
totalSupply: string;
|
|
12
|
+
supplyCap: string;
|
|
13
|
+
/** Target savings rate as an APY percent (e.g. "4.25" for 4.25%). */
|
|
14
|
+
targetRate: string;
|
|
15
|
+
paused: boolean;
|
|
16
|
+
user: SghoUserData;
|
|
17
|
+
}
|
|
4
18
|
export declare const getSghoData: (network: NetworkNumber, address?: EthAddress) => Promise<SghoData>;
|
package/esm/aaveV4/lend.d.ts
CHANGED
|
@@ -1,12 +1,53 @@
|
|
|
1
1
|
import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export interface AaveV4TokenizationSpokeData {
|
|
3
|
+
underlyingAsset: EthAddress;
|
|
4
|
+
assetId: string;
|
|
5
|
+
decimals: number;
|
|
6
|
+
spoke: EthAddress;
|
|
7
|
+
spokeActive: boolean;
|
|
8
|
+
spokeHalted: boolean;
|
|
9
|
+
spokeDepositCap: string;
|
|
10
|
+
spokeTotalAssets: string;
|
|
11
|
+
spokeTotalShares: string;
|
|
12
|
+
hub: EthAddress;
|
|
13
|
+
hubLiquidity: string;
|
|
14
|
+
hubDrawnRate: string;
|
|
15
|
+
convertToShares: string;
|
|
16
|
+
convertToAssets: string;
|
|
17
|
+
user: EthAddress;
|
|
18
|
+
userSuppliedAssets: string;
|
|
19
|
+
userSuppliedShares: string;
|
|
20
|
+
}
|
|
4
21
|
export declare const AAVE_V4_TOKENIZED_SPOKES: Record<string, EthAddress>;
|
|
5
22
|
export declare const AAVE_V4_TOKENIZED_SPOKE_ADDRESSES: Partial<Record<NetworkNumber, EthAddress[]>>;
|
|
6
23
|
export type AaveV4TokenizedHubKey = 'CORE' | 'PLUS' | 'PRIME' | 'PAXOS';
|
|
7
24
|
export declare const aaveV4GetTokenizedHubKey: (hubNameOrKey?: string | null) => AaveV4TokenizedHubKey | null;
|
|
8
25
|
export declare const aaveV4GetTokenizedVaultKey: (symbol: string, hubNameOrKey?: string | null) => string | null;
|
|
9
26
|
export declare const aaveV4GetTokenizedVaultAddress: (network: NetworkNumber, symbol: string, hubNameOrKey?: string | null) => EthAddress | undefined;
|
|
27
|
+
/** Parsed tokenization spoke data with human-readable supplied amounts for display */
|
|
28
|
+
export interface AaveV4TokenizationSpokeDataParsed {
|
|
29
|
+
vaultAddress: EthAddress;
|
|
30
|
+
key: string | null;
|
|
31
|
+
symbol: string;
|
|
32
|
+
hubKey: string;
|
|
33
|
+
spokeActive: boolean;
|
|
34
|
+
spokeHalted: boolean;
|
|
35
|
+
/** Deposit cap in asset units (wei string) */
|
|
36
|
+
spokeDepositCap: string;
|
|
37
|
+
/** Total assets currently in spoke in asset units (wei string) */
|
|
38
|
+
spokeTotalAssets: string;
|
|
39
|
+
/** Available hub liquidity in asset units (wei string) */
|
|
40
|
+
hubLiquidity: string;
|
|
41
|
+
/** The conversion rate from assets to shares expressed in asset units. */
|
|
42
|
+
convertToShares: string;
|
|
43
|
+
userSuppliedAssetsEth: string;
|
|
44
|
+
userSuppliedSharesEth: string;
|
|
45
|
+
userSuppliedAssets: string;
|
|
46
|
+
userSuppliedShares: string;
|
|
47
|
+
underlyingAsset: EthAddress;
|
|
48
|
+
spoke: EthAddress;
|
|
49
|
+
decimals: number;
|
|
50
|
+
}
|
|
10
51
|
/**
|
|
11
52
|
* Fetches tokenization vault data for the given user via getTokenizationSpokesData.
|
|
12
53
|
* Returns parsed data including userSuppliedAssets in human-readable form for each vault.
|
package/esm/claiming/aaveV3.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { EthAddress, NetworkNumber } from '../types';
|
|
3
|
-
import {
|
|
4
|
-
export declare function getUnclaimedRewardsForAllMarkets(provider: Client, network: NetworkNumber, walletAddress: EthAddress, marketAddress: EthAddress): Promise<
|
|
3
|
+
import { ClaimableToken, MerklRewardsClaimableToken } from '../types/claiming';
|
|
4
|
+
export declare function getUnclaimedRewardsForAllMarkets(provider: Client, network: NetworkNumber, walletAddress: EthAddress, marketAddress: EthAddress): Promise<ClaimableToken[]>;
|
|
5
5
|
export declare function getMerklUnclaimedRewards(account: EthAddress, network: NetworkNumber): Promise<MerklRewardsClaimableToken[]>;
|
|
6
6
|
export declare function getMeritUnclaimedRewards(account: EthAddress, network: NetworkNumber): Promise<ClaimableToken[]>;
|
package/esm/claiming/aaveV3.js
CHANGED
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import Dec from 'decimal.js';
|
|
11
|
-
import { ClaimType
|
|
11
|
+
import { ClaimType } from '../types/claiming';
|
|
12
12
|
import { AaveIncentiveDataProviderV3ContractViem, AaveRewardsControllerViem, } from '../contracts';
|
|
13
13
|
import { compareAddresses, getEthAmountForDecimals, LONGER_TIMEOUT } from '../services/utils';
|
|
14
14
|
import { getAaveUnderlyingSymbol } from '../helpers/aaveHelpers';
|
package/esm/claiming/ethena.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { EthAddress } from '../types/common';
|
|
2
|
-
import { EthenaAirdropClaimableToken } from '../types/claiming';
|
|
3
2
|
export declare const fetchEthenaAirdropReward: (address: EthAddress) => Promise<any>;
|
|
4
|
-
export declare const fetchEthenaAirdropRewards: (walletAddresses: EthAddress[]) => Promise<Record<string,
|
|
3
|
+
export declare const fetchEthenaAirdropRewards: (walletAddresses: EthAddress[]) => Promise<Record<string, any[]>>;
|
package/esm/claiming/king.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { EthAddress, NetworkNumber } from '../types/common';
|
|
3
|
-
import { KingRewardsClaimableToken } from '../types/claiming';
|
|
4
3
|
export declare const fetchKingRewards: (walletAddress: EthAddress) => Promise<any>;
|
|
5
|
-
export declare const getKingRewards: (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => Promise<Record<string,
|
|
4
|
+
export declare const getKingRewards: (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => Promise<Record<string, any[]>>;
|
package/esm/claiming/spark.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { EthAddress, NetworkNumber } from '../types/common';
|
|
3
|
-
import {
|
|
3
|
+
import { SparkRewardsClaimableToken } from '../types/claiming';
|
|
4
4
|
export declare const fetchSpkAirdropRewards: (walletAddress: EthAddress) => Promise<any>;
|
|
5
|
-
export declare const fetchSparkAirdropRewards: (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => Promise<Record<string,
|
|
5
|
+
export declare const fetchSparkAirdropRewards: (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => Promise<Record<string, any[]>>;
|
|
6
6
|
export declare const fetchSparkRewards: (provider: Client, network: NetworkNumber, walletAddress: EthAddress, marketAddress: EthAddress) => Promise<SparkRewardsClaimableToken[]>;
|
package/esm/claiming/spark.js
CHANGED
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { assetAmountInEth, getAssetInfoByAddress } from '@defisaver/tokens';
|
|
11
11
|
import Dec from 'decimal.js';
|
|
12
12
|
import { createViemContractFromConfigFunc, SparkIncentiveDataProviderContractViem, SparkRewardsControllerViem, } from '../contracts';
|
|
13
|
-
import { ClaimType, SparkAirdropType
|
|
13
|
+
import { ClaimType, SparkAirdropType } from '../types/claiming';
|
|
14
14
|
import { compareAddresses, getEthAmountForDecimals } from '../services/utils';
|
|
15
15
|
const IGNITION_REWARDS = '0xCBA0C0a2a0B6Bb11233ec4EA85C5bFfea33e724d';
|
|
16
16
|
const PFL3_REWARDS = '0x7ac96180C4d6b2A328D3a19ac059D0E7Fc3C6d41';
|
package/esm/fluid/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client, PublicClient } from 'viem';
|
|
2
2
|
import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
|
|
3
|
-
import { FluidAssetsData,
|
|
3
|
+
import { FluidAssetsData, FluidMarketData, FluidMarketInfo, FluidUsedAssets, FluidVaultData, InnerFluidMarketData } from '../types';
|
|
4
4
|
export { FluidMerklOpportunityType, buildFluidMerklRewardMap, getFluidMerklCampaigns, attachFluidMerklIncentives, } from './merkl';
|
|
5
5
|
export declare const EMPTY_USED_ASSET: {
|
|
6
6
|
isSupplied: boolean;
|
|
@@ -71,10 +71,54 @@ export declare const getFluidTokenData: (provider: EthereumProvider, network: Ne
|
|
|
71
71
|
depositRate: string;
|
|
72
72
|
withdrawRate: string;
|
|
73
73
|
}>;
|
|
74
|
-
export declare const _getFluidDepositData: (provider: Client, network: NetworkNumber, token: string, address: EthAddress) => Promise<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
export declare const _getFluidDepositData: (provider: Client, network: NetworkNumber, token: string, address: EthAddress) => Promise<{
|
|
75
|
+
fTokenAddress: string | undefined;
|
|
76
|
+
fTokenSymbol: string;
|
|
77
|
+
decimals: string;
|
|
78
|
+
totalDeposited: string;
|
|
79
|
+
withdrawable: string;
|
|
80
|
+
apy: string;
|
|
81
|
+
depositRate: string;
|
|
82
|
+
withdrawRate: string;
|
|
83
|
+
deposited: string;
|
|
84
|
+
depositedShares: string;
|
|
85
|
+
}>;
|
|
86
|
+
export declare const getFluidDepositData: (provider: EthereumProvider, network: NetworkNumber, token: string, address: EthAddress) => Promise<{
|
|
87
|
+
fTokenAddress: string | undefined;
|
|
88
|
+
fTokenSymbol: string;
|
|
89
|
+
decimals: string;
|
|
90
|
+
totalDeposited: string;
|
|
91
|
+
withdrawable: string;
|
|
92
|
+
apy: string;
|
|
93
|
+
depositRate: string;
|
|
94
|
+
withdrawRate: string;
|
|
95
|
+
deposited: string;
|
|
96
|
+
depositedShares: string;
|
|
97
|
+
}>;
|
|
98
|
+
export declare const _getAllUserEarnPositionsWithFTokens: (provider: Client, network: NetworkNumber, user: EthAddress) => Promise<{
|
|
99
|
+
fTokenAddress: string | undefined;
|
|
100
|
+
fTokenSymbol: string;
|
|
101
|
+
decimals: string;
|
|
102
|
+
totalDeposited: string;
|
|
103
|
+
withdrawable: string;
|
|
104
|
+
apy: string;
|
|
105
|
+
depositRate: string;
|
|
106
|
+
withdrawRate: string;
|
|
107
|
+
deposited: string;
|
|
108
|
+
depositedShares: string;
|
|
109
|
+
}[]>;
|
|
110
|
+
export declare const getAllUserEarnPositionsWithFTokens: (provider: EthereumProvider, network: NetworkNumber, user: EthAddress) => Promise<{
|
|
111
|
+
fTokenAddress: string | undefined;
|
|
112
|
+
fTokenSymbol: string;
|
|
113
|
+
decimals: string;
|
|
114
|
+
totalDeposited: string;
|
|
115
|
+
withdrawable: string;
|
|
116
|
+
apy: string;
|
|
117
|
+
depositRate: string;
|
|
118
|
+
withdrawRate: string;
|
|
119
|
+
deposited: string;
|
|
120
|
+
depositedShares: string;
|
|
121
|
+
}[]>;
|
|
78
122
|
export declare const _getUserPositions: (provider: PublicClient, network: NetworkNumber, user: EthAddress) => Promise<{
|
|
79
123
|
marketData: FluidMarketData | undefined;
|
|
80
124
|
userData: {
|
package/esm/liquity/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { Blockish, EthAddress, EthereumProvider, NetworkNumber, PositionBalances } from '../types/common';
|
|
3
|
-
import {
|
|
3
|
+
import { LiquityTroveInfo } from '../types';
|
|
4
4
|
export declare const LIQUITY_NORMAL_MODE_RATIO = 110;
|
|
5
5
|
export declare const LIQUITY_RECOVERY_MODE_RATIO = 150;
|
|
6
6
|
export declare const _getLiquityAccountBalances: (provider: Client, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress) => Promise<PositionBalances>;
|
|
@@ -8,4 +8,14 @@ export declare const getLiquityAccountBalances: (provider: EthereumProvider, net
|
|
|
8
8
|
export declare const getDebtInFront: (provider: EthereumProvider, address: EthAddress) => Promise<string>;
|
|
9
9
|
export declare const _getLiquityTroveInfo: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<LiquityTroveInfo>;
|
|
10
10
|
export declare const getLiquityTroveInfo: (provider: EthereumProvider, network: NetworkNumber, address: EthAddress) => Promise<LiquityTroveInfo>;
|
|
11
|
-
export declare const getLiquityStakingData: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<
|
|
11
|
+
export declare const getLiquityStakingData: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<{
|
|
12
|
+
totalLUSDDeposited: string;
|
|
13
|
+
totalLQTYStaked: string;
|
|
14
|
+
stakedLQTY: string;
|
|
15
|
+
stakedLUSDBalance: string;
|
|
16
|
+
rewardETH: string;
|
|
17
|
+
rewardLUSD: string;
|
|
18
|
+
stabilityRewardETH: string;
|
|
19
|
+
stabilityRewardLQTY: string;
|
|
20
|
+
showStakingBalances: boolean;
|
|
21
|
+
}>;
|
package/esm/liquityV2/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client, PublicClient } from 'viem';
|
|
2
2
|
import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
|
|
3
|
-
import { LiquityV2AssetsData, LiquityV2MarketData, LiquityV2MarketInfo,
|
|
3
|
+
import { LiquityV2AssetsData, LiquityV2MarketData, LiquityV2MarketInfo, LiquityV2TroveData, LiquityV2Versions } from '../types';
|
|
4
4
|
export type SPYieldGainParameters = {
|
|
5
5
|
P: string;
|
|
6
6
|
aggWeightedDebtSum: string;
|
|
@@ -19,11 +19,6 @@ export declare const nftContractCreationBlockMapping: {
|
|
|
19
19
|
liquityv2wstethlegacy: number;
|
|
20
20
|
liquityv2rethlegacy: number;
|
|
21
21
|
};
|
|
22
|
-
/**
|
|
23
|
-
* The trove ids of several accounts in one market: the market's NFT transfers are read once for all of them, rather
|
|
24
|
-
* than once per account as _getLiquityV2UserTroveIds does.
|
|
25
|
-
*/
|
|
26
|
-
export declare const _getLiquityV2UsersTroveIds: (provider: PublicClient, network: NetworkNumber, selectedMarket: LiquityV2MarketInfo, troveNFTAddress: EthAddress, limitBlocksForEventFetching: boolean, accounts: EthAddress[]) => Promise<Record<EthAddress, string[]>>;
|
|
27
22
|
export declare const _getLiquityV2UserTroveIds: (provider: PublicClient, network: NetworkNumber, selectedMarket: LiquityV2MarketInfo, troveNFTAddress: EthAddress, limitBlocksForEventFetching: boolean, account: EthAddress) => Promise<{
|
|
28
23
|
troves: {
|
|
29
24
|
troveId: string;
|
|
@@ -57,5 +52,25 @@ export type sBoldYieldParameters = {
|
|
|
57
52
|
wsETH: string;
|
|
58
53
|
rETH: string;
|
|
59
54
|
};
|
|
60
|
-
export declare const getLiquityV2Staking: (provider: Client, network: NetworkNumber, market: LiquityV2Versions, user: EthAddress) => Promise<
|
|
61
|
-
|
|
55
|
+
export declare const getLiquityV2Staking: (provider: Client, network: NetworkNumber, market: LiquityV2Versions, user: EthAddress) => Promise<{
|
|
56
|
+
totalBOLDDeposited: string;
|
|
57
|
+
stakedBOLDBalance: string;
|
|
58
|
+
stabilityRewardColl: string;
|
|
59
|
+
stabilityRewardYield: string;
|
|
60
|
+
showStakingBalances: boolean;
|
|
61
|
+
debtTokenBalance: string;
|
|
62
|
+
stabilityPoolApy: string;
|
|
63
|
+
}>;
|
|
64
|
+
export declare const getLiquitySAndYBold: (provider: Client, network: NetworkNumber, markets: any, user: EthAddress) => Promise<{
|
|
65
|
+
spApy: string;
|
|
66
|
+
yBoldApy: string;
|
|
67
|
+
totalBoldDepositedSBold: string;
|
|
68
|
+
boldRateSBold: string;
|
|
69
|
+
maxWithdrawSBold: string;
|
|
70
|
+
totalBoldDepositedYBold: string;
|
|
71
|
+
boldRateYBold: string;
|
|
72
|
+
maxWithdrawYBold: string;
|
|
73
|
+
sBoldBalance: string;
|
|
74
|
+
yBoldBalance: string;
|
|
75
|
+
stYBoldBalance: string;
|
|
76
|
+
}>;
|
package/esm/liquityV2/index.js
CHANGED
|
@@ -121,53 +121,36 @@ export const nftContractCreationBlockMapping = {
|
|
|
121
121
|
[LiquityV2Versions.LiquityV2WstEthLegacy]: 21686238,
|
|
122
122
|
[LiquityV2Versions.LiquityV2REthLegacy]: 21686257,
|
|
123
123
|
};
|
|
124
|
-
|
|
125
|
-
const getTroveTransfers = (provider, network, troveNFTAddress, limitBlocksForEventFetching, market) => __awaiter(void 0, void 0, void 0, function* () {
|
|
124
|
+
const getTransferredTroves = (provider, network, troveNFTAddress, limitBlocksForEventFetching, market, account) => __awaiter(void 0, void 0, void 0, function* () {
|
|
126
125
|
const nftContract = createViemContractFromConfigFunc('LiquityV2TroveNFT', troveNFTAddress)(provider, network);
|
|
127
126
|
const nftContractCreationBlock = nftContractCreationBlockMapping[market];
|
|
128
127
|
const currentBlock = +(yield provider.getBlockNumber()).toString();
|
|
129
128
|
const _events = yield nftContract.getEvents.Transfer({}, { fromBlock: limitBlocksForEventFetching ? BigInt(currentBlock - 1000) : BigInt(nftContractCreationBlock) });
|
|
130
|
-
|
|
129
|
+
const events = _events.map((event) => ({
|
|
131
130
|
from: event.args.from, to: event.args.to, tokenId: event.args.tokenId.toString(), blockNumber: +(event.blockNumber.toString()),
|
|
132
131
|
}));
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
});
|
|
142
|
-
/** The troves an account opened and still owns, then the ones transferred to it, each once. */
|
|
143
|
-
const mergeTroveIds = (userTroves, userTransferredTroves) => {
|
|
144
|
-
const troves = [...userTroves.map(({ troveId }) => ({ troveId })), ...userTransferredTroves];
|
|
145
|
-
const filteredTroves = troves.filter((value, index, self) => index === self.findIndex((t) => (t.troveId === value.troveId)));
|
|
146
|
-
const troveIds = filteredTroves.map((trove) => trove.troveId);
|
|
147
|
-
const troveIdsSet = new Set(troveIds);
|
|
148
|
-
const troveIdsArray = Array.from(troveIdsSet);
|
|
149
|
-
return troveIdsArray.map((troveId) => troves.find((trove) => trove.troveId === troveId));
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* The trove ids of several accounts in one market: the market's NFT transfers are read once for all of them, rather
|
|
153
|
-
* than once per account as _getLiquityV2UserTroveIds does.
|
|
154
|
-
*/
|
|
155
|
-
export const _getLiquityV2UsersTroveIds = (provider, network, selectedMarket, troveNFTAddress, limitBlocksForEventFetching, accounts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
156
|
-
const [userTroves, events] = yield Promise.all([
|
|
157
|
-
Promise.all(accounts.map((account) => getUserTroves(provider, network, selectedMarket.isLegacy, account, selectedMarket.marketAddress))),
|
|
158
|
-
getTroveTransfers(provider, network, troveNFTAddress, limitBlocksForEventFetching, selectedMarket.value),
|
|
159
|
-
]);
|
|
160
|
-
return Object.fromEntries(accounts.map((account, i) => [
|
|
161
|
-
account,
|
|
162
|
-
mergeTroveIds(userTroves[i].troves, getAccountTransferredTroves(events, account)).map(({ troveId }) => troveId),
|
|
163
|
-
]));
|
|
132
|
+
const userTransferredTroves = events.filter((event) => compareAddresses(event.to, account));
|
|
133
|
+
// check if the last know transfer address is the user
|
|
134
|
+
userTransferredTroves.forEach((event, index) => {
|
|
135
|
+
const otherTransfers = events.filter((e) => event.blockNumber < e.blockNumber && e.tokenId === event.tokenId);
|
|
136
|
+
// @ts-ignore
|
|
137
|
+
userTransferredTroves[index].invalid = !!otherTransfers.length;
|
|
138
|
+
});
|
|
139
|
+
// @ts-ignore
|
|
140
|
+
return userTransferredTroves.filter((event) => !event.invalid).map((event) => ({ troveId: event.tokenId }));
|
|
164
141
|
});
|
|
165
142
|
export const _getLiquityV2UserTroveIds = (provider, network, selectedMarket, troveNFTAddress, limitBlocksForEventFetching, account) => __awaiter(void 0, void 0, void 0, function* () {
|
|
166
143
|
const [{ troves: userTroves, nextFreeTroveIndex }, userTransferredTroves] = yield Promise.all([
|
|
167
144
|
getUserTroves(provider, network, selectedMarket.isLegacy, account, selectedMarket.marketAddress),
|
|
168
145
|
getTransferredTroves(provider, network, troveNFTAddress, limitBlocksForEventFetching, selectedMarket.value, account),
|
|
169
146
|
]);
|
|
170
|
-
|
|
147
|
+
const troves = [...userTroves.map(({ troveId }) => ({ troveId })), ...userTransferredTroves];
|
|
148
|
+
const filteredTroves = troves.filter((value, index, self) => index === self.findIndex((t) => (t.troveId === value.troveId)));
|
|
149
|
+
const troveIds = filteredTroves.map((trove) => trove.troveId);
|
|
150
|
+
const troveIdsSet = new Set(troveIds);
|
|
151
|
+
const troveIdsArray = Array.from(troveIdsSet);
|
|
152
|
+
const trovesNoDuplicates = troveIdsArray.map((troveId) => troves.find((trove) => trove.troveId === troveId));
|
|
153
|
+
return { troves: trovesNoDuplicates, nextFreeTroveIndex };
|
|
171
154
|
});
|
|
172
155
|
export const getLiquityV2UserTroveIds = (provider, network, selectedMarket, troveNFTAddress, limitBlocksForEventFetching, account) => __awaiter(void 0, void 0, void 0, function* () { return _getLiquityV2UserTroveIds(getViemProvider(provider, network), network, selectedMarket, troveNFTAddress, limitBlocksForEventFetching, account); });
|
|
173
156
|
const getDebtInFrontForSingleMarketLiquityV2 = (provider_1, network_1, isLegacy_1, marketAddress_1, troveId_1, ...args_1) => __awaiter(void 0, [provider_1, network_1, isLegacy_1, marketAddress_1, troveId_1, ...args_1], void 0, function* (provider, network, isLegacy, marketAddress, troveId, accumulatedSum = '0', iterations = 2000) {
|
|
@@ -109,6 +109,7 @@ export declare const MORPHO_BLUE_AERO_USDC_625_BASE: (networkId?: NetworkNumber)
|
|
|
109
109
|
export declare const MORPHO_BLUE_USDE_USDC_915_BASE: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
110
110
|
export declare const MORPHO_BLUE_CBETH_USDC_770_BASE: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
111
111
|
export declare const MORPHO_BLUE_CBXRP_USDC_625_BASE: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
112
|
+
export declare const MORPHO_BLUE_CBHYPE_USDC_625_BASE: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
112
113
|
export declare const MORPHO_BLUE_SYRUPUSDC_USDC_915_ARB: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
113
114
|
export declare const MorphoBlueWBTCUSDC_860_Arb: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
114
115
|
export declare const MORPHO_BLUE_WSTETH_USDC_860_ARB: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
@@ -226,6 +227,7 @@ export declare const MorphoBlueMarkets: (networkId: NetworkNumber) => {
|
|
|
226
227
|
readonly morphoblueusdeusdc_915_base: MorphoBlueMarketData;
|
|
227
228
|
readonly morphobluecbethusdc_770_base: MorphoBlueMarketData;
|
|
228
229
|
readonly morphobluecbxrpusdc_625_base: MorphoBlueMarketData;
|
|
230
|
+
readonly morphobluecbhypeusdc_625_base: MorphoBlueMarketData;
|
|
229
231
|
readonly morphobluewsuperoethbweth_915_base: MorphoBlueMarketData;
|
|
230
232
|
readonly morphobluecbetheth_945_base: MorphoBlueMarketData;
|
|
231
233
|
readonly morphobluecbetheth_965_base: MorphoBlueMarketData;
|