|
44 | 44 | get_subnet_name, |
45 | 45 | millify_tao, |
46 | 46 | unlock_key, |
47 | | - hex_to_bytes, |
48 | 47 | WalletLike, |
49 | 48 | ) |
50 | 49 |
|
@@ -1076,12 +1075,11 @@ async def transfer( |
1076 | 1075 | ): |
1077 | 1076 | """Transfer token of amount to destination.""" |
1078 | 1077 | await transfer_extrinsic( |
1079 | | - # TODO verify the order here |
1080 | | - subtensor, |
1081 | | - wallet, |
1082 | | - destination, |
1083 | | - Balance.from_tao(amount), |
1084 | | - transfer_all, |
| 1078 | + subtensor=subtensor, |
| 1079 | + wallet=wallet, |
| 1080 | + destination=destination, |
| 1081 | + amount=Balance.from_tao(amount), |
| 1082 | + transfer_all=transfer_all, |
1085 | 1083 | prompt=prompt, |
1086 | 1084 | ) |
1087 | 1085 |
|
@@ -1335,11 +1333,7 @@ async def set_id( |
1335 | 1333 | ) |
1336 | 1334 | return False |
1337 | 1335 |
|
1338 | | - try: |
1339 | | - # TODO unlock fn |
1340 | | - wallet.unlock_coldkey() |
1341 | | - except KeyFileError: |
1342 | | - err_console.print("Error decrypting coldkey (possibly incorrect password)") |
| 1336 | + if not unlock_key(wallet).success: |
1343 | 1337 | return False |
1344 | 1338 |
|
1345 | 1339 | call = await subtensor.substrate.compose_call( |
@@ -1431,30 +1425,15 @@ async def check_coldkey_swap(wallet: Wallet, subtensor: SubtensorInterface): |
1431 | 1425 | async def sign(wallet: Wallet, message: str, use_hotkey: str): |
1432 | 1426 | """Sign a message using the provided wallet or hotkey.""" |
1433 | 1427 |
|
1434 | | - def _unlock(key: str): |
1435 | | - try: |
1436 | | - getattr(wallet, f"unlock_{key}")() |
1437 | | - return True |
1438 | | - except PasswordError: |
1439 | | - err_console.print( |
1440 | | - ":cross_mark: [red]The password used to decrypt your keyfile is invalid[/red]" |
1441 | | - ) |
1442 | | - return False |
1443 | | - except KeyFileError: |
1444 | | - err_console.print( |
1445 | | - ":cross_mark: [red]Keyfile is corrupt, non-writable, or non-readable[/red]:" |
1446 | | - ) |
1447 | | - return False |
1448 | | - |
1449 | 1428 | if not use_hotkey: |
1450 | | - if not _unlock("coldkey"): |
| 1429 | + if not unlock_key(wallet, "coldkey").success: |
1451 | 1430 | return False |
1452 | 1431 | keypair = wallet.coldkey |
1453 | 1432 | print_verbose( |
1454 | 1433 | f"Signing using [{COLOR_PALETTE['GENERAL']['COLDKEY']}]coldkey: {wallet.name}" |
1455 | 1434 | ) |
1456 | 1435 | else: |
1457 | | - if not _unlock("hotkey"): |
| 1436 | + if not unlock_key(wallet, "hotkey").success: |
1458 | 1437 | return False |
1459 | 1438 | keypair = wallet.hotkey |
1460 | 1439 | print_verbose( |
|
0 commit comments