Updated on 2026-08-14
This commit is contained in:
parent
f10f44e7b0
commit
951226f28f
2 changed files with 37 additions and 1 deletions
|
|
@ -0,0 +1,34 @@
|
|||
package com.tangem.data.walletconnect.sign
|
||||
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.utils.fromNetworkId
|
||||
import com.tangem.domain.models.network.Network
|
||||
import com.tangem.utils.converter.Converter
|
||||
import javax.inject.Inject
|
||||
|
||||
internal class BlockAidChainNameConverter @Inject constructor() : Converter<Network, String> {
|
||||
|
||||
@Suppress("CyclomaticComplexMethod")
|
||||
override fun convert(value: Network): String {
|
||||
return when (Blockchain.fromNetworkId(value.backendId)) {
|
||||
Blockchain.Arbitrum -> "arbitrum"
|
||||
Blockchain.Avalanche -> "avalanche"
|
||||
Blockchain.AvalancheTestnet -> "avalanche-fuji"
|
||||
Blockchain.Binance, Blockchain.BSC -> "bsc"
|
||||
Blockchain.Ethereum -> "ethereum"
|
||||
Blockchain.EthereumTestnet -> "ethereum-sepolia"
|
||||
Blockchain.Polygon -> "polygon"
|
||||
Blockchain.Solana -> "mainnet"
|
||||
Blockchain.Gnosis -> "gnosis"
|
||||
Blockchain.Optimism -> "optimism"
|
||||
Blockchain.ZkSyncEra -> "zksync"
|
||||
Blockchain.ZkSyncEraTestnet -> "zksync-sepolia"
|
||||
Blockchain.Base -> "base"
|
||||
Blockchain.BaseTestnet -> "base-sepolia"
|
||||
Blockchain.Blast, Blockchain.BlastTestnet -> "blast"
|
||||
Blockchain.ApeChain, Blockchain.ApeChainTestnet -> "apechain"
|
||||
Blockchain.Scroll -> "scroll"
|
||||
else -> value.name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.data.walletconnect.utils
|
||||
|
||||
import com.domain.blockaid.models.transaction.*
|
||||
import com.tangem.data.walletconnect.sign.BlockAidChainNameConverter
|
||||
import com.tangem.domain.blockaid.BlockAidVerifier
|
||||
import com.tangem.domain.core.lce.Lce
|
||||
import com.tangem.domain.core.lce.LceFlow
|
||||
|
|
@ -16,6 +17,7 @@ import javax.inject.Inject
|
|||
|
||||
internal class BlockAidVerificationDelegate @Inject constructor(
|
||||
private val blockAidVerifier: BlockAidVerifier,
|
||||
private val blockAidChainNameConverter: BlockAidChainNameConverter,
|
||||
) {
|
||||
|
||||
fun getSecurityStatus(
|
||||
|
|
@ -47,7 +49,7 @@ internal class BlockAidVerificationDelegate @Inject constructor(
|
|||
}?.let { params ->
|
||||
blockAidVerifier.verifyTransaction(
|
||||
TransactionData(
|
||||
chain = network.name,
|
||||
chain = blockAidChainNameConverter.convert(network),
|
||||
accountAddress = accountAddress,
|
||||
method = rawSdkRequest.request.method,
|
||||
domainUrl = session.sdkModel.appMetaData.url,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue