Updated on 2026-08-14
This commit is contained in:
parent
d54f8452b6
commit
c1935b5938
9 changed files with 24 additions and 29 deletions
|
|
@ -183,7 +183,7 @@ class WalletConnectSdkHelper {
|
|||
val dataToSign = EthereumUtils.buildTransactionToSign(
|
||||
transactionData = data.transaction,
|
||||
nonce = null,
|
||||
blockchain = data.walletManager.wallet.blockchain
|
||||
blockchain = data.walletManager.wallet.blockchain,
|
||||
) ?: return null
|
||||
|
||||
val command = SignHashCommand(
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ class DemoTransactionSender(private val walletManager: WalletManager) : Transact
|
|||
TransactionFee.Choosable(
|
||||
minimum = Fee.Common(Amount(minimumFee, blockchain)),
|
||||
normal = Fee.Common(Amount(normalFee, blockchain)),
|
||||
priority = Fee.Common(Amount(priorityFee, blockchain))
|
||||
)
|
||||
priority = Fee.Common(Amount(priorityFee, blockchain)),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class RequestFeeMiddleware {
|
|||
val result = feeResult.data
|
||||
// val result = FeeMock.getFee(walletManager.wallet.blockchain)
|
||||
dispatch(FeeAction.FeeCalculation.SetFeeResult(result))
|
||||
when(result) {
|
||||
when (result) {
|
||||
is TransactionFee.Single -> {
|
||||
val fee = result.normal.amount.value ?: BigDecimal.ZERO
|
||||
if (fee.isZero()) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.tangem.tap.features.send.redux.reducers
|
||||
|
||||
import com.tangem.blockchain.common.Amount
|
||||
import com.tangem.blockchain.common.transaction.Fee
|
||||
import com.tangem.blockchain.common.transaction.TransactionFee
|
||||
import com.tangem.tap.features.send.redux.FeeAction
|
||||
|
|
@ -9,7 +8,6 @@ import com.tangem.tap.features.send.redux.SendScreenAction
|
|||
import com.tangem.tap.features.send.redux.states.FeeState
|
||||
import com.tangem.tap.features.send.redux.states.FeeType
|
||||
import com.tangem.tap.features.send.redux.states.SendState
|
||||
import com.tangem.tap.features.send.redux.states.TransactionExtrasState
|
||||
import com.tangem.tap.features.wallet.redux.ProgressState
|
||||
|
||||
/**
|
||||
|
|
@ -34,7 +32,7 @@ class FeeReducer : SendInternalReducer {
|
|||
}
|
||||
state.copy(
|
||||
selectedFeeType = action.feeType,
|
||||
currentFee = currentFee
|
||||
currentFee = currentFee,
|
||||
)
|
||||
}
|
||||
is FeeActionUi.ChangeIncludeFee -> state.copy(feeIsIncluded = action.isIncluded)
|
||||
|
|
@ -43,7 +41,6 @@ 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)
|
||||
|
|
@ -122,6 +119,4 @@ class FeeReducer : SendInternalReducer {
|
|||
private fun getCurrentFeeType(state: FeeState): FeeType {
|
||||
return if (state.selectedFeeType == FeeType.SINGLE) FeeType.NORMAL else state.selectedFeeType
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
package com.tangem.tap.features.send.redux.states
|
||||
|
||||
import com.tangem.blockchain.common.Amount
|
||||
import com.tangem.blockchain.common.transaction.Fee
|
||||
import com.tangem.blockchain.common.transaction.TransactionFee
|
||||
import com.tangem.tap.common.analytics.events.AnalyticsParam
|
||||
|
|
|
|||
|
|
@ -7,6 +7,14 @@ import com.tangem.wallet.R
|
|||
|
||||
object MultipleAddressUiHelper {
|
||||
|
||||
private val blockchainsSupportingSplit = listOf(
|
||||
Blockchain.Bitcoin,
|
||||
Blockchain.BitcoinTestnet,
|
||||
Blockchain.Litecoin,
|
||||
Blockchain.BitcoinCash,
|
||||
Blockchain.CardanoShelley,
|
||||
)
|
||||
|
||||
fun typeToId(type: AddressType, blockchain: Blockchain): Int {
|
||||
return if (blockchain in blockchainsSupportingSplit) {
|
||||
if (type == AddressType.Legacy) {
|
||||
|
|
@ -22,7 +30,7 @@ object MultipleAddressUiHelper {
|
|||
fun idToType(id: Int, blockchain: Blockchain): AddressType? {
|
||||
return when (blockchain) {
|
||||
in blockchainsSupportingSplit -> {
|
||||
when(id) {
|
||||
when (id) {
|
||||
R.id.chip_default -> AddressType.Default
|
||||
R.id.chip_legacy -> AddressType.Legacy
|
||||
else -> null
|
||||
|
|
@ -31,13 +39,4 @@ object MultipleAddressUiHelper {
|
|||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
private val blockchainsSupportingSplit = listOf(
|
||||
Blockchain.Bitcoin,
|
||||
Blockchain.BitcoinTestnet,
|
||||
Blockchain.Litecoin,
|
||||
Blockchain.BitcoinCash,
|
||||
Blockchain.CardanoShelley
|
||||
)
|
||||
|
||||
}
|
||||
|
|
@ -190,7 +190,10 @@ class SingleWalletView : WalletView() {
|
|||
(binding.lAddress.root as? ViewGroup)?.beginDelayedTransition()
|
||||
chipGroupAddressType.show()
|
||||
chipGroupAddressType.fitChipsByGroupWidth()
|
||||
val checkedId = MultipleAddressUiHelper.typeToId(primaryWallet.walletAddresses.selectedAddress.type, primaryWallet.currency.blockchain)
|
||||
val checkedId = MultipleAddressUiHelper.typeToId(
|
||||
primaryWallet.walletAddresses.selectedAddress.type,
|
||||
primaryWallet.currency.blockchain,
|
||||
)
|
||||
if (checkedId != View.NO_ID) chipGroupAddressType.check(checkedId)
|
||||
|
||||
chipGroupAddressType.setOnCheckedChangeListener { group, checkedId ->
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ suspend fun CurrencyExchangeManager.buyErc20TestnetTokens(
|
|||
val destinationAddress = token.contractAddress
|
||||
|
||||
val feeResult = walletManager.getFee(
|
||||
amountToSend,
|
||||
destinationAddress,
|
||||
) as? Result.Success ?: return
|
||||
amountToSend,
|
||||
destinationAddress,
|
||||
) as? Result.Success ?: return
|
||||
val fee = feeResult.data.minimum
|
||||
|
||||
val coinValue = walletManager.wallet.amounts[AmountType.Coin]?.value ?: BigDecimal.ZERO
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ class TransactionManagerImpl(
|
|||
ProxyFees(
|
||||
minFee = singleFee,
|
||||
normalFee = singleFee,
|
||||
priorityFee = singleFee
|
||||
priorityFee = singleFee,
|
||||
)
|
||||
}
|
||||
is TransactionFee.Choosable -> {
|
||||
|
|
@ -243,11 +243,10 @@ class TransactionManagerImpl(
|
|||
priorityFee = ProxyFee(
|
||||
gasLimit = BigInteger.ZERO,
|
||||
fee = convertToProxyAmount(amount = choosableFee.priority.amount),
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
is Result.Failure -> {
|
||||
error(fee.error.message ?: fee.error.customMessage)
|
||||
|
|
@ -310,7 +309,7 @@ class TransactionManagerImpl(
|
|||
gasLimit = (choosableFee.priority as Fee.Ethereum).gasLimit,
|
||||
fee = convertToProxyAmount(amount = choosableFee.priority.amount),
|
||||
)
|
||||
|
||||
|
||||
ProxyFees(
|
||||
minFee = minProxyFee,
|
||||
normalFee = normalProxyFee,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue