From c466f9632615404eace68c4fda02be4416b5818a Mon Sep 17 00:00:00 2001 From: andrey Date: Mon, 10 Jan 2022 12:44:07 +0100 Subject: [PATCH] [#12535] Human Readable data display when signing using eth_signTypedData_v3 Signed-off-by: andrey --- src/status_im/signing/core.cljs | 4 +++- src/status_im/utils/types.cljs | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/status_im/signing/core.cljs b/src/status_im/signing/core.cljs index 217c936361..b407cb0207 100644 --- a/src/status_im/signing/core.cljs +++ b/src/status_im/signing/core.cljs @@ -236,7 +236,9 @@ :signing/sign {:type (cond pinless? :pinless keycard-multiaccount? :keycard :else :password) - :formatted-data (if typed? (types/json->clj data) (ethereum/hex->text data)) + :formatted-data (if typed? + (types/js->pretty-json (types/json->js data)) + (ethereum/hex->text data)) :keycard-step (when pinless? :connect)}) :show-signing-sheet nil} #(when-not wallet-set-up-passed? diff --git a/src/status_im/utils/types.cljs b/src/status_im/utils/types.cljs index adac5536e7..296eadc218 100644 --- a/src/status_im/utils/types.cljs +++ b/src/status_im/utils/types.cljs @@ -13,6 +13,9 @@ (defn clj->pretty-json [data spaces] (.stringify js/JSON (clj-bean/->js data) nil spaces)) +(defn js->pretty-json [data] + (.stringify js/JSON data nil 2)) + (defn clj->json [data] (clj->pretty-json data 0))