aboutsummaryrefslogtreecommitdiffstats
path: root/routes/info.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-28 14:14:30 -0800
committerAdam Soltys <[email protected]>2026-02-28 14:14:30 -0800
commita1632ae402d11fdd7ffc360de97c55e0b4fad677 (patch)
treeaad5a1ea73f95dcd055c1d0b4ebf2708c36b4e01 /routes/info.ts
parent76c7e52172f3dc25ee109434157d4d982ad9d2bd (diff)
downloadcoinos-server-a1632ae402d11fdd7ffc360de97c55e0b4fad677.tar.gz
coinos-server-a1632ae402d11fdd7ffc360de97c55e0b4fad677.zip
migrate to hono
Diffstat (limited to 'routes/info.ts')
-rw-r--r--routes/info.ts16
1 files changed, 4 insertions, 12 deletions
diff --git a/routes/info.ts b/routes/info.ts
index 35d1c315..adad02c6 100644
--- a/routes/info.ts
+++ b/routes/info.ts
@@ -5,23 +5,15 @@ import ln from "$lib/ln";
import { getDecodedToken } from "@cashu/cashu-ts";
export default {
- async health(_, res) {
+ async health(c) {
const status = getHealthStatus();
const httpStatus = status.healthy ? 200 : 503;
- res.status(httpStatus).send(status);
+ return c.json(status, httpStatus);
},
- async balances(_, res) {
+ async balances(c) {
let total = 0;
- // for await (const k of db.scanIterator({ MATCH: "balance:*" })) {
- // total += parseInt(await db.get(k));
- // }
- //
- // for await (const k of archive.scanIterator({ MATCH: "balance:*" })) {
- // total += parseInt(await archive.get(k));
- // }
-
const funds = await ln.listfunds();
const lnchannel = parseInt(funds.channels.reduce((a, b) => a + b.channel_sat, 0));
const lnwallet = parseInt(funds.outputs.reduce((a, b) => a + b.value, 0));
@@ -34,6 +26,6 @@ export default {
lnwallet,
};
- res.send(info);
+ return c.json(info);
},
};