From ccacffe962fcf065df0a8c8a5f49588af9926354 Mon Sep 17 00:00:00 2001 From: nolash Date: Fri, 15 Oct 2021 22:58:33 +0200 Subject: [PATCH] Correct remaining crypto_dev_signer prefixes --- funga/eth/cli/http.py | 2 +- funga/eth/helper/__init__.py | 1 - funga/eth/helper/tx.py | 58 ------------------------------------ funga/eth/transaction.py | 2 +- setup.py | 2 +- 5 files changed, 3 insertions(+), 62 deletions(-) delete mode 100644 funga/eth/helper/__init__.py delete mode 100644 funga/eth/helper/tx.py diff --git a/funga/eth/cli/http.py b/funga/eth/cli/http.py index 1ae2d72..2bde197 100644 --- a/funga/eth/cli/http.py +++ b/funga/eth/cli/http.py @@ -9,7 +9,7 @@ from http.server import ( # local imports from .handle import SignRequestHandler -from crypto_dev_signer.error import SignerError +from funga.error import SignerError logg = logging.getLogger(__name__) diff --git a/funga/eth/helper/__init__.py b/funga/eth/helper/__init__.py deleted file mode 100644 index e41e515..0000000 --- a/funga/eth/helper/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .tx import EthTxExecutor diff --git a/funga/eth/helper/tx.py b/funga/eth/helper/tx.py deleted file mode 100644 index 9e6441b..0000000 --- a/funga/eth/helper/tx.py +++ /dev/null @@ -1,58 +0,0 @@ -# standard imports -import logging - -# local imports -from crypto_dev_signer.helper import TxExecutor -from crypto_dev_signer.error import NetworkError - -logg = logging.getLogger() -logging.getLogger('web3').setLevel(logging.CRITICAL) -logging.getLogger('urllib3').setLevel(logging.CRITICAL) - - -class EthTxExecutor(TxExecutor): - - def __init__(self, w3, sender, signer, chain_id, verifier=None, block=False): - self.w3 = w3 - nonce = self.w3.eth.getTransactionCount(sender, 'pending') - super(EthTxExecutor, self).__init__(sender, signer, self.translator, self.dispatcher, self.reporter, nonce, chain_id, self.fee_helper, self.fee_price_helper, verifier, block) - - - def fee_helper(self, tx): - estimate = self.w3.eth.estimateGas(tx) - if estimate < 21000: - estimate = 21000 - logg.debug('estimate {} {}'.format(tx, estimate)) - return estimate - - - def fee_price_helper(self): - return self.w3.eth.gasPrice - - - def dispatcher(self, tx): - error_object = None - try: - tx_hash = self.w3.eth.sendRawTransaction(tx) - except ValueError as e: - error_object = e.args[0] - logg.error('node could not intepret rlp {}'.format(tx)) - if error_object != None: - raise NetworkError(error_object) - return tx_hash - - - def reporter(self, tx): - return self.w3.eth.getTransactionReceipt(tx) - - - def translator(self, tx): - if tx.get('feePrice') != None: - tx['gasPrice'] = tx['feePrice'] - del tx['feePrice'] - - if tx.get('feeUnits') != None: - tx['gas'] = tx['feeUnits'] - del tx['feeUnits'] - - return tx diff --git a/funga/eth/transaction.py b/funga/eth/transaction.py index 105df3a..7404e3f 100644 --- a/funga/eth/transaction.py +++ b/funga/eth/transaction.py @@ -13,7 +13,7 @@ from hexathon import ( # local imports from funga.eth.encoding import chain_id_to_v -#from crypto_dev_signer.eth.rlp import rlp_encode +#from funga.eth.rlp import rlp_encode import rlp logg = logging.getLogger(__name__) diff --git a/setup.py b/setup.py index fa2319e..4c61438 100644 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ setup( long_description_content_type='text/markdown', entry_points = { 'console_scripts': [ - 'funga-eth=funga.eth.runnable.signer:main', + 'funga-ethd=funga.eth.runnable.signer:main', 'eth-keyfile=funga.eth.runnable.keyfile:main', ], },