def run(begin=None, end=None): blockchain = Blockchain( mode="head", bitshares_instance=bitshares ) for op in blockchain.stream( opNames=["account_create"], start=int(begin) if begin else None, stop=int(end) if end else None, ): blockid = op.get("block_num") timestamp = op.get("timestamp") if not blockid % 100: print("Blockid: %d (%s)" % (blockid, timestamp), flush=True) try: pprint(bitshares.transfer( op["name"], config["donation_amount"], config["donation_asset"], account=config["registrar"] )) except Exception as e: log.error(str(e)) pass
def run(begin=None, end=None): blockchain = Blockchain(mode="head", bitshares_instance=bitshares) for op in blockchain.stream( opNames=["account_create"], start=int(begin) if begin else None, stop=int(end) if end else None, ): blockid = op.get("block_num") timestamp = op.get("timestamp") if not blockid % 100: print("Blockid: %d (%s)" % (blockid, timestamp), flush=True) try: pprint( bitshares.transfer(op["name"], config["donation_amount"], config["donation_asset"], account=config["registrar"])) except Exception as e: log.error(str(e)) pass
auth_token = '' client = Client(account_sid, auth_token) bitshares = BitShares( node=[ "wss://na.openledger.info/ws", "wss://kc-us-dex.xeldal.com/ws" ] ) blockchain = Blockchain( blockchain_instance=bitshares, mode='head' ) for op in blockchain.stream(['transfer']): payee = Account(op['to']).name from_account = Account(op['from']).name asset_symbol = Asset(op['amount']['asset_id']).symbol asset_precision = int(Asset(op['amount']['asset_id']).precision) amount = int(op['amount']['amount']) / (10**asset_precision) Asset.clear_cache() Account.clear_cache() body = '{} sent {} {} {} in block {}.'.format( from_account, payee, amount, asset_symbol, op['block_num']) pprint(body) if payee == ACCOUNT_WATCHING: