Andrey Shovkoplyas 2017-05-30 14:45:38 +02:00 committed by Roman Volosovskyi
parent 034ff3e413
commit 1a3e346543
5 changed files with 13 additions and 10 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -309,6 +309,7 @@
:from "From"
:data "Data"
:got-it "Got it"
:contract-creation "Contract Creation"
;:webview
:web-view-error "oops, error"})