@t2000/cli 0.12.2 → 0.12.3
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
|
@@ -254,9 +254,14 @@ function registerBalance(program2) {
|
|
|
254
254
|
if (bal.savings > 0.01) {
|
|
255
255
|
const positions = await agent.positions();
|
|
256
256
|
const saves = positions.positions.filter((p) => p.type === "save");
|
|
257
|
+
const borrows = positions.positions.filter((p) => p.type === "borrow");
|
|
257
258
|
const weightedApy = saves.length > 0 ? saves.reduce((sum, p) => sum + p.amount * p.apy, 0) / saves.reduce((sum, p) => sum + p.amount, 0) : 0;
|
|
258
259
|
const dailyEarning = bal.savings * (weightedApy / 100) / 365;
|
|
259
260
|
printKeyValue("Savings", `${formatUsd2(bal.savings)} ${pc3.dim(`(earning ${weightedApy.toFixed(2)}% APY)`)}`);
|
|
261
|
+
if (bal.debt > 0.01) {
|
|
262
|
+
const borrowApy = borrows.length > 0 ? borrows.reduce((sum, p) => sum + p.amount * p.apy, 0) / borrows.reduce((sum, p) => sum + p.amount, 0) : 0;
|
|
263
|
+
printKeyValue("Credit", `${pc3.red(`-${formatUsd2(bal.debt)}`)} ${pc3.dim(`(${borrowApy.toFixed(2)}% APY)`)}`);
|
|
264
|
+
}
|
|
260
265
|
printKeyValue("Gas", `${bal.gasReserve.sui.toFixed(2)} SUI ${pc3.dim(`(~${formatUsd2(bal.gasReserve.usdEquiv)})`)}`);
|
|
261
266
|
printSeparator();
|
|
262
267
|
printKeyValue("Total", `${formatUsd2(bal.total)}`);
|
|
@@ -264,6 +269,9 @@ function registerBalance(program2) {
|
|
|
264
269
|
printLine(` ${pc3.dim(`Earning ~${formatUsd2(dailyEarning)}/day`)}`);
|
|
265
270
|
}
|
|
266
271
|
} else {
|
|
272
|
+
if (bal.debt > 0.01) {
|
|
273
|
+
printKeyValue("Credit", `${pc3.red(`-${formatUsd2(bal.debt)}`)}`);
|
|
274
|
+
}
|
|
267
275
|
printKeyValue("Savings", `${formatUsd2(bal.savings)}`);
|
|
268
276
|
printKeyValue("Gas", `${bal.gasReserve.sui.toFixed(2)} SUI ${pc3.dim(`(~${formatUsd2(bal.gasReserve.usdEquiv)})`)}`);
|
|
269
277
|
printSeparator();
|
|
@@ -1751,7 +1759,7 @@ function registerMcp(program2) {
|
|
|
1751
1759
|
mcp.command("start", { isDefault: true }).description("Start MCP server (stdio transport)").option("--key <path>", "Key file path").action(async (opts) => {
|
|
1752
1760
|
let mod;
|
|
1753
1761
|
try {
|
|
1754
|
-
mod = await import("./dist-
|
|
1762
|
+
mod = await import("./dist-KTIGPZKW.js");
|
|
1755
1763
|
} catch {
|
|
1756
1764
|
console.error(
|
|
1757
1765
|
"MCP server not installed. Run:\n npm install -g @t2000/mcp"
|