forked from mirror/go-ethereum
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.
43 lines
1.1 KiB
43 lines
1.1 KiB
10 years ago
|
<!doctype>
|
||
|
<html>
|
||
|
|
||
|
<head>
|
||
10 years ago
|
<script type="text/javascript" src="js/es6-promise/promise.min.js"></script>
|
||
|
<script type="text/javascript" src="../dist/ethereum.min.js"></script>
|
||
|
|
||
10 years ago
|
<script type="text/javascript">
|
||
10 years ago
|
if (window.Promise === undefined) {
|
||
|
window.Promise = ES6Promise.Promise;
|
||
|
}
|
||
10 years ago
|
var web3 = require('web3');
|
||
10 years ago
|
|
||
|
//web3.setProvider(new web3.providers.QtProvider());
|
||
|
web3.setProvider(new web3.providers.HttpRpcProvider("http://localhost:8080"));
|
||
10 years ago
|
// web3.setProvider(new web3.providers.WebSocketProvider("ws://localhost:40404/eth"));
|
||
10 years ago
|
|
||
|
function testSnippet() {
|
||
|
web3.eth.watch({altered: web3.eth.coinbase}).changed(function() {
|
||
|
web3.eth.balanceAt(web3.eth.coinbase).then(function (balance) {
|
||
10 years ago
|
console.log(parseInt(balance,16));
|
||
|
console.log(typeof balance);
|
||
|
document.getElementById("result").innerText = +balance;
|
||
10 years ago
|
});
|
||
10 years ago
|
});
|
||
|
}
|
||
10 years ago
|
|
||
10 years ago
|
</script>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
|
||
|
<h1>std::name_reg</h1>
|
||
|
<input type="text" id="name"></input>
|
||
10 years ago
|
<button type="button" onClick="testSnippet();">test snippet</button>
|
||
|
|
||
|
<div></div>
|
||
|
result: <div id="result"></div>
|
||
10 years ago
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|