Updated on 2026-08-14

This commit is contained in:
Tangem 2024-01-19 22:29:41 +05:00
parent b2726d153c
commit f7f2ab7f88
35 changed files with 831 additions and 91 deletions

View file

@ -215,6 +215,22 @@ internal object TokensDomainModule {
)
}
@Provides
@ViewModelScoped
fun provideGetFeePaidCryptoCurrencyStatusSyncUseCase(
currenciesRepository: CurrenciesRepository,
quotesRepository: QuotesRepository,
networksRepository: NetworksRepository,
dispatchers: CoroutineDispatcherProvider,
): GetFeePaidCryptoCurrencyStatusSyncUseCase {
return GetFeePaidCryptoCurrencyStatusSyncUseCase(
currenciesRepository = currenciesRepository,
quotesRepository = quotesRepository,
networksRepository = networksRepository,
dispatchers = dispatchers,
)
}
@Provides
@ViewModelScoped
fun provideGetCurrenciesUseCase(currenciesRepository: CurrenciesRepository): GetCryptoCurrenciesUseCase {

View file

@ -3,10 +3,12 @@ package com.tangem.tap.features.send.redux
import com.tangem.Message
import com.tangem.blockchain.common.Amount
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.FeePaidCurrency
import com.tangem.blockchain.common.WalletManager
import com.tangem.blockchain.common.transaction.TransactionFee
import com.tangem.common.core.TangemSdkError
import com.tangem.core.navigation.StateDialog
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.tap.common.analytics.events.Token.Send.AddressEntered
import com.tangem.tap.common.redux.ToastNotificationAction
import com.tangem.tap.domain.TapError
@ -28,10 +30,14 @@ object ReleaseSendState : Action
data class PrepareSendScreen(
val walletManager: WalletManager,
val feePaidCurrency: FeePaidCurrency,
val currency: CryptoCurrency,
val coinAmount: Amount?,
val coinRate: BigDecimal?,
val tokenAmount: Amount? = null,
val tokenRate: BigDecimal? = null,
val feeCurrencyRate: BigDecimal? = null,
val feeCurrencyDecimals: Int = 0,
) : SendScreenAction
// Address

View file

@ -1,6 +1,7 @@
package com.tangem.tap.features.send.redux.reducers
import com.tangem.blockchain.common.AmountType
import com.tangem.blockchain.common.FeePaidCurrency
import com.tangem.blockchain.common.Wallet
import com.tangem.core.ui.utils.BigDecimalFormatter
import com.tangem.tap.common.extensions.scaleToFiat
@ -14,6 +15,7 @@ import java.math.BigDecimal
/**
[REDACTED_AUTHOR]
*/
@Suppress("LargeClass")
class ReceiptReducer : SendInternalReducer {
private lateinit var sendState: SendState
@ -33,9 +35,10 @@ class ReceiptReducer : SendInternalReducer {
private fun handleRefresh(state: ReceiptState): SendState {
val wallet = sendState.walletManager?.wallet ?: return sendState
val feePaidCurrency = wallet.blockchain.feePaidCurrency()
val layoutType = determineLayoutType(amountState.mainCurrency.type, amountState.typeOfAmount)
val symbols = determineSymbols(wallet, amountState.typeOfAmount)
val layoutType = determineLayoutType(amountState.mainCurrency.type, amountState.typeOfAmount, feePaidCurrency)
val symbols = determineSymbols(wallet, amountState.typeOfAmount, feePaidCurrency)
val showBlank = !SendState.isReadyToSend()
val result = state.copy(
visibleTypeOfReceipt = layoutType,
@ -44,6 +47,10 @@ class ReceiptReducer : SendInternalReducer {
crypto = createCryptoType(symbols, showBlank),
tokenFiat = createTokenFiatType(symbols, showBlank),
tokenCrypto = createTokenCryptoType(symbols, showBlank),
customTokenFiat = createCustomTokenFiat(symbols, showBlank),
customTokenCrypto = createCustomTokenCrypto(symbols, showBlank),
sameCurrencyFiat = createSameCurrencyFiat(symbols, showBlank),
sameCurrencyCrypto = createSameCurrencyCrypto(symbols, showBlank),
)
return updateLastState(sendState.copy(receiptState = result), result)
}
@ -170,7 +177,143 @@ class ReceiptReducer : SendInternalReducer {
}
}
private fun determineSymbols(wallet: Wallet, amountType: AmountType): ReceiptSymbols {
private fun createCustomTokenCrypto(symbols: ReceiptSymbols, showBlank: Boolean): ReceiptTokenCrypto {
val feeValue = feeState.getCurrentFeeValue()
if (showBlank) {
return ReceiptTokenCrypto("0", feeValue.stripZeroPlainString(), "0", symbols)
}
val tokensToSend = amountState.amountToSendCrypto
return if (sendState.currencyIsConvertible() && sendState.feeIsConvertible()) {
val currencyConverter = when (amountState.typeOfAmount) {
is AmountType.Token -> sendState.tokenConverter!!
else -> sendState.coinConverter!!
}
val currencyFiat = currencyConverter.toFiatUnscaled(tokensToSend)
val feeFiat = sendState.customFeeConverter!!.toFiatUnscaled(feeValue)
val totalFiat = currencyFiat.plus(feeFiat)
ReceiptTokenCrypto(
amountToken = tokensToSend.stripZeroPlainString(),
feeCoin = feeValue.stripZeroPlainString().addPrecisionSign(),
totalFiat = totalFiat.scaleToFiat(true).stripZeroPlainString(),
symbols = symbols,
)
} else {
ReceiptTokenCrypto(
amountToken = tokensToSend.stripZeroPlainString(),
feeCoin = feeValue.stripZeroPlainString().addPrecisionSign(),
totalFiat = BigDecimalFormatter.EMPTY_BALANCE_SIGN,
symbols = symbols,
)
}
}
private fun createCustomTokenFiat(symbols: ReceiptSymbols, showBlank: Boolean): ReceiptTokenFiat {
val feeCoin = feeState.getCurrentFeeValue()
if (showBlank) {
val feeFiat = convertToFiatPrecision(feeCoin)
return ReceiptTokenFiat("0", feeFiat, "0", "0", "0", symbols)
}
val tokensToSend = amountState.amountToSendCrypto
return if (sendState.currencyIsConvertible() && sendState.feeIsConvertible()) {
val currencyConverter = when (amountState.typeOfAmount) {
is AmountType.Token -> sendState.tokenConverter!!
else -> sendState.coinConverter!!
}
val feeFiat = sendState.customFeeConverter!!.toFiatUnscaled(feeCoin)
val amountFiat = currencyConverter.toFiatUnscaled(tokensToSend)
val totalFiat = amountFiat.plus(feeFiat)
ReceiptTokenFiat(
amountFiat = amountFiat.scaleToFiat(true).stripZeroPlainString(),
feeFiat = feeFiat.scaleToFiat(true).stripZeroPlainString().addPrecisionSign(),
totalFiat = totalFiat.scaleToFiat(true).stripZeroPlainString(),
willSentToken = tokensToSend.scaleToFiat(true).stripZeroPlainString(),
willSentFeeCoin = feeCoin.stripZeroPlainString(),
symbols = symbols,
)
} else {
ReceiptTokenFiat(
amountFiat = BigDecimalFormatter.EMPTY_BALANCE_SIGN,
feeFiat = BigDecimalFormatter.EMPTY_BALANCE_SIGN,
totalFiat = BigDecimalFormatter.EMPTY_BALANCE_SIGN,
willSentToken = tokensToSend.stripZeroPlainString(),
willSentFeeCoin = feeCoin.stripZeroPlainString(),
symbols = symbols,
)
}
}
private fun createSameCurrencyCrypto(symbols: ReceiptSymbols, showBlank: Boolean): ReceiptCrypto {
val feeCrypto = feeState.getCurrentFeeValue()
val feeFiat = convertToFiatPrecision(feeCrypto)
if (showBlank) {
return ReceiptCrypto("0", feeCrypto.stripZeroPlainString(), "0", "0", "0", symbols)
}
val isToken = amountState.typeOfAmount is AmountType.Token
if (feeState.feeIsIncluded) {
return ReceiptCrypto(
amountCrypto = amountState.amountToSendCrypto.minus(feeCrypto).stripZeroPlainString(),
feeCrypto = feeCrypto.stripZeroPlainString().addPrecisionSign(),
totalCrypto = amountState.amountToSendCrypto.stripZeroPlainString(),
feeFiat = feeFiat,
willSentFiat = convertToFiatPrecision(value = amountState.amountToSendCrypto, isToken = isToken),
symbols = symbols,
)
} else {
val totalCrypto = amountState.amountToSendCrypto.plus(feeCrypto)
return ReceiptCrypto(
amountCrypto = amountState.amountToSendCrypto.stripZeroPlainString(),
feeCrypto = feeCrypto.stripZeroPlainString().addPrecisionSign(),
totalCrypto = totalCrypto.stripZeroPlainString(),
feeFiat = feeFiat,
willSentFiat = convertToFiatPrecision(value = totalCrypto, isToken = isToken),
symbols = symbols,
)
}
}
private fun createSameCurrencyFiat(symbols: ReceiptSymbols, showBlank: Boolean): ReceiptFiat {
val feeCrypto = feeState.getCurrentFeeValue()
val isToken = amountState.typeOfAmount is AmountType.Token
val feeFiat = convertToFiatPrecision(feeCrypto, isToken = isToken)
if (showBlank) {
return ReceiptFiat("0", feeFiat, "0", "0", symbols)
}
return if (feeState.feeIsIncluded) {
val amountFiat = convertToFiatPrecision(amountState.amountToSendCrypto.minus(feeCrypto), isToken = isToken)
val totalFiat = convertToFiatPrecision(amountState.amountToSendCrypto, isToken = isToken)
ReceiptFiat(
amountFiat = amountFiat,
feeFiat = feeFiat,
totalFiat = totalFiat,
willSentCrypto = amountState.amountToSendCrypto.scaleToFiat(true).stripZeroPlainString(),
symbols = symbols,
)
} else {
val totalAmountCrypto = amountState.amountToSendCrypto.plus(feeCrypto)
val amountFiat = convertToFiatPrecision(amountState.amountToSendCrypto, isToken = isToken)
val totalFiat = convertToFiatPrecision(totalAmountCrypto, isToken = isToken)
ReceiptFiat(
amountFiat = amountFiat,
feeFiat = feeFiat,
totalFiat = totalFiat,
willSentCrypto = totalAmountCrypto.scaleToFiat().stripZeroPlainString(),
symbols = symbols,
)
}
}
private fun determineSymbols(
wallet: Wallet,
amountType: AmountType,
feePaidCurrency: FeePaidCurrency,
): ReceiptSymbols {
return ReceiptSymbols(
fiat = store.state.globalState.appCurrency.code,
crypto = wallet.blockchain.currency,
@ -178,17 +321,52 @@ class ReceiptReducer : SendInternalReducer {
is AmountType.Token -> amountType.token.symbol
else -> null
},
fee = when (feePaidCurrency) {
FeePaidCurrency.Coin -> wallet.blockchain.currency
FeePaidCurrency.SameCurrency -> store.state.sendState.currency?.symbol
is FeePaidCurrency.Token -> feePaidCurrency.token.symbol
},
)
}
private fun determineLayoutType(mainCurrencyType: MainCurrencyType, amountType: AmountType): ReceiptLayoutType {
private fun determineLayoutType(
mainCurrencyType: MainCurrencyType,
amountType: AmountType,
feePaidCurrency: FeePaidCurrency,
): ReceiptLayoutType {
return when (mainCurrencyType) {
MainCurrencyType.FIAT -> when (amountType) {
MainCurrencyType.FIAT -> determineFiatLayoutType(feePaidCurrency, amountType)
MainCurrencyType.CRYPTO -> determineCryptoLayoutType(feePaidCurrency, amountType)
}
}
private fun determineFiatLayoutType(feePaidCurrency: FeePaidCurrency, amountType: AmountType): ReceiptLayoutType {
return when (feePaidCurrency) {
is FeePaidCurrency.Token -> {
val amountToken = (amountType as? AmountType.Token)?.token
val sameToken =
feePaidCurrency.token.contractAddress.equals(amountToken?.contractAddress, ignoreCase = true)
if (sameToken) ReceiptLayoutType.SAME_CURRENCY_FIAT else ReceiptLayoutType.FEE_IN_CUSTOM_TOKEN_FIAT
}
FeePaidCurrency.Coin -> when (amountType) {
AmountType.Coin -> ReceiptLayoutType.FIAT
is AmountType.Token -> ReceiptLayoutType.TOKEN_FIAT
AmountType.Reserve -> ReceiptLayoutType.UNKNOWN
}
MainCurrencyType.CRYPTO -> when (amountType) {
FeePaidCurrency.SameCurrency -> ReceiptLayoutType.SAME_CURRENCY_FIAT
}
}
private fun determineCryptoLayoutType(feePaidCurrency: FeePaidCurrency, amountType: AmountType): ReceiptLayoutType {
return when (feePaidCurrency) {
is FeePaidCurrency.Token -> {
val amountToken = (amountType as? AmountType.Token)?.token
val sameToken =
feePaidCurrency.token.contractAddress.equals(amountToken?.contractAddress, ignoreCase = true)
if (sameToken) ReceiptLayoutType.SAME_CURRENCY else ReceiptLayoutType.FEE_IN_CUSTOM_TOKEN
}
FeePaidCurrency.SameCurrency -> ReceiptLayoutType.SAME_CURRENCY
FeePaidCurrency.Coin -> when (amountType) {
AmountType.Coin -> ReceiptLayoutType.CRYPTO
is AmountType.Token -> ReceiptLayoutType.TOKEN_CRYPTO
AmountType.Reserve -> ReceiptLayoutType.UNKNOWN

View file

@ -1,7 +1,6 @@
package com.tangem.tap.features.send.redux.reducers
import com.tangem.blockchain.common.AmountType
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.FeePaidCurrency
import com.tangem.tap.common.CurrencyConverter
import com.tangem.tap.common.entities.IndeterminateProgressButton
@ -91,29 +90,40 @@ private class PrepareSendScreenStatesReducer : SendInternalReducer {
val walletManager = action.walletManager
val amountToExtract = prepareAction.tokenAmount ?: prepareAction.coinAmount!!
val decimals = amountToExtract.decimals
val feePaidInNetworkCurrency = isFeePaidInNetworkCurrency(walletManager.wallet.blockchain)
val canIncludeFee = canIncludeFee(
typeOfAmount = amountToExtract.type,
feePaidCurrency = action.feePaidCurrency,
)
return sendState.copy(
walletManager = walletManager,
coinConverter = action.coinRate?.let { CurrencyConverter(it, decimals) },
tokenConverter = action.tokenRate?.let { CurrencyConverter(it, decimals) },
customFeeConverter = action.feeCurrencyRate?.let { CurrencyConverter(it, action.feeCurrencyDecimals) },
amountState = sendState.amountState.copy(
feePaidInCurrencyNetworkCurrency = feePaidInNetworkCurrency,
amountToExtract = amountToExtract,
typeOfAmount = amountToExtract.type,
balanceCrypto = amountToExtract.value ?: BigDecimal.ZERO,
),
feeState = sendState.feeState.copy(
includeFeeSwitcherIsEnabled = feePaidInNetworkCurrency || isCoinAmount(amountToExtract.type),
),
feeState = sendState.feeState.copy(includeFeeSwitcherIsEnabled = canIncludeFee),
canIncludeFee = canIncludeFee,
currency = action.currency,
)
}
private fun isFeePaidInNetworkCurrency(blockchain: Blockchain): Boolean =
// blockchain.tokenTransactionFeePaidInNetworkCurrency()
blockchain.feePaidCurrency() == FeePaidCurrency.SameCurrency // TODO [REDACTED_TASK_KEY]
private fun canIncludeFee(typeOfAmount: AmountType, feePaidCurrency: FeePaidCurrency): Boolean {
return when (feePaidCurrency) {
FeePaidCurrency.Coin -> typeOfAmount == AmountType.Coin
FeePaidCurrency.SameCurrency -> true
is FeePaidCurrency.Token -> {
val sendToken = (typeOfAmount as? AmountType.Token)?.token ?: return false
private fun isCoinAmount(typeOfAmount: AmountType): Boolean = typeOfAmount == AmountType.Coin
sendToken.contractAddress.equals(feePaidCurrency.token.contractAddress, ignoreCase = true) &&
sendToken.name.equals(feePaidCurrency.token.name, ignoreCase = true) &&
sendToken.symbol.equals(feePaidCurrency.token.symbol, ignoreCase = true)
}
}
}
}
internal fun updateLastState(sendState: SendState, lastChangedState: IdStateHolder): SendState {

View file

@ -2,7 +2,15 @@ package com.tangem.tap.features.send.redux.states
// Shows only one type of the layout
enum class ReceiptLayoutType {
UNKNOWN, FIAT, CRYPTO, TOKEN_FIAT, TOKEN_CRYPTO
UNKNOWN,
FIAT,
CRYPTO,
TOKEN_FIAT,
TOKEN_CRYPTO,
FEE_IN_CUSTOM_TOKEN,
FEE_IN_CUSTOM_TOKEN_FIAT,
SAME_CURRENCY,
SAME_CURRENCY_FIAT,
}
data class ReceiptState(
@ -11,6 +19,10 @@ data class ReceiptState(
val crypto: ReceiptCrypto? = null,
val tokenFiat: ReceiptTokenFiat? = null,
val tokenCrypto: ReceiptTokenCrypto? = null,
val customTokenFiat: ReceiptTokenFiat? = null,
val customTokenCrypto: ReceiptTokenCrypto? = null,
val sameCurrencyFiat: ReceiptFiat? = null,
val sameCurrencyCrypto: ReceiptCrypto? = null,
val mainCurrency: MainCurrency? = null,
) : SendScreenState {
override val stateId: StateId = StateId.RECEIPT
@ -20,6 +32,7 @@ data class ReceiptSymbols(
val fiat: String,
val crypto: String,
val token: String? = null,
val fee: String? = null,
)
data class ReceiptFiat(

View file

@ -6,6 +6,7 @@ import com.tangem.blockchain.common.WalletManager
import com.tangem.common.extensions.isZero
import com.tangem.core.navigation.StateDialog
import com.tangem.domain.appcurrency.model.AppCurrency
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.tap.common.CurrencyConverter
import com.tangem.tap.common.entities.IndeterminateProgressButton
import com.tangem.tap.common.text.DecimalDigitsInputFilter
@ -31,8 +32,10 @@ interface SendScreenState : StateType, IdStateHolder
data class SendState(
val walletManager: WalletManager? = null,
val currency: CryptoCurrency? = null,
val coinConverter: CurrencyConverter? = null,
val tokenConverter: CurrencyConverter? = null,
val customFeeConverter: CurrencyConverter? = null,
val lastChangedStates: LinkedHashSet<StateId> = linkedSetOf(),
val addressState: AddressState = AddressState(),
val transactionExtrasState: TransactionExtrasState = TransactionExtrasState(),
@ -44,6 +47,7 @@ data class SendState(
val dialog: StateDialog? = null,
val externalTransactionData: ExternalTransactionData? = null,
val isSuccessSend: Boolean = false,
val canIncludeFee: Boolean = false,
) : SendScreenState {
override val stateId: StateId = StateId.SEND_SCREEN
@ -99,6 +103,9 @@ data class SendState(
fun coinIsConvertible(): Boolean = coinConverter != null
fun tokenIsConvertible(): Boolean = tokenConverter != null
fun currencyIsConvertible(): Boolean = coinConverter != null || tokenConverter != null
fun feeIsConvertible(): Boolean = customFeeConverter != null
fun mainCurrencyCanBeSwitched(): Boolean {
return when (amountState.typeOfAmount) {
AmountType.Coin -> coinIsConvertible()
@ -137,16 +144,13 @@ data class AmountState(
val decimalSeparator: String = ".",
val error: TapError? = null,
val inputIsEnabled: Boolean = true,
private val feePaidInCurrencyNetworkCurrency: Boolean = false,
) : SendScreenState {
override val stateId: StateId = StateId.AMOUNT
fun isReady(): Boolean = error == null && !amountToSendCrypto.isZero()
private fun isCoinAmount(): Boolean = typeOfAmount == AmountType.Coin
fun canIncludeFee(): Boolean = isCoinAmount() || feePaidInCurrencyNetworkCurrency
fun canIncludeFee(): Boolean = store.state.sendState.canIncludeFee
fun createMainCurrency(type: MainCurrencyType, canSwitched: Boolean): MainCurrency {
return if (!canSwitched) {

View file

@ -306,7 +306,7 @@ internal class SendStateSubscriber(
}
@Suppress("LongMethod", "ComplexMethod")
private fun handleReceiptState(fg: SendFragment, state: ReceiptState, feeProgressState: ProgressState) =
private fun handleReceiptState(fg: SendFragment, state: ReceiptState, feeProgressState: ProgressState) {
with(fg.binding.clReceiptContainer) {
val mainLayout = clReceiptContainer as ViewGroup
val totalLayout = llTotalContainer.llTotal as ViewGroup
@ -410,9 +410,96 @@ internal class SendStateSubscriber(
}
llTotalContainer.tvTotalTokenCryptoValue.update(willSent.toString())
}
else -> {}
ReceiptLayoutType.FEE_IN_CUSTOM_TOKEN -> {
val receipt = state.customTokenCrypto ?: return
totalLayout.show(false)
totalTokenLayout.show(true)
tvReceiptAmountValue.update(
"${receipt.amountToken} ${receipt.symbols.token ?: receipt.symbols.crypto}",
)
tvReceiptFeeValue.update("${receipt.feeCoin} ${receipt.symbols.fee}")
val willSent = SpannableStringBuilder()
.bold {
append(roughOrEmpty(receipt.totalFiat)).append(" ")
append(receipt.symbols.fiat)
}
llTotalContainer.tvTotalTokenCryptoValue.update(willSent.toString())
}
ReceiptLayoutType.FEE_IN_CUSTOM_TOKEN_FIAT -> {
val receipt = state.customTokenFiat ?: return
totalLayout.show(true)
totalTokenLayout.show(false)
tvReceiptAmountValue.update("${receipt.amountFiat} ${receipt.symbols.fiat}")
tvReceiptFeeValue.update("${receipt.feeFiat} ${receipt.symbols.fiat}")
llTotalContainer.tvTotalValue.post {
llTotalContainer.tvTotalValue.update(
"${roughOrEmpty(receipt.totalFiat)} ${receipt.symbols.fiat}",
)
}
val willSent = getString(
R.string.send_total_subtitle_asset_format,
"${receipt.symbols.token ?: receipt.symbols.crypto} ${receipt.willSentToken}",
"${receipt.symbols.fee} ${receipt.willSentFeeCoin}",
)
llTotalContainer.tvWillBeSentValue.update(willSent)
}
ReceiptLayoutType.SAME_CURRENCY -> {
val receipt = state.sameCurrencyCrypto ?: return
totalLayout.show(true)
totalTokenLayout.show(false)
tvReceiptAmountValue.update(
"${receipt.amountCrypto} ${receipt.symbols.token ?: receipt.symbols.crypto}",
)
tvReceiptFeeValue.update("${receipt.feeCrypto} ${receipt.symbols.token ?: receipt.symbols.crypto}")
llTotalContainer.tvTotalValue.post {
llTotalContainer.tvTotalValue.update(
"${receipt.totalCrypto} ${receipt.symbols.token ?: receipt.symbols.crypto}",
)
}
if (receipt.willSentFiat == BigDecimalFormatter.EMPTY_BALANCE_SIGN) {
llTotalContainer.tvWillBeSentValue.hide()
} else {
llTotalContainer.tvWillBeSentValue.show()
llTotalContainer.tvWillBeSentValue.update(
getString(
R.string.send_total_subtitle_fiat_format,
"${receipt.willSentFiat} ${receipt.symbols.fiat}",
"${receipt.feeFiat} ${receipt.symbols.fiat}",
),
)
}
}
ReceiptLayoutType.SAME_CURRENCY_FIAT -> {
val receipt = state.sameCurrencyFiat ?: return
totalLayout.show(true)
totalTokenLayout.show(false)
tvReceiptAmountValue.update("${receipt.amountFiat} ${receipt.symbols.fiat}")
tvReceiptFeeValue.update("${receipt.feeFiat} ${receipt.symbols.fiat}")
llTotalContainer.tvTotalValue.post {
llTotalContainer.tvTotalValue.update(
"${roughOrEmpty(receipt.totalFiat)} ${receipt.symbols.fiat}",
)
}
val willSent = getString(
R.string.send_total_subtitle_format,
"${receipt.willSentCrypto} ${receipt.symbols.token ?: receipt.symbols.crypto}",
)
llTotalContainer.tvWillBeSentValue.update(willSent)
}
ReceiptLayoutType.UNKNOWN, null -> {}
}
}
}
private companion object {
const val ROUGH_SIGN = ""

View file

@ -210,10 +210,14 @@ object TradeCryptoMiddleware {
store.dispatchOnMain(
action = PrepareSendScreen(
walletManager = walletManager,
feePaidCurrency = walletManager.wallet.blockchain.feePaidCurrency(),
currency = currency,
coinAmount = walletManager.wallet.amounts[AmountType.Coin],
coinRate = action.coinFiatRate,
tokenAmount = sendableAmount,
tokenRate = action.tokenFiatRate,
feeCurrencyRate = action.feeCurrencyStatus?.value?.fiatRate,
feeCurrencyDecimals = action.feeCurrencyStatus?.currency?.decimals ?: 0,
),
)
@ -262,8 +266,12 @@ object TradeCryptoMiddleware {
store.dispatchOnMain(
action = PrepareSendScreen(
walletManager = walletManager,
feePaidCurrency = walletManager.wallet.blockchain.feePaidCurrency(),
currency = currency,
coinAmount = amountToSend,
coinRate = cryptoStatus.value.fiatRate,
feeCurrencyRate = action.feeCurrencyStatus?.value?.fiatRate,
feeCurrencyDecimals = action.feeCurrencyStatus?.currency?.decimals ?: 0,
),
)
}