Updated on 2026-08-14
This commit is contained in:
parent
91200c4973
commit
0693835f07
9 changed files with 99 additions and 13 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.domain.express.models
|
||||
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
|
|
@ -39,6 +40,13 @@ data class ExpressAsset(
|
|||
operator fun invoke(networkId: String, contractAddress: String?): ID {
|
||||
return ID(networkId = networkId, contractAddress = contractAddress ?: EMPTY_CONTRACT_ADDRESS_VALUE)
|
||||
}
|
||||
|
||||
operator fun invoke(cryptoCurrency: CryptoCurrency): ID {
|
||||
return ID(
|
||||
networkId = cryptoCurrency.network.rawId,
|
||||
contractAddress = (cryptoCurrency as? CryptoCurrency.Token)?.contractAddress,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,4 +35,6 @@ interface ExpressServiceFetcher {
|
|||
* @return A flow emitting Lce states containing either a list of Express assets or an error.
|
||||
*/
|
||||
fun getInitializationStatus(userWalletId: UserWalletId): Flow<Lce<Throwable, List<ExpressAsset>>>
|
||||
|
||||
suspend fun getOrFetch(userWalletId: UserWalletId, assetId: ExpressAsset.ID): Either<Throwable, ExpressAsset>
|
||||
}
|
||||
|
|
@ -23,4 +23,21 @@ interface TxHistoryRepositoryV2 {
|
|||
currency: CryptoCurrency,
|
||||
fromCreatedAtMillis: Long,
|
||||
): Flow<List<ExpressTx>>
|
||||
}
|
||||
|
||||
/**
|
||||
* Reactive express history for [currency] paginated via the unified history index: the [limit] most recent index
|
||||
* rows define the window (their oldest sort time), which bounds [getExpressHistory]. Grow [limit] to load more.
|
||||
*
|
||||
* Used as the standalone backbone when there is no on-chain history source for the currency.
|
||||
*/
|
||||
fun getIndexedExpressHistory(
|
||||
userWalletId: UserWalletId,
|
||||
currency: CryptoCurrency,
|
||||
limit: Int,
|
||||
): Flow<ExpressHistoryPage>
|
||||
}
|
||||
|
||||
data class ExpressHistoryPage(
|
||||
val items: List<ExpressTx>,
|
||||
val hasMore: Boolean,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue