From a1632ae402d11fdd7ffc360de97c55e0b4fad677 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 28 Feb 2026 14:14:30 -0800 Subject: migrate to hono --- routes/info.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'routes/info.ts') 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); }, }; -- cgit v1.2.3