X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=scripts%2Fget_history;h=871ab71a8ed390163a3189d1a773382cca5da7fc;hb=3cbe11a42473af52e7c5e002c36aaaf32646f627;hp=c68009858ef0e3cb83d4dae76aaf6b2974675574;hpb=1a781036cf0a3d04c5e170ef71fbf3e36c2ab908;p=electrum-nvc.git diff --git a/scripts/get_history b/scripts/get_history index c680098..871ab71 100755 --- a/scripts/get_history +++ b/scripts/get_history @@ -1,28 +1,16 @@ #!/usr/bin/env python import sys -from electrum import Interface +from electrum_nvc import NetworkProxy, print_json try: addr = sys.argv[1] -except: - print "usage: get_history " +except Exception: + print "usage: get_history " sys.exit(1) -i = Interface({'server':'electrum.novit.ro:50001:t'}) -i.start() -i.send([('blockchain.address.get_history',[addr])]) +n = NetworkProxy() +n.start(start_daemon=True) +h = n.synchronous_get([ ('blockchain.address.get_history',[addr]) ])[0] +print_json(h) -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