Official Go implementation of the Ethereum protocol
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<!doctype>
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<script type="text/javascript" src="js/es6-promise/promise.min.js"></script>
|
|
|
|
<script type="text/javascript" src="../dist/ethereum.js"></script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
if (window.Promise === undefined) {
|
|
|
|
window.Promise = ES6Promise.Promise;
|
|
|
|
}
|
|
|
|
|
|
|
|
var web3 = require('web3');
|
|
|
|
web3.setProvider(new web3.providers.AutoProvider());
|
|
|
|
|
|
|
|
function testSnippet() {
|
|
|
|
web3.eth.watch({altered: web3.eth.coinbase}).changed(function() {
|
|
|
|
web3.eth.balanceAt(web3.eth.coinbase).then(function (balance) {
|
|
|
|
console.log(parseInt(balance,16));
|
|
|
|
console.log(typeof balance);
|
|
|
|
document.getElementById("result").innerText = +balance;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<h1>std::name_reg</h1>
|
|
|
|
<input type="text" id="name"></input>
|
|
|
|
<button type="button" onClick="testSnippet();">test snippet</button>
|
|
|
|
<div></div>
|
|
|
|
result:
|
|
|
|
<div id="result"></div>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|