Updated on 2026-08-14

This commit is contained in:
Tangem 2024-12-05 12:45:38 +05:00
parent d71d29b72b
commit b750588ef9
21 changed files with 277 additions and 67 deletions

View file

@ -3,10 +3,10 @@ package com.tangem.datasource.local.swaptx
import com.tangem.datasource.local.datastore.core.StringKeyDataStore
internal class DefaultSwapTransactionStatusStore(
private val dataStore: StringKeyDataStore<ExchangeAnalyticsStatus>,
) : SwapTransactionStatusStore, StringKeyDataStore<ExchangeAnalyticsStatus> by dataStore {
private val dataStore: StringKeyDataStore<ExpressAnalyticsStatus>,
) : SwapTransactionStatusStore, StringKeyDataStore<ExpressAnalyticsStatus> by dataStore {
override suspend fun getTransactionStatus(txId: String) = getSyncOrNull(txId)
override suspend fun setTransactionStatus(txId: String, status: ExchangeAnalyticsStatus) = store(txId, status)
override suspend fun setTransactionStatus(txId: String, status: ExpressAnalyticsStatus) = store(txId, status)
}

View file

@ -4,12 +4,12 @@ package com.tangem.datasource.local.swaptx
* Runtime cache for storing swap transactions statuses sent to analytics
*/
interface SwapTransactionStatusStore {
suspend fun getTransactionStatus(txId: String): ExchangeAnalyticsStatus?
suspend fun getTransactionStatus(txId: String): ExpressAnalyticsStatus?
suspend fun setTransactionStatus(txId: String, status: ExchangeAnalyticsStatus)
suspend fun setTransactionStatus(txId: String, status: ExpressAnalyticsStatus)
}
enum class ExchangeAnalyticsStatus(val value: String) {
enum class ExpressAnalyticsStatus(val value: String) {
WaitingTxHash("Waiting tx hash"),
InProgress("In Progress"),
Done("Done"),