From 84b3415b4479eb849b69d77a7e178c67fcaaf3fb Mon Sep 17 00:00:00 2001 From: frankiebee Date: Wed, 29 Mar 2017 10:53:43 -0700 Subject: WIP: lost enital call from dapp to getAccounts --- library/example/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'library/example') diff --git a/library/example/index.js b/library/example/index.js index 329302a4d..aae7ccd19 100644 --- a/library/example/index.js +++ b/library/example/index.js @@ -1,4 +1,5 @@ window.addEventListener('load', web3Detect) +window.addEventListener('message', console.warn) function web3Detect() { if (global.web3) { @@ -12,18 +13,18 @@ function web3Detect() { function startApp(){ console.log('app started') - var primaryAccount = null + var primaryAccount console.log('getting main account...') - web3.eth.getAccounts(function(err, addresses){ - if (err) throw err + web3.eth.getAccounts((err, addresses) => { + if (err) console.error(err) console.log('set address', addresses[0]) - debugger primaryAccount = addresses[0] }) document.querySelector('.action-button-1').addEventListener('click', function(){ console.log('saw click') console.log('sending tx') + primaryAccount web3.eth.sendTransaction({ from: primaryAccount, to: primaryAccount, -- cgit v1.2.3