diff --git a/lib/components/eth.py b/lib/components/eth.py index 87ea333fd..ae2a6547d 100644 --- a/lib/components/eth.py +++ b/lib/components/eth.py @@ -118,9 +118,12 @@ def wei(value): * a string specifying the unit: "10 ether", "300 gwei", "0.25 shannon" * a large float in scientific notation, where direct conversion to int would cause inaccuracy: 8.3e32 - * a byte string: "0x330124"''' + * bytes: b'\xff\xff' + * hex strings: "0x330124"''' if value is None: return 0 + if type(value) is bytes: + value = "0x"+value.hex() if type(value) is float and "e+" in str(value): num, dec = str(value).split("e+") num = num.split(".") if "." in num else [num, ""] diff --git a/lib/components/transaction.py b/lib/components/transaction.py index e5b29a3c4..6a0a27baa 100644 --- a/lib/components/transaction.py +++ b/lib/components/transaction.py @@ -334,6 +334,8 @@ def _evaluate_trace(self): '0x'+i.hex() if type(i) is bytes else i for i in self.return_value ] + elif type(self.return_value) is bytes: + self.return_value = "0x"+self.return_value.hex() else: self.events = [] # get revert message