Updated on 2026-08-14
This commit is contained in:
parent
e7f862423d
commit
4cfea7fd9a
9 changed files with 67 additions and 1 deletions
|
|
@ -9,4 +9,10 @@ sealed class GetFeeError {
|
|||
data object KaspaZeroUtxo : BlockchainErrors()
|
||||
data object SuiOneCoinRequired : BlockchainErrors()
|
||||
}
|
||||
|
||||
sealed class GaslessError : GetFeeError() {
|
||||
data object NetworkIsNotSupported : GaslessError()
|
||||
data object NoSupportedTokensFound : GaslessError()
|
||||
data object NotEnoughFunds : GaslessError()
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.tangem.domain.transaction.usecase.gasless
|
||||
|
||||
import arrow.core.Either
|
||||
import arrow.core.left
|
||||
import com.tangem.domain.models.currency.CryptoCurrencyStatus
|
||||
import com.tangem.domain.models.network.Network
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.transaction.error.GetFeeError
|
||||
|
||||
class GetAvailableFeeTokensUseCase {
|
||||
|
||||
operator fun invoke(userWalletId: UserWalletId, network: Network): Either<GetFeeError, List<CryptoCurrencyStatus>> {
|
||||
return GetFeeError.UnknownError.left()
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.tangem.domain.transaction.usecase.gasless
|
||||
|
||||
import arrow.core.Either
|
||||
import arrow.core.left
|
||||
import com.tangem.blockchain.common.TransactionData
|
||||
import com.tangem.blockchain.common.transaction.TransactionFee
|
||||
import com.tangem.domain.models.network.Network
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.transaction.error.GetFeeError
|
||||
import com.tangem.domain.transaction.error.GetFeeError.GaslessError
|
||||
|
||||
class GetFeeForGaslessUseCase {
|
||||
|
||||
operator fun invoke(
|
||||
userWalletId: UserWalletId,
|
||||
network: Network,
|
||||
transactionData: TransactionData,
|
||||
): Either<GetFeeError, TransactionFee> {
|
||||
return GaslessError.NetworkIsNotSupported.left()
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.tangem.domain.transaction.usecase.gasless
|
||||
|
||||
import arrow.core.Either
|
||||
import arrow.core.left
|
||||
import com.tangem.blockchain.common.TransactionData
|
||||
import com.tangem.blockchain.common.transaction.TransactionFee
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.transaction.error.GetFeeError
|
||||
|
||||
class GetFeeForTokenUseCase {
|
||||
|
||||
operator fun invoke(token: CryptoCurrency, transactionData: TransactionData): Either<GetFeeError, TransactionFee> {
|
||||
return GetFeeError.UnknownError.left()
|
||||
}
|
||||
}
|
||||
|
|
@ -41,6 +41,7 @@ fun Fee.increaseGasLimitBy(percent: BigInteger): Fee {
|
|||
value = increasedGasLimit.toBigDecimal().multiply(increasedGasPrice).movePointLeft(this.amount.decimals),
|
||||
)
|
||||
return when (this) {
|
||||
is Fee.Ethereum.TokenCurrency -> error("handle in [REDACTED_TASK_KEY]")
|
||||
is Fee.Ethereum.EIP1559 -> copy(amount = increasedAmount, gasLimit = increasedGasLimit)
|
||||
is Fee.Ethereum.Legacy -> copy(amount = increasedAmount, gasLimit = increasedGasLimit)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ internal class EthereumCustomFeeConverter(
|
|||
|
||||
addAll(
|
||||
when (value) {
|
||||
is Fee.Ethereum.TokenCurrency -> error("handle in [REDACTED_TASK_KEY]")
|
||||
is Fee.Ethereum.EIP1559 -> eipFeeConverter.convert(value)
|
||||
is Fee.Ethereum.Legacy -> legacyFeeConverter.convert(value)
|
||||
},
|
||||
|
|
@ -55,6 +56,7 @@ internal class EthereumCustomFeeConverter(
|
|||
|
||||
override fun convertBack(normalFee: Fee.Ethereum, value: ImmutableList<CustomFeeFieldUM>): Fee.Ethereum {
|
||||
return when (normalFee) {
|
||||
is Fee.Ethereum.TokenCurrency -> error("handle in [REDACTED_TASK_KEY]")
|
||||
is Fee.Ethereum.EIP1559 -> eipFeeConverter.convertBack(normalFee = normalFee, value = value)
|
||||
is Fee.Ethereum.Legacy -> legacyFeeConverter.convertBack(normalFee = normalFee, value = value)
|
||||
}
|
||||
|
|
@ -62,6 +64,7 @@ internal class EthereumCustomFeeConverter(
|
|||
|
||||
override fun getGasLimitIndex(feeValue: Fee.Ethereum): Int {
|
||||
return when (feeValue) {
|
||||
is Fee.Ethereum.TokenCurrency -> error("handle in [REDACTED_TASK_KEY]")
|
||||
is Fee.Ethereum.EIP1559 -> eipFeeConverter.getGasLimitIndex(feeValue)
|
||||
is Fee.Ethereum.Legacy -> legacyFeeConverter.getGasLimitIndex(feeValue)
|
||||
}
|
||||
|
|
@ -74,6 +77,7 @@ internal class EthereumCustomFeeConverter(
|
|||
value: String,
|
||||
): ImmutableList<CustomFeeFieldUM> {
|
||||
return when (feeValue) {
|
||||
is Fee.Ethereum.TokenCurrency -> error("handle in [REDACTED_TASK_KEY]")
|
||||
is Fee.Ethereum.EIP1559 -> eipFeeConverter.onValueChange(
|
||||
feeValue = feeValue,
|
||||
customValues = customValues,
|
||||
|
|
|
|||
|
|
@ -2088,6 +2088,7 @@ internal class SwapInteractorImpl @AssistedInject constructor(
|
|||
|
||||
private fun Fee.increaseEthGasLimitInNeeded(increaseBy: Int): Fee {
|
||||
return when (this) {
|
||||
is Fee.Ethereum.TokenCurrency -> error("handle in [REDACTED_TASK_KEY]")
|
||||
is Fee.Ethereum.EIP1559,
|
||||
is Fee.Ethereum.Legacy,
|
||||
-> this.increaseGasLimitBy(increaseBy)
|
||||
|
|
@ -2123,6 +2124,7 @@ internal class SwapInteractorImpl @AssistedInject constructor(
|
|||
return when (this) {
|
||||
is Fee.Ethereum.EIP1559 -> copy(amount = increasedAmount, gasLimit = increasedGasLimit)
|
||||
is Fee.Ethereum.Legacy -> copy(amount = increasedAmount, gasLimit = increasedGasLimit)
|
||||
is Fee.Ethereum.TokenCurrency -> error("handle in [REDACTED_TASK_KEY]")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
# https://github.com/tangem/tangem-sdk-android/
|
||||
# https://github.com/tangem/vico
|
||||
|
||||
tangemBlockchainSdk = "develop-1330"
|
||||
tangemBlockchainSdk = "develop-1338"
|
||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||
tangemCardSdk = "develop-573"
|
||||
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ object BlockchainFeeUtils {
|
|||
|
||||
private fun Fee.increaseEthGasLimitInNeeded(increaseBy: Int): Fee {
|
||||
return when (this) {
|
||||
is Fee.Ethereum.TokenCurrency -> error("handle in [REDACTED_TASK_KEY]")
|
||||
is Fee.Ethereum.EIP1559,
|
||||
is Fee.Ethereum.Legacy,
|
||||
-> this.increaseGasLimitBy(increaseBy)
|
||||
|
|
@ -76,6 +77,7 @@ object BlockchainFeeUtils {
|
|||
return when (this) {
|
||||
is Fee.Ethereum.EIP1559 -> copy(amount = increasedAmount, gasLimit = increasedGasLimit)
|
||||
is Fee.Ethereum.Legacy -> copy(amount = increasedAmount, gasLimit = increasedGasLimit)
|
||||
is Fee.Ethereum.TokenCurrency -> error("handle in [REDACTED_TASK_KEY]")
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue