Updated on 2026-08-14

This commit is contained in:
Tangem 2023-05-30 14:44:10 +03:00
parent c9917f1c05
commit 5e4d8a9113
4 changed files with 15 additions and 7 deletions

View file

@ -89,9 +89,9 @@ class DemoTransactionSender(private val walletManager: WalletManager) : Transact
val blockchain = walletManager.wallet.blockchain
return Result.Success(
TransactionFee.Choosable(
minimum = Amount(0.0001.toBigDecimal(), blockchain),
normal = Amount(0.0002.toBigDecimal(), blockchain),
priority = Amount(0.0003.toBigDecimal(), blockchain)
minimum = Amount(minimumFee, blockchain),
normal = Amount(normalFee, blockchain),
priority = Amount(priorityFee, blockchain)
)
)
}
@ -121,5 +121,9 @@ class DemoTransactionSender(private val walletManager: WalletManager) : Transact
companion object {
val ID = DemoTransactionSender::class.java.simpleName
private val minimumFee = 0.0001.toBigDecimal()
private val normalFee = 0.0002.toBigDecimal()
private val priorityFee = 0.0003.toBigDecimal()
}
}

View file

@ -214,7 +214,8 @@ class GnosisRegistrator(
Result.Failure(BlockchainSdkError.FailedToLoadFee)
}
is TransactionFee.Choosable -> {
Result.Success((data as TransactionFee.Choosable).normal)
val normalFee = (data as TransactionFee.Choosable).normal
Result.Success(normalFee)
}
}
}

View file

@ -41,6 +41,7 @@ class FeeReducer : SendInternalReducer {
}
private fun handleAction(action: FeeAction, sendState: SendState, state: FeeState): SendState {
val result = when (action) {
is FeeAction.RequestFee -> {
state.copy(progressState = ProgressState.Loading)
@ -54,8 +55,7 @@ class FeeReducer : SendInternalReducer {
)
}
is FeeAction.FeeCalculation.SetFeeResult -> {
val fees = action.fee
when (fees) {
when (val fees = action.fee) {
is TransactionFee.Single -> {
val feeType = FeeType.SINGLE
val currentFee = createValueOfFeeAmount(feeType, fees)
@ -120,4 +120,6 @@ class FeeReducer : SendInternalReducer {
private fun getCurrentFeeType(state: FeeState): FeeType {
return if (state.selectedFeeType == FeeType.SINGLE) FeeType.NORMAL else state.selectedFeeType
}
}

View file

@ -200,9 +200,10 @@ class TransactionManagerImpl(
// for not EVM blockchains set gasLimit ZERO for now
when (fee.data) {
is TransactionFee.Single -> {
val amount = (fee.data as TransactionFee.Single).value
val singleFee = ProxyFee(
gasLimit = BigInteger.ZERO,
fee = convertToProxyAmount(amount = (fee.data as TransactionFee.Single).value),
fee = convertToProxyAmount(amount = amount),
)
ProxyFees(
minFee = singleFee,