From 2f0220d2d053c68e625731b5a874e6af86121007 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Tue, 23 May 2023 12:07:30 -0500 Subject: [PATCH] show unconfirmed balance as well in methodchooser --- src/routes/Send.tsx | 9 ++++++--- src/routes/Swap.tsx | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/routes/Send.tsx b/src/routes/Send.tsx index 470b5fe..473f41d 100644 --- a/src/routes/Send.tsx +++ b/src/routes/Send.tsx @@ -65,9 +65,12 @@ export function MethodChooser(props: { { value: "onchain", label: "On-chain Balance", - caption: store.balance?.confirmed - ? `${store.balance?.confirmed.toLocaleString()} SATS` - : "No balance" + caption: + store.balance?.confirmed || store.balance?.unconfirmed + ? `${( + (store.balance?.confirmed || 0n) + (store.balance?.unconfirmed || 0n) + ).toLocaleString()} SATS` + : "No balance" } ]; }); diff --git a/src/routes/Swap.tsx b/src/routes/Swap.tsx index fce5dd4..9b2f63c 100644 --- a/src/routes/Swap.tsx +++ b/src/routes/Swap.tsx @@ -156,7 +156,10 @@ export default function Swap() { return "It's just silly to make a channel smaller than 10,000 sats"; } - if (amountSats() > (state.balance?.confirmed ?? 0n) || !feeEstimate()) { + if ( + amountSats() > (state.balance?.confirmed || 0n) + (state.balance?.unconfirmed || 0n) || + !feeEstimate() + ) { return "You don't have enough funds to make this channel"; }