fixed error on invalid utf-8 from dapp
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
parent
b7a92505bc
commit
de03fc2d6a
|
@ -20,7 +20,9 @@
|
|||
(.toAscii dependencies/Web3.prototype s))
|
||||
|
||||
(defn to-utf8 [s]
|
||||
(.toUtf8 dependencies/Web3.prototype (str s)))
|
||||
(try
|
||||
(.toUtf8 dependencies/Web3.prototype (str s))
|
||||
(catch :default err nil)))
|
||||
|
||||
(defn sha3 [s]
|
||||
(.sha3 dependencies/Web3.prototype s))
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
[status-im.utils.money :as money]
|
||||
[status-im.utils.types :as types]
|
||||
[status-im.utils.utils :as utils]
|
||||
[status-im.constants :as constants]))
|
||||
[status-im.constants :as constants]
|
||||
[status-im.transport.utils :as transport.utils]))
|
||||
|
||||
;;;; FX
|
||||
|
||||
|
@ -158,11 +159,13 @@
|
|||
|
||||
(= method constants/web3-personal-sign)
|
||||
|
||||
(let [{:keys [data]} args]
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :transactions-unsigned id] {:data data :id id})
|
||||
(assoc-in [:wallet :send-transaction] {:id id :method method}))
|
||||
:dispatch [:navigate-to-modal :wallet-sign-message-modal]}))))
|
||||
(let [{:keys [data]} args
|
||||
data' (transport.utils/to-utf8 data)]
|
||||
(when data'
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :transactions-unsigned id] {:data data' :id id})
|
||||
(assoc-in [:wallet :send-transaction] {:id id :method method}))
|
||||
:dispatch [:navigate-to-modal :wallet-sign-message-modal]})))))
|
||||
|
||||
(defn this-transaction-signing? [id signing-id view-id modal]
|
||||
(and (= signing-id id)
|
||||
|
|
|
@ -273,7 +273,7 @@
|
|||
(i18n/label :t/message)
|
||||
[components/amount-input {:disabled? true
|
||||
:input-options {:multiline true
|
||||
:default-value (transport.utils/to-utf8 data)}}]]]]
|
||||
:default-value data}}]]]]
|
||||
[signing-buttons
|
||||
#(re-frame/dispatch [:wallet/discard-transaction-navigate-back])
|
||||
#(re-frame/dispatch [:wallet/sign-transaction-modal])
|
||||
|
|
Loading…
Reference in New Issue