Add boolean to encoder
This commit is contained in:
parent
3f3a2e7af4
commit
2591a73950
@ -61,6 +61,10 @@ class ABIContractDecoder:
|
|||||||
return bool(self.uint256(v))
|
return bool(self.uint256(v))
|
||||||
|
|
||||||
|
|
||||||
|
def boolean(self, v):
|
||||||
|
return bool(self.uint256(v))
|
||||||
|
|
||||||
|
|
||||||
def address(self, v):
|
def address(self, v):
|
||||||
a = strip_0x(v)[64-40:]
|
a = strip_0x(v)[64-40:]
|
||||||
return to_checksum_address(a)
|
return to_checksum_address(a)
|
||||||
@ -143,6 +147,16 @@ class ABIContractEncoder:
|
|||||||
self.__log_latest(v)
|
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):
|
def address(self, v):
|
||||||
self.bytes_fixed(32, v, 20)
|
self.bytes_fixed(32, v, 20)
|
||||||
self.types.append(ABIContractType.ADDRESS)
|
self.types.append(ABIContractType.ADDRESS)
|
||||||
@ -161,6 +175,7 @@ class ABIContractEncoder:
|
|||||||
self.__log_latest(v)
|
self.__log_latest(v)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def string(self, v):
|
def string(self, v):
|
||||||
b = v.encode('utf-8')
|
b = v.encode('utf-8')
|
||||||
l = len(b)
|
l = len(b)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = chainlib
|
name = chainlib
|
||||||
version = 0.0.3a2
|
version = 0.0.3a3
|
||||||
description = Generic blockchain access library and tooling
|
description = Generic blockchain access library and tooling
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
Loading…
Reference in New Issue
Block a user