2019-06-17 11:41:37 +02:00
|
|
|
(ns status-im.wallet.utils
|
2017-12-16 11:00:56 +01:00
|
|
|
(:require [status-im.utils.money :as money]))
|
|
|
|
|
|
|
|
(defn format-amount [amount decimals]
|
|
|
|
(-> amount
|
|
|
|
(or (money/bignumber 0))
|
|
|
|
(money/token->unit decimals)
|
2018-10-10 13:07:48 +02:00
|
|
|
money/to-fixed))
|
|
|
|
|
2018-10-17 13:46:59 +02:00
|
|
|
;;NOTE(goranjovic) - we are internally using symbol ETH for native currencies of any ethereum network
|
|
|
|
;; some sidechains have different names for this native currency, which we handle with `symbol-display` override.
|
|
|
|
(defn display-symbol [{:keys [symbol-display symbol] :as token}]
|
|
|
|
(when token
|
|
|
|
(clojure.core/name (or symbol-display symbol))))
|
|
|
|
|
|
|
|
;;NOTE(goranjovic) - in addition to custom symbol display, some sidechain native currencies are listed under a different
|
|
|
|
;; ticker on exchange networks. We handle that with `symbol-exchange` override.
|
|
|
|
(defn exchange-symbol [{:keys [symbol-exchange symbol-display symbol]}]
|
|
|
|
(clojure.core/name (or symbol-exchange symbol-display symbol)))
|