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