Updated on 2026-08-14
This commit is contained in:
parent
63125dc0f3
commit
70294eef52
5 changed files with 65 additions and 13 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue