@defisaver/positions-sdk 2.1.148-comp-dev → 2.1.148
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/claiming/compV3.js +1 -18
- package/cjs/config/contracts.d.ts +0 -1497
- package/cjs/config/contracts.js +3 -11
- package/cjs/markets/compound/index.d.ts +0 -2
- package/cjs/markets/compound/index.js +1 -32
- package/cjs/markets/compound/marketsAssets.d.ts +0 -9
- package/cjs/markets/compound/marketsAssets.js +1 -10
- package/cjs/portfolio/index.js +3 -27
- package/cjs/types/compound.d.ts +1 -3
- package/cjs/types/compound.js +0 -1
- package/esm/claiming/compV3.js +1 -18
- package/esm/config/contracts.d.ts +0 -1497
- package/esm/config/contracts.js +0 -8
- package/esm/markets/compound/index.d.ts +0 -2
- package/esm/markets/compound/index.js +1 -31
- package/esm/markets/compound/marketsAssets.d.ts +0 -9
- package/esm/markets/compound/marketsAssets.js +0 -9
- package/esm/portfolio/index.js +4 -28
- package/esm/types/compound.d.ts +1 -3
- package/esm/types/compound.js +0 -1
- package/package.json +1 -1
- package/src/claiming/compV3.ts +2 -17
- package/src/config/contracts.ts +0 -8
- package/src/markets/compound/index.ts +0 -32
- package/src/markets/compound/marketsAssets.ts +0 -11
- package/src/portfolio/index.ts +3 -27
- package/src/types/compound.ts +0 -2
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
v3USDSCollAssets,
|
|
17
17
|
v3USDTCollAssets,
|
|
18
18
|
v3wstETHCollAssets,
|
|
19
|
-
v3InstitutionalUSDCCollAssets,
|
|
20
19
|
} from './marketsAssets';
|
|
21
20
|
|
|
22
21
|
export {
|
|
@@ -42,7 +41,6 @@ const BULKER_OPTIONS: Record<NetworkNumber, Record<CompoundVersions, CompoundBul
|
|
|
42
41
|
[CompoundVersions.CompoundV3USDT]: STANDARD_BULKER_OPTIONS,
|
|
43
42
|
[CompoundVersions.CompoundV3wstETH]: STANDARD_BULKER_OPTIONS,
|
|
44
43
|
[CompoundVersions.CompoundV3USDS]: STANDARD_BULKER_OPTIONS,
|
|
45
|
-
[CompoundVersions.CompoundV3InstitutionalUSDC]: STANDARD_BULKER_OPTIONS,
|
|
46
44
|
|
|
47
45
|
// Non-existing markets, keeping it because of typescript
|
|
48
46
|
[CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
|
|
@@ -60,7 +58,6 @@ const BULKER_OPTIONS: Record<NetworkNumber, Record<CompoundVersions, CompoundBul
|
|
|
60
58
|
[CompoundVersions.CompoundV3USDbC]: EMPTY_BULKER_OPTIONS,
|
|
61
59
|
[CompoundVersions.CompoundV3wstETH]: EMPTY_BULKER_OPTIONS,
|
|
62
60
|
[CompoundVersions.CompoundV3USDS]: EMPTY_BULKER_OPTIONS,
|
|
63
|
-
[CompoundVersions.CompoundV3InstitutionalUSDC]: EMPTY_BULKER_OPTIONS,
|
|
64
61
|
},
|
|
65
62
|
[NetworkNumber.Base]: {
|
|
66
63
|
[CompoundVersions.CompoundV3ETH]: STANDARD_BULKER_OPTIONS,
|
|
@@ -73,7 +70,6 @@ const BULKER_OPTIONS: Record<NetworkNumber, Record<CompoundVersions, CompoundBul
|
|
|
73
70
|
[CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
|
|
74
71
|
[CompoundVersions.CompoundV3USDT]: EMPTY_BULKER_OPTIONS,
|
|
75
72
|
[CompoundVersions.CompoundV3wstETH]: EMPTY_BULKER_OPTIONS,
|
|
76
|
-
[CompoundVersions.CompoundV3InstitutionalUSDC]: EMPTY_BULKER_OPTIONS,
|
|
77
73
|
},
|
|
78
74
|
[NetworkNumber.Opt]: {
|
|
79
75
|
[CompoundVersions.CompoundV3USDC]: STANDARD_BULKER_OPTIONS,
|
|
@@ -85,7 +81,6 @@ const BULKER_OPTIONS: Record<NetworkNumber, Record<CompoundVersions, CompoundBul
|
|
|
85
81
|
[CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
|
|
86
82
|
[CompoundVersions.CompoundV3wstETH]: EMPTY_BULKER_OPTIONS,
|
|
87
83
|
[CompoundVersions.CompoundV3USDS]: EMPTY_BULKER_OPTIONS,
|
|
88
|
-
[CompoundVersions.CompoundV3InstitutionalUSDC]: EMPTY_BULKER_OPTIONS,
|
|
89
84
|
},
|
|
90
85
|
[NetworkNumber.Linea]: {
|
|
91
86
|
// Non-existing markets, keeping it because of typescript
|
|
@@ -97,7 +92,6 @@ const BULKER_OPTIONS: Record<NetworkNumber, Record<CompoundVersions, CompoundBul
|
|
|
97
92
|
[CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
|
|
98
93
|
[CompoundVersions.CompoundV3wstETH]: EMPTY_BULKER_OPTIONS,
|
|
99
94
|
[CompoundVersions.CompoundV3USDS]: EMPTY_BULKER_OPTIONS,
|
|
100
|
-
[CompoundVersions.CompoundV3InstitutionalUSDC]: EMPTY_BULKER_OPTIONS,
|
|
101
95
|
},
|
|
102
96
|
[NetworkNumber.Plasma]: {
|
|
103
97
|
// Non-existing markets, keeping it because of typescript
|
|
@@ -109,7 +103,6 @@ const BULKER_OPTIONS: Record<NetworkNumber, Record<CompoundVersions, CompoundBul
|
|
|
109
103
|
[CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
|
|
110
104
|
[CompoundVersions.CompoundV3wstETH]: EMPTY_BULKER_OPTIONS,
|
|
111
105
|
[CompoundVersions.CompoundV3USDS]: EMPTY_BULKER_OPTIONS,
|
|
112
|
-
[CompoundVersions.CompoundV3InstitutionalUSDC]: EMPTY_BULKER_OPTIONS,
|
|
113
106
|
},
|
|
114
107
|
};
|
|
115
108
|
|
|
@@ -117,7 +110,6 @@ export const COMPOUND_V2: CompoundMarketData = {
|
|
|
117
110
|
chainIds: [NetworkNumber.Eth],
|
|
118
111
|
label: 'Compound V2',
|
|
119
112
|
shortLabel: CompoundVersionType.V2,
|
|
120
|
-
url: '',
|
|
121
113
|
value: CompoundVersions.CompoundV2,
|
|
122
114
|
baseAsset: '',
|
|
123
115
|
collAssets: compoundV2CollateralAssets.map(a => a.underlyingAsset),
|
|
@@ -134,7 +126,6 @@ export const COMPOUND_V3_USDC = (networkId: NetworkNumber): CompoundMarketData =
|
|
|
134
126
|
chainIds: [NetworkNumber.Eth, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Opt],
|
|
135
127
|
label: 'Compound V3 - USDC',
|
|
136
128
|
shortLabel: CompoundVersionType.V3,
|
|
137
|
-
url: 'cusdcv3',
|
|
138
129
|
value: CompoundVersions.CompoundV3USDC,
|
|
139
130
|
baseAsset: 'USDC',
|
|
140
131
|
collAssets: networkId ? v3USDCCollAssets[networkId] : [],
|
|
@@ -151,7 +142,6 @@ export const COMPOUND_V3_USDCe = (networkId: NetworkNumber): CompoundMarketData
|
|
|
151
142
|
chainIds: [NetworkNumber.Arb],
|
|
152
143
|
label: 'Compound V3 - USDC.e',
|
|
153
144
|
shortLabel: CompoundVersionType.V3,
|
|
154
|
-
url: 'cusdcev3',
|
|
155
145
|
value: CompoundVersions.CompoundV3USDCe,
|
|
156
146
|
baseAsset: 'USDC.e',
|
|
157
147
|
collAssets: networkId ? v3USDCeCollAssets[networkId] : [],
|
|
@@ -168,7 +158,6 @@ export const COMPOUND_V3_ETH = (networkId: NetworkNumber): CompoundMarketData =>
|
|
|
168
158
|
chainIds: [NetworkNumber.Eth, NetworkNumber.Base, NetworkNumber.Arb, NetworkNumber.Opt],
|
|
169
159
|
label: 'Compound V3 - ETH',
|
|
170
160
|
shortLabel: CompoundVersionType.V3,
|
|
171
|
-
url: 'cethv3',
|
|
172
161
|
value: CompoundVersions.CompoundV3ETH,
|
|
173
162
|
baseAsset: 'ETH',
|
|
174
163
|
collAssets: networkId ? v3ETHCollAssets[networkId] : [],
|
|
@@ -185,7 +174,6 @@ export const COMPOUND_V3_USDBC = (networkId: NetworkNumber): CompoundMarketData
|
|
|
185
174
|
chainIds: [NetworkNumber.Base],
|
|
186
175
|
label: 'Compound V3 - USDbC',
|
|
187
176
|
shortLabel: CompoundVersionType.V3,
|
|
188
|
-
url: 'cusdbcv3',
|
|
189
177
|
value: CompoundVersions.CompoundV3USDbC,
|
|
190
178
|
baseAsset: 'USDbC',
|
|
191
179
|
collAssets: networkId ? v3USDbCCollAssets[networkId] : [],
|
|
@@ -202,7 +190,6 @@ export const COMPOUND_V3_USDT = (networkId: NetworkNumber): CompoundMarketData =
|
|
|
202
190
|
chainIds: [NetworkNumber.Eth, NetworkNumber.Arb, NetworkNumber.Opt],
|
|
203
191
|
label: 'Compound V3 - USDT',
|
|
204
192
|
shortLabel: CompoundVersionType.V3,
|
|
205
|
-
url: 'cusdtv3',
|
|
206
193
|
value: CompoundVersions.CompoundV3USDT,
|
|
207
194
|
baseAsset: 'USDT',
|
|
208
195
|
collAssets: networkId ? v3USDTCollAssets[networkId] : [],
|
|
@@ -219,7 +206,6 @@ export const COMPOUND_V3_WSTETH = (networkId: NetworkNumber): CompoundMarketData
|
|
|
219
206
|
chainIds: [NetworkNumber.Eth],
|
|
220
207
|
label: 'Compound V3 - wstETH',
|
|
221
208
|
shortLabel: CompoundVersionType.V3,
|
|
222
|
-
url: 'cwstethv3',
|
|
223
209
|
value: CompoundVersions.CompoundV3wstETH,
|
|
224
210
|
baseAsset: 'wstETH',
|
|
225
211
|
collAssets: networkId ? v3wstETHCollAssets[networkId] : [],
|
|
@@ -235,7 +221,6 @@ export const COMPOUND_V3_USDS = (networkId: NetworkNumber): CompoundMarketData =
|
|
|
235
221
|
chainIds: [NetworkNumber.Eth, NetworkNumber.Base],
|
|
236
222
|
label: 'Compound V3 - USDS',
|
|
237
223
|
shortLabel: CompoundVersionType.V3,
|
|
238
|
-
url: 'cusdsv3',
|
|
239
224
|
value: CompoundVersions.CompoundV3USDS,
|
|
240
225
|
baseAsset: 'USDS',
|
|
241
226
|
collAssets: networkId ? v3USDSCollAssets[networkId] : [],
|
|
@@ -247,22 +232,6 @@ export const COMPOUND_V3_USDS = (networkId: NetworkNumber): CompoundMarketData =
|
|
|
247
232
|
bulkerOptions: BULKER_OPTIONS[networkId][CompoundVersions.CompoundV3USDS],
|
|
248
233
|
});
|
|
249
234
|
|
|
250
|
-
export const COMPOUND_V3_INSTITUTIONAL_USDC = (networkId: NetworkNumber): CompoundMarketData => ({
|
|
251
|
-
chainIds: [NetworkNumber.Eth],
|
|
252
|
-
label: 'Compound V3 - Institutional USDC',
|
|
253
|
-
shortLabel: CompoundVersionType.V3,
|
|
254
|
-
url: 'ciusdcv3',
|
|
255
|
-
value: CompoundVersions.CompoundV3InstitutionalUSDC,
|
|
256
|
-
baseAsset: 'USDC',
|
|
257
|
-
collAssets: networkId ? v3InstitutionalUSDCCollAssets[networkId] : [],
|
|
258
|
-
baseMarket: 'ciUSDCv3',
|
|
259
|
-
baseMarketAddress: getConfigContractAddress('ciUSDCv3', networkId),
|
|
260
|
-
secondLabel: 'Market',
|
|
261
|
-
bulkerName: networkId === NetworkNumber.Eth ? 'CompV3BulkerMainnetETH' : 'CompV3BulkerL2',
|
|
262
|
-
bulkerAddress: getConfigContractAddress(networkId === NetworkNumber.Eth ? 'CompV3BulkerMainnetETH' : 'CompV3BulkerL2', networkId),
|
|
263
|
-
bulkerOptions: BULKER_OPTIONS[networkId][CompoundVersions.CompoundV3InstitutionalUSDC],
|
|
264
|
-
});
|
|
265
|
-
|
|
266
235
|
export const CompoundMarkets = (networkId: NetworkNumber) => ({
|
|
267
236
|
[CompoundVersions.CompoundV2]: COMPOUND_V2,
|
|
268
237
|
[CompoundVersions.CompoundV3ETH]: COMPOUND_V3_ETH(networkId),
|
|
@@ -272,5 +241,4 @@ export const CompoundMarkets = (networkId: NetworkNumber) => ({
|
|
|
272
241
|
[CompoundVersions.CompoundV3USDT]: COMPOUND_V3_USDT(networkId),
|
|
273
242
|
[CompoundVersions.CompoundV3wstETH]: COMPOUND_V3_WSTETH(networkId),
|
|
274
243
|
[CompoundVersions.CompoundV3USDS]: COMPOUND_V3_USDS(networkId),
|
|
275
|
-
[CompoundVersions.CompoundV3InstitutionalUSDC]: COMPOUND_V3_INSTITUTIONAL_USDC(networkId),
|
|
276
244
|
}) as const;
|
|
@@ -95,15 +95,4 @@ export const v3wstETHCollAssets = {
|
|
|
95
95
|
[NetworkNumber.Base]: [],
|
|
96
96
|
[NetworkNumber.Linea]: [],
|
|
97
97
|
[NetworkNumber.Plasma]: [],
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export const v3InstitutionalUSDCCollAssetsEth = ['ETH', 'wstETH', 'cbBTC', 'WBTC'];
|
|
101
|
-
|
|
102
|
-
export const v3InstitutionalUSDCCollAssets = {
|
|
103
|
-
[NetworkNumber.Eth]: v3InstitutionalUSDCCollAssetsEth,
|
|
104
|
-
[NetworkNumber.Opt]: [],
|
|
105
|
-
[NetworkNumber.Arb]: [],
|
|
106
|
-
[NetworkNumber.Base]: [],
|
|
107
|
-
[NetworkNumber.Linea]: [],
|
|
108
|
-
[NetworkNumber.Plasma]: [],
|
|
109
98
|
};
|
package/src/portfolio/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
SparkMarkets,
|
|
13
13
|
} from '../markets';
|
|
14
14
|
import { _getMorphoBlueAccountData, _getMorphoBluePortfolioMarketData, getMorphoEarn } from '../morphoBlue';
|
|
15
|
-
import { _getMorphoMidnightAccountData, _getMorphoMidnightMarketData
|
|
15
|
+
import { _getMorphoMidnightAccountData, _getMorphoMidnightMarketData } from '../morphoMidnight';
|
|
16
16
|
import {
|
|
17
17
|
AaveV2MarketData,
|
|
18
18
|
AaveV3MarketData,
|
|
@@ -137,7 +137,6 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
137
137
|
stakingPositions[address.toLowerCase() as EthAddress] = {
|
|
138
138
|
aaveV3: {},
|
|
139
139
|
morphoBlue: {},
|
|
140
|
-
morphoMidnight: {},
|
|
141
140
|
compoundV3: {},
|
|
142
141
|
spark: {},
|
|
143
142
|
aaveV2: {},
|
|
@@ -487,31 +486,8 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
487
486
|
})).flat(),
|
|
488
487
|
...morphoMidnightMarkets.map((market) => addresses.map(async (address) => {
|
|
489
488
|
try {
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
getMorphoMidnightEarn(client, network, address, market, morphoMidnightMarketsData[market.value]),
|
|
493
|
-
]);
|
|
494
|
-
if (accDataPromise.status === 'rejected') {
|
|
495
|
-
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, accDataPromise.reason);
|
|
496
|
-
positions[address.toLowerCase() as EthAddress].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
|
497
|
-
}
|
|
498
|
-
if (earnDataPromise.status === 'rejected') {
|
|
499
|
-
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, earnDataPromise.reason);
|
|
500
|
-
positions[address.toLowerCase() as EthAddress].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
|
501
|
-
}
|
|
502
|
-
if (accDataPromise.status !== 'rejected') {
|
|
503
|
-
const accData = accDataPromise.value;
|
|
504
|
-
if (new Dec(accData.suppliedUsd).gt(0)) positions[address.toLowerCase() as EthAddress].morphoMidnight[market.value] = { error: '', data: accData };
|
|
505
|
-
}
|
|
506
|
-
if (earnDataPromise.status !== 'rejected') {
|
|
507
|
-
const earnData = earnDataPromise.value;
|
|
508
|
-
if (earnData && new Dec(earnData.amount).gt(0)) {
|
|
509
|
-
stakingPositions[address.toLowerCase() as EthAddress].morphoMidnight[market.value] = {
|
|
510
|
-
error: '',
|
|
511
|
-
data: earnData,
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
}
|
|
489
|
+
const accData = await _getMorphoMidnightAccountData(client, network, address, market, morphoMidnightMarketsData[market.value]);
|
|
490
|
+
if (new Dec(accData.suppliedUsd).gt(0)) positions[address.toLowerCase() as EthAddress].morphoMidnight[market.value] = { error: '', data: accData };
|
|
515
491
|
} catch (error) {
|
|
516
492
|
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, error);
|
|
517
493
|
positions[address.toLowerCase() as EthAddress].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
package/src/types/compound.ts
CHANGED
|
@@ -16,7 +16,6 @@ export enum CompoundVersions {
|
|
|
16
16
|
'CompoundV3USDT' = 'v3-USDT',
|
|
17
17
|
'CompoundV3USDS' = 'v3-USDS',
|
|
18
18
|
'CompoundV3wstETH' = 'v3-wstETH',
|
|
19
|
-
'CompoundV3InstitutionalUSDC' = 'v3-institutional-USDC',
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
export enum CompoundVersionType {
|
|
@@ -33,7 +32,6 @@ export interface CompoundMarketData {
|
|
|
33
32
|
chainIds: NetworkNumber[],
|
|
34
33
|
label: string,
|
|
35
34
|
shortLabel: string,
|
|
36
|
-
url: string,
|
|
37
35
|
value: CompoundVersions,
|
|
38
36
|
baseAsset: string,
|
|
39
37
|
collAssets: readonly string[],
|