bug #4876 - cleaning up succesful and failed dapp transactions and added stricter check for chat wallet onboarding

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
Goran Jovic 2018-06-21 11:40:46 +02:00 committed by Julien Eluard
parent 8bf083cf88
commit ac2780e577
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
2 changed files with 12 additions and 3 deletions

View File

@ -184,10 +184,12 @@
(accounts.utils/account-update {:dev-mode? dev-mode} cofx))) (accounts.utils/account-update {:dev-mode? dev-mode} cofx)))
(defn wallet-set-up-passed [db cofx] (defn wallet-set-up-passed [db cofx]
(let [transaction (seq (get-in db [:wallet :send-transaction]))] (let [transaction (get-in db [:wallet :send-transaction])]
(merge (merge
{:db (navigation/navigate-back db)} {:db (navigation/navigate-back db)}
(when transaction (when (and (seq transaction)
(not (:in-progress? transaction))
(:from-chat? transaction))
{:dispatch [:navigate-to :wallet-send-transaction-chat]})))) {:dispatch [:navigate-to :wallet-send-transaction-chat]}))))
(handlers/register-handler-fx (handlers/register-handler-fx

View File

@ -119,6 +119,8 @@
:signing? false :signing? false
:wrong-password? false :wrong-password? false
:waiting-signal? false :waiting-signal? false
:from-chat? false
:in-progress? false
:password nil}) :password nil})
(defn on-transactions-completed [raw-results] (defn on-transactions-completed [raw-results]
@ -213,6 +215,11 @@
(= modal :wallet-send-transaction-modal) (= modal :wallet-send-transaction-modal)
(= modal :wallet-sign-message-modal)))) (= modal :wallet-sign-message-modal))))
(defn handle-failed-tx [cofx error_message]
(-> cofx
(assoc ::show-transaction-error error_message)
(update-in [:db :wallet] dissoc :send-transaction)))
;;TRANSACTION FAILED signal from status-go ;;TRANSACTION FAILED signal from status-go
(handlers/register-handler-fx (handlers/register-handler-fx
:sign-request-failed :sign-request-failed
@ -232,7 +239,7 @@
(update-in [:wallet :send-transaction] merge clear-send-properties)) (update-in [:wallet :send-transaction] merge clear-send-properties))
:dispatch [:navigate-back]} :dispatch [:navigate-back]}
(= method constants/web3-send-transaction) (= method constants/web3-send-transaction)
(assoc ::show-transaction-error error_message)) (handle-failed-tx error_message))
{:db (update-in db [:wallet :transactions-unsigned] dissoc id)}))))) {:db (update-in db [:wallet :transactions-unsigned] dissoc id)})))))
(defn prepare-unconfirmed-transaction [db now hash id] (defn prepare-unconfirmed-transaction [db now hash id]