Updated on 2026-08-14
This commit is contained in:
parent
261169248a
commit
faad8f15b5
1 changed files with 13 additions and 10 deletions
|
|
@ -81,7 +81,7 @@ class WalletConnectInteractor(
|
|||
}
|
||||
}
|
||||
|
||||
private suspend fun initWithWallet(userWallet: UserWallet) {
|
||||
private fun initWithWallet(userWallet: UserWallet) {
|
||||
if (userWallet.isMultiCurrency) {
|
||||
Timber.i("WalletConnect: initialize and setup networks for ${userWallet.walletId}")
|
||||
startListeningWc(userWallet.walletId.stringValue, getCardId(userWallet))
|
||||
|
|
@ -109,7 +109,7 @@ class WalletConnectInteractor(
|
|||
handleDeeplinkStack(accounts)
|
||||
}
|
||||
|
||||
private suspend fun startListeningWc(userWalletId: String, cardId: String?) {
|
||||
private fun startListeningWc(userWalletId: String, cardId: String?) {
|
||||
this.userWalletId = userWalletId
|
||||
this.cardId = cardId
|
||||
listenerScope.coroutineContext.cancelChildren()
|
||||
|
|
@ -149,18 +149,21 @@ class WalletConnectInteractor(
|
|||
Timber.i("WalletConnect: event: $wcEvent")
|
||||
when (wcEvent) {
|
||||
is WalletConnectEvents.SessionProposal -> {
|
||||
val unsupportedNetworks = wcEvent.requiredChainIds
|
||||
.filter { blockchainHelper.chainIdToNetworkIdOrNull(it) == null }
|
||||
if (unsupportedNetworks.isNotEmpty()) {
|
||||
val unsupportedNetworks = wcEvent.requiredChainIds.filter {
|
||||
blockchainHelper.chainIdToNetworkIdOrNull(it) == null
|
||||
}
|
||||
|
||||
val supportedNetworks = (wcEvent.requiredChainIds + wcEvent.optionalChainIds)
|
||||
.mapNotNull(blockchainHelper::chainIdToFullNameOrNull)
|
||||
.distinct()
|
||||
|
||||
if (unsupportedNetworks.isNotEmpty() || supportedNetworks.isEmpty()) {
|
||||
val error = WalletConnectError.ApprovalErrorUnsupportedNetwork(unsupportedNetworks)
|
||||
handler.onSessionRejected(error)
|
||||
return@onEach
|
||||
}
|
||||
val networksFormatted = (wcEvent.requiredChainIds + wcEvent.optionalChainIds)
|
||||
.mapNotNull { blockchainHelper.chainIdToFullNameOrNull(it) }
|
||||
.distinct()
|
||||
.toString()
|
||||
handler.onProposalReceived(proposal = wcEvent, networksFormatted = networksFormatted)
|
||||
|
||||
handler.onProposalReceived(proposal = wcEvent, networksFormatted = supportedNetworks.toString())
|
||||
}
|
||||
is WalletConnectEvents.SessionApprovalError -> {
|
||||
val error = when (wcEvent.error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue