parent
dd2c3aa287
commit
3244fa49ce
|
@ -23,7 +23,7 @@
|
||||||
[status-im.accounts.recover.screen :refer [recover]]
|
[status-im.accounts.recover.screen :refer [recover]]
|
||||||
[status-im.accounts.screen :refer [accounts]]
|
[status-im.accounts.screen :refer [accounts]]
|
||||||
[status-im.transactions.screens.confirmation-success :refer [confirmation-success]]
|
[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.transactions.screens.transaction-details :refer [transaction-details]]
|
||||||
[status-im.chats-list.screen :refer [chats-list]]
|
[status-im.chats-list.screen :refer [chats-list]]
|
||||||
[status-im.new-chat.screen :refer [new-chat]]
|
[status-im.new-chat.screen :refer [new-chat]]
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
(let [component (case @modal-view
|
(let [component (case @modal-view
|
||||||
:qr-scanner qr-scanner
|
:qr-scanner qr-scanner
|
||||||
:qr-code-view qr-code-view
|
:qr-code-view qr-code-view
|
||||||
:pending-transactions pending-transactions
|
:unsigned-transactions unsigned-transactions
|
||||||
:transaction-details transaction-details
|
:transaction-details transaction-details
|
||||||
:confirmation-success confirmation-success
|
:confirmation-success confirmation-success
|
||||||
:contact-list-modal contact-list-modal)]
|
:contact-list-modal contact-list-modal)]
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
[status-im.accounts.recover.screen :refer [recover]]
|
[status-im.accounts.recover.screen :refer [recover]]
|
||||||
[status-im.accounts.screen :refer [accounts]]
|
[status-im.accounts.screen :refer [accounts]]
|
||||||
[status-im.transactions.screens.confirmation-success :refer [confirmation-success]]
|
[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.transactions.screens.transaction-details :refer [transaction-details]]
|
||||||
[status-im.chats-list.screen :refer [chats-list]]
|
[status-im.chats-list.screen :refer [chats-list]]
|
||||||
[status-im.new-chat.screen :refer [new-chat]]
|
[status-im.new-chat.screen :refer [new-chat]]
|
||||||
|
@ -133,7 +133,7 @@
|
||||||
(let [component (case @modal-view
|
(let [component (case @modal-view
|
||||||
:qr-scanner qr-scanner
|
:qr-scanner qr-scanner
|
||||||
:qr-code-view qr-code-view
|
:qr-code-view qr-code-view
|
||||||
:pending-transactions pending-transactions
|
:unsigned-transactions unsigned-transactions
|
||||||
:transaction-details transaction-details
|
:transaction-details transaction-details
|
||||||
:confirmation-success confirmation-success
|
:confirmation-success confirmation-success
|
||||||
:contact-list-modal contact-list-modal)]
|
:contact-list-modal contact-list-modal)]
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
;; && :navigation-replace <- on success
|
;; && :navigation-replace <- on success
|
||||||
|
|
||||||
|
|
||||||
(defmethod nav/preload-data! :pending-transactions
|
(defmethod nav/preload-data! :unsigned-transactions
|
||||||
[{:keys [transactions-queue] :as db} _]
|
[{:keys [transactions-queue] :as db} _]
|
||||||
(-> db
|
(-> db
|
||||||
(assoc :transactions transactions-queue
|
(assoc :transactions transactions-queue
|
||||||
|
@ -128,15 +128,17 @@
|
||||||
(status/discard-transaction id)))))
|
(status/discard-transaction id)))))
|
||||||
|
|
||||||
(register-handler ::transaction-queued
|
(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]}]]
|
(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)
|
(if (valid-hex? to)
|
||||||
(let [transaction {:id id
|
(let [transaction {:id id
|
||||||
:from from
|
:from from
|
||||||
:to to
|
:to to
|
||||||
:value (.toDecimal js/Web3.prototype value)
|
:value (.toDecimal js/Web3.prototype value)
|
||||||
:data data
|
:data data
|
||||||
|
:gas (.toDecimal js/Web3.prototype gas)
|
||||||
|
:gas-price (.toDecimal js/Web3.prototype gasPrice)
|
||||||
:message-id message_id}]
|
:message-id message_id}]
|
||||||
(assoc-in db [:transactions-queue id] transaction))
|
(assoc-in db [:transactions-queue id] transaction))
|
||||||
db))))
|
db))))
|
||||||
|
@ -155,7 +157,7 @@
|
||||||
(dispatch [::check-completed-transaction!
|
(dispatch [::check-completed-transaction!
|
||||||
{:message-id message-id}]))
|
{:message-id message-id}]))
|
||||||
(dispatch [::remove-transaction id]))
|
(dispatch [::remove-transaction id]))
|
||||||
(when (#{:pending-transactions :transaction-details} modal)
|
(when (#{:unsigned-transactions :transaction-details} modal)
|
||||||
(dispatch [:navigate-to-modal :confirmation-success])))))))
|
(dispatch [:navigate-to-modal :confirmation-success])))))))
|
||||||
|
|
||||||
(register-handler ::add-transactions-hash
|
(register-handler ::add-transactions-hash
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
(defn toolbar-view []
|
(defn toolbar-view []
|
||||||
[toolbar/toolbar
|
[toolbar/toolbar
|
||||||
{:background-color st/transactions-toolbar-background
|
{: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
|
:border-style st/toolbar-border
|
||||||
:custom-content [rn/view {:style st/toolbar-title-container}
|
:custom-content [rn/view {:style st/toolbar-title-container}
|
||||||
[rn/text {:style st/toolbar-title-text
|
[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-title} (i18n/label :t/data)]
|
||||||
[rn/text {:style st/details-data-content} content]])
|
[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]
|
[current-account [:get-current-account]
|
||||||
recipient [:contact-by-address to]]
|
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
|
[rn/view st/details-container
|
||||||
[detail-item (i18n/label :t/to) recipient-name true]
|
[detail-item (i18n/label :t/to) recipient-name true]
|
||||||
[detail-item (i18n/label :t/from) (:name current-account) true]
|
[detail-item (i18n/label :t/from) (:name current-account) true]
|
||||||
|
[detail-item (i18n/label :t/estimated-fee) estimated-fee]
|
||||||
[detail-data data]]))
|
[detail-data data]]))
|
||||||
|
|
||||||
(defview transaction-details []
|
(defview transaction-details []
|
||||||
[{:keys [id] :as transaction} [:get :selected-transaction]
|
[{:keys [id] :as transaction} [:get :selected-transaction]
|
||||||
{:keys [password]} [:get :confirm-transactions]
|
{:keys [password]} [:get :confirm-transactions]
|
||||||
confirmed? [:get-in [:transaction-details-ui-props :confirmed?]]]
|
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])}
|
:component-will-unmount #(rf/dispatch [:set-in [:transaction-details-ui-props :confirmed?] false])}
|
||||||
[rn/keyboard-avoiding-view {:style st/transactions-screen}
|
[rn/keyboard-avoiding-view {:style st/transactions-screen}
|
||||||
[status-bar/status-bar {:type (if platform/ios? :transparent :main)}]
|
[status-bar/status-bar {:type (if platform/ios? :transparent :main)}]
|
||||||
[toolbar-view]
|
[toolbar-view]
|
||||||
[rn/scroll-view st/details-screen-content-container
|
[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]
|
[common/separator st/details-separator st/details-separator-wrapper]
|
||||||
[details transaction]]
|
[details transaction]]
|
||||||
(when confirmed? [password-form/view 1])
|
(when confirmed? [password-form/view 1])
|
||||||
|
|
|
@ -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-macros [status-im.utils.views :refer [defview]])
|
||||||
(:require [re-frame.core :as rf]
|
(:require [re-frame.core :as rf]
|
||||||
[status-im.components.common.common :as common]
|
[status-im.components.common.common :as common]
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
:custom-content [rn/view {:style st/toolbar-title-container}
|
:custom-content [rn/view {:style st/toolbar-title-container}
|
||||||
[rn/text {:style st/toolbar-title-text
|
[rn/text {:style st/toolbar-title-text
|
||||||
:font :toolbar-title}
|
:font :toolbar-title}
|
||||||
(i18n/label :t/pending-transactions)]
|
(i18n/label :t/unsigned-transactions)]
|
||||||
[rn/text {:style st/toolbar-title-count
|
[rn/text {:style st/toolbar-title-count
|
||||||
:font :toolbar-title}
|
:font :toolbar-title}
|
||||||
(count transactions)]]}])
|
(count transactions)]]}])
|
||||||
|
@ -41,13 +41,13 @@
|
||||||
[rn/view
|
[rn/view
|
||||||
[transactions-list-item/view row]]]))
|
[transactions-list-item/view row]]]))
|
||||||
|
|
||||||
(defview pending-transactions []
|
(defview unsigned-transactions []
|
||||||
[transactions [:transactions]
|
[transactions [:transactions]
|
||||||
{:keys [password]} [:get :confirm-transactions]
|
{:keys [password]} [:get :confirm-transactions]
|
||||||
confirmed? [:get-in [:transactions-list-ui-props :confirmed?]]]
|
confirmed? [:get-in [:transactions-list-ui-props :confirmed?]]]
|
||||||
{:component-did-update #(when-not (seq transactions) (rf/dispatch [:navigate-back]))
|
{:component-did-update #(when-not (seq transactions) (rf/dispatch [:navigate-back]))
|
||||||
:component-will-unmount #(rf/dispatch [:set-in [:transactions-list-ui-props :confirmed?] false])}
|
: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)}]
|
[status-bar/status-bar {:type (if platform/ios? :transparent :main)}]
|
||||||
[toolbar-view transactions]
|
[toolbar-view transactions]
|
||||||
[rn/view {:style st/transactions-screen-content-container}
|
[rn/view {:style st/transactions-screen-content-container}
|
|
@ -33,7 +33,7 @@
|
||||||
{:ios {:background-color common/color-white
|
{:ios {:background-color common/color-white
|
||||||
:opacity 0.1}})
|
:opacity 0.1}})
|
||||||
|
|
||||||
;; pending-transactions
|
;; unsigned-transactions
|
||||||
|
|
||||||
(def transactions-screen
|
(def transactions-screen
|
||||||
{:flex 1
|
{:flex 1
|
||||||
|
|
|
@ -279,7 +279,7 @@
|
||||||
:other "{{count}} transactions confirmed"
|
:other "{{count}} transactions confirmed"
|
||||||
:zero "No transactions confirmed"}
|
:zero "No transactions confirmed"}
|
||||||
:transaction "Transaction"
|
:transaction "Transaction"
|
||||||
:pending-transactions "Pending transactions"
|
:unsigned-transactions "Unsigned transactions"
|
||||||
:enter-password-transactions {:one "Confirm transaction by entering your password"
|
:enter-password-transactions {:one "Confirm transaction by entering your password"
|
||||||
:other "Confirm transactions by entering your password"}
|
:other "Confirm transactions by entering your password"}
|
||||||
:status "Status"
|
:status "Status"
|
||||||
|
@ -287,6 +287,7 @@
|
||||||
:recipient "Recipient"
|
:recipient "Recipient"
|
||||||
:one-more-item "One more item"
|
:one-more-item "One more item"
|
||||||
:fee "Fee"
|
:fee "Fee"
|
||||||
|
:estimated-fee "Est. fee"
|
||||||
:value "Value"
|
:value "Value"
|
||||||
:to "To"
|
:to "To"
|
||||||
:from "From"
|
:from "From"
|
||||||
|
|
Loading…
Reference in New Issue