Add lightning sweep functionality to fedimint

This commit is contained in:
Tony Giorgio
2024-02-01 05:20:04 -06:00
committed by Tony Giorgio
parent 666309fa70
commit a3e356dc09
8 changed files with 359 additions and 51 deletions

View File

@@ -94,21 +94,38 @@ export function BalanceBox(props: { loading?: boolean }) {
<Show when={state.federations && state.federations.length}>
<Show when={!props.loading} fallback={<LoadingShimmer />}>
<hr class="my-2 border-m-grey-750" />
<div class="flex flex-col gap-1">
<div class="text-2xl">
<AmountSats
amountSats={state.balance?.federation || 0}
icon="community"
denominationSize="lg"
isFederation
/>
</div>
<div class="text-lg text-white/70">
<AmountFiat
amountSats={state.balance?.federation || 0n}
denominationSize="sm"
/>
<div class="flex justify-between">
<div class="flex flex-col gap-1">
<div class="text-2xl">
<AmountSats
amountSats={
state.balance?.federation || 0
}
icon="community"
denominationSize="lg"
isFederation
/>
</div>
<div class="text-lg text-white/70">
<AmountFiat
amountSats={
state.balance?.federation || 0n
}
denominationSize="sm"
/>
</div>
</div>
<Show when={state.balance?.federation || 0n > 0n}>
<div class="self-end justify-self-end">
<A href="/swaplightning" class={STYLE}>
<img
src={shuffle}
alt="swaplightning"
class="h-6 w-6"
/>
</A>
</div>
</Show>
</div>
</Show>
</Show>

View File

@@ -0,0 +1,86 @@
import { MutinyInvoice } from "@mutinywallet/mutiny-wasm";
import { A, useNavigate, useSearchParams } from "@solidjs/router";
import {
createEffect,
createMemo,
createResource,
createSignal,
JSX,
Match,
onMount,
Show,
Suspense,
Switch
} from "solid-js";
import bolt from "~/assets/icons/bolt.svg";
import chain from "~/assets/icons/chain.svg";
import close from "~/assets/icons/close.svg";
import {
ActivityDetailsModal,
AmountEditable,
AmountFiat,
AmountSats,
BackPop,
Button,
DefaultMain,
Fee,
FeeDisplay,
HackActivityType,
InfoBox,
LabelCircle,
LoadingShimmer,
MegaCheck,
MegaClock,
MegaEx,
MethodChoice,
MutinyWalletGuard,
NavBar,
showToast,
SimpleInput,
SmallHeader,
StringShower,
SuccessModal,
UnstyledBackPop,
VStack
} from "~/components";
import { useI18n } from "~/i18n/context";
import { ParsedParams } from "~/logic/waila";
import { useMegaStore } from "~/state/megaStore";
import { eify, vibrateSuccess } from "~/utils";
export function Failure(props: { reason: string }) {
const i18n = useI18n();
return (
<Switch>
<Match when={props.reason === "Payment timed out."}>
<MegaClock />
<h1 class="mb-2 mt-4 w-full text-center text-2xl font-semibold md:text-3xl">
{i18n.t("send.payment_pending")}
</h1>
<InfoBox accent="white">
{i18n.t("send.payment_pending_description")}
</InfoBox>
</Match>
<Match
when={props.reason === "Channel reserve amount is too high."}
>
<MegaEx />
<h1 class="mb-2 mt-4 w-full text-center text-2xl font-semibold md:text-3xl">
{i18n.t("send.error_channel_reserves")}
</h1>
<InfoBox accent="white">
{i18n.t("send.error_channel_reserves_explained")}{" "}
<A href="/settings/channels">{i18n.t("common.why")}</A>
</InfoBox>
</Match>
<Match when={true}>
<MegaEx />
<h1 class="mb-2 mt-4 w-full text-center text-2xl font-semibold md:text-3xl">
{props.reason}
</h1>
</Match>
</Switch>
);
}

View File

@@ -36,6 +36,7 @@ export * from "./Restart";
export * from "./ResyncOnchain";
export * from "./SeedWords";
export * from "./SetupErrorDisplay";
export * from "./Failure";
export * from "./ShareCard";
export * from "./Toaster";
export * from "./NostrActivity";