Updated on 2026-08-14
This commit is contained in:
parent
2135c31e7b
commit
9a02d97e96
4 changed files with 49 additions and 32 deletions
|
|
@ -4,6 +4,7 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.blockchain.common.network.providers.ProviderType
|
||||
import com.tangem.blockchainsdk.BlockchainProviderTypes
|
||||
import com.tangem.blockchainsdk.BlockchainProvidersResponse
|
||||
import com.tangem.blockchainsdk.utils.createPrivateProviderType
|
||||
import com.tangem.blockchainsdk.utils.fromNetworkId
|
||||
import com.tangem.datasource.config.models.ProviderModel
|
||||
import com.tangem.utils.converter.Converter
|
||||
|
|
@ -24,7 +25,7 @@ internal object BlockchainProviderTypesConverter :
|
|||
val providerTypes = blockchainProviders.mapNotNull { provider ->
|
||||
when (provider) {
|
||||
is ProviderModel.Public -> ProviderType.Public(url = provider.url)
|
||||
is ProviderModel.Private -> createPrivateProviderType(blockchain = blockchain, name = provider.name)
|
||||
is ProviderModel.Private -> createPrivateProviderType(name = provider.name)
|
||||
ProviderModel.UnsupportedType -> {
|
||||
Timber.e("$blockchain provider type is not supported")
|
||||
null
|
||||
|
|
@ -36,31 +37,4 @@ internal object BlockchainProviderTypesConverter :
|
|||
}
|
||||
.toMap()
|
||||
}
|
||||
|
||||
@Suppress("CyclomaticComplexMethod")
|
||||
private fun createPrivateProviderType(blockchain: Blockchain, name: String): ProviderType? {
|
||||
return when (name) {
|
||||
"blockchair" -> ProviderType.BitcoinLike.Blockchair
|
||||
"blockcypher" -> ProviderType.BitcoinLike.Blockcypher
|
||||
"adalite" -> ProviderType.Cardano.Adalite
|
||||
"tangemRosetta" -> ProviderType.Cardano.Rosetta
|
||||
"fireAcademy" -> ProviderType.Chia.FireAcademy
|
||||
"tangemChia" -> ProviderType.Chia.Tangem
|
||||
"infura" -> ProviderType.EthereumLike.Infura
|
||||
"getblock" -> ProviderType.GetBlock
|
||||
"arkhiaHedera" -> ProviderType.Hedera.Arkhia
|
||||
"kaspa" -> ProviderType.Kaspa.SecondaryAPI
|
||||
"nownodes" -> ProviderType.NowNodes
|
||||
"quicknode" -> ProviderType.QuickNode
|
||||
"solana" -> ProviderType.Solana.Official
|
||||
"ton" -> ProviderType.Ton.TonCentral
|
||||
"tron" -> ProviderType.Tron.TronGrid
|
||||
"dwellirBittensor" -> ProviderType.Bittensor.Dwellir
|
||||
"onfinalityBittensor" -> ProviderType.Bittensor.Onfinality
|
||||
else -> {
|
||||
Timber.e("$blockchain private provider ($name) is not supported")
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue