Flags cleanup, remove persistent wallet
This commit is contained in:
parent
9419fbb77b
commit
fcd78b5ca8
@ -1,5 +1,11 @@
|
|||||||
|
- 0.0.23
|
||||||
|
* Configuration variable descriptions
|
||||||
|
* Arg flags to names listing method
|
||||||
|
* New flags preset for reads without wallet
|
||||||
|
* Remove pesistent wallet arg flag bug
|
||||||
|
* Rename arg flag reset to flag_reset
|
||||||
- 0.0.22
|
- 0.0.22
|
||||||
* Add man page generator script
|
* Man page generator script
|
||||||
- 0.0.21
|
- 0.0.21
|
||||||
* Log rpc reply before json parse
|
* Log rpc reply before json parse
|
||||||
- 0.0.20
|
- 0.0.20
|
||||||
|
@ -1 +1 @@
|
|||||||
include *requirements.txt LICENSE chainlib/data/config/*
|
include *requirements.txt LICENSE chainlib/data/config/* chainlib/data/env/*
|
||||||
|
@ -3,7 +3,8 @@ from .base import (
|
|||||||
argflag_std_read,
|
argflag_std_read,
|
||||||
argflag_std_write,
|
argflag_std_write,
|
||||||
argflag_std_base,
|
argflag_std_base,
|
||||||
reset,
|
argflag_std_base_read,
|
||||||
|
flag_reset,
|
||||||
)
|
)
|
||||||
from .arg import ArgumentParser
|
from .arg import ArgumentParser
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
@ -203,8 +203,9 @@ class ArgumentParser(argparse.ArgumentParser):
|
|||||||
if arg_flags & (Flag.SIGN | Flag.FEE):
|
if arg_flags & (Flag.SIGN | Flag.FEE):
|
||||||
self.add_argument('--fee-price', dest='fee_price', type=int, help='override fee price')
|
self.add_argument('--fee-price', dest='fee_price', type=int, help='override fee price')
|
||||||
self.add_argument('--fee-limit', dest='fee_limit', type=int, help='override fee limit')
|
self.add_argument('--fee-limit', dest='fee_limit', type=int, help='override fee limit')
|
||||||
if arg_flags & argflag_std_target == 0:
|
# wtf?
|
||||||
arg_flags |= Flag.WALLET
|
#if arg_flags & argflag_std_target == 0:
|
||||||
|
# arg_flags |= Flag.WALLET
|
||||||
if arg_flags & Flag.EXEC:
|
if arg_flags & Flag.EXEC:
|
||||||
self.add_argument('-e', self.long_args['-e'], dest=self.arg_dest['-e'], type=str, help='contract address')
|
self.add_argument('-e', self.long_args['-e'], dest=self.arg_dest['-e'], type=str, help='contract address')
|
||||||
if arg_flags & Flag.WALLET:
|
if arg_flags & Flag.WALLET:
|
||||||
|
@ -33,14 +33,32 @@ class Flag(enum.IntEnum):
|
|||||||
SEND = 262144
|
SEND = 262144
|
||||||
# rpc extras - nibble 6
|
# rpc extras - nibble 6
|
||||||
RPC_AUTH = 1048576
|
RPC_AUTH = 1048576
|
||||||
|
# upper bound
|
||||||
|
MAX = 1048576
|
||||||
|
|
||||||
argflag_std_read = 0x23ff
|
argflag_std_read = 0x23ff
|
||||||
argflag_std_write = 0xff31ff
|
argflag_std_write = 0x1731ff
|
||||||
argflag_std_base = 0x200f
|
argflag_std_base = 0x200f
|
||||||
|
argflag_std_base_read = 0xbf
|
||||||
argflag_std_target = 0x00e000
|
argflag_std_target = 0x00e000
|
||||||
argflag_all = 0xffffff
|
argflag_all = 0x17f7ff
|
||||||
|
|
||||||
def reset(flags, v):
|
|
||||||
|
def flag_reset(flags, v):
|
||||||
mask = ~(argflag_all & v)
|
mask = ~(argflag_all & v)
|
||||||
r = flags & mask
|
r = flags & mask
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
|
def flag_names(flags):
|
||||||
|
flags_debug = []
|
||||||
|
i = Flag.MAX
|
||||||
|
while True:
|
||||||
|
if flags & i > 0:
|
||||||
|
v = Flag(i)
|
||||||
|
flags_debug.append(v.name)
|
||||||
|
i >>= 1
|
||||||
|
if i == 0:
|
||||||
|
break
|
||||||
|
flags_debug.reverse()
|
||||||
|
return flags_debug
|
||||||
|
@ -132,6 +132,7 @@ class DocGenerator:
|
|||||||
|
|
||||||
|
|
||||||
def process_arg(self):
|
def process_arg(self):
|
||||||
|
|
||||||
if self.arg_flags & Flag.VERBOSE:
|
if self.arg_flags & Flag.VERBOSE:
|
||||||
o = DocEntry('--no-logs')
|
o = DocEntry('--no-logs')
|
||||||
o.set_groff('Turn of logging completely. Negates \\fB-v\\fP and \\fB-vv\\fP')
|
o.set_groff('Turn of logging completely. Negates \\fB-v\\fP and \\fB-vv\\fP')
|
||||||
@ -145,7 +146,6 @@ class DocGenerator:
|
|||||||
o.set_groff('Very verbose. Show logs with debugging information.')
|
o.set_groff('Very verbose. Show logs with debugging information.')
|
||||||
self.docs['vv'] = o
|
self.docs['vv'] = o
|
||||||
|
|
||||||
|
|
||||||
if self.arg_flags & Flag.CONFIG:
|
if self.arg_flags & Flag.CONFIG:
|
||||||
o = DocEntry('-c', '--config', argvalue='config_dir')
|
o = DocEntry('-c', '--config', argvalue='config_dir')
|
||||||
o.set_groff('Load configuration files from given directory. All files with an .ini extension will be loaded, of which all must contain valid ini file data.')
|
o.set_groff('Load configuration files from given directory. All files with an .ini extension will be loaded, of which all must contain valid ini file data.')
|
||||||
@ -244,7 +244,6 @@ class DocGenerator:
|
|||||||
o.set_groff('Produce output most optimized for machines.')
|
o.set_groff('Produce output most optimized for machines.')
|
||||||
self.docs['raw'] = o
|
self.docs['raw'] = o
|
||||||
|
|
||||||
|
|
||||||
if self.arg_flags & (Flag.SIGN | Flag.NONCE):
|
if self.arg_flags & (Flag.SIGN | Flag.NONCE):
|
||||||
o = DocEntry('--nonce')
|
o = DocEntry('--nonce')
|
||||||
o.set_groff('Explicitly set nonce to use for transaction.')
|
o.set_groff('Explicitly set nonce to use for transaction.')
|
||||||
@ -260,9 +259,10 @@ class DocGenerator:
|
|||||||
o.set_groff('Set the limit of execution units for the transaction. If used with \\fB-s\\fP this may incur actual network token cost. If \\fB--fee-price\\fP is not explicitly set, the price \\fImay\\fP be retrieved from the network, and multiplied with this value to define the cost.')
|
o.set_groff('Set the limit of execution units for the transaction. If used with \\fB-s\\fP this may incur actual network token cost. If \\fB--fee-price\\fP is not explicitly set, the price \\fImay\\fP be retrieved from the network, and multiplied with this value to define the cost.')
|
||||||
self.docs['feelimit'] = o
|
self.docs['feelimit'] = o
|
||||||
|
|
||||||
# TODO: this manipulation should be DRYd
|
|
||||||
if self.arg_flags & argflag_std_target == 0:
|
# # TODO: this manipulation should be DRYd
|
||||||
self.arg_flags |= Flag.WALLET
|
# if self.arg_flags & argflag_std_target == 0:
|
||||||
|
# self.arg_flags |= Flag.WALLET
|
||||||
|
|
||||||
|
|
||||||
if self.arg_flags & Flag.EXEC:
|
if self.arg_flags & Flag.EXEC:
|
||||||
|
@ -14,9 +14,12 @@ from chainlib.cli.man import (
|
|||||||
DocGenerator,
|
DocGenerator,
|
||||||
apply_groff,
|
apply_groff,
|
||||||
)
|
)
|
||||||
from chainlib.cli.base import argflag_std_base
|
from chainlib.cli.base import (
|
||||||
|
argflag_std_base,
|
||||||
|
flag_names,
|
||||||
|
)
|
||||||
from chainlib.cli.arg import ArgumentParser as ChainlibArgumentParser
|
from chainlib.cli.arg import ArgumentParser as ChainlibArgumentParser
|
||||||
from chainlib.eth.cli.config import Config
|
from chainlib.cli.config import Config
|
||||||
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
@ -88,20 +91,18 @@ args = argparser.parse_args(sys.argv[1:])
|
|||||||
if args.v:
|
if args.v:
|
||||||
logg.setLevel(logging.DEBUG)
|
logg.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
b = bytes.fromhex(strip_0x(args.b))
|
b = bytes.fromhex(strip_0x(args.b))
|
||||||
flags = int.from_bytes(b, byteorder='little')
|
flags = int.from_bytes(b, byteorder='big')
|
||||||
|
|
||||||
|
flags_debug= flag_names(flags)
|
||||||
|
logg.debug('apply arg flags {}: {}'.format(flags, ', '.join(flags_debug)))
|
||||||
|
|
||||||
#empty_args = ChainlibArgumentParser(flags).parse_args([])
|
|
||||||
#config = Config.from_args(empty_args, arg_flags=flags)
|
|
||||||
#g = DocGenerator(flags, config)
|
|
||||||
g = DocGenerator(flags)
|
g = DocGenerator(flags)
|
||||||
|
|
||||||
toolname = args.n
|
toolname = args.n
|
||||||
if toolname == None:
|
if toolname == None:
|
||||||
parts = os.path.splitext(os.path.basename(args.header_file))
|
parts = os.path.splitext(os.path.basename(args.header_file))
|
||||||
toolname = parts[0]
|
toolname = parts[0]
|
||||||
|
|
||||||
g.process()
|
g.process()
|
||||||
|
|
||||||
if args.overrides_file != None:
|
if args.overrides_file != None:
|
||||||
|
@ -3,7 +3,7 @@ name=chainlib
|
|||||||
license=WTFPL2
|
license=WTFPL2
|
||||||
author_email=dev@holbrook.no
|
author_email=dev@holbrook.no
|
||||||
description=Generic blockchain access library and tooling
|
description=Generic blockchain access library and tooling
|
||||||
version=0.0.22
|
version=0.0.23
|
||||||
url=https://gitlab.com/chaintools/chainlib
|
url=https://gitlab.com/chaintools/chainlib
|
||||||
author=Louis Holbrook
|
author=Louis Holbrook
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user