Updated on 2026-08-14

This commit is contained in:
Tangem 2023-07-25 10:52:33 +05:00
parent ddcb68caf6
commit 782a2ec0f5
21 changed files with 479 additions and 6 deletions

View file

@ -0,0 +1,18 @@
package com.tangem.lib.crypto
import com.tangem.lib.crypto.models.txhistory.ProxyTransactionHistoryItem
import com.tangem.lib.crypto.models.txhistory.ProxyTransactionHistoryState
interface TxHistoryManager {
@Throws(IllegalStateException::class)
suspend fun checkTxHistoryState(networkId: String, derivationPath: String?): ProxyTransactionHistoryState
@Throws(IllegalStateException::class)
suspend fun getTxHistoryItems(
networkId: String,
derivationPath: String?,
page: Int,
pageSize: Int,
): List<ProxyTransactionHistoryItem>
}

View file

@ -0,0 +1,21 @@
package com.tangem.lib.crypto.models.txhistory
import com.tangem.lib.crypto.models.ProxyAmount
data class ProxyTransactionHistoryItem(
val txHash: String,
val timestamp: Long,
val direction: TransactionDirection,
val status: ProxyTransactionStatus,
val type: TransactionType,
val amount: ProxyAmount,
) {
sealed interface TransactionDirection {
data class Incoming(val from: String) : TransactionDirection
data class Outgoing(val to: String) : TransactionDirection
}
sealed interface TransactionType {
object Transfer : TransactionType
}
}

View file

@ -0,0 +1,15 @@
package com.tangem.lib.crypto.models.txhistory
sealed class ProxyTransactionHistoryState {
sealed class Success : ProxyTransactionHistoryState() {
object Empty : Success()
data class HasTransactions(val txCount: Int) : Success()
}
sealed class Failed : ProxyTransactionHistoryState() {
data class FetchError(val exception: Exception) : Failed()
}
object NotImplemented : ProxyTransactionHistoryState()
}

View file

@ -0,0 +1,3 @@
package com.tangem.lib.crypto.models.txhistory
enum class ProxyTransactionStatus { Confirmed, Unconfirmed }