Updated on 2026-08-14
This commit is contained in:
parent
ff985dec4e
commit
cd78832ff1
30 changed files with 89 additions and 23 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
package com.tangem.tap.di.domain
|
package com.tangem.tap.di.domain
|
||||||
|
|
||||||
|
import com.tangem.domain.walletmanager.WalletManagersFacade
|
||||||
import com.tangem.domain.wallets.legacy.WalletsStateHolder
|
import com.tangem.domain.wallets.legacy.WalletsStateHolder
|
||||||
|
import com.tangem.domain.wallets.usecase.GetExploreUrlUseCase
|
||||||
import com.tangem.domain.wallets.usecase.GetWalletsUseCase
|
import com.tangem.domain.wallets.usecase.GetWalletsUseCase
|
||||||
import com.tangem.domain.wallets.usecase.SaveWalletUseCase
|
import com.tangem.domain.wallets.usecase.SaveWalletUseCase
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
|
|
@ -24,4 +26,10 @@ internal object WalletsDomainModule {
|
||||||
fun providesSaveWalletUseCase(walletsStateHolder: WalletsStateHolder): SaveWalletUseCase {
|
fun providesSaveWalletUseCase(walletsStateHolder: WalletsStateHolder): SaveWalletUseCase {
|
||||||
return SaveWalletUseCase(walletsStateHolder = walletsStateHolder)
|
return SaveWalletUseCase(walletsStateHolder = walletsStateHolder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@ViewModelScoped
|
||||||
|
fun providesGetExploreUrlUseCase(walletsManagersFacade: WalletManagersFacade): GetExploreUrlUseCase {
|
||||||
|
return GetExploreUrlUseCase(walletsManagersFacade = walletsManagersFacade)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,7 @@ dependencies {
|
||||||
implementation(projects.domain.core)
|
implementation(projects.domain.core)
|
||||||
implementation(projects.domain.models)
|
implementation(projects.domain.models)
|
||||||
implementation(projects.domain.tokens)
|
implementation(projects.domain.tokens)
|
||||||
|
implementation(projects.domain.tokens.models)
|
||||||
implementation(projects.domain.demo)
|
implementation(projects.domain.demo)
|
||||||
implementation(projects.domain.wallets.models)
|
implementation(projects.domain.wallets.models)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.tangem.data.tokens.mock
|
package com.tangem.data.tokens.mock
|
||||||
|
|
||||||
import com.tangem.domain.tokens.model.Network
|
|
||||||
import com.tangem.domain.tokens.model.NetworkStatus
|
import com.tangem.domain.tokens.model.NetworkStatus
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
|
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ package com.tangem.data.tokens.repository
|
||||||
|
|
||||||
import com.tangem.data.tokens.mock.MockNetworks
|
import com.tangem.data.tokens.mock.MockNetworks
|
||||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||||
import com.tangem.domain.tokens.model.Network
|
|
||||||
import com.tangem.domain.tokens.model.NetworkStatus
|
import com.tangem.domain.tokens.model.NetworkStatus
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.domain.tokens.repository.NetworksRepository
|
import com.tangem.domain.tokens.repository.NetworksRepository
|
||||||
import com.tangem.domain.wallets.models.UserWalletId
|
import com.tangem.domain.wallets.models.UserWalletId
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import com.tangem.domain.common.extensions.toCoinId
|
||||||
import com.tangem.domain.common.extensions.toNetworkId
|
import com.tangem.domain.common.extensions.toNetworkId
|
||||||
import com.tangem.domain.models.scan.CardDTO
|
import com.tangem.domain.models.scan.CardDTO
|
||||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||||
import com.tangem.domain.tokens.model.Network
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.blockchain.common.Token as SdkToken
|
import com.tangem.blockchain.common.Token as SdkToken
|
||||||
|
|
||||||
private const val DEFAULT_TOKENS_ICONS_HOST = "https://s3.eu-central-1.amazonaws.com/tangem.api/coins"
|
private const val DEFAULT_TOKENS_ICONS_HOST = "https://s3.eu-central-1.amazonaws.com/tangem.api/coins"
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ dependencies {
|
||||||
implementation(projects.domain.demo)
|
implementation(projects.domain.demo)
|
||||||
implementation(projects.domain.models)
|
implementation(projects.domain.models)
|
||||||
implementation(projects.domain.tokens)
|
implementation(projects.domain.tokens)
|
||||||
|
implementation(projects.domain.tokens.models)
|
||||||
implementation(projects.domain.wallets.models)
|
implementation(projects.domain.wallets.models)
|
||||||
|
|
||||||
/** Tangem libraries */
|
/** Tangem libraries */
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import com.tangem.domain.common.TapWorkarounds.derivationStyle
|
||||||
import com.tangem.domain.common.util.hasDerivation
|
import com.tangem.domain.common.util.hasDerivation
|
||||||
import com.tangem.domain.demo.DemoConfig
|
import com.tangem.domain.demo.DemoConfig
|
||||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||||
import com.tangem.domain.tokens.model.Network
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
|
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
|
||||||
import com.tangem.domain.walletmanager.utils.SdkTokenConverter
|
import com.tangem.domain.walletmanager.utils.SdkTokenConverter
|
||||||
import com.tangem.domain.walletmanager.utils.UpdateWalletManagerResultFactory
|
import com.tangem.domain.walletmanager.utils.UpdateWalletManagerResultFactory
|
||||||
|
|
@ -46,6 +46,23 @@ class DefaultWalletManagersFacade(
|
||||||
return getAndUpdateWalletManager(userWallet, blockchain, extraTokens)
|
return getAndUpdateWalletManager(userWallet, blockchain, extraTokens)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override suspend fun getExploreUrl(userWalletId: UserWalletId, networkId: Network.ID): String {
|
||||||
|
val userWallet = requireNotNull(userWalletsStore.getSyncOrNull(userWalletId)) {
|
||||||
|
"Unable to find a user wallet with provided ID: $userWalletId"
|
||||||
|
}
|
||||||
|
|
||||||
|
val blockchain = Blockchain.fromId(networkId.value)
|
||||||
|
|
||||||
|
return getOrCreateWalletManager(
|
||||||
|
userWallet = userWallet,
|
||||||
|
blockchain = blockchain,
|
||||||
|
derivationPath = blockchain.derivationPath(userWallet.scanResponse.card.derivationStyle),
|
||||||
|
)
|
||||||
|
?.wallet
|
||||||
|
?.getExploreUrl()
|
||||||
|
.orEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
private suspend fun getAndUpdateWalletManager(
|
private suspend fun getAndUpdateWalletManager(
|
||||||
userWallet: UserWallet,
|
userWallet: UserWallet,
|
||||||
blockchain: Blockchain,
|
blockchain: Blockchain,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.tangem.domain.walletmanager
|
package com.tangem.domain.walletmanager
|
||||||
|
|
||||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||||
import com.tangem.domain.tokens.model.Network
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
|
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
|
||||||
import com.tangem.domain.wallets.models.UserWalletId
|
import com.tangem.domain.wallets.models.UserWalletId
|
||||||
|
|
||||||
|
|
@ -24,4 +24,6 @@ interface WalletManagersFacade {
|
||||||
networkId: Network.ID,
|
networkId: Network.ID,
|
||||||
extraTokens: Set<CryptoCurrency.Token>,
|
extraTokens: Set<CryptoCurrency.Token>,
|
||||||
): UpdateWalletManagerResult
|
): UpdateWalletManagerResult
|
||||||
|
|
||||||
|
suspend fun getExploreUrl(userWalletId: UserWalletId, networkId: Network.ID): String
|
||||||
}
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ plugins {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(projects.domain.core)
|
implementation(projects.domain.core)
|
||||||
|
implementation(projects.domain.tokens.models)
|
||||||
implementation(projects.domain.wallets.models)
|
implementation(projects.domain.wallets.models)
|
||||||
implementation(projects.core.utils)
|
implementation(projects.core.utils)
|
||||||
|
|
||||||
|
|
|
||||||
1
domain/tokens/models/.gitignore
vendored
Normal file
1
domain/tokens/models/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/build
|
||||||
4
domain/tokens/models/build.gradle.kts
Normal file
4
domain/tokens/models/build.gradle.kts
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
plugins {
|
||||||
|
alias(deps.plugins.kotlin.jvm)
|
||||||
|
id("configuration")
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.tangem.domain.tokens.model
|
package com.tangem.domain.tokens.models
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a blockchain network, identified by a unique ID and a human-readable name.
|
* Represents a blockchain network, identified by a unique ID and a human-readable name.
|
||||||
|
|
@ -8,10 +8,7 @@ package com.tangem.domain.tokens.model
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException If the name or ID is blank.
|
* @throws IllegalArgumentException If the name or ID is blank.
|
||||||
*/
|
*/
|
||||||
data class Network(
|
data class Network(val id: ID, val name: String) {
|
||||||
val id: ID,
|
|
||||||
val name: String,
|
|
||||||
) {
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
require(name.isNotBlank()) { "Network name must not be blank" }
|
require(name.isNotBlank()) { "Network name must not be blank" }
|
||||||
|
|
@ -8,7 +8,7 @@ import arrow.core.raise.ensureNotNull
|
||||||
import arrow.core.toNonEmptySetOrNull
|
import arrow.core.toNonEmptySetOrNull
|
||||||
import com.tangem.domain.tokens.error.TokenListSortingError
|
import com.tangem.domain.tokens.error.TokenListSortingError
|
||||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||||
import com.tangem.domain.tokens.model.Network
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.domain.tokens.repository.TokensRepository
|
import com.tangem.domain.tokens.repository.TokensRepository
|
||||||
import com.tangem.domain.wallets.models.UserWalletId
|
import com.tangem.domain.wallets.models.UserWalletId
|
||||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ import arrow.core.raise.either
|
||||||
import arrow.core.raise.ensure
|
import arrow.core.raise.ensure
|
||||||
import com.tangem.domain.tokens.error.TokenListSortingError
|
import com.tangem.domain.tokens.error.TokenListSortingError
|
||||||
import com.tangem.domain.tokens.error.mapper.mapToTokenListSortingError
|
import com.tangem.domain.tokens.error.mapper.mapToTokenListSortingError
|
||||||
import com.tangem.domain.tokens.model.Network
|
|
||||||
import com.tangem.domain.tokens.model.TokenList
|
import com.tangem.domain.tokens.model.TokenList
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.domain.tokens.operations.TokenListSortingOperations
|
import com.tangem.domain.tokens.operations.TokenListSortingOperations
|
||||||
import com.tangem.domain.tokens.repository.NetworksRepository
|
import com.tangem.domain.tokens.repository.NetworksRepository
|
||||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.tangem.domain.tokens.model
|
package com.tangem.domain.tokens.model
|
||||||
|
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a generic cryptocurrency.
|
* Represents a generic cryptocurrency.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.tangem.domain.tokens.model
|
package com.tangem.domain.tokens.model
|
||||||
|
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a group of cryptocurrencies associated with a specific network.
|
* Represents a group of cryptocurrencies associated with a specific network.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.tangem.domain.tokens.model
|
package com.tangem.domain.tokens.model
|
||||||
|
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import arrow.core.raise.catch
|
||||||
import com.tangem.domain.core.raise.DelegatedRaise
|
import com.tangem.domain.core.raise.DelegatedRaise
|
||||||
import com.tangem.domain.tokens.GetTokenListUseCase
|
import com.tangem.domain.tokens.GetTokenListUseCase
|
||||||
import com.tangem.domain.tokens.model.*
|
import com.tangem.domain.tokens.model.*
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.domain.tokens.repository.NetworksRepository
|
import com.tangem.domain.tokens.repository.NetworksRepository
|
||||||
import com.tangem.domain.tokens.repository.QuotesRepository
|
import com.tangem.domain.tokens.repository.QuotesRepository
|
||||||
import com.tangem.domain.tokens.repository.TokensRepository
|
import com.tangem.domain.tokens.repository.TokensRepository
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ import arrow.core.toNonEmptySetOrNull
|
||||||
import com.tangem.domain.core.raise.DelegatedRaise
|
import com.tangem.domain.core.raise.DelegatedRaise
|
||||||
import com.tangem.domain.tokens.GetTokenListUseCase
|
import com.tangem.domain.tokens.GetTokenListUseCase
|
||||||
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
|
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
|
||||||
import com.tangem.domain.tokens.model.Network
|
|
||||||
import com.tangem.domain.tokens.model.TokenList
|
import com.tangem.domain.tokens.model.TokenList
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.domain.tokens.repository.NetworksRepository
|
import com.tangem.domain.tokens.repository.NetworksRepository
|
||||||
import com.tangem.domain.tokens.repository.TokensRepository
|
import com.tangem.domain.tokens.repository.TokensRepository
|
||||||
import com.tangem.domain.wallets.models.UserWalletId
|
import com.tangem.domain.wallets.models.UserWalletId
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ import arrow.core.raise.ensureNotNull
|
||||||
import arrow.core.toNonEmptySetOrNull
|
import arrow.core.toNonEmptySetOrNull
|
||||||
import com.tangem.domain.core.raise.DelegatedRaise
|
import com.tangem.domain.core.raise.DelegatedRaise
|
||||||
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
|
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
|
||||||
import com.tangem.domain.tokens.model.Network
|
|
||||||
import com.tangem.domain.tokens.model.NetworkGroup
|
import com.tangem.domain.tokens.model.NetworkGroup
|
||||||
import com.tangem.domain.tokens.model.TokenList
|
import com.tangem.domain.tokens.model.TokenList
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package com.tangem.domain.tokens.repository
|
package com.tangem.domain.tokens.repository
|
||||||
|
|
||||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||||
import com.tangem.domain.tokens.model.Network
|
|
||||||
import com.tangem.domain.tokens.model.NetworkStatus
|
import com.tangem.domain.tokens.model.NetworkStatus
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.domain.wallets.models.UserWalletId
|
import com.tangem.domain.wallets.models.UserWalletId
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ import com.tangem.domain.tokens.mock.MockQuotes
|
||||||
import com.tangem.domain.tokens.mock.MockTokenLists
|
import com.tangem.domain.tokens.mock.MockTokenLists
|
||||||
import com.tangem.domain.tokens.mock.MockTokens
|
import com.tangem.domain.tokens.mock.MockTokens
|
||||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||||
import com.tangem.domain.tokens.model.Network
|
|
||||||
import com.tangem.domain.tokens.model.NetworkStatus
|
import com.tangem.domain.tokens.model.NetworkStatus
|
||||||
import com.tangem.domain.tokens.model.Quote
|
import com.tangem.domain.tokens.model.Quote
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.domain.tokens.repository.MockNetworksRepository
|
import com.tangem.domain.tokens.repository.MockNetworksRepository
|
||||||
import com.tangem.domain.tokens.repository.MockQuotesRepository
|
import com.tangem.domain.tokens.repository.MockQuotesRepository
|
||||||
import com.tangem.domain.tokens.repository.MockTokensRepository
|
import com.tangem.domain.tokens.repository.MockTokensRepository
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import com.tangem.domain.core.error.DataError
|
||||||
import com.tangem.domain.tokens.error.TokenListSortingError
|
import com.tangem.domain.tokens.error.TokenListSortingError
|
||||||
import com.tangem.domain.tokens.mock.MockNetworks
|
import com.tangem.domain.tokens.mock.MockNetworks
|
||||||
import com.tangem.domain.tokens.mock.MockTokenLists
|
import com.tangem.domain.tokens.mock.MockTokenLists
|
||||||
import com.tangem.domain.tokens.model.Network
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.domain.tokens.repository.MockNetworksRepository
|
import com.tangem.domain.tokens.repository.MockNetworksRepository
|
||||||
import com.tangem.utils.coroutines.TestingCoroutineDispatcherProvider
|
import com.tangem.utils.coroutines.TestingCoroutineDispatcherProvider
|
||||||
import junit.framework.TestCase.assertEquals
|
import junit.framework.TestCase.assertEquals
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ package com.tangem.domain.tokens.mock
|
||||||
|
|
||||||
import arrow.core.NonEmptySet
|
import arrow.core.NonEmptySet
|
||||||
import arrow.core.nonEmptySetOf
|
import arrow.core.nonEmptySetOf
|
||||||
import com.tangem.domain.tokens.model.Network
|
|
||||||
import com.tangem.domain.tokens.model.NetworkStatus
|
import com.tangem.domain.tokens.model.NetworkStatus
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
|
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import arrow.core.Either
|
||||||
import arrow.core.getOrElse
|
import arrow.core.getOrElse
|
||||||
import com.tangem.domain.core.error.DataError
|
import com.tangem.domain.core.error.DataError
|
||||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||||
import com.tangem.domain.tokens.model.Network
|
|
||||||
import com.tangem.domain.tokens.model.NetworkStatus
|
import com.tangem.domain.tokens.model.NetworkStatus
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.domain.wallets.models.UserWalletId
|
import com.tangem.domain.wallets.models.UserWalletId
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,10 @@ android {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
// region Domain modules
|
// region Domain modules
|
||||||
implementation(project(":domain:legacy"))
|
implementation(projects.domain.legacy)
|
||||||
implementation(project(":domain:models"))
|
implementation(projects.domain.models)
|
||||||
implementation(project(":domain:wallets:models"))
|
implementation(projects.domain.tokens.models)
|
||||||
|
implementation(projects.domain.wallets.models)
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region Tangem libraries
|
// region Tangem libraries
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.tangem.domain.wallets.usecase
|
||||||
|
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
|
import com.tangem.domain.walletmanager.WalletManagersFacade
|
||||||
|
import com.tangem.domain.wallets.models.UserWalletId
|
||||||
|
|
||||||
|
class GetExploreUrlUseCase(private val walletsManagersFacade: WalletManagersFacade) {
|
||||||
|
|
||||||
|
suspend operator fun invoke(userWalletId: UserWalletId, networkId: Network.ID): String {
|
||||||
|
return walletsManagersFacade.getExploreUrl(userWalletId, networkId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -51,6 +51,7 @@ dependencies {
|
||||||
implementation(projects.domain.models)
|
implementation(projects.domain.models)
|
||||||
implementation(projects.domain.settings)
|
implementation(projects.domain.settings)
|
||||||
implementation(projects.domain.tokens)
|
implementation(projects.domain.tokens)
|
||||||
|
implementation(projects.domain.tokens.models)
|
||||||
implementation(projects.domain.txhistory)
|
implementation(projects.domain.txhistory)
|
||||||
implementation(projects.domain.wallets)
|
implementation(projects.domain.wallets)
|
||||||
implementation(projects.domain.wallets.models)
|
implementation(projects.domain.wallets.models)
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,12 @@ import com.tangem.domain.demo.IsDemoCardUseCase
|
||||||
import com.tangem.domain.settings.IsUserAlreadyRateAppUseCase
|
import com.tangem.domain.settings.IsUserAlreadyRateAppUseCase
|
||||||
import com.tangem.domain.tokens.GetTokenListUseCase
|
import com.tangem.domain.tokens.GetTokenListUseCase
|
||||||
import com.tangem.domain.tokens.model.TokenList
|
import com.tangem.domain.tokens.model.TokenList
|
||||||
|
import com.tangem.domain.tokens.models.Network
|
||||||
import com.tangem.domain.txhistory.usecase.GetTxHistoryItemsCountUseCase
|
import com.tangem.domain.txhistory.usecase.GetTxHistoryItemsCountUseCase
|
||||||
import com.tangem.domain.txhistory.usecase.GetTxHistoryItemsUseCase
|
import com.tangem.domain.txhistory.usecase.GetTxHistoryItemsUseCase
|
||||||
import com.tangem.domain.userwallets.UserWalletBuilder
|
import com.tangem.domain.userwallets.UserWalletBuilder
|
||||||
import com.tangem.domain.wallets.models.UserWallet
|
import com.tangem.domain.wallets.models.UserWallet
|
||||||
|
import com.tangem.domain.wallets.usecase.GetExploreUrlUseCase
|
||||||
import com.tangem.domain.wallets.usecase.GetWalletsUseCase
|
import com.tangem.domain.wallets.usecase.GetWalletsUseCase
|
||||||
import com.tangem.domain.wallets.usecase.SaveWalletUseCase
|
import com.tangem.domain.wallets.usecase.SaveWalletUseCase
|
||||||
import com.tangem.feature.wallet.presentation.router.InnerWalletRouter
|
import com.tangem.feature.wallet.presentation.router.InnerWalletRouter
|
||||||
|
|
@ -52,6 +54,7 @@ internal class WalletViewModel @Inject constructor(
|
||||||
private val scanCardProcessor: ScanCardProcessor,
|
private val scanCardProcessor: ScanCardProcessor,
|
||||||
private val txHistoryItemsCountUseCase: GetTxHistoryItemsCountUseCase,
|
private val txHistoryItemsCountUseCase: GetTxHistoryItemsCountUseCase,
|
||||||
private val txHistoryItemsUseCase: GetTxHistoryItemsUseCase,
|
private val txHistoryItemsUseCase: GetTxHistoryItemsUseCase,
|
||||||
|
private val getExploreUrlUseCase: GetExploreUrlUseCase,
|
||||||
private val dispatchers: CoroutineDispatcherProvider,
|
private val dispatchers: CoroutineDispatcherProvider,
|
||||||
) : ViewModel(), DefaultLifecycleObserver, WalletClickIntents {
|
) : ViewModel(), DefaultLifecycleObserver, WalletClickIntents {
|
||||||
|
|
||||||
|
|
@ -263,6 +266,16 @@ internal class WalletViewModel @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onExploreClick() {
|
override fun onExploreClick() {
|
||||||
router.openTxHistoryWebsite(url = "") // TODO
|
viewModelScope.launch(dispatchers.io) {
|
||||||
|
val wallet = getWallet(uiState.walletsListConfig.selectedWalletIndex)
|
||||||
|
router.openTxHistoryWebsite(
|
||||||
|
url = getExploreUrlUseCase(
|
||||||
|
userWalletId = wallet.walletId,
|
||||||
|
networkId = Network.ID(
|
||||||
|
value = wallet.scanResponse.cardTypesResolver.getBlockchain().id,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -103,6 +103,7 @@ include(":domain:core")
|
||||||
include(":domain:demo")
|
include(":domain:demo")
|
||||||
include(":domain:settings")
|
include(":domain:settings")
|
||||||
include(":domain:tokens")
|
include(":domain:tokens")
|
||||||
|
include(":domain:tokens:models")
|
||||||
include(":domain:wallets")
|
include(":domain:wallets")
|
||||||
include(":domain:wallets:models")
|
include(":domain:wallets:models")
|
||||||
include(":domain:txhistory")
|
include(":domain:txhistory")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue