Updated on 2026-08-14
This commit is contained in:
parent
097b9ec463
commit
82e3fc2451
17 changed files with 64 additions and 88 deletions
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
<SmellBaseline>
|
||||
<ManuallySuppressedIssues/>
|
||||
<CurrentIssues>
|
||||
<ID>CouldBeSequence:GetSwapPairsUseCase.kt$GetSwapPairsUseCase$filter { pair -> filteringCurrency(pair).currency.id.rawCurrencyId == initialCurrency.id.rawCurrencyId }</ID>
|
||||
<ID>CouldBeSequence:GetSwapSupportedPairsUseCase.kt$GetSwapSupportedPairsUseCase$filter { pair -> filteringCurrency(pair).currency.id.rawCurrencyId == initialCurrency.id.rawCurrencyId }</ID>
|
||||
</CurrentIssues>
|
||||
</SmellBaseline>
|
||||
|
|
@ -63,14 +63,18 @@ class GetSwapPairsUseCase(
|
|||
groupingCurrency: (SwapPairModel) -> CryptoCurrencyStatus,
|
||||
cryptoCurrencyStatusList: List<CryptoCurrencyStatus>,
|
||||
): SwapCurrenciesGroup {
|
||||
val availableCryptoCurrencies = filter { pair ->
|
||||
filteringCurrency(pair).currency.id.rawCurrencyId == initialCurrency.id.rawCurrencyId
|
||||
}.filter { pair ->
|
||||
// Search available to swap currency
|
||||
cryptoCurrencyStatusList.any { currencyStatus ->
|
||||
currencyStatus.currency.id == pair.to.currency.id
|
||||
val availableCryptoCurrencies = asSequence()
|
||||
.filter { pair ->
|
||||
filteringCurrency(pair).currency.id.rawCurrencyId == initialCurrency.id.rawCurrencyId
|
||||
}
|
||||
}.map { pair -> SwapCryptoCurrency(groupingCurrency(pair), pair.providers) }
|
||||
.filter { pair ->
|
||||
// Search available to swap currency
|
||||
cryptoCurrencyStatusList.any { currencyStatus ->
|
||||
currencyStatus.currency.id == pair.to.currency.id
|
||||
}
|
||||
}
|
||||
.map { pair -> SwapCryptoCurrency(groupingCurrency(pair), pair.providers) }
|
||||
.toList()
|
||||
|
||||
val unavailableCryptoCurrencies =
|
||||
cryptoCurrencyStatusList - availableCryptoCurrencies.map { it.currencyStatus }.toSet()
|
||||
|
|
|
|||
|
|
@ -59,16 +59,20 @@ class GetSwapSupportedPairsUseCase(
|
|||
groupingCurrency: (SwapPairModel) -> CryptoCurrencyStatus,
|
||||
cryptoCurrencyList: List<CryptoCurrency>,
|
||||
): SwapCurrenciesGroup {
|
||||
val availableCryptoCurrencies = filter { pair ->
|
||||
filteringCurrency(pair).currency.id.rawCurrencyId == initialCurrency.id.rawCurrencyId
|
||||
}.filter { pair ->
|
||||
// Search available to swap currency
|
||||
cryptoCurrencyList.any { currencyStatus ->
|
||||
// Allowed only on networks without tx extras (e.i. memo and destination tag)
|
||||
val isExtrasSupported = currencyStatus.network.transactionExtrasType.isTxExtrasSupported()
|
||||
currencyStatus.id == pair.to.currency.id && !isExtrasSupported
|
||||
val availableCryptoCurrencies = asSequence()
|
||||
.filter { pair ->
|
||||
filteringCurrency(pair).currency.id.rawCurrencyId == initialCurrency.id.rawCurrencyId
|
||||
}
|
||||
}.map { pair -> SwapCryptoCurrency(groupingCurrency(pair), pair.providers) }
|
||||
.filter { pair ->
|
||||
// Search available to swap currency
|
||||
cryptoCurrencyList.any { currencyStatus ->
|
||||
// Allowed only on networks without tx extras (e.i. memo and destination tag)
|
||||
val isExtrasSupported = currencyStatus.network.transactionExtrasType.isTxExtrasSupported()
|
||||
currencyStatus.id == pair.to.currency.id && !isExtrasSupported
|
||||
}
|
||||
}
|
||||
.map { pair -> SwapCryptoCurrency(groupingCurrency(pair), pair.providers) }
|
||||
.toList()
|
||||
|
||||
val unavailableCryptoCurrencies =
|
||||
cryptoCurrencyList - availableCryptoCurrencies.map { it.currencyStatus.currency }.toSet()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue