Updated on 2026-08-14
This commit is contained in:
parent
a80542d5da
commit
3d832ddd3e
13 changed files with 88 additions and 24 deletions
|
|
@ -22,6 +22,7 @@ import com.tangem.domain.tokens.GetBalanceNotEnoughForFeeWarningUseCase
|
|||
import com.tangem.domain.tokens.GetCurrencyCheckUseCase
|
||||
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
|
||||
import com.tangem.domain.tokens.model.warnings.CryptoCurrencyCheck
|
||||
import com.tangem.domain.tokens.model.warnings.CryptoCurrencyWarning
|
||||
import com.tangem.domain.transaction.error.GetFeeError
|
||||
import com.tangem.domain.transaction.usecase.ValidateTransactionUseCase
|
||||
import com.tangem.domain.utils.convertToSdkAmount
|
||||
|
|
@ -93,12 +94,15 @@ internal class SendNotificationFactory(
|
|||
val feeError = (feeState.feeSelectorState as? FeeSelectorState.Error)?.error
|
||||
|
||||
val recipientAddress = state.recipientState?.addressTextField?.value
|
||||
val statusValue = cryptoCurrencyStatus.value as? CryptoCurrencyStatus.Loaded
|
||||
val balanceAfterTransaction = statusValue?.let { it.amount - sendingAmount - feeValue }
|
||||
val currencyCheck = getCurrencyCheckUseCase(
|
||||
userWalletId = userWalletId,
|
||||
currencyStatus = cryptoCurrencyStatus,
|
||||
amount = sendingAmount,
|
||||
fee = feeValue,
|
||||
recipientAddress = recipientAddress,
|
||||
balanceAfterTransaction = balanceAfterTransaction,
|
||||
)
|
||||
buildList {
|
||||
addErrorNotifications(
|
||||
|
|
@ -221,6 +225,11 @@ internal class SendNotificationFactory(
|
|||
network = cryptoCurrencyStatus.currency.network,
|
||||
).leftOrNull()
|
||||
}
|
||||
|
||||
addRentExemptionNotification(
|
||||
rentWarning = currencyCheck.rentWarning,
|
||||
)
|
||||
|
||||
addExistentialWarningNotification(
|
||||
existentialDeposit = currencyCheck.existentialDeposit,
|
||||
feeAmount = feeState.fee?.amount?.value.orZero(),
|
||||
|
|
@ -303,4 +312,9 @@ internal class SendNotificationFactory(
|
|||
add(NotificationUM.Warning.TooHigh(diff))
|
||||
}
|
||||
}
|
||||
|
||||
private fun MutableList<NotificationUM>.addRentExemptionNotification(rentWarning: CryptoCurrencyWarning.Rent?) {
|
||||
if (rentWarning == null) return
|
||||
add(NotificationUM.Solana.RentInfo(rentWarning))
|
||||
}
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ internal fun LazyListScope.notifications(
|
|||
is NotificationUM.Warning,
|
||||
-> null
|
||||
is NotificationUM.Error -> TangemTheme.colors.icon.warning
|
||||
is NotificationUM.Info -> null
|
||||
is NotificationUM.Info -> TangemTheme.colors.icon.accent
|
||||
},
|
||||
isEnabled = !isClickDisabled,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue