chainqueue

Blockchain transaction queue control
Log | Files | Refs | LICENSE

commit 7e3d9630ceaa980b165eb581b69687a956eb41c2
parent faa9988d53cb7967b7183ae1e292c4bdb5cf3cb2
Author: nolash <dev@holbrook.no>
Date:   Sat, 28 Aug 2021 03:10:21 +0200

Add missing encode module

Diffstat:
Achainqueue/encode.py | 48++++++++++++++++++++++++++++++++++++++++++++++++
Msetup.cfg | 2+-
2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/chainqueue/encode.py b/chainqueue/encode.py @@ -0,0 +1,48 @@ +# standard imports +import logging + +# external imports +from hexathon import ( + add_0x, + strip_0x, + uniform as hex_uniform, + ) + +logg = logging.getLogger(__name__) + + +class TxHexNormalize: + + def tx_hash(self, tx_hash): + return self.__hex_normalize(tx_hash) + + + def tx_wire(self, tx_wire): + return self.__hex_normalize(tx_wire) + + + def wallet_address(self, address): + return self.__hex_normalize(address) + + + def executable_address(self, address): + return self.__hex_normalize(address) + + + def __hex_normalize(self, data): + r = add_0x(hex_uniform(strip_0x(data))) + logg.debug('tx hex normalize {} -> {}'.format(data, r)) + return r + + +class NoopNormalize: + + def __init__(self): + self.tx_hash = self.__noop + self.tx_wire = self.__noop + self.wallet_address = self.__noop + self.executable_address = self.__noop + + + def __noop(self, data): + return data diff --git a/setup.cfg b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = chainqueue -version = 0.0.4a7 +version = 0.0.4a8 description = Generic blockchain transaction queue control author = Louis Holbrook author_email = dev@holbrook.no