Updated on 2026-08-14
This commit is contained in:
parent
77a2899ac5
commit
404bcc011a
4 changed files with 10 additions and 5 deletions
|
|
@ -12,4 +12,7 @@ fun BigDecimal.isZero(): Boolean = this.compareTo(BigDecimal.ZERO) == 0
|
|||
fun BigDecimal.isPositive(): Boolean = this.signum() == 1
|
||||
|
||||
/** Removes trailing zeros and returns plain [String] */
|
||||
fun BigDecimal.stripZeroPlainString(): String = this.stripTrailingZeros().toPlainString()
|
||||
fun BigDecimal.stripZeroPlainString(): String = this.stripTrailingZeros().toPlainString()
|
||||
|
||||
/** Compares two [BigDecimal] numbers */
|
||||
infix fun BigDecimal.isEqualTo(other: BigDecimal): Boolean = this.compareTo(other) == 0
|
||||
|
|
@ -13,6 +13,7 @@ dependencies {
|
|||
api(projects.domain.staking.models)
|
||||
api(projects.domain.core)
|
||||
api(projects.core.analytics)
|
||||
api(projects.core.utils)
|
||||
|
||||
implementation(deps.kotlin.serialization)
|
||||
implementation(deps.jodatime)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.tangem.domain.staking.model.stakekit.StakingError
|
|||
import com.tangem.domain.staking.model.stakekit.action.StakingAction
|
||||
import com.tangem.domain.staking.model.stakekit.action.StakingActionType
|
||||
import com.tangem.domain.staking.repositories.StakingErrorResolver
|
||||
import com.tangem.utils.extensions.isEqualTo
|
||||
import java.util.UUID
|
||||
|
||||
class InvalidatePendingTransactionsUseCase(
|
||||
|
|
@ -75,7 +76,7 @@ class InvalidatePendingTransactionsUseCase(
|
|||
|
||||
private fun modifyBalancesByStatus(balances: MutableList<BalanceItem>, action: StakingAction, type: BalanceType) {
|
||||
val index = balances.indexOfFirst {
|
||||
!it.isPending && it.amount == action.amount && it.type == type
|
||||
!it.isPending && it.amount isEqualTo action.amount && it.type == type
|
||||
}
|
||||
|
||||
if (index != -1) {
|
||||
|
|
|
|||
|
|
@ -59,9 +59,6 @@ internal class StakingBalanceUpdater @AssistedInject constructor(
|
|||
suspend fun partialUpdate() {
|
||||
coroutineScope {
|
||||
listOf(
|
||||
async {
|
||||
updateStakeBalance()
|
||||
},
|
||||
async {
|
||||
updateNetworkStatuses(delay = 0)
|
||||
},
|
||||
|
|
@ -78,6 +75,9 @@ internal class StakingBalanceUpdater @AssistedInject constructor(
|
|||
async {
|
||||
updateStakeBalance()
|
||||
},
|
||||
async {
|
||||
updateProcessingActions()
|
||||
},
|
||||
).awaitAll()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue