@defisaver/positions-sdk 2.1.127-midnight-10-dev → 2.1.127-midnight-11-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.
|
@@ -169,12 +169,14 @@ function _getMorphoMidnightAccountData(provider, network, account, selectedMarke
|
|
|
169
169
|
if (new decimal_js_1.default(positionInfo.debt.toString()).gt(0)) {
|
|
170
170
|
try {
|
|
171
171
|
const borrowInfo = yield (0, morphoMidnightHelpers_1.getMorphoMidnightUserBorrowInfo)(account, marketId, marketInfo.loanToken);
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
172
|
+
if (new decimal_js_1.default(borrowInfo.debtTotal).gt(0)) {
|
|
173
|
+
borrowRate = borrowInfo.borrowRate;
|
|
174
|
+
debtBase = borrowInfo.debtBase;
|
|
175
|
+
debtInterest = borrowInfo.debtInterest;
|
|
176
|
+
usedAssets[marketInfo.loanToken].borrowRate = borrowRate;
|
|
177
|
+
// Reflect the real borrow cost in netApy without mutating the shared marketInfo.assetsData.
|
|
178
|
+
assetsDataForApy = Object.assign(Object.assign({}, marketInfo.assetsData), { [marketInfo.loanToken]: Object.assign(Object.assign({}, loanTokenData), { borrowRate }) });
|
|
179
|
+
}
|
|
178
180
|
}
|
|
179
181
|
catch (err) {
|
|
180
182
|
// Orderbook API unavailable — keep the on-chain-only fallback above.
|
|
@@ -158,12 +158,14 @@ export function _getMorphoMidnightAccountData(provider, network, account, select
|
|
|
158
158
|
if (new Dec(positionInfo.debt.toString()).gt(0)) {
|
|
159
159
|
try {
|
|
160
160
|
const borrowInfo = yield getMorphoMidnightUserBorrowInfo(account, marketId, marketInfo.loanToken);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
if (new Dec(borrowInfo.debtTotal).gt(0)) {
|
|
162
|
+
borrowRate = borrowInfo.borrowRate;
|
|
163
|
+
debtBase = borrowInfo.debtBase;
|
|
164
|
+
debtInterest = borrowInfo.debtInterest;
|
|
165
|
+
usedAssets[marketInfo.loanToken].borrowRate = borrowRate;
|
|
166
|
+
// Reflect the real borrow cost in netApy without mutating the shared marketInfo.assetsData.
|
|
167
|
+
assetsDataForApy = Object.assign(Object.assign({}, marketInfo.assetsData), { [marketInfo.loanToken]: Object.assign(Object.assign({}, loanTokenData), { borrowRate }) });
|
|
168
|
+
}
|
|
167
169
|
}
|
|
168
170
|
catch (err) {
|
|
169
171
|
// Orderbook API unavailable — keep the on-chain-only fallback above.
|
package/package.json
CHANGED
|
@@ -167,15 +167,17 @@ export async function _getMorphoMidnightAccountData(provider: Client, network: N
|
|
|
167
167
|
if (new Dec(positionInfo.debt.toString()).gt(0)) {
|
|
168
168
|
try {
|
|
169
169
|
const borrowInfo = await getMorphoMidnightUserBorrowInfo(account, marketId, marketInfo.loanToken);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
170
|
+
if (new Dec(borrowInfo.debtTotal).gt(0)) {
|
|
171
|
+
borrowRate = borrowInfo.borrowRate;
|
|
172
|
+
debtBase = borrowInfo.debtBase;
|
|
173
|
+
debtInterest = borrowInfo.debtInterest;
|
|
174
|
+
usedAssets[marketInfo.loanToken].borrowRate = borrowRate;
|
|
175
|
+
// Reflect the real borrow cost in netApy without mutating the shared marketInfo.assetsData.
|
|
176
|
+
assetsDataForApy = {
|
|
177
|
+
...marketInfo.assetsData,
|
|
178
|
+
[marketInfo.loanToken]: { ...loanTokenData, borrowRate },
|
|
179
|
+
};
|
|
180
|
+
}
|
|
179
181
|
} catch (err) {
|
|
180
182
|
// Orderbook API unavailable — keep the on-chain-only fallback above.
|
|
181
183
|
}
|