diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-11 18:40:12 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-11 18:40:12 +0800 |
commit | cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007 (patch) | |
tree | ab28c518bd1b78f6b8ac8b241951ad161cb268a9 /cmd/mist/assets/ext/ethereum.js/example/event.html | |
parent | 21fd31dad8bc6e0291ca405314b516670333c707 (diff) | |
parent | c6af5f0a275608ea6c797ef826e6090885f24eac (diff) | |
download | dexon-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar dexon-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.gz dexon-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.bz2 dexon-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.lz dexon-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.xz dexon-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.zst dexon-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.zip |
Merge branch 'develop' into jsonrpc
Conflicts:
rpc/ws/server.go
Diffstat (limited to 'cmd/mist/assets/ext/ethereum.js/example/event.html')
-rw-r--r-- | cmd/mist/assets/ext/ethereum.js/example/event.html | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/cmd/mist/assets/ext/ethereum.js/example/event.html b/cmd/mist/assets/ext/ethereum.js/example/event.html new file mode 100644 index 000000000..84d302437 --- /dev/null +++ b/cmd/mist/assets/ext/ethereum.js/example/event.html @@ -0,0 +1,120 @@ +<!doctype> +<html> + <head> + <script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script> + <script type="text/javascript" src="../dist/ethereum.js"></script> + <script type="text/javascript"> + var web3 = require('web3'); + web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080')); + + var desc = [{ + "type":"event", + "inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}], + "name":"Event" + }, { + "type":"event", + "inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}], + "name":"Event2" + }, { + "type":"function", + "inputs": [{"name":"a","type":"uint256"}], + "name":"foo", + "outputs": [] + }]; + + var address = '0x01'; + + var contract = web3.eth.contract(address, desc); + + function test1() { + // "{"topic":["0x83c9849c","0xc4d76332"],"address":"0x01"}" + web3.eth.watch(contract).changed(function (res) { + + }); + }; + + function test2() { + // "{"topic":["0x83c9849c"],"address":"0x01"}" + web3.eth.watch(contract.Event).changed(function (res) { + + }); + }; + + function test3() { + // "{"topic":["0x83c9849c"],"address":"0x01"}" + contract.Event().changed(function (res) { + + }); + }; + + function test4() { + // "{"topic":["0x83c9849c","0000000000000000000000000000000000000000000000000000000000000045"],"address":"0x01"}" + contract.Event({a: 69}).changed(function (res) { + + }); + }; + + function test5() { + // "{"topic":["0x83c9849c",["0000000000000000000000000000000000000000000000000000000000000045","000000000000000000000000000000000000000000000000000000000000002a"]],"address":"0x01"}" + contract.Event({a: [69, 42]}).changed(function (res) { + + }); + }; + + function test6() { + // "{"topic":["0x83c9849c","000000000000000000000000000000000000000000000000000000000000001e"],"max":100,"address":"0x01"}" + contract.Event({a: 30}, {max: 100}).changed(function (res) { + + }); + }; + + function test7() { + // "{"topic":["0x83c9849c","000000000000000000000000000000000000000000000000000000000000001e"],"address":"0x01"}" + web3.eth.watch(contract.Event, {a: 30}).changed(function (res) { + + }); + }; + + function test8() { + // "{"topic":["0x83c9849c","000000000000000000000000000000000000000000000000000000000000001e"],"max":100,"address":"0x01"}" + web3.eth.watch(contract.Event, {a: 30}, {max: 100}).changed(function (res) { + + }); + }; + + // not valid + // function testX() { + // web3.eth.watch([contract.Event, contract.Event2]).changed(function (res) { + // }); + // }; + + </script> + </head> + + <body> + <div> + <button type="button" onClick="test1();">test1</button> + </div> + <div> + <button type="button" onClick="test2();">test2</button> + </div> + <div> + <button type="button" onClick="test3();">test3</button> + </div> + <div> + <button type="button" onClick="test4();">test4</button> + </div> + <div> + <button type="button" onClick="test5();">test5</button> + </div> + <div> + <button type="button" onClick="test6();">test6</button> + </div> + <div> + <button type="button" onClick="test7();">test7</button> + </div> + <div> + <button type="button" onClick="test8();">test8</button> + </div> + </body> +</html> |