bittensor-cli 9.22.2__tar.gz → 9.23.0__tar.gz

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.
Files changed (74) hide show
  1. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/PKG-INFO +3 -4
  2. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/cli.py +121 -405
  3. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/__init__.py +40 -19
  4. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/extrinsics/registration.py +1 -1
  5. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/subtensor_interface.py +126 -22
  6. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/utils.py +3 -0
  7. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/stake/children_hotkeys.py +14 -4
  8. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/subnets/subnets.py +124 -122
  9. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/sudo.py +137 -12
  10. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/wallets.py +32 -4
  11. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/weights.py +30 -1
  12. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/pyproject.toml +3 -4
  13. bittensor_cli-9.22.2/bittensor_cli/src/commands/liquidity/liquidity.py +0 -696
  14. bittensor_cli-9.22.2/bittensor_cli/src/commands/liquidity/utils.py +0 -202
  15. bittensor_cli-9.22.2/bittensor_cli/src/commands/subnets/__init__.py +0 -0
  16. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/README.md +0 -0
  17. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/__init__.py +0 -0
  18. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/doc_generation_helper.py +0 -0
  19. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/__init__.py +0 -0
  20. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/balances.py +0 -0
  21. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/chain_data.py +0 -0
  22. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/extrinsics/__init__.py +0 -0
  23. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/extrinsics/mev_shield.py +0 -0
  24. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/extrinsics/root.py +0 -0
  25. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/extrinsics/serving.py +0 -0
  26. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/extrinsics/transfer.py +0 -0
  27. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/locks.py +0 -0
  28. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/minigraph.py +0 -0
  29. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/networking.py +0 -0
  30. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/main-filters.j2 +0 -0
  31. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/main-header.j2 +0 -0
  32. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/neuron-details.j2 +0 -0
  33. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/price-multi.j2 +0 -0
  34. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/price-single.j2 +0 -0
  35. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/subnet-details-header.j2 +0 -0
  36. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/subnet-details.j2 +0 -0
  37. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/subnet-metrics.j2 +0 -0
  38. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/subnets-table.j2 +0 -0
  39. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/table.j2 +0 -0
  40. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/view.css +0 -0
  41. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/view.j2 +0 -0
  42. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/bittensor/templates/view.js +0 -0
  43. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/__init__.py +0 -0
  44. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/axon/__init__.py +0 -0
  45. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/axon/axon.py +0 -0
  46. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/crowd/__init__.py +0 -0
  47. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/crowd/contribute.py +0 -0
  48. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/crowd/contributors.py +0 -0
  49. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/crowd/create.py +0 -0
  50. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/crowd/dissolve.py +0 -0
  51. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/crowd/refund.py +0 -0
  52. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/crowd/update.py +0 -0
  53. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/crowd/utils.py +0 -0
  54. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/crowd/view.py +0 -0
  55. {bittensor_cli-9.22.2/bittensor_cli/src/commands/liquidity → bittensor_cli-9.23.0/bittensor_cli/src/commands/lock}/__init__.py +0 -0
  56. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/lock/add.py +0 -0
  57. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/lock/common.py +0 -0
  58. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/lock/list.py +0 -0
  59. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/lock/mode.py +0 -0
  60. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/lock/move.py +0 -0
  61. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/proxy.py +0 -0
  62. {bittensor_cli-9.22.2/bittensor_cli/src/commands/lock → bittensor_cli-9.23.0/bittensor_cli/src/commands/stake}/__init__.py +0 -0
  63. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/stake/add.py +0 -0
  64. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/stake/auto_staking.py +0 -0
  65. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/stake/claim.py +0 -0
  66. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/stake/list.py +0 -0
  67. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/stake/move.py +0 -0
  68. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/stake/remove.py +0 -0
  69. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/stake/wizard.py +0 -0
  70. {bittensor_cli-9.22.2/bittensor_cli/src/commands/stake → bittensor_cli-9.23.0/bittensor_cli/src/commands/subnets}/__init__.py +0 -0
  71. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/subnets/mechanisms.py +0 -0
  72. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/subnets/price.py +0 -0
  73. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/src/commands/view.py +0 -0
  74. {bittensor_cli-9.22.2 → bittensor_cli-9.23.0}/bittensor_cli/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bittensor-cli
3
- Version: 9.22.2
3
+ Version: 9.23.0
4
4
  Summary: Bittensor CLI
5
5
  Author: bittensor.com
6
6
  Requires-Python: >=3.10
@@ -18,16 +18,15 @@ Classifier: Topic :: Scientific/Engineering
18
18
  Classifier: Topic :: Scientific/Engineering :: Mathematics
19
19
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
20
  Classifier: Topic :: Utilities
21
- Requires-Dist: wheel>0.46.1
22
21
  Requires-Dist: async-substrate-interface>=2.0.4,<3.0.0
23
22
  Requires-Dist: aiohttp~=3.13
24
- Requires-Dist: bittensor-drand>=1.3.0
23
+ Requires-Dist: bittensor-drand>=1.3.0,<2.0.0
25
24
  Requires-Dist: GitPython>=3.0.0
26
25
  Requires-Dist: netaddr~=1.3.0
27
26
  Requires-Dist: Jinja2
28
27
  Requires-Dist: PyYAML~=6.0
29
28
  Requires-Dist: rich>=15.0,<16.0
30
- Requires-Dist: cyscale==0.4.0
29
+ Requires-Dist: cyscale==0.5.0
31
30
  Requires-Dist: typer~=0.26.0
32
31
  Requires-Dist: typing_extensions>4.0.0; python_version<'3.11'
33
32
  Requires-Dist: bittensor-wallet==4.1.0
@@ -77,7 +77,6 @@ from bittensor_cli.src.bittensor.utils import (
77
77
  )
78
78
  from bittensor_cli.src.commands import sudo, wallets, view
79
79
  from bittensor_cli.src.commands import weights as weights_cmds
