diff --git a/bittensor/_cli/commands/delegates.py b/bittensor/_cli/commands/delegates.py index 461763da51..defed372cd 100644 --- a/bittensor/_cli/commands/delegates.py +++ b/bittensor/_cli/commands/delegates.py @@ -222,7 +222,7 @@ def check_config( config: 'bittensor.Config' ): wallet_name = Prompt.ask("Enter wallet name", default = bittensor.defaults.wallet.name) config.wallet.name = str(wallet_name) - if config.wallet.get('hotkey') == bittensor.defaults.wallet.hotkey and not config.no_prompt and not config.wallet.get('all_hotkeys') and not config.wallet.get('hotkeys'): + if config.wallet.get('hotkey') == bittensor.defaults.wallet.hotkey and not config.no_prompt: hotkey = Prompt.ask("Enter hotkey name", default = bittensor.defaults.wallet.hotkey) config.wallet.hotkey = str(hotkey) diff --git a/bittensor/_cli/commands/overview.py b/bittensor/_cli/commands/overview.py index 94f9ddd6cb..a5510b00bc 100644 --- a/bittensor/_cli/commands/overview.py +++ b/bittensor/_cli/commands/overview.py @@ -59,13 +59,13 @@ def run( cli ): # We are printing for a select number of hotkeys from all_hotkeys. - if cli.config.wallet.get('hotkeys', []): + if cli.config.get('hotkeys', []): if not cli.config.get('all_hotkeys', False): # We are only showing hotkeys that are specified. - all_hotkeys = [hotkey for hotkey in all_hotkeys if hotkey.hotkey_str in cli.config.wallet.hotkeys] + all_hotkeys = [hotkey for hotkey in all_hotkeys if hotkey.hotkey_str in cli.config.hotkeys] else: # We are excluding the specified hotkeys from all_hotkeys. - all_hotkeys = [hotkey for hotkey in all_hotkeys if hotkey.hotkey_str not in cli.config.wallet.hotkeys] + all_hotkeys = [hotkey for hotkey in all_hotkeys if hotkey.hotkey_str not in cli.config.hotkeys] # Check we have keys to display. if len(all_hotkeys) == 0: @@ -281,6 +281,26 @@ def add_args( parser: argparse.ArgumentParser ): type=str, help='''Sort the hotkeys in the specified ordering. (ascending/asc or descending/desc/reverse)''' ) + overview_parser.add_argument( + '--hotkeys', + '--exclude_hotkeys', + '--wallet.hotkeys', + '--wallet.exclude_hotkeys', + required=False, + action='store', + default=[], + type=str, + nargs='*', + help='''Specify the hotkeys by name or ss58 address. (e.g. hk1 hk2 hk3)''' + ) + overview_parser.add_argument( + '--all_hotkeys', + '--wallet.all_hotkeys', + required=False, + action='store_true', + default=False, + help='''To specify all hotkeys. Specifying hotkeys will exclude them from this all.''' + ) overview_parser.add_argument( '--no_version_checking', action='store_true', help='''Set false to stop cli version checking''', default = False ) bittensor.wallet.add_args( overview_parser ) bittensor.subtensor.add_args( overview_parser ) diff --git a/bittensor/_cli/commands/stake.py b/bittensor/_cli/commands/stake.py index 96274e4bd3..05748177b9 100644 --- a/bittensor/_cli/commands/stake.py +++ b/bittensor/_cli/commands/stake.py @@ -38,17 +38,20 @@ def run( cli ): # Get the hotkey_names (if any) and the hotkey_ss58s. hotkeys_to_stake_to: List[Tuple[Optional[str], str]] = [] - if config.wallet.get('all_hotkeys'): + if config.get('all_hotkeys'): # Stake to all hotkeys. all_hotkeys: List[bittensor.wallet] = get_hotkey_wallets_for_wallet( wallet = wallet ) + # Get the hotkeys to exclude. (d)efault to no exclusions. + hotkeys_to_exclude: List[str] = cli.config.get('hotkeys', d=[]) # Exclude hotkeys that are specified. hotkeys_to_stake_to = [ - (wallet.hotkey_str, wallet.hotkey.ss58_address) for wallet in all_hotkeys if wallet.hotkey_str not in config.wallet.get('hotkeys', []) + (wallet.hotkey_str, wallet.hotkey.ss58_address) for wallet in all_hotkeys + if wallet.hotkey_str not in hotkeys_to_exclude ] # definitely wallets - elif config.wallet.get('hotkeys'): + elif config.get('hotkeys'): # Stake to specific hotkeys. - for hotkey_ss58_or_hotkey_name in config.wallet.get('hotkeys'): + for hotkey_ss58_or_hotkey_name in config.get('hotkeys'): if bittensor.utils.is_valid_ss58_address( hotkey_ss58_or_hotkey_name ): # If the hotkey is a valid ss58 address, we add it to the list. hotkeys_to_stake_to.append( (None, hotkey_ss58_or_hotkey_name ) ) @@ -141,7 +144,7 @@ def check_config( cls, config: 'bittensor.Config' ): wallet_name = Prompt.ask("Enter wallet name", default = bittensor.defaults.wallet.name) config.wallet.name = str(wallet_name) - if config.wallet.get('hotkey') == bittensor.defaults.wallet.hotkey and not config.no_prompt and not config.wallet.get('all_hotkeys') and not config.wallet.get('hotkeys'): + if config.wallet.get('hotkey') == bittensor.defaults.wallet.hotkey and not config.no_prompt and not config.get('all_hotkeys') and not config.get('hotkeys'): hotkey = Prompt.ask("Enter hotkey name", default = bittensor.defaults.wallet.hotkey) config.wallet.hotkey = str(hotkey) @@ -202,5 +205,25 @@ def add_args( cls, parser: argparse.ArgumentParser ): help='''Set true to avoid prompting the user.''', default=False, ) + stake_parser.add_argument( + '--hotkeys', + '--exclude_hotkeys', + '--wallet.hotkeys', + '--wallet.exclude_hotkeys', + required=False, + action='store', + default=[], + type=str, + nargs='*', + help='''Specify the hotkeys by name or ss58 address. (e.g. hk1 hk2 hk3)''' + ) + stake_parser.add_argument( + '--all_hotkeys', + '--wallet.all_hotkeys', + required=False, + action='store_true', + default=False, + help='''To specify all hotkeys. Specifying hotkeys will exclude them from this all.''' + ) bittensor.wallet.add_args( stake_parser ) bittensor.subtensor.add_args( stake_parser ) \ No newline at end of file diff --git a/bittensor/_cli/commands/unstake.py b/bittensor/_cli/commands/unstake.py index 05688434e7..e70ede1286 100644 --- a/bittensor/_cli/commands/unstake.py +++ b/bittensor/_cli/commands/unstake.py @@ -35,17 +35,17 @@ def check_config( cls, config: 'bittensor.Config' ): wallet_name = Prompt.ask("Enter wallet name", default = bittensor.defaults.wallet.name) config.wallet.name = str(wallet_name) - if config.wallet.get('hotkey') == bittensor.defaults.wallet.hotkey and not config.no_prompt and not config.wallet.get('all_hotkeys') and not config.wallet.get('hotkeys'): + if config.wallet.get('hotkey') == bittensor.defaults.wallet.hotkey and not config.no_prompt and not config.get('all_hotkeys') and not config.get('hotkeys'): hotkey = Prompt.ask("Enter hotkey name", default = bittensor.defaults.wallet.hotkey) config.wallet.hotkey = str(hotkey) # Get amount. if not config.get('amount') and not config.get('unstake_all') and not config.get('max_stake'): hotkeys: str = '' - if config.wallet.get('all_hotkeys'): + if config.get('all_hotkeys'): hotkeys = "all hotkeys" - elif config.wallet.get('hotkeys'): - hotkeys = str(config.wallet.hotkeys).replace('[', '').replace(']', '') + elif config.get('hotkeys'): + hotkeys = str(config.hotkeys).replace('[', '').replace(']', '') else: hotkeys = str(config.wallet.hotkey) if not Confirm.ask("Unstake all Tao from: [bold]'{}'[/bold]?".format(hotkeys)): @@ -99,6 +99,26 @@ def add_args( command_parser ): help='''Set true to avoid prompting the user.''', default=False, ) + unstake_parser.add_argument( + '--hotkeys', + '--exclude_hotkeys', + '--wallet.hotkeys', + '--wallet.exclude_hotkeys', + required=False, + action='store', + default=[], + type=str, + nargs='*', + help='''Specify the hotkeys by name or ss58 address. (e.g. hk1 hk2 hk3)''' + ) + unstake_parser.add_argument( + '--all_hotkeys', + '--wallet.all_hotkeys', + required=False, + action='store_true', + default=False, + help='''To specify all hotkeys. Specifying hotkeys will exclude them from this all.''' + ) bittensor.wallet.add_args( unstake_parser ) bittensor.subtensor.add_args( unstake_parser ) @@ -112,17 +132,20 @@ def run( cli ): # Get the hotkey_names (if any) and the hotkey_ss58s. hotkeys_to_unstake_from: List[Tuple[Optional[str], str]] = [] - if cli.config.wallet.get('all_hotkeys'): + if cli.config.get('all_hotkeys'): # Stake to all hotkeys. all_hotkeys: List[bittensor.wallet] = get_hotkey_wallets_for_wallet( wallet = wallet ) + # Get the hotkeys to exclude. (d)efault to no exclusions. + hotkeys_to_exclude: List[str] = cli.config.get('hotkeys', d=[]) # Exclude hotkeys that are specified. hotkeys_to_unstake_from = [ - (wallet.hotkey_str, wallet.hotkey.ss58_address) for wallet in all_hotkeys if wallet.hotkey_str not in cli.config.wallet.get('hotkeys', []) + (wallet.hotkey_str, wallet.hotkey.ss58_address) for wallet in all_hotkeys + if wallet.hotkey_str not in hotkeys_to_exclude ] # definitely wallets - elif cli.config.wallet.get('hotkeys'): + elif cli.config.get('hotkeys'): # Stake to specific hotkeys. - for hotkey_ss58_or_hotkey_name in cli.config.wallet.get('hotkeys'): + for hotkey_ss58_or_hotkey_name in cli.config.get('hotkeys'): if bittensor.utils.is_valid_ss58_address( hotkey_ss58_or_hotkey_name ): # If the hotkey is a valid ss58 address, we add it to the list. hotkeys_to_unstake_from.append( (None, hotkey_ss58_or_hotkey_name ) ) diff --git a/bittensor/_wallet/__init__.py b/bittensor/_wallet/__init__.py index 090b7c3054..69de88e398 100644 --- a/bittensor/_wallet/__init__.py +++ b/bittensor/_wallet/__init__.py @@ -113,9 +113,7 @@ def add_args(cls, parser: argparse.ArgumentParser, prefix: str = None ): parser.add_argument('--' + prefix_str + 'wallet.hotkey', required=False, default=bittensor.defaults.wallet.hotkey, help='''The name of wallet's hotkey.''') parser.add_argument('--' + prefix_str + 'wallet.path', required=False, default=bittensor.defaults.wallet.path, help='''The path to your bittensor wallets''') parser.add_argument('--' + prefix_str + 'wallet._mock', action='store_true', default=bittensor.defaults.wallet._mock, help='To turn on wallet mocking for testing purposes.') - - parser.add_argument('--' + prefix_str + 'wallet.hotkeys', '--' + prefix_str + 'wallet.exclude_hotkeys', required=False, action='store', default=bittensor.defaults.wallet.hotkeys, type=str, nargs='*', help='''Specify the hotkeys by name. (e.g. hk1 hk2 hk3)''') - parser.add_argument('--' + prefix_str + 'wallet.all_hotkeys', required=False, action='store_true', default=bittensor.defaults.wallet.all_hotkeys, help='''To specify all hotkeys. Specifying hotkeys will exclude them from this all.''') + parser.add_argument('--' + prefix_str + 'wallet.reregister', required=False, action='store', default=bittensor.defaults.wallet.reregister, type=strtobool, help='''Whether to reregister the wallet if it is not already registered.''') except argparse.ArgumentError as e: @@ -130,9 +128,6 @@ def add_defaults(cls, defaults): defaults.wallet.hotkey = os.getenv('BT_WALLET_HOTKEY') if os.getenv('BT_WALLET_HOTKEY') != None else 'default' defaults.wallet.path = os.getenv('BT_WALLET_PATH') if os.getenv('BT_WALLET_PATH') != None else '~/.bittensor/wallets/' defaults.wallet._mock = os.getenv('BT_WALLET_MOCK') if os.getenv('BT_WALLET_MOCK') != None else False - # CLI defaults for Overview - defaults.wallet.hotkeys = [] - defaults.wallet.all_hotkeys = False # Defaults for registration defaults.wallet.reregister = True @@ -144,6 +139,4 @@ def check_config(cls, config: 'bittensor.Config' ): assert isinstance(config.wallet.get('name', bittensor.defaults.wallet.name), str) assert isinstance(config.wallet.get('hotkey', bittensor.defaults.wallet.hotkey), str ) or config.wallet.get('hotkey', bittensor.defaults.wallet.hotkey) == None assert isinstance(config.wallet.path, str) - assert isinstance(config.wallet.hotkeys, list) assert isinstance(config.wallet.reregister, bool) - assert isinstance(config.wallet.all_hotkeys, bool) diff --git a/tests/integration_tests/test_cli.py b/tests/integration_tests/test_cli.py index e77fd7d26f..13796a833b 100644 --- a/tests/integration_tests/test_cli.py +++ b/tests/integration_tests/test_cli.py @@ -232,7 +232,7 @@ def test_overview_with_hotkeys_config( self ): config = self.config config.command = "overview" config.no_prompt = True - config.wallet.hotkeys = ['some_hotkey'] + config.hotkeys = ['some_hotkey'] config.all = False config.no_version_checking = False @@ -352,10 +352,10 @@ def test_unstake_with_specific_hotkeys( self ): config.no_prompt = True config.amount = 5.0 config.wallet.name = "fake_wallet" - config.wallet.hotkeys = [ + config.hotkeys = [ 'hk0', 'hk1', 'hk2' ] - config.wallet.all_hotkeys = False + config.all_hotkey = False # Notice no max_stake specified config.no_version_checking = False @@ -371,9 +371,9 @@ def test_unstake_with_specific_hotkeys( self ): mock_wallets = [ SimpleNamespace( name = config.wallet.name, - hotkey_str = config.wallet.hotkeys[0], + hotkey_str = config.hotkeys[0], get_stake = MagicMock( - return_value = mock_stakes[config.wallet.hotkeys[0]] + return_value = mock_stakes[config.hotkeys[0]] ), is_registered = MagicMock( return_value = True @@ -394,7 +394,7 @@ def test_unstake_with_specific_hotkeys( self ): is_registered = MagicMock( return_value = True ) - ) for hk in config.wallet.hotkeys + ) for hk in config.hotkeys ] # The 0th wallet is created twice during unstake @@ -414,7 +414,7 @@ def test_unstake_with_specific_hotkeys( self ): cli.run() mock_create_wallet.assert_has_calls( [ - call(config=ANY, hotkey=hk) for hk in config.wallet.hotkeys + call(config=ANY, hotkey=hk) for hk in config.hotkeys ], any_order=True ) @@ -430,7 +430,7 @@ def test_unstake_with_all_hotkeys( self ): config.amount = 5.0 config.wallet.name = "fake_wallet" # Notice wallet.hotkeys not specified - config.wallet.all_hotkeys = True + config.all_hotkey = True # Notice no max_stake specified config.no_version_checking = False @@ -479,8 +479,8 @@ def test_unstake_with_exclude_hotkeys_from_all( self ): config.no_prompt = True config.amount = 5.0 config.wallet.name = "fake_wallet" - config.wallet.hotkeys = ["hk1"] # Exclude hk1 - config.wallet.all_hotkeys = True + config.hotkeys = ["hk1"] # Exclude hk1 + config.all_hotkey = True # Notice no max_stake specified config.no_version_checking = False @@ -530,10 +530,10 @@ def test_unstake_with_multiple_hotkeys_max_stake( self ): # Notie amount is not specified config.max_stake = 5.0 # The keys should have at most 5.0 tao staked after config.wallet.name = "fake_wallet" - config.wallet.hotkeys = [ + config.hotkeys = [ 'hk0', 'hk1', 'hk2' ] - config.wallet.all_hotkeys = False + config.all_hotkey = False # Notice no max_stake specified config.no_version_checking = False @@ -549,9 +549,9 @@ def test_unstake_with_multiple_hotkeys_max_stake( self ): mock_wallets = [ SimpleNamespace( name = config.wallet.name, - hotkey_str = config.wallet.hotkeys[0], + hotkey_str = config.hotkeys[0], get_stake = MagicMock( - return_value = mock_stakes[config.wallet.hotkeys[0]] + return_value = mock_stakes[config.hotkeys[0]] ), is_registered = MagicMock( return_value = True @@ -572,7 +572,7 @@ def test_unstake_with_multiple_hotkeys_max_stake( self ): is_registered = MagicMock( return_value = True ) - ) for hk in config.wallet.hotkeys + ) for hk in config.hotkeys ] # The 0th wallet is created twice during unstake @@ -589,7 +589,7 @@ def test_unstake_with_multiple_hotkeys_max_stake( self ): cli.run() mock_create_wallet.assert_has_calls( [ - call(config=ANY, hotkey=hk) for hk in config.wallet.hotkeys + call(config=ANY, hotkey=hk) for hk in config.hotkeys ], any_order=True ) @@ -605,10 +605,10 @@ def test_unstake_with_multiple_hotkeys_max_stake_not_enough_stake( self ): # Notie amount is not specified config.max_stake = 5.0 # The keys should have at most 5.0 tao staked after config.wallet.name = "fake_wallet" - config.wallet.hotkeys = [ + config.hotkeys = [ 'hk0', 'hk1', 'hk2' ] - config.wallet.all_hotkeys = False + config.all_hotkey = False # Notice no max_stake specified config.no_version_checking = False @@ -624,9 +624,9 @@ def test_unstake_with_multiple_hotkeys_max_stake_not_enough_stake( self ): mock_wallets = [ SimpleNamespace( name = config.wallet.name, - hotkey_str = config.wallet.hotkeys[0], + hotkey_str = config.hotkeys[0], get_stake = MagicMock( - return_value = mock_stakes[config.wallet.hotkeys[0]] + return_value = mock_stakes[config.hotkeys[0]] ), is_registered = MagicMock( return_value = True @@ -647,7 +647,7 @@ def test_unstake_with_multiple_hotkeys_max_stake_not_enough_stake( self ): is_registered = MagicMock( return_value = True ) - ) for hk in config.wallet.hotkeys + ) for hk in config.hotkeys ] # The 0th wallet is created twice during unstake @@ -664,7 +664,7 @@ def test_unstake_with_multiple_hotkeys_max_stake_not_enough_stake( self ): cli.run() mock_create_wallet.assert_has_calls( [ - call(config=ANY, hotkey=hk) for hk in config.wallet.hotkeys + call(config=ANY, hotkey=hk) for hk in config.hotkeys ], any_order=True ) @@ -687,10 +687,10 @@ def test_stake_with_specific_hotkeys( self ): config.no_prompt = True config.amount = 5.0 config.wallet.name = "fake_wallet" - config.wallet.hotkeys = [ + config.hotkeys = [ 'hk0', 'hk1', 'hk2' ] - config.wallet.all_hotkeys = False + config.all_hotkey = False # Notice no max_stake specified config.no_version_checking = False @@ -702,7 +702,7 @@ def test_stake_with_specific_hotkeys( self ): mock_wallets = [ SimpleNamespace( name = config.wallet.name, - hotkey_str = config.wallet.hotkeys[0], + hotkey_str = config.hotkeys[0], is_registered = MagicMock( return_value = True ), @@ -719,7 +719,7 @@ def test_stake_with_specific_hotkeys( self ): is_registered = MagicMock( return_value = True ) - ) for hk in config.wallet.hotkeys + ) for hk in config.hotkeys ] # The 0th wallet is created twice during unstake @@ -739,7 +739,7 @@ def test_stake_with_specific_hotkeys( self ): cli.run() mock_create_wallet.assert_has_calls( [ - call(config=ANY, hotkey=hk) for hk in config.wallet.hotkeys + call(config=ANY, hotkey=hk) for hk in config.hotkeys ], any_order=True ) @@ -755,7 +755,7 @@ def test_stake_with_all_hotkeys( self ): config.amount = 5.0 config.wallet.name = "fake_wallet" # Notice wallet.hotkeys is not specified - config.wallet.all_hotkeys = True + config.all_hotkey = True # Notice no max_stake specified config.no_version_checking = False @@ -802,8 +802,8 @@ def test_stake_with_exclude_hotkeys_from_all( self ): config.no_prompt = True config.amount = 5.0 config.wallet.name = "fake_wallet" - config.wallet.hotkeys = ['hk1'] # exclude hk1 - config.wallet.all_hotkeys = True + config.hotkeys = ['hk1'] # exclude hk1 + config.all_hotkey = True config.no_version_checking = False # Notice no max_stake specified @@ -853,10 +853,10 @@ def test_stake_with_multiple_hotkeys_max_stake( self ): # Notie amount is not specified config.max_stake = 15.0 # The keys should have at most 15.0 tao staked after config.wallet.name = "fake_wallet" - config.wallet.hotkeys = [ + config.hotkeys = [ 'hk0', 'hk1', 'hk2' ] - config.wallet.all_hotkeys = False + config.all_hotkey = False # Notice no max_stake specified config.no_version_checking = False @@ -874,9 +874,9 @@ def test_stake_with_multiple_hotkeys_max_stake( self ): mock_wallets = [ SimpleNamespace( name = config.wallet.name, - hotkey_str = config.wallet.hotkeys[0], + hotkey_str = config.hotkeys[0], get_stake = MagicMock( - return_value = mock_stakes[config.wallet.hotkeys[0]] + return_value = mock_stakes[config.hotkeys[0]] ), is_registered = MagicMock( return_value = True @@ -897,7 +897,7 @@ def test_stake_with_multiple_hotkeys_max_stake( self ): is_registered = MagicMock( return_value = True ) - ) for hk in config.wallet.hotkeys + ) for hk in config.hotkeys ] # The 0th wallet is created twice during unstake @@ -917,7 +917,7 @@ def test_stake_with_multiple_hotkeys_max_stake( self ): cli.run() mock_create_wallet.assert_has_calls( [ - call(config=ANY, hotkey=hk) for hk in config.wallet.hotkeys + call(config=ANY, hotkey=hk) for hk in config.hotkeys ], any_order=True ) @@ -933,10 +933,10 @@ def test_stake_with_multiple_hotkeys_max_stake_not_enough_balance( self ): # Notie amount is not specified config.max_stake = 15.0 # The keys should have at most 15.0 tao staked after config.wallet.name = "fake_wallet" - config.wallet.hotkeys = [ + config.hotkeys = [ 'hk0', 'hk1', 'hk2' ] - config.wallet.all_hotkeys = False + config.all_hotkey = False config.no_version_checking = False # Notice no max_stake specified @@ -955,9 +955,9 @@ def test_stake_with_multiple_hotkeys_max_stake_not_enough_balance( self ): mock_wallets = [ SimpleNamespace( name = config.wallet.name, - hotkey_str = config.wallet.hotkeys[0], + hotkey_str = config.hotkeys[0], get_stake = MagicMock( - return_value = mock_stakes[config.wallet.hotkeys[0]] + return_value = mock_stakes[config.hotkeys[0]] ), is_registered = MagicMock( return_value = True @@ -978,7 +978,7 @@ def test_stake_with_multiple_hotkeys_max_stake_not_enough_balance( self ): is_registered = MagicMock( return_value = True ) - ) for hk in config.wallet.hotkeys + ) for hk in config.hotkeys ] # The 0th wallet is created twice during unstake @@ -998,7 +998,7 @@ def test_stake_with_multiple_hotkeys_max_stake_not_enough_balance( self ): cli.run() mock_create_wallet.assert_has_calls( [ - call(config=ANY, hotkey=hk) for hk in config.wallet.hotkeys + call(config=ANY, hotkey=hk) for hk in config.hotkeys ], any_order=True ) @@ -1020,10 +1020,10 @@ def test_stake_with_single_hotkey_max_stake( self ): # Notie amount is not specified config.max_stake = 15.0 # The keys should have at most 15.0 tao staked after config.wallet.name = "fake_wallet" - config.wallet.hotkeys = [ + config.hotkeys = [ 'hk0' ] - config.wallet.all_hotkeys = False + config.all_hotkey = False # Notice no max_stake specified config.no_version_checking = False @@ -1039,9 +1039,9 @@ def test_stake_with_single_hotkey_max_stake( self ): mock_wallets = [ SimpleNamespace( name = config.wallet.name, - hotkey_str = config.wallet.hotkeys[0], + hotkey_str = config.hotkeys[0], get_stake = MagicMock( - return_value = mock_stakes[config.wallet.hotkeys[0]] + return_value = mock_stakes[config.hotkeys[0]] ), is_registered = MagicMock( return_value = True @@ -1062,7 +1062,7 @@ def test_stake_with_single_hotkey_max_stake( self ): is_registered = MagicMock( return_value = True ) - ) for hk in config.wallet.hotkeys + ) for hk in config.hotkeys ] # The 0th wallet is created twice during unstake @@ -1082,7 +1082,7 @@ def test_stake_with_single_hotkey_max_stake( self ): cli.run() mock_create_wallet.assert_has_calls( [ - call(config=ANY, hotkey=hk) for hk in config.wallet.hotkeys + call(config=ANY, hotkey=hk) for hk in config.hotkeys ], any_order=True ) @@ -1098,10 +1098,10 @@ def test_stake_with_single_hotkey_max_stake_not_enough_balance( self ): # Notie amount is not specified config.max_stake = 15.0 # The keys should have at most 15.0 tao staked after config.wallet.name = "fake_wallet" - config.wallet.hotkeys = [ + config.hotkeys = [ 'hk0' ] - config.wallet.all_hotkeys = False + config.all_hotkey = False config.no_version_checking = False # Notice no max_stake specified @@ -1118,9 +1118,9 @@ def test_stake_with_single_hotkey_max_stake_not_enough_balance( self ): mock_wallets = [ SimpleNamespace( name = config.wallet.name, - hotkey_str = config.wallet.hotkeys[0], + hotkey_str = config.hotkeys[0], get_stake = MagicMock( - return_value = mock_stakes[config.wallet.hotkeys[0]] + return_value = mock_stakes[config.hotkeys[0]] ), is_registered = MagicMock( return_value = True @@ -1141,7 +1141,7 @@ def test_stake_with_single_hotkey_max_stake_not_enough_balance( self ): is_registered = MagicMock( return_value = True ) - ) for hk in config.wallet.hotkeys + ) for hk in config.hotkeys ] # The 0th wallet is created twice during unstake @@ -1161,7 +1161,7 @@ def test_stake_with_single_hotkey_max_stake_not_enough_balance( self ): cli.run() mock_create_wallet.assert_has_calls( [ - call(config=ANY, hotkey=hk) for hk in config.wallet.hotkeys + call(config=ANY, hotkey=hk) for hk in config.hotkeys ], any_order=True ) @@ -1186,10 +1186,10 @@ def test_stake_with_single_hotkey_max_stake_enough_stake( self ): # Notie amount is not specified config.max_stake = 15.0 # The keys should have at most 15.0 tao staked after config.wallet.name = "fake_wallet" - config.wallet.hotkeys = [ + config.hotkeys = [ 'hk0' ] - config.wallet.all_hotkeys = False + config.all_hotkey = False config.no_version_checking = False # Notice no max_stake specified @@ -1206,9 +1206,9 @@ def test_stake_with_single_hotkey_max_stake_enough_stake( self ): mock_wallets = [ SimpleNamespace( name = config.wallet.name, - hotkey_str = config.wallet.hotkeys[0], + hotkey_str = config.hotkeys[0], get_stake = MagicMock( - return_value = mock_stakes[config.wallet.hotkeys[0]] + return_value = mock_stakes[config.hotkeys[0]] ), is_registered = MagicMock( return_value = True @@ -1229,7 +1229,7 @@ def test_stake_with_single_hotkey_max_stake_enough_stake( self ): is_registered = MagicMock( return_value = True ) - ) for hk in config.wallet.hotkeys + ) for hk in config.hotkeys ] # The 0th wallet is created twice during unstake @@ -1249,7 +1249,7 @@ def test_stake_with_single_hotkey_max_stake_enough_stake( self ): cli.run() mock_create_wallet.assert_has_calls( [ - call(config=ANY, hotkey=hk) for hk in config.wallet.hotkeys + call(config=ANY, hotkey=hk) for hk in config.hotkeys ], any_order=True )