Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-08 12:28:23 +04:00
parent 4e05219c25
commit f172215393
17 changed files with 550 additions and 145 deletions

View file

@ -89,6 +89,7 @@ interface TangemExpressApi {
@GET("history/exchange")
suspend fun getHistory(
@Header("user-id") userWalletId: String,
@Query("fromAddress") fromAddress: String,
@Query("afterCursor") cursor: String?,
@Query("limit") limit: Int = 100,
@ -96,6 +97,7 @@ interface TangemExpressApi {
@GET("history/delta/exchange")
suspend fun getHistoryDelta(
@Header("user-id") userWalletId: String,
@Query("fromAddress") fromAddress: String,
@Query("beforeCursor") cursor: String?,
@Query("limit") limit: Int = 100,

View file

@ -9,7 +9,7 @@ data class ExpressPagination(
val endCursor: String?,
@Json(name = "startDeltaCursor")
val startDeltaCursor: String?,
@Json(name = "hasMore")
@Json(name = "hasNextPage")
val hasMore: Boolean,
)

View file

@ -91,6 +91,7 @@ interface OnrampApi {
@GET("history/onramp")
suspend fun getHistory(
@Header("user-id") userWalletId: String,
@Query("payoutAddress") payoutAddress: String,
@Query("afterCursor") afterCursor: String?,
@Query("limit") limit: Int = 100,
@ -98,6 +99,7 @@ interface OnrampApi {
@GET("history/delta/onramp")
suspend fun getHistoryDelta(
@Header("user-id") userWalletId: String,
@Query("payoutAddress") payoutAddress: String,
@Query("beforeCursor") cursor: String?,
@Query("limit") limit: Int = 100,

View file

@ -13,6 +13,27 @@ interface ExpressSyncStateDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun upsert(item: ExpressSyncStateEntity)
@Query(
"""
UPDATE express_sync_state
SET after_cursor = :afterCursor,
is_initial_completed = :isInitialCompleted
WHERE type = :type
AND address = :address
""",
)
suspend fun updateHistoryCursor(type: String, address: String, afterCursor: String?, isInitialCompleted: Boolean)
@Query(
"""
UPDATE express_sync_state
SET delta_cursor = :deltaCursor
WHERE type = :type
AND address = :address
""",
)
suspend fun updateDeltaCursor(type: String, address: String, deltaCursor: String)
@Query(
"""
SELECT *

View file

@ -9,18 +9,11 @@ import androidx.room.*
*/
@Entity(
tableName = "express_exchange",
foreignKeys = [
ForeignKey(
entity = ExpressProviderEntity::class,
parentColumns = ["id"],
childColumns = ["provider_id"],
onDelete = ForeignKey.RESTRICT,
),
],
indices = [
Index(value = ["owner_address", "from_network", "created_at"]),
Index(value = ["owner_address", "payin_hash"]),
Index(value = ["owner_address", "payout_hash"]),
Index(value = ["provider_id"]),
],
)
data class ExpressExchangeEntity(

View file

@ -9,17 +9,10 @@ import androidx.room.*
*/
@Entity(
tableName = "express_onramp",
foreignKeys = [
ForeignKey(
entity = ExpressProviderEntity::class,
parentColumns = ["id"],
childColumns = ["provider_id"],
onDelete = ForeignKey.RESTRICT,
),
],
indices = [
Index(value = ["owner_address", "to_network", "created_at"]),
Index(value = ["owner_address", "payout_hash"]),
Index(value = ["provider_id"]),
],
)
data class ExpressOnrampEntity(