Updated on 2026-08-14

This commit is contained in:
Tangem 2024-05-29 17:16:59 +03:00
parent 8889ad4c31
commit d2518865d1
39 changed files with 414 additions and 57 deletions

View file

@ -330,6 +330,7 @@ class ReceiptReducer : SendInternalReducer {
FeePaidCurrency.Coin -> wallet.blockchain.currency
FeePaidCurrency.SameCurrency -> store.state.sendState.currency?.symbol
is FeePaidCurrency.Token -> feePaidCurrency.token.symbol
is FeePaidCurrency.FeeResource -> feePaidCurrency.currency
},
)
}
@ -356,9 +357,12 @@ class ReceiptReducer : SendInternalReducer {
FeePaidCurrency.Coin -> when (amountType) {
AmountType.Coin -> ReceiptLayoutType.FIAT
is AmountType.Token -> ReceiptLayoutType.TOKEN_FIAT
AmountType.Reserve -> ReceiptLayoutType.UNKNOWN
is AmountType.FeeResource,
AmountType.Reserve,
-> ReceiptLayoutType.UNKNOWN
}
FeePaidCurrency.SameCurrency -> ReceiptLayoutType.SAME_CURRENCY_FIAT
is FeePaidCurrency.FeeResource -> ReceiptLayoutType.SAME_CURRENCY
}
}
@ -374,8 +378,11 @@ class ReceiptReducer : SendInternalReducer {
FeePaidCurrency.Coin -> when (amountType) {
AmountType.Coin -> ReceiptLayoutType.CRYPTO
is AmountType.Token -> ReceiptLayoutType.TOKEN_CRYPTO
AmountType.Reserve -> ReceiptLayoutType.UNKNOWN
is AmountType.FeeResource,
AmountType.Reserve,
-> ReceiptLayoutType.UNKNOWN
}
is FeePaidCurrency.FeeResource -> ReceiptLayoutType.UNKNOWN
}
}

View file

@ -122,6 +122,7 @@ private class PrepareSendScreenStatesReducer : SendInternalReducer {
sendToken.name.equals(feePaidCurrency.token.name, ignoreCase = true) &&
sendToken.symbol.equals(feePaidCurrency.token.symbol, ignoreCase = true)
}
is FeePaidCurrency.FeeResource -> false
}
}
}

View file

@ -82,14 +82,18 @@ data class SendState(
fun convertFiatToExtractCrypto(fiatValue: BigDecimal): BigDecimal = when (amountState.typeOfAmount) {
AmountType.Coin -> convertFiatToCoin(fiatValue)
is AmountType.Token -> convertFiatToToken(fiatValue)
AmountType.Reserve -> fiatValue
is AmountType.FeeResource,
AmountType.Reserve,
-> fiatValue
}
fun convertExtractCryptoToFiat(cryptoValue: BigDecimal, scaleWithPrecision: Boolean = false): BigDecimal {
return when (amountState.typeOfAmount) {
AmountType.Coin -> convertCoinToFiat(cryptoValue, scaleWithPrecision)
is AmountType.Token -> convertTokenToFiat(cryptoValue, scaleWithPrecision)
AmountType.Reserve -> cryptoValue
is AmountType.FeeResource,
AmountType.Reserve,
-> cryptoValue
}
}
@ -108,7 +112,9 @@ data class SendState(
return when (amountState.typeOfAmount) {
AmountType.Coin -> coinIsConvertible()
is AmountType.Token -> tokenIsConvertible()
AmountType.Reserve -> false
is AmountType.FeeResource,
AmountType.Reserve,
-> false
}
}