Updated on 2026-08-14

This commit is contained in:
Tangem 2025-10-17 17:14:28 +03:00
parent 63125dc0f3
commit 70294eef52
5 changed files with 65 additions and 13 deletions

View file

@ -19,6 +19,7 @@ interface StakeKitApi {
@Query("preferredValidatorsOnly") preferredValidatorsOnly: Boolean? = null,
@Query("ledgerWalletAPICompatible") ledgerWalletAPICompatible: Boolean? = null,
@Query("type") type: YieldType? = null,
@Query("yieldId") yieldId: String? = null,
@Query("revenueOption") revenueOption: RevenueOption? = null,
@Query("page") page: Int? = null,
@Query("network") network: String? = null,

View file

@ -24,8 +24,19 @@ internal class DefaultStakingYieldsStore(
}
override suspend fun store(items: List<YieldDTO>) {
dataStore.updateData { _ ->
items
dataStore.updateData { data ->
val updatedItems = data.toMutableList()
items.forEach { newItem ->
val existingItemIndex = data.indexOfFirst { it.id == newItem.id }
if (existingItemIndex != -1) {
// Update existing item
updatedItems[existingItemIndex] = newItem
} else {
// Add new item
updatedItems.add(newItem)
}
}
updatedItems
}
}