Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9c68196
docs: fixed redundant "from"
mdqst Apr 10, 2025
b8cadfc
Allows for passing stake sudo test because max_burn is now root sudo …
thewhaleking Apr 30, 2025
cbba9d1
Merge pull request #440 from opentensor/fix/thewhaleking/max-burn-now…
thewhaleking Apr 30, 2025
9e12472
Fixes cases where err_docs is a string
thewhaleking Apr 30, 2025
78a4567
Account for multiple doc lines in error
thewhaleking Apr 30, 2025
26772a9
Pulls shares in a gather rather than one-at-a-time. +ruff
thewhaleking Apr 29, 2025
2a962e0
ship
thewhaleking Apr 30, 2025
8ccb083
Merge pull request #439 from opentensor/fix/thewhaleking/fix-error-fo…
thewhaleking Apr 30, 2025
0df45bc
Merge pull request #438 from opentensor/feat/thewhaleking/stake-fetch…
thewhaleking May 2, 2025
0b917da
Pull emission_start_schedule dynamically rather than a predefined con…
thewhaleking May 2, 2025
520adeb
Merge pull request #442 from opentensor/feat/thewhaleking/emission-st…
thewhaleking May 2, 2025
51da68e
Change default era period to 10.
thewhaleking May 5, 2025
a1501d7
Update "era" to "period"
thewhaleking May 5, 2025
deff48f
Update default era period
thewhaleking May 5, 2025
5e2e2b8
Merge pull request #443 from opentensor/fix/thewhaleking/default-era-…
thewhaleking May 5, 2025
13f299c
Merge pull request #429 from mdqst/patch-2
thewhaleking May 5, 2025
90c1796
Fixes name-shadowing bug.
thewhaleking May 12, 2025
56f1932
Adds explicit choosing rather than parsing so as to ensure we do not …
thewhaleking May 12, 2025
b8e7ac7
Fixes broken click dependency (sub-dependency of typer)
thewhaleking May 12, 2025
a08e17f
Merge pull request #447 from opentensor/fix/thewhaleking/click-versio…
thewhaleking May 12, 2025
f617a19
Fixes name-shadowing bug.
thewhaleking May 12, 2025
d60f4c1
Merge pull request #445 from opentensor/fix/thewhaleking/name-shadowi…
thewhaleking May 12, 2025
c0e029a
Merge branch 'staging' into fix/thewhaleking/selection-vs-parsing
thewhaleking May 12, 2025
51790d3
Merge pull request #446 from opentensor/fix/thewhaleking/selection-vs…
thewhaleking May 12, 2025
81a2da5
bumps version and changelog
ibraheem-abe May 12, 2025
4634592
Merge pull request #448 from opentensor/changelog/941
ibraheem-abe May 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 9.4.1 /2025-04-17

## What's Changed
* Fixes `test_staking_sudo` setting `max_burn` by @thewhaleking in https://github.com/opentensor/btcli/pull/440
* Fixes Error Formatter by @thewhaleking in https://github.com/opentensor/btcli/pull/439
* Pulls shares in a gather rather than one-at-a-time by @thewhaleking in https://github.com/opentensor/btcli/pull/438
* Pull emission start schedule dynamically by @thewhaleking in https://github.com/opentensor/btcli/pull/442
* Lengthen default era period + rename "era" to "period" by @thewhaleking in https://github.com/opentensor/btcli/pull/443
* docs: fixed redundant "from" by @mdqst in https://github.com/opentensor/btcli/pull/429
* click version 8.2.0 broken by @thewhaleking in https://github.com/opentensor/btcli/pull/447
* JSON Name shadowing bug by @thewhaleking in https://github.com/opentensor/btcli/pull/445
* Stop Parsing, Start Asking by @thewhaleking in https://github.com/opentensor/btcli/pull/446

**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.4.0...v9.4.1

## 9.4.0 /2025-04-17

## What's Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Installation steps are described below. For a full documentation on how to use `

## Install on macOS and Linux

You can install `btcli` on your local machine directly from source, or from from PyPI. **Make sure you verify your installation after you install**:
You can install `btcli` on your local machine directly from source, or from PyPI. **Make sure you verify your installation after you install**:


