bittensor-cli 8.2.0__py3-none-any.whl → 8.3.0__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/__init__.py +1 -1
- bittensor_cli/cli.py +180 -123
- bittensor_cli/src/__init__.py +4 -2
- bittensor_cli/src/bittensor/async_substrate_interface.py +25 -15
- bittensor_cli/src/bittensor/extrinsics/registration.py +35 -22
- bittensor_cli/src/bittensor/extrinsics/root.py +2 -0
- bittensor_cli/src/bittensor/extrinsics/transfer.py +16 -2
- bittensor_cli/src/bittensor/subtensor_interface.py +11 -11
- bittensor_cli/src/bittensor/utils.py +2 -2
- bittensor_cli/src/commands/root.py +5 -0
- bittensor_cli/src/commands/stake/children_hotkeys.py +7 -5
- bittensor_cli/src/commands/stake/stake.py +6 -0
- bittensor_cli/src/commands/subnets.py +3 -1
- bittensor_cli/src/commands/sudo.py +1 -0
- bittensor_cli/src/commands/wallets.py +63 -62
- bittensor_cli/src/commands/weights.py +4 -2
- {bittensor_cli-8.2.0.dist-info → bittensor_cli-8.3.0.dist-info}/METADATA +1 -1
- bittensor_cli-8.3.0.dist-info/RECORD +31 -0
- bittensor_cli-8.2.0.dist-info/RECORD +0 -31
- {bittensor_cli-8.2.0.dist-info → bittensor_cli-8.3.0.dist-info}/WHEEL +0 -0
- {bittensor_cli-8.2.0.dist-info → bittensor_cli-8.3.0.dist-info}/entry_points.txt +0 -0
- {bittensor_cli-8.2.0.dist-info → bittensor_cli-8.3.0.dist-info}/top_level.txt +0 -0
bittensor_cli/cli.py
CHANGED
@@ -57,7 +57,7 @@ except ImportError:
|
|
57
57
|
pass
|
58
58
|
|
59
59
|
|
60
|
-
__version__ = "8.
|
60
|
+
__version__ = "8.3.0"
|
61
61
|
|
62
62
|
|
63
63
|
_core_version = re.match(r"^\d+\.\d+\.\d+", __version__).group(0)
|
@@ -331,6 +331,12 @@ def get_creation_data(
|
|
331
331
|
json = prompt_answer
|
332
332
|
elif mnemonic:
|
333
333
|
mnemonic = parse_mnemonic(mnemonic)
|
334
|
+
|
335
|
+
if json:
|
336
|
+
if not os.path.exists(json):
|
337
|
+
print_error(f"The JSON file '{json}' does not exist.")
|
338
|
+
raise typer.Exit()
|
339
|
+
|
334
340
|
if json and not json_password:
|
335
341
|
json_password = Prompt.ask(
|
336
342
|
"Enter the backup password for JSON file.", password=True
|
@@ -816,30 +822,35 @@ class CLIManager:
|
|
816
822
|
self.subtensor = SubtensorInterface(defaults.subtensor.network)
|
817
823
|
return self.subtensor
|
818
824
|
|
819
|
-
def _run_command(self, cmd: Coroutine)
|
825
|
+
def _run_command(self, cmd: Coroutine):
|
820
826
|
"""
|
821
827
|
Runs the supplied coroutine with `asyncio.run`
|
822
828
|
"""
|
823
829
|
|
824
830
|
async def _run():
|
831
|
+
initiated = False
|
825
832
|
try:
|
826
833
|
if self.subtensor:
|
827
834
|
async with self.subtensor:
|
835
|
+
initiated = True
|
828
836
|
result = await cmd
|
829
837
|
else:
|
838
|
+
initiated = True
|
830
839
|
result = await cmd
|
831
840
|
return result
|
832
841
|
except (ConnectionRefusedError, ssl.SSLError):
|
833
842
|
err_console.print(f"Unable to connect to the chain: {self.subtensor}")
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
+
except (
|
844
|
+
ConnectionClosed,
|
845
|
+
SubstrateRequestException,
|
846
|
+
KeyboardInterrupt,
|
847
|
+
) as e:
|
848
|
+
if isinstance(e, SubstrateRequestException):
|
849
|
+
err_console.print(str(e))
|
850
|
+
finally:
|
851
|
+
if initiated is False:
|
852
|
+
asyncio.create_task(cmd).cancel()
|
853
|
+
raise typer.Exit()
|
843
854
|
|
844
855
|
if sys.version_info < (3, 10):
|
845
856
|
# For Python 3.9 or lower
|
@@ -857,15 +868,32 @@ class CLIManager:
|
|
857
868
|
"""
|
858
869
|
Command line interface (CLI) for Bittensor. Uses the values in the configuration file. These values can be overriden by passing them explicitly in the command line.
|
859
870
|
"""
|
860
|
-
# create config file
|
861
|
-
if
|
871
|
+
# Load or create the config file
|
872
|
+
if os.path.exists(self.config_path):
|
873
|
+
with open(self.config_path, "r") as f:
|
874
|
+
config = safe_load(f)
|
875
|
+
else:
|
862
876
|
directory_path = Path(self.config_base_path)
|
863
877
|
directory_path.mkdir(exist_ok=True, parents=True)
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
878
|
+
config = defaults.config.dictionary.copy()
|
879
|
+
with open(self.config_path, "w") as f:
|
880
|
+
safe_dump(config, f)
|
881
|
+
|
882
|
+
# Update missing values
|
883
|
+
updated = False
|
884
|
+
for key, value in defaults.config.dictionary.items():
|
885
|
+
if key not in config:
|
886
|
+
config[key] = value
|
887
|
+
updated = True
|
888
|
+
elif isinstance(value, dict):
|
889
|
+
for sub_key, sub_value in value.items():
|
890
|
+
if sub_key not in config[key]:
|
891
|
+
config[key][sub_key] = sub_value
|
892
|
+
updated = True
|
893
|
+
if updated:
|
894
|
+
with open(self.config_path, "w") as f:
|
895
|
+
safe_dump(config, f)
|
896
|
+
|
869
897
|
for k, v in config.items():
|
870
898
|
if k in self.config.keys():
|
871
899
|
self.config[k] = v
|
@@ -1146,6 +1174,29 @@ class CLIManager:
|
|
1146
1174
|
:return: created Wallet object
|
1147
1175
|
"""
|
1148
1176
|
# Prompt for missing attributes specified in ask_for
|
1177
|
+
|
1178
|
+
if wallet_path:
|
1179
|
+
if wallet_path == "default":
|
1180
|
+
wallet_path = defaults.wallet.path
|
1181
|
+
|
1182
|
+
elif self.config.get("wallet_path"):
|
1183
|
+
wallet_path = self.config.get("wallet_path")
|
1184
|
+
console.print(
|
1185
|
+
f"Using the wallet path from config:[bold magenta] {wallet_path}"
|
1186
|
+
)
|
1187
|
+
|
1188
|
+
if WO.PATH in ask_for and not wallet_path:
|
1189
|
+
wallet_path = Prompt.ask(
|
1190
|
+
"Enter the [blue]wallet path[/blue]"
|
1191
|
+
+ " [dark_sea_green3 italic](Hint: You can set this with `btcli config set --wallet-path`)[/dark_sea_green3 italic]",
|
1192
|
+
default=defaults.wallet.path,
|
1193
|
+
)
|
1194
|
+
if wallet_path:
|
1195
|
+
wallet_path = os.path.expanduser(wallet_path)
|
1196
|
+
else:
|
1197
|
+
wallet_path = os.path.expanduser(defaults.wallet.path)
|
1198
|
+
console.print(f"Using default wallet path: ({defaults.wallet.path})")
|
1199
|
+
|
1149
1200
|
if WO.NAME in ask_for and not wallet_name:
|
1150
1201
|
if self.config.get("wallet_name"):
|
1151
1202
|
wallet_name = self.config.get("wallet_name")
|
@@ -1153,13 +1204,9 @@ class CLIManager:
|
|
1153
1204
|
f"Using the wallet name from config:[bold cyan] {wallet_name}"
|
1154
1205
|
)
|
1155
1206
|
else:
|
1156
|
-
wallet_name =
|
1157
|
-
|
1158
|
-
+
|
1159
|
-
" (Hint: You can set this with `btcli config set --wallet-name`)",
|
1160
|
-
fg="green",
|
1161
|
-
italic=True,
|
1162
|
-
),
|
1207
|
+
wallet_name = Prompt.ask(
|
1208
|
+
"Enter the [blue]wallet name[/blue]"
|
1209
|
+
+ " [dark_sea_green3 italic](Hint: You can set this with `btcli config set --wallet-name`)[/dark_sea_green3 italic]",
|
1163
1210
|
default=defaults.wallet.name,
|
1164
1211
|
)
|
1165
1212
|
|
@@ -1170,38 +1217,13 @@ class CLIManager:
|
|
1170
1217
|
f"Using the wallet hotkey from config:[bold cyan] {wallet_hotkey}"
|
1171
1218
|
)
|
1172
1219
|
else:
|
1173
|
-
wallet_hotkey =
|
1174
|
-
|
1175
|
-
+
|
1176
|
-
" (Hint: You can set this with `btcli config set --wallet-hotkey`)",
|
1177
|
-
fg="green",
|
1178
|
-
italic=True,
|
1179
|
-
),
|
1220
|
+
wallet_hotkey = Prompt.ask(
|
1221
|
+
"Enter the [blue]wallet hotkey[/blue]"
|
1222
|
+
+ " [dark_sea_green3 italic](Hint: You can set this with `btcli config set --wallet-hotkey`)[/dark_sea_green3 italic]",
|
1180
1223
|
default=defaults.wallet.hotkey,
|
1181
1224
|
)
|
1182
|
-
if wallet_path:
|
1183
|
-
if wallet_path == "default":
|
1184
|
-
wallet_path = defaults.wallet.path
|
1185
1225
|
|
1186
|
-
elif self.config.get("wallet_path"):
|
1187
|
-
wallet_path = self.config.get("wallet_path")
|
1188
|
-
console.print(
|
1189
|
-
f"Using the wallet path from config:[bold magenta] {wallet_path}"
|
1190
|
-
)
|
1191
|
-
|
1192
|
-
if WO.PATH in ask_for and not wallet_path:
|
1193
|
-
wallet_path = typer.prompt(
|
1194
|
-
typer.style("Enter the wallet path", fg="blue")
|
1195
|
-
+ typer.style(
|
1196
|
-
" (Hint: You can set this with `btcli config set --wallet-path`)",
|
1197
|
-
fg="green",
|
1198
|
-
italic=True,
|
1199
|
-
),
|
1200
|
-
default=defaults.wallet.path,
|
1201
|
-
)
|
1202
1226
|
# Create the Wallet object
|
1203
|
-
if wallet_path:
|
1204
|
-
wallet_path = os.path.expanduser(wallet_path)
|
1205
1227
|
wallet = Wallet(name=wallet_name, path=wallet_path, hotkey=wallet_hotkey)
|
1206
1228
|
|
1207
1229
|
# Validate the wallet if required
|
@@ -1357,7 +1379,7 @@ class CLIManager:
|
|
1357
1379
|
"Netuids must be a comma-separated list of ints, e.g., `--netuids 1,2,3,4`.",
|
1358
1380
|
)
|
1359
1381
|
|
1360
|
-
ask_for = [WO.NAME
|
1382
|
+
ask_for = [WO.NAME] if not all_wallets else []
|
1361
1383
|
validate = WV.WALLET if not all_wallets else WV.NONE
|
1362
1384
|
wallet = self.wallet_ask(
|
1363
1385
|
wallet_name, wallet_path, wallet_hotkey, ask_for=ask_for, validate=validate
|
@@ -1404,9 +1426,12 @@ class CLIManager:
|
|
1404
1426
|
None,
|
1405
1427
|
"--amount",
|
1406
1428
|
"-a",
|
1407
|
-
prompt=
|
1429
|
+
prompt=False,
|
1408
1430
|
help="Amount (in TAO) to transfer.",
|
1409
1431
|
),
|
1432
|
+
transfer_all: bool = typer.Option(
|
1433
|
+
False, "--all", prompt=False, help="Transfer all available balance."
|
1434
|
+
),
|
1410
1435
|
wallet_name: str = Options.wallet_name,
|
1411
1436
|
wallet_path: str = Options.wallet_path,
|
1412
1437
|
wallet_hotkey: str = Options.wallet_hotkey,
|
@@ -1442,13 +1467,25 @@ class CLIManager:
|
|
1442
1467
|
wallet_name,
|
1443
1468
|
wallet_path,
|
1444
1469
|
wallet_hotkey,
|
1445
|
-
ask_for=[WO.NAME
|
1470
|
+
ask_for=[WO.NAME],
|
1446
1471
|
validate=WV.WALLET,
|
1447
1472
|
)
|
1448
1473
|
subtensor = self.initialize_chain(network)
|
1474
|
+
if transfer_all and amount:
|
1475
|
+
print_error("Cannot specify an amount and '--all' flag.")
|
1476
|
+
raise typer.Exit()
|
1477
|
+
elif transfer_all:
|
1478
|
+
amount = 0
|
1479
|
+
elif not amount:
|
1480
|
+
amount = FloatPrompt.ask("Enter amount (in TAO) to transfer.")
|
1449
1481
|
return self._run_command(
|
1450
1482
|
wallets.transfer(
|
1451
|
-
wallet,
|
1483
|
+
wallet,
|
1484
|
+
subtensor,
|
1485
|
+
destination_ss58_address,
|
1486
|
+
amount,
|
1487
|
+
transfer_all,
|
1488
|
+
prompt,
|
1452
1489
|
)
|
1453
1490
|
)
|
1454
1491
|
|
@@ -1487,7 +1524,7 @@ class CLIManager:
|
|
1487
1524
|
wallet_name,
|
1488
1525
|
wallet_path,
|
1489
1526
|
wallet_hotkey,
|
1490
|
-
ask_for=[WO.NAME, WO.
|
1527
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
1491
1528
|
validate=WV.WALLET_AND_HOTKEY,
|
1492
1529
|
)
|
1493
1530
|
if not destination_hotkey_name:
|
@@ -1499,7 +1536,7 @@ class CLIManager:
|
|
1499
1536
|
wallet_name,
|
1500
1537
|
wallet_path,
|
1501
1538
|
destination_hotkey_name,
|
1502
|
-
ask_for=[WO.NAME, WO.
|
1539
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
1503
1540
|
validate=WV.WALLET_AND_HOTKEY,
|
1504
1541
|
)
|
1505
1542
|
self.initialize_chain(network)
|
@@ -1565,7 +1602,7 @@ class CLIManager:
|
|
1565
1602
|
)
|
1566
1603
|
|
1567
1604
|
# if all-wallets is entered, ask for path
|
1568
|
-
ask_for = [WO.NAME
|
1605
|
+
ask_for = [WO.NAME] if not all_wallets else []
|
1569
1606
|
validate = WV.WALLET if not all_wallets else WV.NONE
|
1570
1607
|
wallet = self.wallet_ask(
|
1571
1608
|
wallet_name, wallet_path, wallet_hotkey, ask_for=ask_for, validate=validate
|
@@ -1631,6 +1668,7 @@ class CLIManager:
|
|
1631
1668
|
"--max-successes",
|
1632
1669
|
help="Set the maximum number of times to successfully run the faucet for this command.",
|
1633
1670
|
),
|
1671
|
+
prompt: bool = Options.prompt,
|
1634
1672
|
):
|
1635
1673
|
"""
|
1636
1674
|
Obtain test TAO tokens by performing Proof of Work (PoW).
|
@@ -1654,7 +1692,7 @@ class CLIManager:
|
|
1654
1692
|
wallet_name,
|
1655
1693
|
wallet_path,
|
1656
1694
|
wallet_hotkey,
|
1657
|
-
ask_for=[WO.NAME
|
1695
|
+
ask_for=[WO.NAME],
|
1658
1696
|
validate=WV.WALLET,
|
1659
1697
|
)
|
1660
1698
|
return self._run_command(
|
@@ -1669,6 +1707,7 @@ class CLIManager:
|
|
1669
1707
|
output_in_place,
|
1670
1708
|
verbose,
|
1671
1709
|
max_successes,
|
1710
|
+
prompt,
|
1672
1711
|
)
|
1673
1712
|
)
|
1674
1713
|
|
@@ -2085,7 +2124,7 @@ class CLIManager:
|
|
2085
2124
|
else:
|
2086
2125
|
raise typer.Exit()
|
2087
2126
|
else:
|
2088
|
-
ask_for = [
|
2127
|
+
ask_for = [] if all_balances else [WO.NAME]
|
2089
2128
|
validate = WV.NONE if all_balances else WV.WALLET
|
2090
2129
|
wallet = self.wallet_ask(
|
2091
2130
|
wallet_name,
|
@@ -2131,7 +2170,7 @@ class CLIManager:
|
|
2131
2170
|
wallet_name,
|
2132
2171
|
wallet_path,
|
2133
2172
|
wallet_hotkey,
|
2134
|
-
ask_for=[WO.NAME
|
2173
|
+
ask_for=[WO.NAME],
|
2135
2174
|
validate=WV.WALLET,
|
2136
2175
|
)
|
2137
2176
|
return self._run_command(wallets.wallet_history(wallet))
|
@@ -2232,7 +2271,7 @@ class CLIManager:
|
|
2232
2271
|
wallet_name,
|
2233
2272
|
wallet_path,
|
2234
2273
|
wallet_hotkey,
|
2235
|
-
ask_for=[WO.HOTKEY, WO.
|
2274
|
+
ask_for=[WO.HOTKEY, WO.NAME],
|
2236
2275
|
validate=WV.WALLET_AND_HOTKEY,
|
2237
2276
|
)
|
2238
2277
|
|
@@ -2383,11 +2422,12 @@ class CLIManager:
|
|
2383
2422
|
if use_hotkey is None:
|
2384
2423
|
use_hotkey = Confirm.ask(
|
2385
2424
|
"Would you like to sign the transaction using your [red]hotkey[/red]?"
|
2386
|
-
"\n[Type [red]y[/red] for [red]hotkey[/red] and [blue]n[/blue] for [blue]coldkey[/blue]]
|
2425
|
+
"\n[Type [red]y[/red] for [red]hotkey[/red] and [blue]n[/blue] for [blue]coldkey[/blue]] "
|
2426
|
+
"(default is [blue]coldkey[/blue])",
|
2387
2427
|
default=False,
|
2388
2428
|
)
|
2389
2429
|
|
2390
|
-
ask_for = [WO.HOTKEY, WO.
|
2430
|
+
ask_for = [WO.HOTKEY, WO.NAME] if use_hotkey else [WO.NAME]
|
2391
2431
|
validate = WV.WALLET_AND_HOTKEY if use_hotkey else WV.WALLET
|
2392
2432
|
|
2393
2433
|
wallet = self.wallet_ask(
|
@@ -2490,7 +2530,7 @@ class CLIManager:
|
|
2490
2530
|
wallet_name,
|
2491
2531
|
wallet_path,
|
2492
2532
|
wallet_hotkey,
|
2493
|
-
ask_for=[WO.HOTKEY, WO.
|
2533
|
+
ask_for=[WO.HOTKEY, WO.NAME],
|
2494
2534
|
validate=WV.WALLET_AND_HOTKEY,
|
2495
2535
|
)
|
2496
2536
|
self._run_command(
|
@@ -2581,7 +2621,7 @@ class CLIManager:
|
|
2581
2621
|
wallet_name,
|
2582
2622
|
wallet_path,
|
2583
2623
|
wallet_hotkey,
|
2584
|
-
ask_for=[WO.NAME, WO.
|
2624
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
2585
2625
|
validate=WV.WALLET_AND_HOTKEY,
|
2586
2626
|
)
|
2587
2627
|
return self._run_command(
|
@@ -2622,7 +2662,7 @@ class CLIManager:
|
|
2622
2662
|
wallet_name,
|
2623
2663
|
wallet_path,
|
2624
2664
|
wallet_hotkey,
|
2625
|
-
ask_for=[WO.NAME, WO.
|
2665
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
2626
2666
|
validate=WV.WALLET_AND_HOTKEY,
|
2627
2667
|
)
|
2628
2668
|
return self._run_command(
|
@@ -2672,7 +2712,7 @@ class CLIManager:
|
|
2672
2712
|
wallet_name,
|
2673
2713
|
wallet_path,
|
2674
2714
|
wallet_hotkey,
|
2675
|
-
ask_for=[WO.NAME, WO.
|
2715
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
2676
2716
|
validate=WV.WALLET_AND_HOTKEY,
|
2677
2717
|
)
|
2678
2718
|
return self._run_command(
|
@@ -2727,7 +2767,7 @@ class CLIManager:
|
|
2727
2767
|
wallet_name,
|
2728
2768
|
wallet_path,
|
2729
2769
|
wallet_hotkey,
|
2730
|
-
ask_for=[WO.NAME, WO.
|
2770
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
2731
2771
|
validate=WV.WALLET_AND_HOTKEY,
|
2732
2772
|
)
|
2733
2773
|
return self._run_command(
|
@@ -2796,7 +2836,7 @@ class CLIManager:
|
|
2796
2836
|
wallet_name,
|
2797
2837
|
wallet_path,
|
2798
2838
|
wallet_hotkey,
|
2799
|
-
ask_for=[WO.NAME, WO.
|
2839
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
2800
2840
|
validate=WV.WALLET_AND_HOTKEY,
|
2801
2841
|
)
|
2802
2842
|
|
@@ -2853,10 +2893,10 @@ class CLIManager:
|
|
2853
2893
|
if not stake_all and not amount:
|
2854
2894
|
while True:
|
2855
2895
|
amount = FloatPrompt.ask(
|
2856
|
-
"
|
2896
|
+
"Amount to [blue]stake (TAO τ)[/blue]", console=console
|
2857
2897
|
)
|
2858
2898
|
confirmation = FloatPrompt.ask(
|
2859
|
-
"
|
2899
|
+
"Confirm the amount to stake [blue](TAO τ)[/blue]",
|
2860
2900
|
console=console,
|
2861
2901
|
)
|
2862
2902
|
if amount == confirmation:
|
@@ -2867,7 +2907,7 @@ class CLIManager:
|
|
2867
2907
|
)
|
2868
2908
|
|
2869
2909
|
wallet = self.wallet_ask(
|
2870
|
-
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME
|
2910
|
+
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME]
|
2871
2911
|
)
|
2872
2912
|
return self._run_command(
|
2873
2913
|
root.delegate_stake(
|
@@ -2923,10 +2963,10 @@ class CLIManager:
|
|
2923
2963
|
if not unstake_all and not amount:
|
2924
2964
|
while True:
|
2925
2965
|
amount = FloatPrompt.ask(
|
2926
|
-
"
|
2966
|
+
"Amount to [blue]unstake (TAO τ)[/blue]", console=console
|
2927
2967
|
)
|
2928
2968
|
confirmation = FloatPrompt.ask(
|
2929
|
-
"
|
2969
|
+
"Confirm the amount to unstake [blue](TAO τ)[/blue]",
|
2930
2970
|
console=console,
|
2931
2971
|
)
|
2932
2972
|
if amount == confirmation:
|
@@ -2937,7 +2977,7 @@ class CLIManager:
|
|
2937
2977
|
)
|
2938
2978
|
|
2939
2979
|
wallet = self.wallet_ask(
|
2940
|
-
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME
|
2980
|
+
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME]
|
2941
2981
|
)
|
2942
2982
|
self._run_command(
|
2943
2983
|
root.delegate_unstake(
|
@@ -3009,7 +3049,7 @@ class CLIManager:
|
|
3009
3049
|
wallet_name,
|
3010
3050
|
wallet_path,
|
3011
3051
|
wallet_hotkey,
|
3012
|
-
ask_for=([WO.NAME
|
3052
|
+
ask_for=([WO.NAME] if not all_wallets else []),
|
3013
3053
|
validate=WV.WALLET if not all_wallets else WV.NONE,
|
3014
3054
|
)
|
3015
3055
|
self._run_command(
|
@@ -3123,7 +3163,7 @@ class CLIManager:
|
|
3123
3163
|
wallet_name,
|
3124
3164
|
wallet_path,
|
3125
3165
|
wallet_hotkey,
|
3126
|
-
ask_for=[WO.NAME, WO.
|
3166
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
3127
3167
|
validate=WV.WALLET_AND_HOTKEY,
|
3128
3168
|
)
|
3129
3169
|
return self._run_command(
|
@@ -3188,12 +3228,12 @@ class CLIManager:
|
|
3188
3228
|
wallet_name,
|
3189
3229
|
wallet_path,
|
3190
3230
|
wallet_hotkey,
|
3191
|
-
ask_for=[
|
3231
|
+
ask_for=[],
|
3192
3232
|
validate=WV.NONE,
|
3193
3233
|
)
|
3194
3234
|
else:
|
3195
3235
|
wallet = self.wallet_ask(
|
3196
|
-
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME
|
3236
|
+
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME]
|
3197
3237
|
)
|
3198
3238
|
|
3199
3239
|
return self._run_command(
|
@@ -3269,13 +3309,13 @@ class CLIManager:
|
|
3269
3309
|
self.verbosity_handler(quiet, verbose)
|
3270
3310
|
|
3271
3311
|
if stake_all and amount:
|
3272
|
-
|
3312
|
+
print_error(
|
3273
3313
|
"Cannot specify an amount and 'stake-all'. Choose one or the other."
|
3274
3314
|
)
|
3275
3315
|
raise typer.Exit()
|
3276
3316
|
|
3277
3317
|
if not stake_all and not amount and not max_stake:
|
3278
|
-
amount = FloatPrompt.ask("
|
3318
|
+
amount = FloatPrompt.ask("Amount to [blue]stake (TAO τ)[/blue]")
|
3279
3319
|
|
3280
3320
|
if stake_all and not amount:
|
3281
3321
|
if not Confirm.ask("Stake all the available TAO tokens?", default=False):
|
@@ -3306,7 +3346,7 @@ class CLIManager:
|
|
3306
3346
|
if is_valid_ss58_address(hotkey_or_ss58):
|
3307
3347
|
hotkey_ss58_address = hotkey_or_ss58
|
3308
3348
|
wallet = self.wallet_ask(
|
3309
|
-
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME
|
3349
|
+
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME]
|
3310
3350
|
)
|
3311
3351
|
else:
|
3312
3352
|
wallet_hotkey = hotkey_or_ss58
|
@@ -3314,38 +3354,42 @@ class CLIManager:
|
|
3314
3354
|
wallet_name,
|
3315
3355
|
wallet_path,
|
3316
3356
|
wallet_hotkey,
|
3317
|
-
ask_for=[WO.NAME, WO.HOTKEY
|
3357
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
3318
3358
|
validate=WV.WALLET_AND_HOTKEY,
|
3319
3359
|
)
|
3320
3360
|
|
3321
3361
|
elif all_hotkeys or include_hotkeys or exclude_hotkeys or hotkey_ss58_address:
|
3322
3362
|
wallet = self.wallet_ask(
|
3323
|
-
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME
|
3363
|
+
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME]
|
3324
3364
|
)
|
3325
3365
|
else:
|
3326
3366
|
wallet = self.wallet_ask(
|
3327
3367
|
wallet_name,
|
3328
3368
|
wallet_path,
|
3329
3369
|
wallet_hotkey,
|
3330
|
-
ask_for=[WO.NAME, WO.
|
3370
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
3331
3371
|
validate=WV.WALLET_AND_HOTKEY,
|
3332
3372
|
)
|
3333
3373
|
|
3334
3374
|
if include_hotkeys:
|
3335
|
-
|
3375
|
+
included_hotkeys = parse_to_list(
|
3336
3376
|
include_hotkeys,
|
3337
3377
|
str,
|
3338
|
-
"Hotkeys must be a comma-separated list of ss58s, e.g.,
|
3339
|
-
|
3378
|
+
"Hotkeys must be a comma-separated list of ss58s or hotkey names, e.g., "
|
3379
|
+
"`--include-hotkeys 5Grw....,5Grw....`.",
|
3340
3380
|
)
|
3381
|
+
else:
|
3382
|
+
included_hotkeys = []
|
3341
3383
|
|
3342
3384
|
if exclude_hotkeys:
|
3343
|
-
|
3385
|
+
excluded_hotkeys = parse_to_list(
|
3344
3386
|
exclude_hotkeys,
|
3345
3387
|
str,
|
3346
|
-
"Hotkeys must be a comma-separated list of ss58s, e.g.,
|
3347
|
-
|
3388
|
+
"Hotkeys must be a comma-separated list of ss58s or hotkey names, e.g., "
|
3389
|
+
"`--exclude-hotkeys 5Grw....,5Grw....`.",
|
3348
3390
|
)
|
3391
|
+
else:
|
3392
|
+
excluded_hotkeys = []
|
3349
3393
|
|
3350
3394
|
return self._run_command(
|
3351
3395
|
stake.stake_add(
|
@@ -3354,8 +3398,8 @@ class CLIManager:
|
|
3354
3398
|
amount,
|
3355
3399
|
stake_all,
|
3356
3400
|
max_stake,
|
3357
|
-
|
3358
|
-
|
3401
|
+
included_hotkeys,
|
3402
|
+
excluded_hotkeys,
|
3359
3403
|
all_hotkeys,
|
3360
3404
|
prompt,
|
3361
3405
|
hotkey_ss58_address,
|
@@ -3442,9 +3486,9 @@ class CLIManager:
|
|
3442
3486
|
raise typer.Exit()
|
3443
3487
|
|
3444
3488
|
if not unstake_all and not amount and not keep_stake:
|
3445
|
-
amount = FloatPrompt.ask("
|
3489
|
+
amount = FloatPrompt.ask("Amount to [blue]unstake (TAO τ)[/blue]")
|
3446
3490
|
|
3447
|
-
if unstake_all and not amount:
|
3491
|
+
if unstake_all and not amount and prompt:
|
3448
3492
|
if not Confirm.ask("Unstake all staked TAO tokens?", default=False):
|
3449
3493
|
raise typer.Exit()
|
3450
3494
|
|
@@ -3460,7 +3504,7 @@ class CLIManager:
|
|
3460
3504
|
if is_valid_ss58_address(hotkey_or_ss58):
|
3461
3505
|
hotkey_ss58_address = hotkey_or_ss58
|
3462
3506
|
wallet = self.wallet_ask(
|
3463
|
-
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME
|
3507
|
+
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME]
|
3464
3508
|
)
|
3465
3509
|
else:
|
3466
3510
|
wallet_hotkey = hotkey_or_ss58
|
@@ -3468,13 +3512,13 @@ class CLIManager:
|
|
3468
3512
|
wallet_name,
|
3469
3513
|
wallet_path,
|
3470
3514
|
wallet_hotkey,
|
3471
|
-
ask_for=[WO.NAME, WO.
|
3515
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
3472
3516
|
validate=WV.WALLET_AND_HOTKEY,
|
3473
3517
|
)
|
3474
3518
|
|
3475
3519
|
elif all_hotkeys or include_hotkeys or exclude_hotkeys or hotkey_ss58_address:
|
3476
3520
|
wallet = self.wallet_ask(
|
3477
|
-
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME
|
3521
|
+
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME]
|
3478
3522
|
)
|
3479
3523
|
|
3480
3524
|
else:
|
@@ -3482,25 +3526,29 @@ class CLIManager:
|
|
3482
3526
|
wallet_name,
|
3483
3527
|
wallet_path,
|
3484
3528
|
wallet_hotkey,
|
3485
|
-
ask_for=[WO.NAME, WO.
|
3529
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
3486
3530
|
validate=WV.WALLET_AND_HOTKEY,
|
3487
3531
|
)
|
3488
3532
|
|
3489
3533
|
if include_hotkeys:
|
3490
|
-
|
3534
|
+
included_hotkeys = parse_to_list(
|
3491
3535
|
include_hotkeys,
|
3492
3536
|
str,
|
3493
|
-
"Hotkeys must be a comma-separated list of ss58s, e.g.,
|
3494
|
-
|
3537
|
+
"Hotkeys must be a comma-separated list of ss58s or hotkey names, e.g., "
|
3538
|
+
"`--include-hotkeys 5Grw....,5Grw....`.",
|
3495
3539
|
)
|
3540
|
+
else:
|
3541
|
+
included_hotkeys = []
|
3496
3542
|
|
3497
3543
|
if exclude_hotkeys:
|
3498
|
-
|
3544
|
+
excluded_hotkeys = parse_to_list(
|
3499
3545
|
exclude_hotkeys,
|
3500
3546
|
str,
|
3501
|
-
"Hotkeys must be a comma-separated list of ss58s, e.g.,
|
3502
|
-
|
3547
|
+
"Hotkeys must be a comma-separated list of ss58s or hotkey names, e.g., "
|
3548
|
+
"`--exclude-hotkeys 5Grw....,5Grw....`.",
|
3503
3549
|
)
|
3550
|
+
else:
|
3551
|
+
excluded_hotkeys = []
|
3504
3552
|
|
3505
3553
|
return self._run_command(
|
3506
3554
|
stake.unstake(
|
@@ -3508,8 +3556,8 @@ class CLIManager:
|
|
3508
3556
|
self.initialize_chain(network),
|
3509
3557
|
hotkey_ss58_address,
|
3510
3558
|
all_hotkeys,
|
3511
|
-
|
3512
|
-
|
3559
|
+
included_hotkeys,
|
3560
|
+
excluded_hotkeys,
|
3513
3561
|
amount,
|
3514
3562
|
keep_stake,
|
3515
3563
|
unstake_all,
|
@@ -3553,7 +3601,7 @@ class CLIManager:
|
|
3553
3601
|
wallet_name,
|
3554
3602
|
wallet_path,
|
3555
3603
|
wallet_hotkey,
|
3556
|
-
ask_for=[WO.NAME, WO.
|
3604
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
3557
3605
|
validate=WV.WALLET_AND_HOTKEY,
|
3558
3606
|
)
|
3559
3607
|
|
@@ -3608,6 +3656,7 @@ class CLIManager:
|
|
3608
3656
|
wait_for_finalization: bool = Options.wait_for_finalization,
|
3609
3657
|
quiet: bool = Options.quiet,
|
3610
3658
|
verbose: bool = Options.verbose,
|
3659
|
+
prompt: bool = Options.prompt,
|
3611
3660
|
):
|
3612
3661
|
"""
|
3613
3662
|
Set child hotkeys on specified subnets.
|
@@ -3654,7 +3703,7 @@ class CLIManager:
|
|
3654
3703
|
wallet_name,
|
3655
3704
|
wallet_path,
|
3656
3705
|
wallet_hotkey,
|
3657
|
-
ask_for=[WO.NAME, WO.
|
3706
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
3658
3707
|
validate=WV.WALLET_AND_HOTKEY,
|
3659
3708
|
)
|
3660
3709
|
return self._run_command(
|
@@ -3666,6 +3715,7 @@ class CLIManager:
|
|
3666
3715
|
proportions=proportions,
|
3667
3716
|
wait_for_finalization=wait_for_finalization,
|
3668
3717
|
wait_for_inclusion=wait_for_inclusion,
|
3718
|
+
prompt=prompt,
|
3669
3719
|
)
|
3670
3720
|
)
|
3671
3721
|
|
@@ -3691,6 +3741,7 @@ class CLIManager:
|
|
3691
3741
|
wait_for_finalization: bool = Options.wait_for_finalization,
|
3692
3742
|
quiet: bool = Options.quiet,
|
3693
3743
|
verbose: bool = Options.verbose,
|
3744
|
+
prompt: bool = Options.prompt,
|
3694
3745
|
):
|
3695
3746
|
"""
|
3696
3747
|
Remove all children hotkeys on a specified subnet.
|
@@ -3706,7 +3757,7 @@ class CLIManager:
|
|
3706
3757
|
wallet_name,
|
3707
3758
|
wallet_path,
|
3708
3759
|
wallet_hotkey,
|
3709
|
-
ask_for=[WO.NAME, WO.
|
3760
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
3710
3761
|
validate=WV.WALLET_AND_HOTKEY,
|
3711
3762
|
)
|
3712
3763
|
if all_netuids and netuid:
|
@@ -3725,6 +3776,7 @@ class CLIManager:
|
|
3725
3776
|
netuid,
|
3726
3777
|
wait_for_inclusion,
|
3727
3778
|
wait_for_finalization,
|
3779
|
+
prompt=prompt,
|
3728
3780
|
)
|
3729
3781
|
)
|
3730
3782
|
|
@@ -3780,7 +3832,7 @@ class CLIManager:
|
|
3780
3832
|
wallet_name,
|
3781
3833
|
wallet_path,
|
3782
3834
|
wallet_hotkey,
|
3783
|
-
ask_for=[WO.NAME, WO.
|
3835
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
3784
3836
|
validate=WV.WALLET_AND_HOTKEY,
|
3785
3837
|
)
|
3786
3838
|
if all_netuids and netuid:
|
@@ -3858,7 +3910,7 @@ class CLIManager:
|
|
3858
3910
|
)
|
3859
3911
|
|
3860
3912
|
wallet = self.wallet_ask(
|
3861
|
-
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME
|
3913
|
+
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME]
|
3862
3914
|
)
|
3863
3915
|
return self._run_command(
|
3864
3916
|
sudo.sudo_set_hyperparameter(
|
@@ -3959,7 +4011,6 @@ class CLIManager:
|
|
3959
4011
|
self,
|
3960
4012
|
wallet_name: str = Options.wallet_name,
|
3961
4013
|
wallet_path: str = Options.wallet_path,
|
3962
|
-
wallet_hotkey: str = Options.wallet_hotkey,
|
3963
4014
|
network: Optional[list[str]] = Options.network,
|
3964
4015
|
prompt: bool = Options.prompt,
|
3965
4016
|
quiet: bool = Options.quiet,
|
@@ -3976,9 +4027,9 @@ class CLIManager:
|
|
3976
4027
|
wallet = self.wallet_ask(
|
3977
4028
|
wallet_name,
|
3978
4029
|
wallet_path,
|
3979
|
-
|
3980
|
-
ask_for=[WO.NAME
|
3981
|
-
validate=WV.
|
4030
|
+
None,
|
4031
|
+
ask_for=[WO.NAME],
|
4032
|
+
validate=WV.WALLET,
|
3982
4033
|
)
|
3983
4034
|
return self._run_command(
|
3984
4035
|
subnets.create(wallet, self.initialize_chain(network), prompt)
|
@@ -4031,6 +4082,7 @@ class CLIManager:
|
|
4031
4082
|
"-tbp",
|
4032
4083
|
help="Set the number of threads per block for CUDA.",
|
4033
4084
|
),
|
4085
|
+
prompt: bool = Options.prompt,
|
4034
4086
|
):
|
4035
4087
|
"""
|
4036
4088
|
Register a neuron (a subnet validator or a subnet miner) using Proof of Work (POW).
|
@@ -4056,7 +4108,7 @@ class CLIManager:
|
|
4056
4108
|
wallet_name,
|
4057
4109
|
wallet_path,
|
4058
4110
|
wallet_hotkey,
|
4059
|
-
ask_for=[WO.NAME, WO.
|
4111
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
4060
4112
|
validate=WV.WALLET_AND_HOTKEY,
|
4061
4113
|
),
|
4062
4114
|
self.initialize_chain(network),
|
@@ -4068,6 +4120,7 @@ class CLIManager:
|
|
4068
4120
|
use_cuda,
|
4069
4121
|
dev_id,
|
4070
4122
|
threads_per_block,
|
4123
|
+
prompt=prompt,
|
4071
4124
|
)
|
4072
4125
|
)
|
4073
4126
|
|
@@ -4098,7 +4151,7 @@ class CLIManager:
|
|
4098
4151
|
wallet_name,
|
4099
4152
|
wallet_path,
|
4100
4153
|
wallet_hotkey,
|
4101
|
-
ask_for=[WO.NAME, WO.
|
4154
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
4102
4155
|
validate=WV.WALLET_AND_HOTKEY,
|
4103
4156
|
)
|
4104
4157
|
return self._run_command(
|
@@ -4227,6 +4280,7 @@ class CLIManager:
|
|
4227
4280
|
),
|
4228
4281
|
quiet: bool = Options.quiet,
|
4229
4282
|
verbose: bool = Options.verbose,
|
4283
|
+
prompt: bool = Options.prompt,
|
4230
4284
|
):
|
4231
4285
|
"""
|
4232
4286
|
Reveal weights for a specific subnet.
|
@@ -4285,7 +4339,7 @@ class CLIManager:
|
|
4285
4339
|
wallet_name,
|
4286
4340
|
wallet_path,
|
4287
4341
|
wallet_hotkey,
|
4288
|
-
ask_for=[WO.NAME, WO.
|
4342
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
4289
4343
|
validate=WV.WALLET_AND_HOTKEY,
|
4290
4344
|
)
|
4291
4345
|
|
@@ -4298,6 +4352,7 @@ class CLIManager:
|
|
4298
4352
|
weights,
|
4299
4353
|
salt,
|
4300
4354
|
__version_as_int__,
|
4355
|
+
prompt=prompt,
|
4301
4356
|
)
|
4302
4357
|
)
|
4303
4358
|
|
@@ -4323,6 +4378,7 @@ class CLIManager:
|
|
4323
4378
|
),
|
4324
4379
|
quiet: bool = Options.quiet,
|
4325
4380
|
verbose: bool = Options.verbose,
|
4381
|
+
prompt: bool = Options.prompt,
|
4326
4382
|
):
|
4327
4383
|
"""
|
4328
4384
|
|
@@ -4381,7 +4437,7 @@ class CLIManager:
|
|
4381
4437
|
wallet_name,
|
4382
4438
|
wallet_path,
|
4383
4439
|
wallet_hotkey,
|
4384
|
-
ask_for=[WO.NAME, WO.
|
4440
|
+
ask_for=[WO.NAME, WO.HOTKEY],
|
4385
4441
|
validate=WV.WALLET_AND_HOTKEY,
|
4386
4442
|
)
|
4387
4443
|
return self._run_command(
|
@@ -4393,6 +4449,7 @@ class CLIManager:
|
|
4393
4449
|
weights,
|
4394
4450
|
salt,
|
4395
4451
|
__version_as_int__,
|
4452
|
+
prompt=prompt,
|
4396
4453
|
)
|
4397
4454
|
)
|
4398
4455
|
|