Updated on 2026-08-14

This commit is contained in:
Tangem 2024-01-10 16:32:16 +03:00
parent 8bba8e1afa
commit a73df2ac77
7 changed files with 14 additions and 13 deletions

View file

@ -4,7 +4,7 @@ import com.tangem.Message
import com.tangem.blockchain.blockchains.ethereum.EthereumGasLoader
import com.tangem.blockchain.blockchains.ethereum.EthereumTransactionExtras
import com.tangem.blockchain.blockchains.ethereum.EthereumUtils
import com.tangem.blockchain.blockchains.ethereum.EthereumUtils.Companion.toKeccak
import com.tangem.blockchain.blockchains.ethereum.EthereumUtils.toKeccak
import com.tangem.blockchain.common.*
import com.tangem.blockchain.common.transaction.Fee
import com.tangem.blockchain.extensions.Result

View file

@ -1,5 +1,6 @@
package com.tangem.tap.proxy
import androidx.core.text.isDigitsOnly
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.tangem.Message
import com.tangem.blockchain.blockchains.binance.BinanceTransactionExtras
@ -23,8 +24,6 @@ import com.tangem.core.analytics.api.AnalyticsEventHandler
import com.tangem.domain.card.repository.CardSdkConfigRepository
import com.tangem.domain.common.extensions.fromNetworkId
import com.tangem.domain.walletmanager.WalletManagersFacade
import com.tangem.features.send.impl.presentation.viewmodel.XlmMemoType
import com.tangem.features.send.impl.presentation.viewmodel.determineXlmMemoType
import com.tangem.lib.crypto.TransactionManager
import com.tangem.lib.crypto.models.*
import com.tangem.lib.crypto.models.transactions.SendTxResult
@ -153,11 +152,12 @@ class TransactionManagerImpl(
if (memo == null) return null
return when (blockchain) {
Blockchain.Stellar -> {
val xmlMemo = when (determineXlmMemoType(memo)) {
XlmMemoType.TEXT -> StellarMemo.Text(memo)
XlmMemoType.ID -> StellarMemo.Id(memo.toBigInteger())
val xlmMemo = if (memo.isNotEmpty() && memo.isDigitsOnly()) {
StellarMemo.Id(memo.toBigInteger())
} else {
StellarMemo.Text(memo)
}
StellarTransactionExtras(xmlMemo)
StellarTransactionExtras(xlmMemo)
}
Blockchain.Binance -> BinanceTransactionExtras(memo)
Blockchain.XRP -> memo.toLongOrNull()?.let { XrpTransactionBuilder.XrpTransactionExtras(it) }

View file

@ -2,6 +2,5 @@ package com.tangem.domain.transaction.error
sealed class GetFeeError {
data class DataError(val cause: Throwable?) : GetFeeError()
object UnknownError : GetFeeError()
}

View file

@ -29,7 +29,7 @@ class EstimateFeeUseCase(
amount: BigDecimal,
userWalletId: UserWalletId,
cryptoCurrency: CryptoCurrency,
): Flow<Either<GetFeeError.DataError, TransactionFee>> {
): Flow<Either<GetFeeError, TransactionFee>> {
return flow {
val result = walletManagersFacade.estimateFee(
amount = convertCryptoCurrencyToAmount(cryptoCurrency, amount),
@ -39,7 +39,8 @@ class EstimateFeeUseCase(
val maybeFee = when (result) {
is Result.Success -> result.data.right()
else -> GetFeeError.DataError.left()
is Result.Failure -> GetFeeError.DataError(result.error).left()
null -> GetFeeError.UnknownError.left()
}
emit(maybeFee)
}.flowOn(dispatcher.io)

View file

@ -20,7 +20,7 @@ import com.tangem.feature.swap.models.states.WebViewBottomSheetConfig
fun WebViewBottomSheet(config: TangemBottomSheetConfig) {
TangemBottomSheet(
config = config,
contentColor = TangemTheme.colors.background.tertiary,
containerColor = TangemTheme.colors.background.tertiary,
) { content: WebViewBottomSheetConfig ->
WebViewBottomSheetContent(
WebViewBottomSheetConfig(url = content.url),

View file

@ -5,7 +5,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.*
import arrow.core.getOrElse
import com.tangem.common.Provider
import com.tangem.core.analytics.api.AnalyticsEventHandler
import com.tangem.core.ui.utils.InputNumberFormatter
import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase
@ -32,6 +31,7 @@ import com.tangem.feature.swap.presentation.SwapFragment
import com.tangem.feature.swap.router.SwapNavScreen
import com.tangem.feature.swap.router.SwapRouter
import com.tangem.feature.swap.ui.StateBuilder
import com.tangem.utils.Provider
import com.tangem.utils.coroutines.*
import com.tangem.utils.isNullOrZero
import dagger.hilt.android.lifecycle.HiltViewModel
@ -606,7 +606,7 @@ internal class SwapViewModel @Inject constructor(
afterSearch = true,
),
)
)
} else {
tokenDataState.copy(
toGroup = tokenDataState.toGroup.copy(

View file

@ -28,6 +28,7 @@ internal class WalletWarningsAnalyticsSender @Inject constructor(
is WalletNotification.Warning.LowSignatures,
is WalletNotification.Warning.NetworksUnreachable,
is WalletNotification.Warning.SomeNetworksUnreachable,
is WalletNotification.SwapPromo,
-> null
}
}