Add currency conversions for signing sheet
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
parent
4eac209b9b
commit
72867473d0
|
@ -46,11 +46,6 @@
|
|||
(defn separator []
|
||||
[react/view {:height 1 :background-color colors/gray-lighter}])
|
||||
|
||||
(defn acc-text [txt1 txt2]
|
||||
[react/nested-text nil
|
||||
txt1 " "
|
||||
[{:style {:color colors/gray}} txt2]])
|
||||
|
||||
(defn displayed-name [contact]
|
||||
(if (or (:preferred-name contact) (:name contact))
|
||||
(multiaccounts/displayed-name contact)
|
||||
|
@ -218,9 +213,13 @@
|
|||
sign [:signing/sign]
|
||||
chain [:ethereum/chain-keyword]
|
||||
{:keys [amount-error gas-error]} [:signing/amount-errors (:address from)]
|
||||
keycard-multiaccount? [:keycard-multiaccount?]]
|
||||
keycard-multiaccount? [:keycard-multiaccount?]
|
||||
prices [:prices]
|
||||
wallet-currency [:wallet/currency]]
|
||||
(let [display-symbol (wallet.utils/display-symbol token)
|
||||
fee-display-symbol (wallet.utils/display-symbol (tokens/native-currency chain))]
|
||||
fee-display-symbol (wallet.utils/display-symbol (tokens/native-currency chain))
|
||||
converted-value (* amount (get-in prices [(keyword display-symbol) (keyword (:code wallet-currency)) :price]))
|
||||
converted-fee-value (* fee (get-in prices [(keyword fee-display-symbol) (keyword (:code wallet-currency)) :price]))]
|
||||
[react/view styles/sheet
|
||||
[header sign tx display-symbol fee fee-display-symbol]
|
||||
[separator]
|
||||
|
@ -239,24 +238,43 @@
|
|||
{:type :small
|
||||
:title :t/send-request-amount
|
||||
:error amount-error
|
||||
:accessories [[acc-text (if amount (str amount) "0")
|
||||
(or display-symbol fee-display-symbol)]]}]
|
||||
[separator]])
|
||||
[list-item/list-item
|
||||
{:type :small
|
||||
:title :t/network-fee
|
||||
:error gas-error
|
||||
:accessories [[acc-text fee fee-display-symbol] :chevron]
|
||||
:on-press #(re-frame/dispatch
|
||||
[:signing.ui/open-fee-sheet
|
||||
{:content (fn [] [sheets/fee-bottom-sheet fee-display-symbol])
|
||||
:content-height 270}])}]
|
||||
[react/view {:align-items :center :margin-top 16 :margin-bottom 40}
|
||||
(if keycard-multiaccount?
|
||||
[sign-with-keycard-button amount-error gas-error]
|
||||
[button/button {:on-press #(re-frame/dispatch [:set :signing/sign {:type :password}])
|
||||
:disabled? (or amount-error gas-error)
|
||||
:label :t/sign-with-password}])]])])))
|
||||
:accessories [[react/nested-text {:style {:color colors/gray}}
|
||||
[{:style {:color colors/black}} (if amount (str amount) "0")]
|
||||
" "
|
||||
(or display-symbol fee-display-symbol)
|
||||
" • "
|
||||
[{:style {:color colors/black}} (if converted-value (str "~" (i18n/format-currency converted-value (:code wallet-currency)))
|
||||
[react/activity-indicator {:color :colors/gray
|
||||
:ios {:size :small}
|
||||
:android {:size :16}}])]
|
||||
" "
|
||||
(str (:code wallet-currency))]]}]
|
||||
[separator]
|
||||
[list-item/list-item
|
||||
{:type :small
|
||||
:title :t/network-fee
|
||||
:error gas-error
|
||||
:accessories [[react/nested-text {:style {:color colors/gray}}
|
||||
[{:style {:color colors/black}} fee]
|
||||
" "
|
||||
fee-display-symbol
|
||||
" • "
|
||||
[{:style {:color colors/black}} (if converted-fee-value (str "~" (i18n/format-currency converted-fee-value (:code wallet-currency)))
|
||||
[react/activity-indicator {:color :colors/gray
|
||||
:ios {:size :small}
|
||||
:android {:size :16}}])]
|
||||
" "
|
||||
(str (:code wallet-currency))] :chevron]
|
||||
:on-press #(re-frame/dispatch
|
||||
[:signing.ui/open-fee-sheet
|
||||
{:content (fn [] [sheets/fee-bottom-sheet fee-display-symbol])
|
||||
:content-height 270}])}]
|
||||
[react/view {:align-items :center :margin-top 16 :margin-bottom 40}
|
||||
(if keycard-multiaccount?
|
||||
[sign-with-keycard-button amount-error gas-error]
|
||||
[button/button {:on-press #(re-frame/dispatch [:set :signing/sign {:type :password}])
|
||||
:disabled? (or amount-error gas-error)
|
||||
:label :t/sign-with-password}])]])])])))
|
||||
|
||||
(defn signing-view [tx window-height]
|
||||
(let [bottom-anim-value (anim/create-value window-height)
|
||||
|
|
Loading…
Reference in New Issue