Skip to content

Commit 21b3b99

Browse files
committed
feat: display liabilities
1 parent 5f24db5 commit 21b3b99

4 files changed

Lines changed: 33 additions & 0 deletions

File tree

frontend/src/components/node-stats.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export function NodeStats({ stats }: NodeStatsProps) {
2020
//const vps = stats.vps ?? 0;
2121
const totalSpendable = stats.totalSpendable ?? 0;
2222
const onchainBalance = stats.onchainBalance ?? 0;
23+
const liabilities = stats.totalWalletBalances ?? 0;
24+
const assets = totalSpendable + onchainBalance;
2325

2426
const totalLiquidity = liquidity.available + liquidity.used;
2527
const liquidityPercent =
@@ -79,6 +81,18 @@ export function NodeStats({ stats }: NodeStatsProps) {
7981
</div>
8082
</div>
8183
</TooltipProvider> */}
84+
<div>
85+
<div className="text-muted-foreground text-xs">Liabilities</div>
86+
<div className="font-mono text-foreground font-bold">
87+
{liabilities.toLocaleString()} sats
88+
</div>
89+
</div>
90+
<div className="text-end">
91+
<div className="text-muted-foreground text-xs">Assets</div>
92+
<div className="font-mono text-foreground font-bold">
93+
{assets.toLocaleString()} sats
94+
</div>
95+
</div>
8296
<div>
8397
<div className="text-muted-foreground text-xs">
8498
Lightning balance

frontend/src/lib/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export interface Stats {
3434
liquidity: { available: number; used: number; channels: number };
3535
totalSpendable: number;
3636
onchainBalance: number;
37+
totalWalletBalances: number;
3738
routing: { totalForwarded: number; forwardsCount: number };
3839
nodeAlias: string | null;
3940
nodePubkey: string | null;

frontend/src/pages/About.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,20 @@ export function About() {
179179
takes one curl.
180180
</p>
181181
</div>
182+
183+
<div>
184+
<p className="font-bold">How can I support lncurl.lol?</p>
185+
<p className="text-muted-foreground">
186+
Donations keep the node running. Send sats to{" "}
187+
<a
188+
href="lightning:lncurl@getalby.com"
189+
className="text-terminal hover:underline"
190+
>
191+
lncurl@getalby.com
192+
</a>
193+
.
194+
</p>
195+
</div>
182196
</CardContent>
183197
</Card>
184198
</div>

src/routes/stats.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export async function statsRoutes(fastify: FastifyInstance) {
1515
orderBy: { unlockedAt: "desc" },
1616
});
1717
const aliveCount = await prisma.wallet.count();
18+
const walletBalances = await prisma.wallet.aggregate({
19+
_sum: { lastKnownBalance: true },
20+
});
1821

1922
// At-risk wallets: those with lowest balance
2023
const atRisk = await prisma.wallet.findMany({
@@ -66,6 +69,7 @@ export async function statsRoutes(fastify: FastifyInstance) {
6669
liquidity,
6770
totalSpendable,
6871
onchainBalance: onchainTotal,
72+
totalWalletBalances: walletBalances._sum.lastKnownBalance ?? 0,
6973
routing: { totalForwarded: 0, forwardsCount: 0 }, // TODO: populate when Hub API supports it
7074
nodeAlias,
7175
nodePubkey,

0 commit comments

Comments
 (0)