cic-internal-integration/apps/cic-eth/cic_eth/runnable/info.py

51 lines
1.3 KiB
Python
Raw Normal View History

#!python3
# SPDX-License-Identifier: GPL-3.0-or-later
# standard imports
import logging
import argparse
import os
# external imports
import confini
import celery
# local imports
import cic_eth.cli
from cic_eth.api import Api
from cic_eth.api.admin import AdminApi
logging.basicConfig(level=logging.WARNING)
logg = logging.getLogger()
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.process_local_flags(local_arg_flags)
args = argparser.parse_args()
config = cic_eth.cli.Config.from_args(args, arg_flags, local_arg_flags)
celery_app = cic_eth.cli.CeleryApp.from_config(config)
api = Api(config.get('CHAIN_SPEC'), queue=config.get('CELERY_QUEUE'))
2021-05-05 19:04:56 +02:00
admin_api = AdminApi(None)
def main():
2021-05-05 19:04:56 +02:00
t = admin_api.registry()
2021-05-15 06:36:54 +02:00
registry_address = t.get()
print('Registry: {}'.format(registry_address))
2021-05-05 19:04:56 +02:00
t = api.default_token()
token_info = t.get()
print('Default token symbol: {}'.format(token_info['symbol']))
print('Default token address: {}'.format(token_info['address']))
logg.debug('Default token name: {}'.format(token_info['name']))
logg.debug('Default token decimals: {}'.format(token_info['decimals']))
2021-05-15 06:36:54 +02:00
if __name__ == '__main__':
main()