Skip to content

Commit

Permalink
Add currency conversions for signing sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
acolytec3 committed Sep 27, 2019
1 parent b3150f6 commit 9f87e03
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/status_im/ui/screens/signing/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,15 @@
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]))
stringified-value (str "~" (i18n/format-currency converted-value (:code wallet-currency)) " " (:code wallet-currency))
stringified-fee-value (str "~" (i18n/format-currency converted-fee-value (:code wallet-currency)) " " (:code wallet-currency))]
[react/view styles/sheet
[header sign tx display-symbol fee fee-display-symbol]
[separator]
Expand All @@ -232,21 +238,27 @@
[separator]
[contact-item (i18n/label :t/to) contact]
[separator]
[token-item token display-symbol]
[token-item token display-symbol]
(when-not approve?
[react/view
[list-item/list-item
{:type :small
:title :t/send-request-amount
:error amount-error
:accessories [[acc-text (if amount (str amount) "0")
(or display-symbol fee-display-symbol)]]}]
(or display-symbol fee-display-symbol)] (if stringified-value stringified-value
[react/activity-indicator {:color :colors/gray
:ios {:size :small}
:android {:size :16}}]) ]}]
[separator]])
[list-item/list-item
{:type :small
:title :t/network-fee
:error gas-error
:accessories [[acc-text fee fee-display-symbol] :chevron]
:accessories [[acc-text fee fee-display-symbol] (if stringified-fee-value stringified-fee-value
[react/activity-indicator {:color :colors/gray
:ios {:size :small}
:android {:size :16}}]) :chevron]
:on-press #(re-frame/dispatch
[:signing.ui/open-fee-sheet
{:content (fn [] [sheets/fee-bottom-sheet fee-display-symbol])
Expand Down

0 comments on commit 9f87e03

Please sign in to comment.