Skip to content

Commit e91a052

Browse files
committed
fix: check for on-chain sufficient amount
1 parent 925b52b commit e91a052

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,18 @@ class AppViewModel @Inject constructor(
10681068
return
10691069
}
10701070

1071+
// Check if on-chain invoice amount exceeds available balance
1072+
if (invoice.amountSatoshis > 0uL && invoice.amountSatoshis > maxSendOnchain) {
1073+
val shortfall = invoice.amountSatoshis - maxSendOnchain
1074+
toast(
1075+
type = Toast.ToastType.ERROR,
1076+
title = context.getString(R.string.other__pay_insufficient_savings),
1077+
description = context.getString(R.string.other__pay_insufficient_savings_amount_description)
1078+
.replace("{amount}", shortfall.toString()),
1079+
)
1080+
return
1081+
}
1082+
10711083
Logger.info(
10721084
when (invoice.amountSatoshis > 0u) {
10731085
true -> "Found amount in invoice, proceeding to edit amount"

0 commit comments

Comments
 (0)