### Install from PyPI
Expand Down
115 changes: 75 additions & 40 deletions bittensor_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,11 @@ class Options:
"--json-out",
help="Outputs the result of the command as JSON.",
)
era: int = typer.Option(
3, help="Length (in blocks) for which the transaction should be valid."
period: int = typer.Option(
16,
"--period",
"--era",
help="Length (in blocks) for which the transaction should be valid.",
)


Expand Down Expand Up @@ -436,36 +439,49 @@ def parse_mnemonic(mnemonic: str) -> str:
def get_creation_data(
mnemonic: Optional[str],
seed: Optional[str],
json: Optional[str],
json_path: Optional[str],
json_password: Optional[str],
) -> tuple[str, str, str, str]:
"""
Determines which of the key creation elements have been supplied, if any. If None have been supplied,
prompts to user, and determines what they've supplied. Returns all elements in a tuple.
"""
if not mnemonic and not seed and not json:
prompt_answer = Prompt.ask(
"Enter the mnemonic, or the seed hex string, or the location of the JSON file."
if not mnemonic and not seed and not json_path:
choices = {
1: "mnemonic",
2: "seed hex string",
3: "path to JSON File",
}
type_answer = IntPrompt.ask(
"Select one of the following to enter\n"
f"[{COLORS.G.HINT}][1][/{COLORS.G.HINT}] Mnemonic\n"
f"[{COLORS.G.HINT}][2][/{COLORS.G.HINT}] Seed hex string\n"
f"[{COLORS.G.HINT}][3][/{COLORS.G.HINT}] Path to JSON File\n",
choices=["1", "2", "3"],
show_choices=False,
)
if prompt_answer.startswith("0x"):
prompt_answer = Prompt.ask(f"Please enter your {choices[type_answer]}")
if type_answer == 1:
mnemonic = prompt_answer
elif type_answer == 2:
seed = prompt_answer
elif len(prompt_answer.split(" ")) > 1:
mnemonic = parse_mnemonic(prompt_answer)
else:
json = prompt_answer
if seed.startswith("0x"):
seed = seed[2:]
elif type_answer == 3:
json_path = prompt_answer
elif mnemonic:
mnemonic = parse_mnemonic(mnemonic)

if json:
if not os.path.exists(json):
print_error(f"The JSON file '{json}' does not exist.")
if json_path:
if not os.path.exists(json_path):
print_error(f"The JSON file '{json_path}' does not exist.")
raise typer.Exit()

if json and not json_password:
if json_path and not json_password:
json_password = Prompt.ask(
"Enter the backup password for JSON file.", password=True
)
return mnemonic, seed, json, json_password
return mnemonic, seed, json_path, json_password


def config_selector(conf: dict, title: str):
Expand Down Expand Up @@ -1792,7 +1808,7 @@ def wallet_transfer(
transfer_all: bool = typer.Option(
False, "--all", prompt=False, help="Transfer all available balance."
),
era: int = Options.era,
period: int = Options.period,
wallet_name: str = Options.wallet_name,
wallet_path: str = Options.wallet_path,
wallet_hotkey: str = Options.wallet_hotkey,
Expand Down Expand Up @@ -1847,7 +1863,7 @@ def wallet_transfer(
destination=destination_ss58_address,
amount=amount,
transfer_all=transfer_all,
era=era,
era=period,
prompt=prompt,
json_output=json_output,
)
Expand Down Expand Up @@ -2090,7 +2106,7 @@ def wallet_regen_coldkey(
wallet_hotkey: Optional[str] = Options.wallet_hotkey,
mnemonic: Optional[str] = Options.mnemonic,
seed: Optional[str] = Options.seed,
json: Optional[str] = Options.json,
json_path: Optional[str] = Options.json,
json_password: Optional[str] = Options.json_password,
use_password: Optional[bool] = Options.use_password,
overwrite: bool = Options.overwrite,
Expand Down Expand Up @@ -2130,15 +2146,15 @@ def wallet_regen_coldkey(

wallet = Wallet(wallet_name, wallet_hotkey, wallet_path)

mnemonic, seed, json, json_password = get_creation_data(
mnemonic, seed, json, json_password
mnemonic, seed, json_path, json_password = get_creation_data(
mnemonic, seed, json_path, json_password
)
return self._run_command(
wallets.regen_coldkey(
wallet,
mnemonic,
seed,
json,
json_path,
json_password,
use_password,
overwrite,
Expand Down Expand Up @@ -2214,7 +2230,7 @@ def wallet_regen_hotkey(
wallet_hotkey: Optional[str] = Options.wallet_hotkey,
mnemonic: Optional[str] = Options.mnemonic,
seed: Optional[str] = Options.seed,
json: Optional[str] = Options.json,
json_path: Optional[str] = Options.json,
json_password: Optional[str] = Options.json_password,
use_password: bool = typer.Option(
False, # Overriden to False
Expand Down Expand Up @@ -2250,15 +2266,15 @@ def wallet_regen_hotkey(
ask_for=[WO.NAME, WO.PATH, WO.HOTKEY],
validate=WV.WALLET,
)
mnemonic, seed, json, json_password = get_creation_data(
mnemonic, seed, json, json_password
mnemonic, seed, json_path, json_password = get_creation_data(
mnemonic, seed, json_path, json_password
)
return self._run_command(
wallets.regen_hotkey(
wallet,
mnemonic,
seed,
json,
json_path,
json_password,
use_password,
overwrite,
Expand Down Expand Up @@ -3190,7 +3206,7 @@ def stake_add(
rate_tolerance: Optional[float] = Options.rate_tolerance,
safe_staking: Optional[bool] = Options.safe_staking,
allow_partial_stake: Optional[bool] = Options.allow_partial_stake,
era: int = Options.era,
period: int = Options.period,
prompt: bool = Options.prompt,
quiet: bool = Options.quiet,
verbose: bool = Options.verbose,
Expand Down Expand Up @@ -3386,7 +3402,7 @@ def stake_add(
rate_tolerance,
allow_partial_stake,
json_output,
era,
period,
)
)

Expand Down Expand Up @@ -3438,7 +3454,7 @@ def stake_remove(
rate_tolerance: Optional[float] = Options.rate_tolerance,
safe_staking: Optional[bool] = Options.safe_staking,
allow_partial_stake: Optional[bool] = Options.allow_partial_stake,
era: int = Options.era,
period: int = Options.period,
prompt: bool = Options.prompt,
interactive: bool = typer.Option(
False,
Expand Down Expand Up @@ -3631,7 +3647,7 @@ def stake_remove(
exclude_hotkeys=exclude_hotkeys,
prompt=prompt,
json_output=json_output,
era=era,
era=period,
)
)
elif (
Expand Down Expand Up @@ -3687,7 +3703,7 @@ def stake_remove(
rate_tolerance=rate_tolerance,
allow_partial_stake=allow_partial_stake,
json_output=json_output,
era=era,
era=period,
)
)

Expand Down Expand Up @@ -3715,7 +3731,7 @@ def stake_move(
stake_all: bool = typer.Option(
False, "--stake-all", "--all", help="Stake all", prompt=False
),
era: int = Options.era,
period: int = Options.period,
prompt: bool = Options.prompt,
quiet: bool = Options.quiet,
verbose: bool = Options.verbose,
Expand Down Expand Up @@ -3845,7 +3861,7 @@ def stake_move(
destination_hotkey=destination_hotkey,
amount=amount,
stake_all=stake_all,
era=era,
era=period,
interactive_selection=interactive_selection,
prompt=prompt,
)
Expand Down Expand Up @@ -3886,7 +3902,7 @@ def stake_transfer(
stake_all: bool = typer.Option(
False, "--stake-all", "--all", help="Stake all", prompt=False
),
era: int = Options.era,
period: int = Options.period,
prompt: bool = Options.prompt,
quiet: bool = Options.quiet,
verbose: bool = Options.verbose,
Expand Down Expand Up @@ -4008,7 +4024,7 @@ def stake_transfer(
dest_netuid=dest_netuid,
dest_coldkey_ss58=dest_ss58,
amount=amount,
era=era,
era=period,
interactive_selection=interactive_selection,
stake_all=stake_all,
prompt=prompt,
Expand Down Expand Up @@ -4050,7 +4066,7 @@ def stake_swap(
"--all",
help="Swap all available stake",
),
era: int = Options.era,
period: int = Options.period,
prompt: bool = Options.prompt,
wait_for_inclusion: bool = Options.wait_for_inclusion,
wait_for_finalization: bool = Options.wait_for_finalization,
Expand Down Expand Up @@ -4115,7 +4131,7 @@ def stake_swap(
destination_netuid=dest_netuid,
amount=amount,
swap_all=swap_all,
era=era,
era=period,
interactive_selection=interactive_selection,
prompt=prompt,
wait_for_inclusion=wait_for_inclusion,
Expand Down Expand Up @@ -4430,6 +4446,7 @@ def sudo_set(
param_value: Optional[str] = typer.Option(
"", "--value", help="Value to set the hyperparameter to."
),
prompt: bool = Options.prompt,
quiet: bool = Options.quiet,
verbose: bool = Options.verbose,
json_output: bool = Options.json_output,
Expand All @@ -4454,6 +4471,11 @@ def sudo_set(
raise typer.Exit()

if not param_name:
if not prompt:
err_console.print(
"Param name not supplied with `--no-prompt` flag. Cannot continue"
)
return False
hyperparam_list = [field.name for field in fields(SubnetHyperparameters)]
console.print("Available hyperparameters:\n")
for idx, param in enumerate(hyperparam_list, start=1):
Expand All @@ -4467,6 +4489,11 @@ def sudo_set(
param_name = hyperparam_list[choice - 1]

if param_name in ["alpha_high", "alpha_low"]:
if not prompt:
err_console.print(
"`alpha_high` and `alpha_low` values cannot be set with `--no-prompt`"
)
return False
param_name = "alpha_values"
low_val = FloatPrompt.ask(
"Enter the new value for [dark_orange]alpha_low[/dark_orange]"
Expand All @@ -4477,6 +4504,11 @@ def sudo_set(
param_value = f"{low_val},{high_val}"

if not param_value:
if not prompt:
err_console.print(
"Param value not supplied with `--no-prompt` flag. Cannot continue."
)
return False
if HYPERPARAMS.get(param_name):
param_value = Prompt.ask(
f"Enter the new value for [{COLORS.G.SUBHEAD}]{param_name}[/{COLORS.G.SUBHEAD}] "
Expand All @@ -4495,6 +4527,7 @@ def sudo_set(
netuid,
param_name,
param_value,
prompt,
json_output,
)
)
Expand Down Expand Up @@ -5258,10 +5291,12 @@ def subnets_register(
wallet_hotkey: str = Options.wallet_hotkey,
network: Optional[list[str]] = Options.network,
netuid: int = Options.netuid,
era: Optional[
period: Optional[
int
] = typer.Option( # Should not be Options.era bc this needs to be an Optional[int]
] = typer.Option( # Should not be Options.period bc this needs to be an Optional[int]
None,
"--period",
"--era",
help="Length (in blocks) for which the transaction should be valid. Note that it is possible that if you "
"use an era for this transaction that you may pay a different fee to register than the one stated.",
),
Expand Down Expand Up @@ -5294,7 +5329,7 @@ def subnets_register(
wallet,
self.initialize_chain(network),
netuid,
era,
period,
json_output,
prompt,
)
Expand Down
3 changes: 1 addition & 2 deletions bittensor_cli/src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class Constants:
"test": "0x8f9cf856bf558a14440e75569c9e58594757048d7b3a84b5d25f6bd978263105",
}
delegates_detail_url = "https://raw.githubusercontent.com/opentensor/bittensor-delegates/main/public/delegates.json"
emission_start_schedule = 7 * 24 * 60 * 60 / 12 # 7 days


@dataclass
Expand Down Expand Up @@ -640,7 +639,7 @@ class WalletValidationTypes(Enum):
"activity_cutoff": ("sudo_set_activity_cutoff", False),
"target_regs_per_interval": ("sudo_set_target_registrations_per_interval", True),
"min_burn": ("sudo_set_min_burn", True),
"max_burn": ("sudo_set_max_burn", False),
"max_burn": ("sudo_set_max_burn", True),
"bonds_moving_avg": ("sudo_set_bonds_moving_average", False),
"max_regs_per_block": ("sudo_set_max_registrations_per_block", True),
"serving_rate_limit": ("sudo_set_serving_rate_limit", False),
Expand Down
Loading
Loading