mirror of
https://github.com/status-im/open-bounty.git
synced 2025-01-11 18:14:25 +00:00
access js/window.web3 in advanced-safe way
This commit is contained in:
parent
3465e66683
commit
ec2f87e621
@ -2,10 +2,14 @@
|
||||
(:require [reagent.core :as r]
|
||||
[re-frame.core :as rf]
|
||||
[clojure.string :as str]
|
||||
[goog.object :as gobj]
|
||||
[goog.date.relative]
|
||||
[goog.i18n.DateTimePatterns :as DateTimePatterns])
|
||||
(:import (goog.i18n DateTimeFormat)))
|
||||
|
||||
(defn web3 []
|
||||
(gobj/get js/window "web3"))
|
||||
|
||||
(defn input [val-ratom props]
|
||||
(fn []
|
||||
[:input
|
||||
|
@ -12,7 +12,8 @@
|
||||
[akiroz.re-frame.storage
|
||||
:as rf-storage
|
||||
:refer [reg-co-fx!]]
|
||||
[commiteth.ui-model :as ui-model]))
|
||||
[commiteth.ui-model :as ui-model]
|
||||
[commiteth.common :as common]))
|
||||
|
||||
|
||||
(rf-storage/reg-co-fx! :commiteth-sob {:fx :store
|
||||
@ -49,7 +50,7 @@
|
||||
(reg-event-fx
|
||||
:initialize-web3
|
||||
(fn [{:keys [db]} [_]]
|
||||
(let [injected-web3 (-> js/window .-web3)
|
||||
(let [injected-web3 (common/web3)
|
||||
w3 (when (boolean injected-web3)
|
||||
(do
|
||||
(println "Using injected Web3 constructor with current provider")
|
||||
|
@ -78,10 +78,9 @@
|
||||
[:container
|
||||
[:div.ui.active.inverted.dimmer
|
||||
[:div.ui.text.loader "Loading"]]]
|
||||
(let [web3 (.-web3 js/window)
|
||||
bounties (vals @owner-bounties)]
|
||||
(let [bounties (vals @owner-bounties)]
|
||||
[:div.ui.container
|
||||
(when (nil? web3)
|
||||
(when (nil? (common/web3))
|
||||
[:div.ui.warning.message
|
||||
[:i.warning.icon]
|
||||
"To sign off claims, please view Status Open Bounty in Status, Mist or Metamask"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user