def dispatch_request(self): config = app.config['yada_config'] mongo = app.config['yada_mongo'] address = request.args.get('address') bulletin_secret = request.args.get('bulletin_secret').replace(' ', "+") rid = TU.generate_rid(config, bulletin_secret) unspent_transactions = [ x for x in BU.get_wallet_unspent_transactions( config, mongo, address) ] spent_fastgraph_ids = [] for x in BU.get_wallet_unspent_fastgraph_transactions( config, mongo, address): spent_fastgraph_ids.extend([y['id'] for y in x['inputs']]) regular_txns = [] txns_for_fastgraph = [] for txn in unspent_transactions: if txn['id'] in spent_fastgraph_ids: continue if 'signatures' in txn and txn['signatures']: fastgraph = FastGraph.from_dict(config, mongo, 0, txn) origin_fasttrack = fastgraph.get_origin_relationship(rid) if origin_fasttrack: txns_for_fastgraph.append(txn) else: regular_txns.append(txn) else: if 'rid' in txn and txn[ 'rid'] == rid and 'dh_public_key' in txn and txn[ 'dh_public_key']: txns_for_fastgraph.append(txn) else: regular_txns.append(txn) wallet = { 'balance': BU.get_wallet_balance(config, mongo, address), 'unspent_transactions': regular_txns, 'txns_for_fastgraph': txns_for_fastgraph } return json.dumps(wallet, indent=4)
def dispatch_request(self): # after the necessary signatures are gathered, the transaction is sent here. return BU.get_wallet_unspent_fastgraph_transactions( app.config.get('yada_config'), app.config.get('yada_mongo'), request.args.get('address'))