[#3935] set web3.eth.defaultAccount

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2018-04-25 15:41:17 +03:00
parent 9442b8d9e7
commit 174aac90c0
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
3 changed files with 5 additions and 2 deletions

View File

@ -114,5 +114,6 @@ if (typeof web3 === "undefined") {
if (protocol == "https:" || protocol == "http:") {
console.log("StatusHttpProvider");
web3 = new Web3(new StatusHttpProvider(address));
web3.eth.defaultAccount = currentAccountAddress;
}
}

View File

@ -71,6 +71,7 @@
(views/defview browser []
(views/letsubs [webview (atom nil)
{:keys [address]} [:get-current-account]
{:keys [dapp? contact url] :as browser} [:get-current-browser]
{:keys [can-go-back? can-go-forward?]} [:get :browser/options]
extra-js [:web-view-extra-js]
@ -97,7 +98,7 @@
:injected-on-start-loading-java-script (str js-res/web3
js-res/jquery
(get-inject-js url)
(js-res/web3-init rpc-url))
(js-res/web3-init rpc-url address))
:injected-java-script (str js-res/webview-js extra-js)}]
[react/view styles/background
[react/text (i18n/label :t/enter-dapp-url)]])

View File

@ -37,8 +37,9 @@
(def web3 (str "; if (typeof Web3 == 'undefined') {"
(slurp "node_modules/web3/dist/web3.min.js")
"}"))
(defn web3-init [provider-address]
(defn web3-init [provider-address current-account-address]
(str "var providerAddress = \"" provider-address "\";"
"var currentAccountAddress = \"" current-account-address "\";"
(slurp "resources/js/web3_init.js")))
(defn local-storage-data [data]