@t2000/sdk 0.16.27 → 0.16.28
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 +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3487,6 +3487,7 @@ To access invested funds: t2000 invest sell ${params.amount} ${asset}`,
|
|
|
3487
3487
|
}
|
|
3488
3488
|
let investmentValue = 0;
|
|
3489
3489
|
let investmentCostBasis = 0;
|
|
3490
|
+
let trackedValue = 0;
|
|
3490
3491
|
const trackedAmounts = {};
|
|
3491
3492
|
const trackedCostBasis = {};
|
|
3492
3493
|
const earningAssetSet = /* @__PURE__ */ new Set();
|
|
@@ -3510,6 +3511,7 @@ To access invested funds: t2000 invest sell ${params.amount} ${asset}`,
|
|
|
3510
3511
|
if (asset === "SUI") {
|
|
3511
3512
|
const actualSui = earningAssetSet.has("SUI") ? tracked : Math.min(tracked, bal.gasReserve.sui);
|
|
3512
3513
|
investmentValue += actualSui * price;
|
|
3514
|
+
trackedValue += actualSui * price;
|
|
3513
3515
|
if (actualSui < tracked && tracked > 0) {
|
|
3514
3516
|
investmentCostBasis += costBasis * (actualSui / tracked);
|
|
3515
3517
|
} else {
|
|
@@ -3523,11 +3525,12 @@ To access invested funds: t2000 invest sell ${params.amount} ${asset}`,
|
|
|
3523
3525
|
const onChainAmount = bal.assets[asset] ?? 0;
|
|
3524
3526
|
const effectiveAmount = Math.max(tracked, onChainAmount);
|
|
3525
3527
|
investmentValue += effectiveAmount * price;
|
|
3528
|
+
trackedValue += tracked * price;
|
|
3526
3529
|
investmentCostBasis += costBasis;
|
|
3527
3530
|
}
|
|
3528
3531
|
}
|
|
3529
3532
|
bal.investment = investmentValue;
|
|
3530
|
-
bal.investmentPnL =
|
|
3533
|
+
bal.investmentPnL = trackedValue - investmentCostBasis;
|
|
3531
3534
|
} catch {
|
|
3532
3535
|
bal.investment = 0;
|
|
3533
3536
|
bal.investmentPnL = 0;
|