|
4 | 4 | import time
|
5 | 5 | from typing import Dict, Optional, Tuple
|
6 | 6 |
|
| 7 | +from bittensor_wallet import Wallet |
| 8 | + |
7 | 9 | """
|
8 | 10 | Verify commands:
|
9 | 11 |
|
@@ -412,6 +414,9 @@ def test_wallet_regen(wallet_setup, capfd):
|
412 | 414 | # -----------------------------
|
413 | 415 | print("Testing wallet regen_coldkey command 🧪")
|
414 | 416 | coldkey_path = os.path.join(wallet_path, "new_wallet", "coldkey")
|
| 417 | + initial_coldkey_ss58 = Wallet( |
| 418 | + name="new_wallet", path=wallet_path |
| 419 | + ).coldkey.ss58_address |
415 | 420 | initial_coldkey_mod_time = os.path.getmtime(coldkey_path)
|
416 | 421 |
|
417 | 422 | result = exec_command(
|
@@ -439,24 +444,28 @@ def test_wallet_regen(wallet_setup, capfd):
|
439 | 444 | assert (
|
440 | 445 | initial_coldkey_mod_time != new_coldkey_mod_time
|
441 | 446 | ), "Coldkey file was not regenerated as expected"
|
442 |
| - # Underlying Rust is broken. Will add this in when that is fixed: https://github.com/opentensor/btwallet/issues/118 |
443 |
| - # json_result = exec_command( |
444 |
| - # command="wallet", |
445 |
| - # sub_command="regen-coldkey", |
446 |
| - # extra_args=[ |
447 |
| - # "--wallet-name", |
448 |
| - # "new_wallet", |
449 |
| - # "--hotkey", |
450 |
| - # "new_hotkey", |
451 |
| - # "--wallet-path", |
452 |
| - # wallet_path, |
453 |
| - # "--mnemonic", |
454 |
| - # mnemonics["coldkey"], |
455 |
| - # "--no-use-password", |
456 |
| - # "--overwrite", |
457 |
| - # "--json-output" |
458 |
| - # ], |
459 |
| - # ) |
| 447 | + json_result = exec_command( |
| 448 | + command="wallet", |
| 449 | + sub_command="regen-coldkey", |
| 450 | + extra_args=[ |
| 451 | + "--wallet-name", |
| 452 | + "new_wallet", |
| 453 | + "--hotkey", |
| 454 | + "new_hotkey", |
| 455 | + "--wallet-path", |
| 456 | + wallet_path, |
| 457 | + "--mnemonic", |
| 458 | + mnemonics["coldkey"], |
| 459 | + "--no-use-password", |
| 460 | + "--overwrite", |
| 461 | + "--json-output", |
| 462 | + ], |
| 463 | + ) |
| 464 | + |
| 465 | + json_result_out = json.loads(json_result.stdout) |
| 466 | + assert json_result_out["success"] is True |
| 467 | + assert json_result_out["data"]["name"] == "new_wallet" |
| 468 | + assert json_result_out["data"]["coldkey_ss58"] == initial_coldkey_ss58 |
460 | 469 |
|
461 | 470 | # -----------------------------
|
462 | 471 | # Command 2: <btcli w regen_coldkeypub>
|
|
0 commit comments