cljs-web3 icon indicating copy to clipboard operation
cljs-web3 copied to clipboard

Method: toWei was not found in object.

Open GuillaumeCisco opened this issue 5 years ago • 0 comments

I'm new to web3 and clojure. I don't know what I'm doing wrong. First : is this lib still supported?

I have included in my project.clj:

[cljs-web3 "0.19.0-0-11"]

And in my views.clj:

(ns project.views
  (:require
   [re-frame.core :as re-frame]
   [multis.subs :as subs]
   [cljsjs.web3]
   [cljs-web3.core :as web3]
   [cljs-web3.eth :as web3-eth]
   ))

; activiate ethereum backend
(def enabled (js/ethereum.enable (fn [err res] (
  (.log js/console res)
))))

; get w3 instance
(def my-web3 (or (aget js/window "web3")
             (if goog.DEBUG
               (web3/web3)
               (web3/create-web3 "https://morden.infura.io/metamask"))))
(def w3 (new (aget js/window "Web3") (aget js/window "ethereum")))

(def amount (web3/to-wei 1 :ether))

I get an error:

Failed to load project/views.cljs Method: toWei was not found in object.

What am I doing wrong?

GuillaumeCisco avatar Jan 21 '20 14:01 GuillaumeCisco