@defisaver/positions-sdk 1.0.26-dev-portfolio-8 → 1.0.26-dev-portfolio-10
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/fluid/index.js +8 -4
- package/cjs/portfolio/index.js +1 -1
- package/cjs/types/llamaLend.d.ts +2 -0
- package/esm/fluid/index.js +8 -4
- package/esm/portfolio/index.js +1 -1
- package/esm/types/llamaLend.d.ts +2 -0
- package/package.json +1 -1
- package/src/fluid/index.ts +6 -4
- package/src/portfolio/index.ts +1 -1
- package/src/types/llamaLend.ts +2 -0
package/cjs/fluid/index.js
CHANGED
|
@@ -142,11 +142,15 @@ const getChainLinkPricesForTokens = (tokens, network, client) => __awaiter(void
|
|
|
142
142
|
}
|
|
143
143
|
default:
|
|
144
144
|
// @ts-ignore
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
// @ts-ignore
|
|
148
|
-
else
|
|
145
|
+
if (results[i + offset].result[1]) {
|
|
146
|
+
// @ts-ignore
|
|
149
147
|
acc[token] = new decimal_js_1.default(results[i + offset].result[1].toString()).div(1e8).toString();
|
|
148
|
+
}
|
|
149
|
+
else if (results[i + offset].result) {
|
|
150
|
+
acc[token] = new decimal_js_1.default(results[i + offset].result.toString()).div(1e8).toString();
|
|
151
|
+
}
|
|
152
|
+
else
|
|
153
|
+
acc[token] = '0';
|
|
150
154
|
break;
|
|
151
155
|
}
|
|
152
156
|
return acc;
|
package/cjs/portfolio/index.js
CHANGED
|
@@ -236,7 +236,7 @@ function getPortfolioDataSlower(provider, network, addresses) {
|
|
|
236
236
|
...llamaLendMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
237
237
|
const accData = yield (0, llamaLend_1._getLlamaLendUserData)(client, network, address, market, llamaLendMarketsData[market.value]);
|
|
238
238
|
if (new decimal_js_1.default(accData.suppliedUsd).gt(0) || new decimal_js_1.default(accData.borrowedUsd).gt(0)) {
|
|
239
|
-
positions[address.toLowerCase()].llamaLend[market.value] = accData;
|
|
239
|
+
positions[address.toLowerCase()].llamaLend[market.value] = Object.assign(Object.assign({}, accData), { borrowRate: llamaLendMarketsData[market.value].borrowRate });
|
|
240
240
|
}
|
|
241
241
|
}))).flat(),
|
|
242
242
|
...liquityV2Markets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
package/cjs/types/llamaLend.d.ts
CHANGED
package/esm/fluid/index.js
CHANGED
|
@@ -136,11 +136,15 @@ const getChainLinkPricesForTokens = (tokens, network, client) => __awaiter(void
|
|
|
136
136
|
}
|
|
137
137
|
default:
|
|
138
138
|
// @ts-ignore
|
|
139
|
-
if (
|
|
140
|
-
|
|
141
|
-
// @ts-ignore
|
|
142
|
-
else
|
|
139
|
+
if (results[i + offset].result[1]) {
|
|
140
|
+
// @ts-ignore
|
|
143
141
|
acc[token] = new Dec(results[i + offset].result[1].toString()).div(1e8).toString();
|
|
142
|
+
}
|
|
143
|
+
else if (results[i + offset].result) {
|
|
144
|
+
acc[token] = new Dec(results[i + offset].result.toString()).div(1e8).toString();
|
|
145
|
+
}
|
|
146
|
+
else
|
|
147
|
+
acc[token] = '0';
|
|
144
148
|
break;
|
|
145
149
|
}
|
|
146
150
|
return acc;
|
package/esm/portfolio/index.js
CHANGED
|
@@ -229,7 +229,7 @@ export function getPortfolioDataSlower(provider, network, addresses) {
|
|
|
229
229
|
...llamaLendMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
230
230
|
const accData = yield _getLlamaLendUserData(client, network, address, market, llamaLendMarketsData[market.value]);
|
|
231
231
|
if (new Dec(accData.suppliedUsd).gt(0) || new Dec(accData.borrowedUsd).gt(0)) {
|
|
232
|
-
positions[address.toLowerCase()].llamaLend[market.value] = accData;
|
|
232
|
+
positions[address.toLowerCase()].llamaLend[market.value] = Object.assign(Object.assign({}, accData), { borrowRate: llamaLendMarketsData[market.value].borrowRate });
|
|
233
233
|
}
|
|
234
234
|
}))).flat(),
|
|
235
235
|
...liquityV2Markets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
package/esm/types/llamaLend.d.ts
CHANGED
package/package.json
CHANGED
package/src/fluid/index.ts
CHANGED
|
@@ -189,9 +189,12 @@ const getChainLinkPricesForTokens = async (
|
|
|
189
189
|
|
|
190
190
|
default:
|
|
191
191
|
// @ts-ignore
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
if (results[i + offset].result[1]) {
|
|
193
|
+
// @ts-ignore
|
|
194
|
+
acc[token] = new Dec(results[i + offset].result[1]!.toString() as string).div(1e8).toString();
|
|
195
|
+
} else if (results[i + offset].result) {
|
|
196
|
+
acc[token] = new Dec(results[i + offset].result!.toString() as string).div(1e8).toString();
|
|
197
|
+
} else acc[token] = '0';
|
|
195
198
|
break;
|
|
196
199
|
}
|
|
197
200
|
return acc;
|
|
@@ -1155,7 +1158,6 @@ const parseT4UserData = (userPositionData: FluidUserPositionStructOutputStruct,
|
|
|
1155
1158
|
...EMPTY_FLUID_DATA,
|
|
1156
1159
|
lastUpdated: Date.now(),
|
|
1157
1160
|
};
|
|
1158
|
-
|
|
1159
1161
|
const collAsset0 = getAssetInfo(marketData.collAsset0);
|
|
1160
1162
|
const collAsset1 = getAssetInfo(marketData.collAsset1);
|
|
1161
1163
|
const debtAsset0 = getAssetInfo(marketData.debtAsset0);
|
package/src/portfolio/index.ts
CHANGED
|
@@ -239,7 +239,7 @@ export async function getPortfolioDataSlower(provider: EthereumProvider, network
|
|
|
239
239
|
...llamaLendMarkets.map((market) => addresses.map(async (address) => {
|
|
240
240
|
const accData = await _getLlamaLendUserData(client, network, address, market, llamaLendMarketsData[market.value]);
|
|
241
241
|
if (new Dec(accData.suppliedUsd).gt(0) || new Dec(accData.borrowedUsd).gt(0)) {
|
|
242
|
-
positions[address.toLowerCase() as EthAddress].llamaLend[market.value] = accData;
|
|
242
|
+
positions[address.toLowerCase() as EthAddress].llamaLend[market.value] = { ...accData, borrowRate: llamaLendMarketsData[market.value].borrowRate };
|
|
243
243
|
}
|
|
244
244
|
})).flat(),
|
|
245
245
|
...liquityV2Markets.map((market) => addresses.map(async (address) => {
|