From 213c288cc1da157da47b2f820dc70ce20062ebf3 Mon Sep 17 00:00:00 2001 From: Michele Balistreri Date: Mon, 31 May 2021 12:31:29 +0200 Subject: [PATCH] handle hash-message failure correctly Signed-off-by: Michele Balistreri --- src/status_im/signing/keycard.cljs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/status_im/signing/keycard.cljs b/src/status_im/signing/keycard.cljs index e61cd1f47c..de2fd23b67 100644 --- a/src/status_im/signing/keycard.cljs +++ b/src/status_im/signing/keycard.cljs @@ -3,6 +3,7 @@ [status-im.ethereum.abi-spec :as abi-spec] [status-im.native-module.core :as status] [status-im.utils.fx :as fx] + [status-im.i18n.i18n :as i18n] [status-im.utils.types :as types] [taoensso.timbre :as log])) @@ -62,10 +63,14 @@ {:events [:signing.keycard.callback/hash-message-completed]} [{:keys [db]} data typed? result] (let [{:keys [result error]} (types/json->clj result)] - {:db (update db :keycard assoc - :hash result - :typed? typed? - :data data)})) + (if error + {:dispatch [:signing.ui/cancel-is-pressed] + :utils/show-popup {:title (i18n/label :t/sign-request-failed) + :content (:message error)}} + {:db (update db :keycard assoc + :hash result + :typed? typed? + :data data)}))) (fx/defn hash-transaction [{:keys [db]}]