Skip to content

Commit

Permalink
on-chain warnings and hide zero amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul committed May 9, 2024
1 parent 2504e57 commit 1628a08
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
6 changes: 4 additions & 2 deletions public/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
"body": "Lightning receives will automatically go into your chosen federation. You can swap to self-custodial later if you want."
},
"receive_strings_error": "Something went wrong generating an invoice or on-chain address.",
"error_under_min_onchain": "That's under the dust limit! On-chain transactions should be much bigger."
"error_under_min_onchain": "That's under the dust limit! On-chain transactions should be much bigger.",
"warning_on_chain_fedi": "On-chain fedimint deposits require 10 confirmations."
},
"send": {
"search": {
Expand Down Expand Up @@ -190,7 +191,8 @@
"hodl_invoice_warning": "This is a hodl invoice. Payments to hodl invoices can cause channel force closes, which results in high on-chain fees. Pay at your own risk!",
"private": "Private",
"publiczap": "Public Zap",
"privatezap": "Private Zap"
"privatezap": "Private Zap",
"warn_address_reuse": "Only send to this address once."
},
"feedback": {
"header": "Give us feedback!",
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActivityDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function OnchainHeader(props: { info: OnChainTx; kind?: HackActivityType }) {
</Match>
</Switch>
</div>
<Show when={props.kind !== "ChannelClose"}>
<Show when={props.kind !== "ChannelClose" && Number(amount()) > 0}>
<div class="flex flex-col items-center">
<div
class="text-2xl"
Expand Down
13 changes: 12 additions & 1 deletion src/components/ReceiveWarnings.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createResource, Match, Switch } from "solid-js";
import { createMemo, createResource, Match, Switch } from "solid-js";

import { InfoBox } from "~/components/InfoBox";
import { FeesModal } from "~/components/MoreInfoModal";
Expand Down Expand Up @@ -79,6 +79,12 @@ export function ReceiveWarnings(props: {
}
};

const onChainFedi = createMemo(() => {
if (props.flavor === "onchain" && state.federations?.length) {
return true;
}
});

return (
<Switch>
<Match when={tooSmallWarning()}>
Expand All @@ -92,6 +98,11 @@ export function ReceiveWarnings(props: {
{warningText()} <FeesModal />
</InfoBox>
</Match>
<Match when={onChainFedi()}>
<InfoBox accent="blue">
{i18n.t("receive.warning_on_chain_fedi")}
</InfoBox>
</Match>
</Switch>
);
}
5 changes: 5 additions & 0 deletions src/routes/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,11 @@ export function Send() {
<p>{i18n.t("send.hodl_invoice_warning")}</p>
</InfoBox>
</Show>
<Show when={source() === "onchain"}>
<InfoBox accent="blue">
{i18n.t("send.warn_address_reuse")}
</InfoBox>
</Show>
<Show when={error() && !decodingLnUrl()}>
<InfoBox accent="red">
<p>{error()}</p>
Expand Down

0 comments on commit 1628a08

Please sign in to comment.