Wallet - Refresh tokens and prices (#18456)

This commit adds

- RPC call for start wallet which will signal the client to refresh data (tokens, prices, ...etc) every 10 minutes
- Refreshes tokens and prices every 10 minutes on receiving the "wallet-tick-reload" signal

---------

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
Mohamed Javid 2024-01-23 17:59:29 +05:30 committed by GitHub
parent cb586c8676
commit 4fe62553ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View File

@ -89,4 +89,5 @@
"wallet-get-collectibles-details-done" {:fx [[:dispatch
[:wallet/get-collectible-details-done
event]]]}
"wallet-tick-reload" {:fx [[:dispatch [:wallet/reload]]]}
(log/debug ::unknown-wallet-event :type type :event event)))

View File

@ -327,9 +327,23 @@
{:fx [[:dispatch [:hide-bottom-sheet]]
[:dispatch [:browser.ui/open-url (str explorer-link "/" address)]]]}))
(rf/reg-event-fx :wallet/reload
(fn [_]
{:fx [[:dispatch-n [[:wallet/get-wallet-token]]]]}))
(rf/reg-event-fx :wallet/start-wallet
(fn [_]
{:fx [[:json-rpc/call
[{:method "wallet_startWallet"
:on-error #(log/info "failed to start wallet"
{:error %
:event :wallet/start-wallet})}]]]}))
(rf/reg-event-fx :wallet/initialize
(fn []
{:fx [[:dispatch-n [[:wallet/get-ethereum-chains] [:wallet/get-accounts]]]]}))
{:fx [[:dispatch [:wallet/start-wallet]]
[:dispatch [:wallet/get-ethereum-chains]]
[:dispatch [:wallet/get-accounts]]]}))
(rf/reg-event-fx :wallet/share-account
(fn [_ [{:keys [content title]}]]