Skip to content

Commit 1569fbc

Browse files
committed
Fix account_from_hex_string + refactoring
1 parent 395fc79 commit 1569fbc

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/aleph/sdk/account.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,11 @@ def account_from_hex_string(
5454
private_key_str = private_key_str[2:]
5555

5656
if not chain:
57-
if not account_type:
58-
account_type = load_chain_account_type(Chain.ETH) # type: ignore
59-
return account_type(bytes.fromhex(private_key_str)) # type: ignore
57+
chain = settings.DEFAULT_CHAIN
58+
if not account_type:
59+
account_type = load_chain_account_type(chain)
60+
account = account_type(bytes.fromhex(private_key_str))
6061

61-
account_type = load_chain_account_type(chain)
62-
account = account_type(bytes.fromhex(private_key_str), chain)
6362
if chain in get_chains_with_super_token():
6463
account.switch_chain(chain)
6564
return account # type: ignore
@@ -73,12 +72,11 @@ def account_from_file(
7372
private_key = private_key_path.read_bytes()
7473

7574
if not chain:
76-
if not account_type:
77-
account_type = load_chain_account_type(Chain.ETH) # type: ignore
78-
return account_type(private_key) # type: ignore
79-
80-
account_type = load_chain_account_type(chain)
75+
chain = settings.DEFAULT_CHAIN
76+
if not account_type:
77+
account_type = load_chain_account_type(chain)
8178
account = account_type(private_key)
79+
8280
if chain in get_chains_with_super_token():
8381
account.switch_chain(chain)
8482
return account

0 commit comments

Comments
 (0)