@haven_ai/cli 0.0.0-dev.202609251630.f6bd8a6 → 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/index.js
CHANGED
|
@@ -315,6 +315,19 @@ var CHAIN_NAMES = { 100: "Gnosis", 8453: "Base" };
|
|
|
315
315
|
function chainName(chainId) {
|
|
316
316
|
return CHAIN_NAMES[chainId] ?? `chain ${chainId}`;
|
|
317
317
|
}
|
|
318
|
+
function timeAgo(iso) {
|
|
319
|
+
const diff = Date.now() - new Date(iso).getTime();
|
|
320
|
+
if (diff < 6e4) return "just now";
|
|
321
|
+
const mins = Math.floor(diff / 6e4);
|
|
322
|
+
if (mins < 60) return `${mins}m ago`;
|
|
323
|
+
const hours = Math.floor(mins / 60);
|
|
324
|
+
if (hours < 24) return `${hours}h ago`;
|
|
325
|
+
const days = Math.floor(hours / 24);
|
|
326
|
+
if (days < 30) return `${days}d ago`;
|
|
327
|
+
const months = Math.floor(days / 30);
|
|
328
|
+
if (months < 12) return `${months}mo ago`;
|
|
329
|
+
return `${Math.floor(days / 365)}y ago`;
|
|
330
|
+
}
|
|
318
331
|
|
|
319
332
|
// src/csv.ts
|
|
320
333
|
function csvField(value) {
|
|
@@ -603,7 +616,7 @@ async function runConnector(connectorCommand, spawner, onStderr) {
|
|
|
603
616
|
|
|
604
617
|
// src/commands.ts
|
|
605
618
|
var DEFAULT_API = "https://havenbackend-production-8a00.up.railway.app";
|
|
606
|
-
var CLI_VERSION = "0.0.0-dev.
|
|
619
|
+
var CLI_VERSION = "0.0.0-dev.202609252109.630b3c3";
|
|
607
620
|
var CLI_CLIENT_IDENTITY = `@haven_ai/cli/${CLI_VERSION}`;
|
|
608
621
|
function accountAddressOf(s) {
|
|
609
622
|
return s.account_address ?? "";
|
|
@@ -884,6 +897,12 @@ function accountsEnvelope(body) {
|
|
|
884
897
|
}
|
|
885
898
|
return body.accounts;
|
|
886
899
|
}
|
|
900
|
+
function renderBalanceCell(entry) {
|
|
901
|
+
const marker = entry.balanceFreshness;
|
|
902
|
+
if (!marker) return entry.formatted;
|
|
903
|
+
if (marker.status === "unavailable") return "unavailable";
|
|
904
|
+
return `\u2248 ${entry.formatted} (as of ${timeAgo(marker.asOf ?? "")})`;
|
|
905
|
+
}
|
|
887
906
|
async function cmdWalletsList(args, d) {
|
|
888
907
|
const { api } = await authed(args, d);
|
|
889
908
|
const accounts = accountsEnvelope(await api.get("/user/accounts"));
|
|
@@ -915,7 +934,10 @@ async function cmdWalletsBalances(args, d) {
|
|
|
915
934
|
{ account: safe.name, chainId: safe.chain_id, balances },
|
|
916
935
|
() => [
|
|
917
936
|
`${safe.name} \xB7 ${chainName(safe.chain_id)} \xB7 ${truncateAddress(accountAddressOf(safe))}`,
|
|
918
|
-
balances.length === 0 ? " (no balances)" : table(
|
|
937
|
+
balances.length === 0 ? " (no balances)" : table(
|
|
938
|
+
["TOKEN", "BALANCE"],
|
|
939
|
+
balances.map((b) => [b.symbol, renderBalanceCell(b)])
|
|
940
|
+
)
|
|
919
941
|
].join("\n")
|
|
920
942
|
);
|
|
921
943
|
return EXIT.ok;
|