bittensor-cli 9.0.0rc4__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 +254 -99
- bittensor_cli/src/__init__.py +50 -25
- bittensor_cli/src/bittensor/balances.py +1 -1
- bittensor_cli/src/bittensor/chain_data.py +20 -8
- bittensor_cli/src/bittensor/extrinsics/registration.py +26 -34
- bittensor_cli/src/bittensor/extrinsics/root.py +5 -11
- bittensor_cli/src/bittensor/extrinsics/transfer.py +15 -13
- bittensor_cli/src/bittensor/subtensor_interface.py +20 -20
- bittensor_cli/src/bittensor/utils.py +129 -19
- bittensor_cli/src/commands/stake/add.py +4 -8
- bittensor_cli/src/commands/stake/children_hotkeys.py +13 -19
- bittensor_cli/src/commands/stake/list.py +44 -77
- bittensor_cli/src/commands/stake/move.py +3 -3
- bittensor_cli/src/commands/stake/remove.py +216 -101
- bittensor_cli/src/commands/subnets/subnets.py +147 -5
- bittensor_cli/src/commands/sudo.py +192 -70
- bittensor_cli/src/commands/wallets.py +102 -52
- bittensor_cli/src/commands/weights.py +9 -13
- bittensor_cli/version.py +18 -0
- {bittensor_cli-9.0.0rc4.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.0rc4.dist-info/RECORD +0 -34
- {bittensor_cli-9.0.0rc4.dist-info → bittensor_cli-9.0.2.dist-info}/WHEEL +0 -0
- {bittensor_cli-9.0.0rc4.dist-info → bittensor_cli-9.0.2.dist-info}/entry_points.txt +0 -0
- {bittensor_cli-9.0.0rc4.dist-info → bittensor_cli-9.0.2.dist-info}/top_level.txt +0 -0
@@ -6,7 +6,7 @@ from typing import Generator, Optional
|
|
6
6
|
|
7
7
|
import aiohttp
|
8
8
|
from bittensor_wallet import Wallet, Keypair
|
9
|
-
from bittensor_wallet.errors import KeyFileError
|
9
|
+
from bittensor_wallet.errors import KeyFileError
|
10
10
|
from bittensor_wallet.keyfile import Keyfile
|
11
11
|
from fuzzywuzzy import fuzz
|
12
12
|
from rich import box
|
@@ -43,16 +43,11 @@ from bittensor_cli.src.bittensor.utils import (
|
|
43
43
|
validate_coldkey_presence,
|
44
44
|
get_subnet_name,
|
45
45
|
millify_tao,
|
46
|
+
unlock_key,
|
47
|
+
WalletLike,
|
46
48
|
)
|
47
49
|
|
48
50
|
|
49
|
-
class WalletLike:
|
50
|
-
def __init__(self, name=None, hotkey_ss58=None, hotkey_str=None):
|
51
|
-
self.name = name
|
52
|
-
self.hotkey_ss58 = hotkey_ss58
|
53
|
-
self.hotkey_str = hotkey_str
|
54
|
-
|
55
|
-
|
56
51
|
async def regen_coldkey(
|
57
52
|
wallet: Wallet,
|
58
53
|
mnemonic: Optional[str],
|
@@ -60,6 +55,7 @@ async def regen_coldkey(
|
|
60
55
|
json_path: Optional[str] = None,
|
61
56
|
json_password: Optional[str] = "",
|
62
57
|
use_password: Optional[bool] = True,
|
58
|
+
overwrite: Optional[bool] = False,
|
63
59
|
):
|
64
60
|
"""Creates a new coldkey under this wallet"""
|
65
61
|
json_str: Optional[str] = None
|
@@ -69,13 +65,21 @@ async def regen_coldkey(
|
|
69
65
|
with open(json_path, "r") as f:
|
70
66
|
json_str = f.read()
|
71
67
|
try:
|
72
|
-
wallet.regenerate_coldkey(
|
68
|
+
new_wallet = wallet.regenerate_coldkey(
|
73
69
|
mnemonic=mnemonic,
|
74
70
|
seed=seed,
|
75
71
|
json=(json_str, json_password) if all([json_str, json_password]) else None,
|
76
72
|
use_password=use_password,
|
77
|
-
overwrite=
|
73
|
+
overwrite=overwrite,
|
78
74
|
)
|
75
|
+
|
76
|
+
if isinstance(new_wallet, Wallet):
|
77
|
+
console.print(
|
78
|
+
"\n✅ [dark_sea_green]Regenerated coldkey successfully!\n",
|
79
|
+
f"[dark_sea_green]Wallet name: ({new_wallet.name}), path: ({new_wallet.path}), coldkey ss58: ({new_wallet.coldkeypub.ss58_address})",
|
80
|
+
)
|
81
|
+
except ValueError:
|
82
|
+
print_error("Mnemonic phrase is invalid")
|
79
83
|
except KeyFileError:
|
80
84
|
print_error("KeyFileError: File is not writable")
|
81
85
|
|
@@ -84,14 +88,20 @@ async def regen_coldkey_pub(
|
|
84
88
|
wallet: Wallet,
|
85
89
|
ss58_address: str,
|
86
90
|
public_key_hex: str,
|
91
|
+
overwrite: Optional[bool] = False,
|
87
92
|
):
|
88
93
|
"""Creates a new coldkeypub under this wallet."""
|
89
94
|
try:
|
90
|
-
wallet.regenerate_coldkeypub(
|
95
|
+
new_coldkeypub = wallet.regenerate_coldkeypub(
|
91
96
|
ss58_address=ss58_address,
|
92
97
|
public_key=public_key_hex,
|
93
|
-
overwrite=
|
98
|
+
overwrite=overwrite,
|
94
99
|
)
|
100
|
+
if isinstance(new_coldkeypub, Wallet):
|
101
|
+
console.print(
|
102
|
+
"\n✅ [dark_sea_green]Regenerated coldkeypub successfully!\n",
|
103
|
+
f"[dark_sea_green]Wallet name: ({new_coldkeypub.name}), path: ({new_coldkeypub.path}), coldkey ss58: ({new_coldkeypub.coldkeypub.ss58_address})",
|
104
|
+
)
|
95
105
|
except KeyFileError:
|
96
106
|
print_error("KeyFileError: File is not writable")
|
97
107
|
|
@@ -103,6 +113,7 @@ async def regen_hotkey(
|
|
103
113
|
json_path: Optional[str],
|
104
114
|
json_password: Optional[str] = "",
|
105
115
|
use_password: Optional[bool] = False,
|
116
|
+
overwrite: Optional[bool] = False,
|
106
117
|
):
|
107
118
|
"""Creates a new hotkey under this wallet."""
|
108
119
|
json_str: Optional[str] = None
|
@@ -114,13 +125,20 @@ async def regen_hotkey(
|
|
114
125
|
json_str = f.read()
|
115
126
|
|
116
127
|
try:
|
117
|
-
wallet.regenerate_hotkey(
|
128
|
+
new_hotkey = wallet.regenerate_hotkey(
|
118
129
|
mnemonic=mnemonic,
|
119
130
|
seed=seed,
|
120
131
|
json=(json_str, json_password) if all([json_str, json_password]) else None,
|
121
132
|
use_password=use_password,
|
122
|
-
overwrite=
|
133
|
+
overwrite=overwrite,
|
123
134
|
)
|
135
|
+
if isinstance(new_hotkey, Wallet):
|
136
|
+
console.print(
|
137
|
+
"\n✅ [dark_sea_green]Regenerated hotkey successfully!\n",
|
138
|
+
f"[dark_sea_green]Wallet name: ({new_hotkey.name}), path: ({new_hotkey.path}), hotkey ss58: ({new_hotkey.hotkey.ss58_address})",
|
139
|
+
)
|
140
|
+
except ValueError:
|
141
|
+
print_error("Mnemonic phrase is invalid")
|
124
142
|
except KeyFileError:
|
125
143
|
print_error("KeyFileError: File is not writable")
|
126
144
|
|
@@ -130,6 +148,7 @@ async def new_hotkey(
|
|
130
148
|
n_words: int,
|
131
149
|
use_password: bool,
|
132
150
|
uri: Optional[str] = None,
|
151
|
+
overwrite: Optional[bool] = False,
|
133
152
|
):
|
134
153
|
"""Creates a new hotkey under this wallet."""
|
135
154
|
try:
|
@@ -146,7 +165,7 @@ async def new_hotkey(
|
|
146
165
|
wallet.create_new_hotkey(
|
147
166
|
n_words=n_words,
|
148
167
|
use_password=use_password,
|
149
|
-
overwrite=
|
168
|
+
overwrite=overwrite,
|
150
169
|
)
|
151
170
|
console.print("[dark_sea_green]Hotkey created[/dark_sea_green]")
|
152
171
|
except KeyFileError:
|
@@ -158,6 +177,7 @@ async def new_coldkey(
|
|
158
177
|
n_words: int,
|
159
178
|
use_password: bool,
|
160
179
|
uri: Optional[str] = None,
|
180
|
+
overwrite: Optional[bool] = False,
|
161
181
|
):
|
162
182
|
"""Creates a new coldkey under this wallet."""
|
163
183
|
try:
|
@@ -175,7 +195,7 @@ async def new_coldkey(
|
|
175
195
|
wallet.create_new_coldkey(
|
176
196
|
n_words=n_words,
|
177
197
|
use_password=use_password,
|
178
|
-
overwrite=
|
198
|
+
overwrite=overwrite,
|
179
199
|
)
|
180
200
|
console.print("[dark_sea_green]Coldkey created[/dark_sea_green]")
|
181
201
|
except KeyFileError:
|
@@ -187,6 +207,7 @@ async def wallet_create(
|
|
187
207
|
n_words: int = 12,
|
188
208
|
use_password: bool = True,
|
189
209
|
uri: Optional[str] = None,
|
210
|
+
overwrite: Optional[bool] = False,
|
190
211
|
):
|
191
212
|
"""Creates a new wallet."""
|
192
213
|
if uri:
|
@@ -205,7 +226,7 @@ async def wallet_create(
|
|
205
226
|
wallet.create_new_coldkey(
|
206
227
|
n_words=n_words,
|
207
228
|
use_password=use_password,
|
208
|
-
overwrite=
|
229
|
+
overwrite=overwrite,
|
209
230
|
)
|
210
231
|
console.print("[dark_sea_green]Coldkey created[/dark_sea_green]")
|
211
232
|
except KeyFileError:
|
@@ -215,7 +236,7 @@ async def wallet_create(
|
|
215
236
|
wallet.create_new_hotkey(
|
216
237
|
n_words=n_words,
|
217
238
|
use_password=False,
|
218
|
-
overwrite=
|
239
|
+
overwrite=overwrite,
|
219
240
|
)
|
220
241
|
console.print("[dark_sea_green]Hotkey created[/dark_sea_green]")
|
221
242
|
except KeyFileError:
|
@@ -263,11 +284,7 @@ async def wallet_balance(
|
|
263
284
|
"""Retrieves the current balance of the specified wallet"""
|
264
285
|
if ss58_addresses:
|
265
286
|
coldkeys = ss58_addresses
|
266
|
-
|
267
|
-
wallet_names = [
|
268
|
-
f"{identities.get(coldkey, {'name': f'Provided address {i}'})['name']}"
|
269
|
-
for i, coldkey in enumerate(coldkeys)
|
270
|
-
]
|
287
|
+
wallet_names = [f"Provided Address {i + 1}" for i in range(len(ss58_addresses))]
|
271
288
|
|
272
289
|
elif not all_balances:
|
273
290
|
if not wallet.coldkeypub_file.exists_on_device():
|
@@ -286,19 +303,29 @@ async def wallet_balance(
|
|
286
303
|
wallet_names = [wallet.name]
|
287
304
|
|
288
305
|
block_hash = await subtensor.substrate.get_chain_head()
|
289
|
-
free_balances = await
|
306
|
+
free_balances, staked_balances = await asyncio.gather(
|
307
|
+
subtensor.get_balances(*coldkeys, block_hash=block_hash),
|
308
|
+
subtensor.get_total_stake_for_coldkey(*coldkeys, block_hash=block_hash),
|
309
|
+
)
|
290
310
|
|
291
311
|
total_free_balance = sum(free_balances.values())
|
312
|
+
total_staked_balance = sum(stake[0] for stake in staked_balances.values())
|
313
|
+
total_staked_with_slippage = sum(stake[1] for stake in staked_balances.values())
|
292
314
|
|
293
315
|
balances = {
|
294
|
-
name: (
|
316
|
+
name: (
|
317
|
+
coldkey,
|
318
|
+
free_balances[coldkey],
|
319
|
+
staked_balances[coldkey][0],
|
320
|
+
staked_balances[coldkey][1],
|
321
|
+
)
|
295
322
|
for (name, coldkey) in zip(wallet_names, coldkeys)
|
296
323
|
}
|
297
324
|
|
298
325
|
table = Table(
|
299
326
|
Column(
|
300
327
|
"[white]Wallet Name",
|
301
|
-
style="
|
328
|
+
style=COLOR_PALETTE["GENERAL"]["SUBHEADING_MAIN"],
|
302
329
|
no_wrap=True,
|
303
330
|
),
|
304
331
|
Column(
|
@@ -312,7 +339,31 @@ async def wallet_balance(
|
|
312
339
|
style=COLOR_PALETTE["GENERAL"]["BALANCE"],
|
313
340
|
no_wrap=True,
|
314
341
|
),
|
315
|
-
|
342
|
+
Column(
|
343
|
+
"[white]Staked Value",
|
344
|
+
justify="right",
|
345
|
+
style=COLOR_PALETTE["STAKE"]["STAKE_ALPHA"],
|
346
|
+
no_wrap=True,
|
347
|
+
),
|
348
|
+
Column(
|
349
|
+
"[white]Staked (w/slippage)",
|
350
|
+
justify="right",
|
351
|
+
style=COLOR_PALETTE["STAKE"]["STAKE_SWAP"],
|
352
|
+
no_wrap=True,
|
353
|
+
),
|
354
|
+
Column(
|
355
|
+
"[white]Total Balance",
|
356
|
+
justify="right",
|
357
|
+
style=COLOR_PALETTE["GENERAL"]["BALANCE"],
|
358
|
+
no_wrap=True,
|
359
|
+
),
|
360
|
+
Column(
|
361
|
+
"[white]Total (w/slippage)",
|
362
|
+
justify="right",
|
363
|
+
style=COLOR_PALETTE["GENERAL"]["BALANCE"],
|
364
|
+
no_wrap=True,
|
365
|
+
),
|
366
|
+
title=f"\n[{COLOR_PALETTE['GENERAL']['HEADER']}]Wallet Coldkey Balance[/{COLOR_PALETTE['GENERAL']['HEADER']}]\n[{COLOR_PALETTE['GENERAL']['HEADER']}]Network: {subtensor.network}\n",
|
316
367
|
show_footer=True,
|
317
368
|
show_edge=False,
|
318
369
|
border_style="bright_black",
|
@@ -322,17 +373,25 @@ async def wallet_balance(
|
|
322
373
|
leading=True,
|
323
374
|
)
|
324
375
|
|
325
|
-
for name, (coldkey, free) in balances.items():
|
376
|
+
for name, (coldkey, free, staked, staked_slippage) in balances.items():
|
326
377
|
table.add_row(
|
327
378
|
name,
|
328
379
|
coldkey,
|
329
380
|
str(free),
|
381
|
+
str(staked),
|
382
|
+
str(staked_slippage),
|
383
|
+
str(free + staked),
|
384
|
+
str(free + staked_slippage),
|
330
385
|
)
|
331
386
|
table.add_row()
|
332
387
|
table.add_row(
|
333
388
|
"Total Balance",
|
334
389
|
"",
|
335
390
|
str(total_free_balance),
|
391
|
+
str(total_staked_balance),
|
392
|
+
str(total_staked_with_slippage),
|
393
|
+
str(total_free_balance + total_staked_balance),
|
394
|
+
str(total_free_balance + total_staked_with_slippage),
|
336
395
|
)
|
337
396
|
console.print(Padding(table, (0, 0, 0, 4)))
|
338
397
|
await subtensor.substrate.close()
|
@@ -487,7 +546,9 @@ async def wallet_list(wallet_path: str):
|
|
487
546
|
wallet_tree = root.add(
|
488
547
|
f"[bold blue]Coldkey[/bold blue] [green]{wallet.name}[/green] ss58_address [green]{coldkeypub_str}[/green]"
|
489
548
|
)
|
490
|
-
hotkeys = utils.get_hotkey_wallets_for_wallet(
|
549
|
+
hotkeys = utils.get_hotkey_wallets_for_wallet(
|
550
|
+
wallet, show_nulls=True, show_encrypted=True
|
551
|
+
)
|
491
552
|
for hkey in hotkeys:
|
492
553
|
data = f"[bold red]Hotkey[/bold red][green] {hkey}[/green] (?)"
|
493
554
|
if hkey:
|
@@ -1047,11 +1108,17 @@ async def transfer(
|
|
1047
1108
|
subtensor: SubtensorInterface,
|
1048
1109
|
destination: str,
|
1049
1110
|
amount: float,
|
1111
|
+
transfer_all: bool,
|
1050
1112
|
prompt: bool,
|
1051
1113
|
):
|
1052
1114
|
"""Transfer token of amount to destination."""
|
1053
1115
|
await transfer_extrinsic(
|
1054
|
-
subtensor,
|
1116
|
+
subtensor=subtensor,
|
1117
|
+
wallet=wallet,
|
1118
|
+
destination=destination,
|
1119
|
+
amount=Balance.from_tao(amount),
|
1120
|
+
transfer_all=transfer_all,
|
1121
|
+
prompt=prompt,
|
1055
1122
|
)
|
1056
1123
|
|
1057
1124
|
|
@@ -1211,13 +1278,14 @@ async def faucet(
|
|
1211
1278
|
output_in_place: bool,
|
1212
1279
|
log_verbose: bool,
|
1213
1280
|
max_successes: int = 3,
|
1281
|
+
prompt: bool = True,
|
1214
1282
|
):
|
1215
1283
|
# TODO: - work out prompts to be passed through the cli
|
1216
1284
|
success = await run_faucet_extrinsic(
|
1217
1285
|
subtensor,
|
1218
1286
|
wallet,
|
1219
1287
|
tpb=threads_per_block,
|
1220
|
-
prompt=
|
1288
|
+
prompt=prompt,
|
1221
1289
|
update_interval=update_interval,
|
1222
1290
|
num_processes=processes,
|
1223
1291
|
cuda=use_cuda,
|
@@ -1303,10 +1371,7 @@ async def set_id(
|
|
1303
1371
|
)
|
1304
1372
|
return False
|
1305
1373
|
|
1306
|
-
|
1307
|
-
wallet.unlock_coldkey()
|
1308
|
-
except KeyFileError:
|
1309
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
1374
|
+
if not unlock_key(wallet).success:
|
1310
1375
|
return False
|
1311
1376
|
|
1312
1377
|
call = await subtensor.substrate.compose_call(
|
@@ -1398,30 +1463,15 @@ async def check_coldkey_swap(wallet: Wallet, subtensor: SubtensorInterface):
|
|
1398
1463
|
async def sign(wallet: Wallet, message: str, use_hotkey: str):
|
1399
1464
|
"""Sign a message using the provided wallet or hotkey."""
|
1400
1465
|
|
1401
|
-
def _unlock(key: str):
|
1402
|
-
try:
|
1403
|
-
getattr(wallet, f"unlock_{key}")()
|
1404
|
-
return True
|
1405
|
-
except PasswordError:
|
1406
|
-
err_console.print(
|
1407
|
-
":cross_mark: [red]The password used to decrypt your keyfile is invalid[/red]"
|
1408
|
-
)
|
1409
|
-
return False
|
1410
|
-
except KeyFileError:
|
1411
|
-
err_console.print(
|
1412
|
-
":cross_mark: [red]Keyfile is corrupt, non-writable, or non-readable[/red]:"
|
1413
|
-
)
|
1414
|
-
return False
|
1415
|
-
|
1416
1466
|
if not use_hotkey:
|
1417
|
-
if not
|
1467
|
+
if not unlock_key(wallet, "cold").success:
|
1418
1468
|
return False
|
1419
1469
|
keypair = wallet.coldkey
|
1420
1470
|
print_verbose(
|
1421
1471
|
f"Signing using [{COLOR_PALETTE['GENERAL']['COLDKEY']}]coldkey: {wallet.name}"
|
1422
1472
|
)
|
1423
1473
|
else:
|
1424
|
-
if not
|
1474
|
+
if not unlock_key(wallet, "hot").success:
|
1425
1475
|
return False
|
1426
1476
|
keypair = wallet.hotkey
|
1427
1477
|
print_verbose(
|
@@ -134,9 +134,7 @@ class SetWeightsExtrinsic:
|
|
134
134
|
try:
|
135
135
|
success, message = await self.do_commit_weights(commit_hash=commit_hash)
|
136
136
|
except SubstrateRequestException as e:
|
137
|
-
err_console.print(
|
138
|
-
f"Error committing weights: {format_error_message(e, self.subtensor.substrate)}"
|
139
|
-
)
|
137
|
+
err_console.print(f"Error committing weights: {format_error_message(e)}")
|
140
138
|
# bittensor.logging.error(f"Error committing weights: {e}")
|
141
139
|
success = False
|
142
140
|
message = "No attempt made. Perhaps it is too soon to commit weights!"
|
@@ -257,7 +255,7 @@ class SetWeightsExtrinsic:
|
|
257
255
|
wait_for_finalization=self.wait_for_finalization,
|
258
256
|
)
|
259
257
|
except SubstrateRequestException as e:
|
260
|
-
return False, format_error_message(e
|
258
|
+
return False, format_error_message(e)
|
261
259
|
# We only wait here if we expect finalization.
|
262
260
|
if not self.wait_for_finalization and not self.wait_for_inclusion:
|
263
261
|
return True, "Not waiting for finalization or inclusion."
|
@@ -266,9 +264,7 @@ class SetWeightsExtrinsic:
|
|
266
264
|
if await response.is_success:
|
267
265
|
return True, "Successfully set weights."
|
268
266
|
else:
|
269
|
-
return False, format_error_message(
|
270
|
-
await response.error_message, self.subtensor.substrate
|
271
|
-
)
|
267
|
+
return False, format_error_message(await response.error_message)
|
272
268
|
|
273
269
|
with console.status(
|
274
270
|
f":satellite: Setting weights on [white]{self.subtensor.network}[/white] ..."
|
@@ -314,7 +310,7 @@ class SetWeightsExtrinsic:
|
|
314
310
|
wait_for_finalization=self.wait_for_finalization,
|
315
311
|
)
|
316
312
|
except SubstrateRequestException as e:
|
317
|
-
return False, format_error_message(e
|
313
|
+
return False, format_error_message(e)
|
318
314
|
|
319
315
|
if not self.wait_for_finalization and not self.wait_for_inclusion:
|
320
316
|
success, error_message = True, ""
|
@@ -326,9 +322,7 @@ class SetWeightsExtrinsic:
|
|
326
322
|
else:
|
327
323
|
success, error_message = (
|
328
324
|
False,
|
329
|
-
format_error_message(
|
330
|
-
await response.error_message, self.subtensor.substrate
|
331
|
-
),
|
325
|
+
format_error_message(await response.error_message),
|
332
326
|
)
|
333
327
|
|
334
328
|
if success:
|
@@ -378,6 +372,7 @@ async def reveal_weights(
|
|
378
372
|
weights: list[float],
|
379
373
|
salt: list[int],
|
380
374
|
version: int,
|
375
|
+
prompt: bool = True,
|
381
376
|
) -> None:
|
382
377
|
"""Reveal weights for a specific subnet."""
|
383
378
|
uids_ = np.array(
|
@@ -397,7 +392,7 @@ async def reveal_weights(
|
|
397
392
|
)
|
398
393
|
# Call the reveal function in the module set_weights from extrinsics package
|
399
394
|
extrinsic = SetWeightsExtrinsic(
|
400
|
-
subtensor, wallet, netuid, uids_, weights_, list(salt_), version
|
395
|
+
subtensor, wallet, netuid, uids_, weights_, list(salt_), version, prompt=prompt
|
401
396
|
)
|
402
397
|
success, message = await extrinsic.reveal(weight_uids, weight_vals)
|
403
398
|
|
@@ -415,6 +410,7 @@ async def commit_weights(
|
|
415
410
|
weights: list[float],
|
416
411
|
salt: list[int],
|
417
412
|
version: int,
|
413
|
+
prompt: bool = True,
|
418
414
|
):
|
419
415
|
"""Commits weights and then reveals them for a specific subnet"""
|
420
416
|
uids_ = np.array(
|
@@ -430,7 +426,7 @@ async def commit_weights(
|
|
430
426
|
dtype=np.int64,
|
431
427
|
)
|
432
428
|
extrinsic = SetWeightsExtrinsic(
|
433
|
-
subtensor, wallet, netuid, uids_, weights_, list(salt_), version
|
429
|
+
subtensor, wallet, netuid, uids_, weights_, list(salt_), version, prompt=prompt
|
434
430
|
)
|
435
431
|
success, message = await extrinsic.set_weights_extrinsic()
|
436
432
|
if success:
|
bittensor_cli/version.py
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
import re
|
2
|
+
|
3
|
+
def version_as_int(version):
|
4
|
+
_core_version = re.match(r"^\d+\.\d+\.\d+", version).group(0)
|
5
|
+
_version_split = _core_version.split(".")
|
6
|
+
__version_info__ = tuple(int(part) for part in _version_split)
|
7
|
+
_version_int_base = 1000
|
8
|
+
assert max(__version_info__) < _version_int_base
|
9
|
+
|
10
|
+
__version_as_int__: int = sum(
|
11
|
+
e * (_version_int_base**i) for i, e in enumerate(reversed(__version_info__))
|
12
|
+
)
|
13
|
+
assert __version_as_int__ < 2**31 # fits in int32
|
14
|
+
__new_signature_version__ = 360
|
15
|
+
return __version_as_int__
|
16
|
+
|
17
|
+
__version__ = "9.0.2"
|
18
|
+
__version_as_int__ = version_as_int(__version__)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: bittensor-cli
|
3
|
-
Version: 9.0.
|
3
|
+
Version: 9.0.2
|
4
4
|
Summary: Bittensor CLI
|
5
5
|
Home-page: https://github.com/opentensor/btcli
|
6
6
|
Author: bittensor.com
|
@@ -25,7 +25,7 @@ Requires-Python: >=3.9
|
|
25
25
|
Description-Content-Type: text/markdown
|
26
26
|
Requires-Dist: wheel
|
27
27
|
Requires-Dist: async-property==0.2.2
|
28
|
-
Requires-Dist: async-substrate-interface>=1.0.
|
28
|
+
Requires-Dist: async-substrate-interface>=1.0.3
|
29
29
|
Requires-Dist: aiohttp~=3.10.2
|
30
30
|
Requires-Dist: backoff~=2.2.1
|
31
31
|
Requires-Dist: GitPython>=3.0.0
|
@@ -41,7 +41,7 @@ Requires-Dist: rich~=13.7
|
|
41
41
|
Requires-Dist: scalecodec==1.2.11
|
42
42
|
Requires-Dist: typer~=0.12
|
43
43
|
Requires-Dist: websockets>=14.1
|
44
|
-
Requires-Dist: bittensor-wallet>=3.0.
|
44
|
+
Requires-Dist: bittensor-wallet>=3.0.4
|
45
45
|
Requires-Dist: plotille
|
46
46
|
Requires-Dist: pywry
|
47
47
|
Requires-Dist: plotly
|
@@ -0,0 +1,35 @@
|
|
1
|
+
bittensor_cli/__init__.py,sha256=Lpv4NkbAQgwrfqFOnTMuR_S-fqGdaWCSLhxnFnGTHM0,1232
|
2
|
+
bittensor_cli/cli.py,sha256=hiCu9JQFnu22Q1WjpApkhzNvP9EuR3grNYXWcvGoufc,192627
|
3
|
+
bittensor_cli/doc_generation_helper.py,sha256=GexqjEIKulWg84hpNBEchJ840oOgOi7DWpt447nsdNI,91
|
4
|
+
bittensor_cli/version.py,sha256=W091sz9aNjfMKBgfd7SGgZHim3RwQSv-M8lo7mgPIEY,621
|
5
|
+
bittensor_cli/src/__init__.py,sha256=rTtP85aCliJTLdWv2DYFNgw5Fi0KB2--80Xta5_WsXE,26427
|
6
|
+
bittensor_cli/src/bittensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
bittensor_cli/src/bittensor/balances.py,sha256=EZI8hX-eCkTfuTZq5GMvRYU6DCdl8V_zyZIQWi05K5g,11084
|
8
|
+
bittensor_cli/src/bittensor/chain_data.py,sha256=WV_zX_05Zam1yp_oMX9VIYxu99cGPUGEnhCyH67vNtE,30856
|
9
|
+
bittensor_cli/src/bittensor/minigraph.py,sha256=BIzmSVLfBYiRAeGD_i1LAC8Cw7zxp38a91SIFEPMqYc,10479
|
10
|
+
bittensor_cli/src/bittensor/networking.py,sha256=pZLMs8YXpZzDMLXWMBb_Bj6TVkm_q9khyY-lnbwVMuE,462
|
11
|
+
bittensor_cli/src/bittensor/subtensor_interface.py,sha256=mprNkG462WW57eRUhMmDE4gHGuMoeIvBeQLLSxIppLI,53098
|
12
|
+
bittensor_cli/src/bittensor/utils.py,sha256=E57t4SiASuXCjiXLLU63vK6bK6aKqj9JtIIi9lDOi-k,46238
|
13
|
+
bittensor_cli/src/bittensor/extrinsics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
+
bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=3mJZ3hw_wZEa-8I0R8WVuKjMQi4Y9EV5FjTCvbY37Iw,63780
|
15
|
+
bittensor_cli/src/bittensor/extrinsics/root.py,sha256=N9Fg4VaveRRP1ZN4EZjIWCe04FpTNBKWFqx8USKp9uQ,19062
|
16
|
+
bittensor_cli/src/bittensor/extrinsics/transfer.py,sha256=FyrRo3yk-065toN4f-1Xes23CE5tqP5KU0dBJkKofUc,8476
|
17
|
+
bittensor_cli/src/bittensor/templates/table.j2,sha256=P2EFiksnO1cQsB8zjK6hVJwUryHTsLslzRE0YtobAV8,10601
|
18
|
+
bittensor_cli/src/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
|
+
bittensor_cli/src/commands/sudo.py,sha256=yjmUuOrKkz0Ft2TqHWl4Lw96aYRCEk9kdvtyXCTOASE,31295
|
20
|
+
bittensor_cli/src/commands/wallets.py,sha256=hv9gzh-zPS8gXzgJIfENQVR6BFYxh6abjxmHUjqMhsY,51086
|
21
|
+
bittensor_cli/src/commands/weights.py,sha256=uI7aACKD90JOtYt61VdKL76z7Fe_wh4WtdwMXL6ydD4,16269
|
22
|
+
bittensor_cli/src/commands/stake/__init__.py,sha256=uxomMv_QrYt5Qn3_X5UWFFh45ISjB0JmDmCFxVyX8nQ,6495
|
23
|
+
bittensor_cli/src/commands/stake/add.py,sha256=ZPFuvlTUT2z23urITj_RLUBe51jqyfZ8l22-zdd2Nzg,25074
|
24
|
+
bittensor_cli/src/commands/stake/children_hotkeys.py,sha256=9CMc56eg_6-tpRz9x5ml4Brc5SSbhC7KDlJqYgQ4XiU,29576
|
25
|
+
bittensor_cli/src/commands/stake/list.py,sha256=AnzBhUjuwckFAXYwgv9Yk1JHUKu2w1h8_m8-hf77g80,28625
|
26
|
+
bittensor_cli/src/commands/stake/move.py,sha256=rFCHpkdyUc6tSp1YiJ3fOVG_s6La7YVwQPhXDIBD_FE,37406
|
27
|
+
bittensor_cli/src/commands/stake/remove.py,sha256=6RnxandM05xAG1QJ_vRtWRI0xlzfZC_4kEJgOPKua0M,47069
|
28
|
+
bittensor_cli/src/commands/subnets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
|
+
bittensor_cli/src/commands/subnets/price.py,sha256=TWcRXUFeS_Q-pfyv0YIluAL8SE7d2gzTODK-9M2J5pw,29878
|
30
|
+
bittensor_cli/src/commands/subnets/subnets.py,sha256=ObB2g-iTCPkmrHomR0RHdvqX8FSHXaywSIoIFXko1h4,84118
|
31
|
+
bittensor_cli-9.0.2.dist-info/METADATA,sha256=a-FAYGb9717y58lnFPAtwbKdVBCDwC4edgLf7sQd-GI,6855
|
32
|
+
bittensor_cli-9.0.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
33
|
+
bittensor_cli-9.0.2.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
|
34
|
+
bittensor_cli-9.0.2.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
|
35
|
+
bittensor_cli-9.0.2.dist-info/RECORD,,
|
@@ -1,34 +0,0 @@
|
|
1
|
-
bittensor_cli/__init__.py,sha256=9HvyLfJ2pUxwPjgT8Aqp6uWbkuD-TKrpVMLUBeD9U9A,1216
|
2
|
-
bittensor_cli/cli.py,sha256=LHeltSOQArKSc2Fct6dIUwXPoJs1pJoA4Y0aHvDGC_g,186698
|
3
|
-
bittensor_cli/doc_generation_helper.py,sha256=GexqjEIKulWg84hpNBEchJ840oOgOi7DWpt447nsdNI,91
|
4
|
-
bittensor_cli/src/__init__.py,sha256=CBUMVER1JwPi2bWXhpPJ4xtZqPZyvekExOS7Fv6HtAE,25531
|
5
|
-
bittensor_cli/src/bittensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
bittensor_cli/src/bittensor/balances.py,sha256=E-niENvR7lAaoS5ZyCmwl_9M-nspnkcuIxf_dHiJIDg,11078
|
7
|
-
bittensor_cli/src/bittensor/chain_data.py,sha256=6VyuoDLaJz2QC9NJz9x2Ampi2fdqXumg6cCFfN-Vpq4,30642
|
8
|
-
bittensor_cli/src/bittensor/minigraph.py,sha256=BIzmSVLfBYiRAeGD_i1LAC8Cw7zxp38a91SIFEPMqYc,10479
|
9
|
-
bittensor_cli/src/bittensor/networking.py,sha256=pZLMs8YXpZzDMLXWMBb_Bj6TVkm_q9khyY-lnbwVMuE,462
|
10
|
-
bittensor_cli/src/bittensor/subtensor_interface.py,sha256=rwB-P0rw_h-ynO9KUNK4ODooboHpQ54RoNBKSVU9BxA,53074
|
11
|
-
bittensor_cli/src/bittensor/utils.py,sha256=q_uSvTDpgQOqWhvwi3gi7xoROSlBJ0K1ErwUenqURag,42962
|
12
|
-
bittensor_cli/src/bittensor/extrinsics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=OYRq6hjKzKpZuMjsVK-3O6xeV3TCOZch3VEt8hGITjo,64169
|
14
|
-
bittensor_cli/src/bittensor/extrinsics/root.py,sha256=PvAPkLqfcCRLAR_d1qu3YfKhywFZuHuUyy5h_XZzfR8,19359
|
15
|
-
bittensor_cli/src/bittensor/extrinsics/transfer.py,sha256=mg7hyvQX2IGVh4hkTd1u_ouRi6U4t_HBgNtRbsWiHbM,8352
|
16
|
-
bittensor_cli/src/bittensor/templates/table.j2,sha256=P2EFiksnO1cQsB8zjK6hVJwUryHTsLslzRE0YtobAV8,10601
|
17
|
-
bittensor_cli/src/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
-
bittensor_cli/src/commands/sudo.py,sha256=PTOTp0_OmWksi29k4d33qmNWZAOKAcjZyU7G3wNIdjs,26343
|
19
|
-
bittensor_cli/src/commands/wallets.py,sha256=qH0TkeSQqvowZ8uGF8qeQOgyBS-KxyegD4VK0S0BG4Q,48802
|
20
|
-
bittensor_cli/src/commands/weights.py,sha256=icJpHGLBxMUYvVUFkmPxMYuKAgBx4ELjY7f1WvX3rqg,16433
|
21
|
-
bittensor_cli/src/commands/stake/__init__.py,sha256=uxomMv_QrYt5Qn3_X5UWFFh45ISjB0JmDmCFxVyX8nQ,6495
|
22
|
-
bittensor_cli/src/commands/stake/add.py,sha256=57Dhu8B6EGlEBrsqtHJ4k_en5p_oZ1b0L1YbB0dEspw,25226
|
23
|
-
bittensor_cli/src/commands/stake/children_hotkeys.py,sha256=k8XxWuoUVTaDi6PtrHwnVqc0gs9sGbrogP5XpCVbK7E,29745
|
24
|
-
bittensor_cli/src/commands/stake/list.py,sha256=Z5pB5YlSLfY0QWR4ZWd-IWXbQRWy09FBK6iHsodWntk,29797
|
25
|
-
bittensor_cli/src/commands/stake/move.py,sha256=YEXz5BfhAaQUJYyG11qnhXvFsSmz6ZJ6U4CWLHey4AE,37466
|
26
|
-
bittensor_cli/src/commands/stake/remove.py,sha256=T8poiXia_9hexiVXdi7YG6SzicoEt2sIybN2SIFDyP4,43393
|
27
|
-
bittensor_cli/src/commands/subnets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
|
-
bittensor_cli/src/commands/subnets/price.py,sha256=TWcRXUFeS_Q-pfyv0YIluAL8SE7d2gzTODK-9M2J5pw,29878
|
29
|
-
bittensor_cli/src/commands/subnets/subnets.py,sha256=ydCKUvmEwJK3hVns4QaV_Cw4sZTajrQk0CVGs_ynBcM,79805
|
30
|
-
bittensor_cli-9.0.0rc4.dist-info/METADATA,sha256=j_Ocs-LAFHWU_LhNEkSN6ZET6LHuHQVpX_LdOQ4cqm0,6862
|
31
|
-
bittensor_cli-9.0.0rc4.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
32
|
-
bittensor_cli-9.0.0rc4.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
|
33
|
-
bittensor_cli-9.0.0rc4.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
|
34
|
-
bittensor_cli-9.0.0rc4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|