Cross-platform Ethereum API.
nuid.ethereum
primarily exists to abstract over platform-specific differences and provide a common interface to the provided functionality across host platforms. nuid.ethereum
delegates most invocations to a host implemention (e.g. web3j
on the jvm
, and web3js
, etc. in node
and the browser). This library inherits both dependencies' capability to interact with a remote service such as Infura.
jvm
, node + npm
, clj
, shadow-cljs
{nuid/ethereum {:git/url "https://github.com/nuid/ethereum" :sha "..."}}
$ clj # or shadow-cljs node-repl
=> (require '[clojure.core.async :as async]) ;; or [cljs.core...]
=> (require '[nuid.ethereum.transaction :as tx])
=> (require '[nuid.ethereum.client :as client])
=> (require '[nuid.ethereum :as eth])
=> (require '[nuid.bytes :as bytes])
=> (require '[nuid.hex :as hex])
=> (def http-provider "...") ;; e.g. https://rinkeby.infura.io/...
=> (def private-key "...")
=> (def params {::client/http-provider http-provider ::private-key private-key})
=> (def client (eth/parameters->client params))
=> (def resp-atom (atom []))
=> (def data (hex/prefixed (hex/encode "flavor")))
=> (async/take!
(eth/send-transaction! client {::tx/data data})
(partial swap! resp-atom conj))
Apache v2.0 or MIT