Skip to content

Commit fc4a877

Browse files
committed
Add SendTransactionService creation for all evm blockchains
1 parent f654d68 commit fc4a877

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/SwapConfirmViewModel.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class SwapConfirmViewModel(
212212

213213
companion object {
214214
fun init(quote: SwapProviderQuote, settings: Map<String, Any?>): CreationExtras.() -> SwapConfirmViewModel = {
215-
val sendTransactionService = SendTransactionServiceFactory.create(quote.tokenIn)
215+
val sendTransactionService = SendTransactionServiceFactory.create(quote.tokenIn.blockchainType)
216216

217217
SwapConfirmViewModel(
218218
quote.provider,

app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/sendtransaction/SendTransactionServiceFactory.kt

+19-19
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@ package io.horizontalsystems.bankwallet.modules.multiswap.sendtransaction
22

33
import io.horizontalsystems.bankwallet.core.UnsupportedException
44
import io.horizontalsystems.marketkit.models.BlockchainType
5-
import io.horizontalsystems.marketkit.models.Token
65

76
object SendTransactionServiceFactory {
8-
fun create(tokenIn: Token): ISendTransactionService = when (val blockchainType = tokenIn.blockchainType) {
9-
BlockchainType.Bitcoin -> TODO()
10-
BlockchainType.BitcoinCash -> TODO()
11-
BlockchainType.ECash -> TODO()
12-
BlockchainType.Litecoin -> TODO()
13-
BlockchainType.Dash -> TODO()
14-
BlockchainType.Zcash -> TODO()
7+
fun create(blockchainType: BlockchainType): ISendTransactionService = when (blockchainType) {
158
BlockchainType.Ethereum,
16-
BlockchainType.BinanceSmartChain -> SendTransactionServiceEvm(blockchainType)
17-
BlockchainType.BinanceChain -> TODO()
18-
BlockchainType.Polygon -> TODO()
19-
BlockchainType.Avalanche -> TODO()
20-
BlockchainType.Optimism -> TODO()
21-
BlockchainType.ArbitrumOne -> TODO()
22-
BlockchainType.Solana -> TODO()
23-
BlockchainType.Gnosis -> TODO()
24-
BlockchainType.Fantom -> TODO()
25-
BlockchainType.Tron -> TODO()
26-
BlockchainType.Ton -> TODO()
9+
BlockchainType.BinanceSmartChain,
10+
BlockchainType.Polygon,
11+
BlockchainType.Avalanche,
12+
BlockchainType.Optimism,
13+
BlockchainType.ArbitrumOne,
14+
BlockchainType.Gnosis,
15+
BlockchainType.Fantom -> SendTransactionServiceEvm(blockchainType)
16+
17+
BlockchainType.Bitcoin,
18+
BlockchainType.BitcoinCash,
19+
BlockchainType.ECash,
20+
BlockchainType.Litecoin,
21+
BlockchainType.Dash,
22+
BlockchainType.Zcash,
23+
BlockchainType.BinanceChain,
24+
BlockchainType.Solana,
25+
BlockchainType.Tron,
26+
BlockchainType.Ton,
2727
is BlockchainType.Unsupported -> throw UnsupportedException("")
2828
}
2929
}

0 commit comments

Comments
 (0)