@defisaver/positions-sdk 2.1.160-shifter-v2-dev → 2.1.161-portfolio-api-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/aaveV2/index.js +0 -2
- package/cjs/curveUsd/index.d.ts +2 -5
- package/cjs/curveUsd/index.js +15 -30
- package/cjs/fluid/index.d.ts +0 -5
- package/cjs/fluid/index.js +1 -36
- package/cjs/helpers/aaveHelpers/index.js +0 -3
- package/cjs/helpers/aaveV4Helpers/index.js +0 -1
- package/cjs/helpers/compoundHelpers/index.js +0 -2
- package/cjs/helpers/curveUsdHelpers/index.d.ts +1 -3
- package/cjs/helpers/curveUsdHelpers/index.js +2 -16
- package/cjs/helpers/fluidHelpers/index.js +0 -1
- package/cjs/helpers/liquityV2Helpers/index.js +0 -1
- package/cjs/helpers/llamaLendHelpers/index.js +0 -2
- package/cjs/helpers/makerHelpers/index.d.ts +1 -1
- package/cjs/helpers/makerHelpers/index.js +2 -2
- package/cjs/helpers/morphoBlueHelpers/index.js +0 -2
- package/cjs/helpers/morphoMidnightHelpers/index.js +0 -2
- package/cjs/helpers/sparkHelpers/index.js +0 -1
- package/cjs/liquity/index.js +2 -16
- package/cjs/maker/index.d.ts +2 -7
- package/cjs/maker/index.js +12 -45
- package/cjs/markets/index.d.ts +0 -1
- package/cjs/markets/index.js +1 -3
- package/cjs/portfolio/index.d.ts +1 -5
- package/cjs/portfolio/index.js +7 -277
- package/cjs/staking/staking.d.ts +0 -20
- package/cjs/staking/staking.js +1 -19
- package/cjs/types/aave.d.ts +15 -4
- package/cjs/types/aaveV4.d.ts +0 -1
- package/cjs/types/compound.d.ts +26 -4
- package/cjs/types/curveUsd.d.ts +9 -7
- package/cjs/types/fluid.d.ts +0 -1
- package/cjs/types/liquity.d.ts +0 -4
- package/cjs/types/liquityV2.d.ts +0 -2
- package/cjs/types/llamaLend.d.ts +12 -1
- package/cjs/types/maker.d.ts +0 -4
- package/cjs/types/morphoBlue.d.ts +2 -2
- package/cjs/types/morphoMidnight.d.ts +0 -1
- package/cjs/types/portfolio.d.ts +10 -26
- package/cjs/types/spark.d.ts +21 -3
- package/esm/aaveV2/index.js +0 -2
- package/esm/curveUsd/index.d.ts +2 -5
- package/esm/curveUsd/index.js +15 -30
- package/esm/fluid/index.d.ts +0 -5
- package/esm/fluid/index.js +0 -33
- package/esm/helpers/aaveHelpers/index.js +0 -3
- package/esm/helpers/aaveV4Helpers/index.js +0 -1
- package/esm/helpers/compoundHelpers/index.js +0 -2
- package/esm/helpers/curveUsdHelpers/index.d.ts +1 -3
- package/esm/helpers/curveUsdHelpers/index.js +2 -16
- package/esm/helpers/fluidHelpers/index.js +0 -1
- package/esm/helpers/liquityV2Helpers/index.js +0 -1
- package/esm/helpers/llamaLendHelpers/index.js +0 -2
- package/esm/helpers/makerHelpers/index.d.ts +1 -1
- package/esm/helpers/makerHelpers/index.js +2 -2
- package/esm/helpers/morphoBlueHelpers/index.js +0 -2
- package/esm/helpers/morphoMidnightHelpers/index.js +0 -2
- package/esm/helpers/sparkHelpers/index.js +0 -1
- package/esm/liquity/index.js +2 -16
- package/esm/maker/index.d.ts +2 -7
- package/esm/maker/index.js +13 -44
- package/esm/markets/index.d.ts +0 -1
- package/esm/markets/index.js +0 -1
- package/esm/portfolio/index.d.ts +1 -5
- package/esm/portfolio/index.js +10 -279
- package/esm/staking/staking.d.ts +0 -20
- package/esm/staking/staking.js +0 -17
- package/esm/types/aave.d.ts +15 -4
- package/esm/types/aaveV4.d.ts +0 -1
- package/esm/types/compound.d.ts +26 -4
- package/esm/types/curveUsd.d.ts +9 -7
- package/esm/types/fluid.d.ts +0 -1
- package/esm/types/liquity.d.ts +0 -4
- package/esm/types/liquityV2.d.ts +0 -2
- package/esm/types/llamaLend.d.ts +12 -1
- package/esm/types/maker.d.ts +0 -4
- package/esm/types/morphoBlue.d.ts +2 -2
- package/esm/types/morphoMidnight.d.ts +0 -1
- package/esm/types/portfolio.d.ts +10 -26
- package/esm/types/spark.d.ts +21 -3
- package/package.json +1 -1
- package/src/aaveV2/index.ts +0 -2
- package/src/curveUsd/index.ts +16 -33
- package/src/fluid/index.ts +0 -40
- package/src/helpers/aaveHelpers/index.ts +0 -3
- package/src/helpers/aaveV4Helpers/index.ts +0 -1
- package/src/helpers/compoundHelpers/index.ts +0 -2
- package/src/helpers/curveUsdHelpers/index.ts +2 -23
- package/src/helpers/fluidHelpers/index.ts +0 -1
- package/src/helpers/liquityV2Helpers/index.ts +0 -1
- package/src/helpers/llamaLendHelpers/index.ts +0 -2
- package/src/helpers/makerHelpers/index.ts +1 -2
- package/src/helpers/morphoBlueHelpers/index.ts +0 -2
- package/src/helpers/morphoMidnightHelpers/index.ts +0 -2
- package/src/helpers/sparkHelpers/index.ts +0 -1
- package/src/liquity/index.ts +2 -17
- package/src/maker/index.ts +29 -77
- package/src/markets/index.ts +1 -2
- package/src/portfolio/index.ts +8 -261
- package/src/staking/staking.ts +0 -28
- package/src/types/aave.ts +18 -4
- package/src/types/aaveV4.ts +0 -1
- package/src/types/compound.ts +38 -4
- package/src/types/curveUsd.ts +17 -8
- package/src/types/fluid.ts +0 -1
- package/src/types/liquity.ts +0 -6
- package/src/types/liquityV2.ts +0 -2
- package/src/types/llamaLend.ts +19 -1
- package/src/types/maker.ts +0 -6
- package/src/types/morphoBlue.ts +3 -2
- package/src/types/morphoMidnight.ts +0 -1
- package/src/types/portfolio.ts +12 -31
- package/src/types/spark.ts +25 -3
- package/cjs/markets/maker/index.d.ts +0 -1
- package/cjs/markets/maker/index.js +0 -13
- package/esm/markets/maker/index.d.ts +0 -1
- package/esm/markets/maker/index.js +0 -10
- package/src/markets/maker/index.ts +0 -10
package/cjs/portfolio/index.js
CHANGED
|
@@ -27,7 +27,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.getPortfolioData = getPortfolioData;
|
|
30
|
-
exports.getShifterPortfolioData = getShifterPortfolioData;
|
|
31
30
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
32
31
|
const common_1 = require("../types/common");
|
|
33
32
|
const markets_1 = require("../markets");
|
|
@@ -522,9 +521,11 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
522
521
|
positions[address.toLowerCase()].spark[market.value] = { error: `Error fetching Spark account data for address ${address} on market ${market.value}`, data: null };
|
|
523
522
|
}
|
|
524
523
|
}))).flat(),
|
|
525
|
-
|
|
524
|
+
// flatMap, not map: each CDP's fetch has to be one of the awaited promises, or getPortfolioData can return
|
|
525
|
+
// before a vault's data lands and the vault is missing from the result.
|
|
526
|
+
...addresses.flatMap((address) => {
|
|
526
527
|
var _a;
|
|
527
|
-
return (_a = makerCdps[address.toLowerCase()])
|
|
528
|
+
return ((_a = makerCdps[address.toLowerCase()]) !== null && _a !== void 0 ? _a : []).map((cdpInfo) => __awaiter(this, void 0, void 0, function* () {
|
|
528
529
|
try {
|
|
529
530
|
const cdpData = yield (0, maker_1._getMakerCdpData)(client, network, cdpInfo);
|
|
530
531
|
if (cdpData) {
|
|
@@ -536,7 +537,7 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
536
537
|
positions[address.toLowerCase()].maker[cdpInfo.id] = { error: `Error fetching Maker CDP data for address ${address} with ID ${cdpInfo.id}`, data: null };
|
|
537
538
|
}
|
|
538
539
|
}));
|
|
539
|
-
})
|
|
540
|
+
}),
|
|
540
541
|
...aaveV2Markets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
541
542
|
try {
|
|
542
543
|
const accData = yield (0, aaveV2_1._getAaveV2AccountData)(client, network, address, aaveV2MarketsData[market.value].assetsData, market);
|
|
@@ -574,9 +575,9 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
574
575
|
})),
|
|
575
576
|
...crvUsdMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
576
577
|
try {
|
|
577
|
-
const accData = yield (0, curveUsd_1._getCurveUsdUserData)(client, network, address, market, crvUsdMarketsData[market.value].activeBand
|
|
578
|
+
const accData = yield (0, curveUsd_1._getCurveUsdUserData)(client, network, address, market, crvUsdMarketsData[market.value].activeBand);
|
|
578
579
|
if (new decimal_js_1.default(accData.suppliedUsd).gt(0) || new decimal_js_1.default(accData.borrowedUsd).gt(0)) {
|
|
579
|
-
positions[address.toLowerCase()].crvUsd[market.value] = { error: '', data: accData };
|
|
580
|
+
positions[address.toLowerCase()].crvUsd[market.value] = { error: '', data: Object.assign(Object.assign({}, accData), { borrowRate: crvUsdMarketsData[market.value].borrowRate }) };
|
|
580
581
|
}
|
|
581
582
|
}
|
|
582
583
|
catch (error) {
|
|
@@ -620,275 +621,4 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
620
621
|
};
|
|
621
622
|
});
|
|
622
623
|
}
|
|
623
|
-
function getShifterPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1) {
|
|
624
|
-
return __awaiter(this, arguments, void 0, function* (provider, network, defaultProvider, addresses, isSim = false) {
|
|
625
|
-
const isMainnet = network === common_1.NetworkNumber.Eth;
|
|
626
|
-
const isFluidSupported = [common_1.NetworkNumber.Eth, common_1.NetworkNumber.Arb, common_1.NetworkNumber.Base, common_1.NetworkNumber.Plasma].includes(network);
|
|
627
|
-
const morphoMarkets = Object.values((0, markets_1.MorphoBlueMarkets)(network)).filter((market) => market.chainIds.includes(network));
|
|
628
|
-
const compoundV3Markets = Object.values((0, markets_1.CompoundMarkets)(network)).filter((market) => market.chainIds.includes(network) && market.value !== types_1.CompoundVersions.CompoundV2);
|
|
629
|
-
const sparkMarkets = Object.values((0, markets_1.SparkMarkets)(network)).filter((market) => market.chainIds.includes(network));
|
|
630
|
-
const aaveV3Markets = [types_1.AaveVersions.AaveV3, types_1.AaveVersions.AaveV3Lido, types_1.AaveVersions.AaveV3Etherfi].map((version) => (0, markets_1.AaveMarkets)(network)[version]).filter((market) => market.chainIds.includes(network));
|
|
631
|
-
const aaveV2Markets = [types_1.AaveVersions.AaveV2].map((version) => (0, markets_1.AaveMarkets)(network)[version]).filter((market) => market.chainIds.includes(network));
|
|
632
|
-
const compoundV2Markets = [types_1.CompoundVersions.CompoundV2].map((version) => (0, markets_1.CompoundMarkets)(network)[version]).filter((market) => market.chainIds.includes(network));
|
|
633
|
-
const crvUsdMarkets = Object.values((0, markets_1.CrvUsdMarkets)(network)).filter((market) => market.chainIds.includes(network));
|
|
634
|
-
const llamaLendMarkets = [common_1.NetworkNumber.Eth, common_1.NetworkNumber.Arb].includes(network) ? Object.values((0, markets_1.LlamaLendMarkets)(network)).filter((market) => market.chainIds.includes(network)) : [];
|
|
635
|
-
const liquityV2Markets = [common_1.NetworkNumber.Eth].includes(network) ? Object.values((0, markets_1.LiquityV2Markets)(network)) : [];
|
|
636
|
-
const aaveV4Spokes = Object.values((0, markets_1.AaveV4Spokes)(network)).filter((market) => market.chainIds.includes(network));
|
|
637
|
-
const args = [network, { batch: { multicall: { batchSize: isSim ? 2000 : 2500000 } } }];
|
|
638
|
-
const client = (0, viem_1.getViemProvider)(provider, ...args);
|
|
639
|
-
const defaultClient = (0, viem_1.getViemProvider)(defaultProvider, ...args);
|
|
640
|
-
const markets = {
|
|
641
|
-
morphoMarketsData: {},
|
|
642
|
-
morphoMidnightMarketsData: {}, // Morpho Midnight is not fetched for the shifter; key kept so the payload shape is stable
|
|
643
|
-
compoundV3MarketsData: {},
|
|
644
|
-
sparkMarketsData: {},
|
|
645
|
-
aaveV3MarketsData: {},
|
|
646
|
-
aaveV2MarketsData: {},
|
|
647
|
-
compoundV2MarketsData: {},
|
|
648
|
-
crvUsdMarketsData: {},
|
|
649
|
-
llamaLendMarketsData: {},
|
|
650
|
-
liquityV2MarketsData: {},
|
|
651
|
-
aaveV4SpokesData: {},
|
|
652
|
-
fluidMarketsData: {},
|
|
653
|
-
makerMarketsData: {},
|
|
654
|
-
};
|
|
655
|
-
const makerCdps = {};
|
|
656
|
-
const positions = {};
|
|
657
|
-
for (const address of addresses) {
|
|
658
|
-
positions[address.toLowerCase()] = {
|
|
659
|
-
aaveV3: {},
|
|
660
|
-
aaveV4: {},
|
|
661
|
-
morphoBlue: {},
|
|
662
|
-
morphoMidnight: {}, // not fetched for the shifter (see markets above)
|
|
663
|
-
compoundV3: {},
|
|
664
|
-
spark: {},
|
|
665
|
-
maker: {},
|
|
666
|
-
aaveV2: {},
|
|
667
|
-
compoundV2: {},
|
|
668
|
-
liquity: {},
|
|
669
|
-
crvUsd: {},
|
|
670
|
-
llamaLend: {},
|
|
671
|
-
fluid: {
|
|
672
|
-
error: '',
|
|
673
|
-
data: {},
|
|
674
|
-
},
|
|
675
|
-
};
|
|
676
|
-
}
|
|
677
|
-
yield Promise.allSettled([
|
|
678
|
-
// === MARKET DATA (needs to be fetched first) ===
|
|
679
|
-
...morphoMarkets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
680
|
-
markets.morphoMarketsData[market.value] = yield (0, morphoBlue_1._getMorphoBluePortfolioMarketData)(client, network, market);
|
|
681
|
-
})),
|
|
682
|
-
...compoundV3Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
683
|
-
markets.compoundV3MarketsData[market.value] = yield (0, compoundV3_1._getCompoundV3MarketsData)(client, network, market, defaultClient);
|
|
684
|
-
})),
|
|
685
|
-
...sparkMarkets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
686
|
-
markets.sparkMarketsData[market.value] = yield (0, spark_1._getSparkMarketsData)(client, network, market);
|
|
687
|
-
})),
|
|
688
|
-
...aaveV3Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
689
|
-
markets.aaveV3MarketsData[market.value] = yield (0, aaveV3_1._getAaveV3MarketData)(client, network, market);
|
|
690
|
-
})),
|
|
691
|
-
...aaveV4Spokes.map((spoke) => __awaiter(this, void 0, void 0, function* () {
|
|
692
|
-
markets.aaveV4SpokesData[spoke.value] = yield (0, aaveV4_1._getAaveV4SpokeData)(client, network, spoke);
|
|
693
|
-
})),
|
|
694
|
-
...aaveV2Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
695
|
-
markets.aaveV2MarketsData[market.value] = yield (0, aaveV2_1._getAaveV2MarketsData)(client, network, market);
|
|
696
|
-
})),
|
|
697
|
-
...compoundV2Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
698
|
-
markets.compoundV2MarketsData[market.value] = yield (0, compoundV2_1._getCompoundV2MarketsData)(client, network);
|
|
699
|
-
})),
|
|
700
|
-
...crvUsdMarkets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
701
|
-
markets.crvUsdMarketsData[market.value] = yield (0, curveUsd_1._getCurveUsdGlobalData)(client, network, market);
|
|
702
|
-
})),
|
|
703
|
-
...llamaLendMarkets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
704
|
-
markets.llamaLendMarketsData[market.value] = yield (0, llamaLend_1._getLlamaLendGlobalData)(client, network, market);
|
|
705
|
-
})),
|
|
706
|
-
...liquityV2Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
707
|
-
markets.liquityV2MarketsData[market.value] = yield (0, liquityV2_1._getLiquityV2MarketData)(client, network, market);
|
|
708
|
-
})),
|
|
709
|
-
(() => __awaiter(this, void 0, void 0, function* () {
|
|
710
|
-
if (!isFluidSupported)
|
|
711
|
-
return;
|
|
712
|
-
try {
|
|
713
|
-
markets.fluidMarketsData = yield (0, fluid_1._getAllFluidMarketDataPortfolio)(client, network);
|
|
714
|
-
}
|
|
715
|
-
catch (error) {
|
|
716
|
-
console.error('Error fetching Fluid markets data:', error);
|
|
717
|
-
}
|
|
718
|
-
}))(),
|
|
719
|
-
(() => __awaiter(this, void 0, void 0, function* () {
|
|
720
|
-
if (!isMainnet)
|
|
721
|
-
return; // Maker CDPs are only available on mainnet
|
|
722
|
-
try {
|
|
723
|
-
markets.makerMarketsData = yield (0, maker_1._getMakerIlksData)(client, network, markets_1.MakerActiveIlks);
|
|
724
|
-
}
|
|
725
|
-
catch (error) {
|
|
726
|
-
console.error('Error fetching Maker ilks data:', error);
|
|
727
|
-
}
|
|
728
|
-
}))(),
|
|
729
|
-
// === INDEPENDENT USER DATA (doesn't depend on market data) ===
|
|
730
|
-
...addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
731
|
-
if (!isMainnet)
|
|
732
|
-
return; // Maker CDPs are only available on mainnet
|
|
733
|
-
const makerCdp = yield (0, maker_1._getUserCdps)(client, network, address);
|
|
734
|
-
makerCdps[address.toLowerCase()] = makerCdp;
|
|
735
|
-
})),
|
|
736
|
-
...addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
737
|
-
try {
|
|
738
|
-
if (!isFluidSupported)
|
|
739
|
-
return; // Fluid is not available on Optimism
|
|
740
|
-
const userPositions = (yield (0, fluid_1._getUserPositionsPortfolio)(client, network, address));
|
|
741
|
-
for (const position of userPositions) {
|
|
742
|
-
if (position.userData && new decimal_js_1.default(position.userData.suppliedUsd).gt(0)) {
|
|
743
|
-
positions[address.toLowerCase()].fluid.data[position.userData.nftId] = position.userData;
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
catch (error) {
|
|
748
|
-
console.error(`Error fetching Fluid positions for address ${address}:`, error);
|
|
749
|
-
positions[address.toLowerCase()].fluid = {
|
|
750
|
-
error: `Error fetching Fluid positions for address ${address}`,
|
|
751
|
-
data: {},
|
|
752
|
-
};
|
|
753
|
-
}
|
|
754
|
-
})),
|
|
755
|
-
]);
|
|
756
|
-
yield Promise.all([
|
|
757
|
-
...aaveV3Markets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
758
|
-
try {
|
|
759
|
-
const accData = yield (0, aaveV3_1._getAaveV3AccountData)(client, network, address, Object.assign({ selectedMarket: market }, markets.aaveV3MarketsData[market.value]));
|
|
760
|
-
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
761
|
-
positions[address.toLowerCase()].aaveV3[market.value] = { error: '', data: accData };
|
|
762
|
-
}
|
|
763
|
-
catch (error) {
|
|
764
|
-
console.error(`Error fetching AaveV3 account data for address ${address} on market ${market.value}:`, error);
|
|
765
|
-
positions[address.toLowerCase()].aaveV3[market.value] = { error: `Error fetching AaveV3 account data for address ${address} on market ${market.value}`, data: null };
|
|
766
|
-
}
|
|
767
|
-
}))).flat(),
|
|
768
|
-
...aaveV4Spokes.map((spoke) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
769
|
-
try {
|
|
770
|
-
const accData = yield (0, aaveV4_1._getAaveV4AccountData)(client, network, markets.aaveV4SpokesData[spoke.value], address);
|
|
771
|
-
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
772
|
-
positions[address.toLowerCase()].aaveV4[spoke.value] = { error: '', data: accData };
|
|
773
|
-
}
|
|
774
|
-
catch (error) {
|
|
775
|
-
console.error(`Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}:`, error);
|
|
776
|
-
positions[address.toLowerCase()].aaveV4[spoke.value] = { error: `Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}`, data: null };
|
|
777
|
-
}
|
|
778
|
-
}))).flat(),
|
|
779
|
-
...morphoMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
780
|
-
try {
|
|
781
|
-
const accData = yield (0, morphoBlue_1._getMorphoBlueAccountData)(client, network, address, market, markets.morphoMarketsData[market.value]);
|
|
782
|
-
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
783
|
-
positions[address.toLowerCase()].morphoBlue[market.value] = { error: '', data: accData };
|
|
784
|
-
}
|
|
785
|
-
catch (error) {
|
|
786
|
-
console.error(`Error fetching MorphoBlue account data for address ${address} on market ${market.value}:`, error);
|
|
787
|
-
positions[address.toLowerCase()].morphoBlue[market.value] = { error: `Error fetching MorphoBlue account data for address ${address} on market ${market.value}`, data: null };
|
|
788
|
-
}
|
|
789
|
-
}))).flat(),
|
|
790
|
-
...compoundV3Markets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
791
|
-
try {
|
|
792
|
-
const accData = yield (0, compoundV3_1._getCompoundV3AccountData)(client, network, address, constants_1.ZERO_ADDRESS, { selectedMarket: market, assetsData: markets.compoundV3MarketsData[market.value].assetsData });
|
|
793
|
-
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
794
|
-
positions[address.toLowerCase()].compoundV3[market.value] = { error: '', data: accData };
|
|
795
|
-
}
|
|
796
|
-
catch (error) {
|
|
797
|
-
console.error(`Error fetching CompoundV3 account data for address ${address} on market ${market.value}:`, error);
|
|
798
|
-
positions[address.toLowerCase()].compoundV3[market.value] = { error: `Error fetching CompoundV3 account data for address ${address} on market ${market.value}`, data: null };
|
|
799
|
-
}
|
|
800
|
-
}))).flat(),
|
|
801
|
-
...sparkMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
802
|
-
try {
|
|
803
|
-
const accData = yield (0, spark_1._getSparkAccountData)(client, network, address, { selectedMarket: market, assetsData: markets.sparkMarketsData[market.value].assetsData, eModeCategoriesData: markets.sparkMarketsData[market.value].eModeCategoriesData });
|
|
804
|
-
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
805
|
-
positions[address.toLowerCase()].spark[market.value] = { error: '', data: accData };
|
|
806
|
-
}
|
|
807
|
-
catch (error) {
|
|
808
|
-
console.error(`Error fetching Spark account data for address ${address} on market ${market.value}:`, error);
|
|
809
|
-
positions[address.toLowerCase()].spark[market.value] = { error: `Error fetching Spark account data for address ${address} on market ${market.value}`, data: null };
|
|
810
|
-
}
|
|
811
|
-
}))).flat(),
|
|
812
|
-
...addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
813
|
-
var _a;
|
|
814
|
-
return (_a = makerCdps[address.toLowerCase()]) === null || _a === void 0 ? void 0 : _a.map((cdpInfo) => __awaiter(this, void 0, void 0, function* () {
|
|
815
|
-
try {
|
|
816
|
-
// reuse ilk data fetched for the markets payload; ilks outside the active set are fetched on demand
|
|
817
|
-
const cdpData = yield (0, maker_1._getMakerCdpData)(client, network, cdpInfo, markets.makerMarketsData[cdpInfo.ilkLabel]);
|
|
818
|
-
if (cdpData) {
|
|
819
|
-
positions[address.toLowerCase()].maker[cdpInfo.id] = { error: '', data: cdpData };
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
catch (error) {
|
|
823
|
-
console.error(`Error fetching Maker CDP data for address ${address} with ID ${cdpInfo.id}:`, error);
|
|
824
|
-
positions[address.toLowerCase()].maker[cdpInfo.id] = { error: `Error fetching Maker CDP data for address ${address} with ID ${cdpInfo.id}`, data: null };
|
|
825
|
-
}
|
|
826
|
-
}));
|
|
827
|
-
})).flat(),
|
|
828
|
-
...aaveV2Markets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
829
|
-
try {
|
|
830
|
-
const accData = yield (0, aaveV2_1._getAaveV2AccountData)(client, network, address, markets.aaveV2MarketsData[market.value].assetsData, market);
|
|
831
|
-
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
832
|
-
positions[address.toLowerCase()].aaveV2[market.value] = { error: '', data: accData };
|
|
833
|
-
}
|
|
834
|
-
catch (error) {
|
|
835
|
-
console.error(`Error fetching AaveV2 account data for address ${address}:`, error);
|
|
836
|
-
positions[address.toLowerCase()].aaveV2[market.value] = { error: `Error fetching AaveV2 account data for address ${address}`, data: null };
|
|
837
|
-
}
|
|
838
|
-
}))).flat(),
|
|
839
|
-
...compoundV2Markets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
840
|
-
try {
|
|
841
|
-
const accData = yield (0, compoundV2_1._getCompoundV2AccountData)(client, network, address, markets.compoundV2MarketsData[market.value].assetsData);
|
|
842
|
-
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
843
|
-
positions[address.toLowerCase()].compoundV2[market.value] = { error: '', data: accData };
|
|
844
|
-
}
|
|
845
|
-
catch (error) {
|
|
846
|
-
console.error(`Error fetching CompoundV2 account data for address ${address}:`, error);
|
|
847
|
-
positions[address.toLowerCase()].compoundV2[market.value] = { error: `Error fetching CompoundV2 account data for address ${address}`, data: null };
|
|
848
|
-
}
|
|
849
|
-
}))).flat(),
|
|
850
|
-
...addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
851
|
-
try {
|
|
852
|
-
if (!isMainnet)
|
|
853
|
-
return; // Liquity trove info is only available on mainnet
|
|
854
|
-
const troveInfo = yield (0, liquity_1._getLiquityTroveInfo)(client, network, address);
|
|
855
|
-
if (new decimal_js_1.default(troveInfo.collateral).gt(0))
|
|
856
|
-
positions[address.toLowerCase()].liquity = { error: '', data: troveInfo };
|
|
857
|
-
}
|
|
858
|
-
catch (error) {
|
|
859
|
-
console.error(`Error fetching Liquity trove info for address ${address}:`, error);
|
|
860
|
-
positions[address.toLowerCase()].liquity = { error: `Error fetching Liquity trove info for address ${address}`, data: null };
|
|
861
|
-
}
|
|
862
|
-
})),
|
|
863
|
-
...crvUsdMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
864
|
-
try {
|
|
865
|
-
const accData = yield (0, curveUsd_1._getCurveUsdUserData)(client, network, address, market, markets.crvUsdMarketsData[market.value].activeBand, markets.crvUsdMarketsData[market.value].borrowRate);
|
|
866
|
-
if (new decimal_js_1.default(accData.suppliedUsd).gt(0) || new decimal_js_1.default(accData.borrowedUsd).gt(0)) {
|
|
867
|
-
positions[address.toLowerCase()].crvUsd[market.value] = { error: '', data: accData };
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
catch (error) {
|
|
871
|
-
console.error(`Error fetching Curve USD account data for address ${address} on market ${market.value}:`, error);
|
|
872
|
-
positions[address.toLowerCase()].crvUsd[market.value] = { error: `Error fetching Curve USD account data for address ${address} on market ${market.value}`, data: null };
|
|
873
|
-
}
|
|
874
|
-
}))).flat(),
|
|
875
|
-
...llamaLendMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
876
|
-
try {
|
|
877
|
-
const accData = yield (0, llamaLend_1._getLlamaLendUserData)(client, network, address, market, markets.llamaLendMarketsData[market.value]);
|
|
878
|
-
if (new decimal_js_1.default(accData.suppliedUsd).gt(0) || new decimal_js_1.default(accData.borrowedUsd).gt(0)) {
|
|
879
|
-
positions[address.toLowerCase()].llamaLend[market.value] = { error: '', data: Object.assign(Object.assign({}, accData), { borrowRate: markets.llamaLendMarketsData[market.value].borrowRate }) };
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
catch (error) {
|
|
883
|
-
console.error(`Error fetching LlamaLend account data for address ${address} on market ${market.value}:`, error);
|
|
884
|
-
positions[address.toLowerCase()].llamaLend[market.value] = { error: `Error fetching LlamaLend account data for address ${address} on market ${market.value}`, data: null };
|
|
885
|
-
}
|
|
886
|
-
}))).flat(),
|
|
887
|
-
]);
|
|
888
|
-
return {
|
|
889
|
-
positions,
|
|
890
|
-
markets,
|
|
891
|
-
};
|
|
892
|
-
});
|
|
893
|
-
}
|
|
894
624
|
__exportStar(require("./discovery"), exports);
|
package/cjs/staking/staking.d.ts
CHANGED
|
@@ -3,26 +3,6 @@ import { MMAssetsData, MMUsedAssets } from '../types/common';
|
|
|
3
3
|
export declare const STAKING_ASSETS: string[];
|
|
4
4
|
export declare const getStakingApy: ((asset: string, network?: number) => Promise<string>) & memoize.Memoized<(asset: string, network?: number) => Promise<string>>;
|
|
5
5
|
export declare const calculateInterestEarned: (principal: string, interest: string, type: string, apy?: boolean) => number;
|
|
6
|
-
/**
|
|
7
|
-
* Net APY for positions that have a single known borrow rate (and optionally a single supply rate)
|
|
8
|
-
* instead of per-asset `assetsData` to feed into `calculateNetApy` (Maker, crvUSD, Liquity v1).
|
|
9
|
-
* All rates are yearly percentages that are already compounded. `incentives` are extra yields
|
|
10
|
-
* (e.g. the native staking yield of the collateral) applied to their own USD base and summed into `incentiveUsd`.
|
|
11
|
-
*/
|
|
12
|
-
export declare const calculateNetApyFromRates: ({ suppliedUsd, borrowedUsd, supplyRate, borrowRate, incentives, }: {
|
|
13
|
-
suppliedUsd: string;
|
|
14
|
-
borrowedUsd: string;
|
|
15
|
-
supplyRate?: string;
|
|
16
|
-
borrowRate?: string;
|
|
17
|
-
incentives?: {
|
|
18
|
-
apy: string;
|
|
19
|
-
amountUsd: string;
|
|
20
|
-
}[];
|
|
21
|
-
}) => {
|
|
22
|
-
netApy: string;
|
|
23
|
-
totalInterestUsd: string;
|
|
24
|
-
incentiveUsd: string;
|
|
25
|
-
};
|
|
26
6
|
export declare const calculateNetApy: ({ usedAssets, assetsData, optionalData, }: {
|
|
27
7
|
usedAssets: MMUsedAssets;
|
|
28
8
|
assetsData: MMAssetsData;
|
package/cjs/staking/staking.js
CHANGED
|
@@ -12,7 +12,7 @@ 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.calculateNetApy = exports.
|
|
15
|
+
exports.calculateNetApy = exports.calculateInterestEarned = exports.getStakingApy = exports.STAKING_ASSETS = void 0;
|
|
16
16
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
17
17
|
const memoizee_1 = __importDefault(require("memoizee"));
|
|
18
18
|
const common_1 = require("../types/common");
|
|
@@ -189,24 +189,6 @@ const calculateInterestEarned = (principal, interest, type, apy = false) => {
|
|
|
189
189
|
return (+principal * (Math.pow(((1 + (+interest / 100) / constants_1.BLOCKS_IN_A_YEAR)), (constants_1.BLOCKS_IN_A_YEAR * interval)))) - +principal; // eslint-disable-line
|
|
190
190
|
};
|
|
191
191
|
exports.calculateInterestEarned = calculateInterestEarned;
|
|
192
|
-
/**
|
|
193
|
-
* Net APY for positions that have a single known borrow rate (and optionally a single supply rate)
|
|
194
|
-
* instead of per-asset `assetsData` to feed into `calculateNetApy` (Maker, crvUSD, Liquity v1).
|
|
195
|
-
* All rates are yearly percentages that are already compounded. `incentives` are extra yields
|
|
196
|
-
* (e.g. the native staking yield of the collateral) applied to their own USD base and summed into `incentiveUsd`.
|
|
197
|
-
*/
|
|
198
|
-
const calculateNetApyFromRates = ({ suppliedUsd, borrowedUsd, supplyRate = '0', borrowRate = '0', incentives = [], }) => {
|
|
199
|
-
const supplyInterest = new decimal_js_1.default((0, exports.calculateInterestEarned)(suppliedUsd, supplyRate, 'year', true));
|
|
200
|
-
const borrowInterest = new decimal_js_1.default((0, exports.calculateInterestEarned)(borrowedUsd, borrowRate, 'year', true));
|
|
201
|
-
const incentiveUsd = incentives
|
|
202
|
-
.reduce((acc, { apy, amountUsd }) => acc.add((0, exports.calculateInterestEarned)(amountUsd, apy, 'year', true)), new decimal_js_1.default(0))
|
|
203
|
-
.toString();
|
|
204
|
-
const totalInterestUsd = supplyInterest.sub(borrowInterest).add(incentiveUsd).toString();
|
|
205
|
-
const balance = new decimal_js_1.default(suppliedUsd).sub(borrowedUsd);
|
|
206
|
-
const netApy = balance.isZero() ? '0' : new decimal_js_1.default(totalInterestUsd).div(balance).times(100).toString();
|
|
207
|
-
return { netApy, totalInterestUsd, incentiveUsd };
|
|
208
|
-
};
|
|
209
|
-
exports.calculateNetApyFromRates = calculateNetApyFromRates;
|
|
210
192
|
const calculateNetApy = ({ usedAssets, assetsData, optionalData, }) => {
|
|
211
193
|
const sumValues = Object.values(usedAssets).reduce((_acc, usedAsset) => {
|
|
212
194
|
const acc = Object.assign({}, _acc);
|
package/cjs/types/aave.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IncentiveData, LeverageType, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
|
|
1
|
+
import { EthAddress, IncentiveData, LeverageType, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
|
|
2
2
|
export declare enum AaveVersions {
|
|
3
3
|
AaveV1 = "v1",
|
|
4
4
|
AaveV2 = "v2default",
|
|
@@ -84,6 +84,8 @@ export interface AaveV3AssetData extends AaveAssetData {
|
|
|
84
84
|
liquidationBonus: string;
|
|
85
85
|
supplyIncentives: IncentiveData[];
|
|
86
86
|
borrowIncentives: IncentiveData[];
|
|
87
|
+
aTokenAddress?: EthAddress;
|
|
88
|
+
vTokenAddress?: EthAddress;
|
|
87
89
|
}
|
|
88
90
|
export type EModeCategoriesData = Record<number, EModeCategoryData>;
|
|
89
91
|
export type AaveAssetsData<T> = {
|
|
@@ -121,12 +123,16 @@ export type AaveUsedAssets<T> = {
|
|
|
121
123
|
};
|
|
122
124
|
export type AaveV2UsedAssets = AaveUsedAssets<AaveV2UsedAsset>;
|
|
123
125
|
export type AaveV3UsedAssets = AaveUsedAssets<AaveV3UsedAsset>;
|
|
124
|
-
|
|
126
|
+
/**
|
|
127
|
+
* Fields aaveAnyGetAggregatedPositionData adds to every Aave V2/V3 position at runtime, on top of those declared
|
|
128
|
+
* below. Optional, so code that builds a position by hand keeps compiling.
|
|
129
|
+
*/
|
|
130
|
+
export type AavePositionAggregatedFields = Partial<Omit<AaveV3AggregatedPositionData, keyof MMPositionData | 'ratio' | 'collRatio' | 'safetyRatioWithLtvZeroFallback' | 'suppliedUsd' | 'borrowedUsd' | 'borrowLimitUsd' | 'suppliedCollateralUsd' | 'incentiveUsd' | 'totalInterestUsd'>>;
|
|
131
|
+
export interface AavePositionData extends MMPositionData, AavePositionAggregatedFields {
|
|
125
132
|
ratio: string;
|
|
126
133
|
minRatio: string;
|
|
127
134
|
collRatio: string;
|
|
128
135
|
safetyRatioWithLtvZeroFallback?: string;
|
|
129
|
-
safetyRatio?: string;
|
|
130
136
|
suppliedUsd: string;
|
|
131
137
|
borrowedUsd: string;
|
|
132
138
|
borrowLimitUsd: string;
|
|
@@ -139,6 +145,12 @@ export interface AavePositionData extends MMPositionData {
|
|
|
139
145
|
}
|
|
140
146
|
export interface AaveV2PositionData extends AavePositionData {
|
|
141
147
|
usedAssets: AaveV2UsedAssets;
|
|
148
|
+
eModeCategory?: number;
|
|
149
|
+
isInIsolationMode?: boolean;
|
|
150
|
+
isInSiloedMode?: boolean;
|
|
151
|
+
eModeCategories?: {
|
|
152
|
+
[key: number]: EModeCategoryDataMapping;
|
|
153
|
+
};
|
|
142
154
|
}
|
|
143
155
|
export interface AaveV3PositionData extends AavePositionData {
|
|
144
156
|
usedAssets: AaveV3UsedAssets;
|
|
@@ -160,7 +172,6 @@ export interface AaveV3AggregatedPositionData {
|
|
|
160
172
|
collRatio: string;
|
|
161
173
|
borrowLimitWithLtvZeroFallbackUsd: string;
|
|
162
174
|
safetyRatioWithLtvZeroFallback: string;
|
|
163
|
-
safetyRatio: string;
|
|
164
175
|
netApy: string;
|
|
165
176
|
incentiveUsd: string;
|
|
166
177
|
totalInterestUsd: string;
|
package/cjs/types/aaveV4.d.ts
CHANGED
package/cjs/types/compound.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export interface CompoundAssetData extends MMAssetData {
|
|
|
52
52
|
sortIndex?: number;
|
|
53
53
|
}
|
|
54
54
|
export interface CompoundV2AssetData extends CompoundAssetData {
|
|
55
|
+
exchangeRate?: string;
|
|
55
56
|
}
|
|
56
57
|
export interface CompoundV3AssetData extends CompoundAssetData {
|
|
57
58
|
borrowCollateralFactor: string;
|
|
@@ -63,6 +64,17 @@ export interface CompoundV3AssetData extends CompoundAssetData {
|
|
|
63
64
|
supplyCap: string;
|
|
64
65
|
priceInBaseAsset: string;
|
|
65
66
|
canBeWithdrawn: boolean;
|
|
67
|
+
tokenAddr?: EthAddress;
|
|
68
|
+
isBase?: boolean;
|
|
69
|
+
baseBorrowMin?: string;
|
|
70
|
+
baseTrackingBorrowRewardsSpeed?: string;
|
|
71
|
+
baseTrackingSupplyRewardsSpeed?: string;
|
|
72
|
+
borrowIndex?: string;
|
|
73
|
+
supplyIndex?: string;
|
|
74
|
+
trackingBorrowIndex?: string;
|
|
75
|
+
trackingSupplyIndex?: string;
|
|
76
|
+
rewardSupplySpeed?: string;
|
|
77
|
+
rewardBorrowSpeed?: string;
|
|
66
78
|
}
|
|
67
79
|
export interface CompoundAssetsData<T> {
|
|
68
80
|
[token: string]: T;
|
|
@@ -96,7 +108,6 @@ export interface CompoundAggregatedPositionData {
|
|
|
96
108
|
leftToBorrowUsd: string;
|
|
97
109
|
ratio: string;
|
|
98
110
|
collRatio: string;
|
|
99
|
-
safetyRatio: string;
|
|
100
111
|
netApy: string;
|
|
101
112
|
incentiveUsd: string;
|
|
102
113
|
totalInterestUsd: string;
|
|
@@ -116,7 +127,6 @@ export interface CompoundAggregatedPositionData {
|
|
|
116
127
|
export interface CompoundPositionData extends MMPositionData {
|
|
117
128
|
ratio: string;
|
|
118
129
|
minRatio: string;
|
|
119
|
-
safetyRatio?: string;
|
|
120
130
|
suppliedUsd: string;
|
|
121
131
|
borrowedUsd: string;
|
|
122
132
|
borrowLimitUsd: string;
|
|
@@ -125,9 +135,21 @@ export interface CompoundPositionData extends MMPositionData {
|
|
|
125
135
|
isSubscribedToAutomation?: boolean;
|
|
126
136
|
automationResubscribeRequired?: boolean;
|
|
127
137
|
}
|
|
128
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Fields getCompoundV2AggregatedData adds to every Compound V2 position at runtime — a subset of
|
|
140
|
+
* CompoundAggregatedPositionData. Optional, so code that builds a position by hand keeps compiling.
|
|
141
|
+
*/
|
|
142
|
+
export type CompoundV2PositionAggregatedFields = Partial<Pick<CompoundAggregatedPositionData, 'suppliedCollateralUsd' | 'liquidationLimitUsd' | 'leftToBorrowUsd' | 'collRatio' | 'leveragedType' | 'leveragedAsset' | 'liquidationPrice'>>;
|
|
143
|
+
/**
|
|
144
|
+
* Fields getCompoundV3AggregatedData adds to every Compound V3 position at runtime, on top of those declared in
|
|
145
|
+
* CompoundPositionData. Optional, so code that builds a position by hand keeps compiling.
|
|
146
|
+
*/
|
|
147
|
+
export type CompoundV3PositionAggregatedFields = Partial<Omit<CompoundAggregatedPositionData, keyof MMPositionData | 'ratio' | 'minRatio' | 'suppliedUsd' | 'borrowedUsd' | 'borrowLimitUsd' | 'incentiveUsd' | 'totalInterestUsd'>>;
|
|
148
|
+
export interface CompoundV2PositionData extends CompoundPositionData, CompoundV2PositionAggregatedFields {
|
|
129
149
|
usedAssets: CompoundV2UsedAssets;
|
|
150
|
+
borrowStableSupplyUnstable?: boolean;
|
|
130
151
|
}
|
|
131
|
-
export interface CompoundV3PositionData extends CompoundPositionData {
|
|
152
|
+
export interface CompoundV3PositionData extends CompoundPositionData, CompoundV3PositionAggregatedFields {
|
|
132
153
|
usedAssets: CompoundV3UsedAssets;
|
|
154
|
+
isAllowed?: boolean;
|
|
133
155
|
}
|
package/cjs/types/curveUsd.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ export interface CrvUSDGlobalMarketData {
|
|
|
60
60
|
leftToBorrow: string;
|
|
61
61
|
bands: BandData[];
|
|
62
62
|
loanDiscount: string;
|
|
63
|
+
A?: bigint;
|
|
63
64
|
}
|
|
64
65
|
export interface CrvUSDAggregatedPositionData {
|
|
65
66
|
ratio: string;
|
|
@@ -73,9 +74,6 @@ export interface CrvUSDAggregatedPositionData {
|
|
|
73
74
|
collFactor: string;
|
|
74
75
|
leveragedType: LeverageType;
|
|
75
76
|
exposure: string;
|
|
76
|
-
netApy: string;
|
|
77
|
-
totalInterestUsd: string;
|
|
78
|
-
incentiveUsd: string;
|
|
79
77
|
leveragedAsset?: string;
|
|
80
78
|
liquidationPrice?: string;
|
|
81
79
|
}
|
|
@@ -94,7 +92,8 @@ export interface CrvUSDUsedAsset {
|
|
|
94
92
|
export interface CrvUSDUsedAssets {
|
|
95
93
|
[key: string]: CrvUSDUsedAsset;
|
|
96
94
|
}
|
|
97
|
-
export
|
|
95
|
+
export type CrvUSDPositionAggregatedFields = Partial<Pick<CrvUSDAggregatedPositionData, 'borrowLimitUsd' | 'minAllowedRatio' | 'collFactor' | 'leveragedType' | 'leveragedAsset' | 'liquidationPrice'>>;
|
|
96
|
+
export interface CrvUSDUserData extends CrvUSDPositionAggregatedFields {
|
|
98
97
|
debtAmount: string;
|
|
99
98
|
health: string;
|
|
100
99
|
healthPercent: string;
|
|
@@ -116,7 +115,10 @@ export interface CrvUSDUserData {
|
|
|
116
115
|
collateralPrice: string;
|
|
117
116
|
collRatio: string;
|
|
118
117
|
exposure: string;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
marketCollateralAmount?: bigint;
|
|
119
|
+
curveUsdCollateralAmount?: bigint;
|
|
120
|
+
N?: bigint;
|
|
121
|
+
bandRange?: readonly [bigint, bigint];
|
|
122
|
+
usersBands?: readonly [readonly bigint[], readonly bigint[]];
|
|
123
|
+
isInSoftLiquidation?: boolean;
|
|
122
124
|
}
|
package/cjs/types/fluid.d.ts
CHANGED
package/cjs/types/liquity.d.ts
CHANGED
|
@@ -24,11 +24,7 @@ export interface LiquityTroveInfo {
|
|
|
24
24
|
totalETH: string;
|
|
25
25
|
totalLUSD: string;
|
|
26
26
|
minCollateralRatio: number;
|
|
27
|
-
safetyRatio: string;
|
|
28
27
|
priceForRecovery: string;
|
|
29
28
|
debtInFront: string;
|
|
30
29
|
exposure: string;
|
|
31
|
-
netApy: string;
|
|
32
|
-
totalInterestUsd: string;
|
|
33
|
-
incentiveUsd: string;
|
|
34
30
|
}
|
package/cjs/types/liquityV2.d.ts
CHANGED
|
@@ -94,7 +94,6 @@ export interface LiquityV2AggregatedTroveData {
|
|
|
94
94
|
liquidationPrice: string;
|
|
95
95
|
ratio: string;
|
|
96
96
|
collRatio: string;
|
|
97
|
-
safetyRatio: string;
|
|
98
97
|
exposure: string;
|
|
99
98
|
}
|
|
100
99
|
export interface LiquityV2TroveData {
|
|
@@ -102,7 +101,6 @@ export interface LiquityV2TroveData {
|
|
|
102
101
|
troveId: string;
|
|
103
102
|
ratio: string;
|
|
104
103
|
collRatio: string;
|
|
105
|
-
safetyRatio?: string;
|
|
106
104
|
liqRatio: string;
|
|
107
105
|
borrowLimitRatio: string;
|
|
108
106
|
interestRate: string;
|
package/cjs/types/llamaLend.d.ts
CHANGED
|
@@ -138,7 +138,8 @@ export interface LlamaLendUsedAsset {
|
|
|
138
138
|
export interface LlamaLendUsedAssets {
|
|
139
139
|
[key: string]: LlamaLendUsedAsset;
|
|
140
140
|
}
|
|
141
|
-
export
|
|
141
|
+
export type LlamaLendPositionAggregatedFields = Partial<Pick<LlamaLendAggregatedPositionData, 'borrowLimitUsd' | 'minAllowedRatio' | 'collFactor' | 'leveragedType' | 'leveragedAsset' | 'liquidationPrice' | 'netApy' | 'incentiveUsd' | 'totalInterestUsd'>>;
|
|
142
|
+
export interface LlamaLendUserData extends LlamaLendPositionAggregatedFields {
|
|
142
143
|
debtAmount: string;
|
|
143
144
|
health: string;
|
|
144
145
|
healthPercent: string;
|
|
@@ -157,4 +158,14 @@ export interface LlamaLendUserData {
|
|
|
157
158
|
loanExists: boolean;
|
|
158
159
|
borrowRate?: string;
|
|
159
160
|
exposure: string;
|
|
161
|
+
collateralPrice?: bigint;
|
|
162
|
+
marketCollateralAmount?: bigint;
|
|
163
|
+
debtTokenCollateralAmount?: bigint;
|
|
164
|
+
N?: bigint;
|
|
165
|
+
bandRange?: readonly [bigint, bigint];
|
|
166
|
+
usersBands?: readonly [readonly bigint[], readonly bigint[]];
|
|
167
|
+
collRatio?: bigint;
|
|
168
|
+
isInSoftLiquidation?: boolean;
|
|
169
|
+
debtTokenSuppliedShares?: bigint;
|
|
170
|
+
debtTokenSuppliedAssets?: bigint;
|
|
160
171
|
}
|
package/cjs/types/maker.d.ts
CHANGED
|
@@ -43,7 +43,6 @@ export interface CdpData {
|
|
|
43
43
|
debtAssetMarketPrice: string;
|
|
44
44
|
liquidationPrice: string;
|
|
45
45
|
ratio: string;
|
|
46
|
-
safetyRatio: string;
|
|
47
46
|
liqRatio: string;
|
|
48
47
|
liqPercent: number;
|
|
49
48
|
assetPrice: string;
|
|
@@ -59,7 +58,4 @@ export interface CdpData {
|
|
|
59
58
|
liquidationFee: string;
|
|
60
59
|
lastUpdated: number;
|
|
61
60
|
exposure: string;
|
|
62
|
-
netApy: string;
|
|
63
|
-
totalInterestUsd: string;
|
|
64
|
-
incentiveUsd: string;
|
|
65
61
|
}
|
|
@@ -185,7 +185,6 @@ export interface MorphoBlueAggregatedPositionData {
|
|
|
185
185
|
totalInterestUsd: string;
|
|
186
186
|
ltv: string;
|
|
187
187
|
ratio: string;
|
|
188
|
-
safetyRatio: string;
|
|
189
188
|
leveragedType: LeverageType;
|
|
190
189
|
leveragedAsset?: string;
|
|
191
190
|
currentVolatilePairRatio?: string;
|
|
@@ -208,7 +207,6 @@ export interface MorphoBluePositionData {
|
|
|
208
207
|
totalInterestUsd: string;
|
|
209
208
|
ltv: string;
|
|
210
209
|
ratio: string;
|
|
211
|
-
safetyRatio?: string;
|
|
212
210
|
leveragedType: LeverageType;
|
|
213
211
|
leveragedAsset?: string;
|
|
214
212
|
currentVolatilePairRatio?: string;
|
|
@@ -216,6 +214,8 @@ export interface MorphoBluePositionData {
|
|
|
216
214
|
supplyShares: string;
|
|
217
215
|
borrowShares: string;
|
|
218
216
|
exposure: string;
|
|
217
|
+
minCollRatio?: string;
|
|
218
|
+
collLiquidationRatio?: string;
|
|
219
219
|
}
|
|
220
220
|
export interface MorphoBlueEarnData {
|
|
221
221
|
apy: string;
|