Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multicollectible amount is not updated after transaction until relogin #21483

Open
pavloburykh opened this issue Oct 22, 2024 · 7 comments · May be fixed by #21867
Open

Multicollectible amount is not updated after transaction until relogin #21483

pavloburykh opened this issue Oct 22, 2024 · 7 comments · May be fixed by #21867
Assignees
Labels
wallet-core Issues for mobile wallet team

Comments

@pavloburykh
Copy link
Contributor

Steps:

  1. Send multicollectible from Account A to internal Account B
  2. See if collectible amount has been updated after pull to refresh

Actual result: amount is not updated until relogin
Status-debug-logs - 2024-10-22T175917.000.zip

telegram-cloud-document-2-5242541187209909311.mp4

Additional Information

  • Status version: nightly
  • Operating System: Android, iOS
@pavloburykh pavloburykh added the wallet-core Issues for mobile wallet team label Oct 22, 2024
@mohsen-ghafouri mohsen-ghafouri self-assigned this Dec 18, 2024
@mohsen-ghafouri
Copy link
Contributor

Hey @pavloburykh, could you please advice if it's reproducible on desktop as well or not? as i checked the logs it seems status-go send us current count and not the new count.

@pavloburykh
Copy link
Contributor Author

Hey @pavloburykh, could you please advice if it's reproducible on desktop as well or not? as i checked the logs it seems status-go send us current count and not the new count.

Hey @mohsen-ghafouri! You are right. I have just checked Desktop and reproduced the issue.

@mohsen-ghafouri
Copy link
Contributor

Thanks @pavloburykh, i will check status-go logic.

@smohamedjavid
Copy link
Member

Hey @smohamedjavid, would you mind also check and advice about this issue?#21483
when i was testing i notice that :wallet/collectibles-data-updated recieved wrong balance (current balance and not updated data), I also tried to fetch manually after update but that didn't work too, so IMO the only way to fix it in status-go side. wdyt?

also my draft PR #21867 (not working properly yet)

Based on the changes in the PR #21867, the fetch type is :fetch-if-cache-old which is validated against the cache age we set in the params

The cache is valid for 1 hour (bit high) which is why we still see the cached balance. Maybe, we could try :always-fetch.

Either way, the RPC will trigger the fetching in async but the response will always return the cached ones. The response will have an map ownershipStatus which will contain the state of updating for each chain along with timestamp.

(defn- updating-collectibles?
[status]
(and (= (:state status) (ownership-state :updating))
(= (:timestamp status) -1)))

We can try update the above condition to remove the timestamp check (it was added as additional check if the collectible was an account is never fetched - during account recovery). This will update the app-db with updating addresses fetch the collectibles once it's done. I'm thinking this may introduce a loading collectibles UI bug. Need to verify.

Anyways, the client will receive wallet-collectibles-ownership-update-finished signal once the update is finished and we fetch the collectibles for that address again.

(rf/reg-event-fx
:wallet/collectible-ownership-update-finished
(fn [{:keys [db]} [{:keys [accounts chainId]}]]
(let [address (first accounts)
pending-chain-ids (get-in db [:wallet :ui :collectibles :updating address])
updated-chain-ids (disj pending-chain-ids chainId)
all-chain-updated? (and (some? pending-chain-ids) (empty? updated-chain-ids))]
{:db (cond-> db
(some? pending-chain-ids)
(assoc-in [:wallet :ui :collectibles :updating address] updated-chain-ids))
:fx [(when all-chain-updated?
[:dispatch [:wallet/request-collectibles-for-account address]])]})))

@smohamedjavid
Copy link
Member

On the other hand for simplest solution, there are few other RPC which I noticed in the status-go such as wallet_fetchBalancesByOwnerAndContractAddress, it might help to get the balance of the collectible. I haven't tried that yet. We can just update the balance in the app-db instead of fetching the whole collectibles data and processing it. WDYT?

If none of the above solution works, we definitely need to check status-go 😅 .

@mohsen-ghafouri
Copy link
Contributor

Thank @smohamedjavid for your feedback, I tested once with :always-fetch and it didn't help, i will give it another try. also will check wallet_fetchBalancesByOwnerAndContractAddress if that can help, I agree that fetching whole collectible is not a good way to handle it and also update the balance in the app-db will save us some api call. I will try it.

@mohsen-ghafouri
Copy link
Contributor

mohsen-ghafouri commented Jan 3, 2025

JFYI @smohamedjavid I just tested wallet_fetchBalancesByOwnerAndContractAddress it has issue as it send balance of all contract addresses, despite i sent owner address and specific contract address. it seem for now either it should be fixed in status-go side, or fetch all collectible of one account (this also doesn't work well IMO). will discuss about it with you on Monday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wallet-core Issues for mobile wallet team
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

3 participants