Clojurescript-node.js mount module for a district server, that takes care of setting up and providing web3 instance.
Add
into your project.clj.
Include [district.server.web3]
in your CLJS file, where you use mount/start
.
Warning: district0x modules are still in early stages, therefore API can change in a future.
You can pass following args to web3 module:
:port
Port of locally running ganache or real ethereum client:url
Full url of the client to connect to.(ns my-district
(:require [mount.core :as mount]
[district.server.web3 :refer [web3]]
[cljs-web3.eth :as web3-eth]))
(-> (mount/with-args
{:web3 {:port 8545}})
(mount/start))
(.then (web3-eth/accounts @web3) prn)
;; => ["0x184c2c67dec231c32856e13134670e44f636acc9"]
district-server-web3
gets initial args from config provided by district-server-config/config
under the key :web3
. These args are then merged together with ones passed to mount/with-args
.
If you wish to use custom modules instead of dependencies above while still using district-server-web3
, you can easily do so by mount's states swapping.
lein npm install
lein doo node "nodejs-tests" auto
Can you improve this documentation? These fine people already did:
madvas & filipEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close