Updated on 2026-08-14
This commit is contained in:
parent
b0ec905375
commit
bb4e442b4d
2 changed files with 24 additions and 1 deletions
|
|
@ -40,6 +40,29 @@ object BigDecimalFormatter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun formatCryptoAmountUncapped(
|
||||||
|
cryptoAmount: BigDecimal?,
|
||||||
|
cryptoCurrency: CryptoCurrency,
|
||||||
|
locale: Locale = Locale.getDefault(),
|
||||||
|
): String {
|
||||||
|
if (cryptoAmount == null) return EMPTY_BALANCE_SIGN
|
||||||
|
|
||||||
|
val formatter = NumberFormat.getNumberInstance(locale).apply {
|
||||||
|
maximumFractionDigits = cryptoCurrency.decimals
|
||||||
|
minimumFractionDigits = 2
|
||||||
|
isGroupingUsed = true
|
||||||
|
roundingMode = RoundingMode.DOWN
|
||||||
|
}
|
||||||
|
|
||||||
|
return formatter.format(cryptoAmount).let {
|
||||||
|
if (cryptoCurrency.symbol.isEmpty()) {
|
||||||
|
it
|
||||||
|
} else {
|
||||||
|
it + "\u2009${cryptoCurrency.symbol}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun formatCryptoAmount(
|
fun formatCryptoAmount(
|
||||||
cryptoAmount: BigDecimal?,
|
cryptoAmount: BigDecimal?,
|
||||||
cryptoCurrency: CryptoCurrency,
|
cryptoCurrency: CryptoCurrency,
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ internal class SendNotificationFactory(
|
||||||
if (currencyDeposit != null && currencyDeposit > diff) {
|
if (currencyDeposit != null && currencyDeposit > diff) {
|
||||||
add(
|
add(
|
||||||
SendNotification.Error.ExistentialDeposit(
|
SendNotification.Error.ExistentialDeposit(
|
||||||
BigDecimalFormatter.formatCryptoAmount(
|
BigDecimalFormatter.formatCryptoAmountUncapped(
|
||||||
cryptoAmount = currencyDeposit,
|
cryptoAmount = currencyDeposit,
|
||||||
cryptoCurrency = cryptoCurrency,
|
cryptoCurrency = cryptoCurrency,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue