bittensor-cli 9.1.0__py3-none-any.whl → 9.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bittensor_cli/cli.py +115 -38
- bittensor_cli/src/__init__.py +3 -0
- bittensor_cli/src/bittensor/subtensor_interface.py +1 -1
- bittensor_cli/src/bittensor/utils.py +17 -1
- bittensor_cli/src/commands/stake/add.py +1 -3
- bittensor_cli/src/commands/stake/list.py +1 -2
- bittensor_cli/src/commands/stake/move.py +80 -144
- bittensor_cli/src/commands/stake/remove.py +13 -12
- bittensor_cli/src/commands/subnets/subnets.py +7 -9
- bittensor_cli/src/commands/sudo.py +2 -3
- bittensor_cli/src/commands/view.py +106 -37
- bittensor_cli/src/commands/wallets.py +1 -2
- bittensor_cli/version.py +1 -1
- {bittensor_cli-9.1.0.dist-info → bittensor_cli-9.1.1.dist-info}/METADATA +10 -26
- {bittensor_cli-9.1.0.dist-info → bittensor_cli-9.1.1.dist-info}/RECORD +18 -19
- bittensor_cli/src/bittensor/templates/table.j2 +0 -267
- {bittensor_cli-9.1.0.dist-info → bittensor_cli-9.1.1.dist-info}/WHEEL +0 -0
- {bittensor_cli-9.1.0.dist-info → bittensor_cli-9.1.1.dist-info}/entry_points.txt +0 -0
- {bittensor_cli-9.1.0.dist-info → bittensor_cli-9.1.1.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,8 @@
|
|
1
1
|
import asyncio
|
2
2
|
|
3
3
|
from typing import TYPE_CHECKING
|
4
|
-
import typer
|
5
4
|
|
6
5
|
from bittensor_wallet import Wallet
|
7
|
-
from bittensor_wallet.errors import KeyFileError
|
8
6
|
from rich.table import Table
|
9
7
|
from rich.prompt import Confirm, Prompt
|
10
8
|
|
@@ -41,6 +39,11 @@ async def display_stake_movement_cross_subnets(
|
|
41
39
|
subnet = await subtensor.subnet(origin_netuid)
|
42
40
|
received_amount_tao = subnet.alpha_to_tao(amount_to_move)
|
43
41
|
received_amount_tao -= MIN_STAKE_FEE
|
42
|
+
|
43
|
+
if received_amount_tao < Balance.from_tao(0):
|
44
|
+
print_error("Not enough Alpha to pay the transaction fee.")
|
45
|
+
raise ValueError
|
46
|
+
|
44
47
|
received_amount = subnet.tao_to_alpha(received_amount_tao)
|
45
48
|
slippage_pct_float = (
|
46
49
|
100 * float(MIN_STAKE_FEE) / float(MIN_STAKE_FEE + received_amount_tao)
|
@@ -72,7 +75,7 @@ async def display_stake_movement_cross_subnets(
|
|
72
75
|
|
73
76
|
if received_amount < Balance.from_tao(0):
|
74
77
|
print_error("Not enough Alpha to pay the transaction fee.")
|
75
|
-
raise
|
78
|
+
raise ValueError
|
76
79
|
|
77
80
|
ideal_amount = amount_to_move * price
|
78
81
|
total_slippage = ideal_amount - received_amount
|
@@ -207,7 +210,7 @@ def prompt_stake_amount(
|
|
207
210
|
console.print("[red]Please enter a valid number or 'all'[/red]")
|
208
211
|
|
209
212
|
|
210
|
-
async def
|
213
|
+
async def stake_move_transfer_selection(
|
211
214
|
subtensor: "SubtensorInterface",
|
212
215
|
wallet: Wallet,
|
213
216
|
):
|
@@ -228,7 +231,7 @@ async def stake_move_selection(
|
|
228
231
|
|
229
232
|
if not hotkey_stakes:
|
230
233
|
print_error("You have no stakes to move.")
|
231
|
-
raise
|
234
|
+
raise ValueError
|
232
235
|
|
233
236
|
# Display hotkeys with stakes
|
234
237
|
table = Table(
|
@@ -293,25 +296,24 @@ async def stake_move_selection(
|
|
293
296
|
title_justify="center",
|
294
297
|
width=len(origin_hotkey_ss58) + 20,
|
295
298
|
)
|
296
|
-
table.add_column("Index", justify="right")
|
297
299
|
table.add_column("Netuid", style="cyan")
|
298
300
|
table.add_column("Stake Amount", style=COLOR_PALETTE["STAKE"]["STAKE_AMOUNT"])
|
299
301
|
|
300
302
|
available_netuids = []
|
301
|
-
for
|
303
|
+
for netuid in origin_hotkey_info["netuids"]:
|
302
304
|
stake = origin_hotkey_info["stakes"][netuid]
|
303
305
|
if stake.tao > 0:
|
304
306
|
available_netuids.append(netuid)
|
305
|
-
table.add_row(str(
|
307
|
+
table.add_row(str(netuid), str(stake))
|
306
308
|
|
307
309
|
console.print("\n", table)
|
308
310
|
|
309
311
|
# Select origin netuid
|
310
|
-
|
311
|
-
"\nEnter the
|
312
|
-
choices=[str(
|
312
|
+
origin_netuid = Prompt.ask(
|
313
|
+
"\nEnter the netuid you want to move stake from",
|
314
|
+
choices=[str(netuid) for netuid in available_netuids],
|
313
315
|
)
|
314
|
-
origin_netuid =
|
316
|
+
origin_netuid = int(origin_netuid)
|
315
317
|
origin_stake = origin_hotkey_info["stakes"][origin_netuid]
|
316
318
|
|
317
319
|
# Ask for amount to move
|
@@ -334,104 +336,6 @@ async def stake_move_selection(
|
|
334
336
|
}
|
335
337
|
|
336
338
|
|
337
|
-
async def stake_transfer_selection(
|
338
|
-
wallet: Wallet, subtensor: "SubtensorInterface", origin_hotkey: str
|
339
|
-
):
|
340
|
-
"""Selection interface for transferring stakes."""
|
341
|
-
(
|
342
|
-
stakes,
|
343
|
-
all_netuids,
|
344
|
-
all_subnets,
|
345
|
-
) = await asyncio.gather(
|
346
|
-
subtensor.get_stake_for_coldkey(coldkey_ss58=wallet.coldkeypub.ss58_address),
|
347
|
-
subtensor.get_all_subnet_netuids(),
|
348
|
-
subtensor.all_subnets(),
|
349
|
-
)
|
350
|
-
all_netuids = sorted(all_netuids)
|
351
|
-
all_subnets = {di.netuid: di for di in all_subnets}
|
352
|
-
|
353
|
-
available_stakes = {}
|
354
|
-
for stake in stakes:
|
355
|
-
if stake.stake.tao > 0 and stake.hotkey_ss58 == origin_hotkey:
|
356
|
-
available_stakes[stake.netuid] = {
|
357
|
-
"hotkey_ss58": stake.hotkey_ss58,
|
358
|
-
"stake": stake.stake,
|
359
|
-
"is_registered": stake.is_registered,
|
360
|
-
}
|
361
|
-
|
362
|
-
if not available_stakes:
|
363
|
-
console.print("[red]No stakes available to transfer.[/red]")
|
364
|
-
return None
|
365
|
-
|
366
|
-
table = Table(
|
367
|
-
title=(
|
368
|
-
f"\n[{COLOR_PALETTE['GENERAL']['HEADER']}]"
|
369
|
-
f"Available Stakes to Transfer\n"
|
370
|
-
f"for wallet hotkey:\n"
|
371
|
-
f"[{COLOR_PALETTE['GENERAL']['HOTKEY']}]{wallet.hotkey_str}: {wallet.hotkey.ss58_address}"
|
372
|
-
f"[/{COLOR_PALETTE['GENERAL']['HOTKEY']}]\n"
|
373
|
-
),
|
374
|
-
show_edge=False,
|
375
|
-
header_style="bold white",
|
376
|
-
border_style="bright_black",
|
377
|
-
title_justify="center",
|
378
|
-
width=len(wallet.hotkey_str + wallet.hotkey.ss58_address) + 10,
|
379
|
-
)
|
380
|
-
|
381
|
-
table.add_column("Index", justify="right", style="cyan")
|
382
|
-
table.add_column("Netuid")
|
383
|
-
table.add_column("Name", style="cyan", justify="left")
|
384
|
-
table.add_column("Stake Amount", style=COLOR_PALETTE["STAKE"]["STAKE_AMOUNT"])
|
385
|
-
table.add_column("Registered", justify="center")
|
386
|
-
|
387
|
-
for idx, (netuid, stake_info) in enumerate(available_stakes.items()):
|
388
|
-
subnet_name_cell = (
|
389
|
-
f"[{COLOR_PALETTE['GENERAL']['SYMBOL']}]{all_subnets[netuid].symbol if netuid != 0 else 'τ'}[/{COLOR_PALETTE['GENERAL']['SYMBOL']}]"
|
390
|
-
f" {get_subnet_name(all_subnets[netuid])}"
|
391
|
-
)
|
392
|
-
table.add_row(
|
393
|
-
str(idx),
|
394
|
-
str(netuid),
|
395
|
-
subnet_name_cell,
|
396
|
-
str(stake_info["stake"]),
|
397
|
-
"[dark_sea_green3]YES"
|
398
|
-
if stake_info["is_registered"]
|
399
|
-
else f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]NO",
|
400
|
-
)
|
401
|
-
|
402
|
-
console.print(table)
|
403
|
-
|
404
|
-
if not available_stakes:
|
405
|
-
console.print("[red]No stakes available to transfer.[/red]")
|
406
|
-
return None
|
407
|
-
|
408
|
-
# Prompt to select index of stake to transfer
|
409
|
-
selection = Prompt.ask(
|
410
|
-
"\nEnter the index of the stake you want to transfer",
|
411
|
-
choices=[str(i) for i in range(len(available_stakes))],
|
412
|
-
)
|
413
|
-
selected_netuid = list(available_stakes.keys())[int(selection)]
|
414
|
-
selected_stake = available_stakes[selected_netuid]
|
415
|
-
|
416
|
-
# Prompt for amount
|
417
|
-
stake_balance = selected_stake["stake"]
|
418
|
-
amount, _ = prompt_stake_amount(stake_balance, selected_netuid, "transfer")
|
419
|
-
|
420
|
-
# Prompt for destination subnet
|
421
|
-
destination_netuid = Prompt.ask(
|
422
|
-
"\nEnter the netuid of the subnet you want to move stake to"
|
423
|
-
+ f" ([dim]{group_subnets(all_netuids)}[/dim])",
|
424
|
-
choices=[str(netuid) for netuid in all_netuids],
|
425
|
-
show_choices=False,
|
426
|
-
)
|
427
|
-
|
428
|
-
return {
|
429
|
-
"origin_netuid": selected_netuid,
|
430
|
-
"amount": amount.tao,
|
431
|
-
"destination_netuid": int(destination_netuid),
|
432
|
-
}
|
433
|
-
|
434
|
-
|
435
339
|
async def stake_swap_selection(
|
436
340
|
subtensor: "SubtensorInterface",
|
437
341
|
wallet: Wallet,
|
@@ -457,7 +361,7 @@ async def stake_swap_selection(
|
|
457
361
|
|
458
362
|
if not hotkey_stakes:
|
459
363
|
print_error(f"No stakes found for hotkey: {wallet.hotkey_str}")
|
460
|
-
raise
|
364
|
+
raise ValueError
|
461
365
|
|
462
366
|
# Display available stakes
|
463
367
|
table = Table(
|
@@ -540,7 +444,10 @@ async def move_stake(
|
|
540
444
|
prompt: bool = True,
|
541
445
|
):
|
542
446
|
if interactive_selection:
|
543
|
-
|
447
|
+
try:
|
448
|
+
selection = await stake_move_transfer_selection(subtensor, wallet)
|
449
|
+
except ValueError:
|
450
|
+
return False
|
544
451
|
origin_hotkey = selection["origin_hotkey"]
|
545
452
|
origin_netuid = selection["origin_netuid"]
|
546
453
|
amount = selection["amount"]
|
@@ -571,7 +478,7 @@ async def move_stake(
|
|
571
478
|
f"in Netuid: "
|
572
479
|
f"[{COLOR_PALETTE['GENERAL']['SUBHEADING']}]{origin_netuid}[/{COLOR_PALETTE['GENERAL']['SUBHEADING']}]"
|
573
480
|
)
|
574
|
-
|
481
|
+
return False
|
575
482
|
|
576
483
|
console.print(
|
577
484
|
f"\nOrigin Netuid: "
|
@@ -609,16 +516,19 @@ async def move_stake(
|
|
609
516
|
|
610
517
|
# Slippage warning
|
611
518
|
if prompt:
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
519
|
+
try:
|
520
|
+
await display_stake_movement_cross_subnets(
|
521
|
+
subtensor=subtensor,
|
522
|
+
origin_netuid=origin_netuid,
|
523
|
+
destination_netuid=destination_netuid,
|
524
|
+
origin_hotkey=origin_hotkey,
|
525
|
+
destination_hotkey=destination_hotkey,
|
526
|
+
amount_to_move=amount_to_move_as_balance,
|
527
|
+
)
|
528
|
+
except ValueError:
|
529
|
+
return False
|
620
530
|
if not Confirm.ask("Would you like to continue?"):
|
621
|
-
|
531
|
+
return False
|
622
532
|
|
623
533
|
# Perform moving operation.
|
624
534
|
if not unlock_key(wallet).success:
|
@@ -699,6 +609,7 @@ async def transfer_stake(
|
|
699
609
|
dest_netuid: int,
|
700
610
|
dest_coldkey_ss58: str,
|
701
611
|
interactive_selection: bool = False,
|
612
|
+
stake_all: bool = False,
|
702
613
|
prompt: bool = True,
|
703
614
|
) -> bool:
|
704
615
|
"""Transfers stake from one network to another.
|
@@ -717,12 +628,13 @@ async def transfer_stake(
|
|
717
628
|
Returns:
|
718
629
|
bool: True if transfer was successful, False otherwise.
|
719
630
|
"""
|
720
|
-
origin_hotkey = origin_hotkey or wallet.hotkey.ss58_address
|
721
631
|
if interactive_selection:
|
722
|
-
selection = await
|
632
|
+
selection = await stake_move_transfer_selection(subtensor, wallet)
|
723
633
|
origin_netuid = selection["origin_netuid"]
|
724
634
|
amount = selection["amount"]
|
725
635
|
dest_netuid = selection["destination_netuid"]
|
636
|
+
stake_all = selection["stake_all"]
|
637
|
+
origin_hotkey = selection["origin_hotkey"]
|
726
638
|
|
727
639
|
# Check if both subnets exist
|
728
640
|
block_hash = await subtensor.substrate.get_chain_head()
|
@@ -750,7 +662,22 @@ async def transfer_stake(
|
|
750
662
|
hotkey_ss58=origin_hotkey,
|
751
663
|
netuid=dest_netuid,
|
752
664
|
)
|
753
|
-
|
665
|
+
|
666
|
+
if current_stake.tao == 0:
|
667
|
+
err_console.print(
|
668
|
+
f"[red]No stake found for hotkey: {origin_hotkey} on netuid: {origin_netuid}[/red]"
|
669
|
+
)
|
670
|
+
return False
|
671
|
+
|
672
|
+
amount_to_transfer = None
|
673
|
+
if amount:
|
674
|
+
amount_to_transfer = Balance.from_tao(amount).set_unit(origin_netuid)
|
675
|
+
elif stake_all:
|
676
|
+
amount_to_transfer = current_stake
|
677
|
+
else:
|
678
|
+
amount_to_transfer, _ = prompt_stake_amount(
|
679
|
+
current_stake, origin_netuid, "transfer"
|
680
|
+
)
|
754
681
|
|
755
682
|
# Check if enough stake to transfer
|
756
683
|
if amount_to_transfer > current_stake:
|
@@ -763,17 +690,20 @@ async def transfer_stake(
|
|
763
690
|
|
764
691
|
# Slippage warning
|
765
692
|
if prompt:
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
693
|
+
try:
|
694
|
+
await display_stake_movement_cross_subnets(
|
695
|
+
subtensor=subtensor,
|
696
|
+
origin_netuid=origin_netuid,
|
697
|
+
destination_netuid=dest_netuid,
|
698
|
+
origin_hotkey=origin_hotkey,
|
699
|
+
destination_hotkey=origin_hotkey,
|
700
|
+
amount_to_move=amount_to_transfer,
|
701
|
+
)
|
702
|
+
except ValueError:
|
703
|
+
return False
|
774
704
|
|
775
705
|
if not Confirm.ask("Would you like to continue?"):
|
776
|
-
|
706
|
+
return False
|
777
707
|
|
778
708
|
# Perform transfer operation
|
779
709
|
if not unlock_key(wallet).success:
|
@@ -868,7 +798,10 @@ async def swap_stake(
|
|
868
798
|
"""
|
869
799
|
hotkey_ss58 = wallet.hotkey.ss58_address
|
870
800
|
if interactive_selection:
|
871
|
-
|
801
|
+
try:
|
802
|
+
selection = await stake_swap_selection(subtensor, wallet)
|
803
|
+
except ValueError:
|
804
|
+
return False
|
872
805
|
origin_netuid = selection["origin_netuid"]
|
873
806
|
amount = selection["amount"]
|
874
807
|
destination_netuid = selection["destination_netuid"]
|
@@ -916,17 +849,20 @@ async def swap_stake(
|
|
916
849
|
|
917
850
|
# Slippage warning
|
918
851
|
if prompt:
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
852
|
+
try:
|
853
|
+
await display_stake_movement_cross_subnets(
|
854
|
+
subtensor=subtensor,
|
855
|
+
origin_netuid=origin_netuid,
|
856
|
+
destination_netuid=destination_netuid,
|
857
|
+
origin_hotkey=hotkey_ss58,
|
858
|
+
destination_hotkey=hotkey_ss58,
|
859
|
+
amount_to_move=amount_to_swap,
|
860
|
+
)
|
861
|
+
except ValueError:
|
862
|
+
return False
|
927
863
|
|
928
864
|
if not Confirm.ask("Would you like to continue?"):
|
929
|
-
|
865
|
+
return False
|
930
866
|
|
931
867
|
# Perform swap operation
|
932
868
|
if not unlock_key(wallet).success:
|
@@ -2,10 +2,8 @@ import asyncio
|
|
2
2
|
from functools import partial
|
3
3
|
|
4
4
|
from typing import TYPE_CHECKING, Optional
|
5
|
-
import typer
|
6
5
|
|
7
6
|
from bittensor_wallet import Wallet
|
8
|
-
from bittensor_wallet.errors import KeyFileError
|
9
7
|
from rich.prompt import Confirm, Prompt
|
10
8
|
from rich.table import Table
|
11
9
|
|
@@ -67,13 +65,16 @@ async def unstake(
|
|
67
65
|
all_sn_dynamic_info = {info.netuid: info for info in all_sn_dynamic_info_}
|
68
66
|
|
69
67
|
if interactive:
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
68
|
+
try:
|
69
|
+
hotkeys_to_unstake_from, unstake_all_from_hk = await _unstake_selection(
|
70
|
+
all_sn_dynamic_info,
|
71
|
+
ck_hk_identities,
|
72
|
+
old_identities,
|
73
|
+
stake_infos,
|
74
|
+
netuid=netuid,
|
75
|
+
)
|
76
|
+
except ValueError:
|
77
|
+
return False
|
77
78
|
if unstake_all_from_hk:
|
78
79
|
hotkey_to_unstake_all = hotkeys_to_unstake_from[0]
|
79
80
|
unstake_all_alpha = Confirm.ask(
|
@@ -266,7 +267,7 @@ async def unstake(
|
|
266
267
|
_print_table_and_slippage(table, max_float_slippage, safe_staking)
|
267
268
|
if prompt:
|
268
269
|
if not Confirm.ask("Would you like to continue?"):
|
269
|
-
|
270
|
+
return False
|
270
271
|
|
271
272
|
# Execute extrinsics
|
272
273
|
if not unlock_key(wallet).success:
|
@@ -823,7 +824,7 @@ async def _unstake_selection(
|
|
823
824
|
):
|
824
825
|
if not stake_infos:
|
825
826
|
print_error("You have no stakes to unstake.")
|
826
|
-
raise
|
827
|
+
raise ValueError
|
827
828
|
|
828
829
|
hotkey_stakes = {}
|
829
830
|
for stake_info in stake_infos:
|
@@ -840,7 +841,7 @@ async def _unstake_selection(
|
|
840
841
|
print_error(f"You have no stakes to unstake in subnet {netuid}.")
|
841
842
|
else:
|
842
843
|
print_error("You have no stakes to unstake.")
|
843
|
-
raise
|
844
|
+
raise ValueError
|
844
845
|
|
845
846
|
hotkeys_info = []
|
846
847
|
for idx, (hotkey_ss58, netuid_stakes) in enumerate(hotkey_stakes.items()):
|
@@ -2,10 +2,8 @@ import asyncio
|
|
2
2
|
import json
|
3
3
|
import sqlite3
|
4
4
|
from typing import TYPE_CHECKING, Optional, cast
|
5
|
-
import typer
|
6
5
|
|
7
6
|
from bittensor_wallet import Wallet
|
8
|
-
from bittensor_wallet.errors import KeyFileError
|
9
7
|
from rich.prompt import Confirm, Prompt
|
10
8
|
from rich.console import Group
|
11
9
|
from rich.progress import Progress, BarColumn, TextColumn
|
@@ -814,7 +812,7 @@ async def show(
|
|
814
812
|
root_info = next((s for s in all_subnets if s.netuid == 0), None)
|
815
813
|
if root_info is None:
|
816
814
|
print_error("The root subnet does not exist")
|
817
|
-
|
815
|
+
return False
|
818
816
|
|
819
817
|
root_state, identities, old_identities = await asyncio.gather(
|
820
818
|
subtensor.get_subnet_state(netuid=0, block_hash=block_hash),
|
@@ -1017,7 +1015,7 @@ async def show(
|
|
1017
1015
|
async def show_subnet(netuid_: int):
|
1018
1016
|
if not await subtensor.subnet_exists(netuid=netuid):
|
1019
1017
|
err_console.print(f"[red]Subnet {netuid} does not exist[/red]")
|
1020
|
-
|
1018
|
+
return False
|
1021
1019
|
block_hash = await subtensor.substrate.get_chain_head()
|
1022
1020
|
(
|
1023
1021
|
subnet_info,
|
@@ -1036,15 +1034,15 @@ async def show(
|
|
1036
1034
|
)
|
1037
1035
|
if subnet_state is None:
|
1038
1036
|
print_error(f"Subnet {netuid_} does not exist")
|
1039
|
-
|
1037
|
+
return False
|
1040
1038
|
|
1041
1039
|
if subnet_info is None:
|
1042
1040
|
print_error(f"Subnet {netuid_} does not exist")
|
1043
|
-
|
1041
|
+
return False
|
1044
1042
|
|
1045
1043
|
if len(subnet_state.hotkeys) == 0:
|
1046
1044
|
print_error(f"Subnet {netuid_} is currently empty with 0 UIDs registered.")
|
1047
|
-
|
1045
|
+
return False
|
1048
1046
|
|
1049
1047
|
# Define table properties
|
1050
1048
|
table = Table(
|
@@ -1381,7 +1379,7 @@ async def create(
|
|
1381
1379
|
" are you sure you wish to continue?"
|
1382
1380
|
):
|
1383
1381
|
console.print(":cross_mark: Aborted!")
|
1384
|
-
|
1382
|
+
return False
|
1385
1383
|
|
1386
1384
|
identity = prompt_for_identity(
|
1387
1385
|
current_identity=current_identity,
|
@@ -2135,7 +2133,7 @@ async def get_identity(subtensor: "SubtensorInterface", netuid: int, title: str
|
|
2135
2133
|
|
2136
2134
|
if not await subtensor.subnet_exists(netuid):
|
2137
2135
|
print_error(f"Subnet {netuid} does not exist.")
|
2138
|
-
|
2136
|
+
return None
|
2139
2137
|
|
2140
2138
|
with console.status(
|
2141
2139
|
":satellite: [bold green]Querying subnet identity...", spinner="earth"
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import asyncio
|
2
2
|
from typing import TYPE_CHECKING, Union, Optional
|
3
3
|
|
4
|
-
import typer
|
5
4
|
from bittensor_wallet import Wallet
|
6
5
|
from rich import box
|
7
6
|
from rich.table import Column, Table
|
@@ -593,7 +592,7 @@ async def sudo_set_hyperparameter(
|
|
593
592
|
if success:
|
594
593
|
console.print("\n")
|
595
594
|
print_verbose("Fetching hyperparameters")
|
596
|
-
await get_hyperparameters(subtensor, netuid=netuid)
|
595
|
+
return await get_hyperparameters(subtensor, netuid=netuid)
|
597
596
|
|
598
597
|
|
599
598
|
async def get_hyperparameters(subtensor: "SubtensorInterface", netuid: int):
|
@@ -606,7 +605,7 @@ async def get_hyperparameters(subtensor: "SubtensorInterface", netuid: int):
|
|
606
605
|
subnet_info = await subtensor.subnet(netuid)
|
607
606
|
if subnet_info is None:
|
608
607
|
print_error(f"Subnet with netuid {netuid} does not exist.")
|
609
|
-
|
608
|
+
return False
|
610
609
|
|
611
610
|
table = Table(
|
612
611
|
Column("[white]HYPERPARAMETER", style=COLOR_PALETTE["SUDO"]["HYPERPARAMETER"]),
|