|
87 | 87 | move as move_stake, |
88 | 88 | add as add_stake, |
89 | 89 | remove as remove_stake, |
| 90 | + claim as claim_stake, |
90 | 91 | ) |
91 | 92 | from bittensor_cli.src.commands.subnets import ( |
92 | 93 | price, |
@@ -970,6 +971,12 @@ def __init__(self): |
970 | 971 | self.stake_app.command( |
971 | 972 | "swap", rich_help_panel=HELP_PANELS["STAKE"]["MOVEMENT"] |
972 | 973 | )(self.stake_swap) |
| 974 | + self.stake_app.command( |
| 975 | + "set-claim", rich_help_panel=HELP_PANELS["STAKE"]["CLAIM"] |
| 976 | + )(self.stake_set_claim_type) |
| 977 | + self.stake_app.command( |
| 978 | + "process-claim", rich_help_panel=HELP_PANELS["STAKE"]["CLAIM"] |
| 979 | + )(self.stake_process_claim) |
973 | 980 |
|
974 | 981 | # stake-children commands |
975 | 982 | children_app = typer.Typer() |
@@ -1144,6 +1151,16 @@ def __init__(self): |
1144 | 1151 | self.sudo_app.command("get_take", hidden=True)(self.sudo_get_take) |
1145 | 1152 | self.sudo_app.command("set_take", hidden=True)(self.sudo_set_take) |
1146 | 1153 |
|
| 1154 | + # Stake |
| 1155 | + self.stake_app.command( |
| 1156 | + "claim", |
| 1157 | + hidden=True, |
| 1158 | + )(self.stake_set_claim_type) |
| 1159 | + self.stake_app.command( |
| 1160 | + "unclaim", |
| 1161 | + hidden=True, |
| 1162 | + )(self.stake_set_claim_type) |
| 1163 | + |
1147 | 1164 | # Crowdloan |
1148 | 1165 | self.app.add_typer( |
1149 | 1166 | self.crowd_app, |
@@ -7066,6 +7083,115 @@ def view_dashboard( |
7066 | 7083 | ) |
7067 | 7084 | ) |
7068 | 7085 |
|
| 7086 | + def stake_set_claim_type( |
| 7087 | + self, |
| 7088 | + wallet_name: Optional[str] = Options.wallet_name, |
| 7089 | + wallet_path: Optional[str] = Options.wallet_path, |
| 7090 | + wallet_hotkey: Optional[str] = Options.wallet_hotkey, |
| 7091 | + network: Optional[list[str]] = Options.network, |
| 7092 | + prompt: bool = Options.prompt, |
| 7093 | + quiet: bool = Options.quiet, |
| 7094 | + verbose: bool = Options.verbose, |
| 7095 | + json_output: bool = Options.json_output, |
| 7096 | + ): |
| 7097 | + """ |
| 7098 | + Set the root claim type for your coldkey. |
| 7099 | +
|
| 7100 | + Root claim types control how staking emissions are handled on the ROOT network (subnet 0): |
| 7101 | +
|
| 7102 | + [bold]Claim Types:[/bold] |
| 7103 | + • [green]Swap[/green]: Future Root Alpha Emissions are swapped to TAO and added to root stake (default) |
| 7104 | + • [yellow]Keep[/yellow]: Future Root Alpha Emissions are kept as Alpha tokens |
| 7105 | +
|
| 7106 | + USAGE: |
| 7107 | +
|
| 7108 | + [green]$[/green] btcli root set-claim-type |
| 7109 | +
|
| 7110 | + With specific wallet: |
| 7111 | +
|
| 7112 | + [green]$[/green] btcli root set-claim-type --wallet-name my_wallet |
| 7113 | + """ |
| 7114 | + self.verbosity_handler(quiet, verbose, json_output) |
| 7115 | + wallet = self.wallet_ask( |
| 7116 | + wallet_name, |
| 7117 | + wallet_path, |
| 7118 | + wallet_hotkey, |
| 7119 | + ask_for=[WO.NAME], |
| 7120 | + ) |
| 7121 | + return self._run_command( |
| 7122 | + claim_stake.set_claim_type( |
| 7123 | + wallet=wallet, |
| 7124 | + subtensor=self.initialize_chain(network), |
| 7125 | + prompt=prompt, |
| 7126 | + json_output=json_output, |
| 7127 | + ) |
| 7128 | + ) |
| 7129 | + |
| 7130 | + def stake_process_claim( |
| 7131 | + self, |
| 7132 | + netuids: Optional[str] = Options.netuids, |
| 7133 | + wallet_name: Optional[str] = Options.wallet_name, |
| 7134 | + wallet_path: Optional[str] = Options.wallet_path, |
| 7135 | + wallet_hotkey: Optional[str] = Options.wallet_hotkey, |
| 7136 | + network: Optional[list[str]] = Options.network, |
| 7137 | + prompt: bool = Options.prompt, |
| 7138 | + quiet: bool = Options.quiet, |
| 7139 | + verbose: bool = Options.verbose, |
| 7140 | + json_output: bool = Options.json_output, |
| 7141 | + ): |
| 7142 | + """ |
| 7143 | + Manually claim accumulated root network emissions for your coldkey. |
| 7144 | +
|
| 7145 | + [bold]Note:[/bold] The network will eventually process your pending emissions automatically. |
| 7146 | + However, you can choose to manually claim your emissions with a small extrinsic fee. |
| 7147 | +
|
| 7148 | + A maximum of 5 netuids can be processed in one call. |
| 7149 | +
|
| 7150 | + USAGE: |
| 7151 | +
|
| 7152 | + [green]$[/green] btcli stake process-claim |
| 7153 | +
|
| 7154 | + Claim from specific netuids: |
| 7155 | +
|
| 7156 | + [green]$[/green] btcli stake process-claim --netuids 1,2,3 |
| 7157 | +
|
| 7158 | + Claim with specific wallet: |
| 7159 | +
|
| 7160 | + [green]$[/green] btcli stake process-claim --netuids 1,2 --wallet-name my_wallet |
| 7161 | +
|
| 7162 | + """ |
| 7163 | + self.verbosity_handler(quiet, verbose, json_output) |
| 7164 | + |
| 7165 | + parsed_netuids = None |
| 7166 | + if netuids: |
| 7167 | + parsed_netuids = parse_to_list( |
| 7168 | + netuids, |
| 7169 | + int, |
| 7170 | + "Netuids must be a comma-separated list of ints, e.g., `--netuids 1,2,3`.", |
| 7171 | + ) |
| 7172 | + |
| 7173 | + if len(parsed_netuids) > 5: |
| 7174 | + print_error("Maximum 5 netuids allowed per claim") |
| 7175 | + return |
| 7176 | + |
| 7177 | + wallet = self.wallet_ask( |
| 7178 | + wallet_name, |
| 7179 | + wallet_path, |
| 7180 | + wallet_hotkey, |
| 7181 | + ask_for=[WO.NAME], |
| 7182 | + ) |
| 7183 | + |
| 7184 | + return self._run_command( |
| 7185 | + claim_stake.process_pending_claims( |
| 7186 | + wallet=wallet, |
| 7187 | + subtensor=self.initialize_chain(network), |
| 7188 | + netuids=parsed_netuids, |
| 7189 | + prompt=prompt, |
| 7190 | + json_output=json_output, |
| 7191 | + verbose=verbose, |
| 7192 | + ) |
| 7193 | + ) |
| 7194 | + |
7069 | 7195 | def liquidity_add( |
7070 | 7196 | self, |
7071 | 7197 | network: Optional[list[str]] = Options.network, |
|
0 commit comments