bittensor-cli 9.7.1__tar.gz → 9.8.1__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 (57) hide show
  1. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/PKG-INFO +1 -1
  2. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/cli.py +340 -24
  3. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/__init__.py +8 -0
  4. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/chain_data.py +81 -33
  5. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/subtensor_interface.py +111 -26
  6. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/utils.py +9 -0
  7. bittensor_cli-9.8.1/bittensor_cli/src/commands/liquidity/liquidity.py +628 -0
  8. bittensor_cli-9.8.1/bittensor_cli/src/commands/liquidity/utils.py +200 -0
  9. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/commands/stake/add.py +34 -22
  10. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/commands/stake/list.py +35 -48
  11. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/commands/stake/move.py +18 -44
  12. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/commands/stake/remove.py +33 -95
  13. bittensor_cli-9.8.1/bittensor_cli/src/commands/subnets/__init__.py +0 -0
  14. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/commands/subnets/subnets.py +6 -0
  15. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/commands/sudo.py +21 -8
  16. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/commands/wallets.py +20 -48
  17. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli.egg-info/PKG-INFO +1 -1
  18. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli.egg-info/SOURCES.txt +3 -0
  19. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/pyproject.toml +1 -1
  20. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/MANIFEST.in +0 -0
  21. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/README.md +0 -0
  22. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/__init__.py +0 -0
  23. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/doc_generation_helper.py +0 -0
  24. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/__init__.py +0 -0
  25. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/balances.py +0 -0
  26. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/extrinsics/__init__.py +0 -0
  27. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/extrinsics/registration.py +0 -0
  28. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/extrinsics/root.py +0 -0
  29. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/extrinsics/transfer.py +0 -0
  30. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/minigraph.py +0 -0
  31. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/networking.py +0 -0
  32. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/main-filters.j2 +0 -0
  33. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/main-header.j2 +0 -0
  34. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/neuron-details.j2 +0 -0
  35. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/price-multi.j2 +0 -0
  36. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/price-single.j2 +0 -0
  37. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/subnet-details-header.j2 +0 -0
  38. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/subnet-details.j2 +0 -0
  39. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/subnet-metrics.j2 +0 -0
  40. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/subnets-table.j2 +0 -0
  41. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/table.j2 +0 -0
  42. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/view.css +0 -0
  43. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/view.j2 +0 -0
  44. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/bittensor/templates/view.js +0 -0
  45. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/commands/__init__.py +0 -0
  46. {bittensor_cli-9.7.1/bittensor_cli/src/commands/stake → bittensor_cli-9.8.1/bittensor_cli/src/commands/liquidity}/__init__.py +0 -0
  47. {bittensor_cli-9.7.1/bittensor_cli/src/commands/subnets → bittensor_cli-9.8.1/bittensor_cli/src/commands/stake}/__init__.py +0 -0
  48. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/commands/stake/children_hotkeys.py +0 -0
  49. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/commands/subnets/price.py +0 -0
  50. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/commands/view.py +0 -0
  51. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/src/commands/weights.py +0 -0
  52. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli/version.py +0 -0
  53. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli.egg-info/dependency_links.txt +0 -0
  54. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli.egg-info/entry_points.txt +0 -0
  55. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli.egg-info/requires.txt +0 -0
  56. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/bittensor_cli.egg-info/top_level.txt +0 -0
  57. {bittensor_cli-9.7.1 → bittensor_cli-9.8.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bittensor-cli
3
- Version: 9.7.1
3
+ Version: 9.8.1
4
4
  Summary: Bittensor CLI
5
5
  Author: bittensor.com
6
6
  Project-URL: homepage, https://github.com/opentensor/btcli
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
  import asyncio
3
- import curses
4
3
  import copy
4
+ import curses
5
5
  import importlib
6
6
  import json
7
7
  import os.path
@@ -10,13 +10,13 @@ import ssl
10
10
  import sys
11
11
  import traceback
12
12
  import warnings
13
+ from dataclasses import fields
13
14
  from pathlib import Path
14
15
  from typing import Coroutine, Optional, Union
15
- from dataclasses import fields
16
16
 
17
+ import numpy as np
17
18
  import rich
18
19
  import typer
19
- import numpy as np
20
20
  from async_substrate_interface.errors import (
21
21
  SubstrateRequestException,
22
22
  ConnectionClosed,
@@ -39,21 +39,10 @@ from bittensor_cli.src import (
39
39
  COLORS,
40
40
  HYPERPARAMS,
41
41
  )
42
- from bittensor_cli.version import __version__, __version_as_int__
43
42
  from bittensor_cli.src.bittensor import utils
44
43
  from bittensor_cli.src.bittensor.balances import Balance
45
- from bittensor_cli.src.commands import sudo, wallets, view
46
- from bittensor_cli.src.commands import weights as weights_cmds
47
- from bittensor_cli.src.commands.subnets import price, subnets
48
- from bittensor_cli.src.commands.stake import (
49
- children_hotkeys,
50
- list as list_stake,
51
- move as move_stake,
52
- add as add_stake,
53
- remove as remove_stake,
54
- )
55
- from bittensor_cli.src.bittensor.subtensor_interface import SubtensorInterface
56
44
  from bittensor_cli.src.bittensor.chain_data import SubnetHyperparameters
45
+ from bittensor_cli.src.bittensor.subtensor_interface import SubtensorInterface
57
46
  from bittensor_cli.src.bittensor.utils import (
58
47
  console,
59
48
  err_console,
@@ -70,6 +59,22 @@ from bittensor_cli.src.bittensor.utils import (
70
59
  prompt_for_subnet_identity,
71
60
  validate_rate_tolerance,
72
61
  )
62
+ from bittensor_cli.src.commands import sudo, wallets, view
63
+ from bittensor_cli.src.commands import weights as weights_cmds
64
+ from bittensor_cli.src.commands.liquidity import liquidity
65
+ from bittensor_cli.src.commands.liquidity.utils import (
66
+ prompt_liquidity,
67
+ prompt_position_id,
68
+ )
69
+ from bittensor_cli.src.commands.stake import (
70
+ children_hotkeys,
71
+ list as list_stake,
72
+ move as move_stake,
73
+ add as add_stake,
74
+ remove as remove_stake,
75
+ )
76
+ from bittensor_cli.src.commands.subnets import price, subnets
77
+ from bittensor_cli.version import __version__, __version_as_int__
73
78
 
74
79
  try:
75
80
  from git import Repo, GitError
@@ -656,6 +661,7 @@ class CLIManager:
656
661
  self.subnets_app = typer.Typer(epilog=_epilog)
657
662
  self.weights_app = typer.Typer(epilog=_epilog)
658
663
  self.view_app = typer.Typer(epilog=_epilog)
664
+ self.liquidity_app = typer.Typer(epilog=_epilog)
659
665
 
660
666
  # config alias
661
667
  self.app.add_typer(
@@ -929,11 +935,13 @@ class CLIManager:
929
935
  )(self.view_dashboard)
930
936
 
931
937
  # Sub command aliases
932
- # Weights
938
+ # Wallet
933
939
  self.wallet_app.command(
934
940
  "swap_hotkey",
935
941
  hidden=True,
936
942
  )(self.wallet_swap_hotkey)
943
+ self.wallet_app.command("swap_coldkey", hidden=True)(self.wallet_swap_coldkey)
944
+ self.wallet_app.command("swap_check", hidden=True)(self.wallet_check_ck_swap)
937
945
  self.wallet_app.command(
938
946
  "regen_coldkey",
939
947
  hidden=True,
@@ -962,16 +970,44 @@ class CLIManager:
962
970
  "get_identity",
963
971
  hidden=True,
964
972
  )(self.wallet_get_id)
973
+ self.wallet_app.command("associate_hotkey")(self.wallet_associate_hotkey)
965
974
 
966
975
  # Subnets
967
976
  self.subnets_app.command("burn_cost", hidden=True)(self.subnets_burn_cost)
968
977
  self.subnets_app.command("pow_register", hidden=True)(self.subnets_pow_register)
978
+ self.subnets_app.command("set_identity", hidden=True)(self.subnets_set_identity)
979
+ self.subnets_app.command("get_identity", hidden=True)(self.subnets_get_identity)
980
+ self.subnets_app.command("check_start", hidden=True)(self.subnets_check_start)
969
981
 
970
982
  # Sudo
971
983
  self.sudo_app.command("senate_vote", hidden=True)(self.sudo_senate_vote)
972
984
  self.sudo_app.command("get_take", hidden=True)(self.sudo_get_take)
973
985
  self.sudo_app.command("set_take", hidden=True)(self.sudo_set_take)
974
986
 
987
+ # Liquidity
988
+ self.app.add_typer(
989
+ self.liquidity_app,
990
+ name="liquidity",
991
+ short_help="liquidity commands, aliases: `l`",
992
+ no_args_is_help=True,
993
+ )
994
+ self.app.add_typer(
995
+ self.liquidity_app, name="l", hidden=True, no_args_is_help=True
996
+ )
997
+ # liquidity commands
998
+ self.liquidity_app.command(
999
+ "add", rich_help_panel=HELP_PANELS["LIQUIDITY"]["LIQUIDITY_MGMT"]
1000
+ )(self.liquidity_add)
1001
+ self.liquidity_app.command(
1002
+ "list", rich_help_panel=HELP_PANELS["LIQUIDITY"]["LIQUIDITY_MGMT"]
1003
+ )(self.liquidity_list)
1004
+ self.liquidity_app.command(
1005
+ "modify", rich_help_panel=HELP_PANELS["LIQUIDITY"]["LIQUIDITY_MGMT"]
1006
+ )(self.liquidity_modify)
1007
+ self.liquidity_app.command(
1008
+ "remove", rich_help_panel=HELP_PANELS["LIQUIDITY"]["LIQUIDITY_MGMT"]
1009
+ )(self.liquidity_remove)
1010
+
975
1011
  def generate_command_tree(self) -> Tree:
976
1012
  """
977
1013
  Generates a rich.Tree of the commands, subcommands, and groups of this app
@@ -1603,7 +1639,8 @@ class CLIManager:
1603
1639
  wallet_hotkey: Optional[str],
1604
1640
  ask_for: Optional[list[str]] = None,
1605
1641
  validate: WV = WV.WALLET,
1606
- ) -> Wallet:
1642
+ return_wallet_and_hotkey: bool = False,
1643
+ ) -> Union[Wallet, tuple[Wallet, str]]:
1607
1644
  """
1608
1645
  Generates a wallet object based on supplied values, validating the wallet is valid if flag is set
1609
1646
  :param wallet_name: name of the wallet
@@ -1611,7 +1648,8 @@ class CLIManager:
1611
1648
  :param wallet_hotkey: name of the wallet hotkey file
1612
1649
  :param validate: flag whether to check for the wallet's validity
1613
1650
  :param ask_for: aspect of the wallet (name, path, hotkey) to prompt the user for
1614
- :return: created Wallet object
1651
+ :param return_wallet_and_hotkey: if specified, will return both the wallet object, and the hotkey SS58
1652
+ :return: created Wallet object (or wallet, hotkey ss58)
1615
1653
  """
1616
1654
  ask_for = ask_for or []
1617
1655
  # Prompt for missing attributes specified in ask_for
@@ -1636,8 +1674,9 @@ class CLIManager:
1636
1674
  )
1637
1675
  else:
1638
1676
  wallet_hotkey = Prompt.ask(
1639
- "Enter the [blue]wallet hotkey[/blue]"
1640
- + " [dark_sea_green3 italic](Hint: You can set this with `btcli config set --wallet-hotkey`)[/dark_sea_green3 italic]",
1677
+ "Enter the [blue]wallet hotkey[/blue][dark_sea_green3 italic]"
1678
+ "(Hint: You can set this with `btcli config set --wallet-hotkey`)"
1679
+ "[/dark_sea_green3 italic]",
1641
1680
  default=defaults.wallet.hotkey,
1642
1681
  )
1643
1682
  if wallet_path:
@@ -1655,7 +1694,8 @@ class CLIManager:
1655
1694
  if WO.PATH in ask_for and not wallet_path:
1656
1695
  wallet_path = Prompt.ask(
1657
1696
  "Enter the [blue]wallet path[/blue]"
1658
- + " [dark_sea_green3 italic](Hint: You can set this with `btcli config set --wallet-path`)[/dark_sea_green3 italic]",
1697
+ "[dark_sea_green3 italic](Hint: You can set this with `btcli config set --wallet-path`)"
1698
+ "[/dark_sea_green3 italic]",
1659
1699
  default=defaults.wallet.path,
1660
1700
  )
1661
1701
  # Create the Wallet object
@@ -1679,7 +1719,28 @@ class CLIManager:
1679
1719
  f"Please verify your wallet information: {wallet}[/red]"
1680
1720
  )
1681
1721
  raise typer.Exit()
1682
- return wallet
1722
+ if return_wallet_and_hotkey:
1723
+ valid = utils.is_valid_wallet(wallet)
1724
+ if valid[1]:
1725
+ return wallet, wallet.hotkey.ss58_address
1726
+ else:
1727
+ if wallet_hotkey and is_valid_ss58_address(wallet_hotkey):
1728
+ return wallet, wallet_hotkey
1729
+ else:
1730
+ hotkey = (
1731
+ Prompt.ask(
1732
+ "Enter the SS58 of the hotkey to use for this transaction."
1733
+ )
1734
+ ).strip()
1735
+ if not is_valid_ss58_address(hotkey):
1736
+ err_console.print(
1737
+ f"[red]Error: {hotkey} is not valid SS58 address."
1738
+ )
1739
+ raise typer.Exit(1)
1740
+ else:
1741
+ return wallet, hotkey
1742
+ else:
1743
+ return wallet
1683
1744
 
1684
1745
  def wallet_list(
1685
1746
  self,
@@ -3291,7 +3352,7 @@ class CLIManager:
3291
3352
  )
3292
3353
  else:
3293
3354
  netuid_ = get_optional_netuid(None, all_netuids)
3294
- netuids = [netuid_] if netuid_ else None
3355
+ netuids = [netuid_] if netuid_ is not None else None
3295
3356
  if netuids:
3296
3357
  for netuid_ in netuids:
3297
3358
  # ensure no negative netuids make it into our list
@@ -5025,6 +5086,7 @@ class CLIManager:
5025
5086
  description: Optional[str] = typer.Option(
5026
5087
  None, "--description", help="Description"
5027
5088
  ),
5089
+ logo_url: Optional[str] = typer.Option(None, "--logo-url", help="Logo URL"),
5028
5090
  additional_info: Optional[str] = typer.Option(
5029
5091
  None, "--additional-info", help="Additional information"
5030
5092
  ),
@@ -5067,6 +5129,7 @@ class CLIManager:
5067
5129
  subnet_url=subnet_url,
5068
5130
  discord=discord,
5069
5131
  description=description,
5132
+ logo_url=logo_url,
5070
5133
  additional=additional_info,
5071
5134
  )
5072
5135
  self._run_command(
@@ -5088,7 +5151,7 @@ class CLIManager:
5088
5151
  This command verifies if a subnet's emission schedule can be started based on the subnet's registration block.
5089
5152
 
5090
5153
  Example:
5091
- [green]$[/green] btcli subnets check_start --netuid 1
5154
+ [green]$[/green] btcli subnets check-start --netuid 1
5092
5155
  """
5093
5156
  self.verbosity_handler(quiet, verbose)
5094
5157
  return self._run_command(
@@ -5190,6 +5253,7 @@ class CLIManager:
5190
5253
  description: Optional[str] = typer.Option(
5191
5254
  None, "--description", help="Description"
5192
5255
  ),
5256
+ logo_url: Optional[str] = typer.Option(None, "--logo-url", help="Logo URL"),
5193
5257
  additional_info: Optional[str] = typer.Option(
5194
5258
  None, "--additional-info", help="Additional information"
5195
5259
  ),
@@ -5241,6 +5305,7 @@ class CLIManager:
5241
5305
  subnet_url=subnet_url,
5242
5306
  discord=discord,
5243
5307
  description=description,
5308
+ logo_url=logo_url,
5244
5309
  additional=additional_info,
5245
5310
  )
5246
5311
 
@@ -5752,6 +5817,257 @@ class CLIManager:
5752
5817
  )
5753
5818
  )
5754
5819
 
5820
+ def liquidity_add(
5821
+ self,
5822
+ network: Optional[list[str]] = Options.network,
5823
+ wallet_name: str = Options.wallet_name,
5824
+ wallet_path: str = Options.wallet_path,
5825
+ wallet_hotkey: str = Options.wallet_hotkey,
5826
+ netuid: Optional[int] = Options.netuid,
5827
+ liquidity_: Optional[float] = typer.Option(
5828
+ None,
5829
+ "--liquidity",
5830
+ help="Amount of liquidity to add to the subnet.",
5831
+ ),
5832
+ price_low: Optional[float] = typer.Option(
5833
+ None,
5834
+ "--price-low",
5835
+ "--price_low",
5836
+ "--liquidity-price-low",
5837
+ "--liquidity_price_low",
5838
+ help="Low price for the adding liquidity position.",
5839
+ ),
5840
+ price_high: Optional[float] = typer.Option(
5841
+ None,
5842
+ "--price-high",
5843
+ "--price_high",
5844
+ "--liquidity-price-high",
5845
+ "--liquidity_price_high",
5846
+ help="High price for the adding liquidity position.",
5847
+ ),
5848
+ prompt: bool = Options.prompt,
5849
+ quiet: bool = Options.quiet,
5850
+ verbose: bool = Options.verbose,
5851
+ json_output: bool = Options.json_output,
5852
+ ):
5853
+ """Add liquidity to the swap (as a combination of TAO + Alpha)."""
5854
+ self.verbosity_handler(quiet, verbose, json_output)
5855
+ if not netuid:
5856
+ netuid = Prompt.ask(
5857
+ f"Enter the [{COLORS.G.SUBHEAD_MAIN}]netuid[/{COLORS.G.SUBHEAD_MAIN}] to use",
5858
+ default=None,
5859
+ show_default=False,
5860
+ )
5861
+
5862
+ wallet, hotkey = self.wallet_ask(
5863
+ wallet_name=wallet_name,
5864
+ wallet_path=wallet_path,
5865
+ wallet_hotkey=wallet_hotkey,
5866
+ ask_for=[WO.NAME, WO.HOTKEY, WO.PATH],
5867
+ validate=WV.WALLET,
5868
+ return_wallet_and_hotkey=True,
5869
+ )
5870
+ # Determine the liquidity amount.
5871
+ if liquidity_:
5872
+ liquidity_ = Balance.from_tao(liquidity_)
5873
+ else:
5874
+ liquidity_ = prompt_liquidity("Enter the amount of liquidity")
5875
+
5876
+ # Determine price range
5877
+ if price_low:
5878
+ price_low = Balance.from_tao(price_low)
5879
+ else:
5880
+ price_low = prompt_liquidity("Enter liquidity position low price")
5881
+
5882
+ if price_high:
5883
+ price_high = Balance.from_tao(price_high)
5884
+ else:
5885
+ price_high = prompt_liquidity(
5886
+ "Enter liquidity position high price (must be greater than low price)"
5887
+ )
5888
+
5889
+ if price_low >= price_high:
5890
+ err_console.print("The low price must be lower than the high price.")
5891
+ return False
5892
+
5893
+ return self._run_command(
5894
+ liquidity.add_liquidity(
5895
+ subtensor=self.initialize_chain(network),
5896
+ wallet=wallet,
5897
+ hotkey_ss58=hotkey,
5898
+ netuid=netuid,
5899
+ liquidity=liquidity_,
5900
+ price_low=price_low,
5901
+ price_high=price_high,
5902
+ prompt=prompt,
5903
+ json_output=json_output,
5904
+ )
5905
+ )
5906
+
5907
+ def liquidity_list(
5908
+ self,
5909
+ network: Optional[list[str]] = Options.network,
5910
+ wallet_name: str = Options.wallet_name,
5911
+ wallet_path: str = Options.wallet_path,
5912
+ wallet_hotkey: str = Options.wallet_hotkey,
5913
+ netuid: Optional[int] = Options.netuid,
5914
+ quiet: bool = Options.quiet,
5915
+ verbose: bool = Options.verbose,
5916
+ json_output: bool = Options.json_output,
5917
+ ):
5918
+ """Displays liquidity positions in given subnet."""
5919
+ self.verbosity_handler(quiet, verbose, json_output)
5920
+ if not netuid:
5921
+ netuid = IntPrompt.ask(
5922
+ f"Enter the [{COLORS.G.SUBHEAD_MAIN}]netuid[/{COLORS.G.SUBHEAD_MAIN}] to use",
5923
+ default=None,
5924
+ show_default=False,
5925
+ )
5926
+
5927
+ wallet = self.wallet_ask(
5928
+ wallet_name=wallet_name,
5929
+ wallet_path=wallet_path,
5930
+ wallet_hotkey=wallet_hotkey,
5931
+ ask_for=[WO.NAME, WO.PATH],
5932
+ validate=WV.WALLET,
5933
+ )
5934
+ self._run_command(
5935
+ liquidity.show_liquidity_list(
5936
+ subtensor=self.initialize_chain(network),
5937
+ wallet=wallet,
5938
+ netuid=netuid,
5939
+ json_output=json_output,
5940
+ )
5941
+ )
5942
+
5943
+ def liquidity_remove(
5944
+ self,
5945
+ network: Optional[list[str]] = Options.network,
5946
+ wallet_name: str = Options.wallet_name,
5947
+ wallet_path: str = Options.wallet_path,
5948
+ wallet_hotkey: str = Options.wallet_hotkey,
5949
+ netuid: Optional[int] = Options.netuid,
5950
+ position_id: Optional[int] = typer.Option(
5951
+ None,
5952
+ "--position-id",
5953
+ "--position_id",
5954
+ help="Position ID for modification or removal.",
5955
+ ),
5956
+ all_liquidity_ids: Optional[bool] = typer.Option(
5957
+ False,
5958
+ "--all",
5959
+ "--a",
5960
+ help="Whether to remove all liquidity positions for given subnet.",
5961
+ ),
5962
+ prompt: bool = Options.prompt,
5963
+ quiet: bool = Options.quiet,
5964
+ verbose: bool = Options.verbose,
5965
+ json_output: bool = Options.json_output,
5966
+ ):
5967
+ """Remove liquidity from the swap (as a combination of TAO + Alpha)."""
5968
+
5969
+ self.verbosity_handler(quiet, verbose, json_output)
5970
+
5971
+ if all_liquidity_ids and position_id:
5972
+ print_error("Cannot specify both --all and --position-id.")
5973
+ return
5974
+
5975
+ if not position_id and not all_liquidity_ids:
5976
+ position_id = prompt_position_id()
5977
+
5978
+ if not netuid:
5979
+ netuid = IntPrompt.ask(
5980
+ f"Enter the [{COLORS.G.SUBHEAD_MAIN}]netuid[/{COLORS.G.SUBHEAD_MAIN}] to use",
5981
+ default=None,
5982
+ show_default=False,
5983
+ )
5984
+
5985
+ wallet, hotkey = self.wallet_ask(
5986
+ wallet_name=wallet_name,
5987
+ wallet_path=wallet_path,
5988
+ wallet_hotkey=wallet_hotkey,
5989
+ ask_for=[WO.NAME, WO.HOTKEY, WO.PATH],
5990
+ validate=WV.WALLET,
5991
+ return_wallet_and_hotkey=True,
5992
+ )
5993
+ return self._run_command(
5994
+ liquidity.remove_liquidity(
5995
+ subtensor=self.initialize_chain(network),
5996
+ wallet=wallet,
5997
+ hotkey_ss58=hotkey,
5998
+ netuid=netuid,
5999
+ position_id=position_id,
6000
+ prompt=prompt,
6001
+ all_liquidity_ids=all_liquidity_ids,
6002
+ json_output=json_output,
6003
+ )
6004
+ )
6005
+
6006
+ def liquidity_modify(
6007
+ self,
6008
+ network: Optional[list[str]] = Options.network,
6009
+ wallet_name: str = Options.wallet_name,
6010
+ wallet_path: str = Options.wallet_path,
6011
+ wallet_hotkey: str = Options.wallet_hotkey,
6012
+ netuid: Optional[int] = Options.netuid,
6013
+ position_id: Optional[int] = typer.Option(
6014
+ None,
6015
+ "--position-id",
6016
+ "--position_id",
6017
+ help="Position ID for modification or removing.",
6018
+ ),
6019
+ liquidity_delta: Optional[float] = typer.Option(
6020
+ None,
6021
+ "--liquidity-delta",
6022
+ "--liquidity_delta",
6023
+ help="Liquidity amount for modification.",
6024
+ ),
6025
+ prompt: bool = Options.prompt,
6026
+ quiet: bool = Options.quiet,
6027
+ verbose: bool = Options.verbose,
6028
+ json_output: bool = Options.json_output,
6029
+ ):
6030
+ """Modifies the liquidity position for the given subnet."""
6031
+ self.verbosity_handler(quiet, verbose, json_output)
6032
+ if not netuid:
6033
+ netuid = IntPrompt.ask(
6034
+ f"Enter the [{COLORS.G.SUBHEAD_MAIN}]netuid[/{COLORS.G.SUBHEAD_MAIN}] to use",
6035
+ )
6036
+
6037
+ wallet, hotkey = self.wallet_ask(
6038
+ wallet_name=wallet_name,
6039
+ wallet_path=wallet_path,
6040
+ wallet_hotkey=wallet_hotkey,
6041
+ ask_for=[WO.NAME, WO.HOTKEY, WO.PATH],
6042
+ validate=WV.WALLET,
6043
+ return_wallet_and_hotkey=True,
6044
+ )
6045
+
6046
+ if not position_id:
6047
+ position_id = prompt_position_id()
6048
+
6049
+ if liquidity_delta:
6050
+ liquidity_delta = Balance.from_tao(liquidity_delta)
6051
+ else:
6052
+ liquidity_delta = prompt_liquidity(
6053
+ f"Enter the [blue]liquidity delta[/blue] to modify position with id "
6054
+ f"[blue]{position_id}[/blue] (can be positive or negative)",
6055
+ negative_allowed=True,
6056
+ )
6057
+
6058
+ return self._run_command(
6059
+ liquidity.modify_liquidity(
6060
+ subtensor=self.initialize_chain(network),
6061
+ wallet=wallet,
6062
+ hotkey_ss58=hotkey,
6063
+ netuid=netuid,
6064
+ position_id=position_id,
6065
+ liquidity_delta=liquidity_delta,
6066
+ prompt=prompt,
6067
+ json_output=json_output,
6068
+ )
6069
+ )
6070
+
5755
6071
  @staticmethod
5756
6072
  @utils_app.command("convert")
5757
6073
  def convert(
@@ -660,6 +660,11 @@ HYPERPARAMS = {
660
660
  ),
661
661
  "yuma3_enabled": ("sudo_set_yuma3_enabled", False),
662
662
  "alpha_sigmoid_steepness": ("sudo_set_alpha_sigmoid_steepness", True),
663
+ "user_liquidity_enabled": ("toggle_user_liquidity", True),
664
+ }
665
+
666
+ HYPERPARAMS_MODULE = {
667
+ "user_liquidity_enabled": "Swap",
663
668
  }
664
669
 
665
670
  # Help Panels for cli help
@@ -699,6 +704,9 @@ HELP_PANELS = {
699
704
  "VIEW": {
700
705
  "DASHBOARD": "Network Dashboard",
701
706
  },
707
+ "LIQUIDITY": {
708
+ "LIQUIDITY_MGMT": "Liquidity Management",
709
+ },
702
710
  }
703
711
 
704
712