feat: add api to refetch owned collectibles

This commit is contained in:
Dario Gabriel Lipicar 2023-09-21 18:42:02 -03:00 committed by dlipicar
parent 17cef5f211
commit ba1f8ba923
2 changed files with 12 additions and 0 deletions

View File

@ -320,6 +320,13 @@ func (api *API) FetchBalancesByOwnerAndContractAddress(chainID wcommon.ChainID,
return api.s.collectiblesManager.FetchBalancesByOwnerAndContractAddress(chainID, ownerAddress, contractAddresses)
}
func (api *API) RefetchOwnedCollectibles() error {
log.Debug("wallet.api.RefetchOwnedCollectibles")
api.s.collectibles.RefetchOwnedCollectibles()
return nil
}
func (api *API) FilterOwnedCollectiblesAsync(requestID int32, chainIDs []wcommon.ChainID, addresses []common.Address, offset int, limit int) error {
log.Debug("wallet.api.FilterOwnedCollectiblesAsync", "chainIDs.count", len(chainIDs), "addr.count", len(addresses), "offset", offset, "limit", limit)

View File

@ -188,6 +188,11 @@ func (s *Service) GetCollectiblesDetailsAsync(requestID int32, uniqueIDs []third
})
}
func (s *Service) RefetchOwnedCollectibles() {
s.stopPeriodicalOwnershipFetch()
_ = s.startPeriodicalOwnershipFetch()
}
// Starts periodical fetching for the all wallet addresses and all chains
func (s *Service) startPeriodicalOwnershipFetch() error {
if s.group != nil {