bittensor-cli 9.0.1__py3-none-any.whl → 9.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bittensor_cli/__init__.py +2 -3
- bittensor_cli/cli.py +38 -22
- bittensor_cli/src/__init__.py +1 -1
- bittensor_cli/src/bittensor/balances.py +1 -1
- bittensor_cli/src/bittensor/chain_data.py +17 -7
- bittensor_cli/src/bittensor/subtensor_interface.py +16 -14
- bittensor_cli/src/commands/stake/add.py +2 -6
- bittensor_cli/src/commands/stake/children_hotkeys.py +1 -1
- bittensor_cli/src/commands/stake/list.py +36 -61
- bittensor_cli/src/commands/stake/move.py +1 -1
- bittensor_cli/src/commands/stake/remove.py +214 -99
- bittensor_cli/src/commands/subnets/subnets.py +3 -5
- bittensor_cli/src/commands/sudo.py +126 -37
- bittensor_cli/src/commands/wallets.py +48 -10
- bittensor_cli/version.py +18 -0
- {bittensor_cli-9.0.1.dist-info → bittensor_cli-9.0.2.dist-info}/METADATA +3 -3
- bittensor_cli-9.0.2.dist-info/RECORD +35 -0
- bittensor_cli-9.0.1.dist-info/RECORD +0 -34
- {bittensor_cli-9.0.1.dist-info → bittensor_cli-9.0.2.dist-info}/WHEEL +0 -0
- {bittensor_cli-9.0.1.dist-info → bittensor_cli-9.0.2.dist-info}/entry_points.txt +0 -0
- {bittensor_cli-9.0.1.dist-info → bittensor_cli-9.0.2.dist-info}/top_level.txt +0 -0
bittensor_cli/__init__.py
CHANGED
bittensor_cli/cli.py
CHANGED
@@ -26,7 +26,9 @@ from bittensor_cli.src import (
|
|
26
26
|
WalletValidationTypes as WV,
|
27
27
|
Constants,
|
28
28
|
COLOR_PALETTE,
|
29
|
+
HYPERPARAMS,
|
29
30
|
)
|
31
|
+
from bittensor_cli.version import __version__, __version_as_int__
|
30
32
|
from bittensor_cli.src.bittensor import utils
|
31
33
|
from bittensor_cli.src.bittensor.balances import Balance
|
32
34
|
from async_substrate_interface.errors import SubstrateRequestException
|
@@ -72,21 +74,8 @@ except ImportError:
|
|
72
74
|
pass
|
73
75
|
|
74
76
|
|
75
|
-
__version__ = "9.0.1"
|
76
77
|
|
77
78
|
|
78
|
-
_core_version = re.match(r"^\d+\.\d+\.\d+", __version__).group(0)
|
79
|
-
_version_split = _core_version.split(".")
|
80
|
-
__version_info__ = tuple(int(part) for part in _version_split)
|
81
|
-
_version_int_base = 1000
|
82
|
-
assert max(__version_info__) < _version_int_base
|
83
|
-
|
84
|
-
__version_as_int__: int = sum(
|
85
|
-
e * (_version_int_base**i) for i, e in enumerate(reversed(__version_info__))
|
86
|
-
)
|
87
|
-
assert __version_as_int__ < 2**31 # fits in int32
|
88
|
-
__new_signature_version__ = 360
|
89
|
-
|
90
79
|
_epilog = "Made with [bold red]:heart:[/bold red] by The Openτensor Foundaτion"
|
91
80
|
|
92
81
|
np.set_printoptions(precision=8, suppress=True, floatmode="fixed")
|
@@ -124,7 +113,7 @@ class Options:
|
|
124
113
|
)
|
125
114
|
mnemonic = typer.Option(
|
126
115
|
None,
|
127
|
-
help=
|
116
|
+
help='Mnemonic used to regenerate your key. For example: "horse cart dog ..."',
|
128
117
|
)
|
129
118
|
seed = typer.Option(
|
130
119
|
None, help="Seed hex string used to regenerate your key. For example: 0x1234..."
|
@@ -2130,6 +2119,7 @@ class CLIManager:
|
|
2130
2119
|
# Example usage:
|
2131
2120
|
|
2132
2121
|
[green]$[/green] btcli wallet regen_hotkey --seed 0x1234...
|
2122
|
+
[green]$[/green] btcli wallet regen-hotkey --mnemonic "word1 word2 ... word12"
|
2133
2123
|
|
2134
2124
|
[bold]Note[/bold]: This command is essential for users who need to regenerate their hotkey, possibly for security upgrades or key recovery.
|
2135
2125
|
It should be used with caution to avoid accidental overwriting of existing keys.
|
@@ -3221,11 +3211,23 @@ class CLIManager:
|
|
3221
3211
|
else:
|
3222
3212
|
print_error("Invalid hotkey ss58 address.")
|
3223
3213
|
raise typer.Exit()
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3214
|
+
elif all_hotkeys:
|
3215
|
+
wallet = self.wallet_ask(
|
3216
|
+
wallet_name,
|
3217
|
+
wallet_path,
|
3218
|
+
wallet_hotkey,
|
3219
|
+
ask_for=[WO.NAME, WO.PATH],
|
3228
3220
|
)
|
3221
|
+
else:
|
3222
|
+
if not hotkey_ss58_address and not wallet_hotkey:
|
3223
|
+
hotkey_or_ss58 = Prompt.ask(
|
3224
|
+
"Enter the [blue]hotkey[/blue] name or [blue]ss58 address[/blue] to unstake all from [dim](or enter 'all' to unstake from all hotkeys)[/dim]",
|
3225
|
+
default=self.config.get("wallet_hotkey")
|
3226
|
+
or defaults.wallet.hotkey,
|
3227
|
+
)
|
3228
|
+
else:
|
3229
|
+
hotkey_or_ss58 = hotkey_ss58_address or wallet_hotkey
|
3230
|
+
|
3229
3231
|
if is_valid_ss58_address(hotkey_or_ss58):
|
3230
3232
|
hotkey_ss58_address = hotkey_or_ss58
|
3231
3233
|
wallet = self.wallet_ask(
|
@@ -3234,6 +3236,14 @@ class CLIManager:
|
|
3234
3236
|
wallet_hotkey,
|
3235
3237
|
ask_for=[WO.NAME, WO.PATH],
|
3236
3238
|
)
|
3239
|
+
elif hotkey_or_ss58 == "all":
|
3240
|
+
all_hotkeys = True
|
3241
|
+
wallet = self.wallet_ask(
|
3242
|
+
wallet_name,
|
3243
|
+
wallet_path,
|
3244
|
+
wallet_hotkey,
|
3245
|
+
ask_for=[WO.NAME, WO.PATH],
|
3246
|
+
)
|
3237
3247
|
else:
|
3238
3248
|
wallet_hotkey = hotkey_or_ss58
|
3239
3249
|
wallet = self.wallet_ask(
|
@@ -3249,6 +3259,9 @@ class CLIManager:
|
|
3249
3259
|
subtensor=self.initialize_chain(network),
|
3250
3260
|
hotkey_ss58_address=hotkey_ss58_address,
|
3251
3261
|
unstake_all_alpha=unstake_all_alpha,
|
3262
|
+
all_hotkeys=all_hotkeys,
|
3263
|
+
include_hotkeys=include_hotkeys,
|
3264
|
+
exclude_hotkeys=exclude_hotkeys,
|
3252
3265
|
prompt=prompt,
|
3253
3266
|
)
|
3254
3267
|
)
|
@@ -3961,7 +3974,7 @@ class CLIManager:
|
|
3961
3974
|
param_name: str = typer.Option(
|
3962
3975
|
"", "--param", "--parameter", help="The subnet hyperparameter to set"
|
3963
3976
|
),
|
3964
|
-
param_value: str = typer.Option(
|
3977
|
+
param_value: Optional[str] = typer.Option(
|
3965
3978
|
"", "--value", help="Value to set the hyperparameter to."
|
3966
3979
|
),
|
3967
3980
|
quiet: bool = Options.quiet,
|
@@ -4010,9 +4023,12 @@ class CLIManager:
|
|
4010
4023
|
param_value = f"{low_val},{high_val}"
|
4011
4024
|
|
4012
4025
|
if not param_value:
|
4013
|
-
|
4014
|
-
|
4015
|
-
|
4026
|
+
if HYPERPARAMS.get(param_name):
|
4027
|
+
param_value = Prompt.ask(
|
4028
|
+
f"Enter the new value for [{COLOR_PALETTE['GENERAL']['SUBHEADING']}]{param_name}[/{COLOR_PALETTE['GENERAL']['SUBHEADING']}] in the VALUE column format"
|
4029
|
+
)
|
4030
|
+
else:
|
4031
|
+
param_value = None
|
4016
4032
|
|
4017
4033
|
wallet = self.wallet_ask(
|
4018
4034
|
wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME, WO.PATH]
|
bittensor_cli/src/__init__.py
CHANGED
@@ -672,7 +672,7 @@ HYPERPARAMS = {
|
|
672
672
|
"commit_reveal_weights_enabled": ("sudo_set_commit_reveal_weights_enabled", False),
|
673
673
|
"alpha_values": ("sudo_set_alpha_values", False),
|
674
674
|
"liquid_alpha_enabled": ("sudo_set_liquid_alpha_enabled", False),
|
675
|
-
"
|
675
|
+
"registration_allowed": ("sudo_set_network_registration_allowed", False),
|
676
676
|
"network_pow_registration_allowed": (
|
677
677
|
"sudo_set_network_pow_registration_allowed",
|
678
678
|
False,
|
@@ -76,7 +76,7 @@ class Balance:
|
|
76
76
|
if self.unit == UNITS[0]:
|
77
77
|
return f"{self.unit} {float(self.tao):,.4f}"
|
78
78
|
else:
|
79
|
-
return f"{float(self.tao):,.4f} {self.unit}\u200e"
|
79
|
+
return f"\u200e{float(self.tao):,.4f} {self.unit}\u200e"
|
80
80
|
|
81
81
|
def __rich__(self):
|
82
82
|
return "[green]{}[/green][green]{}[/green][green].[/green][dim green]{}[/dim green]".format(
|
@@ -156,7 +156,7 @@ class SubnetHyperparameters(InfoBase):
|
|
156
156
|
def _fix_decoded(
|
157
157
|
cls, decoded: Union[dict, "SubnetHyperparameters"]
|
158
158
|
) -> "SubnetHyperparameters":
|
159
|
-
return
|
159
|
+
return cls(
|
160
160
|
rho=decoded.get("rho"),
|
161
161
|
kappa=decoded.get("kappa"),
|
162
162
|
immunity_period=decoded.get("immunity_period"),
|
@@ -197,6 +197,7 @@ class StakeInfo(InfoBase):
|
|
197
197
|
stake: Balance # Stake for the hotkey-coldkey pair
|
198
198
|
locked: Balance # Stake which is locked.
|
199
199
|
emission: Balance # Emission for the hotkey-coldkey pair
|
200
|
+
tao_emission: Balance # TAO emission for the hotkey-coldkey pair
|
200
201
|
drain: int
|
201
202
|
is_registered: bool
|
202
203
|
|
@@ -208,11 +209,20 @@ class StakeInfo(InfoBase):
|
|
208
209
|
stake = Balance.from_rao(decoded.get("stake")).set_unit(netuid)
|
209
210
|
locked = Balance.from_rao(decoded.get("locked")).set_unit(netuid)
|
210
211
|
emission = Balance.from_rao(decoded.get("emission")).set_unit(netuid)
|
212
|
+
tao_emission = Balance.from_rao(decoded.get("tao_emission"))
|
211
213
|
drain = int(decoded.get("drain"))
|
212
214
|
is_registered = bool(decoded.get("is_registered"))
|
213
215
|
|
214
|
-
return
|
215
|
-
hotkey,
|
216
|
+
return cls(
|
217
|
+
hotkey,
|
218
|
+
coldkey,
|
219
|
+
netuid,
|
220
|
+
stake,
|
221
|
+
locked,
|
222
|
+
emission,
|
223
|
+
tao_emission,
|
224
|
+
drain,
|
225
|
+
is_registered,
|
216
226
|
)
|
217
227
|
|
218
228
|
|
@@ -293,7 +303,7 @@ class NeuronInfo(InfoBase):
|
|
293
303
|
axon_info = decoded.get("axon_info", {})
|
294
304
|
coldkey = decode_account_id(decoded.get("coldkey"))
|
295
305
|
hotkey = decode_account_id(decoded.get("hotkey"))
|
296
|
-
return
|
306
|
+
return cls(
|
297
307
|
hotkey=hotkey,
|
298
308
|
coldkey=coldkey,
|
299
309
|
uid=decoded.get("uid"),
|
@@ -555,7 +565,7 @@ class SubnetInfo(InfoBase):
|
|
555
565
|
|
556
566
|
@classmethod
|
557
567
|
def _fix_decoded(cls, decoded: "SubnetInfo") -> "SubnetInfo":
|
558
|
-
return
|
568
|
+
return cls(
|
559
569
|
netuid=decoded.get("netuid"),
|
560
570
|
rho=decoded.get("rho"),
|
561
571
|
kappa=decoded.get("kappa"),
|
@@ -594,7 +604,7 @@ class SubnetIdentity(InfoBase):
|
|
594
604
|
|
595
605
|
@classmethod
|
596
606
|
def _fix_decoded(cls, decoded: dict) -> "SubnetIdentity":
|
597
|
-
return
|
607
|
+
return cls(
|
598
608
|
subnet_name=bytes(decoded["subnet_name"]).decode(),
|
599
609
|
github_repo=bytes(decoded["github_repo"]).decode(),
|
600
610
|
subnet_contact=bytes(decoded["subnet_contact"]).decode(),
|
@@ -828,7 +838,7 @@ class SubnetState(InfoBase):
|
|
828
838
|
@classmethod
|
829
839
|
def _fix_decoded(cls, decoded: Any) -> "SubnetState":
|
830
840
|
netuid = decoded.get("netuid")
|
831
|
-
return
|
841
|
+
return cls(
|
832
842
|
netuid=netuid,
|
833
843
|
hotkeys=[decode_account_id(val) for val in decoded.get("hotkeys")],
|
834
844
|
coldkeys=[decode_account_id(val) for val in decoded.get("coldkeys")],
|
@@ -112,8 +112,8 @@ class SubtensorInterface:
|
|
112
112
|
f"[yellow]Connecting to Substrate:[/yellow][bold white] {self}..."
|
113
113
|
):
|
114
114
|
try:
|
115
|
-
|
116
|
-
|
115
|
+
await self.substrate.initialize()
|
116
|
+
return self
|
117
117
|
except TimeoutError: # TODO verify
|
118
118
|
err_console.print(
|
119
119
|
"\n[red]Error[/red]: Timeout occurred connecting to substrate. "
|
@@ -352,7 +352,7 @@ class SubtensorInterface:
|
|
352
352
|
*ss58_addresses,
|
353
353
|
block_hash: Optional[str] = None,
|
354
354
|
reuse_block: bool = False,
|
355
|
-
) -> dict[str, Balance]:
|
355
|
+
) -> dict[str, tuple[Balance, Balance]]:
|
356
356
|
"""
|
357
357
|
Returns the total stake held on a coldkey.
|
358
358
|
|
@@ -370,7 +370,8 @@ class SubtensorInterface:
|
|
370
370
|
|
371
371
|
results = {}
|
372
372
|
for ss58, stake_info_list in sub_stakes.items():
|
373
|
-
|
373
|
+
total_tao_value = Balance(0)
|
374
|
+
total_swapped_tao_value = Balance(0)
|
374
375
|
for sub_stake in stake_info_list:
|
375
376
|
if sub_stake.stake.rao == 0:
|
376
377
|
continue
|
@@ -381,19 +382,20 @@ class SubtensorInterface:
|
|
381
382
|
netuid
|
382
383
|
)
|
383
384
|
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
tao_ownership = Balance(0)
|
385
|
+
# Without slippage
|
386
|
+
tao_value = pool.alpha_to_tao(alpha_value)
|
387
|
+
total_tao_value += tao_value
|
388
388
|
|
389
|
-
|
390
|
-
|
391
|
-
|
389
|
+
# With slippage
|
390
|
+
if netuid == 0:
|
391
|
+
swapped_tao_value = tao_value
|
392
|
+
else:
|
393
|
+
swapped_tao_value, _, _ = pool.alpha_to_tao_with_slippage(
|
394
|
+
sub_stake.stake
|
392
395
|
)
|
396
|
+
total_swapped_tao_value += swapped_tao_value
|
393
397
|
|
394
|
-
|
395
|
-
|
396
|
-
results[ss58] = Balance.from_rao(all_staked_tao)
|
398
|
+
results[ss58] = (total_tao_value, total_swapped_tao_value)
|
397
399
|
return results
|
398
400
|
|
399
401
|
async def get_total_stake_for_hotkey(
|
@@ -107,9 +107,7 @@ async def stake_add(
|
|
107
107
|
)
|
108
108
|
return
|
109
109
|
else:
|
110
|
-
err_out(
|
111
|
-
f"\n{failure_prelude} with error: {format_error_message(e)}"
|
112
|
-
)
|
110
|
+
err_out(f"\n{failure_prelude} with error: {format_error_message(e)}")
|
113
111
|
return
|
114
112
|
else:
|
115
113
|
await response.process_events()
|
@@ -180,9 +178,7 @@ async def stake_add(
|
|
180
178
|
extrinsic, wait_for_inclusion=True, wait_for_finalization=False
|
181
179
|
)
|
182
180
|
except SubstrateRequestException as e:
|
183
|
-
err_out(
|
184
|
-
f"\n{failure_prelude} with error: {format_error_message(e)}"
|
185
|
-
)
|
181
|
+
err_out(f"\n{failure_prelude} with error: {format_error_message(e)}")
|
186
182
|
return
|
187
183
|
else:
|
188
184
|
await response.process_events()
|
@@ -256,7 +256,7 @@ async def get_childkey_take(subtensor, hotkey: str, netuid: int) -> Optional[int
|
|
256
256
|
params=[hotkey, netuid],
|
257
257
|
)
|
258
258
|
if childkey_take_:
|
259
|
-
return int(childkey_take_
|
259
|
+
return int(childkey_take_)
|
260
260
|
|
261
261
|
except SubstrateRequestException as e:
|
262
262
|
err_console.print(f"Error querying ChildKeys: {format_error_message(e)}")
|
@@ -58,7 +58,6 @@ async def stake_list(
|
|
58
58
|
def define_table(
|
59
59
|
hotkey_name: str,
|
60
60
|
rows: list[list[str]],
|
61
|
-
total_tao_ownership: Balance,
|
62
61
|
total_tao_value: Balance,
|
63
62
|
total_swapped_tao_value: Balance,
|
64
63
|
live: bool = False,
|
@@ -130,6 +129,11 @@ async def stake_list(
|
|
130
129
|
style=COLOR_PALETTE["POOLS"]["EMISSION"],
|
131
130
|
justify="right",
|
132
131
|
)
|
132
|
+
table.add_column(
|
133
|
+
f"[white]Emission \n({Balance.get_unit(0)}/block)",
|
134
|
+
style=COLOR_PALETTE["POOLS"]["EMISSION"],
|
135
|
+
justify="right",
|
136
|
+
)
|
133
137
|
return table
|
134
138
|
|
135
139
|
def create_table(hotkey_: str, substakes: list[StakeInfo]):
|
@@ -139,7 +143,6 @@ async def stake_list(
|
|
139
143
|
else hotkey_
|
140
144
|
)
|
141
145
|
rows = []
|
142
|
-
total_tao_ownership = Balance(0)
|
143
146
|
total_tao_value = Balance(0)
|
144
147
|
total_swapped_tao_value = Balance(0)
|
145
148
|
root_stakes = [s for s in substakes if s.netuid == 0]
|
@@ -155,14 +158,6 @@ async def stake_list(
|
|
155
158
|
netuid = substake_.netuid
|
156
159
|
pool = dynamic_info[netuid]
|
157
160
|
symbol = f"{Balance.get_unit(netuid)}\u200e"
|
158
|
-
# TODO: what is this price var for?
|
159
|
-
price = (
|
160
|
-
"{:.4f}{}".format(
|
161
|
-
pool.price.__float__(), f" τ/{Balance.get_unit(netuid)}\u200e"
|
162
|
-
)
|
163
|
-
if pool.is_dynamic
|
164
|
-
else (f" 1.0000 τ/{symbol} ")
|
165
|
-
)
|
166
161
|
|
167
162
|
# Alpha value cell
|
168
163
|
alpha_value = Balance.from_rao(int(substake_.stake.rao)).set_unit(netuid)
|
@@ -192,30 +187,11 @@ async def stake_list(
|
|
192
187
|
else f"{swapped_tao_value} ({slippage_percentage})"
|
193
188
|
)
|
194
189
|
|
195
|
-
# TAO locked cell
|
196
|
-
tao_locked = pool.tao_in
|
197
|
-
|
198
|
-
# Issuance cell
|
199
|
-
issuance = pool.alpha_out if pool.is_dynamic else tao_locked
|
200
|
-
|
201
190
|
# Per block emission cell
|
202
191
|
per_block_emission = substake_.emission.tao / (pool.tempo or 1)
|
192
|
+
per_block_tao_emission = substake_.tao_emission.tao / (pool.tempo or 1)
|
203
193
|
# Alpha ownership and TAO ownership cells
|
204
194
|
if alpha_value.tao > 0.00009:
|
205
|
-
if issuance.tao != 0:
|
206
|
-
# TODO figure out why this alpha_ownership does nothing
|
207
|
-
alpha_ownership = "{:.4f}".format(
|
208
|
-
(alpha_value.tao / issuance.tao) * 100
|
209
|
-
)
|
210
|
-
tao_ownership = Balance.from_tao(
|
211
|
-
(alpha_value.tao / issuance.tao) * tao_locked.tao
|
212
|
-
)
|
213
|
-
total_tao_ownership += tao_ownership
|
214
|
-
else:
|
215
|
-
# TODO what's this var for?
|
216
|
-
alpha_ownership = "0.0000"
|
217
|
-
tao_ownership = Balance.from_tao(0)
|
218
|
-
|
219
195
|
stake_value = (
|
220
196
|
millify_tao(substake_.stake.tao)
|
221
197
|
if not verbose
|
@@ -243,15 +219,14 @@ async def stake_list(
|
|
243
219
|
# Removing this flag for now, TODO: Confirm correct values are here w.r.t CHKs
|
244
220
|
# if substake_.is_registered
|
245
221
|
# else f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]N/A", # Emission(α/block)
|
222
|
+
str(Balance.from_tao(per_block_tao_emission)),
|
246
223
|
]
|
247
224
|
)
|
248
|
-
table = define_table(
|
249
|
-
name, rows, total_tao_ownership, total_tao_value, total_swapped_tao_value
|
250
|
-
)
|
225
|
+
table = define_table(name, rows, total_tao_value, total_swapped_tao_value)
|
251
226
|
for row in rows:
|
252
227
|
table.add_row(*row)
|
253
228
|
console.print(table)
|
254
|
-
return
|
229
|
+
return total_tao_value, total_swapped_tao_value
|
255
230
|
|
256
231
|
def create_live_table(
|
257
232
|
substakes: list,
|
@@ -263,7 +238,6 @@ async def stake_list(
|
|
263
238
|
rows = []
|
264
239
|
current_data = {}
|
265
240
|
|
266
|
-
total_tao_ownership = Balance(0)
|
267
241
|
total_tao_value = Balance(0)
|
268
242
|
total_swapped_tao_value = Balance(0)
|
269
243
|
|
@@ -324,17 +298,6 @@ async def stake_list(
|
|
324
298
|
)
|
325
299
|
total_swapped_tao_value += swapped_tao_value
|
326
300
|
|
327
|
-
# Calculate TAO ownership
|
328
|
-
tao_locked = pool.tao_in
|
329
|
-
issuance = pool.alpha_out if pool.is_dynamic else tao_locked
|
330
|
-
if alpha_value.tao > 0.00009 and issuance.tao != 0:
|
331
|
-
tao_ownership = Balance.from_tao(
|
332
|
-
(alpha_value.tao / issuance.tao) * tao_locked.tao
|
333
|
-
)
|
334
|
-
total_tao_ownership += tao_ownership
|
335
|
-
else:
|
336
|
-
tao_ownership = Balance.from_tao(0)
|
337
|
-
|
338
301
|
# Store current values for future delta tracking
|
339
302
|
current_data[netuid] = {
|
340
303
|
"stake": alpha_value.tao,
|
@@ -342,7 +305,7 @@ async def stake_list(
|
|
342
305
|
"tao_value": tao_value.tao,
|
343
306
|
"swapped_value": swapped_tao_value.tao,
|
344
307
|
"emission": substake.emission.tao / (pool.tempo or 1),
|
345
|
-
"
|
308
|
+
"tao_emission": substake.tao_emission.tao / (pool.tempo or 1),
|
346
309
|
}
|
347
310
|
|
348
311
|
# Get previous values for delta tracking
|
@@ -399,6 +362,16 @@ async def stake_list(
|
|
399
362
|
unit_first=unit_first,
|
400
363
|
precision=4,
|
401
364
|
)
|
365
|
+
|
366
|
+
tao_emission_value = substake.tao_emission.tao / (pool.tempo or 1)
|
367
|
+
tao_emission_cell = format_cell(
|
368
|
+
tao_emission_value,
|
369
|
+
prev.get("tao_emission"),
|
370
|
+
unit="τ",
|
371
|
+
unit_first=unit_first,
|
372
|
+
precision=4,
|
373
|
+
)
|
374
|
+
|
402
375
|
subnet_name_cell = (
|
403
376
|
f"[{COLOR_PALETTE['GENERAL']['SYMBOL']}]{symbol if netuid != 0 else 'τ'}[/{COLOR_PALETTE['GENERAL']['SYMBOL']}]"
|
404
377
|
f" {get_subnet_name(dynamic_info[netuid])}"
|
@@ -416,13 +389,13 @@ async def stake_list(
|
|
416
389
|
if substake.is_registered
|
417
390
|
else f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]NO", # Registration status
|
418
391
|
emission_cell, # Emission rate
|
392
|
+
tao_emission_cell, # TAO emission rate
|
419
393
|
]
|
420
394
|
)
|
421
395
|
|
422
396
|
table = define_table(
|
423
397
|
hotkey_name,
|
424
398
|
rows,
|
425
|
-
total_tao_ownership,
|
426
399
|
total_tao_value,
|
427
400
|
total_swapped_tao_value,
|
428
401
|
live=True,
|
@@ -458,7 +431,7 @@ async def stake_list(
|
|
458
431
|
raise typer.Exit()
|
459
432
|
|
460
433
|
if live:
|
461
|
-
# Select one
|
434
|
+
# Select one hotkey for live monitoring
|
462
435
|
if len(hotkeys_to_substakes) > 1:
|
463
436
|
console.print(
|
464
437
|
"\n[bold]Multiple hotkeys found. Please select one for live monitoring:[/bold]"
|
@@ -562,27 +535,29 @@ async def stake_list(
|
|
562
535
|
# Iterate over each hotkey and make a table
|
563
536
|
counter = 0
|
564
537
|
num_hotkeys = len(hotkeys_to_substakes)
|
565
|
-
|
566
|
-
|
538
|
+
all_hks_swapped_tao_value = Balance(0)
|
539
|
+
all_hks_tao_value = Balance(0)
|
567
540
|
for hotkey in hotkeys_to_substakes.keys():
|
568
541
|
counter += 1
|
569
|
-
|
570
|
-
|
571
|
-
|
542
|
+
tao_value, swapped_tao_value = create_table(
|
543
|
+
hotkey, hotkeys_to_substakes[hotkey]
|
544
|
+
)
|
545
|
+
all_hks_tao_value += tao_value
|
546
|
+
all_hks_swapped_tao_value += swapped_tao_value
|
572
547
|
|
573
548
|
if num_hotkeys > 1 and counter < num_hotkeys and prompt:
|
574
549
|
console.print("\nPress Enter to continue to the next hotkey...")
|
575
550
|
input()
|
576
551
|
|
577
552
|
total_tao_value = (
|
578
|
-
f"τ {millify_tao(
|
553
|
+
f"τ {millify_tao(all_hks_tao_value.tao)}"
|
579
554
|
if not verbose
|
580
|
-
else
|
555
|
+
else all_hks_tao_value
|
581
556
|
)
|
582
|
-
|
583
|
-
f"τ {millify_tao(
|
557
|
+
total_swapped_tao_value = (
|
558
|
+
f"τ {millify_tao(all_hks_swapped_tao_value.tao)}"
|
584
559
|
if not verbose
|
585
|
-
else
|
560
|
+
else all_hks_swapped_tao_value
|
586
561
|
)
|
587
562
|
|
588
563
|
console.print("\n\n")
|
@@ -590,8 +565,8 @@ async def stake_list(
|
|
590
565
|
f"Wallet:\n"
|
591
566
|
f" Coldkey SS58: [{COLOR_PALETTE['GENERAL']['COLDKEY']}]{coldkey_address}[/{COLOR_PALETTE['GENERAL']['COLDKEY']}]\n"
|
592
567
|
f" Free Balance: [{COLOR_PALETTE['GENERAL']['BALANCE']}]{balance}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]\n"
|
593
|
-
f" Total TAO ({Balance.unit}): [{COLOR_PALETTE['GENERAL']['BALANCE']}]{
|
594
|
-
f" Total Value ({Balance.unit}): [{COLOR_PALETTE['GENERAL']['BALANCE']}]{
|
568
|
+
f" Total TAO Value ({Balance.unit}): [{COLOR_PALETTE['GENERAL']['BALANCE']}]{total_tao_value}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]\n"
|
569
|
+
f" Total TAO Swapped Value ({Balance.unit}): [{COLOR_PALETTE['GENERAL']['BALANCE']}]{total_swapped_tao_value}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]"
|
595
570
|
)
|
596
571
|
if not sub_stakes:
|
597
572
|
console.print(
|
@@ -905,7 +905,7 @@ async def swap_stake(
|
|
905
905
|
)
|
906
906
|
|
907
907
|
if swap_all:
|
908
|
-
amount_to_swap =
|
908
|
+
amount_to_swap = current_stake.set_unit(origin_netuid)
|
909
909
|
else:
|
910
910
|
amount_to_swap = Balance.from_tao(amount).set_unit(origin_netuid)
|
911
911
|
|