From a4e8e059a7312e85acb110db84f29502a686f61a Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 8 May 2026 17:43:42 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../common/ui/notifications/NotificationUM.kt | 8 +++++++ .../ui/notifications/NotificationsFactory.kt | 24 +++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt index fe9115cfec..893ca50431 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt @@ -170,6 +170,14 @@ sealed class NotificationUM(val config: NotificationConfig) { subtitle = resourceReference(id = R.string.send_notification_invalid_reserve_amount_text), ) + data class NetworkAccountNotFunded(val coinName: String) : Error( + title = resourceReference(R.string.alert_failed_to_send_transaction_title), + subtitle = resourceReference( + id = R.string.no_account_generic, + formatArgs = wrappedList(coinName), + ), + ) + data object DestinationTagRequired : Error( title = resourceReference(id = R.string.send_validation_destination_tag_required_title), subtitle = resourceReference(id = R.string.send_validation_destination_tag_required_description), diff --git a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt index 4e0e7d90e5..b52325095e 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt @@ -136,14 +136,24 @@ object NotificationsFactory { // No need to show reserve amount warning if fee currency is unknown for token transfer return } else if (!isAccountFunded && reserveAmount != null && reserveAmount > sendingCoinAmount) { - add( - NotificationUM.Error.ReserveAmount( - reserveAmount.format { - crypto(feeCryptoCurrency ?: cryptoCurrency) - }, - ), - ) + // account not funded, sending coin amount < reserve (send coin with less amount OR send any token) + + if (cryptoCurrency is CryptoCurrency.Coin) { + // Try to send coin amount less than reserve amount (e.g. less than 1 XLM in Stellar) + add( + NotificationUM.Error.ReserveAmount( + reserveAmount.format { + crypto(feeCryptoCurrency ?: cryptoCurrency) + }, + ), + ) + } else { + checkNotNull(feeCryptoCurrency) + // Try to send any token (e.g. USDC in Stellar, but account not funded -> user must send XLM at first) + add(NotificationUM.Error.NetworkAccountNotFunded(coinName = feeCryptoCurrency.name)) + } } + // TODO: check the RECEIVER account trustline before sending } fun MutableList.addMinimumAmountErrorNotification(