feature #6250 - added xdai and poa sidechains
Signed-off-by: Goran Jovic <goranjovic@gmail.com>
This commit is contained in:
parent
76165cc7cb
commit
3da2cd9b9e
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
|
@ -88,7 +88,8 @@
|
|||
(defn personal-send-request-short-preview
|
||||
[label-key {:keys [content]}]
|
||||
(let [{:keys [amount asset network]} (:params content)
|
||||
token (tokens/asset-for (keyword network) (keyword asset))]
|
||||
token (when (and network asset)
|
||||
(tokens/asset-for (keyword network) (keyword asset)))]
|
||||
[chat-preview/text {}
|
||||
(i18n/label label-key {:amount (i18n/label-number amount)
|
||||
:asset (wallet.utils/display-symbol token)})]))
|
||||
|
@ -227,7 +228,10 @@
|
|||
:font :default}
|
||||
(wallet.utils/display-symbol token)]]]]
|
||||
(when (and fiat-amount
|
||||
platform/mobile?)
|
||||
platform/mobile?
|
||||
;;NOTE(goranjovic) - have to hide cross network asset fiat value until we can support
|
||||
;; multiple chain prices simultaneously
|
||||
(not network-mismatch?))
|
||||
[react/view transactions-styles/command-send-fiat-amount
|
||||
[react/text {:style (transactions-styles/command-send-fiat-amount-text outgoing)}
|
||||
(str "~ " fiat-amount " " (or currency (i18n/label :usd-currency)))]])
|
||||
|
@ -412,7 +416,10 @@
|
|||
[react/text {:style (transactions-styles/command-request-currency-text outgoing)
|
||||
:font :default}
|
||||
asset]]]
|
||||
(when platform/mobile?
|
||||
(when (and platform/mobile?
|
||||
;;NOTE(goranjovic) - have to hide cross network asset fiat value until we can support
|
||||
;; multiple chain prices simultaneously
|
||||
(not network-mismatch?))
|
||||
[react/view transactions-styles/command-request-fiat-amount-row
|
||||
[react/text {:style (transactions-styles/command-request-fiat-amount-text outgoing)}
|
||||
(str "~ " fiat-amount " " (or currency (i18n/label :usd-currency)))]])
|
||||
|
|
|
@ -48,6 +48,20 @@
|
|||
:UpstreamConfig {:Enabled true
|
||||
:URL "https://mainnet.infura.io/z6GCTmjdP3FETEJmMBI4"}}}})
|
||||
|
||||
(def sidechain-networks
|
||||
{"xdai_rpc" {:id "xdai_rpc",
|
||||
:name "xDai Chain",
|
||||
:config {:NetworkId (ethereum/chain-keyword->chain-id :xdai)
|
||||
:DataDir "/ethereum/xdai_rpc"
|
||||
:UpstreamConfig {:Enabled true
|
||||
:URL "https://dai.poa.network"}}}
|
||||
"poa_rpc" {:id "poa_rpc",
|
||||
:name "POA Network",
|
||||
:config {:NetworkId (ethereum/chain-keyword->chain-id :poa)
|
||||
:DataDir "/ethereum/poa_rpc"
|
||||
:UpstreamConfig {:Enabled true
|
||||
:URL "https://poa.infura.io"}}}})
|
||||
|
||||
(def testnet-networks
|
||||
{"testnet" {:id "testnet",
|
||||
:name "Ropsten",
|
||||
|
@ -84,12 +98,14 @@
|
|||
|
||||
(def default-networks
|
||||
(into {} (filter network-enabled?
|
||||
(merge testnet-networks mainnet-networks))))
|
||||
(merge testnet-networks mainnet-networks sidechain-networks))))
|
||||
|
||||
(defn default-account-settings []
|
||||
{:wallet {:visible-tokens {:testnet #{:STT :HND}
|
||||
:mainnet #{:SNT}
|
||||
:rinkeby #{:MOKSHA :KDO}}}})
|
||||
:rinkeby #{:MOKSHA :KDO}
|
||||
:xdai #{}
|
||||
:poa #{}}}})
|
||||
|
||||
(def currencies
|
||||
{:aed {:id :aed :code "AED" :display-name (i18n/label :t/currency-display-name-aed) :symbol "د.إ"}
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
[status-im.utils.ethereum.tokens :as tokens]
|
||||
[status-im.utils.hex :as utils.hex]
|
||||
[status-im.utils.money :as money]
|
||||
[status-im.utils.fx :as fx]))
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im.ui.screens.wallet.utils :as wallet.utils]))
|
||||
|
||||
(def min-gas-price-wei (money/bignumber 1))
|
||||
|
||||
|
@ -233,8 +234,12 @@
|
|||
:chain chain
|
||||
:success-event :update-token-balance-success
|
||||
:error-event :update-token-balance-fail}
|
||||
:get-prices {:from (if mainnet? (conj tokens "ETH") ["ETH"])
|
||||
:get-prices {:from (if mainnet?
|
||||
(conj tokens "ETH")
|
||||
[(-> (tokens/native-currency chain)
|
||||
(wallet.utils/exchange-symbol))])
|
||||
:to [(:code currency)]
|
||||
:mainnet? mainnet?
|
||||
:success-event :update-prices-success
|
||||
:error-event :update-prices-fail}
|
||||
:db (-> db
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
[status-im.utils.ethereum.core :as ethereum]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im.utils.semaphores :as semaphores]
|
||||
[status-im.utils.utils :as utils]))
|
||||
[status-im.utils.utils :as utils]
|
||||
[status-im.i18n :as i18n]))
|
||||
|
||||
(fx/defn update-sync-state
|
||||
[{{:keys [sync-state sync-data] :as db} :db} error sync]
|
||||
|
@ -73,6 +74,8 @@
|
|||
(when (and (not error) ; error most probably means we are offline
|
||||
(not= network-id fetched-network-id))
|
||||
(utils/show-popup
|
||||
"Ethereum node started incorrectly"
|
||||
"Ethereum node was started with incorrect configuration, application will be stopped to recover from that condition."
|
||||
(i18n/label :t/ethereum-node-started-incorrectly-title)
|
||||
(i18n/label :t/ethereum-node-started-incorrectly-description
|
||||
{:network-id network-id
|
||||
:fetched-network-id fetched-network-id})
|
||||
#(re-frame/dispatch [:protocol.ui/close-app-confirmed]))))))))
|
||||
|
|
|
@ -53,9 +53,14 @@
|
|||
[react/view styles/network-icon
|
||||
[vector-icons/icon :icons/network {:color :white}]]
|
||||
[react/text {:style (styles/network-text text-color)}
|
||||
(if (ethereum/testnet? network-id)
|
||||
(i18n/label :t/testnet-text {:testnet (get-in ethereum/chains [(ethereum/chain-id->chain-keyword network-id) :name] "Unknown")})
|
||||
(i18n/label :t/mainnet-text))]]]))
|
||||
(cond (ethereum/testnet? network-id)
|
||||
(i18n/label :t/testnet-text {:testnet (get-in ethereum/chains [(ethereum/chain-id->chain-keyword network-id) :name] "Unknown")})
|
||||
|
||||
(ethereum/sidechain? network-id)
|
||||
(i18n/label :t/sidechain-text {:sidechain (get-in ethereum/chains [(ethereum/chain-id->chain-keyword network-id) :name] "Unknown")})
|
||||
|
||||
:else
|
||||
(i18n/label :t/mainnet-text))]]]))
|
||||
|
||||
(defn logo
|
||||
([] (logo nil))
|
||||
|
|
|
@ -79,9 +79,10 @@
|
|||
;; TODO(oskarth): At some point we want to get list of relevant assets to get prices for
|
||||
(re-frame/reg-fx
|
||||
:get-prices
|
||||
(fn [{:keys [from to success-event error-event]}]
|
||||
(fn [{:keys [from to mainnet? success-event error-event]}]
|
||||
(prices/get-prices from
|
||||
to
|
||||
mainnet?
|
||||
#(re-frame/dispatch [success-event %])
|
||||
#(re-frame/dispatch [error-event %]))))
|
||||
|
||||
|
|
|
@ -7,5 +7,13 @@
|
|||
(money/token->unit decimals)
|
||||
money/to-fixed))
|
||||
|
||||
(defn display-symbol [{:keys [symbol-display symbol]}]
|
||||
(clojure.core/name (or symbol-display symbol)))
|
||||
;;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)))
|
|
@ -10,7 +10,9 @@
|
|||
(def chains
|
||||
{:mainnet {:id 1 :name "Mainnet"}
|
||||
:testnet {:id 3 :name "Ropsten"}
|
||||
:rinkeby {:id 4 :name "Rinkeby"}})
|
||||
:rinkeby {:id 4 :name "Rinkeby"}
|
||||
:xdai {:id 100 :name "xDai"}
|
||||
:poa {:id 99 :name "POA"}})
|
||||
|
||||
(defn chain-id->chain-keyword [i]
|
||||
(or (some #(when (= i (:id (val %))) (key %)) chains)
|
||||
|
@ -20,7 +22,12 @@
|
|||
(get-in chains [k :id]))
|
||||
|
||||
(defn testnet? [id]
|
||||
(contains? #{(chain-keyword->chain-id :testnet) (chain-keyword->chain-id :rinkeby)} id))
|
||||
(contains? #{(chain-keyword->chain-id :testnet)
|
||||
(chain-keyword->chain-id :rinkeby)} id))
|
||||
|
||||
(defn sidechain? [id]
|
||||
(contains? #{(chain-keyword->chain-id :xdai)
|
||||
(chain-keyword->chain-id :poa)} id))
|
||||
|
||||
(defn network-with-upstream-rpc? [network]
|
||||
(get-in network [:config :UpstreamConfig :Enabled]))
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
(def parameter-separator "&")
|
||||
(def key-value-separator "=")
|
||||
|
||||
;;TODO(goranjovic) - rewrite all of these with something more readable than regex
|
||||
(def uri-pattern (re-pattern (str scheme scheme-separator "([^" query-separator "]*)(?:\\" query-separator "(.*))?")))
|
||||
(def authority-path-pattern (re-pattern (str "^([^" chain-id-separator function-name-separator "]*)(?:" chain-id-separator "(\\d))?(?:" function-name-separator "(\\w*))?")))
|
||||
(def authority-path-pattern (re-pattern (str "^([^" chain-id-separator function-name-separator "]*)(?:" chain-id-separator "(\\d+))?(?:" function-name-separator "(\\w*))?")))
|
||||
(def key-value-format (str "([^" parameter-separator key-value-separator "]+)"))
|
||||
(def query-pattern (re-pattern (str key-value-format key-value-separator key-value-format)))
|
||||
|
||||
|
|
|
@ -25,7 +25,16 @@
|
|||
:rinkeby {:name "Rinkeby Ether"
|
||||
:symbol :ETH
|
||||
:symbol-display :ETHri
|
||||
:decimals 18}}))
|
||||
:decimals 18}
|
||||
:poa {:name "POA"
|
||||
:symbol :ETH
|
||||
:symbol-display :POA
|
||||
:decimals 18}
|
||||
:xdai {:name "xDAI"
|
||||
:symbol :ETH
|
||||
:symbol-display :xDAI
|
||||
:symbol-exchange :DAI
|
||||
:decimals 18}}))
|
||||
|
||||
(def native-currency-symbols
|
||||
(set (map #(-> % val :symbol) all-native-currencies)))
|
||||
|
|
|
@ -19,16 +19,25 @@
|
|||
(defn- gen-price-url [fsyms tsyms]
|
||||
(str api-url "/pricemultifull?fsyms=" (->url-param-syms fsyms) "&tsyms=" (->url-param-syms tsyms) "&" status-identifier))
|
||||
|
||||
(defn- format-price-resp [resp]
|
||||
(into {} (for [[from entries] (:RAW (types/json->clj resp))]
|
||||
{from (into {} (for [[to entry] entries]
|
||||
{to {:from (name from)
|
||||
:to (name to)
|
||||
:price (:PRICE entry)
|
||||
:last-day (:OPEN24HOUR entry)}}))})))
|
||||
(defn- format-price-resp [resp mainnet?]
|
||||
;;NOTE(this check is to allow value conversion for sidechains with native currencies listed on cryptocompare
|
||||
;; under a symbol different than display symbol. Specific use case xDAI and POA.
|
||||
(if mainnet?
|
||||
(into {} (for [[from entries] (:RAW (types/json->clj resp))]
|
||||
{from (into {} (for [[to entry] entries]
|
||||
{to {:from (name from)
|
||||
:to (name to)
|
||||
:price (:PRICE entry)
|
||||
:last-day (:OPEN24HOUR entry)}}))}))
|
||||
(into {} (for [[_ entries] (:RAW (types/json->clj resp))]
|
||||
{:ETH (into {} (for [[to entry] entries]
|
||||
{to {:from "ETH"
|
||||
:to (name to)
|
||||
:price (:PRICE entry)
|
||||
:last-day (:OPEN24HOUR entry)}}))}))))
|
||||
|
||||
(defn get-prices [from to on-success on-error]
|
||||
(defn get-prices [from to mainnet? on-success on-error]
|
||||
(http/get
|
||||
(gen-price-url from to)
|
||||
(fn [resp] (on-success (format-price-resp resp)))
|
||||
(fn [resp] (on-success (format-price-resp resp mainnet?)))
|
||||
on-error))
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
[status-im.utils.types :as types]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(def etherscan-supported?
|
||||
#{:testnet :mainnet :rinkeby})
|
||||
|
||||
(defn- get-network-subdomain [chain]
|
||||
(case chain
|
||||
(:testnet) "ropsten"
|
||||
|
@ -10,8 +13,9 @@
|
|||
(:rinkeby) "rinkeby"))
|
||||
|
||||
(defn get-transaction-details-url [chain hash]
|
||||
(let [network-subdomain (get-network-subdomain chain)]
|
||||
(str "https://" (when network-subdomain (str network-subdomain ".")) "etherscan.io/tx/" hash)))
|
||||
(when (etherscan-supported? chain)
|
||||
(let [network-subdomain (get-network-subdomain chain)]
|
||||
(str "https://" (when network-subdomain (str network-subdomain ".")) "etherscan.io/tx/" hash))))
|
||||
|
||||
(def etherscan-api-key "DMSI4UAAKUBVGCDMVP3H2STAMSAUV7BYFI")
|
||||
|
||||
|
@ -56,8 +60,10 @@
|
|||
{})))
|
||||
|
||||
(defn get-transactions [chain account on-success on-error]
|
||||
(let [url (get-transaction-url chain account)]
|
||||
(log/debug "HTTP GET" url)
|
||||
(http/get url
|
||||
#(on-success (format-transactions-response % account))
|
||||
on-error)))
|
||||
(if (etherscan-supported? chain)
|
||||
(let [url (get-transaction-url chain account)]
|
||||
(log/debug "HTTP GET" url)
|
||||
(http/get url
|
||||
#(on-success (format-transactions-response % account))
|
||||
on-error))
|
||||
(log/info "Etherscan not supported for " chain)))
|
||||
|
|
|
@ -2,8 +2,13 @@
|
|||
(:require [cljs.test :refer-macros [deftest is]]
|
||||
[status-im.utils.prices :as prices]))
|
||||
|
||||
(deftest test-format-price-resp
|
||||
(deftest test-format-price-resp-mainnet
|
||||
(is (= (prices/format-price-resp
|
||||
"{\"RAW\":{\"ETH\":{\"USD\":{\"TYPE\":\"5\",\"MARKET\":\"CCCAGG\",\"FROMSYMBOL\":\"ETH\",\"TOSYMBOL\":\"USD\",\"FLAGS\":\"4\",\"PRICE\":677.91,\"LASTUPDATE\":1525241472,\"LASTVOLUME\":0.69661268,\"LASTVOLUMETO\":472.0874471092,\"LASTTRADEID\":\"1525241472.6714\",\"VOLUMEDAY\":109859.96594606241,\"VOLUMEDAYTO\":73924561.52673237,\"VOLUME24HOUR\":408811.69032152055,\"VOLUME24HOURTO\":270617692.0100031,\"OPENDAY\":670.81,\"HIGHDAY\":681.06,\"LOWDAY\":662.13,\"OPEN24HOUR\":658.68,\"HIGH24HOUR\":681.67,\"LOW24HOUR\":638.25,\"LASTMARKET\":\"Kraken\",\"CHANGE24HOUR\":19.230000000000018,\"CHANGEPCT24HOUR\":2.919475314264896,\"CHANGEDAY\":7.100000000000023,\"CHANGEPCTDAY\":1.0584219078427608,\"SUPPLY\":99176837.749,\"MKTCAP\":67232970078.42458,\"TOTALVOLUME24H\":1308785.4697758215,\"TOTALVOLUME24HTO\":880718916.8398683}},\"SNT\":{\"USD\":{\"TYPE\":\"5\",\"MARKET\":\"CCCAGG\",\"FROMSYMBOL\":\"SNT\",\"TOSYMBOL\":\"USD\",\"FLAGS\":\"1\",\"PRICE\":0.1562,\"LASTUPDATE\":1525241236,\"LASTVOLUME\":582.07218,\"LASTVOLUMETO\":90.919674516,\"LASTTRADEID\":\"237582608\",\"VOLUMEDAY\":259125.16382211001,\"VOLUMEDAYTO\":40450.5318867195,\"VOLUME24HOUR\":1451022.9449243098,\"VOLUME24HOURTO\":223465.71221695316,\"OPENDAY\":0.1573,\"HIGHDAY\":0.1592,\"LOWDAY\":0.1532,\"OPEN24HOUR\":0.15,\"HIGH24HOUR\":0.1657,\"LOW24HOUR\":0.1481,\"LASTMARKET\":\"Bitfinex\",\"CHANGE24HOUR\":0.006200000000000011,\"CHANGEPCT24HOUR\":4.133333333333341,\"CHANGEDAY\":-0.0010999999999999899,\"CHANGEPCTDAY\":-0.6993006993006928,\"SUPPLY\":6804870174.87817,\"MKTCAP\":1062920721.3159702,\"TOTALVOLUME24H\":239970152.87898657,\"TOTALVOLUME24HTO\":37480153.807917476}}},\"DISPLAY\":{\"ETH\":{\"USD\":{\"FROMSYMBOL\":\"Ξ\",\"TOSYMBOL\":\"$\",\"MARKET\":\"CryptoCompare Index\",\"PRICE\":\"$ 677.91\",\"LASTUPDATE\":\"Just now\",\"LASTVOLUME\":\"Ξ 0.6966\",\"LASTVOLUMETO\":\"$ 472.09\",\"LASTTRADEID\":\"1525241472.6714\",\"VOLUMEDAY\":\"Ξ 109,860.0\",\"VOLUMEDAYTO\":\"$ 73,924,561.5\",\"VOLUME24HOUR\":\"Ξ 408,811.7\",\"VOLUME24HOURTO\":\"$ 270,617,692.0\",\"OPENDAY\":\"$ 670.81\",\"HIGHDAY\":\"$ 681.06\",\"LOWDAY\":\"$ 662.13\",\"OPEN24HOUR\":\"$ 658.68\",\"HIGH24HOUR\":\"$ 681.67\",\"LOW24HOUR\":\"$ 638.25\",\"LASTMARKET\":\"Kraken\",\"CHANGE24HOUR\":\"$ 19.23\",\"CHANGEPCT24HOUR\":\"2.92\",\"CHANGEDAY\":\"$ 7.10\",\"CHANGEPCTDAY\":\"1.06\",\"SUPPLY\":\"Ξ 99,176,837.7\",\"MKTCAP\":\"$ 67.23 B\",\"TOTALVOLUME24H\":\"Ξ 1,308.79 K\",\"TOTALVOLUME24HTO\":\"$ 880.72 M\"}},\"SNT\":{\"USD\":{\"FROMSYMBOL\":\"SNT\",\"TOSYMBOL\":\"$\",\"MARKET\":\"CryptoCompare Index\",\"PRICE\":\"$ 0.1562\",\"LASTUPDATE\":\"3 min ago\",\"LASTVOLUME\":\"SNT 582.07\",\"LASTVOLUMETO\":\"$ 90.92\",\"LASTTRADEID\":\"237582608\",\"VOLUMEDAY\":\"SNT 259,125.2\",\"VOLUMEDAYTO\":\"$ 40,450.5\",\"VOLUME24HOUR\":\"SNT 1,451,022.9\",\"VOLUME24HOURTO\":\"$ 223,465.7\",\"OPENDAY\":\"$ 0.1573\",\"HIGHDAY\":\"$ 0.1592\",\"LOWDAY\":\"$ 0.1532\",\"OPEN24HOUR\":\"$ 0.1500\",\"HIGH24HOUR\":\"$ 0.1657\",\"LOW24HOUR\":\"$ 0.1481\",\"LASTMARKET\":\"Bitfinex\",\"CHANGE24HOUR\":\"$ 0.0062\",\"CHANGEPCT24HOUR\":\"4.13\",\"CHANGEDAY\":\"$ -0.0011\",\"CHANGEPCTDAY\":\"-0.70\",\"SUPPLY\":\"SNT 6,804,870,174.9\",\"MKTCAP\":\"$ 1,062.92 M\",\"TOTALVOLUME24H\":\"SNT 239.97 M\",\"TOTALVOLUME24HTO\":\"$ 37.48 M\"}}}}")
|
||||
"{\"RAW\":{\"ETH\":{\"USD\":{\"TYPE\":\"5\",\"MARKET\":\"CCCAGG\",\"FROMSYMBOL\":\"ETH\",\"TOSYMBOL\":\"USD\",\"FLAGS\":\"4\",\"PRICE\":677.91,\"LASTUPDATE\":1525241472,\"LASTVOLUME\":0.69661268,\"LASTVOLUMETO\":472.0874471092,\"LASTTRADEID\":\"1525241472.6714\",\"VOLUMEDAY\":109859.96594606241,\"VOLUMEDAYTO\":73924561.52673237,\"VOLUME24HOUR\":408811.69032152055,\"VOLUME24HOURTO\":270617692.0100031,\"OPENDAY\":670.81,\"HIGHDAY\":681.06,\"LOWDAY\":662.13,\"OPEN24HOUR\":658.68,\"HIGH24HOUR\":681.67,\"LOW24HOUR\":638.25,\"LASTMARKET\":\"Kraken\",\"CHANGE24HOUR\":19.230000000000018,\"CHANGEPCT24HOUR\":2.919475314264896,\"CHANGEDAY\":7.100000000000023,\"CHANGEPCTDAY\":1.0584219078427608,\"SUPPLY\":99176837.749,\"MKTCAP\":67232970078.42458,\"TOTALVOLUME24H\":1308785.4697758215,\"TOTALVOLUME24HTO\":880718916.8398683}},\"SNT\":{\"USD\":{\"TYPE\":\"5\",\"MARKET\":\"CCCAGG\",\"FROMSYMBOL\":\"SNT\",\"TOSYMBOL\":\"USD\",\"FLAGS\":\"1\",\"PRICE\":0.1562,\"LASTUPDATE\":1525241236,\"LASTVOLUME\":582.07218,\"LASTVOLUMETO\":90.919674516,\"LASTTRADEID\":\"237582608\",\"VOLUMEDAY\":259125.16382211001,\"VOLUMEDAYTO\":40450.5318867195,\"VOLUME24HOUR\":1451022.9449243098,\"VOLUME24HOURTO\":223465.71221695316,\"OPENDAY\":0.1573,\"HIGHDAY\":0.1592,\"LOWDAY\":0.1532,\"OPEN24HOUR\":0.15,\"HIGH24HOUR\":0.1657,\"LOW24HOUR\":0.1481,\"LASTMARKET\":\"Bitfinex\",\"CHANGE24HOUR\":0.006200000000000011,\"CHANGEPCT24HOUR\":4.133333333333341,\"CHANGEDAY\":-0.0010999999999999899,\"CHANGEPCTDAY\":-0.6993006993006928,\"SUPPLY\":6804870174.87817,\"MKTCAP\":1062920721.3159702,\"TOTALVOLUME24H\":239970152.87898657,\"TOTALVOLUME24HTO\":37480153.807917476}}},\"DISPLAY\":{\"ETH\":{\"USD\":{\"FROMSYMBOL\":\"Ξ\",\"TOSYMBOL\":\"$\",\"MARKET\":\"CryptoCompare Index\",\"PRICE\":\"$ 677.91\",\"LASTUPDATE\":\"Just now\",\"LASTVOLUME\":\"Ξ 0.6966\",\"LASTVOLUMETO\":\"$ 472.09\",\"LASTTRADEID\":\"1525241472.6714\",\"VOLUMEDAY\":\"Ξ 109,860.0\",\"VOLUMEDAYTO\":\"$ 73,924,561.5\",\"VOLUME24HOUR\":\"Ξ 408,811.7\",\"VOLUME24HOURTO\":\"$ 270,617,692.0\",\"OPENDAY\":\"$ 670.81\",\"HIGHDAY\":\"$ 681.06\",\"LOWDAY\":\"$ 662.13\",\"OPEN24HOUR\":\"$ 658.68\",\"HIGH24HOUR\":\"$ 681.67\",\"LOW24HOUR\":\"$ 638.25\",\"LASTMARKET\":\"Kraken\",\"CHANGE24HOUR\":\"$ 19.23\",\"CHANGEPCT24HOUR\":\"2.92\",\"CHANGEDAY\":\"$ 7.10\",\"CHANGEPCTDAY\":\"1.06\",\"SUPPLY\":\"Ξ 99,176,837.7\",\"MKTCAP\":\"$ 67.23 B\",\"TOTALVOLUME24H\":\"Ξ 1,308.79 K\",\"TOTALVOLUME24HTO\":\"$ 880.72 M\"}},\"SNT\":{\"USD\":{\"FROMSYMBOL\":\"SNT\",\"TOSYMBOL\":\"$\",\"MARKET\":\"CryptoCompare Index\",\"PRICE\":\"$ 0.1562\",\"LASTUPDATE\":\"3 min ago\",\"LASTVOLUME\":\"SNT 582.07\",\"LASTVOLUMETO\":\"$ 90.92\",\"LASTTRADEID\":\"237582608\",\"VOLUMEDAY\":\"SNT 259,125.2\",\"VOLUMEDAYTO\":\"$ 40,450.5\",\"VOLUME24HOUR\":\"SNT 1,451,022.9\",\"VOLUME24HOURTO\":\"$ 223,465.7\",\"OPENDAY\":\"$ 0.1573\",\"HIGHDAY\":\"$ 0.1592\",\"LOWDAY\":\"$ 0.1532\",\"OPEN24HOUR\":\"$ 0.1500\",\"HIGH24HOUR\":\"$ 0.1657\",\"LOW24HOUR\":\"$ 0.1481\",\"LASTMARKET\":\"Bitfinex\",\"CHANGE24HOUR\":\"$ 0.0062\",\"CHANGEPCT24HOUR\":\"4.13\",\"CHANGEDAY\":\"$ -0.0011\",\"CHANGEPCTDAY\":\"-0.70\",\"SUPPLY\":\"SNT 6,804,870,174.9\",\"MKTCAP\":\"$ 1,062.92 M\",\"TOTALVOLUME24H\":\"SNT 239.97 M\",\"TOTALVOLUME24HTO\":\"$ 37.48 M\"}}}}" true)
|
||||
{:ETH {:USD {:from "ETH", :to "USD", :price 677.91, :last-day 658.68}}
|
||||
:SNT {:USD {:from "SNT", :to "USD", :price 0.1562, :last-day 0.15}}})))
|
||||
|
||||
(deftest test-format-price-resp-non-mainnet
|
||||
(is (= (prices/format-price-resp
|
||||
"{\"RAW\":{\"SNT\":{\"USD\":{\"TYPE\":\"5\",\"MARKET\":\"CCCAGG\",\"FROMSYMBOL\":\"SNT\",\"TOSYMBOL\":\"USD\",\"FLAGS\":\"4\",\"PRICE\":0.03511847069999999,\"LASTUPDATE\":1539953131,\"LASTVOLUME\":0,\"LASTVOLUMETO\":0,\"LASTTRADEID\":0,\"VOLUMEDAY\":0,\"VOLUMEDAYTO\":0,\"VOLUME24HOUR\":45900.43172688,\"VOLUME24HOURTO\":1645.4590651064077,\"OPENDAY\":0.0357005448,\"HIGHDAY\":0.0358298946,\"LOWDAY\":0.034924446,\"OPEN24HOUR\":0.0360239193,\"HIGH24HOUR\":0.03621794399999999,\"LOW24HOUR\":0.0348597711,\"LASTMARKET\":\"IDAX\",\"CHANGE24HOUR\":-0.0009054486000000112,\"CHANGEPCT24HOUR\":-2.5134649910233704,\"CHANGEDAY\":-0.0005820741000000101,\"CHANGEPCTDAY\":-1.630434782608724,\"SUPPLY\":6804870174.87817,\"MKTCAP\":238976633.8537628,\"TOTALVOLUME24H\":53502856.59548309,\"TOTALVOLUME24HTO\":1878972.0078131626}}},\"DISPLAY\":{\"SNT\":{\"USD\":{\"FROMSYMBOL\":\"SNT\",\"TOSYMBOL\":\"$\",\"MARKET\":\"CryptoCompare Index\",\"PRICE\":\"$ 0.03512\",\"LASTUPDATE\":\"Just now\",\"LASTVOLUME\":\"SNT 0\",\"LASTVOLUMETO\":\"$ 0\",\"LASTTRADEID\":0,\"VOLUMEDAY\":\"SNT 0\",\"VOLUMEDAYTO\":\"$ 0\",\"VOLUME24HOUR\":\"SNT 45,900.4\",\"VOLUME24HOURTO\":\"$ 1,645.46\",\"OPENDAY\":\"$ 0.03570\",\"HIGHDAY\":\"$ 0.03583\",\"LOWDAY\":\"$ 0.03492\",\"OPEN24HOUR\":\"$ 0.03602\",\"HIGH24HOUR\":\"$ 0.03622\",\"LOW24HOUR\":\"$ 0.03486\",\"LASTMARKET\":\"IDAX\",\"CHANGE24HOUR\":\"$ -0.00091\",\"CHANGEPCT24HOUR\":\"-2.51\",\"CHANGEDAY\":\"$ -0.00058\",\"CHANGEPCTDAY\":\"-1.63\",\"SUPPLY\":\"SNT 6,804,870,174.9\",\"MKTCAP\":\"$ 238.98 M\",\"TOTALVOLUME24H\":\"SNT 53.50 M\",\"TOTALVOLUME24HTO\":\"$ 1,878.97 K\"}}}}" false)
|
||||
{:ETH {:USD {:from "ETH", :to "USD", :price 0.03511847069999999, :last-day 0.0360239193}}})))
|
||||
|
|
|
@ -558,6 +558,9 @@
|
|||
"main-wallet": "Main Wallet",
|
||||
"process-json": "Process JSON",
|
||||
"testnet-text": "You’re on the {{testnet}} Testnet. Do not send real ETH or SNT to your address",
|
||||
"sidechain-text": "You’re on the {{sidechain}} Sidechain.",
|
||||
"ethereum-node-started-incorrectly-title" :"Ethereum node started incorrectly",
|
||||
"ethereum-node-started-incorrectly-description" : "Ethereum node was started with incorrect configuration, application will be stopped to recover from that condition. Configured network id = {{network-id}}, actual = {{fetched-network-id}}",
|
||||
"browser-not-secure": "Connection is not secure! Do not sign transactions or send personal data on this site.",
|
||||
"welcome-to-status-description": "Tap the plus (+) button to get started",
|
||||
"recovery-phrase-invalid": "Recovery phrase is invalid",
|
||||
|
|
Loading…
Reference in New Issue