mirror of
https://github.com/status-im/status-react.git
synced 2025-02-25 09:05:55 +00:00
[fix 5688] fix calculating node version
Signed-off-by: Adam Babik <a.babik@designfortress.com>
This commit is contained in:
parent
e9399167f6
commit
1fff9d7c19
@ -160,7 +160,9 @@
|
||||
(defn initialize-account [address {:keys [web3] :as cofx}]
|
||||
(handlers-macro/merge-fx cofx
|
||||
{:web3/set-default-account [web3 address]
|
||||
:web3/fetch-node-version web3
|
||||
:web3/fetch-node-version [web3
|
||||
#(re-frame/dispatch
|
||||
[:web3/fetch-node-version-callback %])]
|
||||
:notifications/get-fcm-token nil}
|
||||
(initialize-account-db address)
|
||||
(models.protocol/initialize-protocol address)
|
||||
|
@ -39,15 +39,15 @@
|
||||
(ethereum/normalized-address address)))
|
||||
|
||||
(defn fetch-node-version
|
||||
[web3]
|
||||
[web3 cb]
|
||||
(.. web3
|
||||
-version
|
||||
(getNode
|
||||
(fn [err resp]
|
||||
(when-not err
|
||||
(re-frame/dispatch [:web3/fetch-node-version-callback resp]))))))
|
||||
(cb resp))))))
|
||||
|
||||
(defn fetch-node-version-callback
|
||||
[resp {:keys [db]}]
|
||||
(when-let [git-commit (nth (re-find #"-([0-9a-f]{7,})/" resp) 1)]
|
||||
{:db (assoc db :web3-node-version git-commit)}))
|
||||
(when-let [node-version (second (re-find #"StatusIM/v(.*)/.*/.*" resp))]
|
||||
{:db (assoc db :web3-node-version node-version)}))
|
||||
|
@ -20,7 +20,8 @@
|
||||
|
||||
(re-frame/reg-fx
|
||||
:web3/fetch-node-version
|
||||
web3/fetch-node-version)
|
||||
(fn [[web3 cb]]
|
||||
(web3/fetch-node-version web3 cb)))
|
||||
|
||||
;;;; Events
|
||||
(handlers/register-handler-fx
|
||||
|
Loading…
x
Reference in New Issue
Block a user