@defisaver/positions-sdk 2.1.149 → 2.1.150-cirbtc-dev
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 +18 -1
- package/cjs/config/contracts.d.ts +1497 -0
- package/cjs/config/contracts.js +11 -3
- package/cjs/markets/compound/index.d.ts +2 -0
- package/cjs/markets/compound/index.js +32 -1
- package/cjs/markets/compound/marketsAssets.d.ts +9 -0
- package/cjs/markets/compound/marketsAssets.js +10 -1
- package/cjs/markets/morphoBlue/index.js +122 -122
- package/cjs/portfolio/index.js +27 -3
- package/cjs/types/compound.d.ts +3 -1
- package/cjs/types/compound.js +1 -0
- package/esm/claiming/compV3.js +18 -1
- package/esm/config/contracts.d.ts +1497 -0
- package/esm/config/contracts.js +8 -0
- package/esm/markets/compound/index.d.ts +2 -0
- package/esm/markets/compound/index.js +31 -1
- package/esm/markets/compound/marketsAssets.d.ts +9 -0
- package/esm/markets/compound/marketsAssets.js +9 -0
- package/esm/markets/morphoBlue/index.js +122 -122
- package/esm/portfolio/index.js +28 -4
- package/esm/types/compound.d.ts +3 -1
- package/esm/types/compound.js +1 -0
- package/package.json +1 -1
- package/src/claiming/compV3.ts +17 -2
- package/src/config/contracts.ts +8 -0
- package/src/markets/compound/index.ts +32 -0
- package/src/markets/compound/marketsAssets.ts +11 -0
- package/src/markets/morphoBlue/index.ts +122 -122
- package/src/portfolio/index.ts +27 -3
- package/src/types/compound.ts +2 -0
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 } from '../morphoMidnight';
|
|
15
|
+
import { _getMorphoMidnightAccountData, _getMorphoMidnightMarketData, getMorphoMidnightEarn } from '../morphoMidnight';
|
|
16
16
|
import {
|
|
17
17
|
AaveV2MarketData,
|
|
18
18
|
AaveV3MarketData,
|
|
@@ -137,6 +137,7 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
137
137
|
stakingPositions[address.toLowerCase() as EthAddress] = {
|
|
138
138
|
aaveV3: {},
|
|
139
139
|
morphoBlue: {},
|
|
140
|
+
morphoMidnight: {},
|
|
140
141
|
compoundV3: {},
|
|
141
142
|
spark: {},
|
|
142
143
|
aaveV2: {},
|
|
@@ -486,8 +487,31 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
486
487
|
})).flat(),
|
|
487
488
|
...morphoMidnightMarkets.map((market) => addresses.map(async (address) => {
|
|
488
489
|
try {
|
|
489
|
-
const
|
|
490
|
-
|
|
490
|
+
const [accDataPromise, earnDataPromise] = await Promise.allSettled([
|
|
491
|
+
_getMorphoMidnightAccountData(client, network, address, market, morphoMidnightMarketsData[market.value]),
|
|
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
|
+
}
|
|
491
515
|
} catch (error) {
|
|
492
516
|
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, error);
|
|
493
517
|
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,6 +16,7 @@ export enum CompoundVersions {
|
|
|
16
16
|
'CompoundV3USDT' = 'v3-USDT',
|
|
17
17
|
'CompoundV3USDS' = 'v3-USDS',
|
|
18
18
|
'CompoundV3wstETH' = 'v3-wstETH',
|
|
19
|
+
'CompoundV3InstitutionalUSDC' = 'v3-institutional-USDC',
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export enum CompoundVersionType {
|
|
@@ -32,6 +33,7 @@ export interface CompoundMarketData {
|
|
|
32
33
|
chainIds: NetworkNumber[],
|
|
33
34
|
label: string,
|
|
34
35
|
shortLabel: string,
|
|
36
|
+
url: string,
|
|
35
37
|
value: CompoundVersions,
|
|
36
38
|
baseAsset: string,
|
|
37
39
|
collAssets: readonly string[],
|