chainlib-eth

Ethereum implementation of the chainlib interface
Log | Files | Refs | README | LICENSE

commit 03d144b2f7c09179ebe3baaefeda92d4ea00ef9c
parent 196f5537fc14807dae57c43877ef6d06c48369db
Author: lash <dev@holbrook.no>
Date:   Mon, 13 Feb 2023 05:43:44 +0000

Enable setting sender address on contract calls from cli

Diffstat:
MCHANGELOG | 2++
Mchainlib/eth/cli/rpc.py | 13+++++++++----
Mchainlib/eth/runnable/encode.py | 20--------------------
Mchainlib/eth/runnable/info.py | 2+-
Mchainlib/eth/settings.py | 5+++--
Mrequirements.txt | 2+-
Msetup.cfg | 2+-
7 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG @@ -1,3 +1,5 @@ +- 0.4.14 + * Enable setting of unsigned sender address for contract calls - 0.4.13 * Enable send from eth-encode - 0.4.12 diff --git a/chainlib/eth/cli/rpc.py b/chainlib/eth/cli/rpc.py @@ -1,6 +1,7 @@ # external imports from chainlib.cli import Rpc as BaseRpc from chainlib.eth.connection import EthHTTPConnection +from chainlib.eth.constant import ZERO_ADDRESS # local imports from chainlib.eth.gas import ( @@ -19,6 +20,9 @@ class Rpc(BaseRpc): """ + + default_sender_address = ZERO_ADDRESS + def __init__(self, wallet=None): super(Rpc, self).__init__(EthHTTPConnection, wallet=wallet) @@ -59,10 +63,11 @@ class Rpc(BaseRpc): else: self.fee_oracle = RPCGasOracle(self.conn, id_generator=self.id_generator) - error_parser = None - if config.get('RPC_DIALECT') == 'openethereum': - from chainlib.eth.dialect.openethereum import DialectErrorParser - self.error_parser = DialectErrorParser() + # todo move to separate repo for dialect apply + #error_parser = None + #if config.get('RPC_DIALECT') == 'openethereum': + # from chainlib.eth.dialect.openethereum import DialectErrorParser + # self.error_parser = DialectErrorParser() return self.conn diff --git a/chainlib/eth/runnable/encode.py b/chainlib/eth/runnable/encode.py @@ -90,30 +90,10 @@ settings = process_settings(settings, config) logg.debug('settings loaded:\n{}'.format(settings)) -#wallet = chainlib.eth.cli.Wallet(EIP155Signer) -#wallet.from_config(config) -# -#rpc = chainlib.eth.cli.Rpc(wallet=wallet) -#conn = rpc.connect_by_config(config) -# -#send = config.true('_RPC_SEND') - -#chain_spec = None -#try: -# chain_spec = ChainSpec.from_chain_str(config.get('CHAIN_SPEC')) -#except AttributeError: -# pass - - def main(): signer_address = ZERO_ADDRESS signer = None - #try: - #signer = rpc.get_signer() - # signer_address = rpc.get_signer_address() - #except SignerMissingException: - # pass conn = settings.get('CONN') signer_address = settings.get('SENDER_ADDRESS') diff --git a/chainlib/eth/runnable/info.py b/chainlib/eth/runnable/info.py @@ -78,7 +78,7 @@ def process_config_local(config, arg, args, flags): arg_flags = ArgFlag() arg = Arg(arg_flags) -flags = arg_flags.STD_READ | arg_flags.ENV +flags = arg_flags.STD_READ_NOEX | arg_flags.ENV | arg_flags.TAB argparser = chainlib.eth.cli.ArgumentParser() argparser = process_args(argparser, arg, flags) diff --git a/chainlib/eth/settings.py b/chainlib/eth/settings.py @@ -31,15 +31,16 @@ def process_settings_rpc(settings, config): settings.set('GAS_ORACLE', gas_oracle) settings.set('FEE_ORACLE', gas_oracle) + sender_address = rpc.get_sender_address() try: settings.set('SIGNER', rpc.get_signer()) - sender_address = rpc.get_sender_address() - settings.set('SENDER_ADDRESS', add_0x(sender_address)) except AttributeError: pass except SignerMissingException: pass + settings.set('SENDER_ADDRESS', add_0x(sender_address)) + nonce_oracle = rpc.get_nonce_oracle() settings.set('NONCE_ORACLE', nonce_oracle) diff --git a/requirements.txt b/requirements.txt @@ -3,4 +3,4 @@ pysha3==1.0.2 hexathon~=0.1.7 websocket-client==0.57.0 potaahto~=0.1.1 -chainlib~=0.4.6 +chainlib~=0.4.7 diff --git a/setup.cfg b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = chainlib-eth -version = 0.4.13 +version = 0.4.14 description = Ethereum implementation of the chainlib interface author = Louis Holbrook author_email = dev@holbrook.no