From b86081f727dced3438270273515da51064bf10ef Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 6 Nov 2024 23:12:08 +0200 Subject: [PATCH 1/2] Added prompt to wallet faucet. --- bittensor_cli/cli.py | 2 ++ bittensor_cli/src/commands/wallets.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index e0609e039..6d18a8456 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -1668,6 +1668,7 @@ def wallet_faucet( "--max-successes", help="Set the maximum number of times to successfully run the faucet for this command.", ), + prompt: bool = Options.prompt ): """ Obtain test TAO tokens by performing Proof of Work (PoW). @@ -1706,6 +1707,7 @@ def wallet_faucet( output_in_place, verbose, max_successes, + prompt ) ) diff --git a/bittensor_cli/src/commands/wallets.py b/bittensor_cli/src/commands/wallets.py index ff8e981ff..acce3b1a4 100644 --- a/bittensor_cli/src/commands/wallets.py +++ b/bittensor_cli/src/commands/wallets.py @@ -1413,13 +1413,14 @@ async def faucet( output_in_place: bool, log_verbose: bool, max_successes: int = 3, + prompt: bool = True, ): # TODO: - work out prompts to be passed through the cli success = await run_faucet_extrinsic( subtensor, wallet, tpb=threads_per_block, - prompt=False, + prompt=prompt, update_interval=update_interval, num_processes=processes, cuda=use_cuda, From 1e93a72878e2b150b7305518cca8733b4d244bcb Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 6 Nov 2024 23:25:48 +0200 Subject: [PATCH 2/2] Added all prompt options. --- bittensor_cli/cli.py | 17 ++++++++++++++--- .../src/commands/stake/children_hotkeys.py | 12 +++++++----- bittensor_cli/src/commands/subnets.py | 3 ++- bittensor_cli/src/commands/weights.py | 6 ++++-- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index 6d18a8456..87c11998e 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -1668,7 +1668,7 @@ def wallet_faucet( "--max-successes", help="Set the maximum number of times to successfully run the faucet for this command.", ), - prompt: bool = Options.prompt + prompt: bool = Options.prompt, ): """ Obtain test TAO tokens by performing Proof of Work (PoW). @@ -1707,7 +1707,7 @@ def wallet_faucet( output_in_place, verbose, max_successes, - prompt + prompt, ) ) @@ -2422,7 +2422,8 @@ def wallet_sign( if use_hotkey is None: use_hotkey = Confirm.ask( "Would you like to sign the transaction using your [red]hotkey[/red]?" - "\n[Type [red]y[/red] for [red]hotkey[/red] and [blue]n[/blue] for [blue]coldkey[/blue]] (default is [blue]coldkey[/blue])", + "\n[Type [red]y[/red] for [red]hotkey[/red] and [blue]n[/blue] for [blue]coldkey[/blue]] " + "(default is [blue]coldkey[/blue])", default=False, ) @@ -3655,6 +3656,7 @@ def stake_set_children( wait_for_finalization: bool = Options.wait_for_finalization, quiet: bool = Options.quiet, verbose: bool = Options.verbose, + prompt: bool = Options.prompt, ): """ Set child hotkeys on specified subnets. @@ -3713,6 +3715,7 @@ def stake_set_children( proportions=proportions, wait_for_finalization=wait_for_finalization, wait_for_inclusion=wait_for_inclusion, + prompt=prompt, ) ) @@ -3738,6 +3741,7 @@ def stake_revoke_children( wait_for_finalization: bool = Options.wait_for_finalization, quiet: bool = Options.quiet, verbose: bool = Options.verbose, + prompt: bool = Options.prompt, ): """ Remove all children hotkeys on a specified subnet. @@ -3772,6 +3776,7 @@ def stake_revoke_children( netuid, wait_for_inclusion, wait_for_finalization, + prompt=prompt, ) ) @@ -4077,6 +4082,7 @@ def subnets_pow_register( "-tbp", help="Set the number of threads per block for CUDA.", ), + prompt: bool = Options.prompt, ): """ Register a neuron (a subnet validator or a subnet miner) using Proof of Work (POW). @@ -4114,6 +4120,7 @@ def subnets_pow_register( use_cuda, dev_id, threads_per_block, + prompt=prompt, ) ) @@ -4273,6 +4280,7 @@ def weights_reveal( ), quiet: bool = Options.quiet, verbose: bool = Options.verbose, + prompt: bool = Options.prompt, ): """ Reveal weights for a specific subnet. @@ -4344,6 +4352,7 @@ def weights_reveal( weights, salt, __version_as_int__, + prompt=prompt, ) ) @@ -4369,6 +4378,7 @@ def weights_commit( ), quiet: bool = Options.quiet, verbose: bool = Options.verbose, + prompt: bool = Options.prompt, ): """ @@ -4439,6 +4449,7 @@ def weights_commit( weights, salt, __version_as_int__, + prompt=prompt, ) ) diff --git a/bittensor_cli/src/commands/stake/children_hotkeys.py b/bittensor_cli/src/commands/stake/children_hotkeys.py index 074722403..97f8e5fc9 100644 --- a/bittensor_cli/src/commands/stake/children_hotkeys.py +++ b/bittensor_cli/src/commands/stake/children_hotkeys.py @@ -494,6 +494,7 @@ async def set_children( netuid: Optional[int] = None, wait_for_inclusion: bool = True, wait_for_finalization: bool = True, + prompt: bool = True, ): """Set children hotkeys.""" # Validate children SS58 addresses @@ -520,7 +521,7 @@ async def set_children( netuid=netuid, hotkey=wallet.hotkey.ss58_address, children_with_proportions=children_with_proportions, - prompt=True, + prompt=prompt, wait_for_inclusion=wait_for_inclusion, wait_for_finalization=wait_for_finalization, ) @@ -549,7 +550,7 @@ async def set_children( netuid=netuid, hotkey=wallet.hotkey.ss58_address, children_with_proportions=children_with_proportions, - prompt=False, + prompt=prompt, wait_for_inclusion=True, wait_for_finalization=False, ) @@ -564,6 +565,7 @@ async def revoke_children( netuid: Optional[int] = None, wait_for_inclusion: bool = True, wait_for_finalization: bool = True, + prompt: bool = True, ): """ Revokes the children hotkeys associated with a given network identifier (netuid). @@ -575,7 +577,7 @@ async def revoke_children( netuid=netuid, hotkey=wallet.hotkey.ss58_address, children_with_proportions=[], - prompt=True, + prompt=prompt, wait_for_inclusion=wait_for_inclusion, wait_for_finalization=wait_for_finalization, ) @@ -604,7 +606,7 @@ async def revoke_children( netuid=netuid, hotkey=wallet.hotkey.ss58_address, children_with_proportions=[], - prompt=False, + prompt=prompt, wait_for_inclusion=True, wait_for_finalization=False, ) @@ -764,7 +766,7 @@ async def set_chk_take_subnet(subnet, chk_take): netuid=netuid, hotkey=wallet.hotkey.ss58_address, take=take, - prompt=False, + prompt=prompt, wait_for_inclusion=True, wait_for_finalization=False, ) diff --git a/bittensor_cli/src/commands/subnets.py b/bittensor_cli/src/commands/subnets.py index 3e9349827..dba96bfd2 100644 --- a/bittensor_cli/src/commands/subnets.py +++ b/bittensor_cli/src/commands/subnets.py @@ -400,6 +400,7 @@ async def pow_register( use_cuda, dev_id, threads_per_block, + prompt: bool, ): """Register neuron.""" @@ -407,7 +408,7 @@ async def pow_register( subtensor, wallet=wallet, netuid=netuid, - prompt=True, + prompt=prompt, tpb=threads_per_block, update_interval=update_interval, num_processes=processors, diff --git a/bittensor_cli/src/commands/weights.py b/bittensor_cli/src/commands/weights.py index cc5a7d379..33988cf94 100644 --- a/bittensor_cli/src/commands/weights.py +++ b/bittensor_cli/src/commands/weights.py @@ -378,6 +378,7 @@ async def reveal_weights( weights: list[float], salt: list[int], version: int, + prompt: bool = True, ) -> None: """Reveal weights for a specific subnet.""" uids_ = np.array( @@ -397,7 +398,7 @@ async def reveal_weights( ) # Call the reveal function in the module set_weights from extrinsics package extrinsic = SetWeightsExtrinsic( - subtensor, wallet, netuid, uids_, weights_, list(salt_), version + subtensor, wallet, netuid, uids_, weights_, list(salt_), version, prompt=prompt ) success, message = await extrinsic.reveal(weight_uids, weight_vals) @@ -415,6 +416,7 @@ async def commit_weights( weights: list[float], salt: list[int], version: int, + prompt: bool = True, ): """Commits weights and then reveals them for a specific subnet""" uids_ = np.array( @@ -430,7 +432,7 @@ async def commit_weights( dtype=np.int64, ) extrinsic = SetWeightsExtrinsic( - subtensor, wallet, netuid, uids_, weights_, list(salt_), version + subtensor, wallet, netuid, uids_, weights_, list(salt_), version, prompt=prompt ) success, message = await extrinsic.set_weights_extrinsic() if success: