bittensor-cli 9.22.3__tar.gz → 9.23.0rc1__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.3 → bittensor_cli-9.23.0rc1}/PKG-INFO +2 -3
  2. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/cli.py +9 -326
  3. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/__init__.py +13 -13
  4. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/subtensor_interface.py +94 -15
  5. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/utils.py +1 -0
  6. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/subnets/subnets.py +121 -120
  7. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/wallets.py +29 -3
  8. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/pyproject.toml +2 -3
  9. bittensor_cli-9.22.3/bittensor_cli/src/commands/liquidity/liquidity.py +0 -696
  10. bittensor_cli-9.22.3/bittensor_cli/src/commands/liquidity/utils.py +0 -202
  11. bittensor_cli-9.22.3/bittensor_cli/src/commands/subnets/__init__.py +0 -0
  12. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/README.md +0 -0
  13. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/__init__.py +0 -0
  14. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/doc_generation_helper.py +0 -0
  15. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/__init__.py +0 -0
  16. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/balances.py +0 -0
  17. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/chain_data.py +0 -0
  18. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/extrinsics/__init__.py +0 -0
  19. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/extrinsics/mev_shield.py +0 -0
  20. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/extrinsics/registration.py +0 -0
  21. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/extrinsics/root.py +0 -0
  22. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/extrinsics/serving.py +0 -0
  23. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/extrinsics/transfer.py +0 -0
  24. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/locks.py +0 -0
  25. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/minigraph.py +0 -0
  26. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/networking.py +0 -0
  27. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/main-filters.j2 +0 -0
  28. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/main-header.j2 +0 -0
  29. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/neuron-details.j2 +0 -0
  30. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/price-multi.j2 +0 -0
  31. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/price-single.j2 +0 -0
  32. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/subnet-details-header.j2 +0 -0
  33. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/subnet-details.j2 +0 -0
  34. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/subnet-metrics.j2 +0 -0
  35. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/subnets-table.j2 +0 -0
  36. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/table.j2 +0 -0
  37. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/view.css +0 -0
  38. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/view.j2 +0 -0
  39. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/bittensor/templates/view.js +0 -0
  40. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/__init__.py +0 -0
  41. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/axon/__init__.py +0 -0
  42. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/axon/axon.py +0 -0
  43. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/crowd/__init__.py +0 -0
  44. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/crowd/contribute.py +0 -0
  45. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/crowd/contributors.py +0 -0
  46. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/crowd/create.py +0 -0
  47. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/crowd/dissolve.py +0 -0
  48. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/crowd/refund.py +0 -0
  49. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/crowd/update.py +0 -0
  50. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/crowd/utils.py +0 -0
  51. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/crowd/view.py +0 -0
  52. {bittensor_cli-9.22.3/bittensor_cli/src/commands/liquidity → bittensor_cli-9.23.0rc1/bittensor_cli/src/commands/lock}/__init__.py +0 -0
  53. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/lock/add.py +0 -0
  54. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/lock/common.py +0 -0
  55. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/lock/list.py +0 -0
  56. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/lock/mode.py +0 -0
  57. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/lock/move.py +0 -0
  58. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/proxy.py +0 -0
  59. {bittensor_cli-9.22.3/bittensor_cli/src/commands/lock → bittensor_cli-9.23.0rc1/bittensor_cli/src/commands/stake}/__init__.py +0 -0
  60. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/stake/add.py +0 -0
  61. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/stake/auto_staking.py +0 -0
  62. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/stake/children_hotkeys.py +0 -0
  63. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/stake/claim.py +0 -0
  64. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/stake/list.py +0 -0
  65. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/stake/move.py +0 -0
  66. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/stake/remove.py +0 -0
  67. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/stake/wizard.py +0 -0
  68. {bittensor_cli-9.22.3/bittensor_cli/src/commands/stake → bittensor_cli-9.23.0rc1/bittensor_cli/src/commands/subnets}/__init__.py +0 -0
  69. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/subnets/mechanisms.py +0 -0
  70. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/subnets/price.py +0 -0
  71. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/sudo.py +0 -0
  72. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/view.py +0 -0
  73. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/bittensor_cli/src/commands/weights.py +0 -0
  74. {bittensor_cli-9.22.3 → bittensor_cli-9.23.0rc1}/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.3
3
+ Version: 9.23.0rc1
4
4
  Summary: Bittensor CLI
5
5
  Author: bittensor.com
6
6
  Requires-Python: >=3.10
@@ -18,7 +18,6 @@ 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
23
  Requires-Dist: bittensor-drand>=1.3.0,<2.0.0
@@ -27,7 +26,7 @@ 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)
@@ -1394,30 +1388,6 @@ class CLIManager:
1394
1388
  "dissolve", rich_help_panel=HELP_PANELS["CROWD"]["INITIATOR"]
1395
1389
  )(self.crowd_dissolve)
1396
1390
 
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
1391
  # utils app
1422
1392
  self.utils_app.command("convert")(self.convert)
1423
1393
  self.utils_app.command("latency")(self.best_connection)
@@ -2616,6 +2586,11 @@ class CLIManager:
2616
2586
  self,
2617
2587
  wallet_name: Optional[str] = Options.wallet_name,
2618
2588
  wallet_path: str = Options.wallet_path,
2589
+ coldkeys_only: bool = typer.Option(
2590
+ False,
2591
+ "--coldkeys-only",
2592
+ help="List coldkeys only; omit hotkeys from the output.",
2593
+ ),
2619
2594
  quiet: bool = Options.quiet,
2620
2595
  verbose: bool = Options.verbose,
2621
2596
  json_output: bool = Options.json_output,
@@ -2626,11 +2601,13 @@ class CLIManager:
2626
2601
  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
2602
 
2628
2603
  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).
2604
+ public keys are available (`?` denotes unavailable or encrypted keys). Coldkeys and hotkeys are listed in natural
2605
+ sort order (e.g. coldkey2 before coldkey10).
2630
2606
 
2631
2607
  # EXAMPLE
2632
2608
 
2633
2609
  [green]$[/green] btcli wallet list --path ~/.bittensor
2610
+ [green]$[/green] btcli w list --coldkeys-only
2634
2611
 
2635
2612
  [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
2613
  """
@@ -2643,6 +2620,7 @@ class CLIManager:
2643
2620
  wallet.path,
2644
2621
  json_output,
2645
2622
  wallet_name=wallet_name,
2623
+ coldkeys_only=coldkeys_only,
2646
2624
  )
2647
2625
  )
2648
2626
 
@@ -9060,301 +9038,6 @@ class CLIManager:
9060
9038
  )
9061
9039
  )
9062
9040
 
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
9041
  # Crowd
9359
9042
 
9360
9043
  def crowd_list(
@@ -618,7 +618,6 @@ HYPERPARAMS = {
618
618
  ),
619
619
  "yuma3_enabled": ("sudo_set_yuma3_enabled", RootSudoOnly.FALSE),
620
620
  "alpha_sigmoid_steepness": ("sudo_set_alpha_sigmoid_steepness", RootSudoOnly.TRUE),
621
- "user_liquidity_enabled": ("toggle_user_liquidity", RootSudoOnly.COMPLICATED),
622
621
  "bonds_reset_enabled": ("sudo_set_bonds_reset_enabled", RootSudoOnly.FALSE),
623
622
  "transfers_enabled": ("sudo_set_toggle_transfer", RootSudoOnly.FALSE),
624
623
  "min_allowed_uids": ("sudo_set_min_allowed_uids", RootSudoOnly.TRUE),
@@ -640,11 +639,15 @@ HYPERPARAMS = {
640
639
  "max_allowed_uids": ("sudo_set_max_allowed_uids", RootSudoOnly.FALSE),
641
640
  "burn_increase_mult": ("sudo_set_burn_increase_mult", RootSudoOnly.FALSE),
642
641
  "burn_half_life": ("sudo_set_burn_half_life", RootSudoOnly.FALSE),
642
+ "min_childkey_take": (
643
+ "sudo_set_min_childkey_take_per_subnet",
644
+ RootSudoOnly.FALSE,
645
+ ),
643
646
  }
644
647
 
645
- HYPERPARAMS_MODULE = {
646
- "user_liquidity_enabled": "Swap",
647
- }
648
+ # Maps a hyperparameter to a non-default pallet for sudo set calls. Empty by default
649
+ # (all current hyperparameters live in the default pallet).
650
+ HYPERPARAMS_MODULE: dict[str, str] = {}
648
651
 
649
652
  # Hyperparameter metadata: descriptions, side-effects, ownership, and documentation links
650
653
  HYPERPARAMS_METADATA = {
@@ -780,12 +783,6 @@ HYPERPARAMS_METADATA = {
780
783
  "owner_settable": False,
781
784
  "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#alphasigmoidsteepness",
782
785
  },
783
- "user_liquidity_enabled": {
784
- "description": "Enable or disable user liquidity features.",
785
- "side_effects": "Enabling allows liquidity provision and swaps. Disabling restricts liquidity operations.",
786
- "owner_settable": True, # COMPLICATED - can be set by owner or sudo
787
- "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#userliquidityenabled",
788
- },
789
786
  "bonds_reset_enabled": {
790
787
  "description": "Enable or disable periodic bond resets.",
791
788
  "side_effects": "Enabling provides periodic bond resets, preventing bond accumulation. Disabling allows bonds to accumulate.",
@@ -877,6 +874,12 @@ HYPERPARAMS_METADATA = {
877
874
  "owner_settable": True,
878
875
  "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#burnincreasemult",
879
876
  },
877
+ "min_childkey_take": {
878
+ "description": "Minimum childkey take (%) required on this subnet. Settable by the subnet owner. Cannot be set below the global protocol minimum.",
879
+ "side_effects": "Child hotkeys on this subnet must set take at or above this value.",
880
+ "owner_settable": True,
881
+ "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#minchildkeytake",
882
+ },
880
883
  }
881
884
 
882
885
  # Help Panels for cli help
@@ -921,9 +924,6 @@ HELP_PANELS = {
921
924
  "VIEW": {
922
925
  "DASHBOARD": "Network Dashboard",
923
926
  },
924
- "LIQUIDITY": {
925
- "LIQUIDITY_MGMT": "Liquidity Management",
926
- },
927
927
  "CROWD": {
928
928
  "INITIATOR": "Crowdloan Creation & Management",
929
929
  "PARTICIPANT": "Crowdloan Participation",
@@ -48,7 +48,7 @@ from bittensor_cli.src.bittensor.utils import (
48
48
  ProxyAnnouncements,
49
49
  )
50
50
  from scalecodec.base import ScaleType
51
- from scalecodec.utils.math import fixed_to_decimal
51
+ from scalecodec.utils.math import fixed_to_decimal, FixedPoint
52
52
 
53
53
  GENESIS_ADDRESS = "5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM"
54
54
 
@@ -2523,7 +2523,7 @@ class SubtensorInterface:
2523
2523
  Returns:
2524
2524
  dict[int, float]: Dictionary mapping netuid to claimable rate.
2525
2525
  """
2526
- query = await self.query(
2526
+ query: dict[int, FixedPoint] = await self.query(
2527
2527
  module="SubtensorModule",
2528
2528
  storage_function="RootClaimable",
2529
2529
  params=[hotkey_ss58],
@@ -2533,8 +2533,10 @@ class SubtensorInterface:
2533
2533
  if not query:
2534
2534
  return {}
2535
2535
 
2536
- bits_list = next(iter(query))
2537
- return {bits[0]: fixed_to_float(bits[1], frac_bits=32) for bits in bits_list}
2536
+ return {
2537
+ netuid: fixed_to_float(bits, frac_bits=32)
2538
+ for (netuid, bits) in query.items()
2539
+ }
2538
2540
 
2539
2541
  async def get_claimable_rate_netuid(
2540
2542
  self,
@@ -2706,6 +2708,39 @@ class SubtensorInterface:
2706
2708
  results[hotkey][netuid] = net_claimable.set_unit(netuid)
2707
2709
  return results
2708
2710
 
2711
+ async def _runtime_method_exists(
2712
+ self, api: str, method: str, block_hash: Optional[str] = None
2713
+ ) -> bool:
2714
+ """
2715
+ Checks whether a runtime call method exists at the given block.
2716
+
2717
+ :param api: The runtime API name (e.g. `"SwapRuntimeApi"`).
2718
+ :param method: The method within the runtime API to check for.
2719
+ :param block_hash: The hash of the block at which to check.
2720
+
2721
+ :return: `True` if the runtime call method exists, `False` otherwise.
2722
+ """
2723
+ runtime = await self.substrate.init_runtime(block_hash=block_hash)
2724
+ try:
2725
+ _ = runtime.runtime_api_map[api][method]
2726
+ return True
2727
+ except KeyError:
2728
+ return False
2729
+
2730
+ async def _get_subnet_price_from_storage(
2731
+ self, netuid: int, block_hash: Optional[str] = None
2732
+ ) -> Balance:
2733
+ """Legacy Alpha-price lookup for pre-Balancer chains via ``Swap::AlphaSqrtPrice``."""
2734
+ current_sqrt_price = await self.query(
2735
+ module="Swap",
2736
+ storage_function="AlphaSqrtPrice",
2737
+ params=[netuid],
2738
+ block_hash=block_hash,
2739
+ )
2740
+ current_sqrt_price = fixed_to_float(current_sqrt_price)
2741
+ current_price = current_sqrt_price * current_sqrt_price
2742
+ return Balance.from_rao(int(current_price * 1e9))
2743
+
2709
2744
  async def get_subnet_price(
2710
2745
  self,
2711
2746
  netuid: int = None,
@@ -2714,22 +2749,34 @@ class SubtensorInterface:
2714
2749
  """
2715
2750
  Gets the current Alpha price in TAO for a specific subnet.
2716
2751
 
2752
+ Uses the `SwapRuntimeApi::current_alpha_price` runtime call (Balancer swap). If the connected
2753
+ chain does not expose that runtime method, falls back to the legacy `Swap::AlphaSqrtPrice`
2754
+ storage query so the CLI keeps working against pre-Balancer chains. Note this is only necessary to exist
2755
+ until mainnet release, as it allows for working with the staging branch on live data until then.
2756
+
2717
2757
  :param netuid: The unique identifier of the subnet.
2718
2758
  :param block_hash: The hash of the block to retrieve the price from.
2719
2759
 
2720
2760
  :return: The current Alpha price in TAO units for the specified subnet.
2721
2761
  """
2722
- # TODO update this to use the runtime call SwapRuntimeAPI.current_alpha_price
2723
- current_sqrt_price = await self.query(
2724
- module="Swap",
2725
- storage_function="AlphaSqrtPrice",
2726
- params=[netuid],
2727
- block_hash=block_hash,
2728
- )
2762
+ # SN0 (root) uses TAO directly and always has a price of 1 TAO.
2763
+ if netuid == 0:
2764
+ return Balance.from_tao(1)
2729
2765
 
2730
- current_sqrt_price = fixed_to_float(current_sqrt_price)
2731
- current_price = current_sqrt_price * current_sqrt_price
2732
- return Balance.from_rao(int(current_price * 1e9))
2766
+ if await self._runtime_method_exists(
2767
+ "SwapRuntimeApi", "current_alpha_price", block_hash=block_hash
2768
+ ):
2769
+ price_rao = await self.query_runtime_api(
2770
+ "SwapRuntimeApi",
2771
+ "current_alpha_price",
2772
+ params=[netuid],
2773
+ block_hash=block_hash,
2774
+ )
2775
+ return Balance.from_rao(int(price_rao))
2776
+ else:
2777
+ return await self._get_subnet_price_from_storage(
2778
+ netuid, block_hash=block_hash
2779
+ )
2733
2780
 
2734
2781
  async def get_subnet_prices(
2735
2782
  self, block_hash: Optional[str] = None, page_size: int = 200
@@ -2737,11 +2784,43 @@ class SubtensorInterface:
2737
2784
  """
2738
2785
  Gets the current Alpha prices in TAO for all subnets.
2739
2786
 
2787
+ Prefers the `SwapRuntimeApi::current_alpha_price_all` runtime call (Balancer swap), falling
2788
+ back to per-subnet `current_alpha_price` calls, and finally to the legacy
2789
+ `Swap::AlphaSqrtPrice` storage map for pre-Balancer chains.
2790
+
2740
2791
  :param block_hash: The hash of the block to retrieve prices from.
2741
- :param page_size: The page size for batch queries (default: 100).
2792
+ :param page_size: The page size for the legacy storage fallback query.
2742
2793
 
2743
2794
  :return: A dictionary mapping netuid to the current Alpha price in TAO units.
2744
2795
  """
2796
+ if block_hash is None:
2797
+ block_hash = await self.substrate.get_chain_head()
2798
+
2799
+ if await self._runtime_method_exists(
2800
+ "SwapRuntimeApi", "current_alpha_price_all", block_hash=block_hash
2801
+ ):
2802
+ prices_rao = await self.query_runtime_api(
2803
+ "SwapRuntimeApi",
2804
+ "current_alpha_price_all",
2805
+ block_hash=block_hash,
2806
+ )
2807
+ return {
2808
+ int(p["netuid"]): Balance.from_rao(int(p["price"])) for p in prices_rao
2809
+ }
2810
+
2811
+ if await self._runtime_method_exists(
2812
+ "SwapRuntimeApi", "current_alpha_price", block_hash=block_hash
2813
+ ):
2814
+ netuids = await self.get_all_subnet_netuids(block_hash=block_hash)
2815
+ prices_list = await asyncio.gather(
2816
+ *[
2817
+ self.get_subnet_price(netuid, block_hash=block_hash)
2818
+ for netuid in netuids
2819
+ ]
2820
+ )
2821
+ return dict(zip(netuids, prices_list))
2822
+
2823
+ # Legacy fallback for pre-Balancer chains.
2745
2824
  query = await self.substrate.query_map(
2746
2825
  module="Swap",
2747
2826
  storage_function="AlphaSqrtPrice",
@@ -852,6 +852,7 @@ def normalize_hyperparameters(
852
852
  "alpha_high": u16_normalized_float,
853
853
  "alpha_low": u16_normalized_float,
854
854
  "alpha_sigmoid_steepness": u16_normalized_float,
855
+ "min_childkey_take": u16_normalized_float,
855
856
  "min_burn": Balance.from_rao,
856
857
  "max_burn": Balance.from_rao,
857
858
  }