Skip to content

Commit 4132ea0

Browse files
authored
Merge branch 'main' into 177-upgrade-pydantic-version
2 parents afe055d + abdb760 commit 4132ea0

File tree

3 files changed

+43
-12
lines changed

3 files changed

+43
-12
lines changed

src/aleph/sdk/account.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -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:

src/aleph/sdk/client/http.py

+2
Original file line numberDiff line numberDiff line change
@@ -467,3 +467,5 @@ async def get_message_status(self, item_hash: str) -> MessageStatus:
467467
if resp.status == HTTPNotFound.status_code:
468468
raise MessageNotFoundError(f"No such hash {item_hash}")
469469
resp.raise_for_status()
470+
result = await resp.json()
471+
return MessageStatus(result["status"])

src/aleph/sdk/conf.py

+27
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,38 @@ class Settings(BaseSettings):
182182
CHAINS_AVAX_ACTIVE: Optional[bool] = None
183183
CHAINS_BASE_ACTIVE: Optional[bool] = None
184184
CHAINS_BSC_ACTIVE: Optional[bool] = None
185+
CHAINS_ARBITRUM_ACTIVE: Optional[bool] = None
186+
CHAINS_BLAST_ACTIVE: Optional[bool] = None
187+
CHAINS_BOB_ACTIVE: Optional[bool] = None
188+
CHAINS_CYBER_ACTIVE: Optional[bool] = None
189+
CHAINS_FRAXTAL_ACTIVE: Optional[bool] = None
190+
CHAINS_LINEA_ACTIVE: Optional[bool] = None
191+
CHAINS_LISK_ACTIVE: Optional[bool] = None
192+
CHAINS_METIS_ACTIVE: Optional[bool] = None
193+
CHAINS_MODE_ACTIVE: Optional[bool] = None
194+
CHAINS_OPTIMISM_ACTIVE: Optional[bool] = None
195+
CHAINS_POL_ACTIVE: Optional[bool] = None
196+
CHAINS_WORLDCHAIN_ACTIVE: Optional[bool] = None
197+
CHAINS_ZORA_ACTIVE: Optional[bool] = None
198+
185199
CHAINS_SEPOLIA_RPC: Optional[str] = None
186200
CHAINS_ETH_RPC: Optional[str] = None
187201
CHAINS_AVAX_RPC: Optional[str] = None
188202
CHAINS_BASE_RPC: Optional[str] = None
189203
CHAINS_BSC_RPC: Optional[str] = None
204+
CHAINS_ARBITRUM_RPC: Optional[str] = None
205+
CHAINS_BLAST_RPC: Optional[str] = None
206+
CHAINS_BOB_RPC: Optional[str] = None
207+
CHAINS_CYBER_RPC: Optional[str] = None
208+
CHAINS_FRAXTAL_RPC: Optional[str] = None
209+
CHAINS_LINEA_RPC: Optional[str] = None
210+
CHAINS_LISK_RPC: Optional[str] = None
211+
CHAINS_METIS_RPC: Optional[str] = None
212+
CHAINS_MODE_RPC: Optional[str] = None
213+
CHAINS_OPTIMISM_RPC: Optional[str] = None
214+
CHAINS_POL_RPC: Optional[str] = None
215+
CHAINS_WORLDCHAIN_RPC: Optional[str] = None
216+
CHAINS_ZORA_RPC: Optional[str] = None
190217

191218
DEFAULT_CHAIN: Chain = Chain.ETH
192219

0 commit comments

Comments
 (0)