diff --git a/blockchain/src/main/java/com/tangem/blockchain/blockchains/ethereum/Chain.kt b/blockchain/src/main/java/com/tangem/blockchain/blockchains/ethereum/Chain.kt index ef0744706..90b4e03f0 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/blockchains/ethereum/Chain.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/blockchains/ethereum/Chain.kt @@ -81,4 +81,6 @@ enum class Chain(val id: Int, val blockchain: Blockchain?) { Canxium(id = 3003, blockchain = Blockchain.Canxium), Chiliz(id = 88888, blockchain = Blockchain.Chiliz), ChilizTestnet(id = 88882, blockchain = Blockchain.ChilizTestnet), + VanarChain(id = 2040, blockchain = Blockchain.VanarChain), + VanarChainTestnet(id = 78600, blockchain = Blockchain.VanarChainTestnet), } diff --git a/blockchain/src/main/java/com/tangem/blockchain/blockchains/ethereum/eip1559/EthereumLikeBlockchainExt.kt b/blockchain/src/main/java/com/tangem/blockchain/blockchains/ethereum/eip1559/EthereumLikeBlockchainExt.kt index ef4e95f1d..9e763d119 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/blockchains/ethereum/eip1559/EthereumLikeBlockchainExt.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/blockchains/ethereum/eip1559/EthereumLikeBlockchainExt.kt @@ -52,6 +52,7 @@ internal val Blockchain.isSupportEIP1559: Boolean Blockchain.Mantle, Blockchain.Xodex, Blockchain.Chiliz, + Blockchain.VanarChain, -> false else -> error("Don't forget about evm here") } diff --git a/blockchain/src/main/java/com/tangem/blockchain/blockchains/ethereum/providers/VanarChainProvidersBuilder.kt b/blockchain/src/main/java/com/tangem/blockchain/blockchains/ethereum/providers/VanarChainProvidersBuilder.kt new file mode 100644 index 000000000..d3c80789c --- /dev/null +++ b/blockchain/src/main/java/com/tangem/blockchain/blockchains/ethereum/providers/VanarChainProvidersBuilder.kt @@ -0,0 +1,23 @@ +package com.tangem.blockchain.blockchains.ethereum.providers + +import com.tangem.blockchain.blockchains.ethereum.network.EthereumJsonRpcProvider +import com.tangem.blockchain.common.Blockchain +import com.tangem.blockchain.common.network.providers.NetworkProvidersBuilder +import com.tangem.blockchain.common.network.providers.ProviderType + +internal class VanarChainProvidersBuilder( + override val providerTypes: List, +) : NetworkProvidersBuilder() { + + override fun createProviders(blockchain: Blockchain): List { + return listOf( + EthereumJsonRpcProvider("https://rpc.vanarchain.com"), // FIXME: use config during full integration + ) + } + + override fun createTestnetProviders(blockchain: Blockchain): List { + return listOf( + EthereumJsonRpcProvider("https://rpc-vanguard.vanarchain.com"), + ) + } +} diff --git a/blockchain/src/main/java/com/tangem/blockchain/common/Blockchain.kt b/blockchain/src/main/java/com/tangem/blockchain/common/Blockchain.kt index 395fc8d98..ceba96725 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/common/Blockchain.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/common/Blockchain.kt @@ -176,6 +176,8 @@ enum class Blockchain( Chiliz("chiliz", "CHZ", "Chiliz"), ChilizTestnet("chiliz/test", "CHZ", "Chiliz Spicy Testnet"), Clore("clore-ai", "CLORE", "Clore"), + VanarChain("vanar-chain", "VANRY", "Vanar Chain"), + VanarChainTestnet("vanar-chain/test", "VG", "Vanar Vanguard Testnet"), ; private val externalLinkProvider: ExternalLinkProvider by lazy { ExternalLinkProviderFactory.makeProvider(this) } @@ -276,6 +278,7 @@ enum class Blockchain( EnergyWebX, EnergyWebXTestnet, Core, CoreTestnet, Chiliz, ChilizTestnet, + VanarChain, VanarChainTestnet, Xodex, Canxium, -> 18 @@ -352,6 +355,7 @@ enum class Blockchain( EnergyWebChain, EnergyWebChainTestnet, Core, CoreTestnet, Chiliz, ChilizTestnet, + VanarChain, VanarChainTestnet, Xodex, Canxium, -> EthereumAddressService() @@ -485,6 +489,7 @@ enum class Blockchain( Casper, CasperTestnet -> CasperTestnet Core, CoreTestnet -> CoreTestnet Chiliz, ChilizTestnet -> ChilizTestnet + VanarChain, VanarChainTestnet -> VanarChainTestnet else -> null } } @@ -560,6 +565,7 @@ enum class Blockchain( Core, CoreTestnet, Casper, CasperTestnet, Chiliz, ChilizTestnet, + VanarChain, VanarChainTestnet, Xodex, Canxium, Clore, @@ -662,6 +668,8 @@ enum class Blockchain( Canxium -> Chain.Canxium.id Chiliz -> Chain.Chiliz.id ChilizTestnet -> Chain.ChilizTestnet.id + VanarChain -> Chain.VanarChain.id + VanarChainTestnet -> Chain.VanarChainTestnet.id else -> null } } diff --git a/blockchain/src/main/java/com/tangem/blockchain/common/WalletManagerFactory.kt b/blockchain/src/main/java/com/tangem/blockchain/common/WalletManagerFactory.kt index cd3ab316f..bfd1f8ade 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/common/WalletManagerFactory.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/common/WalletManagerFactory.kt @@ -151,6 +151,7 @@ class WalletManagerFactory( Blockchain.EnergyWebChain, Blockchain.EnergyWebChainTestnet, Blockchain.Core, Blockchain.CoreTestnet, Blockchain.Chiliz, Blockchain.ChilizTestnet, + Blockchain.VanarChain, Blockchain.VanarChainTestnet, Blockchain.Xodex, Blockchain.Canxium, -> EthereumLikeWalletManagerAssembly diff --git a/blockchain/src/main/java/com/tangem/blockchain/common/address/EstimationFeeAddressFactory.kt b/blockchain/src/main/java/com/tangem/blockchain/common/address/EstimationFeeAddressFactory.kt index 4fd078945..223070da7 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/common/address/EstimationFeeAddressFactory.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/common/address/EstimationFeeAddressFactory.kt @@ -91,6 +91,7 @@ class EstimationFeeAddressFactory { Blockchain.EnergyWebChain, Blockchain.EnergyWebChainTestnet, Blockchain.Core, Blockchain.CoreTestnet, Blockchain.Chiliz, Blockchain.ChilizTestnet, + Blockchain.VanarChain, Blockchain.VanarChainTestnet, Blockchain.Xodex, Blockchain.Canxium, -> "0x52bb4012854f808CF9BAbd855e44E506dAf6C077" diff --git a/blockchain/src/main/java/com/tangem/blockchain/common/assembly/impl/EthereumLikeWalletManagerAssembly.kt b/blockchain/src/main/java/com/tangem/blockchain/common/assembly/impl/EthereumLikeWalletManagerAssembly.kt index 12ebb8ee0..6a0d85596 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/common/assembly/impl/EthereumLikeWalletManagerAssembly.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/common/assembly/impl/EthereumLikeWalletManagerAssembly.kt @@ -69,6 +69,7 @@ internal object EthereumLikeWalletManagerAssembly : WalletManagerAssembly EnergyWebChainProvidersBuilder(providerTypes) Blockchain.Core, Blockchain.CoreTestnet -> CoreProvidersBuilder(providerTypes) Blockchain.Chiliz, Blockchain.ChilizTestnet -> ChilizProvidersBuilder(providerTypes) + Blockchain.VanarChain, Blockchain.VanarChainTestnet -> VanarChainProvidersBuilder(providerTypes) Blockchain.Xodex -> XodexProvidersBuilder(providerTypes) Blockchain.Canxium -> CanxiumProvidersBuilder(providerTypes) else -> error("Unsupported blockchain: $blockchain") diff --git a/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV1.kt b/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV1.kt index 59aaccbe3..2972d9605 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV1.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV1.kt @@ -62,6 +62,7 @@ object DerivationConfigV1 : DerivationConfig() { Blockchain.Cyber, Blockchain.Canxium, Blockchain.Chiliz, + Blockchain.VanarChain, Blockchain.Xodex, -> mapOf(AddressType.Default to DerivationPath("m/44'/60'/0'/0/0")) Blockchain.XDC -> mapOf(AddressType.Default to DerivationPath("m/44'/550'/0'/0/0")) @@ -151,6 +152,7 @@ object DerivationConfigV1 : DerivationConfig() { Blockchain.EnergyWebChainTestnet, Blockchain.CoreTestnet, Blockchain.ChilizTestnet, + Blockchain.VanarChainTestnet, -> mapOf(AddressType.Default to DerivationPath("m/44'/1'/0'/0/0")) Blockchain.Aptos, Blockchain.AptosTestnet, diff --git a/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV2.kt b/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV2.kt index f61376570..59d43be5f 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV2.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV2.kt @@ -77,6 +77,7 @@ object DerivationConfigV2 : DerivationConfig() { Blockchain.Xodex, Blockchain.Canxium, Blockchain.Chiliz, + Blockchain.VanarChain, -> mapOf(AddressType.Default to DerivationPath("m/44'/60'/0'/0/0")) Blockchain.XDC -> mapOf(AddressType.Default to DerivationPath("m/44'/550'/0'/0/0")) Blockchain.Binance -> mapOf(AddressType.Default to DerivationPath("m/44'/714'/0'/0/0")) @@ -151,6 +152,7 @@ object DerivationConfigV2 : DerivationConfig() { Blockchain.EnergyWebChainTestnet, Blockchain.CoreTestnet, Blockchain.ChilizTestnet, + Blockchain.VanarChainTestnet, -> mapOf(AddressType.Default to DerivationPath("m/44'/1'/0'/0/0")) Blockchain.Aptos, Blockchain.AptosTestnet, diff --git a/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV3.kt b/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV3.kt index 7dd1928b2..ad914a1b4 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV3.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV3.kt @@ -72,6 +72,7 @@ object DerivationConfigV3 : DerivationConfig() { Blockchain.Xodex, Blockchain.Canxium, Blockchain.Chiliz, + Blockchain.VanarChain, -> mapOf(AddressType.Default to DerivationPath("m/44'/60'/0'/0/0")) Blockchain.XDC -> mapOf(AddressType.Default to DerivationPath("m/44'/550'/0'/0/0")) Blockchain.EthereumClassic -> mapOf(AddressType.Default to DerivationPath("m/44'/61'/0'/0/0")) @@ -147,6 +148,7 @@ object DerivationConfigV3 : DerivationConfig() { Blockchain.EnergyWebChainTestnet, Blockchain.CoreTestnet, Blockchain.ChilizTestnet, + Blockchain.VanarChainTestnet, -> mapOf(AddressType.Default to DerivationPath("m/44'/1'/0'/0/0")) Blockchain.Aptos, Blockchain.AptosTestnet, diff --git a/blockchain/src/main/java/com/tangem/blockchain/externallinkprovider/ExternalLinkProviderFactory.kt b/blockchain/src/main/java/com/tangem/blockchain/externallinkprovider/ExternalLinkProviderFactory.kt index 5ce4fa4af..eea3b3af5 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/externallinkprovider/ExternalLinkProviderFactory.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/externallinkprovider/ExternalLinkProviderFactory.kt @@ -92,6 +92,7 @@ internal object ExternalLinkProviderFactory { Blockchain.Casper, Blockchain.CasperTestnet -> CasperExternalLinkProvider(isTestnet) Blockchain.Core, Blockchain.CoreTestnet -> CoreExternalLinkProvider(isTestnet) Blockchain.Chiliz, Blockchain.ChilizTestnet -> ChilizExternalLinkProvider(isTestnet) + Blockchain.VanarChain, Blockchain.VanarChainTestnet -> VanarChainExternalLinkProvider(isTestnet) Blockchain.Xodex -> XodexExternalLinkProvider() Blockchain.Canxium -> CanxiumExternalLinkProvider() Blockchain.Clore -> CloreExternalLinkProvider() diff --git a/blockchain/src/main/java/com/tangem/blockchain/externallinkprovider/providers/VanarChainExternalLinkProvider.kt b/blockchain/src/main/java/com/tangem/blockchain/externallinkprovider/providers/VanarChainExternalLinkProvider.kt new file mode 100644 index 000000000..e71fc6dc3 --- /dev/null +++ b/blockchain/src/main/java/com/tangem/blockchain/externallinkprovider/providers/VanarChainExternalLinkProvider.kt @@ -0,0 +1,23 @@ +package com.tangem.blockchain.externallinkprovider.providers + +import com.tangem.blockchain.externallinkprovider.ExternalLinkProvider +import com.tangem.blockchain.externallinkprovider.TxExploreState + +internal class VanarChainExternalLinkProvider(isTestnet: Boolean) : ExternalLinkProvider { + + override val explorerBaseUrl: String = if (isTestnet) { + "https://explorer-vanguard.vanarchain.com/" + } else { + "https://explorer.vanarchain.com/" + } + + override val testNetTopUpUrl: String = "https://faucet.vanarchain.com/" + + override fun explorerUrl(walletAddress: String, contractAddress: String?): String { + return "${explorerBaseUrl}address/$walletAddress" + } + + override fun getExplorerTxUrl(transactionHash: String): TxExploreState { + return TxExploreState.Url("${explorerBaseUrl}tx/$transactionHash") + } +}