From 525aab8c771461e3fc4fab556f89cc8834527e68 Mon Sep 17 00:00:00 2001 From: William Luke Date: Tue, 1 Mar 2022 16:38:17 +0300 Subject: [PATCH] chore: clean up --- cic/cmd/wizard.py | 80 +++--------------------------------- cic/data/config/config.ini | 2 - config/dev-docker/config.ini | 4 +- config/prod/config.ini | 2 - 4 files changed, 6 insertions(+), 82 deletions(-) diff --git a/cic/cmd/wizard.py b/cic/cmd/wizard.py index c4c6a45..3b6f6b7 100644 --- a/cic/cmd/wizard.py +++ b/cic/cmd/wizard.py @@ -1,27 +1,12 @@ from __future__ import annotations # standard import -import importlib -import json import logging -import os -from typing import TYPE_CHECKING, List -import requests - -# external imports -from chainlib.chain import ChainSpec +from chainlib.cli.config import Config # local imports -from cic.contract.components.proof import Proof -from cic.contract.components.attachment import Attachment -from cic.contract.components.meta import Meta -from cic.contract.network import Network -from cic.contract.components.token import Token -from cic.contract.contract import generate_contract, load_contract, deploy_contract - -if TYPE_CHECKING: - from chainlib.cli.config import Config +from cic.contract.contract import deploy_contract, generate_contract, load_contract log = logging.getLogger(__name__) @@ -61,72 +46,17 @@ def validate_args(_args): pass -def get_options(config: Config, eargs): - # Defaults - default_contract_registry = config.get( - "CIC_REGISTRY_ADDRESS" - ) # Comes from /home/will/grassroots/cic-staff-installer/var/cic-staff-client/CIC_REGISTRY_ADDRESS - default_key_account = config.get("AUTH_KEY") - # https://meta.grassrootseconomics.net - # https://auth.grassrootseconomics.net Authenticated Meta - - default_metadata_endpoint = config.get("META_URL") - # Keyring folder needs to be dumped out as a private key file from $HOME/.config/cic/staff-client/.gnupg - default_wallet_keyfile = eargs.y or config.get( - "WALLET_KEY_FILE" - ) # Show possible wallet keys - - # Should be an input??? - default_wallet_passphrase = config.get("WALLET_PASSPHRASE", "merman") - default_chain_spec = config.get("CHAIN_SPEC") - default_rpc_provider = config.get("RPC_PROVIDER") - - contract_registry = ( - input(f"Enter Contract Registry ({default_contract_registry}): ") - or default_contract_registry - ) - rpc_provider = ( - input(f"Enter RPC Provider ({default_rpc_provider}): ") or default_rpc_provider - ) - chain_spec = ChainSpec.from_chain_str( - (input(f"Enter ChainSpec ({default_chain_spec}): ") or default_chain_spec) - ) - key_account = ( - input(f"Enter KeyAccount ({default_key_account}): ") or default_key_account - ) - metadata_endpoint = ( - input(f"Enter Metadata Endpoint ({default_metadata_endpoint}): ") - or default_metadata_endpoint - ) - auth_passphrase = config.get("AUTH_PASSPHRASE") - auth_keyfile_path = config.get("AUTH_KEYFILE_PATH") - auth_db_path = config.get("AUTH_DB_PATH") - - options = [ - auth_db_path, - auth_keyfile_path, - auth_passphrase, - contract_registry, - key_account, - chain_spec, - rpc_provider, - metadata_endpoint, - default_wallet_keyfile, - default_wallet_passphrase, - ] - print(options) - return options - - ExtraArgs = {"skip_gen": str, "skip_deploy": str, "target": str, "path": str, "p": str} -def execute(config, eargs: ExtraArgs): +def execute(config: Config, eargs: ExtraArgs): print(f"eargs: {eargs}") directory = eargs.path target = eargs.target skip_gen = eargs.skip_gen skip_deploy = eargs.skip_deploy + wallet_keystore = eargs.y + config.add(wallet_keystore, "WALLET_KEY_FILE", exists_ok=True) if not skip_gen: contract = generate_contract(directory, [target], config, interactive=True) diff --git a/cic/data/config/config.ini b/cic/data/config/config.ini index 448b7f9..581f951 100644 --- a/cic/data/config/config.ini +++ b/cic/data/config/config.ini @@ -13,8 +13,6 @@ http_origin = [auth] type = gnupg -db_path = keyfile_path = -key = passphrase = diff --git a/config/dev-docker/config.ini b/config/dev-docker/config.ini index a1e19ca..3366663 100644 --- a/config/dev-docker/config.ini +++ b/config/dev-docker/config.ini @@ -16,14 +16,12 @@ provider = http://localhost:63545 [auth] type = gnupg -db_path = /home/will/.local/share/cic/clicada -key = eb3907ecad74a0013c259d5874ae7f22dcbcc95c keyfile_path = /home/will/grassroots/cic-internal-integration/apps/cic-ussd/tests/data/pgp/privatekeys_meta.asc passphrase = merman [wallet] key_file = /home/will/grassroots/cic-internal-integration/apps/contract-migration/keystore -passphrase = +passphrase = [chain] spec = evm:byzantium:8996:bloxberg \ No newline at end of file diff --git a/config/prod/config.ini b/config/prod/config.ini index cd27599..ce1aa8f 100644 --- a/config/prod/config.ini +++ b/config/prod/config.ini @@ -16,8 +16,6 @@ provider = https://rpc.grassecon.net [auth] type = gnupg -db_path = /home/will/.local/share/cic/clicada -key = CCE2E1D2D0E36ADE0405E2D0995BB21816313BD5 keyfile_path = /home/will/.config/cic/staff-client/user.asc passphrase = queenmarlena