Updated on 2026-08-14

This commit is contained in:
Tangem 2025-01-20 10:12:18 +03:00
commit 780686645b
17 changed files with 70 additions and 35 deletions

View file

@ -19,6 +19,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
import timber.log.Timber
@Suppress("LargeClass")
internal class DefaultLegacyWalletConnectRepository(
private val application: Application,
private val wcRequestDeserializer: WcJrpcRequestsDeserializer,
@ -72,19 +73,23 @@ internal class DefaultLegacyWalletConnectRepository(
}
}
WalletKit.initialize(Wallet.Params.Init(core = CoreClient)) { error ->
Timber.e("Error while initializing Web3Wallet: $error")
scope.launch {
_events.emit(
WalletConnectEvents.SessionApprovalError(
WalletConnectError.ExternalApprovalError(error.throwable.message),
),
)
}
}
val walletDelegate = defineWalletDelegate()
WalletKit.setWalletDelegate(walletDelegate)
WalletKit.initialize(
Wallet.Params.Init(core = CoreClient),
onSuccess = {
val walletDelegate = defineWalletDelegate()
WalletKit.setWalletDelegate(walletDelegate)
},
onError = { error ->
Timber.e("Error while initializing Web3Wallet: $error")
scope.launch {
_events.emit(
WalletConnectEvents.SessionApprovalError(
WalletConnectError.ExternalApprovalError(error.throwable.message),
),
)
}
},
)
}
private fun defineWalletDelegate(): WalletKit.WalletDelegate {