Updated on 2026-08-14
This commit is contained in:
parent
33b7a53905
commit
c5560c3c6a
101 changed files with 274 additions and 272 deletions
|
|
@ -466,7 +466,7 @@ internal class SwapInteractorImpl @AssistedInject constructor(
|
|||
is TxFeeState.MultipleFeeState -> feeState.normalFee.feeValue
|
||||
is TxFeeState.SingleFeeState -> feeState.fee.feeValue
|
||||
},
|
||||
blockchain = Blockchain.fromId(currency.network.id.value),
|
||||
blockchain = Blockchain.fromId(currency.network.rawId),
|
||||
),
|
||||
)
|
||||
|
||||
|
|
@ -1387,7 +1387,7 @@ internal class SwapInteractorImpl @AssistedInject constructor(
|
|||
val callData = SmartContractCallDataProviderFactory.getApprovalCallData(
|
||||
spenderAddress = requireNotNull(spenderAddress) { "Spender address is null" },
|
||||
amount = swapAmount.value.convertToSdkAmount(fromToken),
|
||||
blockchain = Blockchain.fromId(fromToken.network.id.value),
|
||||
blockchain = Blockchain.fromId(fromToken.network.rawId),
|
||||
)
|
||||
val feeData = try {
|
||||
val extras = createTransactionExtrasUseCase(
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
package com.tangem.feature.swap.domain.converters
|
||||
|
||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||
import com.tangem.lib.crypto.models.Currency
|
||||
import com.tangem.utils.converter.Converter
|
||||
|
||||
class SwapCurrencyConverter : Converter<CryptoCurrency, Currency> {
|
||||
|
||||
override fun convert(value: CryptoCurrency): Currency {
|
||||
return when (value) {
|
||||
is CryptoCurrency.Token -> {
|
||||
Currency.NonNativeToken(
|
||||
id = value.id.value,
|
||||
name = value.name,
|
||||
symbol = value.symbol,
|
||||
networkId = value.network.id.value,
|
||||
contractAddress = value.contractAddress,
|
||||
decimalCount = value.decimals,
|
||||
)
|
||||
}
|
||||
is CryptoCurrency.Coin -> {
|
||||
Currency.NativeToken(
|
||||
id = value.id.value,
|
||||
name = value.name,
|
||||
symbol = value.symbol,
|
||||
networkId = value.network.id.value,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1353,7 +1353,7 @@ internal class SwapModel @Inject constructor(
|
|||
saveBlockchainErrorUseCase(
|
||||
error = BlockchainErrorInfo(
|
||||
errorMessage = errorMessage,
|
||||
blockchainId = network.id.value,
|
||||
blockchainId = network.rawId,
|
||||
derivationPath = network.derivationPath.value,
|
||||
destinationAddress = transaction?.txTo.orEmpty(),
|
||||
tokenSymbol = fromCurrencyStatus.currency.symbol,
|
||||
|
|
@ -1375,7 +1375,7 @@ internal class SwapModel @Inject constructor(
|
|||
private fun CryptoCurrency.getNetworkInfo(): NetworkInfo {
|
||||
return NetworkInfo(
|
||||
name = this.network.name,
|
||||
blockchainId = this.network.id.value,
|
||||
blockchainId = this.network.rawId,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ internal class SwapNotificationsFactory(
|
|||
}
|
||||
is TxFeeState.SingleFeeState -> feeState.fee
|
||||
}
|
||||
val isCardano = BlockchainUtils.isCardano(fromCurrencyStatus.currency.network.id.value)
|
||||
val isCardano = BlockchainUtils.isCardano(fromCurrencyStatus.currency.network.rawId)
|
||||
// blockchain specific
|
||||
|
||||
addExistentialWarningNotification(
|
||||
|
|
@ -305,7 +305,7 @@ internal class SwapNotificationsFactory(
|
|||
fromAmount: SwapAmount,
|
||||
onReduceByAmount: (SwapAmount, BigDecimal) -> Unit,
|
||||
) {
|
||||
val isTezos = isTezos(cryptoCurrencyStatus.currency.network.id.value)
|
||||
val isTezos = isTezos(cryptoCurrencyStatus.currency.network.rawId)
|
||||
val balance = cryptoCurrencyStatus.value.amount ?: BigDecimal.ZERO
|
||||
val threshold = getTezosThreshold()
|
||||
val isTotalBalance = fromAmount.value >= balance && balance > threshold
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ import com.tangem.feature.swap.domain.models.domain.IncludeFeeInAmount
|
|||
import com.tangem.feature.swap.domain.models.domain.NetworkInfo
|
||||
import com.tangem.feature.swap.domain.models.domain.SwapProvider
|
||||
import com.tangem.feature.swap.domain.models.ui.*
|
||||
import com.tangem.feature.swap.model.SwapNotificationsFactory
|
||||
import com.tangem.feature.swap.model.SwapProcessDataState
|
||||
import com.tangem.feature.swap.models.*
|
||||
import com.tangem.feature.swap.models.states.*
|
||||
import com.tangem.feature.swap.models.states.events.SwapEvent
|
||||
import com.tangem.feature.swap.presentation.R
|
||||
import com.tangem.feature.swap.model.SwapNotificationsFactory
|
||||
import com.tangem.feature.swap.utils.formatToUIRepresentation
|
||||
import com.tangem.feature.swap.model.SwapProcessDataState
|
||||
import com.tangem.utils.Provider
|
||||
import com.tangem.utils.StringsSigns.DASH_SIGN
|
||||
import com.tangem.utils.StringsSigns.PERCENT
|
||||
|
|
@ -93,7 +93,7 @@ internal class StateBuilder(
|
|||
canSelectAnotherToken = false,
|
||||
isNotNativeToken = initialCurrencyFrom is CryptoCurrency.Token,
|
||||
balance = "",
|
||||
networkIconRes = getActiveIconRes(initialCurrencyFrom.network.id.value),
|
||||
networkIconRes = getActiveIconRes(initialCurrencyFrom.network.rawId),
|
||||
isBalanceHidden = true,
|
||||
),
|
||||
receiveCardData = SwapCardState.SwapCardData(
|
||||
|
|
@ -106,7 +106,7 @@ internal class StateBuilder(
|
|||
canSelectAnotherToken = false,
|
||||
balance = "",
|
||||
isNotNativeToken = initialCurrencyTo is CryptoCurrency.Token,
|
||||
networkIconRes = initialCurrencyTo?.let { getActiveIconRes(it.network.id.value) },
|
||||
networkIconRes = initialCurrencyTo?.let { getActiveIconRes(it.network.rawId) },
|
||||
coinId = initialCurrencyTo?.network?.backendId,
|
||||
isBalanceHidden = true,
|
||||
),
|
||||
|
|
@ -153,7 +153,7 @@ internal class StateBuilder(
|
|||
tokenCurrency = uiStateHolder.sendCardData.tokenCurrency,
|
||||
canSelectAnotherToken = uiStateHolder.sendCardData.canSelectAnotherToken,
|
||||
balance = fromToken.getFormattedAmount(isNeedSymbol = false),
|
||||
networkIconRes = getActiveIconRes(fromToken.currency.network.id.value),
|
||||
networkIconRes = getActiveIconRes(fromToken.currency.network.rawId),
|
||||
isBalanceHidden = isBalanceHiddenProvider(),
|
||||
),
|
||||
receiveCardData = SwapCardState.Empty(
|
||||
|
|
@ -206,7 +206,7 @@ internal class StateBuilder(
|
|||
isNotNativeToken = fromToken is CryptoCurrency.Token,
|
||||
canSelectAnotherToken = canSelectSendToken,
|
||||
balance = if (!canSelectSendToken) uiStateHolder.sendCardData.balance else "",
|
||||
networkIconRes = getActiveIconRes(fromToken.network.id.value),
|
||||
networkIconRes = getActiveIconRes(fromToken.network.rawId),
|
||||
isBalanceHidden = isBalanceHiddenProvider(),
|
||||
),
|
||||
receiveCardData = SwapCardState.SwapCardData(
|
||||
|
|
@ -220,7 +220,7 @@ internal class StateBuilder(
|
|||
isNotNativeToken = toToken is CryptoCurrency.Token,
|
||||
canSelectAnotherToken = canSelectReceiveToken,
|
||||
balance = if (!canSelectReceiveToken) uiStateHolder.receiveCardData.balance else "",
|
||||
networkIconRes = getActiveIconRes(toToken.network.id.value),
|
||||
networkIconRes = getActiveIconRes(toToken.network.rawId),
|
||||
isBalanceHidden = isBalanceHiddenProvider(),
|
||||
),
|
||||
notifications = persistentListOf(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue