alby-hub/frontend/src/routes.tsx
frnandu b55978d7bc
feat: just in time channels with lsps2 (#2275)
* feat: just in time channels with lsps2

* fix: clarify JIT receive channel fee

* fix: fees

* fix: fees 2

* fix: don't show low inbound when LSPS2 is active

* fix: remove the receive limit below the input if LSPS2 is being used

* fix: simplify

* fix: bring back fee % for outgoing

* fix: remove unneeded changes

* fix: typo

* fix: unneeded

* fix: don't show open first channel is LSPS2

* feat: clearer JIT channel fee copy on receive screen

* fix: add LSPS2 var info

* fix: don't duplicate JIT fee hint on create invoice form

* fix: make paymentDone a standard boolean

* fix: update to golang:1.26 in Dockerfile

* feat: read LSPS2 sources from channel suggestions, set minimum receive amount, update guide link

* docs:  update LDK_LSPS2_ADDRESSES to be used as an override

* fix: only show minimum jit receive amount on validation error

* fix: add more detail to receive error when receiving low amounts with jit

* fix: do not use JIT when user has public channels

* feat: add option to disable JIT

* fix: isTrusted check, add jit property to event

* fix: do not require node restart for toggling JIT

* chore: simplify JIT alert

* chore: add guide link on node settings JIT description

* feat: fetch the lsp2info to have access to params like minimum/maximum payment size

* refactor: share single learn-more link across JIT fee hint branches

* fix: remove variable amount invoice support

* fix: use lsps2info for min payment size and remove channelPeerSuggestion usage of minimumChannelSize

* fix: only do amount validation according to lsps2Info values if jit is enabled in settings

* feat: add jit first payment fee alert on receive via lightning address

* fix: remove unnecessary conditional

* fix: ensure at least one sat is left over when opening JIT channel

* chore: remove hardcoded suggestions

* chore: rename JIT enabled config variable

* fix: ui checks when JIT is disabled

* fix: amount input validation message

* fix: formatting

---------

Co-authored-by: anon <anon@anon.com>
Co-authored-by: saunter <68239231+stackingsaunter@users.noreply.github.com>
Co-authored-by: fmar <fmar@fmar>
Co-authored-by: René Aaron <rene@twentyuno.net>
Co-authored-by: Roland Bewick <roland.bewick@gmail.com>
2026-06-10 14:47:07 +07:00

609 lines
18 KiB
TypeScript

import { Navigate, RouteObject } from "react-router";
import AppLayout from "src/components/layouts/AppLayout";
import SettingsLayout from "src/components/layouts/SettingsLayout";
import WalletLayout from "src/components/layouts/WalletLayout";
import TwoColumnFullScreenLayout from "src/components/layouts/TwoColumnFullScreenLayout";
import { DefaultRedirect } from "src/components/redirects/DefaultRedirect";
import { HomeRedirect } from "src/components/redirects/HomeRedirect";
import { SetupRedirect } from "src/components/redirects/SetupRedirect";
import { StartRedirect } from "src/components/redirects/StartRedirect";
import { ConnectAlbyAccount } from "src/screens/ConnectAlbyAccount";
import { CreateNodeMigrationFileSuccess } from "src/screens/CreateNodeMigrationFileSuccess";
import Home from "src/screens/Home";
import { Intro } from "src/screens/Intro";
import { MigrateNode } from "src/screens/MigrateNode";
import NotFound from "src/screens/NotFound";
import Start from "src/screens/Start";
import Unlock from "src/screens/Unlock";
import { Welcome } from "src/screens/Welcome";
import AlbyAuthRedirect from "src/screens/alby/AlbyAuthRedirect";
import { AI } from "src/screens/ai/AI";
import { Cards } from "src/screens/cards/Cards";
import { AlbyEarn } from "src/screens/alby/AlbyEarn";
import SupportAlby from "src/screens/alby/SupportAlby";
import AppDetails from "src/screens/apps/AppDetails";
import { AppsCleanup } from "src/screens/apps/AppsCleanup";
import { Connections } from "src/screens/apps/Connections";
import NewApp from "src/screens/apps/NewApp";
import { AppStoreDetail } from "src/screens/appstore/AppStoreDetail";
import Channels from "src/screens/channels/Channels";
import { CurrentChannelOrder } from "src/screens/channels/CurrentChannelOrder";
import IncreaseIncomingCapacity from "src/screens/channels/IncreaseIncomingCapacity";
import IncreaseOutgoingCapacity from "src/screens/channels/IncreaseOutgoingCapacity";
import { AutoChannel } from "src/screens/channels/auto/AutoChannel";
import { OpenedAutoChannel } from "src/screens/channels/auto/OpenedAutoChannel";
import { OpeningAutoChannel } from "src/screens/channels/auto/OpeningAutoChannel";
import { FirstChannel } from "src/screens/channels/first/FirstChannel";
import { OpenedFirstChannel } from "src/screens/channels/first/OpenedFirstChannel";
import { OpeningFirstChannel } from "src/screens/channels/first/OpeningFirstChannel";
import { AlbyCliSkill } from "src/screens/internal-apps/AlbyCliSkill";
import { BuzzPay } from "src/screens/internal-apps/BuzzPay";
import { LightningMessageboard } from "src/screens/internal-apps/LightningMessageboard";
import { SimpleBoost } from "src/screens/internal-apps/SimpleBoost";
import { Tictactoe } from "src/screens/internal-apps/Tictactoe";
import { ZapPlanner } from "src/screens/internal-apps/ZapPlanner";
import BuyBitcoin from "src/screens/onchain/BuyBitcoin";
import DepositBitcoin from "src/screens/onchain/DepositBitcoin";
import ConnectPeer from "src/screens/peers/ConnectPeer";
import Peers from "src/screens/peers/Peers";
import { About } from "src/screens/settings/About";
import { AlbyAccount } from "src/screens/settings/AlbyAccount";
import { AutoUnlock } from "src/screens/settings/AutoUnlock";
import { NodeSettings } from "src/screens/settings/NodeSettings";
import Backup from "src/screens/settings/Backup";
import { ChangeUnlockPassword } from "src/screens/settings/ChangeUnlockPassword";
import DebugTools from "src/screens/settings/DebugTools";
import DeveloperSettings from "src/screens/settings/DeveloperSettings";
import Settings from "src/screens/settings/Settings";
import { ImportMnemonic } from "src/screens/setup/ImportMnemonic";
import { RestoreNode } from "src/screens/setup/RestoreNode";
import { SetupAdvanced } from "src/screens/setup/SetupAdvanced";
import { SetupFinish } from "src/screens/setup/SetupFinish";
import { SetupNode } from "src/screens/setup/SetupNode";
import { SetupPassword } from "src/screens/setup/SetupPassword";
import { SetupSecurity } from "src/screens/setup/SetupSecurity";
import { BarkForm } from "src/screens/setup/node/BarkForm";
import { CLNForm } from "src/screens/setup/node/CLNForm";
import { CashuForm } from "src/screens/setup/node/CashuForm";
import { LDKForm } from "src/screens/setup/node/LDKForm";
import { LNDForm } from "src/screens/setup/node/LNDForm";
import { PhoenixdForm } from "src/screens/setup/node/PhoenixdForm";
import { PresetNodeForm } from "src/screens/setup/node/PresetNodeForm";
import { NewSubwallet } from "src/screens/subwallets/NewSubwallet";
import { SubwalletCreated } from "src/screens/subwallets/SubwalletCreated";
import { SubwalletList } from "src/screens/subwallets/SubwalletList";
import Lightning from "src/screens/wallet/Lightning";
import Onchain from "src/screens/wallet/Onchain";
import NodeAlias from "src/screens/wallet/NodeAlias";
import Receive from "src/screens/wallet/Receive";
import Send from "src/screens/wallet/Send";
import SignMessage from "src/screens/wallet/SignMessage";
import WithdrawOnchainFunds from "src/screens/wallet/WithdrawOnchainFunds";
import ReceiveInvoice from "src/screens/wallet/receive/ReceiveInvoice";
import ReceiveOffer from "src/screens/wallet/receive/ReceiveOffer";
import ReceiveOnchain from "src/screens/wallet/receive/ReceiveOnchain";
import ConfirmPayment from "src/screens/wallet/send/ConfirmPayment";
import LnurlPay from "src/screens/wallet/send/LnurlPay";
import OnchainSend from "src/screens/wallet/send/Onchain";
import OnchainSuccess from "src/screens/wallet/send/OnchainSuccess";
import PaymentSuccess from "src/screens/wallet/send/PaymentSuccess";
import ZeroAmount from "src/screens/wallet/send/ZeroAmount";
import Swap from "src/screens/wallet/swap";
import AutoSwap from "src/screens/wallet/swap/AutoSwap";
import SwapInStatus from "src/screens/wallet/swap/SwapInStatus";
import SwapOutStatus from "src/screens/wallet/swap/SwapOutStatus";
const routes: RouteObject[] = [
{
path: "/",
element: <AppLayout />,
handle: { crumb: () => "Home" },
children: [
{
index: true,
element: <HomeRedirect />,
},
{
path: "home",
element: <DefaultRedirect />,
handle: { crumb: () => "Dashboard" },
children: [
{
index: true,
element: <Home />,
},
],
},
{
path: "wallet",
element: <DefaultRedirect />,
handle: { crumb: () => "Wallet" },
children: [
{
element: <WalletLayout />,
children: [
{
index: true,
element: <Lightning />,
},
{
path: "onchain",
element: <Onchain />,
},
],
},
{
path: "swap",
handle: { crumb: () => "Swap" },
children: [
{
index: true,
element: <Swap />,
},
{
path: "out/status/:swapId",
element: <SwapOutStatus />,
},
{
path: "in/status/:swapId",
element: <SwapInStatus />,
},
{
path: "auto",
element: <AutoSwap />,
},
],
},
{
path: "receive",
handle: { crumb: () => "Receive" },
children: [
{
index: true,
element: <Receive />,
},
{
handle: { crumb: () => "Receive On-chain" },
path: "onchain",
element: <ReceiveOnchain />,
},
{
handle: { crumb: () => "Invoice" },
path: "invoice",
element: <ReceiveInvoice />,
},
{
handle: { crumb: () => "BOLT-12 Offer" },
path: "offer",
element: <ReceiveOffer />,
},
],
},
{
path: "send",
handle: { crumb: () => "Send" },
children: [
{
index: true,
element: <Send />,
},
{
path: "onchain",
element: <OnchainSend />,
},
{
path: "lnurl-pay",
element: <LnurlPay />,
},
{
path: "0-amount",
element: <ZeroAmount />,
},
{
path: "confirm-payment",
element: <ConfirmPayment />,
},
{
path: "onchain-success",
element: <OnchainSuccess />,
},
{
path: "success",
element: <PaymentSuccess />,
},
],
},
{
path: "sign-message",
element: <SignMessage />,
handle: { crumb: () => "Sign Message" },
},
{
path: "node-alias",
element: <NodeAlias />,
handle: { crumb: () => "Node Alias" },
},
{
path: "withdraw",
element: <WithdrawOnchainFunds />,
handle: { crumb: () => "Withdraw On-Chain Balance" },
},
],
},
{
path: "settings",
element: <DefaultRedirect />,
handle: { crumb: () => "Settings" },
children: [
{
path: "",
element: <SettingsLayout />,
children: [
{
index: true,
element: <Settings />,
},
{
path: "about",
element: <About />,
handle: { crumb: () => "About" },
},
{
path: "auto-unlock",
element: <AutoUnlock />,
handle: { crumb: () => "Auto Unlock" },
},
{
path: "node",
element: <NodeSettings />,
handle: { crumb: () => "Node" },
},
{
path: "change-unlock-password",
element: <ChangeUnlockPassword />,
handle: { crumb: () => "Unlock Password" },
},
{
path: "backup",
element: <Backup />,
handle: { crumb: () => "Backup" },
},
{
path: "node-migrate",
element: <MigrateNode />,
},
{
path: "alby-account",
element: <AlbyAccount />,
},
{
path: "developer",
element: <DeveloperSettings />,
},
{
path: "debug-tools",
element: <DebugTools />,
},
],
},
],
},
{
path: "apps",
element: <DefaultRedirect />,
handle: { crumb: () => "Connections" },
children: [
{
index: true,
element: <Connections />,
},
{
path: ":id",
element: <AppDetails />,
},
{
path: "new",
element: <NewApp />,
handle: { crumb: () => "New App" },
},
{
path: "cleanup",
element: <AppsCleanup />,
},
],
},
{
path: "sub-wallets",
element: <DefaultRedirect />,
handle: { crumb: () => "Sub-wallets" },
children: [
{
index: true,
element: <SubwalletList />,
},
{
path: "new",
element: <NewSubwallet />,
},
{
path: "created",
element: <SubwalletCreated />,
},
],
},
{
path: "internal-apps",
element: <DefaultRedirect />,
handle: { crumb: () => "Connections" },
children: [
{
path: "buzzpay",
element: <BuzzPay />,
},
{
path: "simpleboost",
element: <SimpleBoost />,
},
{
path: "lightning-messageboard",
element: <LightningMessageboard />,
},
{
path: "zapplanner",
element: <ZapPlanner />,
},
{
path: "alby-cli-skill",
element: <AlbyCliSkill />,
},
{
path: "tictactoe",
element: <Tictactoe />,
},
],
},
{
path: "appstore",
element: <DefaultRedirect />,
handle: { crumb: () => "App Store" },
children: [
{
path: ":appStoreId",
element: <AppStoreDetail />,
},
],
},
{
path: "channels",
element: <DefaultRedirect />,
handle: { crumb: () => "Node" },
children: [
{
index: true,
element: <Channels />,
},
{
path: "first",
handle: { crumb: () => "Your First Channel" },
children: [
{
index: true,
element: <FirstChannel />,
},
{
path: "opening",
element: <OpeningFirstChannel />,
},
{
path: "opened",
element: <OpenedFirstChannel />,
},
],
},
{
path: "auto",
handle: { crumb: () => "New Channel" },
children: [
{
index: true,
element: <AutoChannel />,
},
{
path: "opening",
element: <OpeningAutoChannel />,
},
{
path: "opened",
element: <OpenedAutoChannel />,
},
],
},
{
path: "outgoing",
element: <IncreaseOutgoingCapacity />,
handle: { crumb: () => "Open Channel with On-Chain" },
},
{
path: "incoming",
element: <IncreaseIncomingCapacity />,
handle: { crumb: () => "Open Channel with Lightning" },
},
{
path: "order",
element: <CurrentChannelOrder />,
handle: { crumb: () => "Current Order" },
},
{
path: "onchain/buy-bitcoin",
element: <BuyBitcoin />,
handle: { crumb: () => "Buy Bitcoin" },
},
{
path: "onchain/deposit-bitcoin",
element: <DepositBitcoin />,
handle: { crumb: () => "Deposit Bitcoin" },
},
],
},
{
path: "peers",
element: <DefaultRedirect />,
handle: { crumb: () => "Peers" },
children: [
{
index: true,
element: <Peers />,
},
{
path: "new",
element: <ConnectPeer />,
handle: { crumb: () => "Connect Peer" },
},
],
},
{
path: "support-alby",
element: <SupportAlby />,
},
{
path: "earn",
element: <AlbyEarn />,
handle: { crumb: () => "Earn" },
},
{
path: "ai",
element: <AI />,
handle: { crumb: () => "AI & Agents" },
},
{
path: "cards",
element: <DefaultRedirect />,
handle: { crumb: () => "Cards" },
children: [{ index: true, element: <Cards /> }],
},
],
},
{
element: <TwoColumnFullScreenLayout />,
children: [
{
path: "start",
element: (
<StartRedirect>
<Start />
</StartRedirect>
),
},
{
path: "alby/account",
element: <ConnectAlbyAccount />,
},
{
path: "alby/auth",
element: <AlbyAuthRedirect />,
},
{
path: "unlock",
element: <Unlock />,
},
{
path: "welcome",
element: <Welcome />,
},
{
path: "setup",
element: <SetupRedirect />,
children: [
{
element: <Navigate to="password" replace />,
},
{
path: "alby",
element: <ConnectAlbyAccount connectUrl="/setup/auth" />,
},
{
path: "auth",
element: <AlbyAuthRedirect />,
},
{
path: "password",
element: <SetupPassword />,
},
{
path: "security",
element: <SetupSecurity />,
},
{
path: "node",
children: [
{
index: true,
element: <SetupNode />,
},
{
path: "cashu",
element: <CashuForm />,
},
{
path: "phoenix",
element: <PhoenixdForm />,
},
{
path: "lnd",
element: <LNDForm />,
},
{
path: "ldk",
element: <LDKForm />,
},
{
path: "cln",
element: <CLNForm />,
},
{
path: "bark",
element: <BarkForm />,
},
{
path: "preset",
element: <PresetNodeForm />,
},
],
},
{
path: "advanced",
element: <SetupAdvanced />,
},
{
path: "import-mnemonic",
element: <ImportMnemonic />,
},
{
path: "node-restore",
element: <RestoreNode />,
},
{
path: "finish",
element: <SetupFinish />,
},
],
},
],
},
{
path: "create-node-migration-file-success",
element: <CreateNodeMigrationFileSuccess />,
},
{
path: "intro",
element: <Intro />,
},
{
path: "/*",
element: <NotFound />,
},
];
export default routes;