Secret Open Source Mist release :)

@frozeman frozeman released this Nov 16, 2015 · 764 commits to master since this release

This release is intended for DApp Developers only.

Run Mist, browse to your dapp and press the plus to add it to the sidebar.

Your have three options to use (or replace) the pre-loaded web3 object:

// 1. Simply use web3 from mist

// 2. Use web3 from mist, OR load if outside of mist
if(typeof web3 === 'undefined')
  web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

// 3. Use your own web3, but the provider from mist ("Web3" won't be supplied by Mist)
if(typeof web3 !== 'undefined')
  web3 = new Web3(web3.currentProvider);
  web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

Note the mist object is currently not provided in browse mode. So press the + button in the upper right corner first, so it gets added to the sidebar. Then you can use mist.web3Provider!

Note2 Also checkout the Mist API:

Note3 Use web3.eth.isSyncing to prevent your dapp from getting frozen on syncs (when a bunch of blocks are imported)