@defisaver/positions-sdk 2.1.148-dev → 2.1.149
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/markets/morphoBlue/index.js +122 -122
- package/cjs/portfolio/index.js +3 -27
- package/esm/markets/morphoBlue/index.js +122 -122
- package/esm/portfolio/index.js +4 -28
- package/package.json +1 -1
- package/src/markets/morphoBlue/index.ts +122 -122
- package/src/portfolio/index.ts +3 -27
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 };
|