Skip to content

Commit 1fcb36b

Browse files
committed
chore: implement safe check
1 parent 327ba8c commit 1fcb36b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ import to.bitkit.models.NewTransactionSheetType
8383
import to.bitkit.models.Suggestion
8484
import to.bitkit.models.Toast
8585
import to.bitkit.models.TransactionSpeed
86+
import to.bitkit.models.safe
8687
import to.bitkit.models.toActivityFilter
8788
import to.bitkit.models.toTxType
8889
import to.bitkit.repositories.ActivityRepo
@@ -1479,11 +1480,7 @@ class AppViewModel @Inject constructor(
14791480
}
14801481

14811482
val buffer = 2uL
1482-
val amountToEstimate = if (maxSendLightning > buffer) {
1483-
maxSendLightning - buffer
1484-
} else {
1485-
maxSendLightning
1486-
}
1483+
val amountToEstimate = maxSendLightning.safe() - buffer.safe()
14871484

14881485
val feeResult = lightningRepo.estimateRoutingFeesForAmount(
14891486
bolt11 = bolt11,

0 commit comments

Comments
 (0)