2016-10-19 11:02:42 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width">
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
2016-11-01 18:12:40 +01:00
|
|
|
<link rel="icon" href="/parity-logo-black-no-text.png" type="image/png">
|
2016-10-19 11:02:42 +02:00
|
|
|
<title>dev::Web3</title>
|
2016-11-06 17:42:25 +01:00
|
|
|
<style>
|
|
|
|
.box {
|
|
|
|
font-size: 1.5em;
|
|
|
|
text-align: center;
|
|
|
|
border-radius: 0.5em;
|
|
|
|
background: #eee;
|
|
|
|
padding: 1em;
|
|
|
|
margin: 1em;
|
|
|
|
}
|
|
|
|
</style>
|
2016-10-19 11:02:42 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
2016-11-06 17:42:25 +01:00
|
|
|
<div class="box">
|
|
|
|
best block #<span id="blockNumber">unknown</span>
|
|
|
|
</div>
|
2017-11-13 09:31:08 +01:00
|
|
|
<script src="/parity-utils/inject.js"></script>
|
|
|
|
<script src="https://rawgit.com/ethereum/web3.js/develop/dist/web3.min.js"></script>
|
2016-11-06 17:42:25 +01:00
|
|
|
<script>
|
2017-11-13 09:31:08 +01:00
|
|
|
console.log('window.ethereum', window.ethereum);
|
|
|
|
console.log('window.ethereum.isParity', window.ethereum.isParity);
|
|
|
|
console.log('window.web3.currentProvider', window.web3.currentProvider, window.web3.currentProvider.send, window.web3.currentProvider.sendAsync);
|
|
|
|
console.log('window.web3.currentProvider.isParity', window.web3.currentProvider.isParity);
|
|
|
|
|
|
|
|
const web3 = new Web3(window.web3.currentProvider);
|
|
|
|
|
2016-11-06 17:42:25 +01:00
|
|
|
window.setInterval(function () {
|
2017-11-13 09:31:08 +01:00
|
|
|
web3.eth.getBlockNumber(function (error, blockNumber) {
|
2016-11-06 17:42:25 +01:00
|
|
|
if (error) {
|
|
|
|
console.error('error', error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
document.getElementById('blockNumber').innerHTML = blockNumber;
|
|
|
|
});
|
|
|
|
}, 1000);
|
|
|
|
</script>
|
2016-10-19 11:02:42 +02:00
|
|
|
</body>
|
|
|
|
</html>
|