Adds notion of last received and last token for ordering of the tokens list.

This commit is contained in:
PhilipWafula 2021-11-22 13:22:04 +03:00
parent b18bb959a5
commit 9addb901cc
Signed by untrusted user: mango-habanero
GPG Key ID: B00CE9034DA19FB7
1 changed files with 8 additions and 0 deletions

View File

@ -74,6 +74,14 @@ def parse_transaction(transaction: dict) -> dict:
role = transaction.get('role')
alt_blockchain_address = transaction.get('alt_blockchain_address')
blockchain_address = transaction.get('blockchain_address')
identifier = bytes.fromhex(blockchain_address)
token_symbol = transaction.get('token_symbol')
if role == 'recipient':
key = cache_data_key(identifier=identifier, salt=MetadataPointer.TOKEN_LAST_RECEIVED)
cache_data(key, token_symbol)
if role == 'sender':
key = cache_data_key(identifier=identifier, salt=MetadataPointer.TOKEN_LAST_SENT)
cache_data(key, token_symbol)
account = validate_transaction_account(blockchain_address, role, session)
alt_account = session.query(Account).filter_by(blockchain_address=alt_blockchain_address).first()
if alt_account: