Transaction fixes (#997, #1004)

This commit is contained in:
alwx 2017-04-18 11:16:59 +03:00 committed by Roman Volosovskyi
parent ac7da93387
commit c8a3d13ca3
6 changed files with 19 additions and 16 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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"