Updated on 2026-08-14

This commit is contained in:
Tangem 2025-07-12 22:31:10 +04:00
parent f338f79230
commit 01d87ca7c0
2 changed files with 30 additions and 26 deletions

View file

@ -27,7 +27,7 @@ class GetExtendedPublicKeyForCurrencyUseCase(
suspend operator fun invoke(userWalletId: UserWalletId, network: Network): Either<Throwable, String> {
return Either.catch {
val walletManager = walletManagersFacade.getOrCreateWalletManager(userWalletId, network)
?: error("Wallet not found")
?: error("Wallet not found for userWalletId=$userWalletId and network=$network")
val blockchain = network.toBlockchain()
val isSecp256k1Blockchain = Blockchain.secp256k1Blockchains(network.isTestnet).contains(blockchain)

View file

@ -448,31 +448,7 @@ internal class TokenDetailsModel @Inject constructor(
network = cryptoCurrency.network,
).getOrElse { false }
val isSupported = getExtendedPublicKeyForCurrencyUseCase.isSupported(
userWalletId = userWalletId,
network = cryptoCurrency.network,
)
.mapLeft {
analyticsExceptionHandler.sendException(
event = ExceptionAnalyticsEvent(
exception = it,
params = mapOf(
"blockchainId" to cryptoCurrency.network.id.rawId.value,
"networkId" to cryptoCurrency.network.backendId,
),
),
)
Timber.e(
/* t = */ it,
/* message = */ "Unable to get wallet manager for user wallet %s and network %s",
/* ...args = */ userWalletId,
cryptoCurrency.network,
)
false
}
.merge()
val isSupported = isXPUBSupported()
internalUiState.value = stateFactory.getStateWithUpdatedMenu(
cardTypesResolver = userWallet.scanResponse.cardTypesResolver,
@ -482,6 +458,34 @@ internal class TokenDetailsModel @Inject constructor(
}
}
private suspend fun isXPUBSupported(): Boolean {
return getExtendedPublicKeyForCurrencyUseCase.isSupported(
userWalletId = userWalletId,
network = cryptoCurrency.network,
)
.mapLeft {
analyticsExceptionHandler.sendException(
event = ExceptionAnalyticsEvent(
exception = it,
params = mapOf(
"blockchainId" to cryptoCurrency.network.id.rawId.value,
"networkId" to cryptoCurrency.network.backendId,
),
),
)
Timber.e(
/* t = */ it,
/* message = */ "Unable to get wallet manager for user wallet %s and network %s",
/* ...args = */ userWalletId,
cryptoCurrency.network,
)
false
}
.merge()
}
private fun createSelectedAppCurrencyFlow(): StateFlow<AppCurrency> {
return getSelectedAppCurrencyUseCase()
.map { maybeAppCurrency ->