show unconfirmed balance as well in methodchooser

This commit is contained in:
Paul Miller
2023-05-23 12:07:30 -05:00
parent 15ce9db8a7
commit 2f0220d2d0
2 changed files with 10 additions and 4 deletions

View File

@@ -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"
}
];
});

View File

@@ -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";
}