Adds token decimals to transaction object.

This commit is contained in:
PhilipWafula 2021-11-22 19:54:29 +03:00
parent dc454eeec8
commit 29b2d7084a
Signed by untrusted user: mango-habanero
GPG Key ID: B00CE9034DA19FB7

View File

@ -100,14 +100,17 @@ def transaction_actors(transaction: dict) -> Tuple[Dict, Dict]:
"""
destination_token_symbol = transaction.get('destination_token_symbol')
destination_token_value = transaction.get('destination_token_value') or transaction.get('to_value')
destination_token_decimals = transaction.get('destination_token_decimals')
recipient_blockchain_address = transaction.get('recipient')
sender_blockchain_address = transaction.get('sender')
source_token_symbol = transaction.get('source_token_symbol')
source_token_value = transaction.get('source_token_value') or transaction.get('from_value')
source_token_decimals = transaction.get('source_token_decimals')
recipient_transaction_data = {
"token_symbol": destination_token_symbol,
"token_value": destination_token_value,
"token_decimals": destination_token_decimals,
"blockchain_address": recipient_blockchain_address,
"role": "recipient",
}
@ -115,6 +118,7 @@ def transaction_actors(transaction: dict) -> Tuple[Dict, Dict]:
"blockchain_address": sender_blockchain_address,
"token_symbol": source_token_symbol,
"token_value": source_token_value,
"token_decimals": source_token_decimals,
"role": "sender",
}
return recipient_transaction_data, sender_transaction_data