Add web3
This commit is contained in:
parent
68ae5ce5a9
commit
22310a3ee8
|
@ -5,7 +5,8 @@
|
||||||
"modules": [
|
"modules": [
|
||||||
"react-native-contacts",
|
"react-native-contacts",
|
||||||
"react-native-invertible-scroll-view",
|
"react-native-invertible-scroll-view",
|
||||||
"awesome-phonenumber"
|
"awesome-phonenumber",
|
||||||
|
"web3"
|
||||||
],
|
],
|
||||||
"imageDirs": [
|
"imageDirs": [
|
||||||
"images"
|
"images"
|
||||||
|
|
86
project.clj
86
project.clj
|
@ -1,43 +1,45 @@
|
||||||
(defproject messenger "0.1.0-SNAPSHOT"
|
(defproject messenger "0.1.0-SNAPSHOT"
|
||||||
:description "FIXME: write description"
|
:description "FIXME: write description"
|
||||||
:url "http://example.com/FIXME"
|
:url "http://example.com/FIXME"
|
||||||
:license {:name "Eclipse Public License"
|
:license {:name "Eclipse Public License"
|
||||||
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
||||||
:dependencies [[org.clojure/clojure "1.7.0"]
|
:dependencies [[org.clojure/clojure "1.7.0"]
|
||||||
[org.clojure/clojurescript "1.7.170"]
|
[org.clojure/clojurescript "1.7.170"]
|
||||||
[org.omcljs/om "1.0.0-alpha28" :exclusions [cljsjs/react cljsjs/react-dom]]
|
[org.omcljs/om "1.0.0-alpha28" :exclusions [cljsjs/react cljsjs/react-dom]]
|
||||||
[natal-shell "0.1.6"]]
|
[natal-shell "0.1.6"]]
|
||||||
:plugins [[lein-cljsbuild "1.1.1"]
|
:plugins [[lein-cljsbuild "1.1.1"]
|
||||||
[lein-figwheel "0.5.0-2"]]
|
[lein-figwheel "0.5.0-2"]]
|
||||||
:clean-targets ["target/" "index.ios.js" "index.android.js"]
|
:clean-targets ["target/" "index.ios.js" "index.android.js"]
|
||||||
:aliases {"prod-build" ^{:doc "Recompile code with prod profile."}
|
:aliases {"prod-build" ^{:doc "Recompile code with prod profile."}
|
||||||
["do" "clean"
|
["do" "clean"
|
||||||
["with-profile" "prod" "cljsbuild" "once" "ios"]
|
["with-profile" "prod" "cljsbuild" "once" "ios"]
|
||||||
["with-profile" "prod" "cljsbuild" "once" "android"]]}
|
["with-profile" "prod" "cljsbuild" "once" "android"]]}
|
||||||
:profiles {:dev {:dependencies [[figwheel-sidecar "0.5.0-2"]
|
:profiles
|
||||||
[com.cemerick/piggieback "0.2.1"]]
|
{:dev {:dependencies [[figwheel-sidecar "0.5.0-2"]
|
||||||
:source-paths ["src" "env/dev"]
|
[com.cemerick/piggieback "0.2.1"]]
|
||||||
:cljsbuild {:builds {:ios {:source-paths ["src" "env/dev"]
|
:source-paths ["src" "env/dev"]
|
||||||
:figwheel true
|
:cljsbuild {:builds
|
||||||
:compiler {:output-to "target/ios/not-used.js"
|
{:ios {:source-paths ["src" "env/dev"]
|
||||||
:main "env.ios.main"
|
:figwheel true
|
||||||
:output-dir "target/ios"
|
:compiler {:output-to "target/ios/not-used.js"
|
||||||
:optimizations :none}}
|
:main "env.ios.main"
|
||||||
:android {:source-paths ["src" "env/dev"]
|
:output-dir "target/ios"
|
||||||
:figwheel true
|
:optimizations :none}}
|
||||||
:compiler {:output-to "target/android/not-used.js"
|
:android {:source-paths ["src" "env/dev"]
|
||||||
:main "env.android.main"
|
:figwheel true
|
||||||
:output-dir "target/android"
|
:compiler {:output-to "target/android/not-used.js"
|
||||||
:optimizations :none}}}}
|
:main "env.android.main"
|
||||||
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}
|
:output-dir "target/android"
|
||||||
:prod {:cljsbuild {:builds {:ios {:source-paths ["src" "env/prod"]
|
:optimizations :none}}}}
|
||||||
:compiler {:output-to "index.ios.js"
|
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}
|
||||||
:main "env.ios.main"
|
:prod {:cljsbuild {:builds
|
||||||
:output-dir "target/ios"
|
{:ios {:source-paths ["src" "env/prod"]
|
||||||
:optimizations :simple}}
|
:compiler {:output-to "index.ios.js"
|
||||||
:android {:source-paths ["src" "env/prod"]
|
:main "env.ios.main"
|
||||||
:compiler {:output-to "index.android.js"
|
:output-dir "target/ios"
|
||||||
:main "env.android.main"
|
:optimizations :simple}}
|
||||||
:output-dir "target/android"
|
:android {:source-paths ["src" "env/prod"]
|
||||||
:optimizations :simple}}}}
|
:compiler {:output-to "index.android.js"
|
||||||
}})
|
:main "env.android.main"
|
||||||
|
:output-dir "target/android"
|
||||||
|
:optimizations :simple}}}}}})
|
||||||
|
|
|
@ -14,6 +14,30 @@
|
||||||
(set! js/PhoneNumber (js/require "awesome-phonenumber"))
|
(set! js/PhoneNumber (js/require "awesome-phonenumber"))
|
||||||
(def country-code "US")
|
(def country-code "US")
|
||||||
|
|
||||||
|
(set! js/Web3 (js/require "web3"))
|
||||||
|
(def ethereum-rpc-url "http://localhost:8545")
|
||||||
|
(defn make-web3 [rpc-url]
|
||||||
|
(->> (js/Web3.providers.HttpProvider. rpc-url)
|
||||||
|
(js/Web3.)))
|
||||||
|
(defn new-identity [web3 handler]
|
||||||
|
(.newIdentity (.-shh web3) handler))
|
||||||
|
|
||||||
|
(defn my-handler [error result]
|
||||||
|
(if error
|
||||||
|
(do (alert (str error))
|
||||||
|
(.log js/console "error")
|
||||||
|
(.log js/console error))
|
||||||
|
(alert (str result)))
|
||||||
|
(.log js/console "result")
|
||||||
|
(.log js/console result))
|
||||||
|
|
||||||
|
;; (def web3 (make-web3 ethereum-rpc-url))
|
||||||
|
(new-identity (make-web3 ethereum-rpc-url) my-handler)
|
||||||
|
;; (def whisper-identity (new-identity web3 my-handler))
|
||||||
|
;; (alert (str whisper-identity))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defn show-home-view [nav]
|
(defn show-home-view [nav]
|
||||||
(binding [state/*nav-render* false]
|
(binding [state/*nav-render* false]
|
||||||
(.replace nav (clj->js {:component contacts-list
|
(.replace nav (clj->js {:component contacts-list
|
||||||
|
|
Loading…
Reference in New Issue