diff --git a/domain/transaction/models/src/main/kotlin/com/tangem/domain/transaction/error/GetFeeError.kt b/domain/transaction/models/src/main/kotlin/com/tangem/domain/transaction/error/GetFeeError.kt index ef18d2916a..6bfb7e06d4 100644 --- a/domain/transaction/models/src/main/kotlin/com/tangem/domain/transaction/error/GetFeeError.kt +++ b/domain/transaction/models/src/main/kotlin/com/tangem/domain/transaction/error/GetFeeError.kt @@ -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() + } } \ No newline at end of file diff --git a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/gasless/GetAvailableFeeTokensUseCase.kt b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/gasless/GetAvailableFeeTokensUseCase.kt new file mode 100644 index 0000000000..7d57316d91 --- /dev/null +++ b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/gasless/GetAvailableFeeTokensUseCase.kt @@ -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> { + return GetFeeError.UnknownError.left() + } +} \ No newline at end of file diff --git a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/gasless/GetFeeForGaslessUseCase.kt b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/gasless/GetFeeForGaslessUseCase.kt new file mode 100644 index 0000000000..67b2f1ec38 --- /dev/null +++ b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/gasless/GetFeeForGaslessUseCase.kt @@ -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 { + return GaslessError.NetworkIsNotSupported.left() + } +} \ No newline at end of file diff --git a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/gasless/GetFeeForTokenUseCase.kt b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/gasless/GetFeeForTokenUseCase.kt new file mode 100644 index 0000000000..f33773dca4 --- /dev/null +++ b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/gasless/GetFeeForTokenUseCase.kt @@ -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 { + return GetFeeError.UnknownError.left() + } +} \ No newline at end of file diff --git a/domain/yield-supply/src/main/java/com/tangem/domain/yield/supply/FeeExtensions.kt b/domain/yield-supply/src/main/java/com/tangem/domain/yield/supply/FeeExtensions.kt index 6df54ae127..07ce01ecb4 100644 --- a/domain/yield-supply/src/main/java/com/tangem/domain/yield/supply/FeeExtensions.kt +++ b/domain/yield-supply/src/main/java/com/tangem/domain/yield/supply/FeeExtensions.kt @@ -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) } diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/fee/model/converters/custom/ethereum/EthereumCustomFeeConverter.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/fee/model/converters/custom/ethereum/EthereumCustomFeeConverter.kt index 65e2574a85..be8621ba5a 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/fee/model/converters/custom/ethereum/EthereumCustomFeeConverter.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/fee/model/converters/custom/ethereum/EthereumCustomFeeConverter.kt @@ -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): 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 { return when (feeValue) { + is Fee.Ethereum.TokenCurrency -> error("handle in [REDACTED_TASK_KEY]") is Fee.Ethereum.EIP1559 -> eipFeeConverter.onValueChange( feeValue = feeValue, customValues = customValues, diff --git a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt index 067870cc0e..72a86eaec1 100644 --- a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt +++ b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt @@ -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]") } } diff --git a/gradle/tangem_dependencies.toml b/gradle/tangem_dependencies.toml index 36965eb1e1..a5e86b9855 100644 --- a/gradle/tangem_dependencies.toml +++ b/gradle/tangem_dependencies.toml @@ -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 ^ diff --git a/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainFeeUtils.kt b/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainFeeUtils.kt index 30f9d06686..74d6248b75 100644 --- a/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainFeeUtils.kt +++ b/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainFeeUtils.kt @@ -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]") } } } \ No newline at end of file