80
- from bittensor_cli.src.commands.liquidity import liquidity
81
80
  from bittensor_cli.src.commands.crowd import (
82
81
  contribute as crowd_contribute,
83
82
  create as create_crowdloan,
@@ -87,10 +86,6 @@ from bittensor_cli.src.commands.crowd import (
87
86
  refund as crowd_refund,
88
87
  contributors as crowd_contributors,
89
88
  )
90
- from bittensor_cli.src.commands.liquidity.utils import (
91
- prompt_liquidity,
92
- prompt_position_id,
93
- )
94
89
  from bittensor_cli.src.commands import proxy as proxy_commands
95
90
  from bittensor_cli.src.commands.proxy import ProxyType
96
91
  from bittensor_cli.src.commands.stake import (
@@ -884,7 +879,6 @@ class CLIManager:
884
879
  self.subnet_mechanisms_app = typer.Typer(epilog=_epilog)
885
880
  self.weights_app = typer.Typer(epilog=_epilog)
886
881
  self.view_app = typer.Typer(epilog=_epilog)
887
- self.liquidity_app = typer.Typer(epilog=_epilog)
888
882
  self.crowd_app = typer.Typer(epilog=_epilog)
889
883
  self.utils_app = typer.Typer(epilog=_epilog)
890
884
  self.axon_app = typer.Typer(epilog=_epilog)
@@ -1204,6 +1198,9 @@ class CLIManager:
1204
1198
  self.sudo_app.command("trim", rich_help_panel=HELP_PANELS["SUDO"]["CONFIG"])(
1205
1199
  self.sudo_trim
1206
1200
  )
1201
+ self.sudo_app.command(
1202
+ "trigger-epoch", rich_help_panel=HELP_PANELS["SUDO"]["CONFIG"]
1203
+ )(self.sudo_trigger_epoch)
1207
1204
  self.sudo_app.command(
1208
1205
  "stake-burn", rich_help_panel=HELP_PANELS["SUDO"]["CONFIG"]
1209
1206
  )(self.sudo_stake_burn)
@@ -1394,30 +1391,6 @@ class CLIManager:
1394
1391
  "dissolve", rich_help_panel=HELP_PANELS["CROWD"]["INITIATOR"]
1395
1392
  )(self.crowd_dissolve)
1396
1393
 
1397
- # Liquidity
1398
- self.app.add_typer(
1399
- self.liquidity_app,
1400
- name="liquidity",
1401
- short_help="liquidity commands, aliases: `l`",
1402
- no_args_is_help=True,
1403
- )
1404
- self.app.add_typer(
1405
- self.liquidity_app, name="l", hidden=True, no_args_is_help=True
1406
- )
1407
- # liquidity commands
1408
- self.liquidity_app.command(
1409
- "add", rich_help_panel=HELP_PANELS["LIQUIDITY"]["LIQUIDITY_MGMT"]
1410
- )(self.liquidity_add)
1411
- self.liquidity_app.command(
1412
- "list", rich_help_panel=HELP_PANELS["LIQUIDITY"]["LIQUIDITY_MGMT"]
1413
- )(self.liquidity_list)
1414
- self.liquidity_app.command(
1415
- "modify", rich_help_panel=HELP_PANELS["LIQUIDITY"]["LIQUIDITY_MGMT"]
1416
- )(self.liquidity_modify)
1417
- self.liquidity_app.command(
1418
- "remove", rich_help_panel=HELP_PANELS["LIQUIDITY"]["LIQUIDITY_MGMT"]
1419
- )(self.liquidity_remove)
1420
-
1421
1394
  # utils app
1422
1395
  self.utils_app.command("convert")(self.convert)
1423
1396
  self.utils_app.command("latency")(self.best_connection)
@@ -2616,6 +2589,11 @@ class CLIManager:
2616
2589
  self,
2617
2590
  wallet_name: Optional[str] = Options.wallet_name,
2618
2591
  wallet_path: str = Options.wallet_path,
2592
+ coldkeys_only: bool = typer.Option(
2593
+ False,
2594
+ "--coldkeys-only",
2595
+ help="List coldkeys only; omit hotkeys from the output.",
2596
+ ),
2619
2597
  quiet: bool = Options.quiet,
2620
2598
  verbose: bool = Options.verbose,
2621
2599
  json_output: bool = Options.json_output,
@@ -2626,11 +2604,13 @@ class CLIManager:
2626
2604
  The output display shows each wallet and its associated `ss58` addresses for the coldkey public key and any hotkeys. The output is presented in a hierarchical tree format, with each wallet as a root node and any associated hotkeys as child nodes. The `ss58` address (or an `<ENCRYPTED>` marker, for encrypted hotkeys) is displayed for each coldkey and hotkey that exists on the device.
2627
2605
 
2628
2606
  Upon invocation, the command scans the wallet directory and prints a list of all the wallets, indicating whether the
2629
- public keys are available (`?` denotes unavailable or encrypted keys).
2607
+ public keys are available (`?` denotes unavailable or encrypted keys). Coldkeys and hotkeys are listed in natural
2608
+ sort order (e.g. coldkey2 before coldkey10).
2630
2609
 
2631
2610
  # EXAMPLE
2632
2611
 
2633
2612
  [green]$[/green] btcli wallet list --path ~/.bittensor
2613
+ [green]$[/green] btcli w list --coldkeys-only
2634
2614
 
2635
2615
  [bold]NOTE[/bold]: This command is read-only and does not modify the filesystem or the blockchain state. It is intended for use with the Bittensor CLI to provide a quick overview of the user's wallets.
2636
2616
  """
@@ -2643,6 +2623,7 @@ class CLIManager:
2643
2623
  wallet.path,
2644
2624
  json_output,
2645
2625
  wallet_name=wallet_name,
2626
+ coldkeys_only=coldkeys_only,
2646
2627
  )
2647
2628
  )
2648
2629
 
@@ -7351,7 +7332,6 @@ class CLIManager:
7351
7332
  console.print("Available hyperparameters:\n")
7352
7333
 
7353
7334
  # Create a table to show hyperparameters with descriptions
7354
-
7355
7335
  param_table = Table(
7356
7336
  Column("[white]#", style="dim", width=4),
7357
7337
  Column("[white]HYPERPARAMETER", style=COLORS.SU.HYPERPARAMETER),
@@ -7399,19 +7379,13 @@ class CLIManager:
7399
7379
  description = metadata.get("description", "No description available.")
7400
7380
  docs_link = metadata.get("docs_link", "")
7401
7381
  if docs_link:
7402
- # Show description text followed by clickable blue [link] at the end
7403
7382
  console.print(
7404
7383
  f"{description} [bright_blue underline link=https://{docs_link}]link[/]"
7405
7384
  )
7406
7385
  else:
7407
7386
  console.print(f"{description}")
7408
- side_effects = metadata.get("side_effects", "")
7409
- if side_effects:
7387
+ if side_effects := metadata.get("side_effects", ""):
7410
7388
  console.print(f"[dim]Side Effects:[/dim] {side_effects}")
7411
- if docs_link:
7412
- console.print(
7413
- f"[dim]📚 Docs:[/dim] [link]https://{docs_link}[/link]\n"
7414
- )
7415
7389
 
7416
7390
  if param_name in ["alpha_high", "alpha_low"]:
7417
7391
  if not prompt:
@@ -7420,16 +7394,13 @@ class CLIManager:
7420
7394
  "They must be set together via the alpha_values parameter."
7421
7395
  )
7422
7396
  if json_output:
7423
- json_str = json.dumps(
7424
- {
7397
+ json_console.print_json(
7398
+ data={
7425
7399
  "success": False,
7426
7400
  "err_msg": err_msg,
7427
7401
  "extrinsic_identifier": None,
7428
- },
7429
- ensure_ascii=True,
7402
+ }
7430
7403
  )
7431
- sys.stdout.write(json_str + "\n")
7432
- sys.stdout.flush()
7433
7404
  else:
7434
7405
  print_error(
7435
7406
  f"[{COLORS.SU.HYPERPARAM}]alpha_high[/{COLORS.SU.HYPERPARAM}] and "
@@ -7441,23 +7412,20 @@ class CLIManager:
7441
7412
  low_val = FloatPrompt.ask(f"Enter the new value for {arg__('alpha_low')}")
7442
7413
  high_val = FloatPrompt.ask(f"Enter the new value for {arg__('alpha_high')}")
7443
7414
  param_value = f"{low_val},{high_val}"
7444
- if param_name == "yuma_version":
7415
+ elif param_name == "yuma_version":
7445
7416
  if not prompt:
7446
7417
  err_msg = (
7447
7418
  "yuma_version is set using a different hyperparameter (yuma3_enabled), "
7448
7419
  "and thus cannot be set with `--no-prompt`"
7449
7420
  )
7450
7421
  if json_output:
7451
- json_str = json.dumps(
7452
- {
7422
+ json_console.print_json(
7423
+ data={
7453
7424
  "success": False,
7454
7425
  "err_msg": err_msg,
7455
7426
  "extrinsic_identifier": None,
7456
- },
7457
- ensure_ascii=True,
7427
+ }
7458
7428
  )
7459
- sys.stdout.write(json_str + "\n")
7460
- sys.stdout.flush()
7461
7429
  else:
7462
7430
  print_error(
7463
7431
  f"[{COLORS.SU.HYPERPARAM}]yuma_version[/{COLORS.SU.HYPERPARAM}]"
@@ -7478,22 +7446,45 @@ class CLIManager:
7478
7446
  param_value = "true" if question == "enable" else "false"
7479
7447
  else:
7480
7448
  return False
7449
+ elif param_name == "activity_cutoff":
7450
+ err_msg = (
7451
+ "activity_cutoff is now derived from activity_cutoff_factor "
7452
+ "(cutoff blocks = factor × tempo ÷ 1000) and can no longer be set "
7453
+ "directly. Set activity_cutoff_factor instead (per-mille units; "
7454
+ "1000 = one full tempo)."
7455
+ )
7456
+ if json_output:
7457
+ json_console.print_json(
7458
+ data={
7459
+ "success": False,
7460
+ "err_msg": err_msg,
7461
+ "extrinsic_identifier": None,
7462
+ }
7463
+ )
7464
+ else:
7465
+ print_error(
7466
+ f"[{COLORS.SU.HYPERPARAM}]activity_cutoff[/{COLORS.SU.HYPERPARAM}] "
7467
+ f"is now derived from "
7468
+ f"[{COLORS.SU.HYPERPARAM}]activity_cutoff_factor[/{COLORS.SU.HYPERPARAM}] "
7469
+ f"(cutoff blocks = factor × tempo ÷ 1000). Set "
7470
+ f"[{COLORS.SU.HYPERPARAM}]activity_cutoff_factor[/{COLORS.SU.HYPERPARAM}] "
7471
+ f"instead (per-mille units; 1000 = one full tempo)."
7472
+ )
7473
+ return False
7474
+
7481
7475
  if param_name == "subnet_is_active":
7482
7476
  err_msg = (
7483
7477
  "subnet_is_active is set by using the 'btcli subnets start' command, "
7484
7478
  "not via sudo set"
7485
7479
  )
7486
7480
  if json_output:
7487
- json_str = json.dumps(
7488
- {
7481
+ json_console.print_json(
7482
+ data={
7489
7483
  "success": False,
7490
7484
  "err_msg": err_msg,
7491
7485
  "extrinsic_identifier": None,
7492
- },
7493
- ensure_ascii=True,
7486
+ }
7494
7487
  )
7495
- sys.stdout.write(json_str + "\n")
7496
- sys.stdout.flush()
7497
7488
  else:
7498
7489
  print_error(
7499
7490
  f"[{COLORS.SU.HYPERPARAM}]subnet_is_active[/{COLORS.SU.HYPERPARAM}] "
@@ -7528,60 +7519,29 @@ class CLIManager:
7528
7519
  f"param_name: {param_name}\n"
7529
7520
  f"param_value: {param_value}"
7530
7521
  )
7522
+
7523
+ result, err_msg, ext_id = self._run_command(
7524
+ sudo.sudo_set_hyperparameter(
7525
+ wallet=wallet,
7526
+ subtensor=self.initialize_chain(network),
7527
+ netuid=netuid,
7528
+ proxy=proxy,
7529
+ param_name=param_name,
7530
+ param_value=param_value,
7531
+ normalize=normalize_value,
7532
+ prompt=prompt,
7533
+ json_output=json_output,
7534
+ )
7535
+ )
7531
7536
  if json_output:
7532
- try:
7533
- result, err_msg, ext_id = self._run_command(
7534
- sudo.sudo_set_hyperparameter(
7535
- wallet=wallet,
7536
- subtensor=self.initialize_chain(network),
7537
- netuid=netuid,
7538
- proxy=proxy,
7539
- param_name=param_name,
7540
- param_value=param_value,
7541
- normalize=normalize_value,
7542
- prompt=prompt,
7543
- json_output=json_output,
7544
- )
7545
- )
7546
- json_str = json.dumps(
7547
- {
7548
- "success": result,
7549
- "err_msg": err_msg,
7550
- "extrinsic_identifier": ext_id,
7551
- },
7552
- ensure_ascii=True,
7553
- )
7554
- sys.stdout.write(json_str + "\n")
7555
- sys.stdout.flush()
7556
- return result
7557
- except Exception as e:
7558
- # Ensure JSON output even on exceptions
7559
- json_str = json.dumps(
7560
- {
7561
- "success": False,
7562
- "err_msg": str(e),
7563
- "extrinsic_identifier": None,
7564
- },
7565
- ensure_ascii=True,
7566
- )
7567
- sys.stdout.write(json_str + "\n")
7568
- sys.stdout.flush()
7569
- raise
7570
- else:
7571
- result, err_msg, ext_id = self._run_command(
7572
- sudo.sudo_set_hyperparameter(
7573
- wallet=wallet,
7574
- subtensor=self.initialize_chain(network),
7575
- netuid=netuid,
7576
- proxy=proxy,
7577
- param_name=param_name,
7578
- param_value=param_value,
7579
- normalize=normalize_value,
7580
- prompt=prompt,
7581
- json_output=json_output,
7582
- )
7537
+ json_console.print_json(
7538
+ data={
7539
+ "success": result,
7540
+ "err_msg": err_msg,
7541
+ "extrinsic_identifier": ext_id,
7542
+ }
7583
7543
  )
7584
- return result
7544
+ return result
7585
7545
 
7586
7546
  def sudo_get(
7587
7547
  self,
@@ -7860,6 +7820,57 @@ class CLIManager:
7860
7820
  )
7861
7821
  )
7862
7822
 
7823
+ def sudo_trigger_epoch(
7824
+ self,
7825
+ network: Optional[list[str]] = Options.network,
7826
+ wallet_name: Optional[str] = Options.wallet_name,
7827
+ wallet_path: Optional[str] = Options.wallet_path,
7828
+ wallet_hotkey: Optional[str] = Options.wallet_hotkey,
7829
+ netuid: int = Options.netuid,
7830
+ proxy: Optional[str] = Options.proxy,
7831
+ quiet: bool = Options.quiet,
7832
+ verbose: bool = Options.verbose,
7833
+ json_output: bool = Options.json_output,
7834
+ prompt: bool = Options.prompt,
7835
+ decline: bool = Options.decline,
7836
+ period: int = Options.period,
7837
+ ):
7838
+ """
7839
+ Manually triggers an epoch for a subnet you own.
7840
+
7841
+ The epoch fires after the chain's admin freeze window has elapsed, during which
7842
+ admin operations on the subnet are locked. This is rate-limited on-chain and
7843
+ fails if a trigger is already pending, the next automatic epoch is imminent, or
7844
+ commit-reveal is enabled on the subnet (disable it first via
7845
+ 'btcli sudo set --param commit_reveal_weights_enabled --value false').
7846
+
7847
+ EXAMPLE
7848
+ [green]$[/green] btcli sudo trigger-epoch --netuid 95 --wallet-name my_wallet --wallet-hotkey my_hotkey
7849
+ """
7850
+ self.verbosity_handler(quiet, verbose, json_output, prompt)
7851
+ proxy = self.is_valid_proxy_name_or_ss58(proxy, False)
7852
+
7853
+ wallet = self.wallet_ask(
7854
+ wallet_name,
7855
+ wallet_path,
7856
+ wallet_hotkey,
7857
+ ask_for=[WO.NAME, WO.PATH],
7858
+ validate=WV.WALLET,
7859
+ )
7860
+ self._run_command(
7861
+ sudo.trigger_epoch(
7862
+ subtensor=self.initialize_chain(network),
7863
+ wallet=wallet,
7864
+ netuid=netuid,
7865
+ period=period,
7866
+ proxy=proxy,
7867
+ json_output=json_output,
7868
+ prompt=prompt,
7869
+ decline=decline,
7870
+ quiet=quiet,
7871
+ )
7872
+ )
7873
+
7863
7874
  def sudo_stake_burn(
7864
7875
  self,
7865
7876
  network: Optional[list[str]] = Options.network,
@@ -9060,301 +9071,6 @@ class CLIManager:
9060
9071
  )
9061
9072
  )
9062
9073
 
9063
- # Liquidity
9064
-
9065
- def liquidity_add(
9066
- self,
9067
- network: Optional[list[str]] = Options.network,
9068
- wallet_name: str = Options.wallet_name,
9069
- wallet_path: str = Options.wallet_path,
9070
- wallet_hotkey: str = Options.wallet_hotkey,
9071
- netuid: Optional[int] = Options.netuid,
9072
- proxy: Optional[str] = Options.proxy,
9073
- liquidity_: Optional[float] = typer.Option(
9074
- None,
9075
- "--liquidity",
9076
- help="Amount of liquidity to add to the subnet.",
9077
- ),
9078
- price_low: Optional[float] = typer.Option(
9079
- None,
9080
- "--price-low",
9081
- "--price_low",
9082
- "--liquidity-price-low",
9083
- "--liquidity_price_low",
9084
- help="Low price for the adding liquidity position.",
9085
- ),
9086
- price_high: Optional[float] = typer.Option(
9087
- None,
9088
- "--price-high",
9089
- "--price_high",
9090
- "--liquidity-price-high",
9091
- "--liquidity_price_high",
9092
- help="High price for the adding liquidity position.",
9093
- ),
9094
- prompt: bool = Options.prompt,
9095
- decline: bool = Options.decline,
9096
- quiet: bool = Options.quiet,
9097
- verbose: bool = Options.verbose,
9098
- json_output: bool = Options.json_output,
9099
- ):
9100
- """Add liquidity to the swap (as a combination of TAO + Alpha)."""
9101
- self.verbosity_handler(quiet, verbose, json_output, prompt, decline)
9102
- proxy = self.is_valid_proxy_name_or_ss58(proxy, False)
9103
- if not netuid:
9104
- netuid = Prompt.ask(
9105
- f"Enter the [{COLORS.G.SUBHEAD_MAIN}]netuid[/{COLORS.G.SUBHEAD_MAIN}] to use",
9106
- default=None,
9107
- show_default=False,
9108
- )
9109
-
9110
- wallet, hotkey = self.wallet_ask(
9111
- wallet_name=wallet_name,
9112
- wallet_path=wallet_path,
9113
- wallet_hotkey=wallet_hotkey,
9114
- ask_for=[WO.NAME, WO.HOTKEY, WO.PATH],
9115
- validate=WV.WALLET,
9116
- return_wallet_and_hotkey=True,
9117
- )
9118
- # Determine the liquidity amount.
9119
- if liquidity_:
9120
- liquidity_ = Balance.from_tao(liquidity_)
9121
- else:
9122
- liquidity_ = prompt_liquidity("Enter the amount of liquidity")
9123
-
9124
- # Determine price range
9125
- if price_low:
9126
- price_low = Balance.from_tao(price_low)
9127
- else:
9128
- price_low = prompt_liquidity("Enter liquidity position low price")
9129
-
9130
- if price_high:
9131
- price_high = Balance.from_tao(price_high)
9132
- else:
9133
- price_high = prompt_liquidity(
9134
- "Enter liquidity position high price (must be greater than low price)"
9135
- )
9136
-
9137
- if price_low >= price_high:
9138
- print_error("The low price must be lower than the high price.")
9139
- return False
9140
- logger.debug(
9141
- f"args:\n"
9142
- f"hotkey: {type(hotkey)}\n"
9143
- f"netuid: {netuid}\n"
9144
- f"liquidity: {liquidity_}\n"
9145
- f"price_low: {price_low}\n"
9146
- f"price_high: {price_high}\n"
9147
- f"proxy: {type(proxy)}\n"
9148
- )
9149
- return self._run_command(
9150
- liquidity.add_liquidity(
9151
- subtensor=self.initialize_chain(network),
9152
- wallet=wallet,
9153
- hotkey_ss58=hotkey,
9154
- netuid=netuid,
9155
- proxy=proxy,
9156
- liquidity=liquidity_,
9157
- price_low=price_low,
9158
- price_high=price_high,
9159
- prompt=prompt,
9160
- decline=decline,
9161
- quiet=quiet,
9162
- json_output=json_output,
9163
- )
9164
- )
9165
-
9166
- def liquidity_list(
9167
- self,
9168
- network: Optional[list[str]] = Options.network,
9169
- wallet_name: str = Options.wallet_name,
9170
- wallet_path: str = Options.wallet_path,
9171
- wallet_hotkey: str = Options.wallet_hotkey,
9172
- netuid: Optional[int] = Options.netuid,
9173
- quiet: bool = Options.quiet,
9174
- verbose: bool = Options.verbose,
9175
- json_output: bool = Options.json_output,
9176
- ):
9177
- """Displays liquidity positions in given subnet."""
9178
- self.verbosity_handler(quiet, verbose, json_output, prompt=False)
9179
- if not netuid:
9180
- netuid = IntPrompt.ask(
9181
- f"Enter the [{COLORS.G.SUBHEAD_MAIN}]netuid[/{COLORS.G.SUBHEAD_MAIN}] to use",
9182
- default=None,
9183
- show_default=False,
9184
- )
9185
-
9186
- wallet = self.wallet_ask(
9187
- wallet_name=wallet_name,
9188
- wallet_path=wallet_path,
9189
- wallet_hotkey=wallet_hotkey,
9190
- ask_for=[WO.NAME, WO.PATH],
9191
- validate=WV.WALLET,
9192
- )
9193
- self._run_command(
9194
- liquidity.show_liquidity_list(
9195
- subtensor=self.initialize_chain(network),
9196
- wallet=wallet,
9197
- netuid=netuid,
9198
- json_output=json_output,
9199
- )
9200
- )
9201
-
9202
- def liquidity_remove(
9203
- self,
9204
- network: Optional[list[str]] = Options.network,
9205
- wallet_name: str = Options.wallet_name,
9206
- wallet_path: str = Options.wallet_path,
9207
- wallet_hotkey: str = Options.wallet_hotkey,
9208
- netuid: Optional[int] = Options.netuid,
9209
- proxy: Optional[str] = Options.proxy,
9210
- position_id: Optional[int] = typer.Option(
9211
- None,
9212
- "--position-id",
9213
- "--position_id",
9214
- help="Position ID for modification or removal.",
9215
- ),
9216
- all_liquidity_ids: Optional[bool] = typer.Option(
9217
- False,
9218
- "--all",
9219
- "--a",
9220
- help="Whether to remove all liquidity positions for given subnet.",
9221
- ),
9222
- prompt: bool = Options.prompt,
9223
- decline: bool = Options.decline,
9224
- quiet: bool = Options.quiet,
9225
- verbose: bool = Options.verbose,
9226
- json_output: bool = Options.json_output,
9227
- ):
9228
- """Remove liquidity from the swap (as a combination of TAO + Alpha)."""
9229
-
9230
- self.verbosity_handler(quiet, verbose, json_output, prompt, decline)
9231
- proxy = self.is_valid_proxy_name_or_ss58(proxy, False)
9232
- if all_liquidity_ids and position_id:
9233
- print_error("Cannot specify both --all and --position-id.")
9234
- return
9235
-
9236
- if not position_id and not all_liquidity_ids:
9237
- position_id = prompt_position_id()
9238
-
9239
- if not netuid:
9240
- netuid = IntPrompt.ask(
9241
- f"Enter the [{COLORS.G.SUBHEAD_MAIN}]netuid[/{COLORS.G.SUBHEAD_MAIN}] to use",
9242
- default=None,
9243
- show_default=False,
9244
- )
9245
-
9246
- wallet, hotkey = self.wallet_ask(
9247
- wallet_name=wallet_name,
9248
- wallet_path=wallet_path,
9249
- wallet_hotkey=wallet_hotkey,
9250
- ask_for=[WO.NAME, WO.HOTKEY, WO.PATH],
9251
- validate=WV.WALLET,
9252
- return_wallet_and_hotkey=True,
9253
- )
9254
- logger.debug(
9255
- f"args:\n"
9256
- f"network: {network}\n"
9257
- f"hotkey: {type(hotkey)}\n"
9258
- f"netuid: {netuid}\n"
9259
- f"position_id: {position_id}\n"
9260
- f"all_liquidity_ids: {all_liquidity_ids}\n"
9261
- )
9262
- return self._run_command(
9263
- liquidity.remove_liquidity(
9264
- subtensor=self.initialize_chain(network),
9265
- wallet=wallet,
9266
- hotkey_ss58=hotkey,
9267
- netuid=netuid,
9268
- proxy=proxy,
9269
- position_id=position_id,
9270
- prompt=prompt,
9271
- decline=decline,
9272
- quiet=quiet,
9273
- all_liquidity_ids=all_liquidity_ids,
9274
- json_output=json_output,
9275
- )
9276
- )
9277
-
9278
- def liquidity_modify(
9279
- self,
9280
- network: Optional[list[str]] = Options.network,
9281
- wallet_name: str = Options.wallet_name,
9282
- wallet_path: str = Options.wallet_path,
9283
- wallet_hotkey: str = Options.wallet_hotkey,
9284
- netuid: Optional[int] = Options.netuid,
9285
- proxy: Optional[str] = Options.proxy,
9286
- position_id: Optional[int] = typer.Option(
9287
- None,
9288
- "--position-id",
9289
- "--position_id",
9290
- help="Position ID for modification or removing.",
9291
- ),
9292
- liquidity_delta: Optional[float] = typer.Option(
9293
- None,
9294
- "--liquidity-delta",
9295
- "--liquidity_delta",
9296
- help="Liquidity amount for modification.",
9297
- ),
9298
- prompt: bool = Options.prompt,
9299
- decline: bool = Options.decline,
9300
- quiet: bool = Options.quiet,
9301
- verbose: bool = Options.verbose,
9302
- json_output: bool = Options.json_output,
9303
- ):
9304
- """Modifies the liquidity position for the given subnet."""
9305
- self.verbosity_handler(quiet, verbose, json_output, prompt, decline)
9306
- proxy = self.is_valid_proxy_name_or_ss58(proxy, False)
9307
- if not netuid:
9308
- netuid = IntPrompt.ask(
9309
- f"Enter the [{COLORS.G.SUBHEAD_MAIN}]netuid[/{COLORS.G.SUBHEAD_MAIN}] to use",
9310
- )
9311
-
9312
- wallet, hotkey = self.wallet_ask(
9313
- wallet_name=wallet_name,
9314
- wallet_path=wallet_path,
9315
- wallet_hotkey=wallet_hotkey,
9316
- ask_for=[WO.NAME, WO.HOTKEY, WO.PATH],
9317
- validate=WV.WALLET,
9318
- return_wallet_and_hotkey=True,
9319
- )
9320
-
9321
- if not position_id:
9322
- position_id = prompt_position_id()
9323
-
9324
- if liquidity_delta:
9325
- liquidity_delta = Balance.from_tao(liquidity_delta)
9326
- else:
9327
- liquidity_delta = prompt_liquidity(
9328
- f"Enter the [blue]liquidity delta[/blue] to modify position with id "
9329
- f"[blue]{position_id}[/blue] (can be positive or negative)",
9330
- negative_allowed=True,
9331
- )
9332
- logger.debug(
9333
- f"args:\n"
9334
- f"network: {network}\n"
9335
- f"hotkey: {type(hotkey)}\n"
9336
- f"netuid: {netuid}\n"
9337
- f"position_id: {position_id}\n"
9338
- f"liquidity_delta: {liquidity_delta}\n"
9339
- f"proxy: {type(proxy)}\n"
9340
- )
9341
-
9342
- return self._run_command(
9343
- liquidity.modify_liquidity(
9344
- subtensor=self.initialize_chain(network),
9345
- wallet=wallet,
9346
- hotkey_ss58=hotkey,
9347
- netuid=netuid,
9348
- proxy=proxy,
9349
- position_id=position_id,
9350
- liquidity_delta=liquidity_delta,
9351
- prompt=prompt,
9352
- decline=decline,
9353
- quiet=quiet,
9354
- json_output=json_output,
9355
- )
9356
- )
9357
-
9358
9074
  # Crowd
9359
9075
 
9360
9076
  def crowd_list(