@@ -54,12 +54,14 @@ 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 ) # type: ignore
60+ account = account_type (
61+ bytes .fromhex (private_key_str ),
62+ ** ({"chain" : chain } if type (account_type ) in [ETHAccount , EVMAccount ] else {}),
63+ ) # type: ignore
6064
61- account_type = load_chain_account_type (chain )
62- account = account_type (bytes .fromhex (private_key_str ), chain )
6365 if chain in get_chains_with_super_token ():
6466 account .switch_chain (chain )
6567 return account # type: ignore
@@ -73,12 +75,14 @@ def account_from_file(
7375 private_key = private_key_path .read_bytes ()
7476
7577 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
78+ chain = settings .DEFAULT_CHAIN
79+ if not account_type :
80+ account_type = load_chain_account_type (chain ) # type: ignore
81+ account = account_type (
82+ private_key ,
83+ ** ({"chain" : chain } if type (account_type ) in [ETHAccount , EVMAccount ] else {}),
84+ ) # type: ignore
7985
80- account_type = load_chain_account_type (chain )
81- account = account_type (private_key , chain )
8286 if chain in get_chains_with_super_token ():
8387 account .switch_chain (chain )
8488 return account
@@ -106,8 +110,6 @@ def _load_account(
106110 logger .warning (
107111 f"No main configuration found on path { settings .CONFIG_FILE } , defaulting to { chain } "
108112 )
109- else :
110- chain = default_chain
111113
112114 # Loads configuration if no account_type is specified
113115 if not account_type :
0 commit comments