Skip to content

Commit 327ba8c

Browse files
committed
fix: use individual balance instead of total balance
1 parent 8612bea commit 327ba8c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,9 +1046,12 @@ class AppViewModel @Inject constructor(
10461046
if (_sendUiState.value.showSanityWarningDialog != null) return
10471047

10481048
val settings = settingsStore.data.first()
1049-
1049+
val balanceToCheck = when (_sendUiState.value.payMethod) {
1050+
SendMethod.ONCHAIN -> walletRepo.balanceState.value.maxSendOnchainSats
1051+
SendMethod.LIGHTNING -> walletRepo.balanceState.value.maxSendLightningSats
1052+
}
10501053
if (
1051-
amountSats > BigDecimal.valueOf(walletRepo.balanceState.value.totalSats.toLong())
1054+
amountSats > BigDecimal.valueOf(balanceToCheck.toLong())
10521055
.times(BigDecimal(MAX_BALANCE_FRACTION)).toLong().toUInt() &&
10531056
SanityWarning.OVER_HALF_BALANCE !in _sendUiState.value.confirmedWarnings
10541057
) {

0 commit comments

Comments
 (0)