diff options
Diffstat (limited to 'cmd/mist/assets/examples')
-rw-r--r-- | cmd/mist/assets/examples/abi.html | 55 | ||||
-rw-r--r-- | cmd/mist/assets/examples/balance.html | 40 | ||||
-rw-r--r-- | cmd/mist/assets/examples/bomb.html | 22 | ||||
-rw-r--r-- | cmd/mist/assets/examples/coin.html | 147 | ||||
-rw-r--r-- | cmd/mist/assets/examples/coin.js | 65 | ||||
-rw-r--r-- | cmd/mist/assets/examples/info.html | 84 | ||||
-rw-r--r-- | cmd/mist/assets/examples/whisper.html | 70 |
7 files changed, 0 insertions, 483 deletions
diff --git a/cmd/mist/assets/examples/abi.html b/cmd/mist/assets/examples/abi.html deleted file mode 100644 index 8170e88b0..000000000 --- a/cmd/mist/assets/examples/abi.html +++ /dev/null @@ -1,55 +0,0 @@ -<!doctype> -<html> -<head> -<title>Hello world</title> -<script src="../ext/bignumber.min.js"></script> -<script src="../ext/ethereum.js/dist/ethereum.js"></script> -<script> - var web3 = require('web3'); - web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080')); - var eth = web3.eth; - var desc = [{ - "name": "multiply(uint256)", - "inputs": [{ - "name": "a", - "type": "uint256" - }], - "outputs": [{ - "name": "d", - "type": "uint256" - }] - }]; - var address = web3.eth.transact({ - data: "0x603880600c6000396000f3006001600060e060020a600035048063c6888fa114601857005b6021600435602b565b8060005260206000f35b600081600702905091905056", - gasPrice: "1000000000000000", - gas: "10000", - }); - var contract = web3.eth.contract(address, desc); - - function calculate() { - var param = parseInt(document.getElementById('value').value); - - var res = contract.call().multiply(param); - document.getElementById('result').innerText = res.toString(10); - } -</script> -</head> -<body> -<h3>Contract content</h3> -<textarea style="height:100px; width: 300px;" disabled="disabled"> -contract test { - function multiply(uint a) returns(uint d) { - return a * 7; - } -} -</textarea> -<code><pre> -603880600c6000396000f3006001600060e060020a600035048063c6888fa1140 -05b6021600435602b565b8060005260206000f35b600081600702905091905056</pre></code> - -<hr> -<div>7 x <input type="number" id="value" onkeyup='calculate()'></input> = -<span id="result"></spa> - -</body> -</html> diff --git a/cmd/mist/assets/examples/balance.html b/cmd/mist/assets/examples/balance.html deleted file mode 100644 index bc483a879..000000000 --- a/cmd/mist/assets/examples/balance.html +++ /dev/null @@ -1,40 +0,0 @@ -<!doctype> -<html> - -<head> -<script src="../ext/bignumber.min.js"></script> -<script src="../ext/ethereum.js/dist/ethereum.js"></script> -<script type="text/javascript"> - - var web3 = require('web3'); - web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080')); - - function watchBalance() { - var coinbase = web3.eth.coinbase; - var originalBalance = 0; - - var balance = web3.eth.balanceAt(coinbase); - var originalBalance = web3.toDecimal(balance); - document.getElementById('original').innerText = 'original balance: ' + originalBalance + ' watching...'; - - web3.eth.watch({altered: coinbase}).changed(function() { - balance = web3.eth.balanceAt(coinbase) - var currentBalance = web3.toDecimal(balance); - document.getElementById("current").innerText = 'current: ' + currentBalance; - document.getElementById("diff").innerText = 'diff: ' + (currentBalance - originalBalance); - }); - } - -</script> -</head> -<body> - <h1>coinbase balance</h1> - <button type="button" onClick="watchBalance();">watch balance</button> - <div></div> - <div id="original"></div> - <div id="current"></div> - <div id="diff"></div> -</body> -</html> - - diff --git a/cmd/mist/assets/examples/bomb.html b/cmd/mist/assets/examples/bomb.html deleted file mode 100644 index 62540f9bb..000000000 --- a/cmd/mist/assets/examples/bomb.html +++ /dev/null @@ -1,22 +0,0 @@ -<html> -<head> -<script src="../ext/bignumber.min.js"></script> -<script src="../ext/ethereum.js/dist/ethereum.js"></script> - -<script> -var web3 = require('web3'); -web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8545')); -var eth = web3.eth; - -function bomb() { - for (var i = 0; i < 200; i++) { - eth.transact({}) - } -} -</script> -</head> - -<body> -<button onclick="bomb();">BOOM!</button> -</body> -</html> diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html deleted file mode 100644 index 4fe8e7fa2..000000000 --- a/cmd/mist/assets/examples/coin.html +++ /dev/null @@ -1,147 +0,0 @@ -<!doctype> -<html> -<title>JevCoin</title> -<head> -<script type="text/javascript" src="../ext/bignumber.min.js"></script> -<script type="text/javascript" src="../ext/ethereum.js/dist/web3-light.min.js"></script> -</head> -<body> - -<h1>JevCoin <code id="contract_addr"></code></h1> -<div> - <strong>Balance</strong> - <span id="balance"></strong> -</div> - -<div> - <span>Address:</span> - <input type="text" id="address" style="width:200px"> - <span>Amount:</span> - <input type="text" id="amount" style="width:200px"> - <button onclick="transact()">Send</button> - <span id="message"></span> -</div> - -<hr> - -<table width="100%" id="table"> - <tr><td style="width:40%;">Address</td><td>Balance</td></tr> - <tbody id="table_body"></tbody> -</table> - -</body> - -<script type="text/javascript"> - var eth = web3.eth; - - web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545')); - var desc = [{ - "name": "balance(address)", - "type": "function", - "inputs": [{ - "name": "who", - "type": "address" - }], - "constant": true, - "outputs": [{ - "name": "value", - "type": "uint256" - }] - }, { - "name": "send(address,uint256)", - "type": "function", - "inputs": [{ - "name": "to", - "type": "address" - }, { - "name": "value", - "type": "uint256" - }], - "outputs": [] - }, { - "name":"Changed", - "type":"event", - "inputs": [ - {"name":"from","type":"address","indexed":true}, - {"name":"amount","type":"uint256","indexed":true}, - ], - }]; - - var address = localStorage.getItem("address"); - // deploy if not exist - if(address === null) { - var code = "0x60056013565b61014f8061003a6000396000f35b620f42406000600033600160a060020a0316815260200190815260200160002081905550560060e060020a600035048063d0679d3414610020578063e3d670d71461003457005b61002e600435602435610049565b60006000f35b61003f600435610129565b8060005260206000f35b806000600033600160a060020a03168152602001908152602001600020541061007157610076565b610125565b806000600033600160a060020a03168152602001908152602001600020908154039081905550806000600084600160a060020a031681526020019081526020016000209081540190819055508033600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660006000a38082600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660006000a35b5050565b60006000600083600160a060020a0316815260200190815260200160002054905091905056"; - address = web3.eth.sendTransaction({from: eth.accounts[0], data: code, gas: "1000000"}); - localStorage.setItem("address", address); - } - document.querySelector("#contract_addr").innerHTML = address; - - var Contract = web3.eth.contract(desc); - contract = new Contract(address); - var filter = contract.Changed({from: eth.accounts[0]}) - filter.watch(function(logs) { - console.log(logs); - refresh(); - }); -window.filter = filter; - - function refresh() { - document.querySelector("#balance").innerHTML = contract.balance(eth.coinbase); - } - - function transact() { - var to = document.querySelector("#address"); - if( to.value.length == 0 ) { - to = "0x4205b06c2cfa0e30359edcab94543266cb6fa1d3"; - } else { - if (to.value.substr(0,2) != "0x") - to.value = "0x"+to.value; - } - - var value = document.querySelector("#amount"); - var amount = parseInt( value.value ); - console.log("transact: ", to.value, " => ", amount) - - contract.send.sendTransaction(to.value, amount ,{from: eth.accounts[0]}); - - to.value = ""; - value.value = ""; - - var message = document.querySelector("#message") - message.innerHTML = "Submitted"; - setTimeout(function() { - message.innerHTML = ""; - }, 1000); - } - - refresh(); -</script> -</html> - -<!-- -contract JevCoin { - function JevCoin() - { - balances[msg.sender] = 1000000; - } - - event Changed(address indexed from, uint indexed amount); - function send(address to, uint value) - { - if( balances[msg.sender] < value ) return; - - balances[msg.sender] -= value; - balances[to] += value; - - Changed(msg.sender, value); - Changed(to, value); - } - - function balance(address who) constant returns(uint t) - { - t = balances[who]; - } - - mapping(address => uint256) balances; - } --!> diff --git a/cmd/mist/assets/examples/coin.js b/cmd/mist/assets/examples/coin.js deleted file mode 100644 index 77daac846..000000000 --- a/cmd/mist/assets/examples/coin.js +++ /dev/null @@ -1,65 +0,0 @@ -var walletABI = [ - { - "name":"confirm", - "type":"function", - "constant":false, - "inputs":[ - {"name":"_h","type":"hash256"} - ], - "outputs":[] - },{ - "name":"execute", - "constant":false, - "type":"function", - "inputs":[ - {"name":"_to","type":"address"}, - {"name":"_value","type":"uint256"}, - {"name":"_data","type":"bytes"} - ], - "outputs":[ - {"name":"_r","type":"hash256"} - ] - },{ - "name":"kill", - "type":"function", - "constant":false, - "inputs":[ - {"name":"_to","type":"address"} - ], - "outputs":[] - },{ - "name":"changeOwner", - "type":"function", - "constant":false, - "inputs":[ - {"name":"_from","type":"address"}, - {"name":"_to","type":"address"} - ], - "outputs":[] - },{ - "name":"CashIn", - "type":"event", - "inputs":[ - {"indexed":false,"name":"value","type":"uint256"} - ] - },{ - "name":"SingleTransact", - "type":"event", - "inputs":[ - {"indexed":true,"name":"out","type":"string32"}, - {"indexed":false,"name":"owner","type":"address"}, - {"indexed":false,"name":"value","type":"uint256"}, - {"indexed":false,"name":"to","type":"address"} - ] - },{ - "name":"MultiTransact", - "type":"event", - "inputs":[ - {"indexed":true,"name":"out","type":"string32"}, - {"indexed":false,"name":"owner","type":"address"}, - {"indexed":false,"name":"operation","type":"hash256"}, - {"indexed":false,"name":"value","type":"uint256"}, - {"indexed":false,"name":"to","type":"address"} - ] - } -]; diff --git a/cmd/mist/assets/examples/info.html b/cmd/mist/assets/examples/info.html deleted file mode 100644 index 3b958a494..000000000 --- a/cmd/mist/assets/examples/info.html +++ /dev/null @@ -1,84 +0,0 @@ - -<!doctype> -<html> -<head> -<meta name="badge" content="10"> -<script type="text/javascript" src="../ext/bignumber.min.js"></script> -<script type="text/javascript" src="../ext/ethereum.js/dist/ethereum.js"></script> -</head> -<body> - <h1>Info</h1> - - <table width="100%"> - <tr> - <td>Block number</td> - <td id="number"></td> - </tr> - - <tr> - <td>Peer count</td> - <td id="peer_count"></td> - </tr> - - <tr> - <td>Default block</td> - <td id="default_block"></td> - </tr> - - <tr> - <td>Accounts</td> - <td id="accounts"></td> - </tr> - - <tr> - <td>Balance</td> - <td id="balance"></td> - - <tr> - <td>Gas price</td> - <td id="gas_price"></td> - </tr> - - <tr> - <td>Mining</td> - <td id="mining"></td> - </tr> - - <tr> - <td>Listening</td> - <td id="listening"></td> - </tr> - - <tr> - <td>Coinbase</td> - <td id="coinbase"></td> - </tr> - </table> -</body> - -<script type="text/javascript"> - var web3 = require('web3'); - var eth = web3.eth; - - web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8545')); - - eth.defaultBlock = -2 - - document.querySelector("#number").innerHTML = eth.number; - document.querySelector("#coinbase").innerHTML = eth.coinbase - document.querySelector("#peer_count").innerHTML = eth.peerCount; - document.querySelector("#default_block").innerHTML = eth.defaultBlock; - document.querySelector("#accounts").innerHTML = eth.accounts; - document.querySelector("#balance").innerHTML = web3.toEth(eth.balanceAt(eth.accounts[0])); - document.querySelector("#gas_price").innerHTML = eth.gasPrice; - document.querySelector("#mining").innerHTML = eth.mining; - document.querySelector("#listening").innerHTML = eth.listening; - eth.watch('chain').changed(function() { - document.querySelector("#number").innerHTML = eth.number; - }); - - -</script> - -</html> - diff --git a/cmd/mist/assets/examples/whisper.html b/cmd/mist/assets/examples/whisper.html deleted file mode 100644 index ad568f783..000000000 --- a/cmd/mist/assets/examples/whisper.html +++ /dev/null @@ -1,70 +0,0 @@ -<!doctype> -<html> -<title>Whisper test</title> -<head> -<script type="text/javascript" src="../ext/bignumber.min.js"></script> -<script type="text/javascript" src="../ext/ethereum.js/dist/ethereum.js"></script> -</head> -<body> - -<h1>Whisper test</h1> - -<button onclick="test()">Send</button> -<button onclick="test2()">Private send</button> - -<table width="100%" id="table"> - <tr> - <td>Count</td> - <td id="count"></td> - </tr> - - <tr> - <td>ID</td> - <td id="id"></td> - </tr> - - <tr> - <td>Has identity</td> - <td id="known"></td> - </tr> -</table> -</body> - -<script type="text/javascript"> - var web3 = require('web3'); - web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080')); - - var shh = web3.shh; - - var id = shh.newIdentity(); - document.querySelector("#id").innerHTML = id; - document.querySelector("#known").innerHTML = shh.haveIdentity(id); - - var watch = shh.watch({topics: ["test"]}) - watch.arrived(function(message) { - document.querySelector("#table").innerHTML += "<tr><td colspan='2'>"+JSON.stringify(message)+"</td></tr>"; - }); - - var selfWatch = shh.watch({to: id, topics: ["test"]}) - selfWatch.arrived(function(message) { - document.querySelector("#table").innerHTML += "<tr><td>To me</td><td>"+JSON.stringify(message)+"</td></tr>"; - }); - - function test() { - shh.post({topics: ["test"], payload: web3.fromAscii("test it")}); - count(); - } - - function test2() { - shh.post({to: id, topics: ["test"], payload: web3.fromAscii("Private")}); - count(); - } - - function count() { - document.querySelector("#count").innerHTML = watch.messages().length; - } -</script> - -</html> - - |