Skip to content

Commit

Permalink
Hide lightning swap button if on-chain balance is only force closes
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman authored and futurepaul committed Nov 6, 2023
1 parent 2226e9f commit e6e3113
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/BalanceBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export function BalanceBox(props: { loading?: boolean }) {
(state.balance?.unconfirmed || 0n) +
(state.balance?.force_close || 0n);

const usableOnchain = () =>
(state.balance?.confirmed || 0n) + (state.balance?.unconfirmed || 0n);

return (
<>
<FancyCard>
Expand Down Expand Up @@ -115,7 +118,7 @@ export function BalanceBox(props: { loading?: boolean }) {
<Show when={state.balance?.unconfirmed === 0n}>
<div />
</Show>
<Show when={totalOnchain() != 0n}>
<Show when={usableOnchain() > 0n}>
<div class="self-end justify-self-end">
<A href="/swap" class={STYLE}>
<img
Expand Down

0 comments on commit e6e3113

Please sign in to comment.