Remove balances for deleted watch account

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
acolytec3 2019-12-21 08:31:48 -05:00 committed by Churikova Tetiana
parent 4fe49568f7
commit 8eed77a82a
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
1 changed files with 5 additions and 2 deletions

View File

@ -102,12 +102,15 @@
{:events [:wallet.accounts/delete-account]}
[{:keys [db] :as cofx} account]
(let [accounts (:multiaccount/accounts db)
new-accounts (vec (remove #(= account %) accounts))]
new-accounts (vec (remove #(= account %) accounts))
deleted-address (get-in account [:address])]
(fx/merge cofx
{::json-rpc/call [{:method "accounts_deleteAccount"
:params [(:address account)]
:on-success #()}]
:db (assoc db :multiaccount/accounts new-accounts)}
:db (-> db
(assoc :multiaccount/accounts new-accounts)
(assoc-in [:wallet :accounts deleted-address] nil))}
(navigation/navigate-to-cofx :wallet nil))))
(fx/defn save-generated-account