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