bittensor-cli 8.2.0__py3-none-any.whl → 8.3.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/__init__.py +1 -1
- bittensor_cli/cli.py +186 -123
- bittensor_cli/src/__init__.py +4 -2
- bittensor_cli/src/bittensor/async_substrate_interface.py +35 -25
- bittensor_cli/src/bittensor/extrinsics/registration.py +38 -30
- bittensor_cli/src/bittensor/extrinsics/root.py +3 -7
- bittensor_cli/src/bittensor/extrinsics/transfer.py +17 -6
- bittensor_cli/src/bittensor/subtensor_interface.py +11 -11
- bittensor_cli/src/bittensor/utils.py +50 -8
- bittensor_cli/src/commands/root.py +6 -19
- bittensor_cli/src/commands/stake/children_hotkeys.py +12 -14
- bittensor_cli/src/commands/stake/stake.py +8 -14
- bittensor_cli/src/commands/subnets.py +4 -5
- bittensor_cli/src/commands/sudo.py +2 -4
- bittensor_cli/src/commands/wallets.py +68 -73
- bittensor_cli/src/commands/weights.py +4 -2
- {bittensor_cli-8.2.0.dist-info → bittensor_cli-8.3.1.dist-info}/METADATA +3 -2
- bittensor_cli-8.3.1.dist-info/RECORD +31 -0
- {bittensor_cli-8.2.0.dist-info → bittensor_cli-8.3.1.dist-info}/WHEEL +1 -1
- bittensor_cli-8.2.0.dist-info/RECORD +0 -31
- {bittensor_cli-8.2.0.dist-info → bittensor_cli-8.3.1.dist-info}/entry_points.txt +0 -0
- {bittensor_cli-8.2.0.dist-info → bittensor_cli-8.3.1.dist-info}/top_level.txt +0 -0
@@ -2,7 +2,6 @@ import asyncio
|
|
2
2
|
from typing import Optional
|
3
3
|
|
4
4
|
from bittensor_wallet import Wallet
|
5
|
-
from bittensor_wallet.errors import KeyFileError
|
6
5
|
from rich.prompt import Confirm, Prompt, IntPrompt
|
7
6
|
from rich.table import Table
|
8
7
|
from rich.text import Text
|
@@ -19,6 +18,7 @@ from bittensor_cli.src.bittensor.utils import (
|
|
19
18
|
u64_to_float,
|
20
19
|
is_valid_ss58_address,
|
21
20
|
format_error_message,
|
21
|
+
unlock_key,
|
22
22
|
)
|
23
23
|
|
24
24
|
|
@@ -72,10 +72,8 @@ async def set_children_extrinsic(
|
|
72
72
|
return False, "Operation Cancelled"
|
73
73
|
|
74
74
|
# Decrypt coldkey.
|
75
|
-
|
76
|
-
|
77
|
-
except KeyFileError:
|
78
|
-
return False, "There was an error unlocking your coldkey."
|
75
|
+
if not (unlock_status := unlock_key(wallet, print_out=False)).success:
|
76
|
+
return False, unlock_status.message
|
79
77
|
|
80
78
|
with console.status(
|
81
79
|
f":satellite: {operation} on [white]{subtensor.network}[/white] ..."
|
@@ -158,10 +156,8 @@ async def set_childkey_take_extrinsic(
|
|
158
156
|
return False, "Operation Cancelled"
|
159
157
|
|
160
158
|
# Decrypt coldkey.
|
161
|
-
|
162
|
-
|
163
|
-
except KeyFileError:
|
164
|
-
return False, "There was an error unlocking your coldkey."
|
159
|
+
if not (unlock_status := unlock_key(wallet, print_out=False)).success:
|
160
|
+
return False, unlock_status.message
|
165
161
|
|
166
162
|
with console.status(
|
167
163
|
f":satellite: Setting childkey take on [white]{subtensor.network}[/white] ..."
|
@@ -494,6 +490,7 @@ async def set_children(
|
|
494
490
|
netuid: Optional[int] = None,
|
495
491
|
wait_for_inclusion: bool = True,
|
496
492
|
wait_for_finalization: bool = True,
|
493
|
+
prompt: bool = True,
|
497
494
|
):
|
498
495
|
"""Set children hotkeys."""
|
499
496
|
# Validate children SS58 addresses
|
@@ -520,7 +517,7 @@ async def set_children(
|
|
520
517
|
netuid=netuid,
|
521
518
|
hotkey=wallet.hotkey.ss58_address,
|
522
519
|
children_with_proportions=children_with_proportions,
|
523
|
-
prompt=
|
520
|
+
prompt=prompt,
|
524
521
|
wait_for_inclusion=wait_for_inclusion,
|
525
522
|
wait_for_finalization=wait_for_finalization,
|
526
523
|
)
|
@@ -549,7 +546,7 @@ async def set_children(
|
|
549
546
|
netuid=netuid,
|
550
547
|
hotkey=wallet.hotkey.ss58_address,
|
551
548
|
children_with_proportions=children_with_proportions,
|
552
|
-
prompt=
|
549
|
+
prompt=prompt,
|
553
550
|
wait_for_inclusion=True,
|
554
551
|
wait_for_finalization=False,
|
555
552
|
)
|
@@ -564,6 +561,7 @@ async def revoke_children(
|
|
564
561
|
netuid: Optional[int] = None,
|
565
562
|
wait_for_inclusion: bool = True,
|
566
563
|
wait_for_finalization: bool = True,
|
564
|
+
prompt: bool = True,
|
567
565
|
):
|
568
566
|
"""
|
569
567
|
Revokes the children hotkeys associated with a given network identifier (netuid).
|
@@ -575,7 +573,7 @@ async def revoke_children(
|
|
575
573
|
netuid=netuid,
|
576
574
|
hotkey=wallet.hotkey.ss58_address,
|
577
575
|
children_with_proportions=[],
|
578
|
-
prompt=
|
576
|
+
prompt=prompt,
|
579
577
|
wait_for_inclusion=wait_for_inclusion,
|
580
578
|
wait_for_finalization=wait_for_finalization,
|
581
579
|
)
|
@@ -604,7 +602,7 @@ async def revoke_children(
|
|
604
602
|
netuid=netuid,
|
605
603
|
hotkey=wallet.hotkey.ss58_address,
|
606
604
|
children_with_proportions=[],
|
607
|
-
prompt=
|
605
|
+
prompt=prompt,
|
608
606
|
wait_for_inclusion=True,
|
609
607
|
wait_for_finalization=False,
|
610
608
|
)
|
@@ -764,7 +762,7 @@ async def childkey_take(
|
|
764
762
|
netuid=netuid,
|
765
763
|
hotkey=wallet.hotkey.ss58_address,
|
766
764
|
take=take,
|
767
|
-
prompt=
|
765
|
+
prompt=prompt,
|
768
766
|
wait_for_inclusion=True,
|
769
767
|
wait_for_finalization=False,
|
770
768
|
)
|
@@ -7,7 +7,6 @@ from contextlib import suppress
|
|
7
7
|
from typing import TYPE_CHECKING, Optional, Sequence, Union, cast
|
8
8
|
|
9
9
|
from bittensor_wallet import Wallet
|
10
|
-
from bittensor_wallet.errors import KeyFileError
|
11
10
|
from rich.prompt import Confirm
|
12
11
|
from rich.table import Table, Column
|
13
12
|
import typer
|
@@ -28,6 +27,7 @@ from bittensor_cli.src.bittensor.utils import (
|
|
28
27
|
render_tree,
|
29
28
|
u16_normalized_float,
|
30
29
|
validate_coldkey_presence,
|
30
|
+
unlock_key,
|
31
31
|
)
|
32
32
|
|
33
33
|
if TYPE_CHECKING:
|
@@ -103,9 +103,7 @@ async def add_stake_extrinsic(
|
|
103
103
|
"""
|
104
104
|
|
105
105
|
# Decrypt keys,
|
106
|
-
|
107
|
-
wallet.unlock_coldkey()
|
108
|
-
except KeyFileError:
|
106
|
+
if not unlock_key(wallet).success:
|
109
107
|
return False
|
110
108
|
|
111
109
|
# Default to wallet's own hotkey if the value is not passed.
|
@@ -309,9 +307,7 @@ async def add_stake_multiple_extrinsic(
|
|
309
307
|
return True
|
310
308
|
|
311
309
|
# Decrypt coldkey.
|
312
|
-
|
313
|
-
wallet.unlock_coldkey()
|
314
|
-
except KeyFileError:
|
310
|
+
if not unlock_key(wallet).success:
|
315
311
|
return False
|
316
312
|
|
317
313
|
with console.status(
|
@@ -489,10 +485,8 @@ async def unstake_extrinsic(
|
|
489
485
|
:return: success: `True` if extrinsic was finalized or included in the block. If we did not wait for
|
490
486
|
finalization/inclusion, the response is `True`.
|
491
487
|
"""
|
492
|
-
# Decrypt
|
493
|
-
|
494
|
-
wallet.unlock_coldkey()
|
495
|
-
except KeyFileError:
|
488
|
+
# Decrypt coldkey
|
489
|
+
if not unlock_key(wallet).success:
|
496
490
|
return False
|
497
491
|
|
498
492
|
if hotkey_ss58 is None:
|
@@ -660,9 +654,7 @@ async def unstake_multiple_extrinsic(
|
|
660
654
|
return True
|
661
655
|
|
662
656
|
# Unlock coldkey.
|
663
|
-
|
664
|
-
wallet.unlock_coldkey()
|
665
|
-
except KeyFileError:
|
657
|
+
if not unlock_key(wallet).success:
|
666
658
|
return False
|
667
659
|
|
668
660
|
with console.status(
|
@@ -1178,6 +1170,7 @@ async def stake_add(
|
|
1178
1170
|
(wallet.hotkey_str, wallet.hotkey.ss58_address)
|
1179
1171
|
for wallet in all_hotkeys_
|
1180
1172
|
if wallet.hotkey_str not in exclude_hotkeys
|
1173
|
+
and wallet.hotkey.ss58_address not in exclude_hotkeys
|
1181
1174
|
] # definitely wallets
|
1182
1175
|
|
1183
1176
|
elif include_hotkeys:
|
@@ -1345,6 +1338,7 @@ async def unstake(
|
|
1345
1338
|
(wallet.hotkey_str, wallet.hotkey.ss58_address)
|
1346
1339
|
for wallet in all_hotkeys_
|
1347
1340
|
if wallet.hotkey_str not in exclude_hotkeys
|
1341
|
+
and wallet.hotkey.ss58_address not in hotkeys_to_unstake_from
|
1348
1342
|
] # definitely wallets
|
1349
1343
|
|
1350
1344
|
elif include_hotkeys:
|
@@ -5,7 +5,6 @@ from textwrap import dedent
|
|
5
5
|
from typing import TYPE_CHECKING, Optional, cast
|
6
6
|
|
7
7
|
from bittensor_wallet import Wallet
|
8
|
-
from bittensor_wallet.errors import KeyFileError
|
9
8
|
from rich.prompt import Confirm
|
10
9
|
from rich.table import Column, Table
|
11
10
|
|
@@ -28,6 +27,7 @@ from bittensor_cli.src.bittensor.utils import (
|
|
28
27
|
millify,
|
29
28
|
render_table,
|
30
29
|
update_metadata_table,
|
30
|
+
unlock_key,
|
31
31
|
)
|
32
32
|
|
33
33
|
if TYPE_CHECKING:
|
@@ -100,9 +100,7 @@ async def register_subnetwork_extrinsic(
|
|
100
100
|
):
|
101
101
|
return False
|
102
102
|
|
103
|
-
|
104
|
-
wallet.unlock_coldkey()
|
105
|
-
except KeyFileError:
|
103
|
+
if not unlock_key(wallet).success:
|
106
104
|
return False
|
107
105
|
|
108
106
|
with console.status(":satellite: Registering subnet...", spinner="earth"):
|
@@ -399,6 +397,7 @@ async def pow_register(
|
|
399
397
|
use_cuda,
|
400
398
|
dev_id,
|
401
399
|
threads_per_block,
|
400
|
+
prompt: bool,
|
402
401
|
):
|
403
402
|
"""Register neuron."""
|
404
403
|
|
@@ -406,7 +405,7 @@ async def pow_register(
|
|
406
405
|
subtensor,
|
407
406
|
wallet=wallet,
|
408
407
|
netuid=netuid,
|
409
|
-
prompt=
|
408
|
+
prompt=prompt,
|
410
409
|
tpb=threads_per_block,
|
411
410
|
update_interval=update_interval,
|
412
411
|
num_processes=processors,
|
@@ -2,7 +2,6 @@ import asyncio
|
|
2
2
|
from typing import TYPE_CHECKING, Union
|
3
3
|
|
4
4
|
from bittensor_wallet import Wallet
|
5
|
-
from bittensor_wallet.errors import KeyFileError
|
6
5
|
from rich import box
|
7
6
|
from rich.table import Column, Table
|
8
7
|
|
@@ -14,6 +13,7 @@ from bittensor_cli.src.bittensor.utils import (
|
|
14
13
|
print_error,
|
15
14
|
print_verbose,
|
16
15
|
normalize_hyperparameters,
|
16
|
+
unlock_key,
|
17
17
|
)
|
18
18
|
|
19
19
|
if TYPE_CHECKING:
|
@@ -101,9 +101,7 @@ async def set_hyperparameter_extrinsic(
|
|
101
101
|
)
|
102
102
|
return False
|
103
103
|
|
104
|
-
|
105
|
-
wallet.unlock_coldkey()
|
106
|
-
except KeyFileError:
|
104
|
+
if not unlock_key(wallet).success:
|
107
105
|
return False
|
108
106
|
|
109
107
|
extrinsic = HYPERPARAMS.get(parameter)
|
@@ -4,10 +4,9 @@ import itertools
|
|
4
4
|
import os
|
5
5
|
import sys
|
6
6
|
from collections import defaultdict
|
7
|
-
from concurrent.futures import ProcessPoolExecutor
|
8
7
|
from functools import partial
|
9
8
|
from sys import getsizeof
|
10
|
-
from typing import
|
9
|
+
from typing import Collection, Generator, Optional
|
11
10
|
|
12
11
|
import aiohttp
|
13
12
|
from bittensor_wallet import Wallet
|
@@ -56,9 +55,17 @@ from bittensor_cli.src.bittensor.utils import (
|
|
56
55
|
is_valid_ss58_address,
|
57
56
|
validate_coldkey_presence,
|
58
57
|
retry_prompt,
|
58
|
+
unlock_key,
|
59
59
|
)
|
60
60
|
|
61
61
|
|
62
|
+
class WalletLike:
|
63
|
+
def __init__(self, name=None, hotkey_ss58=None, hotkey_str=None):
|
64
|
+
self.name = name
|
65
|
+
self.hotkey_ss58 = hotkey_ss58
|
66
|
+
self.hotkey_str = hotkey_str
|
67
|
+
|
68
|
+
|
62
69
|
async def regen_coldkey(
|
63
70
|
wallet: Wallet,
|
64
71
|
mnemonic: Optional[str],
|
@@ -75,13 +82,21 @@ async def regen_coldkey(
|
|
75
82
|
with open(json_path, "r") as f:
|
76
83
|
json_str = f.read()
|
77
84
|
try:
|
78
|
-
wallet.regenerate_coldkey(
|
85
|
+
new_wallet = wallet.regenerate_coldkey(
|
79
86
|
mnemonic=mnemonic,
|
80
87
|
seed=seed,
|
81
88
|
json=(json_str, json_password) if all([json_str, json_password]) else None,
|
82
89
|
use_password=use_password,
|
83
90
|
overwrite=False,
|
84
91
|
)
|
92
|
+
|
93
|
+
if isinstance(new_wallet, Wallet):
|
94
|
+
console.print(
|
95
|
+
"\n✅ [dark_sea_green]Regenerated coldkey successfully!\n",
|
96
|
+
f"[dark_sea_green]Wallet name: ({new_wallet.name}), path: ({new_wallet.path}), coldkey ss58: ({new_wallet.coldkeypub.ss58_address})",
|
97
|
+
)
|
98
|
+
except ValueError:
|
99
|
+
print_error("Mnemonic phrase is invalid")
|
85
100
|
except KeyFileError:
|
86
101
|
print_error("KeyFileError: File is not writable")
|
87
102
|
|
@@ -93,11 +108,16 @@ async def regen_coldkey_pub(
|
|
93
108
|
):
|
94
109
|
"""Creates a new coldkeypub under this wallet."""
|
95
110
|
try:
|
96
|
-
wallet.regenerate_coldkeypub(
|
111
|
+
new_coldkeypub = wallet.regenerate_coldkeypub(
|
97
112
|
ss58_address=ss58_address,
|
98
113
|
public_key=public_key_hex,
|
99
114
|
overwrite=False,
|
100
115
|
)
|
116
|
+
if isinstance(new_coldkeypub, Wallet):
|
117
|
+
console.print(
|
118
|
+
"\n✅ [dark_sea_green]Regenerated coldkeypub successfully!\n",
|
119
|
+
f"[dark_sea_green]Wallet name: ({new_coldkeypub.name}), path: ({new_coldkeypub.path}), coldkey ss58: ({new_coldkeypub.coldkeypub.ss58_address})",
|
120
|
+
)
|
101
121
|
except KeyFileError:
|
102
122
|
print_error("KeyFileError: File is not writable")
|
103
123
|
|
@@ -120,13 +140,20 @@ async def regen_hotkey(
|
|
120
140
|
json_str = f.read()
|
121
141
|
|
122
142
|
try:
|
123
|
-
wallet.regenerate_hotkey(
|
143
|
+
new_hotkey = wallet.regenerate_hotkey(
|
124
144
|
mnemonic=mnemonic,
|
125
145
|
seed=seed,
|
126
146
|
json=(json_str, json_password) if all([json_str, json_password]) else None,
|
127
147
|
use_password=use_password,
|
128
148
|
overwrite=False,
|
129
149
|
)
|
150
|
+
if isinstance(new_hotkey, Wallet):
|
151
|
+
console.print(
|
152
|
+
"\n✅ [dark_sea_green]Regenerated hotkey successfully!\n",
|
153
|
+
f"[dark_sea_green]Wallet name: ({new_hotkey.name}), path: ({new_hotkey.path}), hotkey ss58: ({new_hotkey.hotkey.ss58_address})",
|
154
|
+
)
|
155
|
+
except ValueError:
|
156
|
+
print_error("Mnemonic phrase is invalid")
|
130
157
|
except KeyFileError:
|
131
158
|
print_error("KeyFileError: File is not writable")
|
132
159
|
|
@@ -697,9 +724,11 @@ async def overview(
|
|
697
724
|
de_registered_neurons.append(de_registered_neuron)
|
698
725
|
|
699
726
|
# Add this hotkey to the wallets dict
|
700
|
-
wallet_ =
|
701
|
-
|
702
|
-
|
727
|
+
wallet_ = WalletLike(
|
728
|
+
name=wallet.name,
|
729
|
+
hotkey_ss58=hotkey_addr,
|
730
|
+
hotkey_str=hotkey_addr[:5],
|
731
|
+
)
|
703
732
|
# Indicates a hotkey not on local machine but exists in stake_info obj on-chain
|
704
733
|
if hotkey_coldkey_to_hotkey_wallet.get(hotkey_addr) is None:
|
705
734
|
hotkey_coldkey_to_hotkey_wallet[hotkey_addr] = {}
|
@@ -762,8 +791,7 @@ async def overview(
|
|
762
791
|
if not hotwallet:
|
763
792
|
# Indicates a mismatch between what the chain says the coldkey
|
764
793
|
# is for this hotkey and the local wallet coldkey-hotkey pair
|
765
|
-
hotwallet =
|
766
|
-
hotwallet.hotkey_str = nn.hotkey[:7]
|
794
|
+
hotwallet = WalletLike(name=nn.coldkey[:7], hotkey_str=nn.hotkey[:7])
|
767
795
|
|
768
796
|
nn: NeuronInfoLite
|
769
797
|
uid = nn.uid
|
@@ -1102,7 +1130,7 @@ def _map_hotkey_to_neurons(
|
|
1102
1130
|
|
1103
1131
|
async def _fetch_neuron_for_netuid(
|
1104
1132
|
netuid: int, subtensor: SubtensorInterface
|
1105
|
-
) -> tuple[int,
|
1133
|
+
) -> tuple[int, Optional[str]]:
|
1106
1134
|
"""
|
1107
1135
|
Retrieves all neurons for a specified netuid
|
1108
1136
|
|
@@ -1112,18 +1140,13 @@ async def _fetch_neuron_for_netuid(
|
|
1112
1140
|
:return: the original netuid, and a mapping of the neurons to their NeuronInfoLite objects
|
1113
1141
|
"""
|
1114
1142
|
|
1115
|
-
async def neurons_lite_for_uid(uid: int) ->
|
1116
|
-
call_definition = TYPE_REGISTRY["runtime_api"]["NeuronInfoRuntimeApi"][
|
1117
|
-
"methods"
|
1118
|
-
]["get_neurons_lite"]
|
1119
|
-
data = await subtensor.encode_params(
|
1120
|
-
call_definition=call_definition, params=[uid]
|
1121
|
-
)
|
1143
|
+
async def neurons_lite_for_uid(uid: int) -> Optional[str]:
|
1122
1144
|
block_hash = subtensor.substrate.last_block_hash
|
1123
|
-
hex_bytes_result = await subtensor.
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1145
|
+
hex_bytes_result = await subtensor.query_runtime_api(
|
1146
|
+
runtime_api="NeuronInfoRuntimeApi",
|
1147
|
+
method="get_neurons_lite",
|
1148
|
+
params=[uid],
|
1149
|
+
block_hash=block_hash,
|
1127
1150
|
)
|
1128
1151
|
|
1129
1152
|
return hex_bytes_result
|
@@ -1134,7 +1157,7 @@ async def _fetch_neuron_for_netuid(
|
|
1134
1157
|
|
1135
1158
|
async def _fetch_all_neurons(
|
1136
1159
|
netuids: list[int], subtensor
|
1137
|
-
) -> list[tuple[int,
|
1160
|
+
) -> list[tuple[int, Optional[str]]]:
|
1138
1161
|
"""Retrieves all neurons for each of the specified netuids"""
|
1139
1162
|
return list(
|
1140
1163
|
await asyncio.gather(
|
@@ -1143,50 +1166,21 @@ async def _fetch_all_neurons(
|
|
1143
1166
|
)
|
1144
1167
|
|
1145
1168
|
|
1146
|
-
def _partial_decode(args):
|
1147
|
-
"""
|
1148
|
-
Helper function for passing to ProcessPoolExecutor that decodes scale bytes based on a set return type and
|
1149
|
-
rpc type registry, passing this back to the Executor with its specified netuid for easier mapping
|
1150
|
-
|
1151
|
-
:param args: (return type, scale bytes object, custom rpc type registry, netuid)
|
1152
|
-
|
1153
|
-
:return: (original netuid, decoded object)
|
1154
|
-
"""
|
1155
|
-
return_type, as_scale_bytes, custom_rpc_type_registry_, netuid_ = args
|
1156
|
-
decoded = decode_scale_bytes(return_type, as_scale_bytes, custom_rpc_type_registry_)
|
1157
|
-
if decoded.startswith("0x"):
|
1158
|
-
bytes_result = bytes.fromhex(decoded[2:])
|
1159
|
-
else:
|
1160
|
-
bytes_result = bytes.fromhex(decoded)
|
1161
|
-
|
1162
|
-
return netuid_, NeuronInfoLite.list_from_vec_u8(bytes_result)
|
1163
|
-
|
1164
|
-
|
1165
1169
|
def _process_neurons_for_netuids(
|
1166
|
-
netuids_with_all_neurons_hex_bytes: list[tuple[int,
|
1170
|
+
netuids_with_all_neurons_hex_bytes: list[tuple[int, Optional[str]]],
|
1167
1171
|
) -> list[tuple[int, list[NeuronInfoLite]]]:
|
1168
1172
|
"""
|
1169
|
-
|
1173
|
+
Decode a list of hex-bytes neurons with their respective netuid
|
1170
1174
|
|
1171
1175
|
:param netuids_with_all_neurons_hex_bytes: netuids with hex-bytes neurons
|
1172
1176
|
:return: netuids mapped to decoded neurons
|
1173
1177
|
"""
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
return_type = TYPE_REGISTRY["runtime_api"]["NeuronInfoRuntimeApi"]["methods"][
|
1182
|
-
"get_neurons_lite"
|
1183
|
-
]["type"]
|
1184
|
-
|
1185
|
-
preprocessed = [make_map(r) for r in netuids_with_all_neurons_hex_bytes]
|
1186
|
-
with ProcessPoolExecutor() as executor:
|
1187
|
-
results = list(executor.map(_partial_decode, preprocessed))
|
1188
|
-
|
1189
|
-
all_results = [(netuid, result) for netuid, result in results]
|
1178
|
+
all_results = [
|
1179
|
+
(netuid, NeuronInfoLite.list_from_vec_u8(bytes.fromhex(result[2:])))
|
1180
|
+
if result
|
1181
|
+
else (netuid, [])
|
1182
|
+
for netuid, result in netuids_with_all_neurons_hex_bytes
|
1183
|
+
]
|
1190
1184
|
return all_results
|
1191
1185
|
|
1192
1186
|
|
@@ -1256,11 +1250,17 @@ async def transfer(
|
|
1256
1250
|
subtensor: SubtensorInterface,
|
1257
1251
|
destination: str,
|
1258
1252
|
amount: float,
|
1253
|
+
transfer_all: bool,
|
1259
1254
|
prompt: bool,
|
1260
1255
|
):
|
1261
1256
|
"""Transfer token of amount to destination."""
|
1262
1257
|
await transfer_extrinsic(
|
1263
|
-
subtensor,
|
1258
|
+
subtensor,
|
1259
|
+
wallet,
|
1260
|
+
destination,
|
1261
|
+
Balance.from_tao(amount),
|
1262
|
+
transfer_all,
|
1263
|
+
prompt=prompt,
|
1264
1264
|
)
|
1265
1265
|
|
1266
1266
|
|
@@ -1414,13 +1414,14 @@ async def faucet(
|
|
1414
1414
|
output_in_place: bool,
|
1415
1415
|
log_verbose: bool,
|
1416
1416
|
max_successes: int = 3,
|
1417
|
+
prompt: bool = True,
|
1417
1418
|
):
|
1418
1419
|
# TODO: - work out prompts to be passed through the cli
|
1419
1420
|
success = await run_faucet_extrinsic(
|
1420
1421
|
subtensor,
|
1421
1422
|
wallet,
|
1422
1423
|
tpb=threads_per_block,
|
1423
|
-
prompt=
|
1424
|
+
prompt=prompt,
|
1424
1425
|
update_interval=update_interval,
|
1425
1426
|
num_processes=processes,
|
1426
1427
|
cuda=use_cuda,
|
@@ -1616,9 +1617,7 @@ async def set_id(
|
|
1616
1617
|
print_error(f":cross_mark: This wallet doesn't own subnet {subnet_netuid}.")
|
1617
1618
|
return False
|
1618
1619
|
|
1619
|
-
|
1620
|
-
wallet.unlock_coldkey()
|
1621
|
-
except KeyFileError:
|
1620
|
+
if not unlock_key(wallet).success:
|
1622
1621
|
return False
|
1623
1622
|
|
1624
1623
|
with console.status(
|
@@ -1718,18 +1717,14 @@ async def check_coldkey_swap(wallet: Wallet, subtensor: SubtensorInterface):
|
|
1718
1717
|
|
1719
1718
|
async def sign(wallet: Wallet, message: str, use_hotkey: str):
|
1720
1719
|
"""Sign a message using the provided wallet or hotkey."""
|
1721
|
-
|
1722
|
-
try:
|
1723
|
-
wallet.unlock_coldkey()
|
1724
|
-
except KeyFileError:
|
1725
|
-
err_console.print(
|
1726
|
-
":cross_mark: [red]Keyfile is corrupt, non-writable, non-readable or the password used to decrypt is "
|
1727
|
-
"invalid[/red]:[bold white]\n [/bold white]"
|
1728
|
-
)
|
1729
1720
|
if not use_hotkey:
|
1721
|
+
if not unlock_key(wallet).success:
|
1722
|
+
return False
|
1730
1723
|
keypair = wallet.coldkey
|
1731
1724
|
print_verbose(f"Signing using coldkey: {wallet.name}")
|
1732
1725
|
else:
|
1726
|
+
if not unlock_key(wallet, "hot").success:
|
1727
|
+
return False
|
1733
1728
|
keypair = wallet.hotkey
|
1734
1729
|
print_verbose(f"Signing using hotkey: {wallet.hotkey_str}")
|
1735
1730
|
|
@@ -378,6 +378,7 @@ async def reveal_weights(
|
|
378
378
|
weights: list[float],
|
379
379
|
salt: list[int],
|
380
380
|
version: int,
|
381
|
+
prompt: bool = True,
|
381
382
|
) -> None:
|
382
383
|
"""Reveal weights for a specific subnet."""
|
383
384
|
uids_ = np.array(
|
@@ -397,7 +398,7 @@ async def reveal_weights(
|
|
397
398
|
)
|
398
399
|
# Call the reveal function in the module set_weights from extrinsics package
|
399
400
|
extrinsic = SetWeightsExtrinsic(
|
400
|
-
subtensor, wallet, netuid, uids_, weights_, list(salt_), version
|
401
|
+
subtensor, wallet, netuid, uids_, weights_, list(salt_), version, prompt=prompt
|
401
402
|
)
|
402
403
|
success, message = await extrinsic.reveal(weight_uids, weight_vals)
|
403
404
|
|
@@ -415,6 +416,7 @@ async def commit_weights(
|
|
415
416
|
weights: list[float],
|
416
417
|
salt: list[int],
|
417
418
|
version: int,
|
419
|
+
prompt: bool = True,
|
418
420
|
):
|
419
421
|
"""Commits weights and then reveals them for a specific subnet"""
|
420
422
|
uids_ = np.array(
|
@@ -430,7 +432,7 @@ async def commit_weights(
|
|
430
432
|
dtype=np.int64,
|
431
433
|
)
|
432
434
|
extrinsic = SetWeightsExtrinsic(
|
433
|
-
subtensor, wallet, netuid, uids_, weights_, list(salt_), version
|
435
|
+
subtensor, wallet, netuid, uids_, weights_, list(salt_), version, prompt=prompt
|
434
436
|
)
|
435
437
|
success, message = await extrinsic.set_weights_extrinsic()
|
436
438
|
if success:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: bittensor-cli
|
3
|
-
Version: 8.
|
3
|
+
Version: 8.3.1
|
4
4
|
Summary: Bittensor CLI
|
5
5
|
Home-page: https://github.com/opentensor/btcli
|
6
6
|
Author: bittensor.com
|
@@ -32,6 +32,7 @@ Requires-Dist: fuzzywuzzy~=0.18.0
|
|
32
32
|
Requires-Dist: netaddr~=1.3.0
|
33
33
|
Requires-Dist: numpy>=2.0.1
|
34
34
|
Requires-Dist: Jinja2
|
35
|
+
Requires-Dist: packaging
|
35
36
|
Requires-Dist: pycryptodome
|
36
37
|
Requires-Dist: PyYAML~=6.0.1
|
37
38
|
Requires-Dist: pytest
|
@@ -41,7 +42,7 @@ Requires-Dist: scalecodec==1.2.11
|
|
41
42
|
Requires-Dist: substrate-interface~=1.7.9
|
42
43
|
Requires-Dist: typer~=0.12
|
43
44
|
Requires-Dist: websockets>=12.0
|
44
|
-
Requires-Dist: bittensor-wallet>=2.0
|
45
|
+
Requires-Dist: bittensor-wallet>=2.1.0
|
45
46
|
Requires-Dist: bt-decode==0.2.0a0
|
46
47
|
Provides-Extra: cuda
|
47
48
|
Requires-Dist: cubit>=1.1.0; extra == "cuda"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
bittensor_cli/__init__.py,sha256=yocN6uqpsPRC1tYESgUAxLcB-JDVYswhljK3KdC2DUA,1217
|
2
|
+
bittensor_cli/cli.py,sha256=ew32_K2VZ4-l6DsETJV6mjLpGBAa-VTUhx_8mBTG6vM,169772
|
3
|
+
bittensor_cli/doc_generation_helper.py,sha256=GexqjEIKulWg84hpNBEchJ840oOgOi7DWpt447nsdNI,91
|
4
|
+
bittensor_cli/src/__init__.py,sha256=9hFSqapIynZbrjc9YHl2wARkPdk4pV5P5zLSvn-EbqM,11856
|
5
|
+
bittensor_cli/src/bittensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
bittensor_cli/src/bittensor/async_substrate_interface.py,sha256=eXF5IxHMKJNNPzw_JdfhDiijghBQzOhEnk2i5F2L1OQ,103367
|
7
|
+
bittensor_cli/src/bittensor/balances.py,sha256=102mg1iiliLSLx-EocQseWGHiWzRqcBBM-MRoObOdKo,10075
|
8
|
+
bittensor_cli/src/bittensor/chain_data.py,sha256=IsHWjmhJbTvud2i3IM1sfmBHP82VxNHC1iFDAtlLgXc,26490
|
9
|
+
bittensor_cli/src/bittensor/minigraph.py,sha256=17AjEA75MO7ez_NekOJSaAz6ARjPt99QG_7E1RJ_u_k,8891
|
10
|
+
bittensor_cli/src/bittensor/networking.py,sha256=pZLMs8YXpZzDMLXWMBb_Bj6TVkm_q9khyY-lnbwVMuE,462
|
11
|
+
bittensor_cli/src/bittensor/subtensor_interface.py,sha256=cwbRhS5qV0Jmref5Qe7rsuDy8ssrRqdObKHvaeGeoOc,43373
|
12
|
+
bittensor_cli/src/bittensor/utils.py,sha256=_uJ7aiYJL6r-Cgyc0NDWBHVkdeyaGbFRYH7PABeM-iM,35184
|
13
|
+
bittensor_cli/src/bittensor/extrinsics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
+
bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=O3ikqyEbosvp3e9vCpMQ7cfjVdd6R4uiPYkXkiawxI4,59045
|
15
|
+
bittensor_cli/src/bittensor/extrinsics/root.py,sha256=huycqHbSTFBNIhQ846MuBqwBEtQCSVDW3y3yPAqPzeU,19121
|
16
|
+
bittensor_cli/src/bittensor/extrinsics/transfer.py,sha256=yC5oKgoKAXszMzfrof3GbeGppESUMgSqJFFGOMMALuc,8686
|
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/root.py,sha256=hohGfh7w9Lu7z264rbmFkwRCStyZrtdBZVMt20RwiqA,62186
|
20
|
+
bittensor_cli/src/commands/subnets.py,sha256=zlnWU-wmJ2GvhM1T3EN9nO_uzjHBai73i48NXGp9P94,33301
|
21
|
+
bittensor_cli/src/commands/sudo.py,sha256=tIkrqUpn-xpbrRLr3jBmjNauP8NKbLloRg37p65llNM,8166
|
22
|
+
bittensor_cli/src/commands/wallets.py,sha256=CCY9rz623ob-JcGU9pJxYwstMvlH8jdMc-sa7J-5XsU,60057
|
23
|
+
bittensor_cli/src/commands/weights.py,sha256=UHakAMTNqRkg_fkiyebbZAT9T3UEf93MmdbFgPSbqUw,16520
|
24
|
+
bittensor_cli/src/commands/stake/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
|
+
bittensor_cli/src/commands/stake/children_hotkeys.py,sha256=j239HdawvHp9rTbIx9MI9v9hkaKbA5OaN_cIQISkHdw,28606
|
26
|
+
bittensor_cli/src/commands/stake/stake.py,sha256=7TyFtL5wnXvGvD-GckNrNTRdcu3RewAfx_JfEekugFU,56147
|
27
|
+
bittensor_cli-8.3.1.dist-info/METADATA,sha256=KBU7oULNqbxQySkMNj3aWwUkVJPsZwgT_JqoIOcg_cY,6813
|
28
|
+
bittensor_cli-8.3.1.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
|
29
|
+
bittensor_cli-8.3.1.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
|
30
|
+
bittensor_cli-8.3.1.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
|
31
|
+
bittensor_cli-8.3.1.dist-info/RECORD,,
|
@@ -1,31 +0,0 @@
|
|
1
|
-
bittensor_cli/__init__.py,sha256=WH9TS8uqnwvM-2dRi2r81kALhCvyKsT70HQvQkpUXIk,1217
|
2
|
-
bittensor_cli/cli.py,sha256=jHkl5uLraMOUggbhQLrHZI7yOeMXJ-mnu0TN4bdgZI4,168060
|
3
|
-
bittensor_cli/doc_generation_helper.py,sha256=GexqjEIKulWg84hpNBEchJ840oOgOi7DWpt447nsdNI,91
|
4
|
-
bittensor_cli/src/__init__.py,sha256=6LdZwIvoSr6UomZUH_wNFeo7cNPgxl_dZhtdC5asJgA,11746
|
5
|
-
bittensor_cli/src/bittensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
bittensor_cli/src/bittensor/async_substrate_interface.py,sha256=oKsN1dx7awdgicGydXPJLbpqnYxwQkBSvdtDu6Pgkmw,102894
|
7
|
-
bittensor_cli/src/bittensor/balances.py,sha256=102mg1iiliLSLx-EocQseWGHiWzRqcBBM-MRoObOdKo,10075
|
8
|
-
bittensor_cli/src/bittensor/chain_data.py,sha256=IsHWjmhJbTvud2i3IM1sfmBHP82VxNHC1iFDAtlLgXc,26490
|
9
|
-
bittensor_cli/src/bittensor/minigraph.py,sha256=17AjEA75MO7ez_NekOJSaAz6ARjPt99QG_7E1RJ_u_k,8891
|
10
|
-
bittensor_cli/src/bittensor/networking.py,sha256=pZLMs8YXpZzDMLXWMBb_Bj6TVkm_q9khyY-lnbwVMuE,462
|
11
|
-
bittensor_cli/src/bittensor/subtensor_interface.py,sha256=65XS6Wy2GqM2v1PIhCZSxtYU_ANvN7svBDVZCTFVVjQ,43378
|
12
|
-
bittensor_cli/src/bittensor/utils.py,sha256=oBZpLnT_o8rMr333xErJHoaEo6wCA8p2vPVs_PuWIy8,33668
|
13
|
-
bittensor_cli/src/bittensor/extrinsics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
-
bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=lUg26xkkx7KBC3UzNZl5bl3T9oKldfQ_cCxY5BxrPjQ,58736
|
15
|
-
bittensor_cli/src/bittensor/extrinsics/root.py,sha256=WTJ5BPVcwb-bO86C6osHsf38V9xGWjxwOrHetYCGT-Y,19208
|
16
|
-
bittensor_cli/src/bittensor/extrinsics/transfer.py,sha256=HcssjHhEob4k1wJPNPw5ZSkeCK5orifLJ3ib-yPMMqM,8302
|
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/root.py,sha256=pjpG8aoU7Nl2_luOmsBQrre68PyAs7ai_8RffTw99JM,62333
|
20
|
-
bittensor_cli/src/commands/subnets.py,sha256=r8ixt5XAhpkBgpRvpmMHYeDr0DcKVMKBBjpZk-qZg6w,33341
|
21
|
-
bittensor_cli/src/commands/sudo.py,sha256=uRimJ2EDrcanajrvtl_qMM16OOO3HuJvU_N50ePiPAY,8226
|
22
|
-
bittensor_cli/src/commands/wallets.py,sha256=SaukCL7FJ_jpHgrAAZywXUjqgF7qJ0qGqN4qqEC2iUM,60324
|
23
|
-
bittensor_cli/src/commands/weights.py,sha256=3BCqVB1-W6BG0U_iOtuUZmFOQ9QngsnXAkBLwCHjK0g,16440
|
24
|
-
bittensor_cli/src/commands/stake/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
|
-
bittensor_cli/src/commands/stake/children_hotkeys.py,sha256=AlELV1ZiZbDuD8hkTpd5WhBs3P8zEF371vjZBgUkLfk,28610
|
26
|
-
bittensor_cli/src/commands/stake/stake.py,sha256=vql-9f7hlj8DLbFRLAXqEDlx2kxJ9DVo_VInRu2LK1I,56146
|
27
|
-
bittensor_cli-8.2.0.dist-info/METADATA,sha256=BxV3i4OcFYjcXYMivFJyyMXrqmx7EMSUrNwJayZyPxw,6788
|
28
|
-
bittensor_cli-8.2.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
29
|
-
bittensor_cli-8.2.0.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
|
30
|
-
bittensor_cli-8.2.0.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
|
31
|
-
bittensor_cli-8.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|