bittensor-cli 9.7.1__py3-none-any.whl → 9.8.1__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 +340 -24
- bittensor_cli/src/__init__.py +8 -0
- bittensor_cli/src/bittensor/chain_data.py +81 -33
- bittensor_cli/src/bittensor/subtensor_interface.py +111 -26
- bittensor_cli/src/bittensor/utils.py +9 -0
- bittensor_cli/src/commands/liquidity/__init__.py +0 -0
- bittensor_cli/src/commands/liquidity/liquidity.py +628 -0
- bittensor_cli/src/commands/liquidity/utils.py +200 -0
- bittensor_cli/src/commands/stake/add.py +34 -22
- bittensor_cli/src/commands/stake/list.py +35 -48
- bittensor_cli/src/commands/stake/move.py +18 -44
- bittensor_cli/src/commands/stake/remove.py +33 -95
- bittensor_cli/src/commands/subnets/subnets.py +6 -0
- bittensor_cli/src/commands/sudo.py +21 -8
- bittensor_cli/src/commands/wallets.py +20 -48
- {bittensor_cli-9.7.1.dist-info → bittensor_cli-9.8.1.dist-info}/METADATA +1 -1
- {bittensor_cli-9.7.1.dist-info → bittensor_cli-9.8.1.dist-info}/RECORD +20 -17
- {bittensor_cli-9.7.1.dist-info → bittensor_cli-9.8.1.dist-info}/WHEEL +0 -0
- {bittensor_cli-9.7.1.dist-info → bittensor_cli-9.8.1.dist-info}/entry_points.txt +0 -0
- {bittensor_cli-9.7.1.dist-info → bittensor_cli-9.8.1.dist-info}/top_level.txt +0 -0
@@ -209,16 +209,12 @@ async def unstake(
|
|
209
209
|
)
|
210
210
|
|
211
211
|
try:
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
stake_fee=stake_fee,
|
216
|
-
)
|
212
|
+
current_price = subnet_info.price.tao
|
213
|
+
rate = current_price
|
214
|
+
received_amount = amount_to_unstake_as_balance * rate
|
217
215
|
except ValueError:
|
218
216
|
continue
|
219
|
-
|
220
217
|
total_received_amount += received_amount
|
221
|
-
max_float_slippage = max(max_float_slippage, slippage_pct_float)
|
222
218
|
|
223
219
|
base_unstake_op = {
|
224
220
|
"netuid": netuid,
|
@@ -229,8 +225,6 @@ async def unstake(
|
|
229
225
|
"amount_to_unstake": amount_to_unstake_as_balance,
|
230
226
|
"current_stake_balance": current_stake_balance,
|
231
227
|
"received_amount": received_amount,
|
232
|
-
"slippage_pct": slippage_pct,
|
233
|
-
"slippage_pct_float": slippage_pct_float,
|
234
228
|
"dynamic_info": subnet_info,
|
235
229
|
}
|
236
230
|
|
@@ -238,23 +232,21 @@ async def unstake(
|
|
238
232
|
str(netuid), # Netuid
|
239
233
|
staking_address_name, # Hotkey Name
|
240
234
|
str(amount_to_unstake_as_balance), # Amount to Unstake
|
241
|
-
|
235
|
+
f"{subnet_info.price.tao:.6f}"
|
242
236
|
+ f"({Balance.get_unit(0)}/{Balance.get_unit(netuid)})", # Rate
|
243
237
|
str(stake_fee), # Fee
|
244
238
|
str(received_amount), # Received Amount
|
245
|
-
slippage_pct, # Slippage Percent
|
239
|
+
# slippage_pct, # Slippage Percent
|
246
240
|
]
|
247
241
|
|
248
242
|
# Additional fields for safe unstaking
|
249
243
|
if safe_staking:
|
250
244
|
if subnet_info.is_dynamic:
|
251
|
-
|
252
|
-
rate_with_tolerance =
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
1 - rate_tolerance
|
257
|
-
) # Actual price to pass to extrinsic
|
245
|
+
price_with_tolerance = current_price * (1 - rate_tolerance)
|
246
|
+
rate_with_tolerance = price_with_tolerance
|
247
|
+
price_with_tolerance = Balance.from_tao(
|
248
|
+
rate_with_tolerance
|
249
|
+
).rao # Actual price to pass to extrinsic
|
258
250
|
else:
|
259
251
|
rate_with_tolerance = 1
|
260
252
|
price_with_tolerance = 1
|
@@ -263,7 +255,7 @@ async def unstake(
|
|
263
255
|
base_table_row.extend(
|
264
256
|
[
|
265
257
|
# Rate with tolerance
|
266
|
-
f"{rate_with_tolerance:.
|
258
|
+
f"{rate_with_tolerance:.6f} {Balance.get_unit(0)}/{Balance.get_unit(netuid)}",
|
267
259
|
# Partial unstake
|
268
260
|
f"[{'dark_sea_green3' if allow_partial_stake else 'red'}]"
|
269
261
|
f"{allow_partial_stake}[/{'dark_sea_green3' if allow_partial_stake else 'red'}]",
|
@@ -448,14 +440,13 @@ async def unstake_all(
|
|
448
440
|
justify="center",
|
449
441
|
style=COLOR_PALETTE["POOLS"]["TAO_EQUIV"],
|
450
442
|
)
|
451
|
-
table.add_column(
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
)
|
443
|
+
# table.add_column(
|
444
|
+
# "Slippage",
|
445
|
+
# justify="center",
|
446
|
+
# style=COLOR_PALETTE["STAKE"]["SLIPPAGE_PERCENT"],
|
447
|
+
# )
|
456
448
|
|
457
|
-
# Calculate
|
458
|
-
max_slippage = 0.0
|
449
|
+
# Calculate total received
|
459
450
|
total_received_value = Balance(0)
|
460
451
|
for stake in stake_info:
|
461
452
|
if stake.stake.rao == 0:
|
@@ -473,41 +464,33 @@ async def unstake_all(
|
|
473
464
|
destination_coldkey_ss58=wallet.coldkeypub.ss58_address,
|
474
465
|
amount=stake_amount.rao,
|
475
466
|
)
|
467
|
+
|
476
468
|
try:
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
469
|
+
current_price = subnet_info.price.tao
|
470
|
+
rate = current_price
|
471
|
+
received_amount = stake_amount * rate - stake_fee
|
472
|
+
|
473
|
+
if received_amount < Balance.from_tao(0):
|
474
|
+
print_error("Not enough Alpha to pay the transaction fee.")
|
475
|
+
continue
|
476
|
+
except (AttributeError, ValueError):
|
481
477
|
continue
|
482
478
|
|
483
|
-
max_slippage = max(max_slippage, slippage_pct_float)
|
484
479
|
total_received_value += received_amount
|
485
480
|
|
486
481
|
table.add_row(
|
487
482
|
str(stake.netuid),
|
488
483
|
hotkey_display,
|
489
484
|
str(stake_amount),
|
490
|
-
|
485
|
+
f"{float(subnet_info.price):.6f}"
|
491
486
|
+ f"({Balance.get_unit(0)}/{Balance.get_unit(stake.netuid)})",
|
492
487
|
str(stake_fee),
|
493
488
|
str(received_amount),
|
494
|
-
slippage_pct,
|
495
489
|
)
|
496
490
|
console.print(table)
|
497
|
-
if max_slippage > 5:
|
498
|
-
message = (
|
499
|
-
f"[{COLOR_PALETTE['STAKE']['SLIPPAGE_TEXT']}]--------------------------------------------------------------"
|
500
|
-
f"-----------------------------------------------------\n"
|
501
|
-
f"[bold]WARNING:[/bold] The slippage on one of your operations is high: "
|
502
|
-
f"[{COLOR_PALETTE['STAKE']['SLIPPAGE_PERCENT']}]{max_slippage:.4f}%"
|
503
|
-
f"[/{COLOR_PALETTE['STAKE']['SLIPPAGE_PERCENT']}], this may result in a loss of funds.\n"
|
504
|
-
"----------------------------------------------------------------------------------------------------------"
|
505
|
-
"---------\n"
|
506
|
-
)
|
507
|
-
console.print(message)
|
508
491
|
|
509
492
|
console.print(
|
510
|
-
f"
|
493
|
+
f"Total expected return: [{COLOR_PALETTE['STAKE']['STAKE_AMOUNT']}]{total_received_value}"
|
511
494
|
)
|
512
495
|
|
513
496
|
if prompt and not Confirm.ask(
|
@@ -848,51 +831,6 @@ async def _unstake_all_extrinsic(
|
|
848
831
|
|
849
832
|
|
850
833
|
# Helpers
|
851
|
-
def _calculate_slippage(
|
852
|
-
subnet_info, amount: Balance, stake_fee: Balance
|
853
|
-
) -> tuple[Balance, str, float]:
|
854
|
-
"""Calculate slippage and received amount for unstaking operation.
|
855
|
-
|
856
|
-
Args:
|
857
|
-
subnet_info: Subnet information containing price data
|
858
|
-
amount: Amount being unstaked
|
859
|
-
stake_fee: Stake fee to include in slippage calculation
|
860
|
-
|
861
|
-
Returns:
|
862
|
-
tuple containing:
|
863
|
-
- received_amount: Balance after slippage deduction
|
864
|
-
- slippage_pct: Formatted string of slippage percentage
|
865
|
-
- slippage_pct_float: Float value of slippage percentage
|
866
|
-
"""
|
867
|
-
received_amount, _, _ = subnet_info.alpha_to_tao_with_slippage(amount)
|
868
|
-
received_amount -= stake_fee
|
869
|
-
|
870
|
-
if received_amount < Balance.from_tao(0):
|
871
|
-
print_error("Not enough Alpha to pay the transaction fee.")
|
872
|
-
raise ValueError
|
873
|
-
|
874
|
-
if subnet_info.is_dynamic:
|
875
|
-
# Ideal amount w/o slippage
|
876
|
-
ideal_amount = subnet_info.alpha_to_tao(amount)
|
877
|
-
|
878
|
-
# Total slippage including fees
|
879
|
-
total_slippage = ideal_amount - received_amount
|
880
|
-
slippage_pct_float = (
|
881
|
-
100 * (float(total_slippage.tao) / float(ideal_amount.tao))
|
882
|
-
if ideal_amount.tao != 0
|
883
|
-
else 0
|
884
|
-
)
|
885
|
-
slippage_pct = f"{slippage_pct_float:.4f} %"
|
886
|
-
else:
|
887
|
-
# Root will only have fee-based slippage
|
888
|
-
slippage_pct_float = (
|
889
|
-
100 * float(stake_fee.tao) / float(amount.tao) if amount.tao != 0 else 0
|
890
|
-
)
|
891
|
-
slippage_pct = f"{slippage_pct_float:.4f} %"
|
892
|
-
|
893
|
-
return received_amount, slippage_pct, slippage_pct_float
|
894
|
-
|
895
|
-
|
896
834
|
async def _unstake_selection(
|
897
835
|
dynamic_info,
|
898
836
|
identities,
|
@@ -993,14 +931,14 @@ async def _unstake_selection(
|
|
993
931
|
table.add_column("Symbol", style=COLOR_PALETTE["GENERAL"]["SYMBOL"])
|
994
932
|
table.add_column("Stake Amount", style=COLOR_PALETTE["STAKE"]["STAKE_AMOUNT"])
|
995
933
|
table.add_column(
|
996
|
-
f"[bold white]
|
934
|
+
f"[bold white]Rate ({Balance.get_unit(0)}/{Balance.get_unit(1)})",
|
997
935
|
style=COLOR_PALETTE["POOLS"]["RATE"],
|
998
936
|
justify="left",
|
999
937
|
)
|
1000
938
|
|
1001
939
|
for netuid_, stake_amount in netuid_stakes.items():
|
1002
940
|
symbol = dynamic_info[netuid_].symbol
|
1003
|
-
rate = f"{dynamic_info[netuid_].price.tao:.
|
941
|
+
rate = f"{dynamic_info[netuid_].price.tao:.6f} τ/{symbol}"
|
1004
942
|
table.add_row(str(netuid_), symbol, str(stake_amount), rate)
|
1005
943
|
console.print("\n", table, "\n")
|
1006
944
|
|
@@ -1261,9 +1199,9 @@ def _create_unstake_table(
|
|
1261
1199
|
style=COLOR_PALETTE["POOLS"]["TAO_EQUIV"],
|
1262
1200
|
footer=str(total_received_amount),
|
1263
1201
|
)
|
1264
|
-
table.add_column(
|
1265
|
-
|
1266
|
-
)
|
1202
|
+
# table.add_column(
|
1203
|
+
# "Slippage", justify="center", style=COLOR_PALETTE["STAKE"]["SLIPPAGE_PERCENT"]
|
1204
|
+
# )
|
1267
1205
|
if safe_staking:
|
1268
1206
|
table.add_column(
|
1269
1207
|
f"Rate with tolerance: [blue]({rate_tolerance * 100}%)[/blue]",
|
@@ -140,6 +140,9 @@ async def register_subnetwork_extrinsic(
|
|
140
140
|
"description": subnet_identity["description"].encode()
|
141
141
|
if subnet_identity.get("description")
|
142
142
|
else b"",
|
143
|
+
"logo_url": subnet_identity["logo_url"].encode()
|
144
|
+
if subnet_identity.get("logo_url")
|
145
|
+
else b"",
|
143
146
|
"additional": subnet_identity["additional"].encode()
|
144
147
|
if subnet_identity.get("additional")
|
145
148
|
else b"",
|
@@ -2207,6 +2210,7 @@ async def set_identity(
|
|
2207
2210
|
"subnet_url": subnet_identity.get("subnet_url", ""),
|
2208
2211
|
"discord": subnet_identity.get("discord", ""),
|
2209
2212
|
"description": subnet_identity.get("description", ""),
|
2213
|
+
"logo_url": subnet_identity.get("logo_url", ""),
|
2210
2214
|
"additional": subnet_identity.get("additional", ""),
|
2211
2215
|
}
|
2212
2216
|
|
@@ -2252,6 +2256,7 @@ async def set_identity(
|
|
2252
2256
|
"subnet_url",
|
2253
2257
|
"discord",
|
2254
2258
|
"description",
|
2259
|
+
"logo_url",
|
2255
2260
|
"additional",
|
2256
2261
|
]:
|
2257
2262
|
value = getattr(identity, key, None)
|
@@ -2301,6 +2306,7 @@ async def get_identity(
|
|
2301
2306
|
"subnet_url",
|
2302
2307
|
"discord",
|
2303
2308
|
"description",
|
2309
|
+
"logo_url",
|
2304
2310
|
"additional",
|
2305
2311
|
]:
|
2306
2312
|
value = getattr(identity, key, None)
|
@@ -8,7 +8,12 @@ from rich.table import Column, Table
|
|
8
8
|
from rich.prompt import Confirm
|
9
9
|
from scalecodec import GenericCall
|
10
10
|
|
11
|
-
from bittensor_cli.src import
|
11
|
+
from bittensor_cli.src import (
|
12
|
+
HYPERPARAMS,
|
13
|
+
HYPERPARAMS_MODULE,
|
14
|
+
DelegatesDetails,
|
15
|
+
COLOR_PALETTE,
|
16
|
+
)
|
12
17
|
from bittensor_cli.src.bittensor.chain_data import decode_account_id
|
13
18
|
from bittensor_cli.src.bittensor.utils import (
|
14
19
|
console,
|
@@ -31,6 +36,7 @@ if TYPE_CHECKING:
|
|
31
36
|
|
32
37
|
|
33
38
|
# helpers and extrinsics
|
39
|
+
DEFAULT_PALLET = "AdminUtils"
|
34
40
|
|
35
41
|
|
36
42
|
def allowed_value(
|
@@ -81,7 +87,11 @@ def string_to_bool(val) -> bool:
|
|
81
87
|
|
82
88
|
|
83
89
|
def search_metadata(
|
84
|
-
param_name: str,
|
90
|
+
param_name: str,
|
91
|
+
value: Union[str, bool, float, list[float]],
|
92
|
+
netuid: int,
|
93
|
+
metadata,
|
94
|
+
pallet: str = DEFAULT_PALLET,
|
85
95
|
) -> tuple[bool, Optional[dict]]:
|
86
96
|
"""
|
87
97
|
Searches the substrate metadata AdminUtils pallet for a given parameter name. Crafts a response dict to be used
|
@@ -92,6 +102,7 @@ def search_metadata(
|
|
92
102
|
value: the value to set the hyperparameter
|
93
103
|
netuid: the specified netuid
|
94
104
|
metadata: the subtensor.substrate.metadata
|
105
|
+
pallet: the name of the module to use for the query. If not set, the default value is DEFAULT_PALLET
|
95
106
|
|
96
107
|
Returns:
|
97
108
|
(success, dict of call params)
|
@@ -113,7 +124,7 @@ def search_metadata(
|
|
113
124
|
|
114
125
|
call_crafter = {"netuid": netuid}
|
115
126
|
|
116
|
-
pallet = metadata.get_metadata_pallet(
|
127
|
+
pallet = metadata.get_metadata_pallet(pallet)
|
117
128
|
for call in pallet.calls:
|
118
129
|
if call.name == param_name:
|
119
130
|
if "netuid" not in [x.name for x in call.args]:
|
@@ -135,11 +146,11 @@ def search_metadata(
|
|
135
146
|
return False, None
|
136
147
|
|
137
148
|
|
138
|
-
def requires_bool(metadata, param_name) -> bool:
|
149
|
+
def requires_bool(metadata, param_name, pallet: str = DEFAULT_PALLET) -> bool:
|
139
150
|
"""
|
140
151
|
Determines whether a given hyperparam takes a single arg (besides netuid) that is of bool type.
|
141
152
|
"""
|
142
|
-
pallet = metadata.get_metadata_pallet(
|
153
|
+
pallet = metadata.get_metadata_pallet(pallet)
|
143
154
|
for call in pallet.calls:
|
144
155
|
if call.name == param_name:
|
145
156
|
if "netuid" not in [x.name for x in call.args]:
|
@@ -218,6 +229,8 @@ async def set_hyperparameter_extrinsic(
|
|
218
229
|
|
219
230
|
substrate = subtensor.substrate
|
220
231
|
msg_value = value if not arbitrary_extrinsic else call_params
|
232
|
+
pallet = HYPERPARAMS_MODULE.get(parameter) or DEFAULT_PALLET
|
233
|
+
|
221
234
|
with console.status(
|
222
235
|
f":satellite: Setting hyperparameter [{COLOR_PALETTE['GENERAL']['SUBHEADING']}]{parameter}"
|
223
236
|
f"[/{COLOR_PALETTE['GENERAL']['SUBHEADING']}] to [{COLOR_PALETTE['GENERAL']['SUBHEADING']}]{msg_value}"
|
@@ -227,7 +240,7 @@ async def set_hyperparameter_extrinsic(
|
|
227
240
|
):
|
228
241
|
if not arbitrary_extrinsic:
|
229
242
|
extrinsic_params = await substrate.get_metadata_call_function(
|
230
|
-
|
243
|
+
module_name=pallet, call_function_name=extrinsic
|
231
244
|
)
|
232
245
|
|
233
246
|
# if input value is a list, iterate through the list and assign values
|
@@ -251,7 +264,7 @@ async def set_hyperparameter_extrinsic(
|
|
251
264
|
|
252
265
|
else:
|
253
266
|
if requires_bool(
|
254
|
-
substrate.metadata, param_name=extrinsic
|
267
|
+
substrate.metadata, param_name=extrinsic, pallet=pallet
|
255
268
|
) and isinstance(value, str):
|
256
269
|
value = string_to_bool(value)
|
257
270
|
value_argument = extrinsic_params["fields"][
|
@@ -261,7 +274,7 @@ async def set_hyperparameter_extrinsic(
|
|
261
274
|
|
262
275
|
# create extrinsic call
|
263
276
|
call_ = await substrate.compose_call(
|
264
|
-
call_module=
|
277
|
+
call_module=pallet,
|
265
278
|
call_function=extrinsic,
|
266
279
|
call_params=call_params,
|
267
280
|
)
|
@@ -542,14 +542,12 @@ async def wallet_balance(
|
|
542
542
|
|
543
543
|
total_free_balance = sum(free_balances.values())
|
544
544
|
total_staked_balance = sum(stake[0] for stake in staked_balances.values())
|
545
|
-
total_staked_with_slippage = sum(stake[1] for stake in staked_balances.values())
|
546
545
|
|
547
546
|
balances = {
|
548
547
|
name: (
|
549
548
|
coldkey,
|
550
549
|
free_balances[coldkey],
|
551
550
|
staked_balances[coldkey][0],
|
552
|
-
staked_balances[coldkey][1],
|
553
551
|
)
|
554
552
|
for (name, coldkey) in zip(wallet_names, coldkeys)
|
555
553
|
}
|
@@ -577,24 +575,12 @@ async def wallet_balance(
|
|
577
575
|
style=COLOR_PALETTE["STAKE"]["STAKE_ALPHA"],
|
578
576
|
no_wrap=True,
|
579
577
|
),
|
580
|
-
Column(
|
581
|
-
"[white]Staked (w/slippage)",
|
582
|
-
justify="right",
|
583
|
-
style=COLOR_PALETTE["STAKE"]["STAKE_SWAP"],
|
584
|
-
no_wrap=True,
|
585
|
-
),
|
586
578
|
Column(
|
587
579
|
"[white]Total Balance",
|
588
580
|
justify="right",
|
589
581
|
style=COLOR_PALETTE["GENERAL"]["BALANCE"],
|
590
582
|
no_wrap=True,
|
591
583
|
),
|
592
|
-
Column(
|
593
|
-
"[white]Total (w/slippage)",
|
594
|
-
justify="right",
|
595
|
-
style=COLOR_PALETTE["GENERAL"]["BALANCE"],
|
596
|
-
no_wrap=True,
|
597
|
-
),
|
598
584
|
title=f"\n[{COLOR_PALETTE['GENERAL']['HEADER']}]Wallet Coldkey Balance[/{COLOR_PALETTE['GENERAL']['HEADER']}]\n[{COLOR_PALETTE['GENERAL']['HEADER']}]Network: {subtensor.network}\n",
|
599
585
|
show_footer=True,
|
600
586
|
show_edge=False,
|
@@ -605,15 +591,13 @@ async def wallet_balance(
|
|
605
591
|
leading=True,
|
606
592
|
)
|
607
593
|
|
608
|
-
for name, (coldkey, free, staked
|
594
|
+
for name, (coldkey, free, staked) in balances.items():
|
609
595
|
table.add_row(
|
610
596
|
name,
|
611
597
|
coldkey,
|
612
598
|
str(free),
|
613
599
|
str(staked),
|
614
|
-
str(staked_slippage),
|
615
600
|
str(free + staked),
|
616
|
-
str(free + staked_slippage),
|
617
601
|
)
|
618
602
|
table.add_row()
|
619
603
|
table.add_row(
|
@@ -621,9 +605,7 @@ async def wallet_balance(
|
|
621
605
|
"",
|
622
606
|
str(total_free_balance),
|
623
607
|
str(total_staked_balance),
|
624
|
-
str(total_staked_with_slippage),
|
625
608
|
str(total_free_balance + total_staked_balance),
|
626
|
-
str(total_free_balance + total_staked_with_slippage),
|
627
609
|
)
|
628
610
|
console.print(Padding(table, (0, 0, 0, 4)))
|
629
611
|
await subtensor.substrate.close()
|
@@ -633,9 +615,7 @@ async def wallet_balance(
|
|
633
615
|
"coldkey": value[0],
|
634
616
|
"free": value[1].tao,
|
635
617
|
"staked": value[2].tao,
|
636
|
-
"staked_with_slippage": value[3].tao,
|
637
618
|
"total": (value[1] + value[2]).tao,
|
638
|
-
"total_with_slippage": (value[1] + value[3]).tao,
|
639
619
|
}
|
640
620
|
for (key, value) in balances.items()
|
641
621
|
}
|
@@ -644,11 +624,7 @@ async def wallet_balance(
|
|
644
624
|
"totals": {
|
645
625
|
"free": total_free_balance.tao,
|
646
626
|
"staked": total_staked_balance.tao,
|
647
|
-
"staked_with_slippage": total_staked_with_slippage.tao,
|
648
627
|
"total": (total_free_balance + total_staked_balance).tao,
|
649
|
-
"total_with_slippage": (
|
650
|
-
total_free_balance + total_staked_with_slippage
|
651
|
-
).tao,
|
652
628
|
},
|
653
629
|
}
|
654
630
|
json_console.print(json.dumps(output_dict))
|
@@ -2002,11 +1978,12 @@ async def check_swap_status(
|
|
2002
1978
|
Args:
|
2003
1979
|
subtensor: Connection to the network
|
2004
1980
|
origin_ss58: The SS58 address of the original coldkey
|
2005
|
-
|
1981
|
+
expected_block_number: Optional block number where the swap was scheduled
|
1982
|
+
|
2006
1983
|
"""
|
2007
|
-
scheduled_swaps = await subtensor.get_scheduled_coldkey_swap()
|
2008
1984
|
|
2009
1985
|
if not origin_ss58:
|
1986
|
+
scheduled_swaps = await subtensor.get_scheduled_coldkey_swap()
|
2010
1987
|
if not scheduled_swaps:
|
2011
1988
|
console.print("[yellow]No pending coldkey swaps found.[/yellow]")
|
2012
1989
|
return
|
@@ -2035,11 +2012,20 @@ async def check_swap_status(
|
|
2035
2012
|
|
2036
2013
|
console.print(table)
|
2037
2014
|
console.print(
|
2038
|
-
"\n[dim]Tip: Check specific swap details by providing the original coldkey
|
2015
|
+
"\n[dim]Tip: Check specific swap details by providing the original coldkey "
|
2016
|
+
"SS58 address and the block number.[/dim]"
|
2039
2017
|
)
|
2040
2018
|
return
|
2041
|
-
|
2042
|
-
|
2019
|
+
chain_reported_completion_block, destination_address = await subtensor.query(
|
2020
|
+
"SubtensorModule", "ColdkeySwapScheduled", [origin_ss58]
|
2021
|
+
)
|
2022
|
+
if (
|
2023
|
+
chain_reported_completion_block != 0
|
2024
|
+
and destination_address != "5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM"
|
2025
|
+
):
|
2026
|
+
is_pending = True
|
2027
|
+
else:
|
2028
|
+
is_pending = False
|
2043
2029
|
|
2044
2030
|
if not is_pending:
|
2045
2031
|
console.print(
|
@@ -2052,23 +2038,10 @@ async def check_swap_status(
|
|
2052
2038
|
)
|
2053
2039
|
|
2054
2040
|
if expected_block_number is None:
|
2055
|
-
|
2056
|
-
|
2057
|
-
swap_info = await find_coldkey_swap_extrinsic(
|
2058
|
-
subtensor=subtensor,
|
2059
|
-
start_block=expected_block_number,
|
2060
|
-
end_block=expected_block_number,
|
2061
|
-
wallet_ss58=origin_ss58,
|
2062
|
-
)
|
2063
|
-
|
2064
|
-
if not swap_info:
|
2065
|
-
console.print(
|
2066
|
-
f"[yellow]Warning: Could not find swap extrinsic at block {expected_block_number}[/yellow]"
|
2067
|
-
)
|
2068
|
-
return
|
2041
|
+
expected_block_number = chain_reported_completion_block
|
2069
2042
|
|
2070
2043
|
current_block = await subtensor.substrate.get_block_number()
|
2071
|
-
remaining_blocks =
|
2044
|
+
remaining_blocks = expected_block_number - current_block
|
2072
2045
|
|
2073
2046
|
if remaining_blocks <= 0:
|
2074
2047
|
console.print("[green]Swap period has completed![/green]")
|
@@ -2076,9 +2049,8 @@ async def check_swap_status(
|
|
2076
2049
|
|
2077
2050
|
console.print(
|
2078
2051
|
"\n[green]Coldkey swap details:[/green]"
|
2079
|
-
f"\nScheduled at block: {swap_info['block_num']}"
|
2080
2052
|
f"\nOriginal address: [{COLORS.G.CK}]{origin_ss58}[/{COLORS.G.CK}]"
|
2081
|
-
f"\nDestination address: [{COLORS.G.CK}]{
|
2082
|
-
f"\nCompletion block: {
|
2053
|
+
f"\nDestination address: [{COLORS.G.CK}]{destination_address}[/{COLORS.G.CK}]"
|
2054
|
+
f"\nCompletion block: {chain_reported_completion_block}"
|
2083
2055
|
f"\nTime remaining: {blocks_to_duration(remaining_blocks)}"
|
2084
2056
|
)
|
@@ -1,15 +1,15 @@
|
|
1
1
|
bittensor_cli/__init__.py,sha256=Lpv4NkbAQgwrfqFOnTMuR_S-fqGdaWCSLhxnFnGTHM0,1232
|
2
|
-
bittensor_cli/cli.py,sha256
|
2
|
+
bittensor_cli/cli.py,sha256=araPpzXJvIAQWG7Jt1AhsM183cYc1rpAIQZxCbufaQ8,231311
|
3
3
|
bittensor_cli/doc_generation_helper.py,sha256=GexqjEIKulWg84hpNBEchJ840oOgOi7DWpt447nsdNI,91
|
4
4
|
bittensor_cli/version.py,sha256=dU1xsa3mG5FPdhzvqlzDByNcCHmzcFQH3q1pQr4u76g,720
|
5
|
-
bittensor_cli/src/__init__.py,sha256=
|
5
|
+
bittensor_cli/src/__init__.py,sha256=zd_S5sddcg9bJKnOadpMgGAGmwUrR8fPQGgYCauzUq8,34129
|
6
6
|
bittensor_cli/src/bittensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
bittensor_cli/src/bittensor/balances.py,sha256=q5KkxF8wmUguWAFddEKstfDKTxPe5ISHpT6br8x32rc,11148
|
8
|
-
bittensor_cli/src/bittensor/chain_data.py,sha256=
|
8
|
+
bittensor_cli/src/bittensor/chain_data.py,sha256=_GATOCacWMN2jRurzn3hffJiq_l7AznGRkKePTAflwQ,44420
|
9
9
|
bittensor_cli/src/bittensor/minigraph.py,sha256=BIzmSVLfBYiRAeGD_i1LAC8Cw7zxp38a91SIFEPMqYc,10479
|
10
10
|
bittensor_cli/src/bittensor/networking.py,sha256=pZLMs8YXpZzDMLXWMBb_Bj6TVkm_q9khyY-lnbwVMuE,462
|
11
|
-
bittensor_cli/src/bittensor/subtensor_interface.py,sha256=
|
12
|
-
bittensor_cli/src/bittensor/utils.py,sha256=
|
11
|
+
bittensor_cli/src/bittensor/subtensor_interface.py,sha256=nAVcSTbXZEp3A1Sks4Mfypp4G9F3m8qLl1z2UrNExng,62334
|
12
|
+
bittensor_cli/src/bittensor/utils.py,sha256=cvJZNhcm2tESZ43D1fmBH3Zc1rSe_BvanvhRuN7qL5o,47961
|
13
13
|
bittensor_cli/src/bittensor/extrinsics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
14
|
bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=7ybqpJ7-Z_PTgj4boCOFxgfjMBCHv0JE7MNpJzJmyDc,66360
|
15
15
|
bittensor_cli/src/bittensor/extrinsics/root.py,sha256=C9WPssL2HpNK8u_IFPPr8TrdFgbLPTfkbAYzalfmbRM,19188
|
@@ -28,21 +28,24 @@ bittensor_cli/src/bittensor/templates/view.css,sha256=OS0V_ixzdTU15FbNzpZW1m7-c6
|
|
28
28
|
bittensor_cli/src/bittensor/templates/view.j2,sha256=4ux3uyqz34v9VVAX17GezuPESk4z9n5kkd9HbnTsF_Y,1101
|
29
29
|
bittensor_cli/src/bittensor/templates/view.js,sha256=QIPnPp9SuYS9wcl7cwL8nFzd8idiDjNzrDjwwxpiVvY,45076
|
30
30
|
bittensor_cli/src/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
|
-
bittensor_cli/src/commands/sudo.py,sha256=
|
31
|
+
bittensor_cli/src/commands/sudo.py,sha256=FJFjEQ-IU9c7W53EhwW7I_pEAJ9phJzarFg-neHZa_M,33758
|
32
32
|
bittensor_cli/src/commands/view.py,sha256=9lx6vfOkel8KIefUhDNaBS_j5lNR2djcRFRbK4mbnDE,12535
|
33
|
-
bittensor_cli/src/commands/wallets.py,sha256=
|
33
|
+
bittensor_cli/src/commands/wallets.py,sha256=v6JDcWhP_CcBruboixKM1XMqhUKL6GbllGd39wHKbBs,71646
|
34
34
|
bittensor_cli/src/commands/weights.py,sha256=BCJm_mlw0pVK4YEZuEMqQBpvvOoB7B1rzdvMeN3uTfM,16503
|
35
|
+
bittensor_cli/src/commands/liquidity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
|
+
bittensor_cli/src/commands/liquidity/liquidity.py,sha256=AXCjBvQb2gakP8n1z81npYkZ_QF5CQy7r82AMtQwXzk,21692
|
37
|
+
bittensor_cli/src/commands/liquidity/utils.py,sha256=egfZHnvBMc8ydntAHnU6V5Zyi-wLkomjNuucUj73aZQ,6361
|
35
38
|
bittensor_cli/src/commands/stake/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
|
-
bittensor_cli/src/commands/stake/add.py,sha256=
|
39
|
+
bittensor_cli/src/commands/stake/add.py,sha256=oEpWFnRWazaFsbKn06o4gwQ1JfFmn4AwxRNecimI3js,27614
|
37
40
|
bittensor_cli/src/commands/stake/children_hotkeys.py,sha256=lMiV-Z3SGZUEapdy0LRthFLx0RlFK0KVxytE47ybdEc,31746
|
38
|
-
bittensor_cli/src/commands/stake/list.py,sha256=
|
39
|
-
bittensor_cli/src/commands/stake/move.py,sha256=
|
40
|
-
bittensor_cli/src/commands/stake/remove.py,sha256=
|
41
|
+
bittensor_cli/src/commands/stake/list.py,sha256=tzjhiJucXgOGaw7TGt420nGosH85AEjvOimP1XXV3Xs,29038
|
42
|
+
bittensor_cli/src/commands/stake/move.py,sha256=mNFuyJ3bsT1LTQE9nDKmED7rMHR0a7j72bBgdvwaYSo,34541
|
43
|
+
bittensor_cli/src/commands/stake/remove.py,sha256=40IZWZx7pXaQfwyyauUHbxiJCcMudIU_lVd_SkXxDBg,47324
|
41
44
|
bittensor_cli/src/commands/subnets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
42
45
|
bittensor_cli/src/commands/subnets/price.py,sha256=akXkbilWjQYqTYvtOhXngX_cVkU0Mv-Gl3kjce6dtl0,21490
|
43
|
-
bittensor_cli/src/commands/subnets/subnets.py,sha256=
|
44
|
-
bittensor_cli-9.
|
45
|
-
bittensor_cli-9.
|
46
|
-
bittensor_cli-9.
|
47
|
-
bittensor_cli-9.
|
48
|
-
bittensor_cli-9.
|
46
|
+
bittensor_cli/src/commands/subnets/subnets.py,sha256=yM74ct5a9xHyD_TdSAmZL6XOtkT6zk6F67VvOe8Ou68,94070
|
47
|
+
bittensor_cli-9.8.1.dist-info/METADATA,sha256=2V8E7MMSSJrqfH3MnBKdNyoDsZ8IMfX4gl3feGRqa9s,6601
|
48
|
+
bittensor_cli-9.8.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
49
|
+
bittensor_cli-9.8.1.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
|
50
|
+
bittensor_cli-9.8.1.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
|
51
|
+
bittensor_cli-9.8.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|