show warning in profile for all testnet networks

This commit is contained in:
Roman Volosovskyi 2017-10-10 15:07:27 +02:00
parent e732f5559c
commit d7fcb333da
4 changed files with 33 additions and 15 deletions

View File

@ -38,35 +38,39 @@
:raw-config config)]))
(into {})))
(def mainnet-id 1)
(def ropsten-id 3)
(def rinkeby-id 4)
(def default-networks
(transform-config
{"testnet" {:id "testnet",
:name "Ropsten",
:config {:NetworkId 3
:config {:NetworkId ropsten-id
:DataDir "/ethereum/testnet"}}
"testnet_rpc" {:id "testnet_rpc",
:name "Ropsten with upstream RPC",
:config {:NetworkId 3
:config {:NetworkId ropsten-id
:DataDir "/ethereum/testnet_rpc"
:UpstreamConfig {:Enabled true
:URL "https://ropsten.infura.io/z6GCTmjdP3FETEJmMBI4"}}}
"rinkeby" {:id "rinkeby",
:name "Rinkeby",
:config {:NetworkId 4
:config {:NetworkId rinkeby-id
:DataDir "/ethereum/rinkeby"}}
"rinkeby_rpc" {:id "rinkeby_rpc",
:name "Rinkeby with upstream RPC",
:config {:NetworkId 4
:config {:NetworkId rinkeby-id
:DataDir "/ethereum/rinkeby_rpc"
:UpstreamConfig {:Enabled true
:URL "https://rinkeby.infura.io/z6GCTmjdP3FETEJmMBI4"}}}
"mainnet" {:id "mainnet",
:name "Mainnet",
:config {:NetworkId 1
:config {:NetworkId mainnet-id
:DataDir "/ethereum/mainnet"}}
"mainnet_rpc" {:id "mainnet_rpc",
:name "Mainnet with upstream RPC",
:config {:NetworkId 1
:config {:NetworkId mainnet-id
:DataDir "/ethereum/mainnet_rpc"
:UpstreamConfig {:Enabled true
:URL "https://mainnet.infura.io/z6GCTmjdP3FETEJmMBI4 "}}}}))

View File

@ -103,7 +103,7 @@
:error-incorrect-name "Please select another name"
:error-incorrect-email "Incorrect e-mail"
:profile-testnet-icon "Testnet"
:profile-testnet-text "Ropsten Testnet Only. Please do not send real ETH or SNT to your address"
:profile-testnet-text "Testnet Only. Please do not send real ETH or SNT to your address"
;;make_photo
:image-source-title "Profile image"

View File

@ -1,9 +1,23 @@
(ns status-im.ui.screens.network-settings.subs
(:require [re-frame.core :refer [reg-sub subscribe]]))
(:require [re-frame.core :refer [reg-sub subscribe]]
[status-im.constants :as constants]))
(reg-sub
:get-current-account-network
:<- [:get-current-account]
:<- [:get :networks/networks]
(fn [[current-account networks]]
(get networks (:network current-account))))
(get networks (:network current-account))))
(reg-sub
:get-network-id
:<- [:get :networks/networks]
:<- [:get :network]
(fn [[networks network]]
(get-in networks [network :raw-config :NetworkId])))
(reg-sub
:testnet?
:<- [:get-network-id]
(fn [network-id]
(contains? #{constants/rinkeby-id constants/ropsten-id} network-id)))

View File

@ -205,11 +205,11 @@
(defview my-profile []
(letsubs [{:keys [status] :as current-account} [:get-current-account]
network [:get :network]]
testnet? [:testnet?]]
[react/view styles/profile
[status-bar]
[my-profile-toolbar]
(when (= network "testnet")
(when testnet?
[testnet-only])
[react/scroll-view
[react/view styles/profile-form
@ -230,13 +230,13 @@
(letsubs [{:keys [pending?
status
whisper-identity]
:as contact} [:contact]
chat-id [:get :current-chat-id]
network [:get :network]]
:as contact} [:contact]
chat-id [:get :current-chat-id]
testnet? [:testnet?]]
[react/view styles/profile
[status-bar]
[profile-toolbar contact]
(when (= network "testnet")
(when testnet?
[testnet-only])
[react/scroll-view
[react/view styles/profile-form