From e70c20803f46838f4b9e9296a5af4cfd7cae331b Mon Sep 17 00:00:00 2001 From: thomasv Date: Mon, 8 Oct 2012 15:19:05 +0200 Subject: [PATCH] create scripts directory --- MANIFEST.in | 4 ++-- blocks | 16 ---------------- get_history | 29 ----------------------------- peers | 12 ------------ scripts/blocks | 16 ++++++++++++++++ scripts/get_history | 29 +++++++++++++++++++++++++++++ scripts/peers | 12 ++++++++++++ scripts/watch_address | 35 +++++++++++++++++++++++++++++++++++ watch_address | 35 ----------------------------------- 9 files changed, 94 insertions(+), 94 deletions(-) delete mode 100755 blocks delete mode 100755 get_history delete mode 100755 peers create mode 100755 scripts/blocks create mode 100755 scripts/get_history create mode 100755 scripts/peers create mode 100755 scripts/watch_address delete mode 100755 watch_address diff --git a/MANIFEST.in b/MANIFEST.in index afdcd1b..91eed64 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,6 +6,6 @@ recursive-include ecdsa *.py recursive-include aes *.py include app.fil include icons.qrc -include remote.php recursive-include icons * - +include scripts +recursive_include scripts/* diff --git a/blocks b/blocks deleted file mode 100755 index 01fbc70..0000000 --- a/blocks +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -from electrum import TcpStratumInterface - -i = TcpStratumInterface('electrum.novit.ro', 50001) -i.init_socket() -i.start() -i.send([('blockchain.numblocks.subscribe',[])]) - -while True: - try: - r = i.responses.get(True, 100000000000) - except KeyboardInterrupt: - break - if r.get('method') == 'blockchain.numblocks.subscribe': - print r.get('result') diff --git a/get_history b/get_history deleted file mode 100755 index 95600c2..0000000 --- a/get_history +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -import sys -from electrum import TcpStratumInterface - -try: - addr = sys.argv[1] -except: - print "usage: get_history " - sys.exit(1) - -i = TcpStratumInterface('electrum.novit.ro', 50001) -i.init_socket() -i.start() -i.send([('blockchain.address.get_history',[addr])]) - -while True: - try: - r = i.responses.get(True, 100000000000) - except KeyboardInterrupt: - break - method = r.get('method') - if method == 'blockchain.address.get_history': - confirmed = unconfirmed = 0 - h = r.get('result') - for item in h: - print item['tx_hash'], item['value'] - - break diff --git a/peers b/peers deleted file mode 100755 index ac3f539..0000000 --- a/peers +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python - -from electrum import TcpStratumInterface - -i = TcpStratumInterface('electrum.novit.ro', 50001) -i.init_socket() -i.start() -i.send([('server.peers.subscribe',[])]) - -while True: - r = i.responses.get(True, 100000000000) - print r.get('result') diff --git a/scripts/blocks b/scripts/blocks new file mode 100755 index 0000000..01fbc70 --- /dev/null +++ b/scripts/blocks @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +from electrum import TcpStratumInterface + +i = TcpStratumInterface('electrum.novit.ro', 50001) +i.init_socket() +i.start() +i.send([('blockchain.numblocks.subscribe',[])]) + +while True: + try: + r = i.responses.get(True, 100000000000) + except KeyboardInterrupt: + break + if r.get('method') == 'blockchain.numblocks.subscribe': + print r.get('result') diff --git a/scripts/get_history b/scripts/get_history new file mode 100755 index 0000000..95600c2 --- /dev/null +++ b/scripts/get_history @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import sys +from electrum import TcpStratumInterface + +try: + addr = sys.argv[1] +except: + print "usage: get_history " + sys.exit(1) + +i = TcpStratumInterface('electrum.novit.ro', 50001) +i.init_socket() +i.start() +i.send([('blockchain.address.get_history',[addr])]) + +while True: + try: + r = i.responses.get(True, 100000000000) + except KeyboardInterrupt: + break + method = r.get('method') + if method == 'blockchain.address.get_history': + confirmed = unconfirmed = 0 + h = r.get('result') + for item in h: + print item['tx_hash'], item['value'] + + break diff --git a/scripts/peers b/scripts/peers new file mode 100755 index 0000000..ac3f539 --- /dev/null +++ b/scripts/peers @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +from electrum import TcpStratumInterface + +i = TcpStratumInterface('electrum.novit.ro', 50001) +i.init_socket() +i.start() +i.send([('server.peers.subscribe',[])]) + +while True: + r = i.responses.get(True, 100000000000) + print r.get('result') diff --git a/scripts/watch_address b/scripts/watch_address new file mode 100755 index 0000000..50c3f5d --- /dev/null +++ b/scripts/watch_address @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +import sys +from electrum import TcpStratumInterface + +try: + addr = sys.argv[1] +except: + print "usage: watch_address " + sys.exit(1) + +i = TcpStratumInterface('electrum.novit.ro', 50001) +i.init_socket() +i.start() +i.send([('blockchain.address.subscribe',[addr])]) + +while True: + r = i.responses.get(True, 100000000000) + method = r.get('method') + if method == 'blockchain.address.subscribe': + i.send([('blockchain.address.get_history',[addr])]) + elif method == 'blockchain.address.get_history': + confirmed = unconfirmed = 0 + h = r.get('result') + if h is None: + continue + for item in h: + v = item['value'] + if item['height']: + confirmed += v + else: + unconfirmed += v + print (confirmed+unconfirmed)/1.e8 + + diff --git a/watch_address b/watch_address deleted file mode 100755 index 50c3f5d..0000000 --- a/watch_address +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python - -import sys -from electrum import TcpStratumInterface - -try: - addr = sys.argv[1] -except: - print "usage: watch_address " - sys.exit(1) - -i = TcpStratumInterface('electrum.novit.ro', 50001) -i.init_socket() -i.start() -i.send([('blockchain.address.subscribe',[addr])]) - -while True: - r = i.responses.get(True, 100000000000) - method = r.get('method') - if method == 'blockchain.address.subscribe': - i.send([('blockchain.address.get_history',[addr])]) - elif method == 'blockchain.address.get_history': - confirmed = unconfirmed = 0 - h = r.get('result') - if h is None: - continue - for item in h: - v = item['value'] - if item['height']: - confirmed += v - else: - unconfirmed += v - print (confirmed+unconfirmed)/1.e8 - - -- 1.7.1