Updated on 2026-08-14
This commit is contained in:
parent
304d4b32a6
commit
c49502dcd3
3 changed files with 40 additions and 19 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package com.tangem.tap.common.analytics.events
|
||||
|
||||
import com.tangem.core.analytics.models.AnalyticsEvent
|
||||
import com.tangem.tap.common.extensions.filterNotNull
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
@ -42,17 +41,22 @@ sealed class WalletConnect(
|
|||
val methodName: String,
|
||||
val blockchain: String,
|
||||
val errorCode: String? = null,
|
||||
val errorDescription: String? = null,
|
||||
) {
|
||||
fun toParamsMap(): Map<String, String> {
|
||||
val validation = if (errorCode == null) Validation.SUCCESS.param else Validation.FAIL.param
|
||||
return mapOf(
|
||||
AnalyticsParam.DAPP_NAME to dAppName,
|
||||
AnalyticsParam.DAPP_URL to dAppUrl,
|
||||
AnalyticsParam.METHOD_NAME to methodName,
|
||||
AnalyticsParam.BLOCKCHAIN to blockchain,
|
||||
AnalyticsParam.VALIDATION to validation,
|
||||
if (errorCode != null) AnalyticsParam.ERROR_CODE to errorCode else null to null,
|
||||
).filterNotNull()
|
||||
val code = errorCode ?: SUCCESS_CODE
|
||||
return buildMap {
|
||||
put(AnalyticsParam.DAPP_NAME, dAppName)
|
||||
put(AnalyticsParam.DAPP_URL, dAppUrl)
|
||||
put(AnalyticsParam.METHOD_NAME, methodName)
|
||||
put(AnalyticsParam.BLOCKCHAIN, blockchain)
|
||||
put(AnalyticsParam.VALIDATION, validation)
|
||||
put(AnalyticsParam.ERROR_CODE, code)
|
||||
if (errorDescription != null) {
|
||||
put(AnalyticsParam.ERROR_DESCRIPTION, errorDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -60,4 +64,8 @@ sealed class WalletConnect(
|
|||
SUCCESS("Success"),
|
||||
FAIL("Fail"),
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val SUCCESS_CODE = "0"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue