Updated on 2026-08-14

This commit is contained in:
Tangem 2025-03-05 17:09:59 +07:00
commit 5e3eebff00
2 changed files with 8 additions and 11 deletions

View file

@ -9,8 +9,10 @@ import com.reown.walletkit.client.Wallet
import com.reown.walletkit.client.WalletKit
import com.tangem.core.analytics.api.AnalyticsEventHandler
import com.tangem.tap.common.analytics.events.WalletConnect
import com.tangem.tap.domain.walletconnect2.app.TangemWcBlockchainHelper
import com.tangem.tap.domain.walletconnect2.domain.*
import com.tangem.tap.domain.walletconnect2.domain.models.*
import com.tangem.tap.domain.walletconnect2.toggles.WalletConnectFeatureToggles
import com.tangem.tap.features.details.redux.walletconnect.WalletConnectAction.OpenSession.SourceType
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.Flow
@ -22,7 +24,7 @@ internal class DefaultLegacyWalletConnectRepository(
private val application: Application,
private val wcRequestDeserializer: WcJrpcRequestsDeserializer,
private val analyticsHandler: AnalyticsEventHandler,
private val blockchainHelper: WcBlockchainHelper,
private val walletConnectFeatureToggles: WalletConnectFeatureToggles,
) : LegacyWalletConnectRepository {
private var sessionProposal: Wallet.Model.SessionProposal? = null
@ -34,6 +36,7 @@ internal class DefaultLegacyWalletConnectRepository(
private val _activeSessions: MutableSharedFlow<List<WalletConnectSession>> = MutableSharedFlow()
override val activeSessions: Flow<List<WalletConnectSession>> = _activeSessions
private val blockchainHelper by lazy { TangemWcBlockchainHelper(walletConnectFeatureToggles) }
override var currentSessions: List<WalletConnectSession> = emptyList()
private set

View file

@ -33,7 +33,7 @@ internal object WalletConnectInteractorModule {
fun provideWalletConnectInteractor(
wcRepository: LegacyWalletConnectRepository,
wcSessionsRepository: WalletConnectSessionsRepository,
wcBlockchainHelper: WcBlockchainHelper,
walletConnectFeatureToggles: WalletConnectFeatureToggles,
currenciesRepository: CurrenciesRepository,
walletManagersFacade: WalletManagersFacade,
userWalletsListManager: UserWalletsListManager,
@ -44,7 +44,7 @@ internal object WalletConnectInteractorModule {
walletConnectRepository = wcRepository,
sessionsRepository = wcSessionsRepository,
sdkHelper = WalletConnectSdkHelper(),
blockchainHelper = wcBlockchainHelper,
blockchainHelper = TangemWcBlockchainHelper(walletConnectFeatureToggles),
currenciesRepository = currenciesRepository,
walletManagersFacade = walletManagersFacade,
userWalletsListManager = userWalletsListManager,
@ -63,25 +63,19 @@ internal object WalletConnectModule {
return WalletConnectFeatureToggles(featureTogglesManager)
}
@Provides
@Singleton
fun provideWcBlockchainHelper(walletConnectFeatureToggles: WalletConnectFeatureToggles): WcBlockchainHelper {
return TangemWcBlockchainHelper(walletConnectFeatureToggles)
}
@Provides
@Singleton
fun provideWalletConnectRepository(
application: Application,
wcRequestDeserializer: WcJrpcRequestsDeserializer,
analyticsHandler: AnalyticsEventHandler,
wcBlockchainHelper: WcBlockchainHelper,
walletConnectFeatureToggles: WalletConnectFeatureToggles,
): LegacyWalletConnectRepository {
return DefaultLegacyWalletConnectRepository(
application = application,
wcRequestDeserializer = wcRequestDeserializer,
analyticsHandler = analyticsHandler,
blockchainHelper = wcBlockchainHelper,
walletConnectFeatureToggles = walletConnectFeatureToggles,
)
}