@t2000/sdk 0.16.12 → 0.16.13
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/dist/index.cjs +16 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3400,16 +3400,24 @@ To access invested funds: t2000 invest sell ${params.amount} ${asset}`,
|
|
|
3400
3400
|
const suiPrice = bal.gasReserve.sui > 0 ? bal.gasReserve.usdEquiv / bal.gasReserve.sui : 0;
|
|
3401
3401
|
const assetPrices = { SUI: suiPrice };
|
|
3402
3402
|
const swapAdapter = this.registry.listSwap()[0];
|
|
3403
|
+
const investedAssets = /* @__PURE__ */ new Set();
|
|
3403
3404
|
for (const pos of portfolioPositions) {
|
|
3404
|
-
if (pos.asset
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3405
|
+
if (pos.asset in INVESTMENT_ASSETS) investedAssets.add(pos.asset);
|
|
3406
|
+
}
|
|
3407
|
+
for (const key of this.portfolio.getAllStrategyKeys()) {
|
|
3408
|
+
for (const sp of this.portfolio.getStrategyPositions(key)) {
|
|
3409
|
+
if (sp.asset in INVESTMENT_ASSETS) investedAssets.add(sp.asset);
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
for (const asset of investedAssets) {
|
|
3413
|
+
if (asset === "SUI" || asset in assetPrices) continue;
|
|
3414
|
+
try {
|
|
3415
|
+
if (swapAdapter) {
|
|
3416
|
+
const quote = await swapAdapter.getQuote("USDC", asset, 1);
|
|
3417
|
+
assetPrices[asset] = quote.expectedOutput > 0 ? 1 / quote.expectedOutput : 0;
|
|
3412
3418
|
}
|
|
3419
|
+
} catch {
|
|
3420
|
+
assetPrices[asset] = 0;
|
|
3413
3421
|
}
|
|
3414
3422
|
}
|
|
3415
3423
|
let investmentValue = 0;
|