bittensor-cli 9.1.3__py3-none-any.whl → 9.2.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 +22 -18
- bittensor_cli/src/__init__.py +105 -58
- bittensor_cli/src/bittensor/chain_data.py +3 -1
- bittensor_cli/src/bittensor/subtensor_interface.py +79 -5
- bittensor_cli/src/bittensor/utils.py +2 -3
- bittensor_cli/src/commands/stake/__init__.py +0 -154
- bittensor_cli/src/commands/stake/add.py +60 -32
- bittensor_cli/src/commands/stake/children_hotkeys.py +17 -14
- bittensor_cli/src/commands/stake/list.py +93 -95
- bittensor_cli/src/commands/stake/move.py +43 -9
- bittensor_cli/src/commands/stake/remove.py +111 -45
- bittensor_cli/src/commands/subnets/subnets.py +13 -14
- bittensor_cli/src/commands/sudo.py +1 -2
- bittensor_cli/src/commands/wallets.py +4 -3
- bittensor_cli/version.py +1 -1
- {bittensor_cli-9.1.3.dist-info → bittensor_cli-9.2.0.dist-info}/METADATA +25 -5
- bittensor_cli-9.2.0.dist-info/RECORD +35 -0
- bittensor_cli-9.1.3.dist-info/RECORD +0 -35
- {bittensor_cli-9.1.3.dist-info → bittensor_cli-9.2.0.dist-info}/WHEEL +0 -0
- {bittensor_cli-9.1.3.dist-info → bittensor_cli-9.2.0.dist-info}/entry_points.txt +0 -0
- {bittensor_cli-9.1.3.dist-info → bittensor_cli-9.2.0.dist-info}/top_level.txt +0 -0
@@ -34,38 +34,37 @@ async def stake_list(
|
|
34
34
|
):
|
35
35
|
coldkey_address = coldkey_ss58 if coldkey_ss58 else wallet.coldkeypub.ss58_address
|
36
36
|
|
37
|
-
async def get_stake_data(
|
37
|
+
async def get_stake_data(block_hash_: str = None):
|
38
38
|
(
|
39
|
-
|
40
|
-
|
39
|
+
sub_stakes_,
|
40
|
+
registered_delegate_info_,
|
41
41
|
_dynamic_info,
|
42
42
|
) = await asyncio.gather(
|
43
43
|
subtensor.get_stake_for_coldkey(
|
44
|
-
coldkey_ss58=coldkey_address, block_hash=
|
44
|
+
coldkey_ss58=coldkey_address, block_hash=block_hash_
|
45
45
|
),
|
46
|
-
subtensor.get_delegate_identities(block_hash=
|
47
|
-
subtensor.all_subnets(block_hash=
|
46
|
+
subtensor.get_delegate_identities(block_hash=block_hash_),
|
47
|
+
subtensor.all_subnets(block_hash=block_hash_),
|
48
48
|
)
|
49
49
|
# sub_stakes = substakes[coldkey_address]
|
50
|
-
|
50
|
+
dynamic_info__ = {info.netuid: info for info in _dynamic_info}
|
51
51
|
return (
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
sub_stakes_,
|
53
|
+
registered_delegate_info_,
|
54
|
+
dynamic_info__,
|
55
55
|
)
|
56
56
|
|
57
57
|
def define_table(
|
58
|
-
|
58
|
+
hotkey_name_: str,
|
59
59
|
rows: list[list[str]],
|
60
|
-
|
61
|
-
|
62
|
-
live: bool = False,
|
60
|
+
total_tao_value_: Balance,
|
61
|
+
total_swapped_tao_value_: Balance,
|
63
62
|
):
|
64
|
-
title = f"\n[{COLOR_PALETTE['GENERAL']['HEADER']}]Hotkey: {
|
63
|
+
title = f"\n[{COLOR_PALETTE['GENERAL']['HEADER']}]Hotkey: {hotkey_name_}\nNetwork: {subtensor.network}\n\n"
|
65
64
|
# TODO: Add hint back in after adding columns descriptions
|
66
65
|
# if not live:
|
67
66
|
# title += f"[{COLOR_PALETTE['GENERAL']['HINT']}]See below for an explanation of the columns\n"
|
68
|
-
|
67
|
+
defined_table = Table(
|
69
68
|
title=title,
|
70
69
|
show_footer=True,
|
71
70
|
show_edge=False,
|
@@ -76,74 +75,74 @@ async def stake_list(
|
|
76
75
|
show_lines=False,
|
77
76
|
pad_edge=True,
|
78
77
|
)
|
79
|
-
|
78
|
+
defined_table.add_column(
|
80
79
|
"[white]Netuid",
|
81
80
|
footer=f"{len(rows)}",
|
82
81
|
footer_style="overline white",
|
83
82
|
style="grey89",
|
84
83
|
)
|
85
|
-
|
84
|
+
defined_table.add_column(
|
86
85
|
"[white]Name",
|
87
86
|
style="cyan",
|
88
87
|
justify="left",
|
89
88
|
no_wrap=True,
|
90
89
|
)
|
91
|
-
|
90
|
+
defined_table.add_column(
|
92
91
|
f"[white]Value \n({Balance.get_unit(1)} x {Balance.unit}/{Balance.get_unit(1)})",
|
93
92
|
footer_style="overline white",
|
94
93
|
style=COLOR_PALETTE["STAKE"]["TAO"],
|
95
94
|
justify="right",
|
96
|
-
footer=f"τ {millify_tao(
|
95
|
+
footer=f"τ {millify_tao(total_tao_value_.tao)}"
|
97
96
|
if not verbose
|
98
|
-
else f"{
|
97
|
+
else f"{total_tao_value_}",
|
99
98
|
)
|
100
|
-
|
99
|
+
defined_table.add_column(
|
101
100
|
f"[white]Stake ({Balance.get_unit(1)})",
|
102
101
|
footer_style="overline white",
|
103
102
|
style=COLOR_PALETTE["STAKE"]["STAKE_ALPHA"],
|
104
103
|
justify="center",
|
105
104
|
)
|
106
|
-
|
105
|
+
defined_table.add_column(
|
107
106
|
f"[white]Price \n({Balance.unit}_in/{Balance.get_unit(1)}_in)",
|
108
107
|
footer_style="white",
|
109
108
|
style=COLOR_PALETTE["POOLS"]["RATE"],
|
110
109
|
justify="center",
|
111
110
|
)
|
112
|
-
|
111
|
+
defined_table.add_column(
|
113
112
|
f"[white]Swap ({Balance.get_unit(1)} -> {Balance.unit})",
|
114
113
|
footer_style="overline white",
|
115
114
|
style=COLOR_PALETTE["STAKE"]["STAKE_SWAP"],
|
116
115
|
justify="right",
|
117
|
-
footer=f"τ {millify_tao(
|
116
|
+
footer=f"τ {millify_tao(total_swapped_tao_value_.tao)}"
|
118
117
|
if not verbose
|
119
|
-
else f"{
|
118
|
+
else f"{total_swapped_tao_value_}",
|
120
119
|
)
|
121
|
-
|
120
|
+
defined_table.add_column(
|
122
121
|
"[white]Registered",
|
123
122
|
style=COLOR_PALETTE["STAKE"]["STAKE_ALPHA"],
|
124
123
|
justify="right",
|
125
124
|
)
|
126
|
-
|
125
|
+
defined_table.add_column(
|
127
126
|
f"[white]Emission \n({Balance.get_unit(1)}/block)",
|
128
127
|
style=COLOR_PALETTE["POOLS"]["EMISSION"],
|
129
128
|
justify="right",
|
130
129
|
)
|
131
|
-
|
130
|
+
defined_table.add_column(
|
132
131
|
f"[white]Emission \n({Balance.get_unit(0)}/block)",
|
133
132
|
style=COLOR_PALETTE["POOLS"]["EMISSION"],
|
134
133
|
justify="right",
|
135
134
|
)
|
136
|
-
return
|
135
|
+
return defined_table
|
137
136
|
|
138
137
|
def create_table(hotkey_: str, substakes: list[StakeInfo]):
|
139
|
-
|
138
|
+
name_ = (
|
140
139
|
f"{registered_delegate_info[hotkey_].display} ({hotkey_})"
|
141
140
|
if hotkey_ in registered_delegate_info
|
142
141
|
else hotkey_
|
143
142
|
)
|
144
143
|
rows = []
|
145
|
-
|
146
|
-
|
144
|
+
total_tao_value_ = Balance(0)
|
145
|
+
total_swapped_tao_value_ = Balance(0)
|
147
146
|
root_stakes = [s for s in substakes if s.netuid == 0]
|
148
147
|
other_stakes = sorted(
|
149
148
|
[s for s in substakes if s.netuid != 0],
|
@@ -162,14 +161,14 @@ async def stake_list(
|
|
162
161
|
alpha_value = Balance.from_rao(int(substake_.stake.rao)).set_unit(netuid)
|
163
162
|
|
164
163
|
# TAO value cell
|
165
|
-
|
166
|
-
|
164
|
+
tao_value_ = pool.alpha_to_tao(alpha_value)
|
165
|
+
total_tao_value_ += tao_value_
|
167
166
|
|
168
167
|
# Swapped TAO value and slippage cell
|
169
|
-
|
168
|
+
swapped_tao_value_, _, slippage_percentage_ = (
|
170
169
|
pool.alpha_to_tao_with_slippage(substake_.stake)
|
171
170
|
)
|
172
|
-
|
171
|
+
total_swapped_tao_value_ += swapped_tao_value_
|
173
172
|
|
174
173
|
# Slippage percentage cell
|
175
174
|
if pool.is_dynamic:
|
@@ -181,9 +180,9 @@ async def stake_list(
|
|
181
180
|
swap_value = f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]N/A[/{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}] ({slippage_percentage})"
|
182
181
|
else:
|
183
182
|
swap_value = (
|
184
|
-
f"τ {millify_tao(
|
183
|
+
f"τ {millify_tao(swapped_tao_value_.tao)} ({slippage_percentage})"
|
185
184
|
if not verbose
|
186
|
-
else f"{
|
185
|
+
else f"{swapped_tao_value_} ({slippage_percentage})"
|
187
186
|
)
|
188
187
|
|
189
188
|
# Per block emission cell
|
@@ -202,9 +201,9 @@ async def stake_list(
|
|
202
201
|
[
|
203
202
|
str(netuid), # Number
|
204
203
|
subnet_name_cell, # Symbol + name
|
205
|
-
f"τ {millify_tao(
|
204
|
+
f"τ {millify_tao(tao_value_.tao)}"
|
206
205
|
if not verbose
|
207
|
-
else f"{
|
206
|
+
else f"{tao_value_}", # Value (α x τ/α)
|
208
207
|
f"{stake_value} {symbol}"
|
209
208
|
if netuid != 0
|
210
209
|
else f"{symbol} {stake_value}", # Stake (a)
|
@@ -221,27 +220,33 @@ async def stake_list(
|
|
221
220
|
str(Balance.from_tao(per_block_tao_emission)),
|
222
221
|
]
|
223
222
|
)
|
224
|
-
|
223
|
+
created_table = define_table(
|
224
|
+
name_, rows, total_tao_value_, total_swapped_tao_value_
|
225
|
+
)
|
225
226
|
for row in rows:
|
226
|
-
|
227
|
-
console.print(
|
228
|
-
return
|
227
|
+
created_table.add_row(*row)
|
228
|
+
console.print(created_table)
|
229
|
+
return total_tao_value_, total_swapped_tao_value_
|
229
230
|
|
230
231
|
def create_live_table(
|
231
232
|
substakes: list,
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
) -> tuple[Table, dict, Balance, Balance, Balance]:
|
233
|
+
dynamic_info_for_lt: dict,
|
234
|
+
hotkey_name_: str,
|
235
|
+
previous_data_: Optional[dict] = None,
|
236
|
+
) -> tuple[Table, dict]:
|
237
237
|
rows = []
|
238
|
-
|
238
|
+
current_data_ = {}
|
239
239
|
|
240
|
-
|
241
|
-
|
240
|
+
total_tao_value_ = Balance(0)
|
241
|
+
total_swapped_tao_value_ = Balance(0)
|
242
242
|
|
243
243
|
def format_cell(
|
244
|
-
value,
|
244
|
+
value,
|
245
|
+
previous_value,
|
246
|
+
unit="",
|
247
|
+
unit_first_=False,
|
248
|
+
precision=4,
|
249
|
+
millify=False,
|
245
250
|
):
|
246
251
|
if previous_value is not None:
|
247
252
|
change = value - previous_value
|
@@ -265,7 +270,7 @@ async def stake_list(
|
|
265
270
|
)
|
266
271
|
return (
|
267
272
|
f"{formatted_value} {unit}{change_text}"
|
268
|
-
if not
|
273
|
+
if not unit_first_
|
269
274
|
else f"{unit} {formatted_value}{change_text}"
|
270
275
|
)
|
271
276
|
|
@@ -273,7 +278,7 @@ async def stake_list(
|
|
273
278
|
root_stakes = [s for s in substakes if s.netuid == 0]
|
274
279
|
other_stakes = sorted(
|
275
280
|
[s for s in substakes if s.netuid != 0],
|
276
|
-
key=lambda x:
|
281
|
+
key=lambda x: dynamic_info_for_lt[x.netuid]
|
277
282
|
.alpha_to_tao(Balance.from_rao(int(x.stake.rao)).set_unit(x.netuid))
|
278
283
|
.tao,
|
279
284
|
reverse=True,
|
@@ -281,41 +286,41 @@ async def stake_list(
|
|
281
286
|
sorted_substakes = root_stakes + other_stakes
|
282
287
|
|
283
288
|
# Process each stake
|
284
|
-
for
|
285
|
-
netuid =
|
286
|
-
pool =
|
287
|
-
if
|
289
|
+
for substake_ in sorted_substakes:
|
290
|
+
netuid = substake_.netuid
|
291
|
+
pool = dynamic_info_for_lt.get(netuid)
|
292
|
+
if substake_.stake.rao == 0 or not pool:
|
288
293
|
continue
|
289
294
|
|
290
295
|
# Calculate base values
|
291
296
|
symbol = f"{Balance.get_unit(netuid)}\u200e"
|
292
|
-
alpha_value = Balance.from_rao(int(
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
+
alpha_value = Balance.from_rao(int(substake_.stake.rao)).set_unit(netuid)
|
298
|
+
tao_value_ = pool.alpha_to_tao(alpha_value)
|
299
|
+
total_tao_value_ += tao_value_
|
300
|
+
swapped_tao_value_, slippage, slippage_pct = (
|
301
|
+
pool.alpha_to_tao_with_slippage(substake_.stake)
|
297
302
|
)
|
298
|
-
|
303
|
+
total_swapped_tao_value_ += swapped_tao_value_
|
299
304
|
|
300
305
|
# Store current values for future delta tracking
|
301
|
-
|
306
|
+
current_data_[netuid] = {
|
302
307
|
"stake": alpha_value.tao,
|
303
308
|
"price": pool.price.tao,
|
304
|
-
"tao_value":
|
305
|
-
"swapped_value":
|
306
|
-
"emission":
|
307
|
-
"tao_emission":
|
309
|
+
"tao_value": tao_value_.tao,
|
310
|
+
"swapped_value": swapped_tao_value_.tao,
|
311
|
+
"emission": substake_.emission.tao / (pool.tempo or 1),
|
312
|
+
"tao_emission": substake_.tao_emission.tao / (pool.tempo or 1),
|
308
313
|
}
|
309
314
|
|
310
315
|
# Get previous values for delta tracking
|
311
|
-
prev =
|
316
|
+
prev = previous_data_.get(netuid, {}) if previous_data_ else {}
|
312
317
|
unit_first = True if netuid == 0 else False
|
313
318
|
|
314
319
|
stake_cell = format_cell(
|
315
320
|
alpha_value.tao,
|
316
321
|
prev.get("stake"),
|
317
322
|
unit=symbol,
|
318
|
-
|
323
|
+
unit_first_=unit_first,
|
319
324
|
precision=4,
|
320
325
|
millify=True if not verbose else False,
|
321
326
|
)
|
@@ -324,16 +329,16 @@ async def stake_list(
|
|
324
329
|
pool.price.tao,
|
325
330
|
prev.get("price"),
|
326
331
|
unit=f"τ/{symbol}",
|
327
|
-
|
332
|
+
unit_first_=False,
|
328
333
|
precision=5,
|
329
334
|
millify=True if not verbose else False,
|
330
335
|
)
|
331
336
|
|
332
337
|
exchange_cell = format_cell(
|
333
|
-
|
338
|
+
tao_value_.tao,
|
334
339
|
prev.get("tao_value"),
|
335
340
|
unit="τ",
|
336
|
-
|
341
|
+
unit_first_=True,
|
337
342
|
precision=4,
|
338
343
|
millify=True if not verbose else False,
|
339
344
|
)
|
@@ -341,10 +346,10 @@ async def stake_list(
|
|
341
346
|
if netuid != 0:
|
342
347
|
swap_cell = (
|
343
348
|
format_cell(
|
344
|
-
|
349
|
+
swapped_tao_value_.tao,
|
345
350
|
prev.get("swapped_value"),
|
346
351
|
unit="τ",
|
347
|
-
|
352
|
+
unit_first_=True,
|
348
353
|
precision=4,
|
349
354
|
millify=True if not verbose else False,
|
350
355
|
)
|
@@ -353,27 +358,27 @@ async def stake_list(
|
|
353
358
|
else:
|
354
359
|
swap_cell = f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]N/A[/{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}] ({slippage_pct}%)"
|
355
360
|
|
356
|
-
emission_value =
|
361
|
+
emission_value = substake_.emission.tao / (pool.tempo or 1)
|
357
362
|
emission_cell = format_cell(
|
358
363
|
emission_value,
|
359
364
|
prev.get("emission"),
|
360
365
|
unit=symbol,
|
361
|
-
|
366
|
+
unit_first_=unit_first,
|
362
367
|
precision=4,
|
363
368
|
)
|
364
369
|
|
365
|
-
tao_emission_value =
|
370
|
+
tao_emission_value = substake_.tao_emission.tao / (pool.tempo or 1)
|
366
371
|
tao_emission_cell = format_cell(
|
367
372
|
tao_emission_value,
|
368
373
|
prev.get("tao_emission"),
|
369
374
|
unit="τ",
|
370
|
-
|
375
|
+
unit_first_=unit_first,
|
371
376
|
precision=4,
|
372
377
|
)
|
373
378
|
|
374
379
|
subnet_name_cell = (
|
375
380
|
f"[{COLOR_PALETTE['GENERAL']['SYMBOL']}]{symbol if netuid != 0 else 'τ'}[/{COLOR_PALETTE['GENERAL']['SYMBOL']}]"
|
376
|
-
f" {get_subnet_name(
|
381
|
+
f" {get_subnet_name(dynamic_info_for_lt[netuid])}"
|
377
382
|
)
|
378
383
|
|
379
384
|
rows.append(
|
@@ -385,25 +390,21 @@ async def stake_list(
|
|
385
390
|
rate_cell, # Rate
|
386
391
|
swap_cell, # Swap value with slippage
|
387
392
|
"YES"
|
388
|
-
if
|
393
|
+
if substake_.is_registered
|
389
394
|
else f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]NO", # Registration status
|
390
395
|
emission_cell, # Emission rate
|
391
396
|
tao_emission_cell, # TAO emission rate
|
392
397
|
]
|
393
398
|
)
|
394
399
|
|
395
|
-
|
396
|
-
|
397
|
-
rows,
|
398
|
-
total_tao_value,
|
399
|
-
total_swapped_tao_value,
|
400
|
-
live=True,
|
400
|
+
live_table = define_table(
|
401
|
+
hotkey_name_, rows, total_tao_value_, total_swapped_tao_value_
|
401
402
|
)
|
402
403
|
|
403
404
|
for row in rows:
|
404
|
-
|
405
|
+
live_table.add_row(*row)
|
405
406
|
|
406
|
-
return
|
407
|
+
return live_table, current_data_
|
407
408
|
|
408
409
|
# Main execution
|
409
410
|
block_hash = await subtensor.substrate.get_chain_head()
|
@@ -448,10 +449,8 @@ async def stake_list(
|
|
448
449
|
choices=[str(i) for i in range(len(hotkeys_to_substakes))],
|
449
450
|
)
|
450
451
|
selected_hotkey = list(hotkeys_to_substakes.keys())[int(selected_idx)]
|
451
|
-
selected_stakes = hotkeys_to_substakes[selected_hotkey]
|
452
452
|
else:
|
453
453
|
selected_hotkey = list(hotkeys_to_substakes.keys())[0]
|
454
|
-
selected_stakes = hotkeys_to_substakes[selected_hotkey]
|
455
454
|
|
456
455
|
hotkey_name = (
|
457
456
|
f"{registered_delegate_info[selected_hotkey].display} ({selected_hotkey})"
|
@@ -499,7 +498,6 @@ async def stake_list(
|
|
499
498
|
|
500
499
|
table, current_data = create_live_table(
|
501
500
|
selected_stakes,
|
502
|
-
registered_delegate_info,
|
503
501
|
dynamic_info_,
|
504
502
|
hotkey_name,
|
505
503
|
previous_data,
|
@@ -32,13 +32,14 @@ async def display_stake_movement_cross_subnets(
|
|
32
32
|
origin_hotkey: str,
|
33
33
|
destination_hotkey: str,
|
34
34
|
amount_to_move: Balance,
|
35
|
+
stake_fee: Balance,
|
35
36
|
) -> tuple[Balance, float, str, str]:
|
36
37
|
"""Calculate and display slippage information"""
|
37
38
|
|
38
39
|
if origin_netuid == destination_netuid:
|
39
40
|
subnet = await subtensor.subnet(origin_netuid)
|
40
41
|
received_amount_tao = subnet.alpha_to_tao(amount_to_move)
|
41
|
-
received_amount_tao -=
|
42
|
+
received_amount_tao -= stake_fee
|
42
43
|
|
43
44
|
if received_amount_tao < Balance.from_tao(0):
|
44
45
|
print_error("Not enough Alpha to pay the transaction fee.")
|
@@ -46,7 +47,7 @@ async def display_stake_movement_cross_subnets(
|
|
46
47
|
|
47
48
|
received_amount = subnet.tao_to_alpha(received_amount_tao)
|
48
49
|
slippage_pct_float = (
|
49
|
-
100 * float(
|
50
|
+
100 * float(stake_fee) / float(stake_fee + received_amount_tao)
|
50
51
|
if received_amount_tao != 0
|
51
52
|
else 0
|
52
53
|
)
|
@@ -67,7 +68,7 @@ async def display_stake_movement_cross_subnets(
|
|
67
68
|
received_amount_tao, _, _ = dynamic_origin.alpha_to_tao_with_slippage(
|
68
69
|
amount_to_move
|
69
70
|
)
|
70
|
-
received_amount_tao -=
|
71
|
+
received_amount_tao -= stake_fee
|
71
72
|
received_amount, _, _ = dynamic_destination.tao_to_alpha_with_slippage(
|
72
73
|
received_amount_tao
|
73
74
|
)
|
@@ -135,6 +136,11 @@ async def display_stake_movement_cross_subnets(
|
|
135
136
|
justify="center",
|
136
137
|
style=COLOR_PALETTE["POOLS"]["TAO_EQUIV"],
|
137
138
|
)
|
139
|
+
table.add_column(
|
140
|
+
"Fee (τ)",
|
141
|
+
justify="center",
|
142
|
+
style=COLOR_PALETTE["STAKE"]["STAKE_AMOUNT"],
|
143
|
+
)
|
138
144
|
table.add_column(
|
139
145
|
"slippage",
|
140
146
|
justify="center",
|
@@ -149,13 +155,11 @@ async def display_stake_movement_cross_subnets(
|
|
149
155
|
str(amount_to_move),
|
150
156
|
price_str,
|
151
157
|
str(received_amount),
|
158
|
+
str(stake_fee),
|
152
159
|
str(slippage_pct),
|
153
160
|
)
|
154
161
|
|
155
162
|
console.print(table)
|
156
|
-
# console.print(
|
157
|
-
# f"[dim]A fee of {MIN_STAKE_FEE} applies.[/dim]"
|
158
|
-
# )
|
159
163
|
|
160
164
|
# Display slippage warning if necessary
|
161
165
|
if slippage_pct_float > 5:
|
@@ -494,7 +498,6 @@ async def move_stake(
|
|
494
498
|
)
|
495
499
|
|
496
500
|
# Determine the amount we are moving.
|
497
|
-
amount_to_move_as_balance = None
|
498
501
|
if amount:
|
499
502
|
amount_to_move_as_balance = Balance.from_tao(amount)
|
500
503
|
elif stake_all:
|
@@ -514,6 +517,16 @@ async def move_stake(
|
|
514
517
|
)
|
515
518
|
return False
|
516
519
|
|
520
|
+
stake_fee = await subtensor.get_stake_fee(
|
521
|
+
origin_hotkey_ss58=origin_hotkey,
|
522
|
+
origin_netuid=origin_netuid,
|
523
|
+
origin_coldkey_ss58=wallet.coldkeypub.ss58_address,
|
524
|
+
destination_hotkey_ss58=destination_hotkey,
|
525
|
+
destination_netuid=destination_netuid,
|
526
|
+
destination_coldkey_ss58=wallet.coldkeypub.ss58_address,
|
527
|
+
amount=amount_to_move_as_balance.rao,
|
528
|
+
)
|
529
|
+
|
517
530
|
# Slippage warning
|
518
531
|
if prompt:
|
519
532
|
try:
|
@@ -524,6 +537,7 @@ async def move_stake(
|
|
524
537
|
origin_hotkey=origin_hotkey,
|
525
538
|
destination_hotkey=destination_hotkey,
|
526
539
|
amount_to_move=amount_to_move_as_balance,
|
540
|
+
stake_fee=stake_fee,
|
527
541
|
)
|
528
542
|
except ValueError:
|
529
543
|
return False
|
@@ -669,7 +683,6 @@ async def transfer_stake(
|
|
669
683
|
)
|
670
684
|
return False
|
671
685
|
|
672
|
-
amount_to_transfer = None
|
673
686
|
if amount:
|
674
687
|
amount_to_transfer = Balance.from_tao(amount).set_unit(origin_netuid)
|
675
688
|
elif stake_all:
|
@@ -688,6 +701,16 @@ async def transfer_stake(
|
|
688
701
|
)
|
689
702
|
return False
|
690
703
|
|
704
|
+
stake_fee = await subtensor.get_stake_fee(
|
705
|
+
origin_hotkey_ss58=origin_hotkey,
|
706
|
+
origin_netuid=origin_netuid,
|
707
|
+
origin_coldkey_ss58=wallet.coldkeypub.ss58_address,
|
708
|
+
destination_hotkey_ss58=origin_hotkey,
|
709
|
+
destination_netuid=dest_netuid,
|
710
|
+
destination_coldkey_ss58=dest_coldkey_ss58,
|
711
|
+
amount=amount_to_transfer.rao,
|
712
|
+
)
|
713
|
+
|
691
714
|
# Slippage warning
|
692
715
|
if prompt:
|
693
716
|
try:
|
@@ -698,6 +721,7 @@ async def transfer_stake(
|
|
698
721
|
origin_hotkey=origin_hotkey,
|
699
722
|
destination_hotkey=origin_hotkey,
|
700
723
|
amount_to_move=amount_to_transfer,
|
724
|
+
stake_fee=stake_fee,
|
701
725
|
)
|
702
726
|
except ValueError:
|
703
727
|
return False
|
@@ -784,7 +808,6 @@ async def swap_stake(
|
|
784
808
|
Args:
|
785
809
|
wallet (Wallet): The wallet to swap stake from.
|
786
810
|
subtensor (SubtensorInterface): Subtensor interface instance.
|
787
|
-
hotkey_ss58 (str): The SS58 address of the hotkey whose stake is being swapped.
|
788
811
|
origin_netuid (int): The netuid from which stake is removed.
|
789
812
|
destination_netuid (int): The netuid to which stake is added.
|
790
813
|
amount (float): The amount to swap.
|
@@ -847,6 +870,16 @@ async def swap_stake(
|
|
847
870
|
)
|
848
871
|
return False
|
849
872
|
|
873
|
+
stake_fee = await subtensor.get_stake_fee(
|
874
|
+
origin_hotkey_ss58=hotkey_ss58,
|
875
|
+
origin_netuid=origin_netuid,
|
876
|
+
origin_coldkey_ss58=wallet.coldkeypub.ss58_address,
|
877
|
+
destination_hotkey_ss58=hotkey_ss58,
|
878
|
+
destination_netuid=destination_netuid,
|
879
|
+
destination_coldkey_ss58=wallet.coldkeypub.ss58_address,
|
880
|
+
amount=amount_to_swap.rao,
|
881
|
+
)
|
882
|
+
|
850
883
|
# Slippage warning
|
851
884
|
if prompt:
|
852
885
|
try:
|
@@ -857,6 +890,7 @@ async def swap_stake(
|
|
857
890
|
origin_hotkey=hotkey_ss58,
|
858
891
|
destination_hotkey=hotkey_ss58,
|
859
892
|
amount_to_move=amount_to_swap,
|
893
|
+
stake_fee=stake_fee,
|
860
894
|
)
|
861
895
|
except ValueError:
|
862
896
|
return False
|