diff --git a/chainlib/eth/contract.py b/chainlib/eth/contract.py index 4ab234b..327cdf9 100644 --- a/chainlib/eth/contract.py +++ b/chainlib/eth/contract.py @@ -61,6 +61,10 @@ class ABIContractDecoder: return bool(self.uint256(v)) + def boolean(self, v): + return bool(self.uint256(v)) + + def address(self, v): a = strip_0x(v)[64-40:] return to_checksum_address(a) @@ -143,6 +147,16 @@ class ABIContractEncoder: self.__log_latest(v) + def bool(self, v): + return self.boolean(v) + + + def boolean(self, v): + if bool(v): + return self.uint256(1) + return self.uint256(0) + + def address(self, v): self.bytes_fixed(32, v, 20) self.types.append(ABIContractType.ADDRESS) @@ -161,6 +175,7 @@ class ABIContractEncoder: self.__log_latest(v) + def string(self, v): b = v.encode('utf-8') l = len(b) diff --git a/setup.cfg b/setup.cfg index 08a32ce..e7df6b5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = chainlib -version = 0.0.3a2 +version = 0.0.3a3 description = Generic blockchain access library and tooling author = Louis Holbrook author_email = dev@holbrook.no