diff --git a/bittensor_cli/src/bittensor/chain_data.py b/bittensor_cli/src/bittensor/chain_data.py index d873d51cf..9d71c675e 100644 --- a/bittensor_cli/src/bittensor/chain_data.py +++ b/bittensor_cli/src/bittensor/chain_data.py @@ -156,7 +156,7 @@ class SubnetHyperparameters(InfoBase): def _fix_decoded( cls, decoded: Union[dict, "SubnetHyperparameters"] ) -> "SubnetHyperparameters": - return SubnetHyperparameters( + return cls( rho=decoded.get("rho"), kappa=decoded.get("kappa"), immunity_period=decoded.get("immunity_period"), @@ -197,6 +197,7 @@ class StakeInfo(InfoBase): stake: Balance # Stake for the hotkey-coldkey pair locked: Balance # Stake which is locked. emission: Balance # Emission for the hotkey-coldkey pair + tao_emission: Balance # TAO emission for the hotkey-coldkey pair drain: int is_registered: bool @@ -208,11 +209,20 @@ def _fix_decoded(cls, decoded: Any) -> "StakeInfo": stake = Balance.from_rao(decoded.get("stake")).set_unit(netuid) locked = Balance.from_rao(decoded.get("locked")).set_unit(netuid) emission = Balance.from_rao(decoded.get("emission")).set_unit(netuid) + tao_emission = Balance.from_rao(decoded.get("tao_emission")) drain = int(decoded.get("drain")) is_registered = bool(decoded.get("is_registered")) - return StakeInfo( - hotkey, coldkey, netuid, stake, locked, emission, drain, is_registered + return cls( + hotkey, + coldkey, + netuid, + stake, + locked, + emission, + tao_emission, + drain, + is_registered, ) @@ -293,7 +303,7 @@ def _fix_decoded(cls, decoded: Any) -> "NeuronInfo": axon_info = decoded.get("axon_info", {}) coldkey = decode_account_id(decoded.get("coldkey")) hotkey = decode_account_id(decoded.get("hotkey")) - return NeuronInfo( + return cls( hotkey=hotkey, coldkey=coldkey, uid=decoded.get("uid"), @@ -555,7 +565,7 @@ class SubnetInfo(InfoBase): @classmethod def _fix_decoded(cls, decoded: "SubnetInfo") -> "SubnetInfo": - return SubnetInfo( + return cls( netuid=decoded.get("netuid"), rho=decoded.get("rho"), kappa=decoded.get("kappa"), @@ -594,7 +604,7 @@ class SubnetIdentity(InfoBase): @classmethod def _fix_decoded(cls, decoded: dict) -> "SubnetIdentity": - return SubnetIdentity( + return cls( subnet_name=bytes(decoded["subnet_name"]).decode(), github_repo=bytes(decoded["github_repo"]).decode(), subnet_contact=bytes(decoded["subnet_contact"]).decode(), @@ -828,7 +838,7 @@ class SubnetState(InfoBase): @classmethod def _fix_decoded(cls, decoded: Any) -> "SubnetState": netuid = decoded.get("netuid") - return SubnetState( + return cls( netuid=netuid, hotkeys=[decode_account_id(val) for val in decoded.get("hotkeys")], coldkeys=[decode_account_id(val) for val in decoded.get("coldkeys")], diff --git a/bittensor_cli/src/commands/stake/list.py b/bittensor_cli/src/commands/stake/list.py index 9ee7a2fb1..2545725ec 100644 --- a/bittensor_cli/src/commands/stake/list.py +++ b/bittensor_cli/src/commands/stake/list.py @@ -1,6 +1,7 @@ import asyncio from typing import TYPE_CHECKING, Optional +from bittensor_cli.src.commands.stake.remove import unstake import typer from bittensor_wallet import Wallet @@ -130,6 +131,11 @@ def define_table( style=COLOR_PALETTE["POOLS"]["EMISSION"], justify="right", ) + table.add_column( + f"[white]Emission \n({Balance.get_unit(0)}/block)", + style=COLOR_PALETTE["POOLS"]["EMISSION"], + justify="right", + ) return table def create_table(hotkey_: str, substakes: list[StakeInfo]): @@ -200,6 +206,7 @@ def create_table(hotkey_: str, substakes: list[StakeInfo]): # Per block emission cell per_block_emission = substake_.emission.tao / (pool.tempo or 1) + per_block_tao_emission = substake_.tao_emission.tao / (pool.tempo or 1) # Alpha ownership and TAO ownership cells if alpha_value.tao > 0.00009: if issuance.tao != 0: @@ -243,6 +250,7 @@ def create_table(hotkey_: str, substakes: list[StakeInfo]): # Removing this flag for now, TODO: Confirm correct values are here w.r.t CHKs # if substake_.is_registered # else f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]N/A", # Emission(α/block) + str(Balance.from_tao(per_block_tao_emission)), ] ) table = define_table( @@ -343,6 +351,7 @@ def format_cell( "swapped_value": swapped_tao_value.tao, "emission": substake.emission.tao / (pool.tempo or 1), "tao_ownership": tao_ownership.tao, + "tao_emission": substake.tao_emission.tao (pool.tempo or 1), } # Get previous values for delta tracking @@ -408,6 +417,16 @@ def format_cell( unit_first=unit_first, precision=4, ) + + tao_emission_value = substake.tao_emission.tao / (pool.tempo or 1) + tao_emission_cell = format_cell( + tao_emission_value, + prev.get("tao_emission"), + unit="τ", + unit_first=unit_first, + precision=4, + ) + subnet_name_cell = ( f"[{COLOR_PALETTE['GENERAL']['SYMBOL']}]{symbol if netuid != 0 else 'τ'}[/{COLOR_PALETTE['GENERAL']['SYMBOL']}]" f" {get_subnet_name(dynamic_info[netuid])}" @@ -425,6 +444,7 @@ def format_cell( if substake.is_registered else f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]NO", # Registration status emission_cell, # Emission rate + tao_emission_cell, # TAO emission rate ] )