Updated on 2026-08-14

This commit is contained in:
Tangem 2024-05-02 09:59:35 +05:00
commit 5560ebe964
6 changed files with 23 additions and 10 deletions

View file

@ -71,7 +71,10 @@ internal class DefaultTransactionRepository(
}
Blockchain.Binance -> BinanceTransactionExtras(memo)
Blockchain.XRP -> memo.toLongOrNull()?.let { XrpTransactionBuilder.XrpTransactionExtras(it) }
Blockchain.Cosmos -> CosmosTransactionExtras(memo)
Blockchain.Cosmos,
Blockchain.TerraV1,
Blockchain.TerraV2,
-> CosmosTransactionExtras(memo)
Blockchain.TON -> TonTransactionExtras(memo)
Blockchain.Hedera -> HederaTransactionBuilder.HederaTransactionExtras(memo)
Blockchain.Algorand -> AlgorandTransactionExtras(memo)

View file

@ -264,10 +264,18 @@ internal class CurrenciesStatusesOperations(
var quotesRetrievingFailed = false
val networksStatuses = maybeNetworkStatuses?.bind()?.toNonEmptySetOrNull()
val quotes = recover({ maybeQuotes?.bind()?.toNonEmptySetOrNull() }) {
quotesRetrievingFailed = true
null
}
val quotes: Set<Quote>? = maybeQuotes?.fold(
ifLeft = {
quotesRetrievingFailed = true
null
},
ifRight = {
it.ifEmpty {
quotesRetrievingFailed = true
null
}
},
)
currencies.map { currency ->
val quote = quotes?.firstOrNull { it.rawCurrencyId == currency.id.rawCurrencyId }

View file

@ -34,7 +34,7 @@ internal class StateRouter(
when {
isSuccess -> popBackStack()
isEditingDisabled -> when (type) {
SendUiStateType.Send -> showFee()
SendUiStateType.EditFee -> showSend()
else -> popBackStack()
}
else -> when (type) {

View file

@ -71,7 +71,7 @@ internal class SendNotificationFactory(
buildList {
// errors
addFeeUnreachableNotification(feeState.feeSelectorState)
addExceedBalanceNotification(feeValue, sendingAmount)
addExceedBalanceNotification(feeValue, sendingAmount, isFeeCoverage)
addExceedsBalanceNotification(feeState.fee)
addDustWarningNotification(feeValue, sendingAmount)
addTransactionLimitErrorNotification(feeValue, sendingAmount)
@ -107,11 +107,12 @@ internal class SendNotificationFactory(
private fun MutableList<SendNotification>.addExceedBalanceNotification(
feeAmount: BigDecimal,
receivedAmount: BigDecimal,
isFeeCoverage: Boolean,
) {
val cryptoCurrencyStatus = cryptoCurrencyStatusProvider()
val balance = cryptoCurrencyStatus.value.amount ?: BigDecimal.ZERO
if (!isSubtractAvailableProvider()) return
if (isFeeCoverage) return
val showNotification = receivedAmount + feeAmount > balance
if (showNotification) {

View file

@ -45,7 +45,7 @@ internal fun checkFeeCoverage(
feeValue: BigDecimal,
): Boolean {
if (!isSubtractAvailable) return false
return balance < amountValue + feeValue && balance > feeValue
return balance < amountValue + feeValue && balance > feeValue && balance >= amountValue
}
/**

View file

@ -667,7 +667,7 @@ internal class SendViewModel @Inject constructor(
private fun autoNextFromRecipient(type: EnterAddressSource?, isValidAddress: Boolean) {
val isRecent = type == EnterAddressSource.RecentAddress
if (isRecent && isValidAddress) onNextClick()
if (isRecent && isValidAddress) onNextClick(stateRouter.isEditState)
}
// endregion
@ -702,6 +702,7 @@ internal class SendViewModel @Inject constructor(
val isShowStatus = uiState.feeState?.fee == null
if (isShowStatus) {
uiState = feeStateFactory.onFeeOnLoadingState()
updateNotifications()
}
val result = callFeeUseCase()?.fold(
ifRight = {