Skip to content

Commit fe48607

Browse files
authored
Merge pull request #388 from opentensor/release/9.1.4
Release/9.1.4
2 parents aaf9714 + e5df987 commit fe48607

File tree

18 files changed

+345
-429
lines changed

18 files changed

+345
-429
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 9.1.4 /2025-03-13
4+
5+
## What's Changed
6+
* Disk-Cache Async-Substrate-Interface Calls by @thewhaleking in https://github.com/opentensor/btcli/pull/368
7+
* COLOR_PALETTE refactor by @thewhaleking in https://github.com/opentensor/btcli/pull/386
8+
* Code Cleanup by @thewhaleking in https://github.com/opentensor/btcli/pull/381
9+
* Adds rate-tolerance alias by @ibraheem-opentensor in https://github.com/opentensor/btcli/pull/387
10+
11+
**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.1.3...v9.1.4
12+
313
## 9.1.3 /2025-03-12
414

515
## What's Changed

bittensor_cli/cli.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
WalletOptions as WO,
2626
WalletValidationTypes as WV,
2727
Constants,
28-
COLOR_PALETTE,
28+
COLORS,
2929
HYPERPARAMS,
3030
)
3131
from bittensor_cli.version import __version__, __version_as_int__
@@ -241,6 +241,7 @@ class Options:
241241
"--slippage",
242242
"--slippage-tolerance",
243243
"--tolerance",
244+
"--rate-tolerance",
244245
help="Set the rate tolerance percentage for transactions (default: 0.05%).",
245246
callback=validate_rate_tolerance,
246247
)
@@ -341,8 +342,8 @@ def get_optional_netuid(netuid: Optional[int], all_netuids: bool) -> Optional[in
341342
return None
342343
elif netuid is None and all_netuids is False:
343344
answer = Prompt.ask(
344-
f"Enter the [{COLOR_PALETTE['GENERAL']['SUBHEADING_MAIN']}]netuid"
345-
f"[/{COLOR_PALETTE['GENERAL']['SUBHEADING_MAIN']}] to use. Leave blank for all netuids",
345+
f"Enter the [{COLORS.G.SUBHEAD_MAIN}]netuid"
346+
f"[/{COLORS.G.SUBHEAD_MAIN}] to use. Leave blank for all netuids",
346347
default=None,
347348
show_default=False,
348349
)
@@ -950,7 +951,8 @@ def initialize_chain(
950951
elif self.config["network"]:
951952
self.subtensor = SubtensorInterface(self.config["network"])
952953
console.print(
953-
f"Using the specified network [{COLOR_PALETTE['GENERAL']['LINKS']}]{self.config['network']}[/{COLOR_PALETTE['GENERAL']['LINKS']}] from config"
954+
f"Using the specified network [{COLORS.G.LINKS}]{self.config['network']}"
955+
f"[/{COLORS.G.LINKS}] from config"
954956
)
955957
else:
956958
self.subtensor = SubtensorInterface(defaults.subtensor.network)
@@ -1523,7 +1525,7 @@ def wallet_ask(
15231525
else:
15241526
wallet_name = Prompt.ask(
15251527
"Enter the [blue]wallet name[/blue]"
1526-
+ f" [{COLOR_PALETTE['GENERAL']['HINT']} italic](Hint: You can set this with `btcli config set --wallet-name`)",
1528+
+ f" [{COLORS.G.HINT} italic](Hint: You can set this with `btcli config set --wallet-name`)",
15271529
default=defaults.wallet.name,
15281530
)
15291531

@@ -2049,7 +2051,7 @@ def wallet_regen_coldkey(
20492051

20502052
if not wallet_name:
20512053
wallet_name = Prompt.ask(
2052-
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]new wallet (coldkey)",
2054+
f"Enter the name of the [{COLORS.G.CK}]new wallet (coldkey)",
20532055
default=defaults.wallet.name,
20542056
)
20552057

@@ -2106,7 +2108,7 @@ def wallet_regen_coldkey_pub(
21062108

21072109
if not wallet_name:
21082110
wallet_name = Prompt.ask(
2109-
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]new wallet (coldkey)",
2111+
f"Enter the name of the [{COLORS.G.CK}]new wallet (coldkey)",
21102112
default=defaults.wallet.name,
21112113
)
21122114
wallet = Wallet(wallet_name, wallet_hotkey, wallet_path)
@@ -2223,13 +2225,13 @@ def wallet_new_hotkey(
22232225

22242226
if not wallet_name:
22252227
wallet_name = Prompt.ask(
2226-
f"Enter the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]wallet name",
2228+
f"Enter the [{COLORS.G.CK}]wallet name",
22272229
default=defaults.wallet.name,
22282230
)
22292231

22302232
if not wallet_hotkey:
22312233
wallet_hotkey = Prompt.ask(
2232-
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['HOTKEY']}]new hotkey",
2234+
f"Enter the name of the [{COLORS.G.HK}]new hotkey",
22332235
default=defaults.wallet.hotkey,
22342236
)
22352237

@@ -2285,7 +2287,7 @@ def wallet_new_coldkey(
22852287

22862288
if not wallet_name:
22872289
wallet_name = Prompt.ask(
2288-
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]new wallet (coldkey)",
2290+
f"Enter the name of the [{COLORS.G.CK}]new wallet (coldkey)",
22892291
default=defaults.wallet.name,
22902292
)
22912293

@@ -2359,12 +2361,12 @@ def wallet_create_wallet(
23592361

23602362
if not wallet_name:
23612363
wallet_name = Prompt.ask(
2362-
f"Enter the name of the [{COLOR_PALETTE['GENERAL']['COLDKEY']}]new wallet (coldkey)",
2364+
f"Enter the name of the [{COLORS.G.CK}]new wallet (coldkey)",
23632365
default=defaults.wallet.name,
23642366
)
23652367
if not wallet_hotkey:
23662368
wallet_hotkey = Prompt.ask(
2367-
f"Enter the the name of the [{COLOR_PALETTE['GENERAL']['HOTKEY']}]new hotkey",
2369+
f"Enter the the name of the [{COLORS.G.HK}]new hotkey",
23682370
default=defaults.wallet.hotkey,
23692371
)
23702372

@@ -2742,9 +2744,10 @@ def wallet_sign(
27422744
self.verbosity_handler(quiet, verbose)
27432745
if use_hotkey is None:
27442746
use_hotkey = Confirm.ask(
2745-
f"Would you like to sign the transaction using your [{COLOR_PALETTE['GENERAL']['HOTKEY']}]hotkey[/{COLOR_PALETTE['GENERAL']['HOTKEY']}]?"
2746-
f"\n[Type [{COLOR_PALETTE['GENERAL']['HOTKEY']}]y[/{COLOR_PALETTE['GENERAL']['HOTKEY']}] for [{COLOR_PALETTE['GENERAL']['HOTKEY']}]hotkey[/{COLOR_PALETTE['GENERAL']['HOTKEY']}]"
2747-
f" and [{COLOR_PALETTE['GENERAL']['COLDKEY']}]n[/{COLOR_PALETTE['GENERAL']['COLDKEY']}] for [{COLOR_PALETTE['GENERAL']['COLDKEY']}]coldkey[/{COLOR_PALETTE['GENERAL']['COLDKEY']}]] (default is [{COLOR_PALETTE['GENERAL']['COLDKEY']}]coldkey[/{COLOR_PALETTE['GENERAL']['COLDKEY']}])",
2747+
f"Would you like to sign the transaction using your [{COLORS.G.HK}]hotkey[/{COLORS.G.HK}]?"
2748+
f"\n[Type [{COLORS.G.HK}]y[/{COLORS.G.HK}] for [{COLORS.G.HK}]hotkey[/{COLORS.G.HK}]"
2749+
f" and [{COLORS.G.CK}]n[/{COLORS.G.CK}] for [{COLORS.G.CK}]coldkey[/{COLORS.G.CK}]] "
2750+
f"(default is [{COLORS.G.CK}]coldkey[/{COLORS.G.CK}])",
27482751
default=False,
27492752
)
27502753

@@ -3035,11 +3038,11 @@ def stake_add(
30353038
raise typer.Exit()
30363039
if netuid is not None:
30373040
amount = FloatPrompt.ask(
3038-
f"Amount to [{COLOR_PALETTE['GENERAL']['SUBHEADING_MAIN']}]stake (TAO τ)"
3041+
f"Amount to [{COLORS.G.SUBHEAD_MAIN}]stake (TAO τ)"
30393042
)
30403043
else:
30413044
amount = FloatPrompt.ask(
3042-
f"Amount to [{COLOR_PALETTE['GENERAL']['SUBHEADING_MAIN']}]stake to each netuid (TAO τ)"
3045+
f"Amount to [{COLORS.G.SUBHEAD_MAIN}]stake to each netuid (TAO τ)"
30433046
)
30443047

30453048
if amount <= 0:
@@ -4112,7 +4115,8 @@ def sudo_set(
41124115
if not param_value:
41134116
if HYPERPARAMS.get(param_name):
41144117
param_value = Prompt.ask(
4115-
f"Enter the new value for [{COLOR_PALETTE['GENERAL']['SUBHEADING']}]{param_name}[/{COLOR_PALETTE['GENERAL']['SUBHEADING']}] in the VALUE column format"
4118+
f"Enter the new value for [{COLORS.G.SUBHEAD}]{param_name}[/{COLORS.G.SUBHEAD}] "
4119+
f"in the VALUE column format"
41164120
)
41174121
else:
41184122
param_value = None

bittensor_cli/src/__init__.py

Lines changed: 105 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -721,64 +721,111 @@ class WalletValidationTypes(Enum):
721721
},
722722
}
723723

724-
COLOR_PALETTE = {
725-
"GENERAL": {
726-
"HEADER": "#4196D6", # Light Blue
727-
"LINKS": "#8CB9E9", # Sky Blue
728-
"HINT": "#A2E5B8", # Mint Green
729-
"COLDKEY": "#9EF5E4", # Aqua
730-
"HOTKEY": "#ECC39D", # Light Orange/Peach
731-
"SUBHEADING_MAIN": "#7ECFEC", # Light Cyan
732-
"SUBHEADING": "#AFEFFF", # Pale Blue
733-
"SUBHEADING_EXTRA_1": "#96A3C5", # Grayish Blue
734-
"SUBHEADING_EXTRA_2": "#6D7BAF", # Slate Blue
735-
"CONFIRMATION_Y_N_Q": "#EE8DF8", # Light Purple/Pink
736-
"SYMBOL": "#E7CC51", # Gold
737-
"BALANCE": "#4F91C6", # Medium Blue
738-
"COST": "#53B5A0", # Teal
739-
"SUCCESS": "#53B5A0", # Teal
740-
"NETUID": "#CBA880", # Tan
741-
"NETUID_EXTRA": "#DDD5A9", # Light Khaki
742-
"TEMPO": "#67A3A5", # Grayish Teal
743-
},
744-
"STAKE": {
745-
"STAKE_AMOUNT": "#53B5A0", # Teal
746-
"STAKE_ALPHA": "#53B5A0", # Teal
747-
"STAKE_SWAP": "#67A3A5", # Grayish Teal
748-
"TAO": "#4F91C6", # Medium Blue
749-
"SLIPPAGE_TEXT": "#C25E7C", # Rose
750-
"SLIPPAGE_PERCENT": "#E7B195", # Light Coral
751-
"NOT_REGISTERED": "#EB6A6C", # Salmon Red
752-
"EXTRA_1": "#D781BB", # Pink
753-
},
754-
"POOLS": {
755-
"TAO": "#4F91C6", # Medium Blue
756-
"ALPHA_IN": "#D09FE9", # Light Purple
757-
"ALPHA_OUT": "#AB7CC8", # Medium Purple
758-
"RATE": "#F8D384", # Light Orange
759-
"TAO_EQUIV": "#8CB9E9", # Sky Blue
760-
"EMISSION": "#F8D384", # Light Orange
761-
"EXTRA_1": "#CAA8FB", # Lavender
762-
"EXTRA_2": "#806DAF", # Dark Purple
763-
},
764-
"GREY": {
765-
"GREY_100": "#F8F9FA", # Almost White
766-
"GREY_200": "#F1F3F4", # Very Light Grey
767-
"GREY_300": "#DBDDE1", # Light Grey
768-
"GREY_400": "#BDC1C6", # Medium Light Grey
769-
"GREY_500": "#5F6368", # Medium Grey
770-
"GREY_600": "#2E3134", # Medium Dark Grey
771-
"GREY_700": "#282A2D", # Dark Grey
772-
"GREY_800": "#17181B", # Very Dark Grey
773-
"GREY_900": "#0E1013", # Almost Black
774-
"BLACK": "#000000", # Pure Black
775-
},
776-
"SUDO": {
777-
"HYPERPARAMETER": "#4F91C6", # Medium Blue
778-
"VALUE": "#D09FE9", # Light Purple
779-
"NORMALIZED": "#AB7CC8", # Medium Purple
780-
},
781-
}
724+
725+
class Gettable:
726+
def __getitem__(self, item):
727+
return getattr(self, item)
728+
729+
730+
class ColorPalette(Gettable):
731+
def __init__(self):
732+
self.GENERAL = self.General()
733+
self.STAKE = self.Stake()
734+
self.POOLS = self.Pools()
735+
self.GREY = self.Grey()
736+
self.SUDO = self.Sudo()
737+
# aliases
738+
self.G = self.GENERAL
739+
self.S = self.STAKE
740+
self.P = self.POOLS
741+
self.GR = self.GREY
742+
self.SU = self.SUDO
743+
744+
class General(Gettable):
745+
HEADER = "#4196D6" # Light Blue
746+
LINKS = "#8CB9E9" # Sky Blue
747+
HINT = "#A2E5B8" # Mint Green
748+
COLDKEY = "#9EF5E4" # Aqua
749+
HOTKEY = "#ECC39D" # Light Orange/Peach
750+
SUBHEADING_MAIN = "#7ECFEC" # Light Cyan
751+
SUBHEADING = "#AFEFFF" # Pale Blue
752+
SUBHEADING_EXTRA_1 = "#96A3C5" # Grayish Blue
753+
SUBHEADING_EXTRA_2 = "#6D7BAF" # Slate Blue
754+
CONFIRMATION_Y_N_Q = "#EE8DF8" # Light Purple/Pink
755+
SYMBOL = "#E7CC51" # Gold
756+
BALANCE = "#4F91C6" # Medium Blue
757+
COST = "#53B5A0" # Teal
758+
SUCCESS = "#53B5A0" # Teal
759+
NETUID = "#CBA880" # Tan
760+
NETUID_EXTRA = "#DDD5A9" # Light Khaki
761+
TEMPO = "#67A3A5" # Grayish Teal
762+
# aliases
763+
CK = COLDKEY
764+
HK = HOTKEY
765+
SUBHEAD_MAIN = SUBHEADING_MAIN
766+
SUBHEAD = SUBHEADING
767+
SUBHEAD_EX_1 = SUBHEADING_EXTRA_1
768+
SUBHEAD_EX_2 = SUBHEADING_EXTRA_2
769+
SYM = SYMBOL
770+
BAL = BALANCE
771+
772+
class Stake(Gettable):
773+
STAKE_AMOUNT = "#53B5A0" # Teal
774+
STAKE_ALPHA = "#53B5A0" # Teal
775+
STAKE_SWAP = "#67A3A5" # Grayish Teal
776+
TAO = "#4F91C6" # Medium Blue
777+
SLIPPAGE_TEXT = "#C25E7C" # Rose
778+
SLIPPAGE_PERCENT = "#E7B195" # Light Coral
779+
NOT_REGISTERED = "#EB6A6C" # Salmon Red
780+
EXTRA_1 = "#D781BB" # Pink
781+
# aliases
782+
AMOUNT = STAKE_AMOUNT
783+
ALPHA = STAKE_ALPHA
784+
SWAP = STAKE_SWAP
785+
786+
class Pools(Gettable):
787+
TAO = "#4F91C6" # Medium Blue
788+
ALPHA_IN = "#D09FE9" # Light Purple
789+
ALPHA_OUT = "#AB7CC8" # Medium Purple
790+
RATE = "#F8D384" # Light Orange
791+
TAO_EQUIV = "#8CB9E9" # Sky Blue
792+
EMISSION = "#F8D384" # Light Orange
793+
EXTRA_1 = "#CAA8FB" # Lavender
794+
EXTRA_2 = "#806DAF" # Dark Purple
795+
796+
class Grey(Gettable):
797+
GREY_100 = "#F8F9FA" # Almost White
798+
GREY_200 = "#F1F3F4" # Very Light Grey
799+
GREY_300 = "#DBDDE1" # Light Grey
800+
GREY_400 = "#BDC1C6" # Medium Light Grey
801+
GREY_500 = "#5F6368" # Medium Grey
802+
GREY_600 = "#2E3134" # Medium Dark Grey
803+
GREY_700 = "#282A2D" # Dark Grey
804+
GREY_800 = "#17181B" # Very Dark Grey
805+
GREY_900 = "#0E1013" # Almost Black
806+
BLACK = "#000000" # Pure Black
807+
# aliases
808+
G_100 = GREY_100
809+
G_200 = GREY_200
810+
G_300 = GREY_300
811+
G_400 = GREY_400
812+
G_500 = GREY_500
813+
G_600 = GREY_600
814+
G_700 = GREY_700
815+
G_800 = GREY_800
816+
G_900 = GREY_900
817+
818+
class Sudo(Gettable):
819+
HYPERPARAMETER = "#4F91C6" # Medium Blue
820+
VALUE = "#D09FE9" # Light Purple
821+
NORMALIZED = "#AB7CC8" # Medium Purple
822+
# aliases
823+
HYPERPARAM = HYPERPARAMETER
824+
NORMAL = NORMALIZED
825+
826+
827+
COLOR_PALETTE = ColorPalette()
828+
COLORS = COLOR_PALETTE
782829

783830

784831
SUBNETS = {

bittensor_cli/src/bittensor/chain_data.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,9 @@ def tao_to_alpha(self, tao: Balance) -> Balance:
745745
def alpha_to_tao(self, alpha: Balance) -> Balance:
746746
return Balance.from_tao(alpha.tao * self.price.tao)
747747

748-
def tao_to_alpha_with_slippage(self, tao: Balance) -> tuple[Balance, Balance]:
748+
def tao_to_alpha_with_slippage(
749+
self, tao: Balance
750+
) -> tuple[Balance, Balance, float]:
749751
"""
750752
Returns an estimate of how much Alpha would a staker receive if they stake their tao using the current pool state.
751753
Args:

0 commit comments

Comments
 (0)