feat: add interactive deployment and switch to poetry #2
@ -1,27 +1,12 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
# standard import
|
# standard import
|
||||||
import importlib
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
from typing import TYPE_CHECKING, List
|
|
||||||
|
|
||||||
import requests
|
from chainlib.cli.config import Config
|
||||||
|
|
||||||
# external imports
|
|
||||||
from chainlib.chain import ChainSpec
|
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic.contract.components.proof import Proof
|
from cic.contract.contract import deploy_contract, generate_contract, load_contract
|
||||||
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
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -61,72 +46,17 @@ def validate_args(_args):
|
|||||||
pass
|
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}
|
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}")
|
print(f"eargs: {eargs}")
|
||||||
directory = eargs.path
|
directory = eargs.path
|
||||||
target = eargs.target
|
target = eargs.target
|
||||||
skip_gen = eargs.skip_gen
|
skip_gen = eargs.skip_gen
|
||||||
skip_deploy = eargs.skip_deploy
|
skip_deploy = eargs.skip_deploy
|
||||||
|
wallet_keystore = eargs.y
|
||||||
|
config.add(wallet_keystore, "WALLET_KEY_FILE", exists_ok=True)
|
||||||
|
|
||||||
if not skip_gen:
|
if not skip_gen:
|
||||||
contract = generate_contract(directory, [target], config, interactive=True)
|
contract = generate_contract(directory, [target], config, interactive=True)
|
||||||
|
@ -13,8 +13,6 @@ http_origin =
|
|||||||
|
|
||||||
[auth]
|
[auth]
|
||||||
type = gnupg
|
type = gnupg
|
||||||
db_path =
|
|
||||||
keyfile_path =
|
keyfile_path =
|
||||||
key =
|
|
||||||
passphrase =
|
passphrase =
|
||||||
|
|
||||||
|
@ -16,14 +16,12 @@ provider = http://localhost:63545
|
|||||||
|
|
||||||
[auth]
|
[auth]
|
||||||
type = gnupg
|
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
|
keyfile_path = /home/will/grassroots/cic-internal-integration/apps/cic-ussd/tests/data/pgp/privatekeys_meta.asc
|
||||||
passphrase = merman
|
passphrase = merman
|
||||||
|
|
||||||
[wallet]
|
[wallet]
|
||||||
key_file = /home/will/grassroots/cic-internal-integration/apps/contract-migration/keystore
|
key_file = /home/will/grassroots/cic-internal-integration/apps/contract-migration/keystore
|
||||||
passphrase =
|
passphrase =
|
||||||
|
|
||||||
[chain]
|
[chain]
|
||||||
spec = evm:byzantium:8996:bloxberg
|
spec = evm:byzantium:8996:bloxberg
|
@ -16,8 +16,6 @@ provider = https://rpc.grassecon.net
|
|||||||
|
|
||||||
[auth]
|
[auth]
|
||||||
type = gnupg
|
type = gnupg
|
||||||
db_path = /home/will/.local/share/cic/clicada
|
|
||||||
key = CCE2E1D2D0E36ADE0405E2D0995BB21816313BD5
|
|
||||||
keyfile_path = /home/will/.config/cic/staff-client/user.asc
|
keyfile_path = /home/will/.config/cic/staff-client/user.asc
|
||||||
passphrase = queenmarlena
|
passphrase = queenmarlena
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user