fix #1050 transaction view: app crash

Transactions with 15 significant digits crashes the app due to something weird
going on in the Clojurescript -> web3 -> BigNumber chain. This fix converts the
number into a BigNumber before converting it into Ether.
This commit is contained in:
Oskar Thorén 2017-08-01 09:34:50 +02:00 committed by Roman Volosovskyi
parent 4521020ce5
commit fc59f8d7f1
1 changed files with 4 additions and 3 deletions

View File

@ -30,10 +30,11 @@
(defview view [{:keys [to value id] :as transaction} on-deny]
[recipient [:contact-by-address to]]
(let [eth-value (.fromWei js/Web3.prototype value "ether")
value (str (i18n/label-number eth-value) " ETH")
(let [bignumber (.toBigNumber js/Web3.prototype value)
eth-value (str (.fromWei js/Web3.prototype bignumber "ether"))
value-str (str (i18n/label-number eth-value) " ETH")
recipient-name (or (:name recipient) to (i18n/label :t/contract-creation))]
[rn/view {:style st/item}
[item-image recipient]
[item-info recipient-name value]
[item-info recipient-name value-str]
[deny-btn id on-deny]]))