@@ -598,6 +598,19 @@ class AppViewModel @Inject constructor(
598598 }
599599
600600 val lnurl = _sendUiState .value.lnurl
601+ if (lnurl is LnurlParams .LnurlPay ) {
602+ val minSendable = lnurl.data.minSendableSat()
603+ if (_sendUiState .value.amount < minSendable) {
604+ toast(
605+ type = Toast .ToastType .ERROR ,
606+ title = context.getString(R .string.wallet__lnurl_pay__error_min__title),
607+ description = context.getString(R .string.wallet__lnurl_pay__error_min__description)
608+ .replace(" {amount}" , minSendable.toString()),
609+ testTag = " LnurlPayAmountTooLowToast" ,
610+ )
611+ return
612+ }
613+ }
601614 if (lnurl is LnurlParams .LnurlWithdraw ) {
602615 setSendEffect(SendEffect .NavigateToWithdrawConfirm )
603616 return
@@ -630,10 +643,9 @@ class AppViewModel @Inject constructor(
630643 null -> lightningRepo.canSend(amount)
631644 is LnurlParams .LnurlWithdraw -> amount < lnurl.data.maxWithdrawableSat()
632645 is LnurlParams .LnurlPay -> {
633- val minSat = lnurl.data.minSendableSat()
634646 val maxSat = lnurl.data.maxSendableSat()
635647
636- amount in minSat .. maxSat && lightningRepo.canSend(amount)
648+ amount <= maxSat && lightningRepo.canSend(amount)
637649 }
638650 }
639651
@@ -823,15 +835,17 @@ class AppViewModel @Inject constructor(
823835 return
824836 }
825837
838+ val hasAmount = minSendable == maxSendable && minSendable > 0u
839+ val initialAmount = if (hasAmount) minSendable else 0u
840+
826841 _sendUiState .update {
827842 it.copy(
828- amount = minSendable ,
843+ amount = initialAmount ,
829844 payMethod = SendMethod .LIGHTNING ,
830845 lnurl = LnurlParams .LnurlPay (data),
831846 )
832847 }
833848
834- val hasAmount = minSendable == maxSendable && minSendable > 0u
835849 if (hasAmount) {
836850 Logger .info(" Found amount $$minSendable in lnurlPay, proceeding with payment" , context = TAG )
837851
0 commit comments