aboutsummaryrefslogtreecommitdiffstats
path: root/ethereal
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-02 19:35:12 +0800
committerobscuren <geffobscura@gmail.com>2014-05-02 19:35:12 +0800
commitf1da6f0564696f4fb5a6c04d1b9e24ed12432d63 (patch)
tree692b4c99cad7ceed5013dd03aca1bfccc2fa1260 /ethereal
parentee04c6ff6790a9b39ea96a630a60bdcf7f261b97 (diff)
downloadgo-tangerine-f1da6f0564696f4fb5a6c04d1b9e24ed12432d63.tar.gz
go-tangerine-f1da6f0564696f4fb5a6c04d1b9e24ed12432d63.tar.zst
go-tangerine-f1da6f0564696f4fb5a6c04d1b9e24ed12432d63.zip
Fixed samplecoin
Diffstat (limited to 'ethereal')
-rw-r--r--ethereal/assets/ethereum.js5
-rw-r--r--ethereal/assets/qml/webapp.qml1
-rw-r--r--ethereal/assets/samplecoin/samplecoin.html28
3 files changed, 18 insertions, 16 deletions
diff --git a/ethereal/assets/ethereum.js b/ethereal/assets/ethereum.js
index 1f36f691e..64a7ff47c 100644
--- a/ethereal/assets/ethereum.js
+++ b/ethereal/assets/ethereum.js
@@ -19,8 +19,7 @@ window.eth = {
// Create transaction
//
- // Creates a transaction with the current account
- // If no recipient is set, the Ethereum API will see it as a contract creation
+ // Transact between two state objects
transact: function(sec, recipient, value, gas, gasPrice, data, cb) {
postData({call: "transact", args: [sec, recipient, value, gas, gasPrice, data]}, cb);
},
@@ -202,7 +201,7 @@ String.prototype.unbin = function() {
String.prototype.hex2bin = function() {
bytes = []
- for(var i=2; i< this.length-1; i+=2){
+ for(var i=2; i< this.length-1; i+=2) {
bytes.push(parseInt(this.substr(i, 2), 16));
}
diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml
index 11ccd6998..4bac12ef0 100644
--- a/ethereal/assets/qml/webapp.qml
+++ b/ethereal/assets/qml/webapp.qml
@@ -60,6 +60,7 @@ ApplicationWindow {
var tx = eth.transact(data.args[0], data.args[1], data.args[2],data.args[3],data.args[4],data.args[5])
postData(data._seed, tx)
+
break
case "create":
postData(data._seed, null)
diff --git a/ethereal/assets/samplecoin/samplecoin.html b/ethereal/assets/samplecoin/samplecoin.html
index 0f61c613a..6f35a1312 100644
--- a/ethereal/assets/samplecoin/samplecoin.html
+++ b/ethereal/assets/samplecoin/samplecoin.html
@@ -9,13 +9,14 @@
<script type="text/javascript">
var jefcoinAddr = "3dff537f51350239abc95c76a5864aa605259e7d"
+var mAddr = ""
function createTransaction() {
var addr = document.querySelector("#addr").value;
var amount = document.querySelector("#amount").value;
- var data = "0x" + addr + "\n" + amount
- eth.transact("", jefcoinAddr, 0, "10000000", "250", data, function(tx) {
+ var data = (("0x"+addr).pad(32) + amount.pad(32)).unbin()
+ eth.transact(mAddr, jefcoinAddr, 0, "10000000", "250", data, function(tx) {
debug("received tx hash:", tx)
})
}
@@ -23,13 +24,15 @@ function createTransaction() {
function init() {
eth.set({width: 500})
- eth.getKey(function(key) {
- eth.getStorageAt(jefcoinAddr, key, function(storage) {
+ eth.getKey(function(keyPair) {
+ mAddr = keyPair.privateKey;
+
+ eth.getStorageAt(jefcoinAddr, keyPair.address, function(storage) {
document.querySelector("#current-amount").innerHTML = storage;
});
eth.watch(jefcoinAddr, function(stateObject) {
- eth.getStorageAt(jefcoinAddr, key, function(storage) {
+ eth.getStorageAt(jefcoinAddr, keyPair.address, function(storage) {
document.querySelector("#current-amount").innerHTML = storage;
});
});
@@ -50,19 +53,18 @@ function init() {
<div>Amount: <strong id="current-amount"></strong></div>
<div id="transactions">
- <form role="form">
- <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>
+ <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>
- <button class="btn btn-default" onclick="createTransaction();">Send Tx</button>
+ <button class="btn btn-default" onclick="createTransaction();">Send Tx</button>
</div>
</div>
-
- <div id="debug" style="border: 1px solid block"></div>
</div>
+<div id="debug" style="border: 1px solid black; min-height: 30px;"></div>
+
</body>
</html>