2014-09-30 20:51:53 +00:00
|
|
|
<!doctype>
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
2014-11-05 17:46:01 +00:00
|
|
|
<script type="text/javascript" src="js/es6-promise/promise.min.js"></script>
|
|
|
|
<script type="text/javascript" src="../dist/ethereum.min.js"></script>
|
|
|
|
|
2014-09-30 20:51:53 +00:00
|
|
|
<script type="text/javascript">
|
2014-11-03 16:46:56 +00:00
|
|
|
if (window.Promise === undefined) {
|
|
|
|
window.Promise = ES6Promise.Promise;
|
|
|
|
}
|
2014-11-06 20:51:37 +00:00
|
|
|
|
2014-11-05 17:46:01 +00:00
|
|
|
var web3 = require('web3');
|
2014-11-03 16:46:56 +00:00
|
|
|
|
|
|
|
//web3.setProvider(new web3.providers.QtProvider());
|
|
|
|
web3.setProvider(new web3.providers.HttpRpcProvider("http://localhost:8080"));
|
2014-11-05 17:46:01 +00:00
|
|
|
// web3.setProvider(new web3.providers.WebSocketProvider("ws://localhost:40404/eth"));
|
2014-11-03 16:46:56 +00:00
|
|
|
|
|
|
|
function testSnippet() {
|
|
|
|
web3.eth.watch({altered: web3.eth.coinbase}).changed(function() {
|
|
|
|
web3.eth.balanceAt(web3.eth.coinbase).then(function (balance) {
|
2014-11-05 17:46:01 +00:00
|
|
|
console.log(parseInt(balance,16));
|
|
|
|
console.log(typeof balance);
|
|
|
|
document.getElementById("result").innerText = +balance;
|
2014-11-03 16:46:56 +00:00
|
|
|
});
|
2014-09-30 20:51:53 +00:00
|
|
|
});
|
|
|
|
}
|
2014-11-03 16:46:56 +00:00
|
|
|
|
2014-09-30 20:51:53 +00:00
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h1>std::name_reg</h1>
|
|
|
|
<input type="text" id="name"></input>
|
2014-11-03 16:46:56 +00:00
|
|
|
<button type="button" onClick="testSnippet();">test snippet</button>
|
|
|
|
|
|
|
|
<div></div>
|
|
|
|
result: <div id="result"></div>
|
2014-09-30 20:51:53 +00:00
|
|
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|