Skip to content

Commit

Permalink
Handles contract creation tx, refs #142
Browse files Browse the repository at this point in the history
Handles the scenario in the lib, but not in the test, refs #142
  • Loading branch information
AndreMiras committed Jul 29, 2018
1 parent c890ce4 commit 6a6d91c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pywalib.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ def get_transaction_history(address):
value_eth = value_wei / float(pow(10, 18))
value_eth = round(value_eth, ROUND_DIGITS)
from_address = PyWalib.address_hex(transaction['from'])
to_address = PyWalib.address_hex(transaction['to'])
to_address = transaction['to']
# on contract creation, "to" is replaced by the "contractAddress"
if not to_address:
to_address = transaction['contractAddress']
to_address = PyWalib.address_hex(to_address)
sent = from_address == address
received = not sent
extra_dict = {
Expand Down

0 comments on commit 6a6d91c

Please sign in to comment.