From 941266365e805e29e326071d5329c6c95ce3581b Mon Sep 17 00:00:00 2001 From: David Kaspar Date: Sat, 31 Aug 2024 19:24:12 +0100 Subject: [PATCH 1/2] millisats were incorrectly multiplied by 1000 --- .../amethyst/ui/screen/loggedIn/AccountViewModel.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index 394d8cf18..ed049e280 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -30,7 +30,6 @@ import androidx.compose.runtime.MutableState import androidx.compose.runtime.Stable import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider -import androidx.lifecycle.map import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewmodel.compose.viewModel import coil.imageLoader @@ -44,7 +43,6 @@ import com.vitorpamplona.amethyst.model.AccountSettings import com.vitorpamplona.amethyst.model.AddressableNote import com.vitorpamplona.amethyst.model.Channel import com.vitorpamplona.amethyst.model.LocalCache -import com.vitorpamplona.amethyst.model.LocalCache.notes import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.model.UrlCachedPreviewer import com.vitorpamplona.amethyst.model.User @@ -1480,7 +1478,7 @@ class AccountViewModel( LightningAddressResolver() .lnAddressInvoice( lnaddress, - milliSats * 1000, + milliSats, message, null, onSuccess = onSuccess, @@ -1494,7 +1492,7 @@ class AccountViewModel( LightningAddressResolver() .lnAddressInvoice( lnaddress, - milliSats * 1000, + milliSats, message, zapRequest.toJson(), onSuccess = onSuccess, From a4a753e7b623da776afeb47d293551c04ece994e Mon Sep 17 00:00:00 2001 From: David Kaspar Date: Mon, 2 Sep 2024 12:26:26 +0200 Subject: [PATCH 2/2] Rename amount to amountInMillisats to give visual clue to calling classes that millisats should be used --- .../amethyst/ui/screen/loggedIn/AccountViewModel.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index ed049e280..62ed1ab4a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -607,7 +607,7 @@ class AccountViewModel( fun zap( note: Note, - amount: Long, + amountInMillisats: Long, pollOption: Int?, message: String, context: Context, @@ -621,7 +621,7 @@ class AccountViewModel( ZapPaymentHandler(account) .zap( note = note, - amountMilliSats = amount, + amountMilliSats = amountInMillisats, pollOption = pollOption, message = message, context = context,