Skip to content

Commit 286655e

Browse files
ovitrifclaude
andcommitted
fix: address review comments
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4c211df commit 286655e

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

app/src/main/java/to/bitkit/ext/Lnurl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fun LnurlPayData.isFixedAmount(): Boolean =
2828
* For variable-amount requests the user-selected sat amount is converted to msats.
2929
*/
3030
fun LnurlPayData.callbackAmountMsats(userSats: ULong? = null): ULong =
31-
if (isFixedAmount()) minSendable else (userSats ?: minSendableSat()) * 1000u
31+
if (isFixedAmount()) minSendable else (userSats ?: minSendableSat()) * MSat.PER_SAT
3232

3333
fun LnurlWithdrawData.minWithdrawableSat(): ULong = MSat(minWithdrawable ?: 0u).ceil()
3434
fun LnurlWithdrawData.maxWithdrawableSat(): ULong = MSat(maxWithdrawable).floor()

app/src/main/java/to/bitkit/models/MSat.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ package to.bitkit.models
1111
@JvmInline
1212
value class MSat(val value: ULong) {
1313

14+
companion object {
15+
const val PER_SAT: ULong = 1000u
16+
}
17+
1418
/** Round up to the nearest whole sat. Use for payment/display amounts. */
15-
fun ceil(): ULong = (value + 999u) / 1000u
19+
fun ceil(): ULong = (value + PER_SAT - 1u) / PER_SAT
1620

1721
/** Truncate sub-sat remainder. Use for fees and upper bounds. */
18-
fun floor(): ULong = value / 1000u
22+
fun floor(): ULong = value / PER_SAT
1923
}

app/src/main/java/to/bitkit/ui/NodeInfoScreen.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,9 @@ private fun ChannelsSection(
361361
)
362362
ChannelDetailRow(
363363
title = stringResource(R.string.lightning__inbound_htlc_max),
364-
value = "${(channel.inboundHtlcMaximumMsat?.let { MSat(it).floor() } ?: 0u).formatToModernDisplay()}",
364+
value = "${
365+
(channel.inboundHtlcMaximumMsat?.let { MSat(it).floor() } ?: 0u).formatToModernDisplay()
366+
}",
365367
)
366368
ChannelDetailRow(
367369
title = stringResource(R.string.lightning__inbound_htlc_min),

0 commit comments

Comments
 (0)