go-ethereum/ethereal/assets/samplecoin/samplecoin.html

69 lines
1.8 KiB
HTML
Raw Normal View History

2014-05-01 23:15:34 +03:00
<html>
<head>
<title>jeffcoin</title>
<link rel="stylesheet" href="bootstrap.min.css">
<link rel="stylesheet" href="bootstrap-theme.min.css">
<link rel="stylesheet" href="samplecoin.css">
<meta name="viewport" content="minimum-scale=1; maximum-scale=1; initial-scale=1;">
<script type="text/javascript">
2014-05-05 12:56:05 +03:00
2014-05-20 23:13:39 +03:00
var jefcoinAddr = "fc0a9436890478bb9b1c6ed7455c2535366f4a99"
2014-05-02 14:35:12 +03:00
var mAddr = ""
2014-05-01 23:15:34 +03:00
function createTransaction() {
2014-05-10 03:00:18 +03:00
var addr = ("0x" + document.querySelector("#addr").value).pad(32);
var amount = document.querySelector("#amount").value.pad(32);
2014-05-01 23:15:34 +03:00
2014-05-10 02:57:10 +03:00
var data = (addr + amount).unbin();
2014-05-02 15:08:38 +03:00
eth.transact(mAddr, jefcoinAddr, 0, "10000000", "250", data, function(receipt) {
2014-05-05 12:56:05 +03:00
debug("received tx hash:", reciept.address)
2014-05-01 23:15:34 +03:00
})
}
function init() {
2014-05-05 14:09:11 +03:00
eth.getKey(function(sec) {
2014-05-08 15:20:17 +03:00
mAddr = sec;
2014-05-05 14:09:11 +03:00
eth.getSecretToAddress(sec, function(addr) {
eth.getStorageAt(jefcoinAddr, addr, function(storage) {
document.querySelector("#current-amount").innerHTML = storage;
});
2014-05-01 23:15:34 +03:00
2014-05-05 14:09:11 +03:00
eth.watch(jefcoinAddr, addr, function(addr, value) {
document.querySelector("#current-amount").innerHTML = value
});
2014-05-01 23:15:34 +03:00
});
});
}
</script>
</head>
<body onload="init();">
<div class="container">
<div class="header">
<h3 class="text-muted">JeffCoin</h3>
</div>
<div class="jumbotron ">
<img src="icon.png">
<div>Amount: <strong id="current-amount"></strong></div>
<div id="transactions">
2014-05-02 14:35:12 +03:00
<div class="form-group">
<input id="addr" class="form-control" type="text" placeholder="Receiver address"></input><br>
<input id="amount" class="form-control" type="text" placeholder="Amount"></input><br>
</div>
2014-05-01 23:15:34 +03:00
2014-05-02 14:35:12 +03:00
<button class="btn btn-default" onclick="createTransaction();">Send Tx</button>
2014-05-01 23:15:34 +03:00
</div>
</div>
</div>
2014-05-02 14:35:12 +03:00
<div id="debug" style="border: 1px solid black; min-height: 30px;"></div>
2014-05-01 23:15:34 +03:00
</body>
</html>