Updated on 2026-08-14

This commit is contained in:
Tangem 2025-10-30 17:38:10 +05:00
parent 4be3782a0a
commit 2ea3f2ca9d
11 changed files with 98 additions and 8 deletions

View file

@ -1,6 +1,7 @@
package com.tangem.domain.swap.models
import com.tangem.domain.express.models.ExpressProvider
import com.tangem.domain.models.account.Account
import com.tangem.domain.models.currency.CryptoCurrency
import java.math.BigDecimal
@ -13,6 +14,8 @@ data class SwapTransactionListModel(
val toCryptoCurrencyId: String,
val fromCryptoCurrency: CryptoCurrency,
val toCryptoCurrency: CryptoCurrency,
val fromAccount: Account.CryptoPortfolio?,
val toAccount: Account.CryptoPortfolio?,
val transactions: List<SwapTransactionModel>,
)

View file

@ -1,5 +1,6 @@
package com.tangem.domain.swap
import com.tangem.domain.models.account.Account
import com.tangem.domain.models.account.AccountId
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.wallet.UserWallet
@ -20,12 +21,17 @@ interface SwapTransactionRepository {
* @param userWalletId selected user wallet id
* @param fromCryptoCurrency currency swap from
* @param toCryptoCurrency currency swap to
* @param fromAccount account swap from
* @param toAccount account swap to
* @param transaction swap transaction
*/
@Suppress("LongParameterList")
suspend fun storeTransaction(
userWalletId: UserWalletId,
fromCryptoCurrency: CryptoCurrency,
toCryptoCurrency: CryptoCurrency,
fromAccount: Account.CryptoPortfolio?,
toAccount: Account.CryptoPortfolio?,
transaction: SwapTransactionModel,
)

View file

@ -3,6 +3,7 @@ package com.tangem.domain.swap.usecase
import arrow.core.Either
import com.tangem.domain.express.models.ExpressProvider
import com.tangem.domain.express.models.ExpressProviderType.Companion.shouldStoreSwapTransaction
import com.tangem.domain.models.account.Account
import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.swap.SwapErrorResolver
@ -21,6 +22,8 @@ class SwapTransactionSentUseCase(
userWallet: UserWallet,
fromCryptoCurrencyStatus: CryptoCurrencyStatus,
toCryptoCurrencyStatus: CryptoCurrencyStatus,
fromAccount: Account.CryptoPortfolio?,
toAccount: Account.CryptoPortfolio?,
swapDataTransactionModel: SwapDataTransactionModel,
provider: ExpressProvider,
txHash: String,
@ -32,6 +35,8 @@ class SwapTransactionSentUseCase(
userWalletId = userWallet.walletId,
fromCryptoCurrency = fromCryptoCurrencyStatus.currency,
toCryptoCurrency = toCryptoCurrencyStatus.currency,
fromAccount = fromAccount,
toAccount = toAccount,
transaction = SwapTransactionModel(
txId = swapDataTransactionModel.txId,
provider = provider,