@defisaver/positions-sdk 2.1.127-midnight-dev → 2.1.127-uniswap-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/index.d.ts +2 -1
- package/cjs/claiming/index.js +3 -1
- package/cjs/claiming/uniswap.d.ts +4 -0
- package/cjs/claiming/uniswap.js +70 -0
- package/cjs/config/contracts.d.ts +22 -249
- package/cjs/config/contracts.js +10 -11
- package/cjs/contracts.d.ts +35 -1510
- package/cjs/contracts.js +3 -3
- package/cjs/helpers/index.d.ts +0 -1
- package/cjs/helpers/index.js +1 -2
- package/cjs/helpers/morphoBlueHelpers/index.js +1 -0
- package/cjs/index.d.ts +1 -2
- package/cjs/index.js +1 -3
- package/cjs/markets/index.d.ts +0 -1
- package/cjs/markets/index.js +1 -4
- package/cjs/morphoBlue/index.d.ts +8 -6
- package/cjs/morphoBlue/index.js +69 -40
- package/cjs/portfolio/discovery.js +0 -4
- package/cjs/portfolio/index.js +30 -45
- package/cjs/services/viem.d.ts +11 -11
- package/cjs/types/claiming.d.ts +2 -0
- package/cjs/types/claiming.js +2 -0
- package/cjs/types/index.d.ts +0 -1
- package/cjs/types/index.js +0 -1
- package/cjs/types/morphoBlue.d.ts +9 -0
- package/cjs/types/portfolio.d.ts +0 -4
- package/esm/claiming/index.d.ts +2 -1
- package/esm/claiming/index.js +2 -1
- package/esm/claiming/uniswap.d.ts +4 -0
- package/esm/claiming/uniswap.js +62 -0
- package/esm/config/contracts.d.ts +22 -249
- package/esm/config/contracts.js +8 -9
- package/esm/contracts.d.ts +35 -1510
- package/esm/contracts.js +1 -1
- package/esm/helpers/index.d.ts +0 -1
- package/esm/helpers/index.js +0 -1
- package/esm/helpers/morphoBlueHelpers/index.js +1 -0
- package/esm/index.d.ts +1 -2
- package/esm/index.js +1 -2
- package/esm/markets/index.d.ts +0 -1
- package/esm/markets/index.js +0 -1
- package/esm/morphoBlue/index.d.ts +8 -6
- package/esm/morphoBlue/index.js +62 -39
- package/esm/portfolio/discovery.js +1 -5
- package/esm/portfolio/index.js +32 -47
- package/esm/services/viem.d.ts +11 -11
- package/esm/types/claiming.d.ts +2 -0
- package/esm/types/claiming.js +2 -0
- package/esm/types/index.d.ts +0 -1
- package/esm/types/index.js +0 -1
- package/esm/types/morphoBlue.d.ts +9 -0
- package/esm/types/portfolio.d.ts +0 -4
- package/package.json +1 -1
- package/src/claiming/index.ts +2 -0
- package/src/claiming/uniswap.ts +65 -0
- package/src/config/contracts.ts +9 -9
- package/src/contracts.ts +2 -1
- package/src/helpers/index.ts +0 -1
- package/src/helpers/morphoBlueHelpers/index.ts +1 -0
- package/src/index.ts +0 -2
- package/src/markets/index.ts +0 -1
- package/src/morphoBlue/index.ts +101 -44
- package/src/portfolio/discovery.ts +0 -6
- package/src/portfolio/index.ts +30 -46
- package/src/types/claiming.ts +2 -0
- package/src/types/index.ts +0 -1
- package/src/types/morphoBlue.ts +11 -0
- package/src/types/portfolio.ts +0 -4
- package/cjs/helpers/morphoMidnightHelpers/index.d.ts +0 -16
- package/cjs/helpers/morphoMidnightHelpers/index.js +0 -68
- package/cjs/markets/morphoMidnight/index.d.ts +0 -16
- package/cjs/markets/morphoMidnight/index.js +0 -159
- package/cjs/morphoMidnight/index.d.ts +0 -14
- package/cjs/morphoMidnight/index.js +0 -220
- package/cjs/types/morphoMidnight.d.ts +0 -91
- package/cjs/types/morphoMidnight.js +0 -15
- package/esm/helpers/morphoMidnightHelpers/index.d.ts +0 -16
- package/esm/helpers/morphoMidnightHelpers/index.js +0 -61
- package/esm/markets/morphoMidnight/index.d.ts +0 -16
- package/esm/markets/morphoMidnight/index.js +0 -148
- package/esm/morphoMidnight/index.d.ts +0 -14
- package/esm/morphoMidnight/index.js +0 -207
- package/esm/types/morphoMidnight.d.ts +0 -91
- package/esm/types/morphoMidnight.js +0 -12
- package/src/helpers/morphoMidnightHelpers/index.ts +0 -86
- package/src/markets/morphoMidnight/index.ts +0 -161
- package/src/morphoMidnight/index.ts +0 -234
- package/src/types/morphoMidnight.ts +0 -104
package/cjs/contracts.js
CHANGED
|
@@ -33,8 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.UUPSViem = exports.LiquityStabilityPoolViem = exports.LiquityLQTYStakingViem = exports.AaveUmbrellaViewViem = exports.AaveIncentivesControllerViem = exports.FluidViewContractViem = exports.LiquityV2LegacyViewContractViem = exports.LiquityV2ViewContractViem = exports.LiquityActivePoolContractViem = exports.LiquityPriceFeedContractViem = exports.LiquityTroveManagerContractViem = exports.LiquityCollSurplusPoolContractViem = exports.LiquityViewContractViem = exports.BTCPriceFeedContractViem = exports.WeETHPriceFeedContractViem = exports.ComptrollerContractViem = exports.CompoundLoanInfoContractViem = exports.McdJugContractViem = exports.McdDogContractViem = exports.McdSpotterContractViem = exports.McdVatContractViem = exports.McdViewContractViem = exports.McdGetCdpsContractViem = exports.LlamaLendViewContractViem = exports.CrvUSDFactoryContractViem = exports.CrvUSDViewContractViem = exports.EulerV2ViewContractViem = exports.SparkIncentiveDataProviderContractViem = exports.SparkViewContractViem = exports.CompV3ViewContractViem = exports.WstETHPriceFeedContractViem = exports.USDCPriceFeedContractViem = exports.ETHPriceFeedContractViem = exports.COMPPriceFeedContractViem = exports.DFSFeedRegistryContractViem = exports.FeedRegistryContractViem = exports.AaveIncentiveDataProviderV3ContractViem = exports.AaveV3ViewContractViem = exports.AaveLoanInfoV2ContractViem = exports.
|
|
37
|
-
exports.AaveV4ViewContractViem = exports.SkySavingsContractView = exports.MakerDsrContractViem = exports.YearnViewContractViem = exports.StkAAVEViem = exports.LiquityV2sBoldVaultViem = exports.AaveRewardsControllerViem =
|
|
36
|
+
exports.SparkRewardsControllerViem = exports.UUPSViem = exports.LiquityStabilityPoolViem = exports.LiquityLQTYStakingViem = exports.AaveUmbrellaViewViem = exports.AaveIncentivesControllerViem = exports.FluidViewContractViem = exports.LiquityV2LegacyViewContractViem = exports.LiquityV2ViewContractViem = exports.LiquityActivePoolContractViem = exports.LiquityPriceFeedContractViem = exports.LiquityTroveManagerContractViem = exports.LiquityCollSurplusPoolContractViem = exports.LiquityViewContractViem = exports.BTCPriceFeedContractViem = exports.WeETHPriceFeedContractViem = exports.ComptrollerContractViem = exports.CompoundLoanInfoContractViem = exports.McdJugContractViem = exports.McdDogContractViem = exports.McdSpotterContractViem = exports.McdVatContractViem = exports.McdViewContractViem = exports.McdGetCdpsContractViem = exports.LlamaLendViewContractViem = exports.CrvUSDFactoryContractViem = exports.CrvUSDViewContractViem = exports.EulerV2ViewContractViem = exports.SparkIncentiveDataProviderContractViem = exports.SparkViewContractViem = exports.CompV3ViewContractViem = exports.WstETHPriceFeedContractViem = exports.USDCPriceFeedContractViem = exports.ETHPriceFeedContractViem = exports.COMPPriceFeedContractViem = exports.DFSFeedRegistryContractViem = exports.FeedRegistryContractViem = exports.AaveIncentiveDataProviderV3ContractViem = exports.AaveV3ViewContractViem = exports.AaveLoanInfoV2ContractViem = exports.MorphoBlueViewContractViem = exports.getYearnV3VaultContractViem = exports.getErc4626ContractViem = exports.getErc20ContractViem = exports.getSparkSavingsVaultContractViem = exports.getYearnVaultContractViem = exports.getMorphoVaultContractViem = exports.createViemContractFromConfigFunc = exports.getConfigContractAbi = exports.getConfigContractAddress = void 0;
|
|
37
|
+
exports.UniswapTokenDistributorViem = exports.AaveV4ViewContractViem = exports.SkySavingsContractView = exports.MakerDsrContractViem = exports.YearnViewContractViem = exports.StkAAVEViem = exports.LiquityV2sBoldVaultViem = exports.AaveRewardsControllerViem = void 0;
|
|
38
38
|
const viem_1 = require("viem");
|
|
39
39
|
const configRaw = __importStar(require("./config/contracts"));
|
|
40
40
|
// @ts-ignore
|
|
@@ -140,7 +140,6 @@ const getYearnV3VaultContractViem = (client, address) => {
|
|
|
140
140
|
};
|
|
141
141
|
exports.getYearnV3VaultContractViem = getYearnV3VaultContractViem;
|
|
142
142
|
exports.MorphoBlueViewContractViem = (0, exports.createViemContractFromConfigFunc)('MorphoBlueView');
|
|
143
|
-
exports.MorphoMidnightViewContractViem = (0, exports.createViemContractFromConfigFunc)('MidnightView');
|
|
144
143
|
exports.AaveLoanInfoV2ContractViem = (0, exports.createViemContractFromConfigFunc)('AaveLoanInfoV2');
|
|
145
144
|
exports.AaveV3ViewContractViem = (0, exports.createViemContractFromConfigFunc)('AaveV3View');
|
|
146
145
|
exports.AaveIncentiveDataProviderV3ContractViem = (0, exports.createViemContractFromConfigFunc)('AaveUiIncentiveDataProviderV3');
|
|
@@ -188,3 +187,4 @@ exports.YearnViewContractViem = (0, exports.createViemContractFromConfigFunc)('Y
|
|
|
188
187
|
exports.MakerDsrContractViem = (0, exports.createViemContractFromConfigFunc)('MakerDsr');
|
|
189
188
|
exports.SkySavingsContractView = (0, exports.createViemContractFromConfigFunc)('SkySavings');
|
|
190
189
|
exports.AaveV4ViewContractViem = (0, exports.createViemContractFromConfigFunc)('AaveV4View');
|
|
190
|
+
exports.UniswapTokenDistributorViem = (0, exports.createViemContractFromConfigFunc)('UniswapTokenDistributor');
|
package/cjs/helpers/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export * as sparkHelpers from './sparkHelpers';
|
|
|
4
4
|
export * as curveUsdHelpers from './curveUsdHelpers';
|
|
5
5
|
export * as makerHelpers from './makerHelpers';
|
|
6
6
|
export * as morphoBlueHelpers from './morphoBlueHelpers';
|
|
7
|
-
export * as morphoMidnightHelpers from './morphoMidnightHelpers';
|
|
8
7
|
export * as llamaLendHelpers from './llamaLendHelpers';
|
|
9
8
|
export * as liquityV2Helpers from './liquityV2Helpers';
|
|
10
9
|
export * as eulerV2Helpers from './eulerHelpers';
|
package/cjs/helpers/index.js
CHANGED
|
@@ -33,14 +33,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.aaveV4Helpers = exports.fluidHelpers = exports.eulerV2Helpers = exports.liquityV2Helpers = exports.llamaLendHelpers = exports.
|
|
36
|
+
exports.aaveV4Helpers = exports.fluidHelpers = exports.eulerV2Helpers = exports.liquityV2Helpers = exports.llamaLendHelpers = exports.morphoBlueHelpers = exports.makerHelpers = exports.curveUsdHelpers = exports.sparkHelpers = exports.compoundHelpers = exports.aaveHelpers = void 0;
|
|
37
37
|
exports.aaveHelpers = __importStar(require("./aaveHelpers"));
|
|
38
38
|
exports.compoundHelpers = __importStar(require("./compoundHelpers"));
|
|
39
39
|
exports.sparkHelpers = __importStar(require("./sparkHelpers"));
|
|
40
40
|
exports.curveUsdHelpers = __importStar(require("./curveUsdHelpers"));
|
|
41
41
|
exports.makerHelpers = __importStar(require("./makerHelpers"));
|
|
42
42
|
exports.morphoBlueHelpers = __importStar(require("./morphoBlueHelpers"));
|
|
43
|
-
exports.morphoMidnightHelpers = __importStar(require("./morphoMidnightHelpers"));
|
|
44
43
|
exports.llamaLendHelpers = __importStar(require("./llamaLendHelpers"));
|
|
45
44
|
exports.liquityV2Helpers = __importStar(require("./liquityV2Helpers"));
|
|
46
45
|
exports.eulerV2Helpers = __importStar(require("./eulerHelpers"));
|
|
@@ -361,6 +361,7 @@ const getRewardsForMarket = (marketId_1, ...args_1) => __awaiter(void 0, [market
|
|
|
361
361
|
query: REWARDS_QUERY,
|
|
362
362
|
variables: { marketId, chainId: network },
|
|
363
363
|
}),
|
|
364
|
+
signal: AbortSignal.timeout(utils_1.LONGER_TIMEOUT),
|
|
364
365
|
});
|
|
365
366
|
const data = yield response.json();
|
|
366
367
|
const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketById;
|
package/cjs/index.d.ts
CHANGED
|
@@ -16,11 +16,10 @@ import * as markets from './markets';
|
|
|
16
16
|
import * as helpers from './helpers';
|
|
17
17
|
import * as exchange from './exchange';
|
|
18
18
|
import * as morphoBlue from './morphoBlue';
|
|
19
|
-
import * as morphoMidnight from './morphoMidnight';
|
|
20
19
|
import * as llamaLend from './llamaLend';
|
|
21
20
|
import * as eulerV2 from './eulerV2';
|
|
22
21
|
import * as portfolio from './portfolio';
|
|
23
22
|
import * as claiming from './claiming';
|
|
24
23
|
import * as savings from './savings';
|
|
25
24
|
export * from './types';
|
|
26
|
-
export { aaveV2, aaveV3, aaveV4, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue,
|
|
25
|
+
export { aaveV2, aaveV3, aaveV4, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, savings, };
|
package/cjs/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.savings = exports.claiming = exports.portfolio = exports.fluid = exports.eulerV2 = exports.llamaLend = exports.
|
|
39
|
+
exports.savings = exports.claiming = exports.portfolio = exports.fluid = exports.eulerV2 = exports.llamaLend = exports.morphoBlue = exports.helpers = exports.markets = exports.moneymarket = exports.staking = exports.exchange = exports.maker = exports.liquityV2 = exports.liquity = exports.curveUsd = exports.spark = exports.compoundV3 = exports.compoundV2 = exports.aaveV4 = exports.aaveV3 = exports.aaveV2 = void 0;
|
|
40
40
|
require("./setup");
|
|
41
41
|
const fluid = __importStar(require("./fluid"));
|
|
42
42
|
exports.fluid = fluid;
|
|
@@ -72,8 +72,6 @@ const exchange = __importStar(require("./exchange"));
|
|
|
72
72
|
exports.exchange = exchange;
|
|
73
73
|
const morphoBlue = __importStar(require("./morphoBlue"));
|
|
74
74
|
exports.morphoBlue = morphoBlue;
|
|
75
|
-
const morphoMidnight = __importStar(require("./morphoMidnight"));
|
|
76
|
-
exports.morphoMidnight = morphoMidnight;
|
|
77
75
|
const llamaLend = __importStar(require("./llamaLend"));
|
|
78
76
|
exports.llamaLend = llamaLend;
|
|
79
77
|
const eulerV2 = __importStar(require("./eulerV2"));
|
package/cjs/markets/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export { CompoundMarkets, compoundV2CollateralAssets, v3ETHCollAssets, v3USDbCCo
|
|
|
3
3
|
export { SparkMarkets } from './spark';
|
|
4
4
|
export { CrvUsdMarkets } from './curveUsd';
|
|
5
5
|
export { MorphoBlueMarkets, findMorphoBlueMarket } from './morphoBlue';
|
|
6
|
-
export { MorphoMidnightMarkets, findMorphoMidnightMarket } from './morphoMidnight';
|
|
7
6
|
export { LlamaLendMarkets } from './llamaLend';
|
|
8
7
|
export { LiquityV2Markets, findLiquityV2MarketByAddress } from './liquityV2';
|
|
9
8
|
export { EulerV2Markets } from './euler';
|
package/cjs/markets/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findAaveV4SpokeByAddress = exports.AaveV4Spokes = exports.getFluidMarketInfoByAddress = exports.getFTokenAddress = exports.getFluidMarketInfoById = exports.getFluidVersionsDataForNetwork = exports.FluidMarkets = exports.EulerV2Markets = exports.findLiquityV2MarketByAddress = exports.LiquityV2Markets = exports.LlamaLendMarkets = exports.
|
|
3
|
+
exports.findAaveV4SpokeByAddress = exports.AaveV4Spokes = exports.getFluidMarketInfoByAddress = exports.getFTokenAddress = exports.getFluidMarketInfoById = exports.getFluidVersionsDataForNetwork = exports.FluidMarkets = exports.EulerV2Markets = exports.findLiquityV2MarketByAddress = exports.LiquityV2Markets = exports.LlamaLendMarkets = exports.findMorphoBlueMarket = exports.MorphoBlueMarkets = exports.CrvUsdMarkets = exports.SparkMarkets = exports.v3USDTCollAssets = exports.v3USDCeCollAssets = exports.v3USDCCollAssets = exports.v3USDbCCollAssets = exports.v3ETHCollAssets = exports.compoundV2CollateralAssets = exports.CompoundMarkets = exports.getAaveV3MarketByMarketAddress = exports.aaveV3AssetsDefaultMarket = exports.aaveV2AssetsDefaultMarket = exports.aaveV1AssetsDefaultMarket = exports.AaveMarkets = void 0;
|
|
4
4
|
var aave_1 = require("./aave");
|
|
5
5
|
Object.defineProperty(exports, "AaveMarkets", { enumerable: true, get: function () { return aave_1.AaveMarkets; } });
|
|
6
6
|
Object.defineProperty(exports, "aaveV1AssetsDefaultMarket", { enumerable: true, get: function () { return aave_1.aaveV1AssetsDefaultMarket; } });
|
|
@@ -22,9 +22,6 @@ Object.defineProperty(exports, "CrvUsdMarkets", { enumerable: true, get: functio
|
|
|
22
22
|
var morphoBlue_1 = require("./morphoBlue");
|
|
23
23
|
Object.defineProperty(exports, "MorphoBlueMarkets", { enumerable: true, get: function () { return morphoBlue_1.MorphoBlueMarkets; } });
|
|
24
24
|
Object.defineProperty(exports, "findMorphoBlueMarket", { enumerable: true, get: function () { return morphoBlue_1.findMorphoBlueMarket; } });
|
|
25
|
-
var morphoMidnight_1 = require("./morphoMidnight");
|
|
26
|
-
Object.defineProperty(exports, "MorphoMidnightMarkets", { enumerable: true, get: function () { return morphoMidnight_1.MorphoMidnightMarkets; } });
|
|
27
|
-
Object.defineProperty(exports, "findMorphoMidnightMarket", { enumerable: true, get: function () { return morphoMidnight_1.findMorphoMidnightMarket; } });
|
|
28
25
|
var llamaLend_1 = require("./llamaLend");
|
|
29
26
|
Object.defineProperty(exports, "LlamaLendMarkets", { enumerable: true, get: function () { return llamaLend_1.LlamaLendMarkets; } });
|
|
30
27
|
var liquityV2_1 = require("./liquityV2");
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { Blockish, EthAddress, EthereumProvider, NetworkNumber, PositionBalances } from '../types/common';
|
|
3
|
-
import { MorphoBlueMarketData, MorphoBlueMarketInfo, MorphoBluePositionData } from '../types';
|
|
3
|
+
import { MorphoBlueEarnData, MorphoBlueMarketData, MorphoBlueMarketInfo, MorphoBlueMarketRewards, MorphoBluePositionData } from '../types';
|
|
4
|
+
export declare const addMorphoBlueRewardsToMarketInfo: (marketInfo: MorphoBlueMarketInfo, rewards: MorphoBlueMarketRewards) => MorphoBlueMarketInfo;
|
|
4
5
|
export declare function _getMorphoBlueMarketData(provider: Client, network: NetworkNumber, selectedMarket: MorphoBlueMarketData): Promise<MorphoBlueMarketInfo>;
|
|
6
|
+
export declare function _getMorphoBluePortfolioMarketData(provider: Client, network: NetworkNumber, selectedMarket: MorphoBlueMarketData): Promise<MorphoBlueMarketInfo>;
|
|
5
7
|
export declare function getMorphoBlueMarketData(provider: EthereumProvider, network: NetworkNumber, selectedMarket: MorphoBlueMarketData): Promise<MorphoBlueMarketInfo>;
|
|
8
|
+
export declare function getMorphoBluePortfolioMarketData(provider: EthereumProvider, network: NetworkNumber, selectedMarket: MorphoBlueMarketData): Promise<MorphoBlueMarketInfo>;
|
|
9
|
+
export declare const getMorphoBluePositionDataWithMarketInfo: (data: MorphoBluePositionData, marketInfo: MorphoBlueMarketInfo) => MorphoBluePositionData;
|
|
10
|
+
export declare const getMorphoEarnDataWithMarketInfo: (data: MorphoBlueEarnData, marketInfo: MorphoBlueMarketInfo) => MorphoBlueEarnData;
|
|
11
|
+
export declare function getMorphoBlueMarketRewards(network: NetworkNumber, selectedMarket: MorphoBlueMarketData): Promise<MorphoBlueMarketRewards>;
|
|
6
12
|
export declare const _getMorphoBlueAccountBalances: (provider: Client, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress, selectedMarket: MorphoBlueMarketData) => Promise<PositionBalances>;
|
|
7
13
|
export declare const getMorphoBlueAccountBalances: (provider: EthereumProvider, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress, selectedMarket: MorphoBlueMarketData) => Promise<PositionBalances>;
|
|
8
14
|
export declare function _getMorphoBlueAccountData(provider: Client, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoBlueMarketData, marketInfo: MorphoBlueMarketInfo): Promise<MorphoBluePositionData>;
|
|
9
15
|
export declare function getMorphoBlueAccountData(provider: EthereumProvider, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoBlueMarketData, marketInfo: MorphoBlueMarketInfo): Promise<MorphoBluePositionData>;
|
|
10
|
-
export declare function getMorphoEarn(provider: Client, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoBlueMarketData, marketInfo: MorphoBlueMarketInfo): Promise<
|
|
11
|
-
apy: string;
|
|
12
|
-
amount: string;
|
|
13
|
-
amountUsd: string;
|
|
14
|
-
}>;
|
|
16
|
+
export declare function getMorphoEarn(provider: Client, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoBlueMarketData, marketInfo: MorphoBlueMarketInfo): Promise<MorphoBlueEarnData>;
|
package/cjs/morphoBlue/index.js
CHANGED
|
@@ -12,9 +12,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getMorphoBlueAccountBalances = exports._getMorphoBlueAccountBalances = void 0;
|
|
15
|
+
exports.getMorphoBlueAccountBalances = exports._getMorphoBlueAccountBalances = exports.getMorphoEarnDataWithMarketInfo = exports.getMorphoBluePositionDataWithMarketInfo = exports.addMorphoBlueRewardsToMarketInfo = void 0;
|
|
16
16
|
exports._getMorphoBlueMarketData = _getMorphoBlueMarketData;
|
|
17
|
+
exports._getMorphoBluePortfolioMarketData = _getMorphoBluePortfolioMarketData;
|
|
17
18
|
exports.getMorphoBlueMarketData = getMorphoBlueMarketData;
|
|
19
|
+
exports.getMorphoBluePortfolioMarketData = getMorphoBluePortfolioMarketData;
|
|
20
|
+
exports.getMorphoBlueMarketRewards = getMorphoBlueMarketRewards;
|
|
18
21
|
exports._getMorphoBlueAccountData = _getMorphoBlueAccountData;
|
|
19
22
|
exports.getMorphoBlueAccountData = getMorphoBlueAccountData;
|
|
20
23
|
exports.getMorphoEarn = getMorphoEarn;
|
|
@@ -29,7 +32,21 @@ const morphoBlueHelpers_1 = require("../helpers/morphoBlueHelpers");
|
|
|
29
32
|
const priceService_1 = require("../services/priceService");
|
|
30
33
|
const viem_1 = require("../services/viem");
|
|
31
34
|
const HARDCODED_USD_STABLE_PRICE = '100000000'; // $1 with 8 decimals
|
|
32
|
-
|
|
35
|
+
const getMorphoRewardIncentives = (apy) => [{
|
|
36
|
+
token: 'MORPHO',
|
|
37
|
+
apy,
|
|
38
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
39
|
+
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
40
|
+
}];
|
|
41
|
+
const addMorphoBlueRewardsToMarketInfo = (marketInfo, rewards) => (Object.assign(Object.assign({}, marketInfo), { assetsData: Object.assign(Object.assign({}, marketInfo.assetsData), { [marketInfo.loanToken]: Object.assign(Object.assign({}, marketInfo.assetsData[marketInfo.loanToken]), { supplyIncentives: [
|
|
42
|
+
...marketInfo.assetsData[marketInfo.loanToken].supplyIncentives.filter(({ token }) => token !== 'MORPHO'),
|
|
43
|
+
...getMorphoRewardIncentives(rewards.supplyApy),
|
|
44
|
+
], borrowIncentives: [
|
|
45
|
+
...marketInfo.assetsData[marketInfo.loanToken].borrowIncentives.filter(({ token }) => token !== 'MORPHO'),
|
|
46
|
+
...getMorphoRewardIncentives(rewards.borrowApy),
|
|
47
|
+
] }) }) }));
|
|
48
|
+
exports.addMorphoBlueRewardsToMarketInfo = addMorphoBlueRewardsToMarketInfo;
|
|
49
|
+
function getMorphoBlueMarketDataInternal(provider, network, selectedMarket) {
|
|
33
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
51
|
const { loanToken, collateralToken, oracle, irm, lltv, oracleType, } = selectedMarket;
|
|
35
52
|
const lltvInWei = new decimal_js_1.default(lltv).mul(constants_1.WAD).toString();
|
|
@@ -61,16 +78,6 @@ function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
|
61
78
|
marketInfo = _marketInfo;
|
|
62
79
|
loanTokenPrice = loanTokenPriceRound[1].toString();
|
|
63
80
|
}
|
|
64
|
-
let morphoSupplyApy = '0';
|
|
65
|
-
let morphoBorrowApy = '0';
|
|
66
|
-
try {
|
|
67
|
-
const { supplyApy: _morphoSupplyApy, borrowApy: _morphoBorrowApy } = yield (0, morphoBlueHelpers_1.getRewardsForMarket)(selectedMarket.marketId, network);
|
|
68
|
-
morphoSupplyApy = _morphoSupplyApy;
|
|
69
|
-
morphoBorrowApy = _morphoBorrowApy;
|
|
70
|
-
}
|
|
71
|
-
catch (e) {
|
|
72
|
-
console.error(e);
|
|
73
|
-
}
|
|
74
81
|
const supplyRate = (0, morphoBlueHelpers_1.getSupplyRate)(marketInfo.totalSupplyAssets.toString(), marketInfo.totalBorrowAssets.toString(), marketInfo.borrowRate.toString(), marketInfo.fee.toString());
|
|
75
82
|
const compoundedBorrowRate = (0, morphoBlueHelpers_1.getBorrowRate)(marketInfo.borrowRate.toString(), marketInfo.totalBorrowShares.toString());
|
|
76
83
|
const utillization = new decimal_js_1.default(marketInfo.totalBorrowAssets.toString()).div(marketInfo.totalSupplyAssets.toString()).mul(100).toString();
|
|
@@ -89,18 +96,8 @@ function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
|
89
96
|
totalBorrow: new decimal_js_1.default(marketInfo.totalBorrowAssets.toString()).div(scale).toString(),
|
|
90
97
|
canBeSupplied: true,
|
|
91
98
|
canBeBorrowed: true,
|
|
92
|
-
supplyIncentives: [
|
|
93
|
-
|
|
94
|
-
apy: morphoSupplyApy,
|
|
95
|
-
incentiveKind: common_1.IncentiveKind.Reward,
|
|
96
|
-
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
97
|
-
}],
|
|
98
|
-
borrowIncentives: [{
|
|
99
|
-
token: 'MORPHO',
|
|
100
|
-
apy: morphoBorrowApy,
|
|
101
|
-
incentiveKind: common_1.IncentiveKind.Reward,
|
|
102
|
-
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
103
|
-
}],
|
|
99
|
+
supplyIncentives: [],
|
|
100
|
+
borrowIncentives: [],
|
|
104
101
|
};
|
|
105
102
|
assetsData[(0, utils_1.wethToEth)(collateralTokenInfo.symbol)] = {
|
|
106
103
|
symbol: (0, utils_1.wethToEth)(collateralTokenInfo.symbol),
|
|
@@ -135,11 +132,56 @@ function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
|
135
132
|
};
|
|
136
133
|
});
|
|
137
134
|
}
|
|
135
|
+
function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
const marketInfo = yield getMorphoBlueMarketDataInternal(provider, network, selectedMarket);
|
|
138
|
+
try {
|
|
139
|
+
const rewards = yield (0, morphoBlueHelpers_1.getRewardsForMarket)(selectedMarket.marketId, network);
|
|
140
|
+
return (0, exports.addMorphoBlueRewardsToMarketInfo)(marketInfo, rewards);
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
console.error(error);
|
|
144
|
+
return (0, exports.addMorphoBlueRewardsToMarketInfo)(marketInfo, { supplyApy: '0', borrowApy: '0' });
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function _getMorphoBluePortfolioMarketData(provider, network, selectedMarket) {
|
|
149
|
+
return getMorphoBlueMarketDataInternal(provider, network, selectedMarket);
|
|
150
|
+
}
|
|
138
151
|
function getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
139
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
140
153
|
return _getMorphoBlueMarketData((0, viem_1.getViemProvider)(provider, network), network, selectedMarket);
|
|
141
154
|
});
|
|
142
155
|
}
|
|
156
|
+
function getMorphoBluePortfolioMarketData(provider, network, selectedMarket) {
|
|
157
|
+
return _getMorphoBluePortfolioMarketData((0, viem_1.getViemProvider)(provider, network), network, selectedMarket);
|
|
158
|
+
}
|
|
159
|
+
const getMorphoBluePositionDataWithMarketInfo = (data, marketInfo) => (Object.assign(Object.assign({}, data), (0, morphoBlueHelpers_1.getMorphoBlueAggregatedPositionData)({
|
|
160
|
+
usedAssets: data.usedAssets,
|
|
161
|
+
assetsData: marketInfo.assetsData,
|
|
162
|
+
marketInfo,
|
|
163
|
+
})));
|
|
164
|
+
exports.getMorphoBluePositionDataWithMarketInfo = getMorphoBluePositionDataWithMarketInfo;
|
|
165
|
+
const getMorphoEarnDataWithMarketInfo = (data, marketInfo) => {
|
|
166
|
+
const loanTokenInfo = marketInfo.assetsData[marketInfo.loanToken];
|
|
167
|
+
const usedAssets = {
|
|
168
|
+
[marketInfo.loanToken]: {
|
|
169
|
+
symbol: loanTokenInfo.symbol,
|
|
170
|
+
supplied: data.amount,
|
|
171
|
+
borrowed: '0',
|
|
172
|
+
isSupplied: new decimal_js_1.default(data.amount).gt(0),
|
|
173
|
+
isBorrowed: false,
|
|
174
|
+
collateral: false,
|
|
175
|
+
suppliedUsd: data.amountUsd,
|
|
176
|
+
borrowedUsd: '0',
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
return Object.assign(Object.assign({}, data), { apy: (0, staking_1.calculateNetApy)({ usedAssets, assetsData: marketInfo.assetsData }).netApy });
|
|
180
|
+
};
|
|
181
|
+
exports.getMorphoEarnDataWithMarketInfo = getMorphoEarnDataWithMarketInfo;
|
|
182
|
+
function getMorphoBlueMarketRewards(network, selectedMarket) {
|
|
183
|
+
return (0, morphoBlueHelpers_1.getRewardsForMarket)(selectedMarket.marketId, network);
|
|
184
|
+
}
|
|
143
185
|
const _getMorphoBlueAccountBalances = (provider, network, block, addressMapping, address, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
186
|
let balances = {
|
|
145
187
|
collateral: {},
|
|
@@ -229,23 +271,10 @@ function getMorphoEarn(provider, network, account, selectedMarket, marketInfo) {
|
|
|
229
271
|
const loanTokenInfo = marketInfo.assetsData[marketInfo.loanToken];
|
|
230
272
|
const loanTokenSupplied = (0, tokens_1.assetAmountInEth)(loanInfo.suppliedInAssets.toString(), marketInfo.loanToken);
|
|
231
273
|
const loanTokenSuppliedUsd = new decimal_js_1.default(loanTokenSupplied).mul(loanTokenInfo.price).toString();
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
symbol: loanTokenInfo.symbol,
|
|
235
|
-
supplied: loanTokenSupplied,
|
|
236
|
-
borrowed: '0',
|
|
237
|
-
isSupplied: new decimal_js_1.default(loanInfo.suppliedInAssets.toString()).gt(0),
|
|
238
|
-
isBorrowed: false,
|
|
239
|
-
collateral: false,
|
|
240
|
-
suppliedUsd: loanTokenSuppliedUsd,
|
|
241
|
-
borrowedUsd: '0',
|
|
242
|
-
},
|
|
243
|
-
};
|
|
244
|
-
const { netApy } = (0, staking_1.calculateNetApy)({ usedAssets, assetsData: marketInfo.assetsData });
|
|
245
|
-
return {
|
|
246
|
-
apy: netApy,
|
|
274
|
+
return (0, exports.getMorphoEarnDataWithMarketInfo)({
|
|
275
|
+
apy: '0',
|
|
247
276
|
amount: loanTokenSupplied,
|
|
248
277
|
amountUsd: loanTokenSuppliedUsd,
|
|
249
|
-
};
|
|
278
|
+
}, marketInfo);
|
|
250
279
|
});
|
|
251
280
|
}
|
|
@@ -24,7 +24,6 @@ const compoundV3_1 = require("../compoundV3");
|
|
|
24
24
|
const curveUsd_1 = require("../curveUsd");
|
|
25
25
|
const llamaLend_1 = require("../llamaLend");
|
|
26
26
|
const morphoBlue_1 = require("../morphoBlue");
|
|
27
|
-
const morphoMidnight_1 = require("../morphoMidnight");
|
|
28
27
|
const contracts_1 = require("../contracts");
|
|
29
28
|
const hasAnyBalance = (balances) => ([balances.collateral, balances.debt].some((group) => Object.values(group || {}).some((amount) => new decimal_js_1.default(amount || '0').gt(0))));
|
|
30
29
|
/**
|
|
@@ -88,9 +87,6 @@ function getUserPositionsExistence(provider_1, network_1, address_1) {
|
|
|
88
87
|
Object.values((0, markets_1.MorphoBlueMarkets)(network)).filter((market) => market.chainIds.includes(network)).forEach((market) => {
|
|
89
88
|
tasks.push(balanceTask(market.value, () => (0, morphoBlue_1._getMorphoBlueAccountBalances)(client, network, block, false, address, market)));
|
|
90
89
|
});
|
|
91
|
-
Object.values((0, markets_1.MorphoMidnightMarkets)(network)).filter((market) => market.chainIds.includes(network)).forEach((market) => {
|
|
92
|
-
tasks.push(balanceTask(market.value, () => (0, morphoMidnight_1._getMorphoMidnightAccountBalances)(client, network, block, false, address, market)));
|
|
93
|
-
});
|
|
94
90
|
yield Promise.all(tasks);
|
|
95
91
|
return existence;
|
|
96
92
|
});
|
package/cjs/portfolio/index.js
CHANGED
|
@@ -31,7 +31,6 @@ const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
|
31
31
|
const common_1 = require("../types/common");
|
|
32
32
|
const markets_1 = require("../markets");
|
|
33
33
|
const morphoBlue_1 = require("../morphoBlue");
|
|
34
|
-
const morphoMidnight_1 = require("../morphoMidnight");
|
|
35
34
|
const types_1 = require("../types");
|
|
36
35
|
const compoundV3_1 = require("../compoundV3");
|
|
37
36
|
const spark_1 = require("../spark");
|
|
@@ -55,12 +54,12 @@ const spark_2 = require("../claiming/spark");
|
|
|
55
54
|
const king_1 = require("../claiming/king");
|
|
56
55
|
const ethena_1 = require("../claiming/ethena");
|
|
57
56
|
const aaveV4_1 = require("../aaveV4");
|
|
57
|
+
const uniswap_1 = require("../claiming/uniswap");
|
|
58
58
|
function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1) {
|
|
59
59
|
return __awaiter(this, arguments, void 0, function* (provider, network, defaultProvider, addresses, isSim = false) {
|
|
60
60
|
const isMainnet = network === common_1.NetworkNumber.Eth;
|
|
61
61
|
const isFluidSupported = [common_1.NetworkNumber.Eth, common_1.NetworkNumber.Arb, common_1.NetworkNumber.Base, common_1.NetworkNumber.Plasma].includes(network);
|
|
62
62
|
const morphoMarkets = Object.values((0, markets_1.MorphoBlueMarkets)(network)).filter((market) => market.chainIds.includes(network));
|
|
63
|
-
const morphoMidnightMarkets = Object.values((0, markets_1.MorphoMidnightMarkets)(network)).filter((market) => market.chainIds.includes(network));
|
|
64
63
|
const compoundV3Markets = Object.values((0, markets_1.CompoundMarkets)(network)).filter((market) => market.chainIds.includes(network) && market.value !== types_1.CompoundVersions.CompoundV2);
|
|
65
64
|
const sparkMarkets = Object.values((0, markets_1.SparkMarkets)(network)).filter((market) => market.chainIds.includes(network));
|
|
66
65
|
const eulerV2Markets = Object.values((0, markets_1.EulerV2Markets)(network)).filter((market) => market.chainIds.includes(network));
|
|
@@ -76,7 +75,6 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
76
75
|
const client = (0, viem_1.getViemProvider)(provider, ...args);
|
|
77
76
|
const defaultClient = (0, viem_1.getViemProvider)(defaultProvider, ...args);
|
|
78
77
|
const morphoMarketsData = {};
|
|
79
|
-
const morphoMidnightMarketsData = {};
|
|
80
78
|
const compoundV3MarketsData = {};
|
|
81
79
|
const sparkMarketsData = {};
|
|
82
80
|
const eulerV2MarketsData = {};
|
|
@@ -90,7 +88,6 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
90
88
|
const aaveV4SpokesData = {};
|
|
91
89
|
const markets = {
|
|
92
90
|
morphoMarketsData,
|
|
93
|
-
morphoMidnightMarketsData,
|
|
94
91
|
compoundV3MarketsData,
|
|
95
92
|
sparkMarketsData,
|
|
96
93
|
eulerV2MarketsData,
|
|
@@ -111,7 +108,6 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
111
108
|
aaveV3: {},
|
|
112
109
|
aaveV4: {},
|
|
113
110
|
morphoBlue: {},
|
|
114
|
-
morphoMidnight: {},
|
|
115
111
|
compoundV3: {},
|
|
116
112
|
spark: {},
|
|
117
113
|
eulerV2: {},
|
|
@@ -132,7 +128,6 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
132
128
|
stakingPositions[address.toLowerCase()] = {
|
|
133
129
|
aaveV3: {},
|
|
134
130
|
morphoBlue: {},
|
|
135
|
-
morphoMidnight: {},
|
|
136
131
|
compoundV3: {},
|
|
137
132
|
spark: {},
|
|
138
133
|
aaveV2: {},
|
|
@@ -157,13 +152,9 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
157
152
|
yield Promise.allSettled([
|
|
158
153
|
// === MARKET DATA (needs to be fetched first) ===
|
|
159
154
|
...morphoMarkets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
const marketData = yield (0, morphoBlue_1.
|
|
155
|
+
const marketData = yield (0, morphoBlue_1._getMorphoBluePortfolioMarketData)(client, network, market);
|
|
161
156
|
morphoMarketsData[market.value] = marketData;
|
|
162
157
|
})),
|
|
163
|
-
...morphoMidnightMarkets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
const marketData = yield (0, morphoMidnight_1._getMorphoMidnightMarketData)(client, network, market);
|
|
165
|
-
morphoMidnightMarketsData[market.value] = marketData;
|
|
166
|
-
})),
|
|
167
158
|
...compoundV3Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
168
159
|
const marketData = yield (0, compoundV3_1._getCompoundV3MarketsData)(client, network, market, defaultClient);
|
|
169
160
|
compoundV3MarketsData[market.value] = marketData;
|
|
@@ -319,6 +310,34 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
319
310
|
}
|
|
320
311
|
}
|
|
321
312
|
}))(),
|
|
313
|
+
// Batch UNI rewards
|
|
314
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
315
|
+
try {
|
|
316
|
+
if (!isMainnet) {
|
|
317
|
+
for (const address of addresses) {
|
|
318
|
+
rewardsData[address.toLowerCase()].uniswap = { error: '', data: [] };
|
|
319
|
+
}
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const uniswapRewards = yield (0, uniswap_1.getUniswapRewards)(client, network, addresses);
|
|
323
|
+
for (const address of addresses) {
|
|
324
|
+
const lowerAddress = address.toLowerCase();
|
|
325
|
+
rewardsData[lowerAddress].uniswap = {
|
|
326
|
+
error: '',
|
|
327
|
+
data: uniswapRewards[lowerAddress] || [],
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
catch (error) {
|
|
332
|
+
console.error('Error fetching Uniswap rewards data in batch:', error);
|
|
333
|
+
for (const address of addresses) {
|
|
334
|
+
rewardsData[address.toLowerCase()].uniswap = {
|
|
335
|
+
error: 'Error fetching Uniswap rewards data in batch',
|
|
336
|
+
data: null,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}))(),
|
|
322
341
|
...sparkMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
323
342
|
try {
|
|
324
343
|
if (!isMainnet) {
|
|
@@ -474,40 +493,6 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
474
493
|
positions[address.toLowerCase()].morphoBlue[market.value] = { error: `Error fetching MorphoBlue account data for address ${address} on market ${market.value}`, data: null };
|
|
475
494
|
}
|
|
476
495
|
}))).flat(),
|
|
477
|
-
...morphoMidnightMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
478
|
-
try {
|
|
479
|
-
const [accDataPromise, earnDataPromise] = yield Promise.allSettled([
|
|
480
|
-
(0, morphoMidnight_1._getMorphoMidnightAccountData)(client, network, address, market, morphoMidnightMarketsData[market.value]),
|
|
481
|
-
(0, morphoMidnight_1.getMorphoMidnightEarn)(client, network, address, market, morphoMidnightMarketsData[market.value]),
|
|
482
|
-
]);
|
|
483
|
-
if (accDataPromise.status === 'rejected') {
|
|
484
|
-
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, accDataPromise.reason);
|
|
485
|
-
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
|
486
|
-
}
|
|
487
|
-
if (earnDataPromise.status === 'rejected') {
|
|
488
|
-
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, earnDataPromise.reason);
|
|
489
|
-
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
|
490
|
-
}
|
|
491
|
-
if (accDataPromise.status !== 'rejected') {
|
|
492
|
-
const accData = accDataPromise.value;
|
|
493
|
-
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
494
|
-
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: '', data: accData };
|
|
495
|
-
}
|
|
496
|
-
if (earnDataPromise.status !== 'rejected') {
|
|
497
|
-
const earnData = earnDataPromise.value;
|
|
498
|
-
if (earnData && new decimal_js_1.default(earnData.amount).gt(0)) {
|
|
499
|
-
stakingPositions[address.toLowerCase()].morphoMidnight[market.value] = {
|
|
500
|
-
error: '',
|
|
501
|
-
data: earnData,
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
catch (error) {
|
|
507
|
-
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, error);
|
|
508
|
-
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
|
509
|
-
}
|
|
510
|
-
}))).flat(),
|
|
511
496
|
...compoundV3Markets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
512
497
|
try {
|
|
513
498
|
const accData = yield (0, compoundV3_1._getCompoundV3AccountData)(client, network, address, constants_1.ZERO_ADDRESS, { selectedMarket: market, assetsData: compoundV3MarketsData[market.value].assetsData });
|