handle hash-message failure correctly

Signed-off-by: Michele Balistreri <michele@bitgamma.com>
This commit is contained in:
Michele Balistreri 2021-05-31 12:31:29 +02:00
parent 114e704b78
commit 213c288cc1
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
1 changed files with 9 additions and 4 deletions

View File

@ -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]}]