From 4ea90278709645f7d8d127ccded0710faec88ff8 Mon Sep 17 00:00:00 2001 From: KPrasch Date: Wed, 7 Aug 2024 13:14:17 +0700 Subject: [PATCH] require network option --- scripts/initiate_ritual.py | 7 +++++-- scripts/manage_subscription.py | 14 ++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/initiate_ritual.py b/scripts/initiate_ritual.py index 43abe060..4f5c106c 100644 --- a/scripts/initiate_ritual.py +++ b/scripts/initiate_ritual.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 import click -from ape.cli import ConnectedProviderCommand, account_option +from ape.cli import ConnectedProviderCommand, account_option, network_option from deployment import registry from deployment.constants import ACCESS_CONTROLLERS, FEE_MODELS, SUPPORTED_TACO_DOMAINS @@ -12,6 +12,7 @@ @click.command(cls=ConnectedProviderCommand, name="initiate-ritual") @account_option() +@network_option(required=True) @click.option( "--domain", "-d", @@ -66,8 +67,9 @@ ) def cli( domain, - duration, account, + network, + duration, access_controller, fee_model, authority, @@ -79,6 +81,7 @@ def cli( # Setup check_plugins() + click.echo(f"Connected to {network.name} network.") if not (bool(handpicked) ^ (num_nodes is not None)): raise click.BadOptionUsage( option_name="--num-nodes", diff --git a/scripts/manage_subscription.py b/scripts/manage_subscription.py index 53815a1a..48ada8de 100644 --- a/scripts/manage_subscription.py +++ b/scripts/manage_subscription.py @@ -1,6 +1,6 @@ import click from ape import Contract -from ape.cli import account_option, ConnectedProviderCommand +from ape.cli import account_option, ConnectedProviderCommand, network_option from deployment import registry from deployment.options import ( @@ -51,6 +51,7 @@ def cli(): @cli.command(cls=ConnectedProviderCommand) @account_option() +@network_option(required=True) @domain_option @subscription_contract_option @encryptor_slots_option @@ -59,9 +60,10 @@ def cli(): default=0, help="Subscription billing period number to pay for.", ) -def pay_subscription(account, domain, subscription_contract, encryptor_slots, period): +def pay_subscription(account, network, domain, subscription_contract, encryptor_slots, period): """Pay for a new subscription period and initial encryptor slots.""" check_plugins() + click.echo(f"Connected to {network.name} network.") transactor = Transactor(account=account) subscription_contract = registry.get_contract( contract_name=subscription_contract, @@ -92,12 +94,14 @@ def pay_subscription(account, domain, subscription_contract, encryptor_slots, pe @cli.command(cls=ConnectedProviderCommand) @account_option() +@network_option(required=True) @domain_option @subscription_contract_option @encryptor_slots_option -def pay_slots(account, domain, subscription_contract, encryptor_slots): +def pay_slots(account, network, domain, subscription_contract, encryptor_slots): """Pay for additional encryptor slots in the current billing period.""" check_plugins() + click.echo(f"Connected to {network.name} network.") transactor = Transactor(account=account) subscription_contract = registry.get_contract( contract_name=subscription_contract, @@ -123,12 +127,14 @@ def pay_slots(account, domain, subscription_contract, encryptor_slots): @cli.command(cls=ConnectedProviderCommand) @account_option() +@network_option(required=True) @domain_option @ritual_id_option @access_controller_option @encryptors_option -def add_encryptors(account, domain, ritual_id, access_controller, encryptors): +def add_encryptors(account, network, domain, ritual_id, access_controller, encryptors): """Authorize encryptors to the access control contract for a ritual.""" + click.echo(f"Connected to {network.name} network.") access_controller = registry.get_contract( contract_name=access_controller, domain=domain