import { toast } from "sonner";
import ExternalLink from "src/components/ExternalLink";
import Loading from "src/components/Loading";
import SettingsHeader from "src/components/SettingsHeader";
import { Label } from "src/components/ui/label";
import { Switch } from "src/components/ui/switch";
import { useInfo } from "src/hooks/useInfo";
import { handleRequestError } from "src/utils/handleRequestError";
import { request } from "src/utils/request";
export function NodeSettings() {
const { data: info, mutate: refetchInfo } = useInfo();
if (!info) {
return
Your Hub does not support this feature.
; } const hasJitSource = !!info.jitChannelsLiquiditySource; async function setJitChannelsEnabled(enabled: boolean) { try { await request("/api/settings", { method: "PATCH", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ jitChannelsEnabled: enabled }), }); await refetchInfo(); toast( enabled ? "Just-in-time channels enabled" : "Just-in-time channels disabled" ); } catch (error) { handleRequestError("Failed to update just-in-time channels", error); } } return ( <>
Automatically open a new channel through a liquidity provider when
you receive a payment that exceeds your receive limit. The
provider's fee is deducted from that payment.{" "}
Just-in-time channels are currently not available on your network.
)}