Skip to content

Commit

Permalink
Show the channel fee warning from federation swap
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyRonning committed Feb 1, 2024
1 parent f8f0103 commit 8a9ebc7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/components/ReceiveWarnings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { FeesModal } from "~/components/MoreInfoModal";
import { useI18n } from "~/i18n/context";
import { useMegaStore } from "~/state/megaStore";

export function ReceiveWarnings(props: { amountSats: string | bigint }) {
export function ReceiveWarnings(props: {
amountSats: string | bigint;
from_fedi_to_ln: boolean;
}) {
const i18n = useI18n();
const [state, _actions] = useMegaStore();

Expand All @@ -26,7 +29,7 @@ export function ReceiveWarnings(props: { amountSats: string | bigint }) {
});

const warningText = () => {
if (state.federations?.length !== 0) {
if (state.federations?.length !== 0 && props.from_fedi_to_ln != true) {
return undefined;
}
if ((state.balance?.lightning || 0n) === 0n) {
Expand Down
5 changes: 4 additions & 1 deletion src/routes/Receive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,10 @@ export function Receive() {
setAmountSats={setAmount}
onSubmit={getQr}
/>
<ReceiveWarnings amountSats={amount() || "0"} />
<ReceiveWarnings
amountSats={amount() || "0"}
from_fedi_to_ln={false}
/>
</VStack>
<div class="flex-1" />
<VStack>
Expand Down
5 changes: 5 additions & 0 deletions src/routes/SwapLightning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
MegaEx,
MutinyWalletGuard,
NavBar,
ReceiveWarnings,
showToast,
SuccessModal,
TextField,
Expand Down Expand Up @@ -205,6 +206,10 @@ export function SwapLightning() {
}
]}
/>
<ReceiveWarnings
amountSats={amountSats() || "0"}
from_fedi_to_ln={true}
/>
<Show when={amountWarning() && amountSats() > 0n}>
<InfoBox accent={"red"}>{amountWarning()}</InfoBox>
</Show>
Expand Down

0 comments on commit 8a9ebc7

Please sign in to comment.