From 0ebd4fbd333591ae32e8555c6b01b74db75fbc92 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Fri, 20 Oct 2017 20:54:54 +0200 Subject: [PATCH] fix showing twice word ETH --- src/status_im/ui/screens/wallet/main/views.cljs | 2 +- src/status_im/utils/money.cljs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/status_im/ui/screens/wallet/main/views.cljs b/src/status_im/ui/screens/wallet/main/views.cljs index 04eee7f851..025cdf6ce5 100644 --- a/src/status_im/ui/screens/wallet/main/views.cljs +++ b/src/status_im/ui/screens/wallet/main/views.cljs @@ -123,7 +123,7 @@ [react/text {:style styles/asset-item-value :number-of-lines 1 :ellipsize-mode :tail} - (money/wei->str :eth amount)] + (money/to-fixed (money/wei-> :eth amount))] [react/text {:style styles/asset-item-currency :uppercase? true :number-of-lines 1} diff --git a/src/status_im/utils/money.cljs b/src/status_im/utils/money.cljs index ca07a9fa75..4242e90c44 100644 --- a/src/status_im/utils/money.cljs +++ b/src/status_im/utils/money.cljs @@ -66,8 +66,11 @@ (defn wei-> [unit n] (.dividedBy (bignumber n) (eth-units unit))) +(defn to-fixed [bn] + (.toFixed bn)) + (defn wei->str [unit n] - (str (.toFixed (wei-> unit n)) " " (string/upper-case (name unit)))) + (str (to-fixed (wei-> unit n)) " " (string/upper-case (name unit)))) (defn wei->ether [n] (wei-> :eth n))