Updated on 2026-08-14

This commit is contained in:
Tangem 2023-07-10 15:05:50 +04:00
parent e3306ba216
commit 4c55f7ae66
5 changed files with 19 additions and 3 deletions

View file

@ -156,5 +156,6 @@ sealed class AnalyticsParam {
const val ERROR_CODE = "Error Code" const val ERROR_CODE = "Error Code"
const val ERROR_KEY = "Error Key" const val ERROR_KEY = "Error Key"
const val CREATION_TYPE = "Creation type" const val CREATION_TYPE = "Creation type"
const val DAPP_NAME = "DApp Name"
} }
} }

View file

@ -12,7 +12,13 @@ sealed class WalletConnect(
) : AnalyticsEvent("Wallet Connect", event, params, error) { ) : AnalyticsEvent("Wallet Connect", event, params, error) {
class ScreenOpened : WalletConnect(event = "WC Screen Opened") class ScreenOpened : WalletConnect(event = "WC Screen Opened")
class NewSessionEstablished : WalletConnect("New Session Established") class NewSessionEstablished(dAppName: String) : WalletConnect(
event = "New Session Established",
params = mapOf(
AnalyticsParam.DAPP_NAME to dAppName,
),
)
class SessionDisconnected : WalletConnect("Session Disconnected") class SessionDisconnected : WalletConnect("Session Disconnected")
class RequestSigned : WalletConnect("Request Signed") class RequestSigned : WalletConnect("Request Signed")

View file

@ -394,7 +394,7 @@ class WalletConnectManager {
), ),
) )
} }
Analytics.send(WalletConnect.NewSessionEstablished()) Analytics.send(WalletConnect.NewSessionEstablished(""))
} }
} }
} }

View file

@ -2,6 +2,8 @@ package com.tangem.tap.domain.walletconnect2.data
import android.app.Application import android.app.Application
import arrow.core.flatten import arrow.core.flatten
import com.tangem.core.analytics.Analytics
import com.tangem.tap.common.analytics.events.WalletConnect
import com.tangem.tap.domain.walletconnect2.domain.WalletConnectRepository import com.tangem.tap.domain.walletconnect2.domain.WalletConnectRepository
import com.tangem.tap.domain.walletconnect2.domain.WcJrpcRequestsDeserializer import com.tangem.tap.domain.walletconnect2.domain.WcJrpcRequestsDeserializer
import com.tangem.tap.domain.walletconnect2.domain.models.* import com.tangem.tap.domain.walletconnect2.domain.models.*
@ -237,6 +239,7 @@ class WalletConnectRepositoryImpl @Inject constructor(
params = sessionApproval, params = sessionApproval,
onSuccess = { onSuccess = {
Timber.d("Approved successfully: $it") Timber.d("Approved successfully: $it")
Analytics.send(WalletConnect.NewSessionEstablished(sessionProposal.name))
}, },
onError = { onError = {
Timber.d("Error while approving: $it") Timber.d("Error while approving: $it")
@ -261,7 +264,9 @@ class WalletConnectRepositoryImpl @Inject constructor(
), ),
), ),
onSuccess = {}, onSuccess = {},
onError = {}, onError = {
Analytics.send(WalletConnect.TransactionError(it.throwable))
},
) )
} }
@ -299,6 +304,7 @@ class WalletConnectRepositoryImpl @Inject constructor(
Web3Wallet.disconnectSession( Web3Wallet.disconnectSession(
params = Wallet.Params.SessionDisconnect(topic), params = Wallet.Params.SessionDisconnect(topic),
onSuccess = { onSuccess = {
Analytics.send(WalletConnect.SessionDisconnected())
updateSessions() updateSessions()
Timber.d("Disconnected successfully: $it") Timber.d("Disconnected successfully: $it")
}, },

View file

@ -1,5 +1,7 @@
package com.tangem.tap.domain.walletconnect2.domain package com.tangem.tap.domain.walletconnect2.domain
import com.tangem.core.analytics.Analytics
import com.tangem.tap.common.analytics.events.WalletConnect
import com.tangem.tap.common.extensions.filterNotNull import com.tangem.tap.common.extensions.filterNotNull
import com.tangem.tap.domain.walletconnect.WalletConnectSdkHelper import com.tangem.tap.domain.walletconnect.WalletConnectSdkHelper
import com.tangem.tap.domain.walletconnect2.domain.models.* import com.tangem.tap.domain.walletconnect2.domain.models.*
@ -216,6 +218,7 @@ class WalletConnectInteractor(
id = request.requestId, id = request.requestId,
) )
} else { } else {
Analytics.send(WalletConnect.RequestSigned())
walletConnectRepository.sendRequest( walletConnectRepository.sendRequest(
topic = request.topic, topic = request.topic,
id = request.requestId, id = request.requestId,