Remove padding in hex values in encode cli command

This commit is contained in:
nolash 2022-01-07 12:53:27 +00:00
parent 1a73c0d1ed
commit 1fbd94d382
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 8 additions and 6 deletions

View File

@ -53,7 +53,7 @@ logg = logging.getLogger()
script_dir = os.path.dirname(os.path.realpath(__file__)) script_dir = os.path.dirname(os.path.realpath(__file__))
config_dir = os.path.join(script_dir, '..', 'data', 'config') config_dir = os.path.join(script_dir, '..', 'data', 'config')
arg_flags = chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC arg_flags = chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC | chainlib.eth.cli.Flag.FEE
argparser = chainlib.eth.cli.ArgumentParser(arg_flags) argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
argparser.add_argument('--notx', action='store_true', help='Network send is not a transaction') argparser.add_argument('--notx', action='store_true', help='Network send is not a transaction')
argparser.add_argument('--signature', type=str, help='Method signature to encode') argparser.add_argument('--signature', type=str, help='Method signature to encode')
@ -119,12 +119,14 @@ def main():
j = JSONRPCRequest(id_generator=rpc.id_generator) j = JSONRPCRequest(id_generator=rpc.id_generator)
o = j.template() o = j.template()
o['method'] = 'eth_call' o['method'] = 'eth_call'
gas_limit = add_0x(int.to_bytes(config.get('_FEE_LIMIT'), 8, byteorder='big').hex(), compact_value=True)
gas_price = add_0x(int.to_bytes(config.get('_FEE_PRICE'), 8, byteorder='big').hex(), compact_value=True)
o['params'].append({ o['params'].append({
'to': exec_address, 'to': exec_address,
'from': signer_address, 'from': signer_address,
'value': '0x00', 'value': '0x0',
'gas': add_0x(int.to_bytes(8000000, 8, byteorder='big').hex()), # TODO: better get of network gas limit 'gas': gas_limit, # TODO: better get of network gas limit
'gasPrice': '0x01', 'gasPrice': gas_price,
'data': add_0x(code), 'data': add_0x(code),
}) })
height = to_blockheight_param(config.get('_HEIGHT')) height = to_blockheight_param(config.get('_HEIGHT'))

View File

@ -1,6 +1,6 @@
funga-eth~=0.5.1 funga-eth~=0.5.1
pysha3==1.0.2 pysha3==1.0.2
hexathon~=0.1.0 hexathon~=0.1.1
websocket-client==0.57.0 websocket-client==0.57.0
potaahto~=0.1.0 potaahto~=0.1.0
chainlib~=0.0.16 chainlib~=0.0.16

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = chainlib-eth name = chainlib-eth
version = 0.0.17 version = 0.0.18
description = Ethereum implementation of the chainlib interface description = Ethereum implementation of the chainlib interface
author = Louis Holbrook author = Louis Holbrook
author_email = dev@holbrook.no author_email = dev@holbrook.no