import { AlertTriangleIcon } from "lucide-react"; import { FormattedBitcoinAmount } from "src/components/FormattedBitcoinAmount"; import { Alert, AlertDescription, AlertTitle } from "src/components/ui/alert"; import { useBalances } from "src/hooks/useBalances"; import { useChannels } from "src/hooks/useChannels"; export function AnchorReserveAlert({ amountSat, className, }: { amountSat: number; className?: string; }) { const { data: balances } = useBalances(); const { data: channels } = useChannels(); if (!balances || !channels) { return null; } const showAlert = amountSat && !!channels.length && +amountSat > balances.onchain.spendableSat - channels.length * 25000; if (!showAlert) { return null; } return ( Channel Anchor Reserves will be depleted

You have channels open and by spending your entire on-chain balance including your anchor reserves may put your node at risk of unable to reclaim funds in your channel after a force-closure. To prevent this, set aside at least{" "} {" "} on-chain.

); }