Updated on 2026-08-14

This commit is contained in:
Tangem 2026-04-16 14:05:53 +01:00
parent ae09293604
commit 0f700c4071
3 changed files with 2266 additions and 7 deletions

View file

@ -10,6 +10,10 @@ android {
namespace = "com.tangem.features.staking.impl"
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
dependencies {
/** AndroidX */
implementation(deps.androidx.fragment.ktx)
@ -88,4 +92,11 @@ dependencies {
/** DI */
implementation(deps.hilt.android)
kapt(deps.hilt.kapt)
/** Test */
testImplementation(deps.test.junit5)
testRuntimeOnly(deps.test.junit5.engine)
testImplementation(deps.test.mockk)
testImplementation(deps.test.truth)
testImplementation(deps.test.coroutine)
}

View file

@ -453,10 +453,9 @@ internal class StakingModel @Inject constructor(
stakingAnalyticSender.sendTransactionStakingClickedAnalytics(value)
stateController.update(SetConfirmationStateInProgressTransformer())
if (integration is P2PEthPoolIntegration) {
checkFeeAndSendP2PTransaction()
} else {
sendTransaction()
when (integration) {
is P2PEthPoolIntegration -> checkFeeAndSendP2PTransaction()
is StakeKitIntegration -> sendTransaction()
}
}.saveIn(sendTransactionJobHolder)
}
@ -952,7 +951,7 @@ internal class StakingModel @Inject constructor(
reduceAmountByDiff: BigDecimal,
notification: Class<out NotificationUM>,
) {
AmountReduceByStateTransformer(
val transformer = AmountReduceByStateTransformer(
cryptoCurrencyStatus = cryptoCurrencyStatus,
minimumTransactionAmount = minimumTransactionAmount,
value = ReduceByData(
@ -960,6 +959,7 @@ internal class StakingModel @Inject constructor(
reduceAmountByDiff = reduceAmountByDiff,
),
)
stateController.update(transformer)
onNotificationCancel(notification)
}
@ -1057,8 +1057,9 @@ internal class StakingModel @Inject constructor(
modelScope.launch {
val network = cryptoCurrencyStatus.currency.network
val metaInfo =
getWalletMetaInfoUseCase(userWallet.walletId).getOrElse { error("CardInfo must be not null") }
val metaInfo = getWalletMetaInfoUseCase(userWalletId = userWallet.walletId).getOrElse {
error("CardInfo must be not null")
}
val amountState = uiState.value.amountState as? AmountState.Data
val confirmationState = uiState.value.confirmationState as? StakingStates.ConfirmationState.Data
val validatorState = uiState.value.validatorState as? StakingStates.ValidatorState.Data