login to account after creating it to enable it in whisper

This commit is contained in:
Adrian Tiberius 2016-06-30 20:28:51 +03:00
parent 3a3a39b71d
commit df229035e7
2 changed files with 10 additions and 4 deletions

View File

@ -8,7 +8,7 @@ import android.util.Log;
import java.lang.ref.WeakReference;
import com.github.ethereum.go_ethereum.Statusgo;
import com.github.status_im.status_go.Statusgo;
import java.io.File;

View File

@ -15,7 +15,7 @@
(update db :accounts assoc address account))
((after save-account))))
(defn account-created [result]
(defn account-created [result password]
(let [data (json->clj result)
public-key (:pubkey data)
address (:address data)
@ -24,10 +24,16 @@
(log/debug "Created account: " result)
(when (not (str/blank? public-key))
(do
(dispatch [:login-account address password])
(dispatch [:initialize-protocol account])
(dispatch [:add-account account])))))
(register-handler :create-account
(-> (fn [db [_ password]]
(.createAccount geth password (fn [result] (account-created result)))
(.createAccount geth password (fn [result] (account-created result password)))
db)))
(register-handler :login-account
(-> (fn [db [_ address password]]
(.login geth address password (fn [result] (log/debug "Logged in account: " address result)))
db)))