def faux_realtime_callback(block_id): bountyContract = getBountyContract(web3, bounty_contract_address) bsrs = BountySyncRequest.objects.filter(processed=False) for bsr in bsrs: url = bsr.github_url process_change(bountyContract, url, None, None) # TODO - pass options['network'] in pass
def realtime_callback(transaction_hash): block = web3.eth.getBlock('latest') fromBlock = block['number'] - 1 _filter = web3.eth.filter({ "fromBlock": fromBlock, "toBlock": "latest", "address": bounty_contract_address, }) bountyContract = getBountyContract(web3, bounty_contract_address) log_entries = _filter.get(False) print('got {} log entrires from web3'.format(len(log_entries))) for entry in log_entries: txid = entry['transactionHash'] result = web3.toAscii(entry['data']) result = result[result.find('http'):] url = result[:result.find('\x00')] process_change(bountyContract, url, txid, None) # TODO - pass options['network'] in