set defaultAccount when getting web3

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
Eric Dvorsak 2018-05-08 12:35:24 +02:00 committed by Julien Eluard
parent 7334938d96
commit d876895492
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
1 changed files with 7 additions and 2 deletions

View File

@ -9,13 +9,18 @@
[status-im.utils.handlers :as handlers]
[status-im.utils.handlers-macro :as handlers-macro]
[status-im.utils.web3-provider :as web3-provider]
[status-im.transport.core :as transport]))
[status-im.transport.core :as transport]
[status-im.utils.ethereum.core :as ethereum]))
;;;; COFX
(re-frame/reg-cofx
::get-web3
(fn [coeffects _]
(assoc coeffects :web3 (web3-provider/make-web3))))
(let [web3 (web3-provider/make-web3)
address (get-in coeffects [:db :account/account :address])]
(set! (.-defaultAccount (.-eth web3))
(ethereum/normalized-address address))
(assoc coeffects :web3 web3))))
(re-frame/reg-fx
::web3-get-syncing