chore(wallet) remove activity filter dependency on accounts
Bumps status-go and pass the all addresses selected to the API Close #11980
This commit is contained in:
parent
20182b0d75
commit
7e5ed80847
|
@ -15,7 +15,6 @@ import app/core/signals/types
|
||||||
|
|
||||||
import backend/activity as backend_activity
|
import backend/activity as backend_activity
|
||||||
import backend/backend as backend
|
import backend/backend as backend
|
||||||
import backend/transactions
|
|
||||||
|
|
||||||
import app_service/service/currency/service as currency_service
|
import app_service/service/currency/service as currency_service
|
||||||
import app_service/service/transaction/service as transaction_service
|
import app_service/service/transaction/service as transaction_service
|
||||||
|
@ -24,8 +23,6 @@ import app_service/service/token/service as token_service
|
||||||
import app/modules/shared/wallet_utils
|
import app/modules/shared/wallet_utils
|
||||||
import app/modules/shared_models/currency_amount
|
import app/modules/shared_models/currency_amount
|
||||||
|
|
||||||
import app_service/service/transaction/dto
|
|
||||||
|
|
||||||
proc toRef*[T](obj: T): ref T =
|
proc toRef*[T](obj: T): ref T =
|
||||||
new(result)
|
new(result)
|
||||||
result[] = obj
|
result[] = obj
|
||||||
|
@ -51,6 +48,7 @@ QtObject:
|
||||||
filterTokenCodes: HashSet[string]
|
filterTokenCodes: HashSet[string]
|
||||||
|
|
||||||
addresses: seq[string]
|
addresses: seq[string]
|
||||||
|
allAddressesSelected: bool
|
||||||
# call updateAssetsIdentities after updating chainIds
|
# call updateAssetsIdentities after updating chainIds
|
||||||
chainIds: seq[int]
|
chainIds: seq[int]
|
||||||
allChainsSelected: bool
|
allChainsSelected: bool
|
||||||
|
@ -154,7 +152,7 @@ QtObject:
|
||||||
self.status.setNewDataAvailable(false)
|
self.status.setNewDataAvailable(false)
|
||||||
|
|
||||||
let chains = if not self.allChainsSelected: self.chainIds else: @[]
|
let chains = if not self.allChainsSelected: self.chainIds else: @[]
|
||||||
let response = backend_activity.filterActivityAsync(self.requestId, self.addresses, seq[backend_activity.ChainId](chains), self.currentActivityFilter, 0, FETCH_BATCH_COUNT_DEFAULT)
|
let response = backend_activity.filterActivityAsync(self.requestId, self.addresses, self.allAddressesSelected, seq[backend_activity.ChainId](chains), self.currentActivityFilter, 0, FETCH_BATCH_COUNT_DEFAULT)
|
||||||
if response.error != nil:
|
if response.error != nil:
|
||||||
error "error fetching activity entries: ", response.error
|
error "error fetching activity entries: ", response.error
|
||||||
self.status.setLoadingData(false)
|
self.status.setLoadingData(false)
|
||||||
|
@ -163,7 +161,7 @@ QtObject:
|
||||||
proc loadMoreItems(self: Controller) {.slot.} =
|
proc loadMoreItems(self: Controller) {.slot.} =
|
||||||
self.status.setLoadingData(true)
|
self.status.setLoadingData(true)
|
||||||
let chains = if not self.allChainsSelected: self.chainIds else: @[]
|
let chains = if not self.allChainsSelected: self.chainIds else: @[]
|
||||||
let response = backend_activity.filterActivityAsync(self.requestId, self.addresses, seq[backend_activity.ChainId](chains), self.currentActivityFilter, self.model.getCount(), FETCH_BATCH_COUNT_DEFAULT)
|
let response = backend_activity.filterActivityAsync(self.requestId, self.addresses, self.allAddressesSelected, seq[backend_activity.ChainId](chains), self.currentActivityFilter, self.model.getCount(), FETCH_BATCH_COUNT_DEFAULT)
|
||||||
if response.error != nil:
|
if response.error != nil:
|
||||||
self.status.setLoadingData(false)
|
self.status.setLoadingData(false)
|
||||||
error "error fetching activity entries: ", response.error
|
error "error fetching activity entries: ", response.error
|
||||||
|
@ -257,6 +255,7 @@ QtObject:
|
||||||
result.filterTokenCodes = initHashSet[string]()
|
result.filterTokenCodes = initHashSet[string]()
|
||||||
|
|
||||||
result.addresses = @[]
|
result.addresses = @[]
|
||||||
|
result.allAddressesSelected = false
|
||||||
result.chainIds = @[]
|
result.chainIds = @[]
|
||||||
result.allChainsSelected = true
|
result.allChainsSelected = true
|
||||||
|
|
||||||
|
@ -320,13 +319,14 @@ QtObject:
|
||||||
|
|
||||||
self.updateAssetsIdentities()
|
self.updateAssetsIdentities()
|
||||||
|
|
||||||
proc setFilterAddresses*(self: Controller, addresses: seq[string]) =
|
proc setFilterAddresses*(self: Controller, addresses: seq[string], allAddressesSelected: bool) =
|
||||||
self.addresses = addresses
|
self.addresses = addresses
|
||||||
|
self.allAddressesSelected = allAddressesSelected
|
||||||
self.status.setIsFilterDirty(true)
|
self.status.setIsFilterDirty(true)
|
||||||
|
|
||||||
self.updateStartTimestamp()
|
self.updateStartTimestamp()
|
||||||
|
|
||||||
proc setFilterAddressesJson*(self: Controller, jsonArray: string) {.slot.} =
|
proc setFilterAddressesJson*(self: Controller, jsonArray: string, allAddressesSelected: bool) {.slot.} =
|
||||||
let addressesJson = parseJson(jsonArray)
|
let addressesJson = parseJson(jsonArray)
|
||||||
if addressesJson.kind != JArray:
|
if addressesJson.kind != JArray:
|
||||||
error "invalid array of json strings"
|
error "invalid array of json strings"
|
||||||
|
@ -339,7 +339,7 @@ QtObject:
|
||||||
return
|
return
|
||||||
addresses.add(addressesJson[i].getStr())
|
addresses.add(addressesJson[i].getStr())
|
||||||
|
|
||||||
self.setFilterAddresses(addresses)
|
self.setFilterAddresses(addresses, allAddressesSelected)
|
||||||
|
|
||||||
proc setFilterToAddresses*(self: Controller, addresses: seq[string]) =
|
proc setFilterToAddresses*(self: Controller, addresses: seq[string]) =
|
||||||
self.currentActivityFilter.counterpartyAddresses = addresses
|
self.currentActivityFilter.counterpartyAddresses = addresses
|
||||||
|
@ -384,10 +384,10 @@ QtObject:
|
||||||
QtProperty[QVariant] status:
|
QtProperty[QVariant] status:
|
||||||
read = getStatus
|
read = getStatus
|
||||||
|
|
||||||
proc globalFilterChanged*(self: Controller, addresses: seq[string], chainIds: seq[int], allChainsEnabled: bool) =
|
proc globalFilterChanged*(self: Controller, addresses: seq[string], allAddressesSelected: bool, chainIds: seq[int], allChainsEnabled: bool) =
|
||||||
if (self.addresses == addresses and self.chainIds == chainIds):
|
if (self.addresses == addresses and self.allAddressesSelected == allAddressesSelected and self.chainIds == chainIds):
|
||||||
return
|
return
|
||||||
self.setFilterAddresses(addresses)
|
self.setFilterAddresses(addresses, allAddressesSelected)
|
||||||
self.setFilterChains(chainIds, allChainsEnabled)
|
self.setFilterChains(chainIds, allChainsEnabled)
|
||||||
|
|
||||||
proc noLimitTimestamp*(self: Controller): int {.slot.} =
|
proc noLimitTimestamp*(self: Controller): int {.slot.} =
|
||||||
|
|
|
@ -173,7 +173,7 @@ method notifyFilterChanged(self: Module) =
|
||||||
self.assetsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
self.assetsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
||||||
self.accountsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
self.accountsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
||||||
self.sendModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
self.sendModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
||||||
self.activityController.globalFilterChanged(self.filter.addresses, self.filter.chainIds, self.filter.allChainsEnabled)
|
self.activityController.globalFilterChanged(self.filter.addresses, self.filter.allAddresses, self.filter.chainIds, self.filter.allChainsEnabled)
|
||||||
self.collectiblesController.globalFilterChanged(self.filter.addresses, self.filter.chainIds)
|
self.collectiblesController.globalFilterChanged(self.filter.addresses, self.filter.chainIds)
|
||||||
if self.filter.addresses.len > 0:
|
if self.filter.addresses.len > 0:
|
||||||
self.view.filterChanged(self.filter.addresses[0], includeWatchOnly, self.filter.allAddresses)
|
self.view.filterChanged(self.filter.addresses[0], includeWatchOnly, self.filter.allAddresses)
|
||||||
|
|
|
@ -476,6 +476,7 @@ proc fromJson*(e: JsonNode, T: typedesc[FilterResponse]): FilterResponse {.inlin
|
||||||
rpc(filterActivityAsync, "wallet"):
|
rpc(filterActivityAsync, "wallet"):
|
||||||
requestId: int32
|
requestId: int32
|
||||||
addresses: seq[string]
|
addresses: seq[string]
|
||||||
|
allAddresses: bool
|
||||||
chainIds: seq[ChainId]
|
chainIds: seq[ChainId]
|
||||||
filter: ActivityFilter
|
filter: ActivityFilter
|
||||||
offset: int
|
offset: int
|
||||||
|
|
|
@ -174,7 +174,7 @@ Item {
|
||||||
|
|
||||||
function updateRecentsActivity() {
|
function updateRecentsActivity() {
|
||||||
if(root.selectedAccount) {
|
if(root.selectedAccount) {
|
||||||
root.store.tmpActivityController.setFilterAddressesJson(JSON.stringify([root.selectedAccount.address]))
|
root.store.tmpActivityController.setFilterAddressesJson(JSON.stringify([root.selectedAccount.address], false))
|
||||||
}
|
}
|
||||||
root.store.tmpActivityController.updateFilter()
|
root.store.tmpActivityController.updateFilter()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit e98952588d767eff86e3f3cee5731cb7ecdc4db0
|
Subproject commit ad971278d948fbe80050cc56441b6470ca905326
|
Loading…
Reference in New Issue