openethereum/js/src/dev.parity.html

41 lines
1.1 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="/parity-logo-black-no-text.png" type="image/png">
<title>dev::Parity.js</title>
<style>
.box {
font-size: 1.5em;
text-align: center;
border-radius: 0.5em;
background: #eee;
padding: 1em;
margin: 1em;
}
</style>
</head>
<body>
<div class="box">
best block #<span id="blockNumber">unknown</span>
</div>
<script src="/parity-utils/inject.js"></script>
<script>
console.log('window.ethereum', window.ethereum);
console.log('window.ethereum.isParity', window.ethereum.isParity);
console.log('window.parity', window.parity);
window.parity.api.subscribe('eth_blockNumber', function (error, blockNumber) {
if (error) {
console.log('error', error);
return;
}
document.getElementById('blockNumber').innerHTML = blockNumber.toFormat(0);
});
</script>
</body>
</html>