diff --git a/src/status_im/transactions/handlers.cljs b/src/status_im/transactions/handlers.cljs index c73f21c41d..d0a4ccaa18 100644 --- a/src/status_im/transactions/handlers.cljs +++ b/src/status_im/transactions/handlers.cljs @@ -116,18 +116,21 @@ (fn [db [_ message-id]] (remove-pending-message db message-id))) +(defn transaction-valid? [{{:keys [to data]} :args}] + (or (and to (valid-hex? to)) (and data (not= data "0x")))) + (register-handler :transaction-queued (u/side-effect! - (fn [_ [_ {:keys [id args] :as transaction}]] - (if (:to args) + (fn [_ [_ {:keys [id] :as transaction}]] + (if (transaction-valid? transaction) (dispatch [::transaction-queued transaction]) (status/discard-transaction id))))) (register-handler ::transaction-queued (after #(dispatch [:navigate-to-modal :unsigned-transactions])) - (fn [db [_ {:keys [id message_id args]}]] + (fn [db [_ {:keys [id message_id args] :as transaction}]] (let [{:keys [from to value data gas gasPrice]} args] - (if (valid-hex? to) + (if (transaction-valid? transaction) (let [transaction {:id id :from from :to to diff --git a/src/status_im/transactions/screens/transaction_details.cljs b/src/status_im/transactions/screens/transaction_details.cljs index 4ecb3f25a2..858c9b1436 100644 --- a/src/status_im/transactions/screens/transaction_details.cljs +++ b/src/status_im/transactions/screens/transaction_details.cljs @@ -39,7 +39,7 @@ (defview details [{:keys [to data gas gas-price] :as transaction}] [current-account [:get-current-account] recipient [:contact-by-address to]] - (let [recipient-name (or (:name recipient) to) + (let [recipient-name (or (:name recipient) to (i18n/label :t/contract-creation)) gas-price (.fromWei js/Web3.prototype gas-price "ether") fee-value (* gas gas-price) estimated-fee (str fee-value " ETH")] diff --git a/src/status_im/transactions/subs.cljs b/src/status_im/transactions/subs.cljs index ee0df27c1a..74af783500 100644 --- a/src/status_im/transactions/subs.cljs +++ b/src/status_im/transactions/subs.cljs @@ -10,10 +10,9 @@ (register-sub :contacts-by-address (fn [db] (reaction (into {} (map (fn [[_ {:keys [address] :as contact}]] - [address contact]) - - (:contacts @db) - ))))) + (when address + [address contact])) + (:contacts @db)))))) (register-sub :contact-by-address (fn [_ [_ address]] diff --git a/src/status_im/transactions/views/list_item.cljs b/src/status_im/transactions/views/list_item.cljs index da8a0784a7..d079c66547 100644 --- a/src/status_im/transactions/views/list_item.cljs +++ b/src/status_im/transactions/views/list_item.cljs @@ -32,7 +32,7 @@ [recipient [:contact-by-address to]] (let [eth-value (.fromWei js/Web3.prototype value "ether") value (str (i18n/label-number eth-value) " ETH") - recipient-name (or (:name recipient) to)] + recipient-name (or (:name recipient) to (i18n/label :t/contract-creation))] [rn/view {:style st/item} [item-image recipient] [item-info recipient-name value] diff --git a/src/status_im/translations/en.cljs b/src/status_im/translations/en.cljs index ee8bd3c2a2..006f3112f1 100644 --- a/src/status_im/translations/en.cljs +++ b/src/status_im/translations/en.cljs @@ -309,6 +309,7 @@ :from "From" :data "Data" :got-it "Got it" + :contract-creation "Contract Creation" ;:webview :web-view-error "oops, error"})