Skip to content

Commit

Permalink
Fix offline update not working
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahem authored and ibrahem committed Sep 7, 2022
1 parent a43091f commit 47f0ac4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/status_im/wallet_connect_legacy/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,18 @@
(let [sessions (get db :wallet-connect-legacy/sessions)
accounts-new (:accounts (first (:params payload)))
session (first (filter #(= (:connector %) connector) sessions))
updated-session (assoc-in session [:params 0 :accounts] accounts-new)]
{:db (-> db
(assoc :wallet-connect-legacy/sessions (conj (filter #(not= (:connector %) connector) sessions) updated-session))
(dissoc :wallet-connect/session-managed))}))
updated-session (assoc-in session [:params 0 :accounts] accounts-new)
peer-id (get-in updated-session [:params 0 :peerId])
dapp-name (get-in updated-session [:params 0 :peerMeta :name])
dapp-url (get-in updated-session [:params 0 :peerMeta :url])]
(fx/merge cofx
{:db (-> db
(assoc :wallet-connect-legacy/sessions (conj (filter #(not= (:connector %) connector) sessions) updated-session))
(dissoc :wallet-connect/session-managed))
:dispatch [:wallet-connect-legacy/save-session {:peer-id peer-id
:dapp-url dapp-url
:dapp-name dapp-name
:connector connector}]})))

(fx/defn wallet-connect-legacy-complete-transaction
{:events [:wallet-connect-legacy.dapp/transaction-on-result]}
Expand Down

0 comments on commit 47f0ac4

Please sign in to comment.