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