Updated on 2026-08-14

This commit is contained in:
Tangem 2024-05-24 15:56:27 +04:00
parent 092ad9d6c4
commit 8491f524b9
6 changed files with 79 additions and 0 deletions

View file

@ -102,6 +102,7 @@ dependencies {
implementation(projects.data.feedback)
implementation(projects.data.qrScanning)
implementation(projects.data.staking)
implementation(projects.data.walletConnect)
/** Features */
implementation(projects.features.onboarding)

1
data/wallet-connect/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,30 @@
plugins {
alias(deps.plugins.kotlin.android)
alias(deps.plugins.kotlin.kapt)
alias(deps.plugins.android.library)
id("configuration")
}
android {
namespace = "com.tangem.data.walletconnect"
}
dependencies {
/* Project - Domain */
implementation(projects.domain.walletConnect)
implementation(projects.domain.wallets.models)
/* Project - Data */
implementation(projects.core.datasource)
/* Project - Core */
implementation(projects.core.utils)
/* DI */
implementation(deps.hilt.core)
kapt(deps.hilt.kapt)
/* Other */
implementation(deps.kotlin.coroutines)
}

View file

@ -0,0 +1,21 @@
package com.tangem.data.walletconnect
import com.tangem.datasource.local.userwallet.UserWalletsStore
import com.tangem.domain.walletconnect.repository.WalletConnectRepository
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import kotlinx.coroutines.withContext
internal class DefaultWalletConnectRepository(
private val userWalletsStore: UserWalletsStore,
private val dispatchers: CoroutineDispatcherProvider,
) : WalletConnectRepository {
override suspend fun checkIsAvailable(userWalletId: UserWalletId): Boolean = withContext(dispatchers.io) {
val userWallet = requireNotNull(userWalletsStore.getSyncOrNull(userWalletId)) {
"User wallet with id $userWalletId not found"
}
userWallet.isMultiCurrency
}
}

View file

@ -0,0 +1,25 @@
package com.tangem.data.walletconnect.di
import com.tangem.data.walletconnect.DefaultWalletConnectRepository
import com.tangem.datasource.local.userwallet.UserWalletsStore
import com.tangem.domain.walletconnect.repository.WalletConnectRepository
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
internal object WalletConnectDataModule {
@Provides
@Singleton
fun providesWalletConnectRepository(
userWalletsStore: UserWalletsStore,
dispatchers: CoroutineDispatcherProvider,
): WalletConnectRepository {
return DefaultWalletConnectRepository(userWalletsStore, dispatchers)
}
}

View file

@ -212,4 +212,5 @@ include(":data:onboarding")
include(":data:feedback")
include(":data:qr-scanning")
include(":data:staking")
include(":data:wallet-connect")
// endregion Data modules