Updated on 2026-08-14

This commit is contained in:
Tangem 2024-11-27 15:23:46 +05:00
parent d0d9fcfef8
commit d772beda45
11 changed files with 90 additions and 41 deletions

View file

@ -113,10 +113,19 @@ object NotificationsFactory {
}
}
/**
* Adds Existential Warning
*
* @param existentialDeposit existential deposit of blockchain
* @param feeAmount amount of fee spending for transaction
* @param sendingAmount amount sending by user (excluding fee for coins)
* @param cryptoCurrencyStatus blockchain currency status
* @param onReduceClick action to leave existential amount in balance after transaction
*/
fun MutableList<NotificationUM>.addExistentialWarningNotification(
existentialDeposit: BigDecimal?,
feeAmount: BigDecimal,
receivedAmount: BigDecimal,
sendingAmount: BigDecimal,
cryptoCurrencyStatus: CryptoCurrencyStatus,
onReduceClick: (
reduceAmountBy: BigDecimal,
@ -129,7 +138,7 @@ object NotificationsFactory {
val spendingAmount = if (cryptoCurrency is CryptoCurrency.Token) {
feeAmount
} else {
receivedAmount + feeAmount
sendingAmount
}
val diff = balance.minus(spendingAmount)
if (existentialDeposit != null && diff >= BigDecimal.ZERO && existentialDeposit > diff) {