URI: 
       tget_history.py - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
       tget_history.py (785B)
       ---
            1 #!/usr/bin/env python3
            2 
            3 import sys
            4 import asyncio
            5 
            6 from electrum import bitcoin
            7 from electrum.network import Network
            8 from electrum.util import json_encode, print_msg, create_and_start_event_loop, log_exceptions
            9 from electrum.simple_config import SimpleConfig
           10 
           11 
           12 try:
           13     addr = sys.argv[1]
           14 except Exception:
           15     print("usage: get_history <bitcoin_address>")
           16     sys.exit(1)
           17 
           18 config = SimpleConfig()
           19 
           20 loop, stopping_fut, loop_thread = create_and_start_event_loop()
           21 network = Network(config)
           22 network.start()
           23 
           24 @log_exceptions
           25 async def f():
           26     try:
           27         sh = bitcoin.address_to_scripthash(addr)
           28         hist = await network.get_history_for_scripthash(sh)
           29         print_msg(json_encode(hist))
           30     finally:
           31         stopping_fut.set_result(1)
           32 
           33 asyncio.run_coroutine_threadsafe(f(), loop)