Updated on 2026-08-14

This commit is contained in:
Tangem 2024-12-11 20:36:32 +03:00
commit dce4c8c295
5 changed files with 43 additions and 2 deletions

View file

@ -42,6 +42,41 @@ object NotificationsFactory {
}
}
fun MutableList<NotificationUM>.addFeeUnreachableNotification(
tokenStatus: CryptoCurrencyStatus,
coinStatus: CryptoCurrencyStatus,
feeError: GetFeeError?,
onReload: () -> Unit,
onClick: (currency: CryptoCurrency) -> Unit,
) {
when (feeError) {
is GetFeeError.BlockchainErrors.TronActivationError -> add(
NotificationUM.Warning.TronAccountNotActivated(coinStatus.currency.name),
)
is GetFeeError.BlockchainErrors.KaspaZeroUtxo -> add(
NotificationUM.Error.TokenExceedsBalance(
networkIconId = coinStatus.currency.networkIconResId,
networkName = coinStatus.currency.name,
currencyName = tokenStatus.currency.name,
feeName = coinStatus.currency.name,
feeSymbol = coinStatus.currency.symbol,
mergeFeeNetworkName = false,
onClick = {
onClick(coinStatus.currency)
},
),
)
is GetFeeError.DataError,
is GetFeeError.UnknownError,
-> add(
NotificationUM.Warning.NetworkFeeUnreachable(onReload),
)
else -> {
/* do nothing */
}
}
}
fun MutableList<NotificationUM>.addExceedBalanceNotification(
feeAmount: BigDecimal,
sendingAmount: BigDecimal,

View file

@ -6,5 +6,6 @@ sealed class GetFeeError {
sealed class BlockchainErrors : GetFeeError() {
data object TronActivationError : BlockchainErrors()
data object KaspaZeroUtxo : BlockchainErrors()
}
}

View file

@ -8,6 +8,9 @@ fun Result.Failure.mapToFeeError(): GetFeeError {
is BlockchainSdkError.Tron.AccountActivationError -> {
GetFeeError.BlockchainErrors.TronActivationError
}
is BlockchainSdkError.Kaspa.ZeroUtxoError -> {
GetFeeError.BlockchainErrors.KaspaZeroUtxo
}
else -> GetFeeError.DataError(this.error)
}
}

View file

@ -153,9 +153,11 @@ internal class SendNotificationFactory(
).getOrNull()
addFeeUnreachableNotification(
tokenStatus = cryptoCurrencyStatus,
coinStatus = feeCryptoCurrencyStatusProvider() ?: cryptoCurrencyStatus,
feeError = feeError,
tokenName = currency.name,
onReload = clickIntents::feeReload,
onClick = clickIntents::onTokenDetailsClick,
)
addExceedBalanceNotification(
feeAmount = feeValue,

View file

@ -88,7 +88,7 @@ markdownComposeView = "0.5.4"
# endregion Other libraries
# region Tangem
tangemBlockchainSdk = "release-app_5.19-882"
tangemBlockchainSdk = "release-app_5.19-883"
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
tangemCardSdk = "release-app_5.19-414"
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^