2021-02-08 22:39:50 +01:00
|
|
|
# standard imports
|
|
|
|
import logging
|
|
|
|
import argparse
|
|
|
|
import re
|
|
|
|
import os
|
|
|
|
|
|
|
|
# third-party imports
|
2021-04-02 15:16:27 +02:00
|
|
|
from chainlib.chain import ChainSpec
|
|
|
|
from chainlib.eth.connection import EthHTTPConnection
|
2021-02-08 22:39:50 +01:00
|
|
|
|
|
|
|
# local imports
|
2021-08-17 08:46:51 +02:00
|
|
|
import cic_eth.cli
|
2021-07-07 09:45:21 +02:00
|
|
|
from cic_eth.api.admin import AdminApi
|
2021-02-08 22:39:50 +01:00
|
|
|
|
|
|
|
logging.basicConfig(level=logging.WARNING)
|
|
|
|
logg = logging.getLogger()
|
|
|
|
|
2021-08-17 08:46:51 +02:00
|
|
|
arg_flags = cic_eth.cli.argflag_std_base
|
|
|
|
local_arg_flags = cic_eth.cli.argflag_local_taskcallback
|
|
|
|
argparser = cic_eth.cli.ArgumentParser(arg_flags)
|
|
|
|
argparser.add_argument('--unlock', action='store_true', help='Unlock account after resend')
|
|
|
|
argparser.add_positional('tx_hash', type=str, help='Transaction hash')
|
|
|
|
argparser.process_local_flags(local_arg_flags)
|
|
|
|
extra_args = {
|
|
|
|
'unlock': None,
|
|
|
|
'tx_hash': None,
|
|
|
|
}
|
2021-02-08 22:39:50 +01:00
|
|
|
args = argparser.parse_args()
|
|
|
|
|
2021-08-17 08:46:51 +02:00
|
|
|
config = cic_eth.cli.Config.from_args(args, arg_flags, local_arg_flags, extra_args=extra_args)
|
2021-02-08 22:39:50 +01:00
|
|
|
|
2021-08-17 08:46:51 +02:00
|
|
|
chain_spec = ChainSpec.from_chain_str(config.get('CHAIN_SPEC'))
|
2021-02-08 22:39:50 +01:00
|
|
|
|
2021-08-17 08:46:51 +02:00
|
|
|
celery_app = cic_eth.cli.CeleryApp.from_config(config)
|
2021-02-08 22:39:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2021-08-17 08:46:51 +02:00
|
|
|
api = AdminApi(None)
|
|
|
|
tx_details = api.tx(chain_spec, config.get('_TX_HASH'))
|
2021-04-02 15:16:27 +02:00
|
|
|
t = api.resend(args.tx_hash, chain_spec, unlock=config.get('_UNLOCK'))
|
|
|
|
print(t.get_leaf())
|
2021-02-08 22:39:50 +01:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|