diff --git a/src/cljs/status_dapp/events.cljs b/src/cljs/status_dapp/events.cljs index 221b6a2..e54682f 100644 --- a/src/cljs/status_dapp/events.cljs +++ b/src/cljs/status_dapp/events.cljs @@ -165,12 +165,12 @@ {:call-get-contract-fx [web3 (:address contract)]}))) (re-frame/reg-event-fx - :good-request-ropsten-eth + :good-request-testnet-eth (fn [_ _] (js/alert "Faucet request recieved"))) (re-frame/reg-event-fx - :bad-request-ropsten-eth + :bad-request-testnet-eth (fn [_ _] (js/alert "Faucet request error"))) @@ -180,8 +180,17 @@ {:http-xhrio {:method :get :uri (str "https://faucet.status.im/donate/" address) :response-format (ajax/json-response-format {:keywords? true}) - :on-success [:good-request-ropsten-eth] - :on-failure [:bad-request-ropsten-eth]}})) + :on-success [:good-request-testnet-eth] + :on-failure [:bad-request-testnet-eth]}})) + +(re-frame/reg-event-fx + :request-rinkeby-eth + (fn [_ [_ address]] + {:http-xhrio {:method :get + :uri (str "http://51.15.60.23:3001/donate/" address) + :response-format (ajax/json-response-format {:keywords? true}) + :on-success [:good-request-testnet-eth] + :on-failure [:bad-request-testnet-eth]}})) (re-frame/reg-event-fx :new-contact-callback diff --git a/src/cljs/status_dapp/views.cljs b/src/cljs/status_dapp/views.cljs index e188114..322d763 100644 --- a/src/cljs/status_dapp/views.cljs +++ b/src/cljs/status_dapp/views.cljs @@ -72,8 +72,8 @@ (when (= :assets tab-view) [react/view - (if (= "3" network) - [react/view + (case network + "3" [react/view ;;TODO CORS [ui/button "Request Ropsten ETH" #(re-frame/dispatch [:request-ropsten-eth (str (first accounts))])] [ui/asset-button "STT" constants/stt-ropsten-contract] @@ -82,6 +82,8 @@ [ui/asset-button "ADI" constants/adi-ropsten-contract] [ui/asset-button "WGN" constants/wgn-ropsten-contract] [ui/asset-button "MDS" constants/mds-ropsten-contract]] + "4" [react/view + [ui/button "Request Rinkeby ETH" #(re-frame/dispatch [:request-rinkeby-eth (str (first accounts))])]] [react/text "Assets supported only in Ropsten Testnet"])]) (when (= :transactions tab-view)