chore: clean up
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
William Luke 2022-03-01 16:38:17 +03:00
parent 41dbd5a400
commit 525aab8c77
4 changed files with 6 additions and 82 deletions

View File

@ -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)

View File

@ -13,8 +13,6 @@ http_origin =
[auth]
type = gnupg
db_path =
keyfile_path =
key =
passphrase =

View File

@ -16,8 +16,6 @@ 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

View File

@ -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