diff --git a/src/status_im/android/core.cljs b/src/status_im/android/core.cljs index b5f6bdf709..13ba9bac22 100644 --- a/src/status_im/android/core.cljs +++ b/src/status_im/android/core.cljs @@ -23,7 +23,7 @@ [status-im.accounts.recover.screen :refer [recover]] [status-im.accounts.screen :refer [accounts]] [status-im.transactions.screens.confirmation-success :refer [confirmation-success]] - [status-im.transactions.screens.pending-transactions :refer [pending-transactions]] + [status-im.transactions.screens.unsigned-transactions :refer [unsigned-transactions]] [status-im.transactions.screens.transaction-details :refer [transaction-details]] [status-im.chats-list.screen :refer [chats-list]] [status-im.new-chat.screen :refer [new-chat]] @@ -151,7 +151,7 @@ (let [component (case @modal-view :qr-scanner qr-scanner :qr-code-view qr-code-view - :pending-transactions pending-transactions + :unsigned-transactions unsigned-transactions :transaction-details transaction-details :confirmation-success confirmation-success :contact-list-modal contact-list-modal)] diff --git a/src/status_im/ios/core.cljs b/src/status_im/ios/core.cljs index 86c7491092..a4368bfcf7 100644 --- a/src/status_im/ios/core.cljs +++ b/src/status_im/ios/core.cljs @@ -21,7 +21,7 @@ [status-im.accounts.recover.screen :refer [recover]] [status-im.accounts.screen :refer [accounts]] [status-im.transactions.screens.confirmation-success :refer [confirmation-success]] - [status-im.transactions.screens.pending-transactions :refer [pending-transactions]] + [status-im.transactions.screens.unsigned-transactions :refer [unsigned-transactions]] [status-im.transactions.screens.transaction-details :refer [transaction-details]] [status-im.chats-list.screen :refer [chats-list]] [status-im.new-chat.screen :refer [new-chat]] @@ -133,7 +133,7 @@ (let [component (case @modal-view :qr-scanner qr-scanner :qr-code-view qr-code-view - :pending-transactions pending-transactions + :unsigned-transactions unsigned-transactions :transaction-details transaction-details :confirmation-success confirmation-success :contact-list-modal contact-list-modal)] diff --git a/src/status_im/transactions/handlers.cljs b/src/status_im/transactions/handlers.cljs index 064df8ca6c..754fbab6fa 100644 --- a/src/status_im/transactions/handlers.cljs +++ b/src/status_im/transactions/handlers.cljs @@ -22,7 +22,7 @@ ;; && :navigation-replace <- on success -(defmethod nav/preload-data! :pending-transactions +(defmethod nav/preload-data! :unsigned-transactions [{:keys [transactions-queue] :as db} _] (-> db (assoc :transactions transactions-queue @@ -128,15 +128,17 @@ (status/discard-transaction id))))) (register-handler ::transaction-queued - (after #(dispatch [:navigate-to-modal :pending-transactions])) + (after #(dispatch [:navigate-to-modal :unsigned-transactions])) (fn [db [_ {:keys [id message_id args]}]] - (let [{:keys [from to value data]} args] + (let [{:keys [from to value data gas gasPrice]} args] (if (valid-hex? to) (let [transaction {:id id :from from :to to :value (.toDecimal js/Web3.prototype value) :data data + :gas (.toDecimal js/Web3.prototype gas) + :gas-price (.toDecimal js/Web3.prototype gasPrice) :message-id message_id}] (assoc-in db [:transactions-queue id] transaction)) db)))) @@ -155,7 +157,7 @@ (dispatch [::check-completed-transaction! {:message-id message-id}])) (dispatch [::remove-transaction id])) - (when (#{:pending-transactions :transaction-details} modal) + (when (#{:unsigned-transactions :transaction-details} modal) (dispatch [:navigate-to-modal :confirmation-success]))))))) (register-handler ::add-transactions-hash diff --git a/src/status_im/transactions/screens/transaction_details.cljs b/src/status_im/transactions/screens/transaction_details.cljs index fd3a6a212d..13274ce7b7 100644 --- a/src/status_im/transactions/screens/transaction_details.cljs +++ b/src/status_im/transactions/screens/transaction_details.cljs @@ -16,7 +16,7 @@ (defn toolbar-view [] [toolbar/toolbar {:background-color st/transactions-toolbar-background - :nav-action (act/back-white #(rf/dispatch [:navigate-to-modal :pending-transactions])) + :nav-action (act/back-white #(rf/dispatch [:navigate-to-modal :unsigned-transactions])) :border-style st/toolbar-border :custom-content [rn/view {:style st/toolbar-title-container} [rn/text {:style st/toolbar-title-text @@ -35,26 +35,30 @@ [rn/text {:style st/details-data-title} (i18n/label :t/data)] [rn/text {:style st/details-data-content} content]]) -(defview details [{:keys [to data] :as transaction}] +(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) + gas-price (.fromWei js/Web3.prototype gas-price "ether") + fee-value (* gas gas-price) + estimated-fee (str fee-value " ETH")] [rn/view st/details-container [detail-item (i18n/label :t/to) recipient-name true] [detail-item (i18n/label :t/from) (:name current-account) true] + [detail-item (i18n/label :t/estimated-fee) estimated-fee] [detail-data data]])) (defview transaction-details [] [{:keys [id] :as transaction} [:get :selected-transaction] {:keys [password]} [:get :confirm-transactions] confirmed? [:get-in [:transaction-details-ui-props :confirmed?]]] - {:component-did-update #(when-not transaction (rf/dispatch [:navigate-to-modal :pending-transactions])) + {:component-did-update #(when-not transaction (rf/dispatch [:navigate-to-modal :unsigned-transactions])) :component-will-unmount #(rf/dispatch [:set-in [:transaction-details-ui-props :confirmed?] false])} [rn/keyboard-avoiding-view {:style st/transactions-screen} [status-bar/status-bar {:type (if platform/ios? :transparent :main)}] [toolbar-view] [rn/scroll-view st/details-screen-content-container - [transactions-list-item/view transaction #(rf/dispatch [:navigate-to-modal :pending-transactions])] + [transactions-list-item/view transaction #(rf/dispatch [:navigate-to-modal :unsigned-transactions])] [common/separator st/details-separator st/details-separator-wrapper] [details transaction]] (when confirmed? [password-form/view 1]) diff --git a/src/status_im/transactions/screens/pending_transactions.cljs b/src/status_im/transactions/screens/unsigned_transactions.cljs similarity index 92% rename from src/status_im/transactions/screens/pending_transactions.cljs rename to src/status_im/transactions/screens/unsigned_transactions.cljs index 1f028df30e..e307344ce0 100644 --- a/src/status_im/transactions/screens/pending_transactions.cljs +++ b/src/status_im/transactions/screens/unsigned_transactions.cljs @@ -1,4 +1,4 @@ -(ns status-im.transactions.screens.pending-transactions +(ns status-im.transactions.screens.unsigned-transactions (:require-macros [status-im.utils.views :refer [defview]]) (:require [re-frame.core :as rf] [status-im.components.common.common :as common] @@ -23,7 +23,7 @@ :custom-content [rn/view {:style st/toolbar-title-container} [rn/text {:style st/toolbar-title-text :font :toolbar-title} - (i18n/label :t/pending-transactions)] + (i18n/label :t/unsigned-transactions)] [rn/text {:style st/toolbar-title-count :font :toolbar-title} (count transactions)]]}]) @@ -41,13 +41,13 @@ [rn/view [transactions-list-item/view row]]])) -(defview pending-transactions [] +(defview unsigned-transactions [] [transactions [:transactions] {:keys [password]} [:get :confirm-transactions] confirmed? [:get-in [:transactions-list-ui-props :confirmed?]]] {:component-did-update #(when-not (seq transactions) (rf/dispatch [:navigate-back])) :component-will-unmount #(rf/dispatch [:set-in [:transactions-list-ui-props :confirmed?] false])} - [rn/keyboard-avoiding-view {:style st/transactions-screen} + [(if platform/ios? rn/keyboard-avoiding-view rn/view) (merge {:behavior :padding} st/transactions-screen) [status-bar/status-bar {:type (if platform/ios? :transparent :main)}] [toolbar-view transactions] [rn/view {:style st/transactions-screen-content-container} diff --git a/src/status_im/transactions/styles/screens.cljs b/src/status_im/transactions/styles/screens.cljs index 88c2d75dd4..f0b0a42bfc 100644 --- a/src/status_im/transactions/styles/screens.cljs +++ b/src/status_im/transactions/styles/screens.cljs @@ -33,7 +33,7 @@ {:ios {:background-color common/color-white :opacity 0.1}}) -;; pending-transactions +;; unsigned-transactions (def transactions-screen {:flex 1 diff --git a/src/status_im/translations/en.cljs b/src/status_im/translations/en.cljs index 9460c88576..789a968a7f 100644 --- a/src/status_im/translations/en.cljs +++ b/src/status_im/translations/en.cljs @@ -279,7 +279,7 @@ :other "{{count}} transactions confirmed" :zero "No transactions confirmed"} :transaction "Transaction" - :pending-transactions "Pending transactions" + :unsigned-transactions "Unsigned transactions" :enter-password-transactions {:one "Confirm transaction by entering your password" :other "Confirm transactions by entering your password"} :status "Status" @@ -287,6 +287,7 @@ :recipient "Recipient" :one-more-item "One more item" :fee "Fee" + :estimated-fee "Est. fee" :value "Value" :to "To" :from "From"