[fix #8759] Сan't send funds from added account

- save added account in keystore properly so that it can be used
- still needs a fix in status-go so that it works without having to relogin
This commit is contained in:
yenda 2019-08-24 18:51:05 +02:00
parent b4b93aa3f7
commit 3597978131
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
2 changed files with 22 additions and 13 deletions

View File

@ -1881,11 +1881,11 @@
:wallet.send/transaction
:<- [::send-transaction]
:<- [:wallet]
:<- [:network-status]
:<- [:offline?]
:<- [:wallet/all-tokens]
:<- [:ethereum/chain-keyword]
(fn [[{:keys [amount symbol from to amount-error] :as transaction}
wallet network-status all-tokens chain]]
wallet offline? all-tokens chain]]
(let [balance (get-in wallet [:accounts from :balance])
token (tokens/asset-for all-tokens chain symbol)]
(assoc (merge transaction
@ -1896,7 +1896,7 @@
:sign-enabled? (and to
(nil? amount-error)
(not (nil? amount))
(= :online network-status))))))
(not offline?))))))
;; NETWORK SETTINGS

View File

@ -32,11 +32,20 @@
(status/multiaccount-derive-addresses
id
[path]
#(re-frame/dispatch [:wallet.accounts/account-generated
(merge
(get (types/json->clj %) (keyword path))
(fn [result]
(status/multiaccount-store-derived
id
[path]
password
(fn [result]
(let [{:keys [public-key address]}
(get (types/json->clj result) (keyword path))]
(re-frame/dispatch [:wallet.accounts/account-generated
{:name (str "Account " path-num)
:color (rand-nth colors/account-colors)})])))))))))
:address address
:public-key public-key
:path path
:color (rand-nth colors/account-colors)}])))))))))))))
(fx/defn set-symbol-request
{:events [:wallet.accounts/share]}
@ -61,13 +70,13 @@
{:events [:wallet.accounts/save-generated-account]}
[{:keys [db] :as cofx}]
(let [{:keys [accounts latest-derived-path]} (:multiaccount db)
new-account (assoc (get-in db [:generate-account :account])
:path (str constants/path-root "/" latest-derived-path))]
{:keys [account]} (:generate-account db)]
(fx/merge cofx
{::json-rpc/call [{:method "accounts_saveAccounts"
:params [[new-account]]
:on-success #()}]}
(multiaccounts.update/multiaccount-update {:accounts (conj accounts new-account)
:params [[account]]
:on-success #()}]
:db (dissoc db :generate-account)}
(multiaccounts.update/multiaccount-update {:accounts (conj accounts account)
:latest-derived-path (inc latest-derived-path)} nil)
(wallet/update-balances nil)
(navigation/navigate-to-cofx :wallet nil))))