@haven_ai/cli 0.0.0-dev.202609251409.98ed67a → 0.0.0-dev.202609252109.630b3c3
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/cli.cjs +24 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +24 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +24 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -319,6 +319,19 @@ var CHAIN_NAMES = { 100: "Gnosis", 8453: "Base" };
|
|
|
319
319
|
function chainName(chainId) {
|
|
320
320
|
return CHAIN_NAMES[chainId] ?? `chain ${chainId}`;
|
|
321
321
|
}
|
|
322
|
+
function timeAgo(iso) {
|
|
323
|
+
const diff = Date.now() - new Date(iso).getTime();
|
|
324
|
+
if (diff < 6e4) return "just now";
|
|
325
|
+
const mins = Math.floor(diff / 6e4);
|
|
326
|
+
if (mins < 60) return `${mins}m ago`;
|
|
327
|
+
const hours = Math.floor(mins / 60);
|
|
328
|
+
if (hours < 24) return `${hours}h ago`;
|
|
329
|
+
const days = Math.floor(hours / 24);
|
|
330
|
+
if (days < 30) return `${days}d ago`;
|
|
331
|
+
const months = Math.floor(days / 30);
|
|
332
|
+
if (months < 12) return `${months}mo ago`;
|
|
333
|
+
return `${Math.floor(days / 365)}y ago`;
|
|
334
|
+
}
|
|
322
335
|
|
|
323
336
|
// src/csv.ts
|
|
324
337
|
function csvField(value) {
|
|
@@ -607,7 +620,7 @@ async function runConnector(connectorCommand, spawner, onStderr) {
|
|
|
607
620
|
|
|
608
621
|
// src/commands.ts
|
|
609
622
|
var DEFAULT_API = "https://havenbackend-production-8a00.up.railway.app";
|
|
610
|
-
var CLI_VERSION = "0.0.0-dev.
|
|
623
|
+
var CLI_VERSION = "0.0.0-dev.202609252109.630b3c3";
|
|
611
624
|
var CLI_CLIENT_IDENTITY = `@haven_ai/cli/${CLI_VERSION}`;
|
|
612
625
|
function accountAddressOf(s) {
|
|
613
626
|
return s.account_address ?? "";
|
|
@@ -888,6 +901,12 @@ function accountsEnvelope(body) {
|
|
|
888
901
|
}
|
|
889
902
|
return body.accounts;
|
|
890
903
|
}
|
|
904
|
+
function renderBalanceCell(entry) {
|
|
905
|
+
const marker = entry.balanceFreshness;
|
|
906
|
+
if (!marker) return entry.formatted;
|
|
907
|
+
if (marker.status === "unavailable") return "unavailable";
|
|
908
|
+
return `\u2248 ${entry.formatted} (as of ${timeAgo(marker.asOf ?? "")})`;
|
|
909
|
+
}
|
|
891
910
|
async function cmdWalletsList(args, d) {
|
|
892
911
|
const { api } = await authed(args, d);
|
|
893
912
|
const accounts = accountsEnvelope(await api.get("/user/accounts"));
|
|
@@ -919,7 +938,10 @@ async function cmdWalletsBalances(args, d) {
|
|
|
919
938
|
{ account: safe.name, chainId: safe.chain_id, balances },
|
|
920
939
|
() => [
|
|
921
940
|
`${safe.name} \xB7 ${chainName(safe.chain_id)} \xB7 ${truncateAddress(accountAddressOf(safe))}`,
|
|
922
|
-
balances.length === 0 ? " (no balances)" : table(
|
|
941
|
+
balances.length === 0 ? " (no balances)" : table(
|
|
942
|
+
["TOKEN", "BALANCE"],
|
|
943
|
+
balances.map((b) => [b.symbol, renderBalanceCell(b)])
|
|
944
|
+
)
|
|
923
945
|
].join("\n")
|
|
924
946
|
);
|
|
925
947
|
return EXIT.ok;
|