diff --git a/resources/commands.js b/resources/commands.js index c2e833b15f..36b16d4272 100644 --- a/resources/commands.js +++ b/resources/commands.js @@ -796,11 +796,7 @@ function sendTransaction(params, context) { try { return web3.eth.sendTransaction(data); } catch (err) { - var error = status.components.validationMessage( - "Error", - err.message - ); - return {error: {markup: error}}; + return {error: err.message}; } } diff --git a/src/status_im/chat/handlers/commands.cljs b/src/status_im/chat/handlers/commands.cljs index f638d59c72..68c2516a1b 100644 --- a/src/status_im/chat/handlers/commands.cljs +++ b/src/status_im/chat/handlers/commands.cljs @@ -10,9 +10,9 @@ (handlers/register-handler :request-command-data (handlers/side-effect! - (fn [{:keys [chats] :as db} + (fn [{:keys [chats current-account-id] :as db} [_ {{:keys [command params content-command type]} :content - :keys [message-id chat-id address on-requested] :as message} data-type]] + :keys [message-id chat-id on-requested] :as message} data-type]] (if-not (get-in chats [chat-id :commands-loaded]) (do (dispatch [:add-commands-loading-callback chat-id @@ -24,7 +24,7 @@ to (get-in db [:contacts chat-id :address]) params {:parameters params :context (merge {:platform platform/platform - :from address + :from current-account-id :to to} i18n/delimeters)} callback #(let [result (get-in % [:result :returned]) diff --git a/src/status_im/chat/views/input/validation_messages.cljs b/src/status_im/chat/views/input/validation_messages.cljs index a46f2bd0be..de1a7a3219 100644 --- a/src/status_im/chat/views/input/validation_messages.cljs +++ b/src/status_im/chat/views/input/validation_messages.cljs @@ -2,7 +2,8 @@ (:require-macros [status-im.utils.views :refer [defview]]) (:require [status-im.components.react :as c] [status-im.chat.styles.input.validation-message :as style] - [status-im.utils.listview :as lw])) + [status-im.utils.listview :as lw] + [status-im.i18n :as i18n])) (defn validation-message [{:keys [title description]}] [c/view style/message-container @@ -18,7 +19,10 @@ (defview validation-messages-view [] [chat-input-margin [:chat-input-margin] input-height [:chat-ui-props :input-height] - markup [:chat-ui-props :validation-messages]] - (when markup + messages [:chat-ui-props :validation-messages]] + (when messages [c/view (style/root (+ input-height chat-input-margin)) - [messages-list markup]])) + (if (string? messages) + [messages-list [validation-message {:title (i18n/label :t/error) + :description messages}]] + [messages-list messages])])) diff --git a/src/status_im/components/status.cljs b/src/status_im/components/status.cljs index cf29264e38..c8c69f6fae 100644 --- a/src/status_im/components/status.cljs +++ b/src/status_im/components/status.cljs @@ -75,7 +75,7 @@ (defn restart-rpc [] (when-not @restarting-rpc (reset! restarting-rpc true) - (log/debug :restrt-rpc-on-post-error) + (log/debug :restart-rpc-on-post-error) ;; todo maybe it would be better to use something like ;; restart-rpc-server on status-go side diff --git a/src/status_im/transactions/handlers.cljs b/src/status_im/transactions/handlers.cljs index 754fbab6fa..6b673c2081 100644 --- a/src/status_im/transactions/handlers.cljs +++ b/src/status_im/transactions/handlers.cljs @@ -194,7 +194,7 @@ (register-handler :transaction-failed (u/side-effect! - (fn [_ [_ {:keys [id message_id error_code]}]] + (fn [_ [_ {:keys [id message_id error_code error_message] :as event}]] (cond (= error_code wrong-password-code) @@ -204,9 +204,11 @@ (do (when message_id (dispatch [::remove-pending-message message_id])) (dispatch [:clear-selected-transaction]) - (dispatch [::remove-transaction id])) + (dispatch [::remove-transaction id]) + (dispatch [:set-chat-ui-props :validation-messages error_message])) - :else nil)))) + :else + (dispatch [:set-chat-ui-props :validation-messages nil]))))) (register-handler :clear-selected-transaction (fn [db _] diff --git a/src/status_im/translations/en.cljs b/src/status_im/translations/en.cljs index b765274e65..f7d5153fbf 100644 --- a/src/status_im/translations/en.cljs +++ b/src/status_im/translations/en.cljs @@ -13,6 +13,7 @@ :next "Next" :type-a-message "Type a message..." :type-a-command "Start typing a command..." + :error "Error" ;drawer :invite-friends "Invite friends"