Add faucet button in rinkeby

This commit is contained in:
Serhy 2018-08-01 19:38:30 +03:00 committed by Andrey
parent e39519dfb7
commit 8cc6c7c924
2 changed files with 17 additions and 6 deletions

View File

@ -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

View File

@ -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)