bittensor-cli 9.8.7__py3-none-any.whl → 9.10.0__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/cli.py +229 -55
- bittensor_cli/src/bittensor/extrinsics/registration.py +29 -25
- bittensor_cli/src/bittensor/extrinsics/root.py +6 -5
- bittensor_cli/src/bittensor/extrinsics/transfer.py +35 -18
- bittensor_cli/src/bittensor/subtensor_interface.py +34 -15
- bittensor_cli/src/bittensor/utils.py +13 -1
- bittensor_cli/src/commands/stake/add.py +86 -30
- bittensor_cli/src/commands/stake/children_hotkeys.py +16 -14
- bittensor_cli/src/commands/stake/move.py +106 -84
- bittensor_cli/src/commands/stake/remove.py +119 -11
- bittensor_cli/src/commands/subnets/price.py +126 -30
- bittensor_cli/src/commands/subnets/subnets.py +3 -2
- bittensor_cli/src/commands/sudo.py +13 -11
- bittensor_cli/src/commands/wallets.py +159 -19
- bittensor_cli/src/commands/weights.py +2 -1
- {bittensor_cli-9.8.7.dist-info → bittensor_cli-9.10.0.dist-info}/METADATA +14 -6
- {bittensor_cli-9.8.7.dist-info → bittensor_cli-9.10.0.dist-info}/RECORD +20 -20
- {bittensor_cli-9.8.7.dist-info → bittensor_cli-9.10.0.dist-info}/WHEEL +0 -0
- {bittensor_cli-9.8.7.dist-info → bittensor_cli-9.10.0.dist-info}/entry_points.txt +0 -0
- {bittensor_cli-9.8.7.dist-info → bittensor_cli-9.10.0.dist-info}/top_level.txt +0 -0
@@ -22,6 +22,7 @@ from bittensor_cli.src.bittensor.utils import (
|
|
22
22
|
group_subnets,
|
23
23
|
unlock_key,
|
24
24
|
json_console,
|
25
|
+
get_hotkey_pub_ss58,
|
25
26
|
)
|
26
27
|
|
27
28
|
if TYPE_CHECKING:
|
@@ -47,6 +48,7 @@ async def unstake(
|
|
47
48
|
era: int,
|
48
49
|
):
|
49
50
|
"""Unstake from hotkey(s)."""
|
51
|
+
|
50
52
|
with console.status(
|
51
53
|
f"Retrieving subnet data & identities from {subtensor.network}...",
|
52
54
|
spinner="earth",
|
@@ -82,7 +84,7 @@ async def unstake(
|
|
82
84
|
hotkey_to_unstake_all = hotkeys_to_unstake_from[0]
|
83
85
|
unstake_all_alpha = Confirm.ask(
|
84
86
|
"\nDo you want to:\n"
|
85
|
-
"[blue]Yes[/blue]: Unstake from all subnets and automatically
|
87
|
+
"[blue]Yes[/blue]: Unstake from all subnets and automatically re-stake to subnet 0 (root)\n"
|
86
88
|
"[blue]No[/blue]: Unstake everything (including subnet 0)",
|
87
89
|
default=True,
|
88
90
|
)
|
@@ -210,8 +212,38 @@ async def unstake(
|
|
210
212
|
|
211
213
|
try:
|
212
214
|
current_price = subnet_info.price.tao
|
215
|
+
if safe_staking:
|
216
|
+
if subnet_info.is_dynamic:
|
217
|
+
price_with_tolerance = current_price * (1 - rate_tolerance)
|
218
|
+
rate_with_tolerance = price_with_tolerance
|
219
|
+
price_limit = Balance.from_tao(
|
220
|
+
rate_with_tolerance
|
221
|
+
) # Actual price to pass to extrinsic
|
222
|
+
else:
|
223
|
+
price_limit = Balance.from_rao(1)
|
224
|
+
extrinsic_fee = await _get_extrinsic_fee(
|
225
|
+
"unstake_safe",
|
226
|
+
wallet,
|
227
|
+
subtensor,
|
228
|
+
hotkey_ss58=staking_address_ss58,
|
229
|
+
amount=amount_to_unstake_as_balance,
|
230
|
+
netuid=netuid,
|
231
|
+
price_limit=price_limit,
|
232
|
+
allow_partial_stake=allow_partial_stake,
|
233
|
+
)
|
234
|
+
else:
|
235
|
+
extrinsic_fee = await _get_extrinsic_fee(
|
236
|
+
"unstake",
|
237
|
+
wallet,
|
238
|
+
subtensor,
|
239
|
+
hotkey_ss58=staking_address_ss58,
|
240
|
+
netuid=netuid,
|
241
|
+
amount=amount_to_unstake_as_balance,
|
242
|
+
)
|
213
243
|
rate = current_price
|
214
|
-
received_amount =
|
244
|
+
received_amount = (
|
245
|
+
(amount_to_unstake_as_balance - stake_fee) * rate
|
246
|
+
) - extrinsic_fee
|
215
247
|
except ValueError:
|
216
248
|
continue
|
217
249
|
total_received_amount += received_amount
|
@@ -233,8 +265,9 @@ async def unstake(
|
|
233
265
|
staking_address_name, # Hotkey Name
|
234
266
|
str(amount_to_unstake_as_balance), # Amount to Unstake
|
235
267
|
f"{subnet_info.price.tao:.6f}"
|
236
|
-
+ f"({Balance.get_unit(
|
268
|
+
+ f"(τ/{Balance.get_unit(netuid)})", # Rate
|
237
269
|
str(stake_fee.set_unit(netuid)), # Fee
|
270
|
+
str(extrinsic_fee), # Extrinsic fee
|
238
271
|
str(received_amount), # Received Amount
|
239
272
|
# slippage_pct, # Slippage Percent
|
240
273
|
]
|
@@ -375,7 +408,7 @@ async def unstake_all(
|
|
375
408
|
old_identities=old_identities,
|
376
409
|
)
|
377
410
|
elif not hotkey_ss58_address:
|
378
|
-
hotkeys = [(wallet.hotkey_str, wallet
|
411
|
+
hotkeys = [(wallet.hotkey_str, get_hotkey_pub_ss58(wallet), None)]
|
379
412
|
else:
|
380
413
|
hotkeys = [(None, hotkey_ss58_address, None)]
|
381
414
|
|
@@ -431,10 +464,15 @@ async def unstake_all(
|
|
431
464
|
style=COLOR_PALETTE["POOLS"]["RATE"],
|
432
465
|
)
|
433
466
|
table.add_column(
|
434
|
-
f"Fee ({Balance.
|
467
|
+
f"Fee ({Balance.get_unit(1)})",
|
435
468
|
justify="center",
|
436
469
|
style=COLOR_PALETTE["STAKE"]["STAKE_AMOUNT"],
|
437
470
|
)
|
471
|
+
table.add_column(
|
472
|
+
"Extrinsic Fee (τ)",
|
473
|
+
justify="center",
|
474
|
+
style=COLOR_PALETTE.STAKE.TAO,
|
475
|
+
)
|
438
476
|
table.add_column(
|
439
477
|
f"Received ({Balance.unit})",
|
440
478
|
justify="center",
|
@@ -467,8 +505,17 @@ async def unstake_all(
|
|
467
505
|
|
468
506
|
try:
|
469
507
|
current_price = subnet_info.price.tao
|
508
|
+
extrinsic_type = (
|
509
|
+
"unstake_all" if not unstake_all_alpha else "unstake_all_alpha"
|
510
|
+
)
|
511
|
+
extrinsic_fee = await _get_extrinsic_fee(
|
512
|
+
extrinsic_type,
|
513
|
+
wallet,
|
514
|
+
subtensor,
|
515
|
+
hotkey_ss58=stake.hotkey_ss58,
|
516
|
+
)
|
470
517
|
rate = current_price
|
471
|
-
received_amount = stake_amount * rate -
|
518
|
+
received_amount = ((stake_amount - stake_fee) * rate) - extrinsic_fee
|
472
519
|
|
473
520
|
if received_amount < Balance.from_tao(0):
|
474
521
|
print_error("Not enough Alpha to pay the transaction fee.")
|
@@ -485,6 +532,7 @@ async def unstake_all(
|
|
485
532
|
f"{float(subnet_info.price):.6f}"
|
486
533
|
+ f"({Balance.get_unit(0)}/{Balance.get_unit(stake.netuid)})",
|
487
534
|
str(stake_fee),
|
535
|
+
str(extrinsic_fee),
|
488
536
|
str(received_amount),
|
489
537
|
)
|
490
538
|
console.print(table)
|
@@ -830,6 +878,63 @@ async def _unstake_all_extrinsic(
|
|
830
878
|
err_out(f"{failure_prelude} with error: {str(e)}")
|
831
879
|
|
832
880
|
|
881
|
+
async def _get_extrinsic_fee(
|
882
|
+
_type: str,
|
883
|
+
wallet: Wallet,
|
884
|
+
subtensor: "SubtensorInterface",
|
885
|
+
hotkey_ss58: str,
|
886
|
+
netuid: Optional[int] = None,
|
887
|
+
amount: Optional[Balance] = None,
|
888
|
+
price_limit: Optional[Balance] = None,
|
889
|
+
allow_partial_stake: bool = False,
|
890
|
+
) -> Balance:
|
891
|
+
"""
|
892
|
+
Retrieves the extrinsic fee for a given unstaking call.
|
893
|
+
Args:
|
894
|
+
_type: 'unstake', 'unstake_safe', 'unstake_all', 'unstake_all_alpha' depending on the specific
|
895
|
+
extrinsic to be called
|
896
|
+
wallet: Wallet object
|
897
|
+
subtensor: SubtensorInterface object
|
898
|
+
hotkey_ss58: the hotkey ss58 to unstake from
|
899
|
+
netuid: the netuid from which to remove the stake
|
900
|
+
amount: the amount of stake to remove
|
901
|
+
price_limit: the price limit
|
902
|
+
allow_partial_stake: whether to allow partial unstaking
|
903
|
+
|
904
|
+
Returns:
|
905
|
+
Balance object representing the extrinsic fee.
|
906
|
+
"""
|
907
|
+
lookup_table = {
|
908
|
+
"unstake": lambda: (
|
909
|
+
"remove_stake",
|
910
|
+
{
|
911
|
+
"hotkey": hotkey_ss58,
|
912
|
+
"netuid": netuid,
|
913
|
+
"amount_unstaked": amount.rao,
|
914
|
+
},
|
915
|
+
),
|
916
|
+
"unstake_safe": lambda: (
|
917
|
+
"remove_stake_limit",
|
918
|
+
{
|
919
|
+
"hotkey": hotkey_ss58,
|
920
|
+
"netuid": netuid,
|
921
|
+
"amount_unstaked": amount.rao,
|
922
|
+
"limit_price": price_limit,
|
923
|
+
"allow_partial": allow_partial_stake,
|
924
|
+
},
|
925
|
+
),
|
926
|
+
"unstake_all": lambda: ("unstake_all", {"hotkey": hotkey_ss58}),
|
927
|
+
"unstake_all_alpha": lambda: ("unstake_all_alpha", {"hotkey": hotkey_ss58}),
|
928
|
+
}
|
929
|
+
call_fn, call_params = lookup_table[_type]()
|
930
|
+
call = await subtensor.substrate.compose_call(
|
931
|
+
call_module="SubtensorModule",
|
932
|
+
call_function=call_fn,
|
933
|
+
call_params=call_params,
|
934
|
+
)
|
935
|
+
return await subtensor.get_extrinsic_fee(call, wallet.coldkeypub)
|
936
|
+
|
937
|
+
|
833
938
|
# Helpers
|
834
939
|
async def _unstake_selection(
|
835
940
|
dynamic_info,
|
@@ -1094,7 +1199,7 @@ def _get_hotkeys_to_unstake(
|
|
1094
1199
|
print_verbose("Unstaking from all hotkeys")
|
1095
1200
|
all_hotkeys_ = get_hotkey_wallets_for_wallet(wallet=wallet)
|
1096
1201
|
wallet_hotkeys = [
|
1097
|
-
(wallet.hotkey_str, wallet
|
1202
|
+
(wallet.hotkey_str, get_hotkey_pub_ss58(wallet), None)
|
1098
1203
|
for wallet in all_hotkeys_
|
1099
1204
|
if wallet.hotkey_str not in exclude_hotkeys
|
1100
1205
|
]
|
@@ -1126,7 +1231,7 @@ def _get_hotkeys_to_unstake(
|
|
1126
1231
|
path=wallet.path,
|
1127
1232
|
hotkey=hotkey_identifier,
|
1128
1233
|
)
|
1129
|
-
result.append((wallet_.hotkey_str, wallet_
|
1234
|
+
result.append((wallet_.hotkey_str, get_hotkey_pub_ss58(wallet_), None))
|
1130
1235
|
return result
|
1131
1236
|
|
1132
1237
|
# Only cli.config.wallet.hotkey is specified
|
@@ -1134,7 +1239,7 @@ def _get_hotkeys_to_unstake(
|
|
1134
1239
|
f"Unstaking from wallet: ({wallet.name}) from hotkey: ({wallet.hotkey_str})"
|
1135
1240
|
)
|
1136
1241
|
assert wallet.hotkey is not None
|
1137
|
-
return [(wallet.hotkey_str, wallet
|
1242
|
+
return [(wallet.hotkey_str, get_hotkey_pub_ss58(wallet), None)]
|
1138
1243
|
|
1139
1244
|
|
1140
1245
|
def _create_unstake_table(
|
@@ -1184,7 +1289,7 @@ def _create_unstake_table(
|
|
1184
1289
|
style=COLOR_PALETTE["POOLS"]["TAO"],
|
1185
1290
|
)
|
1186
1291
|
table.add_column(
|
1187
|
-
f"Rate ({Balance.get_unit(
|
1292
|
+
f"Rate (τ/{Balance.get_unit(1)})",
|
1188
1293
|
justify="center",
|
1189
1294
|
style=COLOR_PALETTE["POOLS"]["RATE"],
|
1190
1295
|
)
|
@@ -1194,7 +1299,10 @@ def _create_unstake_table(
|
|
1194
1299
|
style=COLOR_PALETTE["STAKE"]["STAKE_AMOUNT"],
|
1195
1300
|
)
|
1196
1301
|
table.add_column(
|
1197
|
-
|
1302
|
+
"Extrinsic Fee (τ)", justify="center", style=COLOR_PALETTE.STAKE.TAO
|
1303
|
+
)
|
1304
|
+
table.add_column(
|
1305
|
+
"Received (τ)",
|
1198
1306
|
justify="center",
|
1199
1307
|
style=COLOR_PALETTE["POOLS"]["TAO_EQUIV"],
|
1200
1308
|
footer=str(total_received_amount),
|
@@ -10,6 +10,7 @@ import plotille
|
|
10
10
|
import plotly.graph_objects as go
|
11
11
|
|
12
12
|
from bittensor_cli.src import COLOR_PALETTE
|
13
|
+
from bittensor_cli.src.bittensor.chain_data import DynamicInfo
|
13
14
|
from bittensor_cli.src.bittensor.utils import (
|
14
15
|
console,
|
15
16
|
err_console,
|
@@ -27,7 +28,8 @@ async def price(
|
|
27
28
|
subtensor: "SubtensorInterface",
|
28
29
|
netuids: list[int],
|
29
30
|
all_netuids: bool = False,
|
30
|
-
interval_hours: int =
|
31
|
+
interval_hours: int = 4,
|
32
|
+
current_only: bool = False,
|
31
33
|
html_output: bool = False,
|
32
34
|
log_scale: bool = False,
|
33
35
|
json_output: bool = False,
|
@@ -41,45 +43,96 @@ async def price(
|
|
41
43
|
blocks_per_hour = int(3600 / 12) # ~300 blocks per hour
|
42
44
|
total_blocks = blocks_per_hour * interval_hours
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
-
|
46
|
+
if not current_only:
|
47
|
+
with console.status(":chart_increasing: Fetching historical price data..."):
|
48
|
+
current_block_hash = await subtensor.substrate.get_chain_head()
|
49
|
+
current_block = await subtensor.substrate.get_block_number(
|
50
|
+
current_block_hash
|
51
|
+
)
|
47
52
|
|
48
|
-
|
49
|
-
|
50
|
-
|
53
|
+
step = 300
|
54
|
+
start_block = max(0, current_block - total_blocks)
|
55
|
+
block_numbers = list(range(start_block, current_block + 1, step))
|
51
56
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
+
# Block hashes
|
58
|
+
block_hash_cors = [
|
59
|
+
subtensor.substrate.get_block_hash(bn) for bn in block_numbers
|
60
|
+
]
|
61
|
+
block_hashes = await asyncio.gather(*block_hash_cors)
|
57
62
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
# We fetch all subnets when there is more than one netuid
|
64
|
+
if all_netuids or len(netuids) > 1:
|
65
|
+
subnet_info_cors = [subtensor.all_subnets(bh) for bh in block_hashes]
|
66
|
+
else:
|
67
|
+
# If there is only one netuid, we fetch the subnet info for that netuid
|
68
|
+
netuid = netuids[0]
|
69
|
+
subnet_info_cors = [subtensor.subnet(netuid, bh) for bh in block_hashes]
|
70
|
+
all_subnet_infos = await asyncio.gather(*subnet_info_cors)
|
66
71
|
|
67
72
|
subnet_data = _process_subnet_data(
|
68
73
|
block_numbers, all_subnet_infos, netuids, all_netuids
|
69
74
|
)
|
75
|
+
if not subnet_data:
|
76
|
+
err_console.print("[red]No valid price data found for any subnet[/red]")
|
77
|
+
return
|
70
78
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
79
|
+
if html_output:
|
80
|
+
await _generate_html_output(
|
81
|
+
subnet_data, block_numbers, interval_hours, log_scale
|
82
|
+
)
|
83
|
+
elif json_output:
|
84
|
+
json_console.print(json.dumps(_generate_json_output(subnet_data)))
|
85
|
+
else:
|
86
|
+
_generate_cli_output(subnet_data, block_numbers, interval_hours, log_scale)
|
87
|
+
else:
|
88
|
+
with console.status("Fetching current price data..."):
|
89
|
+
if all_netuids or len(netuids) > 1:
|
90
|
+
all_subnet_info = await subtensor.all_subnets()
|
91
|
+
else:
|
92
|
+
all_subnet_info = [await subtensor.subnet(netuid=netuids[0])]
|
93
|
+
subnet_data = _process_current_subnet_data(
|
94
|
+
all_subnet_info, netuids, all_netuids
|
78
95
|
)
|
79
|
-
|
80
|
-
|
96
|
+
if json_output:
|
97
|
+
json_console.print(json.dumps(_generate_json_output(subnet_data)))
|
98
|
+
else:
|
99
|
+
_generate_cli_output_current(subnet_data)
|
100
|
+
|
101
|
+
|
102
|
+
def _process_current_subnet_data(subnet_infos: list[DynamicInfo], netuids, all_netuids):
|
103
|
+
subnet_data = {}
|
104
|
+
if all_netuids or len(netuids) > 1:
|
105
|
+
# Most recent data for statistics
|
106
|
+
for subnet_info in subnet_infos:
|
107
|
+
stats = {
|
108
|
+
"current_price": subnet_info.price,
|
109
|
+
"supply": subnet_info.alpha_in.tao + subnet_info.alpha_out.tao,
|
110
|
+
"market_cap": subnet_info.price.tao
|
111
|
+
* (subnet_info.alpha_in.tao + subnet_info.alpha_out.tao),
|
112
|
+
"emission": subnet_info.emission.tao,
|
113
|
+
"stake": subnet_info.alpha_out.tao,
|
114
|
+
"symbol": subnet_info.symbol,
|
115
|
+
"name": get_subnet_name(subnet_info),
|
116
|
+
}
|
117
|
+
subnet_data[subnet_info.netuid] = {
|
118
|
+
"stats": stats,
|
119
|
+
}
|
81
120
|
else:
|
82
|
-
|
121
|
+
subnet_info = subnet_infos[0]
|
122
|
+
stats = {
|
123
|
+
"current_price": subnet_info.price.tao,
|
124
|
+
"supply": subnet_info.alpha_in.tao + subnet_info.alpha_out.tao,
|
125
|
+
"market_cap": subnet_info.price.tao
|
126
|
+
* (subnet_info.alpha_in.tao + subnet_info.alpha_out.tao),
|
127
|
+
"emission": subnet_info.emission.tao,
|
128
|
+
"stake": subnet_info.alpha_out.tao,
|
129
|
+
"symbol": subnet_info.symbol,
|
130
|
+
"name": get_subnet_name(subnet_info),
|
131
|
+
}
|
132
|
+
subnet_data[subnet_info.netuid] = {
|
133
|
+
"stats": stats,
|
134
|
+
}
|
135
|
+
return subnet_data
|
83
136
|
|
84
137
|
|
85
138
|
def _process_subnet_data(block_numbers, all_subnet_infos, netuids, all_netuids):
|
@@ -626,3 +679,46 @@ def _generate_cli_output(subnet_data, block_numbers, interval_hours, log_scale):
|
|
626
679
|
)
|
627
680
|
|
628
681
|
console.print(stats_text)
|
682
|
+
|
683
|
+
|
684
|
+
def _generate_cli_output_current(subnet_data):
|
685
|
+
for netuid, data in subnet_data.items():
|
686
|
+
stats = data["stats"]
|
687
|
+
|
688
|
+
if netuid != 0:
|
689
|
+
console.print(
|
690
|
+
f"\n[{COLOR_PALETTE.G.SYM}]Subnet {netuid} - {stats['symbol']} "
|
691
|
+
f"[cyan]{stats['name']}[/cyan][/{COLOR_PALETTE.G.SYM}]\n"
|
692
|
+
f"Current: [blue]{stats['current_price']:.6f}{stats['symbol']}[/blue]\n"
|
693
|
+
)
|
694
|
+
else:
|
695
|
+
console.print(
|
696
|
+
f"\n[{COLOR_PALETTE.G.SYM}]Subnet {netuid} - {stats['symbol']} "
|
697
|
+
f"[cyan]{stats['name']}[/cyan][/{COLOR_PALETTE.G.SYM}]\n"
|
698
|
+
f"Current: [blue]{stats['symbol']} {stats['current_price']:.6f}[/blue]\n"
|
699
|
+
)
|
700
|
+
|
701
|
+
if netuid != 0:
|
702
|
+
stats_text = (
|
703
|
+
"\nLatest stats:\n"
|
704
|
+
f"Supply: [{COLOR_PALETTE.P.ALPHA_IN}]"
|
705
|
+
f"{stats['supply']:,.2f} {stats['symbol']}[/{COLOR_PALETTE.P.ALPHA_IN}]\n"
|
706
|
+
f"Market Cap: [steel_blue3]{stats['market_cap']:,.2f} {stats['symbol']} / 21M[/steel_blue3]\n"
|
707
|
+
f"Emission: [{COLOR_PALETTE.P.EMISSION}]"
|
708
|
+
f"{stats['emission']:,.2f} {stats['symbol']}[/{COLOR_PALETTE.P.EMISSION}]\n"
|
709
|
+
f"Stake: [{COLOR_PALETTE.S.TAO}]"
|
710
|
+
f"{stats['stake']:,.2f} {stats['symbol']}[/{COLOR_PALETTE.S.TAO}]"
|
711
|
+
)
|
712
|
+
else:
|
713
|
+
stats_text = (
|
714
|
+
"\nLatest stats:\n"
|
715
|
+
f"Supply: [{COLOR_PALETTE.P.ALPHA_IN}]"
|
716
|
+
f"{stats['symbol']} {stats['supply']:,.2f}[/{COLOR_PALETTE.P.ALPHA_IN}]\n"
|
717
|
+
f"Market Cap: [steel_blue3]{stats['symbol']} {stats['market_cap']:,.2f} / 21M[/steel_blue3]\n"
|
718
|
+
f"Emission: [{COLOR_PALETTE.P.EMISSION}]"
|
719
|
+
f"{stats['symbol']} {stats['emission']:,.2f}[/{COLOR_PALETTE.P.EMISSION}]\n"
|
720
|
+
f"Stake: [{COLOR_PALETTE.S.TAO}]"
|
721
|
+
f"{stats['symbol']} {stats['stake']:,.2f}[/{COLOR_PALETTE.S.TAO}]"
|
722
|
+
)
|
723
|
+
|
724
|
+
console.print(stats_text)
|
@@ -36,6 +36,7 @@ from bittensor_cli.src.bittensor.utils import (
|
|
36
36
|
unlock_key,
|
37
37
|
blocks_to_duration,
|
38
38
|
json_console,
|
39
|
+
get_hotkey_pub_ss58,
|
39
40
|
)
|
40
41
|
|
41
42
|
if TYPE_CHECKING:
|
@@ -114,7 +115,7 @@ async def register_subnetwork_extrinsic(
|
|
114
115
|
return False, None
|
115
116
|
|
116
117
|
call_params = {
|
117
|
-
"hotkey": wallet
|
118
|
+
"hotkey": get_hotkey_pub_ss58(wallet),
|
118
119
|
"mechid": 1,
|
119
120
|
}
|
120
121
|
call_function = "register_network"
|
@@ -1654,7 +1655,7 @@ async def register(
|
|
1654
1655
|
str(netuid),
|
1655
1656
|
f"{Balance.get_unit(netuid)}",
|
1656
1657
|
f"τ {current_recycle.tao:.4f}",
|
1657
|
-
f"{wallet
|
1658
|
+
f"{get_hotkey_pub_ss58(wallet)}",
|
1658
1659
|
f"{wallet.coldkeypub.ss58_address}",
|
1659
1660
|
)
|
1660
1661
|
console.print(table)
|
@@ -26,6 +26,7 @@ from bittensor_cli.src.bittensor.utils import (
|
|
26
26
|
json_console,
|
27
27
|
string_to_u16,
|
28
28
|
string_to_u64,
|
29
|
+
get_hotkey_pub_ss58,
|
29
30
|
)
|
30
31
|
|
31
32
|
if TYPE_CHECKING:
|
@@ -497,7 +498,7 @@ async def vote_senate_extrinsic(
|
|
497
498
|
call_module="SubtensorModule",
|
498
499
|
call_function="vote",
|
499
500
|
call_params={
|
500
|
-
"hotkey": wallet
|
501
|
+
"hotkey": get_hotkey_pub_ss58(wallet),
|
501
502
|
"proposal": proposal_hash,
|
502
503
|
"index": proposal_idx,
|
503
504
|
"approve": vote,
|
@@ -513,9 +514,10 @@ async def vote_senate_extrinsic(
|
|
513
514
|
# Successful vote, final check for data
|
514
515
|
else:
|
515
516
|
if vote_data := await subtensor.get_vote_data(proposal_hash):
|
517
|
+
hotkey_ss58 = get_hotkey_pub_ss58(wallet)
|
516
518
|
if (
|
517
|
-
vote_data.ayes.count(
|
518
|
-
or vote_data.nays.count(
|
519
|
+
vote_data.ayes.count(hotkey_ss58) > 0
|
520
|
+
or vote_data.nays.count(hotkey_ss58) > 0
|
519
521
|
):
|
520
522
|
console.print(":white_heavy_check_mark: [green]Vote cast.[/green]")
|
521
523
|
return True
|
@@ -859,10 +861,9 @@ async def senate_vote(
|
|
859
861
|
return False
|
860
862
|
|
861
863
|
print_verbose(f"Fetching senate status of {wallet.hotkey_str}")
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
)
|
864
|
+
hotkey_ss58 = get_hotkey_pub_ss58(wallet)
|
865
|
+
if not await _is_senate_member(subtensor, hotkey_ss58=hotkey_ss58):
|
866
|
+
err_console.print(f"Aborting: Hotkey {hotkey_ss58} isn't a senate member.")
|
866
867
|
return False
|
867
868
|
|
868
869
|
# Unlock the wallet.
|
@@ -890,7 +891,7 @@ async def senate_vote(
|
|
890
891
|
|
891
892
|
|
892
893
|
async def get_current_take(subtensor: "SubtensorInterface", wallet: Wallet):
|
893
|
-
current_take = await subtensor.current_take(wallet
|
894
|
+
current_take = await subtensor.current_take(get_hotkey_pub_ss58(wallet))
|
894
895
|
return current_take
|
895
896
|
|
896
897
|
|
@@ -912,12 +913,13 @@ async def set_take(
|
|
912
913
|
return False
|
913
914
|
|
914
915
|
block_hash = await subtensor.substrate.get_chain_head()
|
916
|
+
hotkey_ss58 = get_hotkey_pub_ss58(wallet)
|
915
917
|
netuids_registered = await subtensor.get_netuids_for_hotkey(
|
916
|
-
|
918
|
+
hotkey_ss58, block_hash=block_hash
|
917
919
|
)
|
918
920
|
if not len(netuids_registered) > 0:
|
919
921
|
err_console.print(
|
920
|
-
f"Hotkey [{COLOR_PALETTE.G.HK}]{
|
922
|
+
f"Hotkey [{COLOR_PALETTE.G.HK}]{hotkey_ss58}[/{COLOR_PALETTE.G.HK}] is not registered to"
|
921
923
|
f" any subnet. Please register using [{COLOR_PALETTE.G.SUBHEAD}]`btcli subnets register`"
|
922
924
|
f"[{COLOR_PALETTE.G.SUBHEAD}] and try again."
|
923
925
|
)
|
@@ -926,7 +928,7 @@ async def set_take(
|
|
926
928
|
result: bool = await set_take_extrinsic(
|
927
929
|
subtensor=subtensor,
|
928
930
|
wallet=wallet,
|
929
|
-
delegate_ss58=
|
931
|
+
delegate_ss58=hotkey_ss58,
|
930
932
|
take=take,
|
931
933
|
)
|
932
934
|
|