Updated on 2026-08-14

This commit is contained in:
Tangem 2023-11-14 14:22:43 +02:00
parent 95f66c8798
commit cfdcf4da41
16 changed files with 278 additions and 20 deletions

View file

@ -1,14 +1,21 @@
package com.tangem.feature.swap.viewmodels
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.feature.swap.domain.models.domain.Currency
import com.tangem.feature.swap.domain.models.ui.RequestApproveStateData
import com.tangem.feature.swap.domain.models.ui.SwapStateData
import com.tangem.feature.swap.domain.models.ui.TxFee
data class SwapProcessDataState(
// Initial network id
val networkId: String,
@Deprecated("used in old swap mechanism")
val fromCurrency: Currency? = null,
@Deprecated("used in old swap mechanism")
val toCurrency: Currency? = null,
val fromCryptoCurrency: CryptoCurrency? = null,
val toCryptoCurrency: CryptoCurrency? = null,
// Amount from input
val amount: String? = null,
val approveDataModel: RequestApproveStateData? = null,
val swapDataModel: SwapStateData? = null,

View file

@ -137,6 +137,15 @@ internal class SwapViewModel @Inject constructor(
}
private fun initTokens(currency: Currency) {
// new flow
viewModelScope.launch(dispatchers.main) {
runCatching(dispatchers.io) {
val pairs = swapInteractor.getPairs(currency)
// TODO
}
}
// old flow
viewModelScope.launch(dispatchers.main) {
runCatching(dispatchers.io) {
swapInteractor.initTokensToSwap(currency)