Updated on 2026-08-14

This commit is contained in:
Tangem 2026-03-20 21:54:46 +04:00
parent 8b75e37e30
commit a9bca131c3
386 changed files with 1369 additions and 1347 deletions

View file

@ -33,11 +33,10 @@ dependencies {
implementation(projects.libs.blockchainSdk)
implementation(projects.libs.crypto)
implementation(projects.core.utils)
implementation(deps.kotlin.datetime)
implementation(deps.kotlin.serialization)
implementation(deps.timber)
implementation(deps.kermit)
implementation(tangemDeps.blockchain)

View file

@ -1,12 +1,12 @@
package com.tangem.domain.account.status.producer
import co.touchlab.kermit.Logger
import com.tangem.core.analytics.api.AnalyticsExceptionHandler
import com.tangem.core.analytics.models.ExceptionAnalyticsEvent
import com.tangem.domain.core.flow.FlowProducer
import com.tangem.domain.core.flow.FlowProducerTools
import com.tangem.utils.coroutines.AppCoroutineScope
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import com.tangem.utils.logging.TangemLogger
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.*
import javax.inject.Inject
@ -55,7 +55,7 @@ class DefaultFlowProducerTools @Inject constructor(
private fun logError(cause: Throwable, flowProducerName: String, attempt: Long) {
val tag = "FlowProducerRetryWhen"
Logger.withTag(tag)
TangemLogger.withTag(tag)
.e("flowProducerName $flowProducerName attempt $attempt", cause)
val event = ExceptionAnalyticsEvent(

View file

@ -14,8 +14,8 @@ import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.tokens.error.TokenListSortingError
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import com.tangem.utils.logging.TangemLogger
import kotlinx.coroutines.coroutineScope
import timber.log.Timber
private typealias SortingErrorByAccountId = MutableMap<AccountId, TokenListSortingError>
@ -68,7 +68,7 @@ class ApplyTokenListSortingUseCase(
maybeSortedAccountList.toEitherNeg()
.onLeft { errorByAccountId ->
Timber.e(
TangemLogger.e(
"""
Unable to sort tokens for accounts: ${
errorByAccountId.entries.joinToString { "${it.key.value}: ${it.value}" }

View file

@ -20,7 +20,7 @@ import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.models.wallet.isMultiCurrency
import com.tangem.domain.networks.multi.MultiNetworkStatusProducer
import com.tangem.domain.networks.multi.MultiNetworkStatusSupplier
import timber.log.Timber
import com.tangem.utils.logging.TangemLogger
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract
@ -130,7 +130,7 @@ class GetAccountCurrencyByAddressUseCase(
}
return value ?: run {
Timber.d(message())
TangemLogger.d(message())
raise(None)
}
}

View file

@ -8,7 +8,6 @@ import com.tangem.domain.account.status.producer.SingleAccountStatusListProducer
import com.tangem.domain.account.status.supplier.SingleAccountStatusListSupplier
import com.tangem.domain.account.status.utils.CryptoCurrencyBalanceFetcher
import com.tangem.domain.account.status.utils.CryptoCurrencyMetadataCleaner
import com.tangem.utils.coroutines.AppCoroutineScope
import com.tangem.domain.core.utils.eitherOn
import com.tangem.domain.express.ExpressServiceFetcher
import com.tangem.domain.express.models.ExpressAsset
@ -22,10 +21,14 @@ import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.tokens.repository.CurrenciesRepository
import com.tangem.domain.walletmanager.WalletManagersFacade
import com.tangem.domain.wallets.derivations.DerivationsRepository
import com.tangem.utils.coroutines.AppCoroutineScope
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import com.tangem.utils.coroutines.runSuspendCatching
import kotlinx.coroutines.*
import timber.log.Timber
import com.tangem.utils.logging.TangemLogger
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
/**
* Use case for saving crypto currencies to a specific account.
@ -77,7 +80,7 @@ class ManageCryptoCurrenciesUseCase(
skipDerivationErrors: Boolean = true,
): Either<Throwable, Unit> = eitherOn(dispatchers.default) {
if (add.isEmpty() && remove.isEmpty()) {
Timber.d("No currencies to add or remove, skipping")
TangemLogger.d("No currencies to add or remove, skipping")
return@eitherOn
}
@ -89,7 +92,7 @@ class ManageCryptoCurrenciesUseCase(
.modify(add = add, remove = remove)
if (!modifiedCurrencyList.hasChanges) {
Timber.d("No changes in currencies, skipping")
TangemLogger.d("No changes in currencies, skipping")
return@withContext
}
@ -279,7 +282,7 @@ class ManageCryptoCurrenciesUseCase(
createWalletManagers(userWalletId = userWalletId, currencies = modifiedCurrencyList.added)
runSuspendCatching { accountsCRUDRepository.syncTokens(userWalletId) }
.onFailure { Timber.e(it, "Failed to sync tokens for wallet $userWalletId") }
.onFailure { TangemLogger.e("Failed to sync tokens for wallet $userWalletId", it) }
}
/**
@ -296,7 +299,7 @@ class ManageCryptoCurrenciesUseCase(
runSuspendCatching {
walletManagersFacade.getOrCreateWalletManager(userWalletId = userWalletId, network = network)
}
.onFailure { Timber.e(it, "Failed to create wallet manager for network ${network.id}") }
.onFailure { TangemLogger.e("Failed to create wallet manager for network ${network.id}", it) }
}
}

View file

@ -5,11 +5,11 @@ import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.tokens.BalanceFetchingOperations
import com.tangem.domain.tokens.FetchErrorFormatter
import com.tangem.domain.tokens.FetchingSource
import com.tangem.utils.logging.TangemLogger
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import timber.log.Timber
import java.util.concurrent.ConcurrentHashMap
/**
@ -87,7 +87,7 @@ class CryptoCurrencyBalanceFetcher(
)
if (errors.isNotEmpty()) {
Timber.e(FetchErrorFormatter.format(userWalletId, errors))
TangemLogger.e(FetchErrorFormatter.format(userWalletId, errors))
}
}

View file

@ -11,7 +11,7 @@ import com.tangem.domain.account.status.utils.AccountCryptoCurrencyStatusFinder.
import com.tangem.domain.models.account.Account
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.network.Network
import timber.log.Timber
import com.tangem.utils.logging.TangemLogger
/**
* Extension functions for retrieving [CryptoCurrency] from an [AccountList] or [Account.CryptoPortfolio].
@ -57,7 +57,7 @@ object CryptoCurrencyOperations {
val currencyId = catch(
block = { CryptoCurrency.ID.fromValue(currencyIdValue) },
catch = { throwable ->
Timber.e("Error on converting currencyId: $throwable")
TangemLogger.e("Error on converting currencyId: $throwable")
raise(None)
},
)