-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add function to create web3 instance from injected web3 #8
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,8 @@ | |
(create-web3 \"http://localhost:8545/\"))` | ||
|
||
The Web3 JavaScript object is provided on the browser window." | ||
(:require [cljs-web3.utils :as u :refer [js-apply js-prototype-apply]])) | ||
|
||
(:require [cljs-web3.utils :as u :refer [js-apply js-prototype-apply]] | ||
[goog.object])) | ||
|
||
(def version-api | ||
"Returns a string representing the Ethereum js api version. | ||
|
@@ -386,6 +386,12 @@ | |
[web3] | ||
(aget web3 "currentProvider")) | ||
|
||
(defn web3 | ||
"Return the web3 instance injected via Mist or Metamask" | ||
[] | ||
(new (goog.object/getValueByKeys js/window "web3" "constructor") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. used constructor access here as I felt it's a little more explicit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get
Do you have an idea why this could happen? |
||
(current-provider | ||
(goog.object/get js/window "web3")))) | ||
|
||
;;; Providers | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think it would be nice if this actually had
http
in the name somehow but it's part of the API now so I don't know 🙂