Skip to content

Commit 18347b4

Browse files
committed
Set initial block range for a newly created account (again)
1 parent bad9aa9 commit 18347b4

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/status_im2/contexts/profile/login/events.cljs

+8-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
[status-im2.contexts.profile.config :as profile.config]
1212
[taoensso.timbre :as log]
1313
[status-im.notifications.core :as notifications]
14-
[status-im2.contexts.profile.create.events :as profile.create]
1514
[status-im2.config :as config]
1615
[status-im.data-store.settings :as data-store.settings]
1716
[status-im2.contexts.communities.discover.events :as contract-communities]
@@ -132,19 +131,17 @@
132131
(switcher-cards-store/fetch-switcher-cards-rpc))))
133132

134133
(rf/defn login-node-signal
135-
[{{:keys [recovered-account?] :as db} :db :as cofx} {:keys [settings account error]}]
134+
[{{:onboarding-2/keys [recovered-account? new-account?] :as db} :db :as cofx}
135+
{:keys [settings account error]}]
136136
(log/debug "[signals] node.login" "error" error)
137137
(if error
138138
{:db (update db :profile/login #(-> % (dissoc :processing) (assoc :error error)))}
139-
(let [{:keys [creating?]} (:profile/login db)]
140-
(rf/merge cofx
141-
{:db (dissoc db :profile/login)
142-
:dispatch-n [[:logging/initialize-web3-client-version]
143-
(when (and creating? (not recovered-account?))
144-
[:wallet/set-initial-blocks-range])]}
145-
(if (or creating? recovered-account?)
146-
(profile.create/login-new-profile recovered-account?)
147-
(login-existing-profile settings account))))))
139+
(rf/merge cofx
140+
{:db (dissoc db :profile/login)
141+
:dispatch-n [[:logging/initialize-web3-client-version]
142+
(when (and new-account? (not recovered-account?))
143+
[:wallet/set-initial-blocks-range])]}
144+
(login-existing-profile settings account))))
148145

149146
(rf/defn login-with-biometric-if-available
150147
{:events [:profile.login/login-with-biometric-if-available]}

src/status_im2/contexts/profile/recover/events.cljs

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414

1515
(rf/defn recover-profile-and-login
1616
{:events [:profile.recover/recover-and-login]}
17-
[_ {:keys [display-name password image-path color seed-phrase]}]
18-
{::restore-profile-and-login
17+
[{:keys [db]} {:keys [display-name password image-path color seed-phrase]}]
18+
{:db
19+
(assoc db :onboarding-2/recovered-account? true)
20+
21+
::restore-profile-and-login
1922
(merge (profile.config/create)
2023
{:displayName display-name
2124
:mnemonic (security/safe-unmask-data seed-phrase)

0 commit comments

Comments
 (0)