@defisaver/positions-sdk 2.1.148-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/portfolio/index.js +3 -27
- package/esm/portfolio/index.js +4 -28
- package/package.json +1 -1
- package/src/portfolio/index.ts +3 -27
package/cjs/portfolio/index.js
CHANGED
|
@@ -127,7 +127,6 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
127
127
|
stakingPositions[address.toLowerCase()] = {
|
|
128
128
|
aaveV3: {},
|
|
129
129
|
morphoBlue: {},
|
|
130
|
-
morphoMidnight: {},
|
|
131
130
|
compoundV3: {},
|
|
132
131
|
spark: {},
|
|
133
132
|
aaveV2: {},
|
|
@@ -495,32 +494,9 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
495
494
|
}))).flat(),
|
|
496
495
|
...morphoMidnightMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
497
496
|
try {
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
(
|
|
501
|
-
]);
|
|
502
|
-
if (accDataPromise.status === 'rejected') {
|
|
503
|
-
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, accDataPromise.reason);
|
|
504
|
-
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
|
505
|
-
}
|
|
506
|
-
if (earnDataPromise.status === 'rejected') {
|
|
507
|
-
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, earnDataPromise.reason);
|
|
508
|
-
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
|
509
|
-
}
|
|
510
|
-
if (accDataPromise.status !== 'rejected') {
|
|
511
|
-
const accData = accDataPromise.value;
|
|
512
|
-
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
513
|
-
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: '', data: accData };
|
|
514
|
-
}
|
|
515
|
-
if (earnDataPromise.status !== 'rejected') {
|
|
516
|
-
const earnData = earnDataPromise.value;
|
|
517
|
-
if (earnData && new decimal_js_1.default(earnData.amount).gt(0)) {
|
|
518
|
-
stakingPositions[address.toLowerCase()].morphoMidnight[market.value] = {
|
|
519
|
-
error: '',
|
|
520
|
-
data: earnData,
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
}
|
|
497
|
+
const accData = yield (0, morphoMidnight_1._getMorphoMidnightAccountData)(client, network, address, market, morphoMidnightMarketsData[market.value]);
|
|
498
|
+
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
499
|
+
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: '', data: accData };
|
|
524
500
|
}
|
|
525
501
|
catch (error) {
|
|
526
502
|
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, error);
|
package/esm/portfolio/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import Dec from 'decimal.js';
|
|
|
11
11
|
import { NetworkNumber } from '../types/common';
|
|
12
12
|
import { AaveMarkets, AaveV4Spokes, CompoundMarkets, CrvUsdMarkets, LiquityV2Markets, LlamaLendMarkets, MorphoBlueMarkets, MorphoMidnightMarkets, SparkMarkets, } from '../markets';
|
|
13
13
|
import { _getMorphoBlueAccountData, _getMorphoBluePortfolioMarketData, getMorphoEarn } from '../morphoBlue';
|
|
14
|
-
import { _getMorphoMidnightAccountData, _getMorphoMidnightMarketData
|
|
14
|
+
import { _getMorphoMidnightAccountData, _getMorphoMidnightMarketData } from '../morphoMidnight';
|
|
15
15
|
import { AaveVersions, CompoundVersions, } from '../types';
|
|
16
16
|
import { _getCompoundV3AccountData, _getCompoundV3MarketsData } from '../compoundV3';
|
|
17
17
|
import { _getSparkAccountData, _getSparkMarketsData } from '../spark';
|
|
@@ -107,7 +107,6 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
107
107
|
stakingPositions[address.toLowerCase()] = {
|
|
108
108
|
aaveV3: {},
|
|
109
109
|
morphoBlue: {},
|
|
110
|
-
morphoMidnight: {},
|
|
111
110
|
compoundV3: {},
|
|
112
111
|
spark: {},
|
|
113
112
|
aaveV2: {},
|
|
@@ -475,32 +474,9 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
475
474
|
}))).flat(),
|
|
476
475
|
...morphoMidnightMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
477
476
|
try {
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
]);
|
|
482
|
-
if (accDataPromise.status === 'rejected') {
|
|
483
|
-
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, accDataPromise.reason);
|
|
484
|
-
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
|
485
|
-
}
|
|
486
|
-
if (earnDataPromise.status === 'rejected') {
|
|
487
|
-
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, earnDataPromise.reason);
|
|
488
|
-
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
|
489
|
-
}
|
|
490
|
-
if (accDataPromise.status !== 'rejected') {
|
|
491
|
-
const accData = accDataPromise.value;
|
|
492
|
-
if (new Dec(accData.suppliedUsd).gt(0))
|
|
493
|
-
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: '', data: accData };
|
|
494
|
-
}
|
|
495
|
-
if (earnDataPromise.status !== 'rejected') {
|
|
496
|
-
const earnData = earnDataPromise.value;
|
|
497
|
-
if (earnData && new Dec(earnData.amount).gt(0)) {
|
|
498
|
-
stakingPositions[address.toLowerCase()].morphoMidnight[market.value] = {
|
|
499
|
-
error: '',
|
|
500
|
-
data: earnData,
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
}
|
|
477
|
+
const accData = yield _getMorphoMidnightAccountData(client, network, address, market, morphoMidnightMarketsData[market.value]);
|
|
478
|
+
if (new Dec(accData.suppliedUsd).gt(0))
|
|
479
|
+
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: '', data: accData };
|
|
504
480
|
}
|
|
505
481
|
catch (error) {
|
|
506
482
|
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, error);
|
package/package.json
CHANGED
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 };
|