fixed provider

This commit is contained in:
Andrey Shovkoplyas 2019-01-10 12:30:38 +01:00
parent 24aba00f23
commit 42bc5f368b
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
3 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,7 @@
[tab-button "ETH" :eth tab-view]
[tab-button "Version" :version tab-view]
[tab-button "Status API" :api tab-view]
(when js/ethereumBeta
(when (exists? js/ethereumBeta)
[tab-button "Beta Provider" :beta tab-view])
[tab-button "About" :about tab-view]]
[react/view {:style {:height 1 :margin-top 10 :background-color "#4360df33"}}]])

View File

@ -2,14 +2,14 @@
(:require [re-frame.core :as re-frame]))
(def web3 (or (when (exists? js/web3) js/web3)
(when js/ethereumBeta
(when (exists? js/ethereumBeta)
(js/setTimeout (fn []
(.then (.send js/ethereumBeta "eth_requestAccounts") #(re-frame/dispatch [:set-default-account]))
(when js/ethereumBeta
(.then (.getContactCode js/ethereumBeta.status) #(re-frame/dispatch [:on-status-api :contact %]))))
100)
(js/Web3. js/ethereumBeta))
(when js/ethereum
(when (exists? js/ethereum)
(js/setTimeout (fn []
(.then (.enable js/ethereum) #(re-frame/dispatch [:set-default-account]))
(when js/ethereum.status

View File

@ -110,7 +110,7 @@
(fn [{{:keys [web3] :as db} :db} _]
(println "WEB3" web3)
(when web3
{:db (if js/window.ethereumBeta
{:db (if (exists? js/window.ethereumBeta)
db
(update db :web3-async-data
assoc