commit f46f4fc128c8723d776485b14775deca72b5ef6d
parent a392f804407d90511a9ccee41df9c4c8c4728861
Author: lash <dev@holbrook.no>
Date: Thu, 13 Oct 2022 13:17:05 +0000
Use new cli flags generation for flags cli tool
Diffstat:
4 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,3 +1,5 @@
+- 0.3.3
+ * Update flags bit value cli command to use new cli flags generator
- 0.3.2
* Fix crash when supplying block number to block cli tool
* Allow non-pending nonce bootstrap
diff --git a/chainlib/eth/runnable/flags.py b/chainlib/eth/runnable/flags.py
@@ -2,22 +2,32 @@
import sys
# external imports
-import chainlib.eth.cli
+from chainlib.eth.cli.arg import ArgFlag
from hexathon import add_0x
+
cmds = {
- 'gas': chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.WALLET,
- 'info': chainlib.eth.cli.argflag_reset(chainlib.cli.argflag_std_base_read, chainlib.eth.cli.Flag.CHAIN_SPEC),
- 'get': chainlib.eth.cli.argflag_reset(chainlib.cli.argflag_std_base_read, chainlib.eth.cli.Flag.CHAIN_SPEC),
- 'decode': chainlib.cli.argflag_std_base | chainlib.eth.cli.Flag.CHAIN_SPEC,
- 'encode': chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC | chainlib.eth.cli.Flag.FEE | chainlib.eth.cli.Flag.FMT_HUMAN | chainlib.eth.cli.Flag.FMT_WIRE | chainlib.eth.cli.Flag.FMT_RPC,
- 'count': chainlib.eth.cli.argflag_std_base_read | chainlib.eth.cli.Flag.WALLET,
- 'raw': chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC,
- 'balance': chainlib.eth.cli.argflag_std_base | chainlib.eth.cli.Flag.WALLET,
- 'wait': chainlib.eth.cli.argflag_reset(chainlib.eth.cli.argflag_std_base_read | chainlib.eth.cli.Flag.NO_TARGET | chainlib.eth.cli.Flag.RPC_AUTH, chainlib.eth.cli.Flag.CHAIN_SPEC | chainlib.eth.cli.Flag.RAW),
- 'checksum': 0,
+ 'gas': [['std_write', 'wallet'], []], #chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.WALLET,
+ 'info' : [['std_base_read'], ['chain_spec']],
+ 'get' : [['std_base_read'], ['chain_spec']],
+ 'decode': [['std_base', 'chain_spec'], []],
+ 'encode': [['std_write', 'exec' ,'fee', 'fmt_human', 'fmt_wire', 'fmt_rpc'], []],
+ 'count' : [['std_base_read', 'wallet'], []],
+ 'raw': [['std_write', 'exec'], []],
+ 'balance': [['std_base', 'wallet'], []],
+ 'wait': [['std_base_read', 'target', 'rpc_auth'], ['chain_spec', 'raw']],
+ 'checksum': [[], []],
}
+
if __name__ == '__main__':
- b = cmds[sys.argv[1]]
- print(add_0x(hex(b)))
+ args = ArgFlag()
+ r = 0
+ instructions = cmds[sys.argv[1]]
+ for k in instructions[0]:
+ v = args.get(k)
+ r = args.more(r, v)
+ for k in instructions[1]:
+ v = args.get(k)
+ r = args.less(r, v)
+ print(add_0x(hex(r)))
diff --git a/chainlib/eth/tx.py b/chainlib/eth/tx.py
@@ -756,7 +756,10 @@ input {}
""".format(
self.result.fee_cost,
)
- status = self.result.status.name
+ try:
+ status = self.result.status.name
+ except AttributeError:
+ logg.debug('tx {} does not have a result yet', self.hash)
s += 'status ' + status + '\n'
diff --git a/setup.cfg b/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = chainlib-eth
-version = 0.3.2
+version = 0.3.3
description = Ethereum implementation of the chainlib interface
author = Louis Holbrook
author_email = dev@holbrook.no