Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9a26fd0
add get_mev_shield_next_key
ibraheem-abe Nov 27, 2025
33eb90a
adds encrypt_call
ibraheem-abe Nov 27, 2025
a58c38d
extract_mev_shield_id
ibraheem-abe Nov 27, 2025
fb6dcb6
wait_for_mev_execution
ibraheem-abe Nov 27, 2025
121ac08
update deps
ibraheem-abe Nov 27, 2025
5c5a7fc
handle inner call failure
ibraheem-abe Nov 27, 2025
f368f42
mev shield in stake add ops
ibraheem-abe Nov 27, 2025
6558a2d
Add shield in remove ops
ibraheem-abe Nov 27, 2025
b1f3770
add error handling
ibraheem-abe Nov 28, 2025
4b32467
improve waiting
ibraheem-abe Nov 28, 2025
2ca2ddf
update add/remove
ibraheem-abe Nov 28, 2025
142d93a
add protection to move stakes
ibraheem-abe Nov 28, 2025
00d7b63
remove statuses when in error state
ibraheem-abe Nov 28, 2025
227a5aa
use submission block directly
ibraheem-abe Dec 1, 2025
0378be3
handle edge case
ibraheem-abe Dec 1, 2025
11d8228
update mev shield calls
ibraheem-abe Dec 1, 2025
55ea2d3
update e2e tests
ibraheem-abe Dec 1, 2025
5c03f28
update mev shield working
ibraheem-abe Dec 1, 2025
c669b1e
uncomment bulk staking test
ibraheem-abe Dec 1, 2025
0ef2e76
dummy commit
ibraheem-abe Dec 1, 2025
c84afe9
bump asi dep
ibraheem-abe Dec 1, 2025
752051d
update
ibraheem-abe Dec 1, 2025
47dcdaf
update liquidity test
ibraheem-abe Dec 2, 2025
14504f7
ruff
ibraheem-abe Dec 2, 2025
aa2f2e4
wip tests
ibraheem-abe Dec 2, 2025
34e2121
add shield to subnet creation
ibraheem-abe Dec 2, 2025
9ad5f2e
wip
ibraheem-abe Dec 2, 2025
4ed0bfe
update both tests
ibraheem-abe Dec 2, 2025
7a96cd5
update tests + statuses
ibraheem-abe Dec 2, 2025
244da8f
testing
ibraheem-abe Dec 2, 2025
121a48d
bump version to 9.16.0rc1
ibraheem-abe Dec 2, 2025
82915d8
add mev protection arg
ibraheem-abe Dec 2, 2025
79a7682
add optional arg to add & rem stake
ibraheem-abe Dec 2, 2025
341140a
update movement cmds
ibraheem-abe Dec 2, 2025
57035e9
update sn creation
ibraheem-abe Dec 2, 2025
7f2bcae
update tests to use fastblocks
ibraheem-abe Dec 3, 2025
6076bdf
init setup
ibraheem-abe Dec 3, 2025
d642f41
move stake test
ibraheem-abe Dec 3, 2025
8ff6266
test transfer stake
ibraheem-abe Dec 3, 2025
34c384f
test swap stake
ibraheem-abe Dec 3, 2025
31ffd5e
improvement
ibraheem-abe Dec 4, 2025
6799a22
test_wallet_overview_inspect non fast-blocks
ibraheem-abe Dec 4, 2025
6a40b71
add get_mev_shield_current_key
ibraheem-abe Dec 5, 2025
e7b1812
add supp for mark_decryption_failed
ibraheem-abe Dec 5, 2025
3d40ede
no mev prot
ibraheem-abe Dec 5, 2025
bd621e9
bump ASI
ibraheem-abe Dec 5, 2025
42055a3
improve example cmds
ibraheem-abe Dec 5, 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
70 changes: 61 additions & 9 deletions bittensor_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ def edit_help(cls, option_name: str, help_text: str):
"--dashboard.path",
help="Path to save the dashboard HTML file. For example: `~/.bittensor/dashboard`.",
)
mev_protection = typer.Option(
True,
"--mev-protection/--no-mev-protection",
show_default=False,
help="Enable or disable MEV protection [dim](default: enabled)[/dim].",
)
json_output = typer.Option(
False,
"--json-output",
Expand Down Expand Up @@ -3972,6 +3978,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,
mev_protection: bool = Options.mev_protection,
period: int = Options.period,
prompt: bool = Options.prompt,
quiet: bool = Options.quiet,
Expand Down Expand Up @@ -4006,6 +4013,9 @@ def stake_add(
7. Stake the same amount to multiple subnets:
[green]$[/green] btcli stake add --amount 100 --netuids 4,5,6

8. Stake without MEV protection:
[green]$[/green] btcli stake add --amount 100 --netuid 1 --no-mev-protection

[bold]Safe Staking Parameters:[/bold]
• [blue]--safe[/blue]: Enables rate tolerance checks
• [blue]--tolerance[/blue]: Maximum % rate change allowed (0.05 = 5%)
Expand Down Expand Up @@ -4201,6 +4211,7 @@ def stake_add(
f"rate_tolerance: {rate_tolerance}\n"
f"allow_partial_stake: {allow_partial_stake}\n"
f"period: {period}\n"
f"mev_protection: {mev_protection}\n"
)
return self._run_command(
add_stake.stake_add(
Expand All @@ -4218,6 +4229,7 @@ def stake_add(
allow_partial_stake,
json_output,
period,
mev_protection,
)
)

Expand Down Expand Up @@ -4270,6 +4282,7 @@ def stake_remove(
safe_staking: Optional[bool] = Options.safe_staking,
allow_partial_stake: Optional[bool] = Options.allow_partial_stake,
period: int = Options.period,
mev_protection: bool = Options.mev_protection,
prompt: bool = Options.prompt,
interactive: bool = typer.Option(
False,
Expand Down Expand Up @@ -4306,6 +4319,9 @@ def stake_remove(
6. Unstake all Alpha from a hotkey and stake to Root:
[green]$[/green] btcli stake remove --all-alpha

7. Unstake without MEV protection:
[green]$[/green] btcli stake remove --amount 100 --netuid 1 --no-mev-protection

[bold]Safe Staking Parameters:[/bold]
• [blue]--safe[/blue]: Enables rate tolerance checks during unstaking
• [blue]--tolerance[/blue]: Max allowed rate change (0.05 = 5%)
Expand Down Expand Up @@ -4478,7 +4494,8 @@ def stake_remove(
f"all_hotkeys: {all_hotkeys}\n"
f"include_hotkeys: {include_hotkeys}\n"
f"exclude_hotkeys: {exclude_hotkeys}\n"
f"era: {period}"
f"era: {period}\n"
f"mev_protection: {mev_protection}"
)
return self._run_command(
remove_stake.unstake_all(
Expand All @@ -4492,6 +4509,7 @@ def stake_remove(
prompt=prompt,
json_output=json_output,
era=period,
mev_protection=mev_protection,
)
)
elif (
Expand Down Expand Up @@ -4544,7 +4562,8 @@ def stake_remove(
f"safe_staking: {safe_staking}\n"
f"rate_tolerance: {rate_tolerance}\n"
f"allow_partial_stake: {allow_partial_stake}\n"
f"era: {period}"
f"era: {period}\n"
f"mev_protection: {mev_protection}\n"
)

return self._run_command(
Expand All @@ -4564,6 +4583,7 @@ def stake_remove(
allow_partial_stake=allow_partial_stake,
json_output=json_output,
era=period,
mev_protection=mev_protection,
)
)

Expand Down Expand Up @@ -4609,6 +4629,7 @@ def stake_move(
False, "--stake-all", "--all", help="Stake all", prompt=False
),
period: int = Options.period,
mev_protection: bool = Options.mev_protection,
prompt: bool = Options.prompt,
quiet: bool = Options.quiet,
verbose: bool = Options.verbose,
Expand All @@ -4630,9 +4651,13 @@ def stake_move(

If no arguments are provided, an interactive selection menu will be shown.

EXAMPLE
EXAMPLES

[green]$[/green] btcli stake move
1. Interactive move (guided prompts):
[green]$[/green] btcli stake move

2. Move stake without MEV protection:
[green]$[/green] btcli stake move --no-mev-protection
"""
self.verbosity_handler(quiet, verbose, json_output)
if prompt:
Expand Down Expand Up @@ -4747,6 +4772,7 @@ def stake_move(
f"era: {period}\n"
f"interactive_selection: {interactive_selection}\n"
f"prompt: {prompt}\n"
f"mev_protection: {mev_protection}\n"
)
result, ext_id = self._run_command(
move_stake.move_stake(
Expand All @@ -4761,6 +4787,7 @@ def stake_move(
era=period,
interactive_selection=interactive_selection,
prompt=prompt,
mev_protection=mev_protection,
)
)
if json_output:
Expand Down Expand Up @@ -4801,6 +4828,7 @@ def stake_transfer(
stake_all: bool = typer.Option(
False, "--stake-all", "--all", help="Stake all", prompt=False
),
mev_protection: bool = Options.mev_protection,
period: int = Options.period,
prompt: bool = Options.prompt,
quiet: bool = Options.quiet,
Expand Down Expand Up @@ -4838,6 +4866,9 @@ def stake_transfer(

Transfer all available stake from origin hotkey:
[green]$[/green] btcli stake transfer --all --origin-netuid 1 --dest-netuid 2

Transfer stake without MEV protection:
[green]$[/green] btcli stake transfer --origin-netuid 1 --dest-netuid 2 --amount 100 --no-mev-protection
"""
self.verbosity_handler(quiet, verbose, json_output)
if prompt:
Expand Down Expand Up @@ -4933,7 +4964,8 @@ def stake_transfer(
f"dest_coldkey_ss58: {dest_ss58}\n"
f"amount: {amount}\n"
f"era: {period}\n"
f"stake_all: {stake_all}"
f"stake_all: {stake_all}\n"
f"mev_protection: {mev_protection}"
)
result, ext_id = self._run_command(
move_stake.transfer_stake(
Expand All @@ -4948,6 +4980,7 @@ def stake_transfer(
interactive_selection=interactive_selection,
stake_all=stake_all,
prompt=prompt,
mev_protection=mev_protection,
)
)
if json_output:
Expand Down Expand Up @@ -4992,6 +5025,7 @@ def stake_swap(
prompt: bool = Options.prompt,
wait_for_inclusion: bool = Options.wait_for_inclusion,
wait_for_finalization: bool = Options.wait_for_finalization,
mev_protection: bool = Options.mev_protection,
quiet: bool = Options.quiet,
verbose: bool = Options.verbose,
json_output: bool = Options.json_output,
Expand All @@ -5011,10 +5045,13 @@ def stake_swap(

If no arguments are provided, an interactive selection menu will be shown.

EXAMPLE
EXAMPLES

Swap 100 TAO from subnet 1 to subnet 2:
[green]$[/green] btcli stake swap --wallet-name default --wallet-hotkey default --origin-netuid 1 --dest-netuid 2 --amount 100
1. Swap 100 TAO from subnet 1 to subnet 2:
[green]$[/green] btcli stake swap --wallet-name default --wallet-hotkey default --origin-netuid 1 --dest-netuid 2 --amount 100

2. Swap stake without MEV protection:
[green]$[/green] btcli stake swap --origin-netuid 1 --dest-netuid 2 --amount 100 --no-mev-protection
"""
self.verbosity_handler(quiet, verbose, json_output)
console.print(
Expand Down Expand Up @@ -5056,6 +5093,7 @@ def stake_swap(
f"prompt: {prompt}\n"
f"wait_for_inclusion: {wait_for_inclusion}\n"
f"wait_for_finalization: {wait_for_finalization}\n"
f"mev_protection: {mev_protection}\n"
)
result, ext_id = self._run_command(
move_stake.swap_stake(
Expand All @@ -5070,6 +5108,7 @@ def stake_swap(
prompt=prompt,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
mev_protection=mev_protection,
)
)
if json_output:
Expand All @@ -5085,6 +5124,7 @@ def stake_wizard(
wallet_path: Optional[str] = Options.wallet_path,
wallet_hotkey: Optional[str] = Options.wallet_hotkey,
period: int = Options.period,
mev_protection: bool = Options.mev_protection,
prompt: bool = Options.prompt,
quiet: bool = Options.quiet,
verbose: bool = Options.verbose,
Expand Down Expand Up @@ -5150,6 +5190,7 @@ def stake_wizard(
era=period,
interactive_selection=False,
prompt=prompt,
mev_protection=mev_protection,
)
)
elif operation == "transfer":
Expand Down Expand Up @@ -5179,6 +5220,7 @@ def stake_wizard(
era=period,
interactive_selection=False,
prompt=prompt,
mev_protection=mev_protection,
)
)
elif operation == "swap":
Expand All @@ -5194,6 +5236,7 @@ def stake_wizard(
era=period,
interactive_selection=False,
prompt=prompt,
mev_protection=mev_protection,
)
)
else:
Expand Down Expand Up @@ -6427,6 +6470,7 @@ def subnets_create(
additional_info: Optional[str] = typer.Option(
None, "--additional-info", help="Additional information"
),
mev_protection: bool = Options.mev_protection,
json_output: bool = Options.json_output,
prompt: bool = Options.prompt,
quiet: bool = Options.quiet,
Expand All @@ -6445,6 +6489,9 @@ def subnets_create(

2. Create with GitHub repo and contact email:
[green]$[/green] btcli subnets create --subnet-name MySubnet --github-repo https://github.com/myorg/mysubnet --subnet-contact team@mysubnet.net

3. Create subnet without MEV protection:
[green]$[/green] btcli subnets create --no-mev-protection
"""
self.verbosity_handler(quiet, verbose, json_output)
wallet = self.wallet_ask(
Expand Down Expand Up @@ -6472,7 +6519,12 @@ def subnets_create(
logger.debug(f"args:\nnetwork: {network}\nidentity: {identity}\n")
self._run_command(
subnets.create(
wallet, self.initialize_chain(network), identity, json_output, prompt
wallet,
self.initialize_chain(network),
identity,
json_output,
prompt,
mev_protection,
)
)

Expand Down
Loading
Loading