flags.py (996B)
1 # standard imports 2 import sys 3 4 # external imports 5 from chainlib.eth.cli.arg import ArgFlag 6 from hexathon import add_0x 7 8 9 cmds = { 10 'gas': [['std_write', 'wallet', 'value'], []], 11 'info' : [['std_base_read'], ['chain_spec']], 12 'get' : [['std_base_read', 'tab'], ['chain_spec']], 13 'decode': [['std_base', 'chain_spec'], []], 14 'encode': [['std_write', 'exec' ,'fee', 'fmt_human', 'fmt_wire', 'fmt_rpc'], []], 15 'count' : [['std_base_read', 'wallet'], []], 16 'raw': [['std_write', 'exec'], []], 17 'balance': [['std_base', 'wallet'], []], 18 'wait': [['std_base_read', 'target', 'rpc_auth'], ['chain_spec', 'raw']], 19 'checksum': [[], []], 20 } 21 22 23 if __name__ == '__main__': 24 args = ArgFlag() 25 r = 0 26 instructions = cmds[sys.argv[1]] 27 for k in instructions[0]: 28 v = args.get(k) 29 r = args.more(r, v) 30 for k in instructions[1]: 31 v = args.get(k) 32 r = args.less(r, v) 33 print(add_0x(hex(r)))