Skip to content

Commit

Permalink
Add Base network
Browse files Browse the repository at this point in the history
  • Loading branch information
abdrasulov committed Sep 30, 2024
1 parent b3fba35 commit d0fa4b9
Show file tree
Hide file tree
Showing 26 changed files with 113 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ android {
resValue "string", "arbiscanApiKey", "Z43JN5434XVNA5D73UGPWKF26G5D9MGDPZ"
resValue "string", "gnosisscanApiKey", "V2J8YU15ZX9S1W3GTUV2HXM11TP2TUBRW4"
resValue "string", "ftmscanApiKey", "57YQ2GIRAZNV6M5HIJYYG3XQGGNIPVV8MF"
resValue "string", "basescanApiKey", "AKEWS351FN9P9E2CFPWRWQVGHYUP7W8SUF"
resValue "string", "is_release", "false"
resValue "string", "guidesUrl", "https://raw.githubusercontent.com/horizontalsystems/blockchain-crypto-guides/develop/index.json"
resValue "string", "faqUrl", "https://raw.githubusercontent.com/horizontalsystems/Unstoppable-Wallet-Website/master/src/faq.json"
Expand Down Expand Up @@ -113,6 +114,7 @@ android {
resValue "string", "arbiscanApiKey", "4QWW522BV13BJCZMXH1JIB2ESJ7MZTSJYI"
resValue "string", "gnosisscanApiKey", "KEXFAQKDUENZ5U9CW3ZKYJEJ84ZIHH9QTY"
resValue "string", "ftmscanApiKey", "JAWRPW27KEMVXMJJ9UKY63CVPH3X5V9SMP"
resValue "string", "basescanApiKey", "QU4RJVJXQCW812J3234EW9EV815TA6XC55"
resValue "string", "is_release", "true"
resValue "string", "guidesUrl", "https://raw.githubusercontent.com/horizontalsystems/blockchain-crypto-guides/v1.2/index.json"
resValue "string", "faqUrl", "https://raw.githubusercontent.com/horizontalsystems/Unstoppable-Wallet-Website/v1.3/src/faq.json"
Expand Down Expand Up @@ -277,10 +279,10 @@ dependencies {
// Wallet kits
implementation 'com.github.horizontalsystems:ton-kit-android:e907480'
implementation 'com.github.horizontalsystems:bitcoin-kit-android:47db768'
implementation 'com.github.horizontalsystems:ethereum-kit-android:3d83900'
implementation 'com.github.horizontalsystems:ethereum-kit-android:a30cc3a71'
implementation 'com.github.horizontalsystems:blockchain-fee-rate-kit-android:1d3bd49'
implementation 'com.github.horizontalsystems:binance-chain-kit-android:c1509a2'
implementation 'com.github.horizontalsystems:market-kit-android:55dde9c'
implementation 'com.github.horizontalsystems:market-kit-android:5fe87c2'
implementation 'com.github.horizontalsystems:solana-kit-android:ce738d8'
implementation 'com.github.horizontalsystems:tron-kit-android:dc3dca7'
// Zcash SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ val Token.swappable: Boolean
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Gnosis,
BlockchainType.Fantom,
BlockchainType.ArbitrumOne -> true
Expand Down Expand Up @@ -149,6 +150,7 @@ val TokenQuery.isSupported: Boolean
BlockchainType.BinanceSmartChain,
BlockchainType.Polygon,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.ArbitrumOne,
BlockchainType.Gnosis,
BlockchainType.Fantom,
Expand Down Expand Up @@ -184,6 +186,7 @@ val Blockchain.description: String
BlockchainType.Polygon -> "MATIC, ERC20 tokens"
BlockchainType.Avalanche -> "AVAX, ERC20 tokens"
BlockchainType.Optimism -> "L2 chain"
BlockchainType.Base -> "L2 chain"
BlockchainType.ArbitrumOne -> "L2 chain"
BlockchainType.Solana -> "SOL, SPL tokens"
BlockchainType.Gnosis -> "xDAI, ERC20 tokens"
Expand Down Expand Up @@ -218,6 +221,7 @@ private val blockchainOrderMap: Map<BlockchainType, Int> by lazy {
BlockchainType.Ton,
BlockchainType.Solana,
BlockchainType.Polygon,
BlockchainType.Base,
BlockchainType.Avalanche,
BlockchainType.Zcash,
BlockchainType.BitcoinCash,
Expand Down Expand Up @@ -246,6 +250,7 @@ val BlockchainType.tokenIconPlaceholder: Int
BlockchainType.Avalanche -> R.drawable.avalanche_erc20
BlockchainType.Polygon -> R.drawable.polygon_erc20
BlockchainType.Optimism -> R.drawable.optimism_erc20
BlockchainType.Base -> R.drawable.base_erc20
BlockchainType.ArbitrumOne -> R.drawable.arbitrum_erc20
BlockchainType.Gnosis -> R.drawable.gnosis_erc20
BlockchainType.Fantom -> R.drawable.fantom_erc20
Expand All @@ -269,6 +274,7 @@ val BlockchainType.title: String
BlockchainType.ArbitrumOne -> "ArbitrumOne"
BlockchainType.BinanceChain -> "BNB Beacon Coin"
BlockchainType.Optimism -> "Optimism"
BlockchainType.Base -> "Base"
BlockchainType.Solana -> "Solana"
BlockchainType.Gnosis -> "Gnosis"
BlockchainType.Fantom -> "Fantom"
Expand All @@ -294,6 +300,7 @@ val BlockchainType.brandColor: Color?
BlockchainType.Polygon -> Color(0xFF8247E5)
BlockchainType.Avalanche -> Color(0xFFD74F49)
BlockchainType.Optimism -> Color(0xFFEB3431)
BlockchainType.Base -> Color(0xFF2759F6)
BlockchainType.ArbitrumOne -> Color(0xFF96BEDC)
else -> null
}
Expand Down Expand Up @@ -329,6 +336,7 @@ fun BlockchainType.supports(accountType: AccountType): Boolean {
|| this == BlockchainType.Polygon
|| this == BlockchainType.Avalanche
|| this == BlockchainType.Optimism
|| this == BlockchainType.Base
|| this == BlockchainType.ArbitrumOne
|| this == BlockchainType.Gnosis
|| this == BlockchainType.Fantom
Expand All @@ -338,6 +346,7 @@ fun BlockchainType.supports(accountType: AccountType): Boolean {
|| this == BlockchainType.Polygon
|| this == BlockchainType.Avalanche
|| this == BlockchainType.Optimism
|| this == BlockchainType.Base
|| this == BlockchainType.ArbitrumOne
|| this == BlockchainType.Gnosis
|| this == BlockchainType.Fantom
Expand Down Expand Up @@ -572,6 +581,7 @@ val BlockchainType.Companion.supported: List<BlockchainType>
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.ArbitrumOne,
BlockchainType.Gnosis,
BlockchainType.Fantom,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class AdapterFactory(
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Gnosis,
BlockchainType.Fantom,
BlockchainType.ArbitrumOne -> {
Expand Down Expand Up @@ -230,6 +231,7 @@ class AdapterFactory(
BlockchainType.BinanceSmartChain,
BlockchainType.Polygon,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.ArbitrumOne -> {
val evmKitManager = evmBlockchainManager.getEvmKitManager(blockchainType)
evmKitManager.unlink(wallet.account)
Expand All @@ -256,6 +258,7 @@ class AdapterFactory(
BlockchainType.BinanceSmartChain,
BlockchainType.Polygon,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.ArbitrumOne -> {
val evmKitManager = evmBlockchainManager.getEvmKitManager(blockchainType)
evmKitManager.unlink(transactionSource.account)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class EvmBlockchainManager(
BlockchainType.Polygon -> Chain.Polygon
BlockchainType.Avalanche -> Chain.Avalanche
BlockchainType.Optimism -> Chain.Optimism
BlockchainType.Base -> Chain.Base
BlockchainType.ArbitrumOne -> Chain.ArbitrumOne
BlockchainType.Gnosis -> Chain.Gnosis
BlockchainType.Fantom -> Chain.Fantom
Expand Down Expand Up @@ -80,6 +81,7 @@ class EvmBlockchainManager(
BlockchainType.ArbitrumOne,
BlockchainType.Gnosis,
BlockchainType.Fantom,
BlockchainType.Base,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class EvmSyncSourceManager(
BlockchainType.ArbitrumOne -> TransactionSource.arbiscan(appConfigProvider.arbiscanApiKey)
BlockchainType.Gnosis -> TransactionSource.gnosis(appConfigProvider.gnosisscanApiKey)
BlockchainType.Fantom -> TransactionSource.fantom(appConfigProvider.ftmscanApiKey)
BlockchainType.Base -> TransactionSource.basescan(appConfigProvider.basescanApiKey)
else -> throw Exception("Non-supported EVM blockchain")
}
}
Expand Down Expand Up @@ -131,6 +132,33 @@ class EvmSyncSourceManager(
)
)

BlockchainType.Base -> listOf(
evmSyncSource(
blockchainType,
"Base",
RpcSource.baseRpcHttp(),
defaultTransactionSource(blockchainType)
),
evmSyncSource(
blockchainType,
"LlamaNodes",
RpcSource.Http(
listOf(URI("https://base.llamarpc.com")),
null
),
defaultTransactionSource(blockchainType)
),
evmSyncSource(
blockchainType,
"Omnia",
RpcSource.Http(
listOf(URI("https://endpoints.omniatech.io/v1/base/mainnet/public")),
null
),
defaultTransactionSource(blockchainType)
)
)

BlockchainType.ArbitrumOne -> listOf(
evmSyncSource(
blockchainType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class TransactionAdapterManager(
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Gnosis,
BlockchainType.Fantom,
BlockchainType.ArbitrumOne -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ class AppConfigProvider(localStorage: ILocalStorage) {
val ftmscanApiKey by lazy {
Translator.getString(R.string.ftmscanApiKey)
}
val basescanApiKey by lazy {
Translator.getString(R.string.basescanApiKey)
}
val guidesUrl by lazy {
Translator.getString(R.string.guidesUrl)
}
Expand Down Expand Up @@ -138,6 +141,7 @@ class AppConfigProvider(localStorage: ILocalStorage) {
BlockchainType.Polygon to "0x731352dcF66014156B1560B832B56069e7b38ab1",
BlockchainType.Avalanche to "0x731352dcF66014156B1560B832B56069e7b38ab1",
BlockchainType.Optimism to "0x731352dcF66014156B1560B832B56069e7b38ab1",
BlockchainType.Base to "0x731352dcF66014156B1560B832B56069e7b38ab1",
BlockchainType.ArbitrumOne to "0x731352dcF66014156B1560B832B56069e7b38ab1",
BlockchainType.Solana to "ELFQmFXqdS6C1zVqZifs7WAmLKovdEPbWSnqomhZoK3B",
BlockchainType.Gnosis to "0x731352dcF66014156B1560B832B56069e7b38ab1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ val BitcoinAddress.tokenType: TokenType
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.ArbitrumOne,
BlockchainType.Solana,
BlockchainType.Gnosis,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class AddressHandlerFactory(
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Gnosis,
BlockchainType.Fantom,
BlockchainType.ArbitrumOne -> {
Expand Down Expand Up @@ -92,6 +93,7 @@ class AddressHandlerFactory(
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Gnosis,
BlockchainType.Fantom,
BlockchainType.ArbitrumOne -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ object AddressInputModule {
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Gnosis,
BlockchainType.Fantom,
BlockchainType.ArbitrumOne -> {
Expand Down Expand Up @@ -83,6 +84,7 @@ object AddressInputModule {
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Gnosis,
BlockchainType.Fantom,
BlockchainType.ArbitrumOne -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class AddressHandlerUdn(
BlockchainType.BinanceChain,
BlockchainType.Polygon,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Avalanche,
BlockchainType.Gnosis,
BlockchainType.Fantom,
Expand Down Expand Up @@ -138,6 +139,7 @@ class AddressHandlerUdn(
BlockchainType.Avalanche -> "AVAX"
BlockchainType.Ethereum,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.ArbitrumOne,
BlockchainType.Gnosis,
BlockchainType.Fantom -> "ERC20"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class AddTokenService(
BlockchainType.Fantom,
BlockchainType.ArbitrumOne,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Solana
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class BalanceViewItemFactory {
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Solana,
BlockchainType.Gnosis,
BlockchainType.Fantom,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class MarketFiltersService(
BlockchainType.Unsupported("moonriver"),
BlockchainType.Unsupported("okex-chain"),
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Polygon,
BlockchainType.Unsupported("solana"),
BlockchainType.Unsupported("sora"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ abstract class BaseUniswapV3Provider(dexType: DexType) : EvmSwapProvider() {
BlockchainType.BinanceSmartChain,
BlockchainType.Polygon,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.ArbitrumOne -> uniswapV3Kit.etherToken(chain)
else -> throw Exception("Invalid coin for swap: $token")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ object OneInchProvider : EvmSwapProvider() {
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Gnosis,
BlockchainType.Fantom,
BlockchainType.ArbitrumOne
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ object UniswapV3Provider : BaseUniswapV3Provider(DexType.Uniswap) {
BlockchainType.ArbitrumOne,
// BlockchainType.Optimism,
BlockchainType.Polygon,
BlockchainType.BinanceSmartChain
BlockchainType.BinanceSmartChain,
BlockchainType.Base,
-> true
else -> false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ object SendTransactionServiceFactory {
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.ArbitrumOne,
BlockchainType.Gnosis,
BlockchainType.Fantom -> SendTransactionServiceEvm(blockchainType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class SendFragment : BaseFragment() {
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.Gnosis,
BlockchainType.Fantom,
BlockchainType.ArbitrumOne -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ data class TransactionInfoItem(
val BlockchainType.resendable: Boolean
get() =
when (this) {
BlockchainType.Optimism, BlockchainType.ArbitrumOne -> false
BlockchainType.Optimism, BlockchainType.Base, BlockchainType.ArbitrumOne -> false
else -> true
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class TransactionRecordRepository(
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.ArbitrumOne,
BlockchainType.Gnosis,
BlockchainType.Fantom,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ data class TransactionViewItem(
BlockchainType.Polygon -> R.drawable.logo_chain_polygon_trx_24
BlockchainType.Avalanche -> R.drawable.logo_chain_avalanche_trx_24
BlockchainType.Optimism -> R.drawable.logo_chain_optimism_trx_24
BlockchainType.Base -> R.drawable.logo_chain_base_trx_24
BlockchainType.ArbitrumOne -> R.drawable.logo_chain_arbitrum_one_trx_24
BlockchainType.Gnosis -> R.drawable.logo_chain_gnosis_trx_32
BlockchainType.Fantom -> R.drawable.logo_chain_fantom_trx_32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class WatchAddressViewModel(
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.ArbitrumOne,
BlockchainType.Gnosis,
BlockchainType.Fantom -> Type.EvmAddress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ private fun openTransactionOptionsModule(
BlockchainType.Polygon,
BlockchainType.Avalanche,
BlockchainType.Optimism,
BlockchainType.Base,
BlockchainType.ArbitrumOne -> {
navController.slideFromRight(
R.id.transactionSpeedUpCancelFragment,
Expand Down
Loading

0 comments on commit d0fa4b9

Please sign in to comment.