Skip to content

Commit

Permalink
Fix re-istantiating wallet connect bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrkhalil committed Sep 14, 2022
1 parent 3f1bbf0 commit 9ab5526
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
7 changes: 2 additions & 5 deletions src/status_im/ethereum/subscriptions.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[status-im.wallet.core :as wallet.core]
[status-im.ethereum.transactions.core :as transactions]
[status-im.utils.fx :as fx]
[status-im.wallet-connect-legacy.core :as wallet-connect-legacy]
[taoensso.timbre :as log]))

(fx/defn new-transfers
Expand All @@ -15,18 +14,16 @@
(transactions/check-watched-transactions cofx))

(fx/defn recent-history-fetching-started
[{:keys [db] :as cofx} accounts]
[{:keys [db]} accounts]
(log/debug "[wallet-subs] recent-history-fetching-started"
"accounts" accounts)
(let [event (get db :wallet/on-recent-history-fetching)]
(fx/merge cofx
(cond-> {:db (-> db
(transactions/update-fetching-status accounts :recent? true)
(assoc :wallet/recent-history-fetching-started? true)
(dissoc :wallet/on-recent-history-fetching))}
event
(assoc :dispatch event))
(wallet-connect-legacy/get-connector-session-from-db))))
(assoc :dispatch event))))

(fx/defn recent-history-fetching-ended
[{:keys [db]} {:keys [accounts blockNumber]}]
Expand Down
3 changes: 2 additions & 1 deletion src/status_im/mailserver/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
{:events [::request-success]}
[{:keys [db] :as cofx} response-js]
{:db (dissoc db :mailserver/current-request)
:dispatch [:sanitize-messages-and-process-response response-js]})
:dispatch-n [[:sanitize-messages-and-process-response response-js]
[:wallet-connect-legacy/get-connector-session-from-db]]})

(fx/defn handle-mailserver-not-working [{:keys [db] :as cofx}]
(let [current-fleet (node/current-fleet-key db)
Expand Down
48 changes: 25 additions & 23 deletions src/status_im/multiaccounts/login/core.cljs
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
(ns status-im.multiaccounts.login.core
(:require [re-frame.core :as re-frame]
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.async-storage.core :as async-storage]
[status-im.chat.models.link-preview :as link-preview]
[status-im.communities.core :as communities]
[status-im.contact.core :as contact]
[status-im.utils.config :as config]
[status-im.data-store.chats :as data-store.chats]
[status-im.data-store.invitations :as data-store.invitations]
[status-im.data-store.settings :as data-store.settings]
[status-im.data-store.visibility-status-updates :as visibility-status-updates-store]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.transactions.core :as transactions]
[status-im.ethereum.eip55 :as eip55]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.keycard.common :as keycard.common]
[status-im.ethereum.tokens :as tokens]
[status-im.ethereum.transactions.core :as transactions]
[status-im.fleet.core :as fleet]
[status-im.i18n.i18n :as i18n]
[status-im.keycard.common :as keycard.common]
[status-im.mobile-sync-settings.core :as mobile-network]
[status-im.multiaccounts.biometric.core :as biometric]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.native-module.core :as status]
[status-im.navigation :as navigation]
[status-im.node.core :as node]
[status-im.notifications-center.core :as notifications-center]
[status-im.notifications.core :as notifications]
[status-im.popover.core :as popover]
[status-im.communities.core :as communities]
[status-im.signing.eip1559 :as eip1559]
[status-im.transport.core :as transport]
[status-im.mobile-sync-settings.core :as mobile-network]
[status-im.ui.components.react :as react]
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.utils.keychain.core :as keychain]
[status-im.utils.logging.core :as logging]
[status-im.utils.mobile-sync :as utils.mobile-sync]
[status-im.utils.platform :as platform]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
[status-im.utils.wallet-connect :as wallet-connect]
[status-im.wallet-connect-legacy.core :as wallet-connect-legacy]
[status-im.wallet.core :as wallet]
[status-im.wallet.prices :as prices]
[taoensso.timbre :as log]
[status-im.data-store.invitations :as data-store.invitations]
[status-im.chat.models.link-preview :as link-preview]
[status-im.utils.mobile-sync :as utils.mobile-sync]
[status-im.async-storage.core :as async-storage]
[status-im.notifications-center.core :as notifications-center]
[status-im.navigation :as navigation]
[status-im.signing.eip1559 :as eip1559]
[status-im.data-store.chats :as data-store.chats]
[status-im.data-store.visibility-status-updates :as visibility-status-updates-store]
[status-im.ui.components.react :as react]
[status-im.utils.platform :as platform]
[status-im.ethereum.tokens :as tokens]
[clojure.string :as string]
[status-im.utils.wallet-connect :as wallet-connect]
[status-im.node.core :as node]))
[taoensso.timbre :as log]))

(re-frame/reg-fx
::initialize-communities-enabled
Expand Down Expand Up @@ -162,7 +163,8 @@
(transactions/get-fetched-transfers))
(when (ethereum/binance-chain? db)
(wallet/request-current-block-update))
(prices/update-prices)))
(prices/update-prices)
(wallet-connect-legacy/get-connector-session-from-db)))

(fx/defn login
{:events [:multiaccounts.login.ui/password-input-submitted]}
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/wallet_connect_legacy/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
{:initialize-wc-sessions [chain-id sessions]})))

(fx/defn get-connector-session-from-db
{:events [:get-connector-session-from-db]}
{:events [:wallet-connect-legacy/get-connector-session-from-db]}
[_]
{::json-rpc/call [{:method "wakuext_getWalletConnectSession"
:on-success #(re-frame/dispatch [:sync-wallet-connect-app-sessions %])
Expand Down

0 comments on commit 9ab5526

Please sign in to comment.