bittensor-cli 8.3.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 +7 -1
- bittensor_cli/src/bittensor/async_substrate_interface.py +10 -10
- bittensor_cli/src/bittensor/extrinsics/registration.py +4 -9
- bittensor_cli/src/bittensor/extrinsics/root.py +3 -9
- bittensor_cli/src/bittensor/extrinsics/transfer.py +2 -5
- bittensor_cli/src/bittensor/utils.py +48 -6
- bittensor_cli/src/commands/root.py +6 -24
- bittensor_cli/src/commands/stake/children_hotkeys.py +5 -9
- bittensor_cli/src/commands/stake/stake.py +6 -18
- bittensor_cli/src/commands/subnets.py +2 -5
- bittensor_cli/src/commands/sudo.py +2 -5
- bittensor_cli/src/commands/wallets.py +6 -12
- {bittensor_cli-8.3.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.3.0.dist-info → bittensor_cli-8.3.1.dist-info}/WHEEL +1 -1
- bittensor_cli-8.3.0.dist-info/RECORD +0 -31
- {bittensor_cli-8.3.0.dist-info → bittensor_cli-8.3.1.dist-info}/entry_points.txt +0 -0
- {bittensor_cli-8.3.0.dist-info → bittensor_cli-8.3.1.dist-info}/top_level.txt +0 -0
bittensor_cli/__init__.py
CHANGED
bittensor_cli/cli.py
CHANGED
@@ -7,6 +7,7 @@ import os.path
|
|
7
7
|
import re
|
8
8
|
import ssl
|
9
9
|
import sys
|
10
|
+
import traceback
|
10
11
|
from pathlib import Path
|
11
12
|
from typing import Coroutine, Optional
|
12
13
|
from dataclasses import fields
|
@@ -57,7 +58,7 @@ except ImportError:
|
|
57
58
|
pass
|
58
59
|
|
59
60
|
|
60
|
-
__version__ = "8.3.
|
61
|
+
__version__ = "8.3.1"
|
61
62
|
|
62
63
|
|
63
64
|
_core_version = re.match(r"^\d+\.\d+\.\d+", __version__).group(0)
|
@@ -840,6 +841,7 @@ class CLIManager:
|
|
840
841
|
return result
|
841
842
|
except (ConnectionRefusedError, ssl.SSLError):
|
842
843
|
err_console.print(f"Unable to connect to the chain: {self.subtensor}")
|
844
|
+
verbose_console.print(traceback.format_exc())
|
843
845
|
except (
|
844
846
|
ConnectionClosed,
|
845
847
|
SubstrateRequestException,
|
@@ -847,6 +849,10 @@ class CLIManager:
|
|
847
849
|
) as e:
|
848
850
|
if isinstance(e, SubstrateRequestException):
|
849
851
|
err_console.print(str(e))
|
852
|
+
verbose_console.print(traceback.format_exc())
|
853
|
+
except Exception as e:
|
854
|
+
err_console.print(f"An unknown error has occurred: {e}")
|
855
|
+
verbose_console.print(traceback.format_exc())
|
850
856
|
finally:
|
851
857
|
if initiated is False:
|
852
858
|
asyncio.create_task(cmd).cancel()
|
@@ -6,13 +6,14 @@ from dataclasses import dataclass
|
|
6
6
|
from hashlib import blake2b
|
7
7
|
from typing import Optional, Any, Union, Callable, Awaitable, cast
|
8
8
|
|
9
|
-
from bt_decode import PortableRegistry, decode as decode_by_type_string, MetadataV15
|
10
9
|
from async_property import async_property
|
10
|
+
from bt_decode import PortableRegistry, decode as decode_by_type_string, MetadataV15
|
11
|
+
from bittensor_wallet import Keypair
|
12
|
+
from packaging import version
|
11
13
|
from scalecodec import GenericExtrinsic
|
12
14
|
from scalecodec.base import ScaleBytes, ScaleType, RuntimeConfigurationObject
|
13
15
|
from scalecodec.type_registry import load_type_registry_preset
|
14
16
|
from scalecodec.types import GenericCall
|
15
|
-
from bittensor_wallet import Keypair
|
16
17
|
from substrateinterface.exceptions import (
|
17
18
|
SubstrateRequestException,
|
18
19
|
ExtrinsicNotFound,
|
@@ -771,14 +772,13 @@ class AsyncSubstrateInterface:
|
|
771
772
|
"""
|
772
773
|
self.chain_endpoint = chain_endpoint
|
773
774
|
self.__chain = chain_name
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
)
|
775
|
+
options = {
|
776
|
+
"max_size": 2**32,
|
777
|
+
"write_limit": 2**16,
|
778
|
+
}
|
779
|
+
if version.parse(websockets.__version__) < version.parse("14.0"):
|
780
|
+
options.update({"read_limit": 2**16})
|
781
|
+
self.ws = Websocket(chain_endpoint, options=options)
|
782
782
|
self._lock = asyncio.Lock()
|
783
783
|
self.last_block_hash: Optional[str] = None
|
784
784
|
self.config = {
|
@@ -20,7 +20,6 @@ import subprocess
|
|
20
20
|
|
21
21
|
import backoff
|
22
22
|
from bittensor_wallet import Wallet
|
23
|
-
from bittensor_wallet.errors import KeyFileError
|
24
23
|
from Crypto.Hash import keccak
|
25
24
|
import numpy as np
|
26
25
|
from rich.prompt import Confirm
|
@@ -37,6 +36,7 @@ from bittensor_cli.src.bittensor.utils import (
|
|
37
36
|
get_human_readable,
|
38
37
|
print_verbose,
|
39
38
|
print_error,
|
39
|
+
unlock_key,
|
40
40
|
)
|
41
41
|
|
42
42
|
if typing.TYPE_CHECKING:
|
@@ -726,10 +726,8 @@ async def run_faucet_extrinsic(
|
|
726
726
|
return False, "Requires torch"
|
727
727
|
|
728
728
|
# Unlock coldkey
|
729
|
-
|
730
|
-
|
731
|
-
except KeyFileError:
|
732
|
-
return False, "There was an error unlocking your coldkey"
|
729
|
+
if not (unlock_status := unlock_key(wallet, print_out=False)).success:
|
730
|
+
return False, unlock_status.message
|
733
731
|
|
734
732
|
# Get previous balance.
|
735
733
|
old_balance = await subtensor.get_balance(wallet.coldkeypub.ss58_address)
|
@@ -1639,10 +1637,7 @@ async def swap_hotkey_extrinsic(
|
|
1639
1637
|
)
|
1640
1638
|
return False
|
1641
1639
|
|
1642
|
-
|
1643
|
-
wallet.unlock_coldkey()
|
1644
|
-
except KeyFileError:
|
1645
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
1640
|
+
if not unlock_key(wallet).success:
|
1646
1641
|
return False
|
1647
1642
|
|
1648
1643
|
if prompt:
|
@@ -21,7 +21,6 @@ import time
|
|
21
21
|
from typing import Union, List, TYPE_CHECKING
|
22
22
|
|
23
23
|
from bittensor_wallet import Wallet, Keypair
|
24
|
-
from bittensor_wallet.errors import KeyFileError
|
25
24
|
import numpy as np
|
26
25
|
from numpy.typing import NDArray
|
27
26
|
from rich.prompt import Confirm
|
@@ -37,6 +36,7 @@ from bittensor_cli.src.bittensor.utils import (
|
|
37
36
|
u16_normalized_float,
|
38
37
|
print_verbose,
|
39
38
|
format_error_message,
|
39
|
+
unlock_key,
|
40
40
|
)
|
41
41
|
|
42
42
|
if TYPE_CHECKING:
|
@@ -306,10 +306,7 @@ async def root_register_extrinsic(
|
|
306
306
|
the response is `True`.
|
307
307
|
"""
|
308
308
|
|
309
|
-
|
310
|
-
wallet.unlock_coldkey()
|
311
|
-
except KeyFileError:
|
312
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
309
|
+
if not unlock_key(wallet).success:
|
313
310
|
return False
|
314
311
|
|
315
312
|
print_verbose(f"Checking if hotkey ({wallet.hotkey_str}) is registered on root")
|
@@ -427,10 +424,7 @@ async def set_root_weights_extrinsic(
|
|
427
424
|
err_console.print("Your hotkey is not registered to the root network")
|
428
425
|
return False
|
429
426
|
|
430
|
-
|
431
|
-
wallet.unlock_coldkey()
|
432
|
-
except KeyFileError:
|
433
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
427
|
+
if not unlock_key(wallet).success:
|
434
428
|
return False
|
435
429
|
|
436
430
|
# First convert types.
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import asyncio
|
2
2
|
|
3
3
|
from bittensor_wallet import Wallet
|
4
|
-
from bittensor_wallet.errors import KeyFileError
|
5
4
|
from rich.prompt import Confirm
|
6
5
|
from substrateinterface.exceptions import SubstrateRequestException
|
7
6
|
|
@@ -16,6 +15,7 @@ from bittensor_cli.src.bittensor.utils import (
|
|
16
15
|
get_explorer_url_for_network,
|
17
16
|
is_valid_bittensor_address_or_public_key,
|
18
17
|
print_error,
|
18
|
+
unlock_key,
|
19
19
|
)
|
20
20
|
|
21
21
|
|
@@ -115,10 +115,7 @@ async def transfer_extrinsic(
|
|
115
115
|
return False
|
116
116
|
console.print(f"[dark_orange]Initiating transfer on network: {subtensor.network}")
|
117
117
|
# Unlock wallet coldkey.
|
118
|
-
|
119
|
-
wallet.unlock_coldkey()
|
120
|
-
except KeyFileError:
|
121
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
118
|
+
if not unlock_key(wallet).success:
|
122
119
|
return False
|
123
120
|
|
124
121
|
# Check balance.
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import ast
|
2
|
+
from collections import namedtuple
|
2
3
|
import math
|
3
4
|
import os
|
4
5
|
import sqlite3
|
@@ -9,7 +10,7 @@ from urllib.parse import urlparse
|
|
9
10
|
|
10
11
|
from bittensor_wallet import Wallet, Keypair
|
11
12
|
from bittensor_wallet.utils import SS58_FORMAT
|
12
|
-
from bittensor_wallet.errors import KeyFileError
|
13
|
+
from bittensor_wallet.errors import KeyFileError, PasswordError
|
13
14
|
from bittensor_wallet import utils
|
14
15
|
from jinja2 import Template
|
15
16
|
from markupsafe import Markup
|
@@ -35,6 +36,8 @@ console = Console()
|
|
35
36
|
err_console = Console(stderr=True)
|
36
37
|
verbose_console = Console(quiet=True)
|
37
38
|
|
39
|
+
UnlockStatus = namedtuple("UnlockStatus", ["success", "message"])
|
40
|
+
|
38
41
|
|
39
42
|
def print_console(message: str, colour: str, title: str, console: Console):
|
40
43
|
console.print(
|
@@ -238,11 +241,14 @@ def get_hotkey_wallets_for_wallet(
|
|
238
241
|
def get_coldkey_wallets_for_path(path: str) -> list[Wallet]:
|
239
242
|
"""Gets all wallets with coldkeys from a given path"""
|
240
243
|
wallet_path = Path(path).expanduser()
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
244
|
+
try:
|
245
|
+
wallets = [
|
246
|
+
Wallet(name=directory.name, path=path)
|
247
|
+
for directory in wallet_path.iterdir()
|
248
|
+
if directory.is_dir()
|
249
|
+
]
|
250
|
+
except FileNotFoundError:
|
251
|
+
wallets = []
|
246
252
|
return wallets
|
247
253
|
|
248
254
|
|
@@ -974,3 +980,39 @@ def retry_prompt(
|
|
974
980
|
return var
|
975
981
|
else:
|
976
982
|
err_console.print(rejection_text)
|
983
|
+
|
984
|
+
|
985
|
+
def unlock_key(
|
986
|
+
wallet: Wallet, unlock_type="cold", print_out: bool = True
|
987
|
+
) -> "UnlockStatus":
|
988
|
+
"""
|
989
|
+
Attempts to decrypt a wallet's coldkey or hotkey
|
990
|
+
Args:
|
991
|
+
wallet: a Wallet object
|
992
|
+
unlock_type: the key type, 'cold' or 'hot'
|
993
|
+
print_out: whether to print out the error message to the err_console
|
994
|
+
|
995
|
+
Returns: UnlockStatus for success status of unlock, with error message if unsuccessful
|
996
|
+
|
997
|
+
"""
|
998
|
+
if unlock_type == "cold":
|
999
|
+
unlocker = "unlock_coldkey"
|
1000
|
+
elif unlock_type == "hot":
|
1001
|
+
unlocker = "unlock_hotkey"
|
1002
|
+
else:
|
1003
|
+
raise ValueError(
|
1004
|
+
f"Invalid unlock type provided: {unlock_type}. Must be 'cold' or 'hot'."
|
1005
|
+
)
|
1006
|
+
try:
|
1007
|
+
getattr(wallet, unlocker)()
|
1008
|
+
return UnlockStatus(True, "")
|
1009
|
+
except PasswordError:
|
1010
|
+
err_msg = f"The password used to decrypt your {unlock_type.capitalize()}key Keyfile is invalid."
|
1011
|
+
if print_out:
|
1012
|
+
err_console.print(f":cross_mark: [red]{err_msg}[/red]")
|
1013
|
+
return UnlockStatus(False, err_msg)
|
1014
|
+
except KeyFileError:
|
1015
|
+
err_msg = f"{unlock_type.capitalize()}key Keyfile is corrupt, non-writable, or non-readable, or non-existent."
|
1016
|
+
if print_out:
|
1017
|
+
err_console.print(f":cross_mark: [red]{err_msg}[/red]")
|
1018
|
+
return UnlockStatus(False, err_msg)
|
@@ -3,7 +3,6 @@ import json
|
|
3
3
|
from typing import Optional, TYPE_CHECKING
|
4
4
|
|
5
5
|
from bittensor_wallet import Wallet
|
6
|
-
from bittensor_wallet.errors import KeyFileError
|
7
6
|
import numpy as np
|
8
7
|
from numpy.typing import NDArray
|
9
8
|
from rich import box
|
@@ -42,6 +41,7 @@ from bittensor_cli.src.bittensor.utils import (
|
|
42
41
|
ss58_to_vec_u8,
|
43
42
|
update_metadata_table,
|
44
43
|
group_subnets,
|
44
|
+
unlock_key,
|
45
45
|
)
|
46
46
|
|
47
47
|
if TYPE_CHECKING:
|
@@ -280,10 +280,7 @@ async def burned_register_extrinsic(
|
|
280
280
|
finalization/inclusion, the response is `True`.
|
281
281
|
"""
|
282
282
|
|
283
|
-
|
284
|
-
wallet.unlock_coldkey()
|
285
|
-
except KeyFileError:
|
286
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
283
|
+
if not unlock_key(wallet).success:
|
287
284
|
return False
|
288
285
|
|
289
286
|
with console.status(
|
@@ -537,10 +534,7 @@ async def delegate_extrinsic(
|
|
537
534
|
delegate_string = "delegate" if delegate else "undelegate"
|
538
535
|
|
539
536
|
# Decrypt key
|
540
|
-
|
541
|
-
wallet.unlock_coldkey()
|
542
|
-
except KeyFileError:
|
543
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
537
|
+
if not unlock_key(wallet).success:
|
544
538
|
return False
|
545
539
|
|
546
540
|
print_verbose("Checking if hotkey is a delegate")
|
@@ -1098,11 +1092,7 @@ async def senate_vote(
|
|
1098
1092
|
return False
|
1099
1093
|
|
1100
1094
|
# Unlock the wallet.
|
1101
|
-
|
1102
|
-
wallet.unlock_hotkey()
|
1103
|
-
wallet.unlock_coldkey()
|
1104
|
-
except KeyFileError:
|
1105
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
1095
|
+
if not unlock_key(wallet).success and unlock_key(wallet, "hot").success:
|
1106
1096
|
return False
|
1107
1097
|
|
1108
1098
|
console.print(f"Fetching proposals in [dark_orange]network: {subtensor.network}")
|
@@ -1322,11 +1312,7 @@ async def set_take(wallet: Wallet, subtensor: SubtensorInterface, take: float) -
|
|
1322
1312
|
|
1323
1313
|
console.print(f"Setting take on [dark_orange]network: {subtensor.network}")
|
1324
1314
|
# Unlock the wallet.
|
1325
|
-
|
1326
|
-
wallet.unlock_hotkey()
|
1327
|
-
wallet.unlock_coldkey()
|
1328
|
-
except KeyFileError:
|
1329
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
1315
|
+
if not unlock_key(wallet).success and unlock_key(wallet, "hot").success:
|
1330
1316
|
return False
|
1331
1317
|
|
1332
1318
|
result_ = await _do_set_take()
|
@@ -1724,11 +1710,7 @@ async def nominate(wallet: Wallet, subtensor: SubtensorInterface, prompt: bool):
|
|
1724
1710
|
|
1725
1711
|
console.print(f"Nominating on [dark_orange]network: {subtensor.network}")
|
1726
1712
|
# Unlock the wallet.
|
1727
|
-
|
1728
|
-
wallet.unlock_hotkey()
|
1729
|
-
wallet.unlock_coldkey()
|
1730
|
-
except KeyFileError:
|
1731
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
1713
|
+
if not unlock_key(wallet).success and unlock_key(wallet, "hot").success:
|
1732
1714
|
return False
|
1733
1715
|
|
1734
1716
|
print_verbose(f"Checking hotkey ({wallet.hotkey_str}) is a delegate")
|
@@ -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] ..."
|
@@ -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,10 +103,7 @@ async def add_stake_extrinsic(
|
|
103
103
|
"""
|
104
104
|
|
105
105
|
# Decrypt keys,
|
106
|
-
|
107
|
-
wallet.unlock_coldkey()
|
108
|
-
except KeyFileError:
|
109
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
106
|
+
if not unlock_key(wallet).success:
|
110
107
|
return False
|
111
108
|
|
112
109
|
# Default to wallet's own hotkey if the value is not passed.
|
@@ -310,10 +307,7 @@ async def add_stake_multiple_extrinsic(
|
|
310
307
|
return True
|
311
308
|
|
312
309
|
# Decrypt coldkey.
|
313
|
-
|
314
|
-
wallet.unlock_coldkey()
|
315
|
-
except KeyFileError:
|
316
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
310
|
+
if not unlock_key(wallet).success:
|
317
311
|
return False
|
318
312
|
|
319
313
|
with console.status(
|
@@ -491,11 +485,8 @@ async def unstake_extrinsic(
|
|
491
485
|
:return: success: `True` if extrinsic was finalized or included in the block. If we did not wait for
|
492
486
|
finalization/inclusion, the response is `True`.
|
493
487
|
"""
|
494
|
-
# Decrypt
|
495
|
-
|
496
|
-
wallet.unlock_coldkey()
|
497
|
-
except KeyFileError:
|
498
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
488
|
+
# Decrypt coldkey
|
489
|
+
if not unlock_key(wallet).success:
|
499
490
|
return False
|
500
491
|
|
501
492
|
if hotkey_ss58 is None:
|
@@ -663,10 +654,7 @@ async def unstake_multiple_extrinsic(
|
|
663
654
|
return True
|
664
655
|
|
665
656
|
# Unlock coldkey.
|
666
|
-
|
667
|
-
wallet.unlock_coldkey()
|
668
|
-
except KeyFileError:
|
669
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
657
|
+
if not unlock_key(wallet).success:
|
670
658
|
return False
|
671
659
|
|
672
660
|
with console.status(
|
@@ -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,10 +100,7 @@ async def register_subnetwork_extrinsic(
|
|
100
100
|
):
|
101
101
|
return False
|
102
102
|
|
103
|
-
|
104
|
-
wallet.unlock_coldkey()
|
105
|
-
except KeyFileError:
|
106
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
103
|
+
if not unlock_key(wallet).success:
|
107
104
|
return False
|
108
105
|
|
109
106
|
with console.status(":satellite: Registering subnet...", spinner="earth"):
|
@@ -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,10 +101,7 @@ async def set_hyperparameter_extrinsic(
|
|
101
101
|
)
|
102
102
|
return False
|
103
103
|
|
104
|
-
|
105
|
-
wallet.unlock_coldkey()
|
106
|
-
except KeyFileError:
|
107
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
104
|
+
if not unlock_key(wallet).success:
|
108
105
|
return False
|
109
106
|
|
110
107
|
extrinsic = HYPERPARAMS.get(parameter)
|
@@ -55,6 +55,7 @@ from bittensor_cli.src.bittensor.utils import (
|
|
55
55
|
is_valid_ss58_address,
|
56
56
|
validate_coldkey_presence,
|
57
57
|
retry_prompt,
|
58
|
+
unlock_key,
|
58
59
|
)
|
59
60
|
|
60
61
|
|
@@ -1616,10 +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:
|
1622
|
-
err_console.print("Error decrypting coldkey (possibly incorrect password)")
|
1620
|
+
if not unlock_key(wallet).success:
|
1623
1621
|
return False
|
1624
1622
|
|
1625
1623
|
with console.status(
|
@@ -1719,18 +1717,14 @@ async def check_coldkey_swap(wallet: Wallet, subtensor: SubtensorInterface):
|
|
1719
1717
|
|
1720
1718
|
async def sign(wallet: Wallet, message: str, use_hotkey: str):
|
1721
1719
|
"""Sign a message using the provided wallet or hotkey."""
|
1722
|
-
|
1723
|
-
try:
|
1724
|
-
wallet.unlock_coldkey()
|
1725
|
-
except KeyFileError:
|
1726
|
-
err_console.print(
|
1727
|
-
":cross_mark: [red]Keyfile is corrupt, non-writable, non-readable or the password used to decrypt is "
|
1728
|
-
"invalid[/red]:[bold white]\n [/bold white]"
|
1729
|
-
)
|
1730
1720
|
if not use_hotkey:
|
1721
|
+
if not unlock_key(wallet).success:
|
1722
|
+
return False
|
1731
1723
|
keypair = wallet.coldkey
|
1732
1724
|
print_verbose(f"Signing using coldkey: {wallet.name}")
|
1733
1725
|
else:
|
1726
|
+
if not unlock_key(wallet, "hot").success:
|
1727
|
+
return False
|
1734
1728
|
keypair = wallet.hotkey
|
1735
1729
|
print_verbose(f"Signing using hotkey: {wallet.hotkey_str}")
|
1736
1730
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: bittensor-cli
|
3
|
-
Version: 8.3.
|
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=O5T0sSkvfCnlXbdjLguIp-4w1jd6Bmb-TXgQINZD1uo,1217
|
2
|
-
bittensor_cli/cli.py,sha256=tMJBqFba9L267Ghl8Af228_MIR8h7nHfYrmN1Tz3xR8,169461
|
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=EcvAoQcyDa_Sm8Ne-SNtMm8lUkZmkzDto1VUvqG0rlg,103271
|
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=cvtej2aKix_EEU5FBeBCd3vIEZSt44R0dCidny7zyoA,33663
|
13
|
-
bittensor_cli/src/bittensor/extrinsics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
-
bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=xrEdN_gbL6fFNh-tZRwgB-Xpb8fUer1nSd3Xr5f7x9g,59202
|
15
|
-
bittensor_cli/src/bittensor/extrinsics/root.py,sha256=RZEQv6QVDAQDjuX_vgjOMsatYvHpA3MW8zueiL6jxlE,19376
|
16
|
-
bittensor_cli/src/bittensor/extrinsics/transfer.py,sha256=ZqbUcaGVENFP0nviLj914lJXcQ_bHpUpyudPlrmSCzw,8830
|
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=MiNdEg2SCPYv4Q_8aSgGn_9Giotv-k5JEnwgjrDA09A,62753
|
20
|
-
bittensor_cli/src/commands/subnets.py,sha256=0tf3DhdCmvIQA_64gFTfhk9spOA9PHSn4NUsswjbY0U,33445
|
21
|
-
bittensor_cli/src/commands/sudo.py,sha256=lpmZBT2xoAcERQNjJN__6nBmFUNcbXFTdNvl3S_T5Cg,8310
|
22
|
-
bittensor_cli/src/commands/wallets.py,sha256=lHuChXL9n4esIktENZjffdVnNKaFQaBhtuIHvunqrvs,60286
|
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=3FapotpWGbE_i6RELt0Sqlk5Bvao4Sd3tQibLS13nKQ,28667
|
26
|
-
bittensor_cli/src/commands/stake/stake.py,sha256=lGLMWdE3RVmYcr57pMwKljQI8vRX3WFRltmXWHdnKy8,56622
|
27
|
-
bittensor_cli-8.3.0.dist-info/METADATA,sha256=5SilMKuTyLT2Y6r_zi1Gh3kFJWSzWUQvidQQADezkfs,6788
|
28
|
-
bittensor_cli-8.3.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
29
|
-
bittensor_cli-8.3.0.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
|
30
|
-
bittensor_cli-8.3.0.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
|
31
|
-
bittensor_cli-8.3.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|