From 65158d39b0632226c168b9a3415365ca8f072cbf Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 4 Feb 2015 15:05:47 -0800 Subject: Filtering --- cmd/mist/assets/examples/coin.html | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'cmd/mist/assets/examples/coin.html') diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html index edeabe5e8..070ac94a6 100644 --- a/cmd/mist/assets/examples/coin.html +++ b/cmd/mist/assets/examples/coin.html @@ -32,17 +32,19 @@ web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080')); var desc = [{ "name": "balance(address)", + "type": "function", "inputs": [{ "name": "who", "type": "address" }], - "const": true, + "constant": true, "outputs": [{ "name": "value", "type": "uint256" }] }, { "name": "send(address,uint256)", + "type": "function", "inputs": [{ "name": "to", "type": "address" @@ -51,21 +53,31 @@ "type": "uint256" }], "outputs": [] + }, { + "name":"Changed", + "type":"event", + "inputs": [ + {"name":"to","type":"address","indexed":false}, + {"name":"amount","type":"uint256","indexed":true}, + ], }]; - var address = web3.db.get("jevcoin", "address"); + var address = "";//web3.db.get("jevcoin", "address"); if( address.length == 0 ) { - var code = "0x60056011565b60ae8060356000396000f35b64174876e800600033600160a060020a031660005260205260406000208190555056006001600060e060020a600035048063d0679d34146022578063e3d670d714603457005b602e6004356024356047565b60006000f35b603d600435608d565b8060005260206000f35b80600083600160a060020a0316600052602052604060002090815401908190555080600033600160a060020a031660005260205260406000209081540390819055505050565b6000600082600160a060020a0316600052602052604060002054905091905056"; + var code = "0x60056011565b60b88060356000396000f35b64e8d4a51000600033600160a060020a0316600052602052604060002081905550560060e060020a6000350480637bb98a68146028578063d0679d34146034578063e3d670d714604657005b602e60b3565b60006000f35b60406004356024356059565b60006000f35b604f6004356091565b8060005260206000f35b8060005281600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660206000a25050565b6000600082600160a060020a03166000526020526040600020549050919050565b5b60008156"; address = web3.eth.transact({ data: code, - gasprice: "1000000000000000", + gasPrice: "1000000000000000", gas: "10000", }); web3.db.put("jevcoin", "address", address); } var contract = web3.eth.contract(address, desc); - + contract.Changed({to: "0xaabb"}).changed(function(e) { + console.log("e: " + JSON.stringify(e)); + }); + contract.transact({gas: "10000", gasprice: eth.gasPrice}).send( "0xaa", 10000 ); function reflesh() { document.querySelector("#balance").innerHTML = contract.call().balance(eth.coinbase); -- cgit