2014-09-30 22:51:53 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<!doctype>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<html>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<head>
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-16 16:04:41 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script>
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-11 15:47:58 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<script type="text/javascript" src="../dist/ethereum.js"></script>
							 | 
						
					
						
							
								
									
										
										
										
											2014-09-30 22:51:53 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<script type="text/javascript">
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-13 19:28:58 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-13 04:21:51 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    var web3 = require('web3');
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-21 20:29:02 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-13 04:21:51 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-13 19:28:58 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    function watchBalance() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        var coinbase = web3.eth.coinbase;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        var originalBalance = 0;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-21 21:12:07 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        var balance = web3.eth.balanceAt(coinbase);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        var originalBalance = web3.toDecimal(balance);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        document.getElementById('original').innerText = 'original balance: ' + originalBalance + '    watching...';
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-13 19:28:58 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-04 12:52:17 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<<<<<<< HEAD:cmd/mist/assets/ext/ethereum.js/example/balance.html
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-29 16:52:00 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        var filter = web3.eth.watch({address: coinbase}).changed(function() {
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-04 12:52:17 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								=======
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-28 10:19:49 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        web3.eth.watch('pending').changed(function() {
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-04 12:52:17 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								>>>>>>> 859a1999cb204d2c6fcb08d6569c738c5af5cd86:example/balance.html
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-21 21:12:07 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            balance = web3.eth.balanceAt(coinbase)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            var currentBalance = web3.toDecimal(balance);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            document.getElementById("current").innerText = 'current: ' + currentBalance;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            document.getElementById("diff").innerText = 'diff:    ' + (currentBalance - originalBalance);
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-03 17:46:56 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        });
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-13 04:21:51 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2014-09-30 22:51:53 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-13 19:28:58 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								</script>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</head>
							 | 
						
					
						
							
								
									
										
										
										
											2014-09-30 22:51:53 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<body>
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-14 13:11:47 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <h1>coinbase balance</h1>
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-13 19:28:58 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <button type="button" onClick="watchBalance();">watch balance</button>
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-13 04:21:51 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <div></div>
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-13 19:28:58 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <div id="original"></div>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <div id="current"></div>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <div id="diff"></div>
							 | 
						
					
						
							
								
									
										
										
										
											2014-09-30 22:51:53 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</body>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</html>
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-13 04:21:51 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 |