Updated on 2026-08-14
This commit is contained in:
parent
638cbc9d23
commit
32ae17c016
9 changed files with 31 additions and 66 deletions
|
|
@ -37,6 +37,9 @@ dependencies {
|
|||
implementation(projects.domain.transaction)
|
||||
implementation(projects.domain.demo)
|
||||
|
||||
/** Api */
|
||||
implementation(projects.features.sendV2.api)
|
||||
|
||||
/** DI */
|
||||
implementation(deps.hilt.android)
|
||||
kapt(deps.hilt.kapt)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.tangem.domain.transaction.GaslessTransactionRepository
|
|||
import com.tangem.domain.transaction.models.Eip7702Authorization
|
||||
import com.tangem.domain.transaction.models.GaslessSignedTransactionResult
|
||||
import com.tangem.domain.transaction.models.GaslessTransactionData
|
||||
import com.tangem.features.send.v2.api.SendFeatureToggles
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
|
|
@ -25,6 +26,7 @@ class DefaultGaslessTransactionRepository(
|
|||
private val gaslessTxServiceApi: GaslessTxServiceApi,
|
||||
private val coroutineDispatcherProvider: CoroutineDispatcherProvider,
|
||||
private val responseCryptoCurrenciesFactory: ResponseCryptoCurrenciesFactory,
|
||||
private val sendFeatureToggles: SendFeatureToggles,
|
||||
) : GaslessTransactionRepository {
|
||||
|
||||
private val supportedTokensState = MutableStateFlow<Map<Network.ID, Set<CryptoCurrency>>>(hashMapOf())
|
||||
|
|
@ -120,6 +122,9 @@ class DefaultGaslessTransactionRepository(
|
|||
}
|
||||
|
||||
override suspend fun getGaslessFeeAddresses(): Set<String> {
|
||||
if (!sendFeatureToggles.isGaslessTransactionsEnabled) {
|
||||
return EMPTY_ADDRESSES
|
||||
}
|
||||
return addressesMutex.withLock {
|
||||
allFeeRecipientAddress.ifEmpty {
|
||||
val allFeeAddresses = getAllFeeRecipientAddresses()
|
||||
|
|
@ -136,5 +141,6 @@ class DefaultGaslessTransactionRepository(
|
|||
|
||||
private companion object {
|
||||
val BASE_GAS_FOR_TRANSACTION: BigInteger = BigInteger("100000")
|
||||
val EMPTY_ADDRESSES = emptySet<String>()
|
||||
}
|
||||
}
|
||||
|
|
@ -49,10 +49,7 @@ class MockedGaslessTransactionRepository(
|
|||
network: Network,
|
||||
eip7702Auth: Eip7702Authorization?,
|
||||
): GaslessSignedTransactionResult = GaslessSignedTransactionResult(
|
||||
signedTransaction = "0x000",
|
||||
gasLimit = 100000.toBigInteger(),
|
||||
maxFeePerGas = 21000.toBigInteger(),
|
||||
maxPriorityFeePerGas = 21000.toBigInteger(),
|
||||
txHash = "0x000",
|
||||
)
|
||||
|
||||
override fun getBaseGasForTransaction(): BigInteger {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.tangem.data.transaction.convertes
|
||||
|
||||
import com.tangem.datasource.api.gasless.models.GaslessSignedTransactionResultDTO as GaslessSignedTransactionResultDTO
|
||||
import com.tangem.datasource.api.gasless.models.GaslessSignedTransactionResultDTO
|
||||
import com.tangem.domain.transaction.models.GaslessSignedTransactionResult
|
||||
import com.tangem.utils.converter.Converter
|
||||
|
||||
|
|
@ -13,10 +13,7 @@ class GaslessSignedTransactionResultConverter :
|
|||
|
||||
override fun convert(value: GaslessSignedTransactionResultDTO): GaslessSignedTransactionResult {
|
||||
return GaslessSignedTransactionResult(
|
||||
signedTransaction = value.signedTransaction,
|
||||
gasLimit = value.gasLimit.toBigInteger(),
|
||||
maxFeePerGas = value.maxFeePerGas.toBigInteger(),
|
||||
maxPriorityFeePerGas = value.maxPriorityFeePerGas.toBigInteger(),
|
||||
txHash = value.txHash,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ import com.tangem.domain.transaction.TransactionRepository
|
|||
import com.tangem.domain.transaction.WalletAddressServiceRepository
|
||||
import com.tangem.domain.transaction.error.FeeErrorResolver
|
||||
import com.tangem.domain.walletmanager.WalletManagersFacade
|
||||
import com.tangem.features.send.v2.api.SendFeatureToggles
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
|
@ -76,11 +77,13 @@ internal object TransactionDataModule {
|
|||
responseCryptoCurrenciesFactory: ResponseCryptoCurrenciesFactory,
|
||||
gaslessTxServiceApi: GaslessTxServiceApi,
|
||||
coroutineDispatcherProvider: CoroutineDispatcherProvider,
|
||||
sendFeatureToggles: SendFeatureToggles,
|
||||
): GaslessTransactionRepository {
|
||||
return DefaultGaslessTransactionRepository(
|
||||
gaslessTxServiceApi,
|
||||
coroutineDispatcherProvider,
|
||||
responseCryptoCurrenciesFactory,
|
||||
gaslessTxServiceApi = gaslessTxServiceApi,
|
||||
coroutineDispatcherProvider = coroutineDispatcherProvider,
|
||||
responseCryptoCurrenciesFactory = responseCryptoCurrenciesFactory,
|
||||
sendFeatureToggles = sendFeatureToggles,
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue