22from typing import Any , Iterator , Optional
33
44from ape .api .accounts import AccountAPI , AccountContainerAPI , TransactionAPI
5+ from ape .logging import logger
56from ape .types import AddressType , MessageSignature , SignableMessage , TransactionSignature
67from eth_account ._utils .legacy_transactions import serializable_unsigned_transaction_from_dict
78from eth_account .messages import _hash_eip191_message , encode_defunct
1112from ape_aws .exceptions import ApeAwsException
1213
1314from .client import AwsClient
15+ from .exceptions import AwsAccessError
1416from .kms .client import KmsKey
1517from .utils import _convert_der_to_rsv
1618
@@ -20,6 +22,16 @@ def __init__(self, *args, **kwargs):
2022 super (AwsClient , self ).__init__ () # NOTE: Use config/envvar default
2123 super (AccountContainerAPI , self ).__init__ (* args , ** kwargs )
2224
25+ @property
26+ def keys (self ) -> dict [str , KmsKey ]: # type: ignore[syntax]
27+ try :
28+ return super (AwsClient , self ).keys
29+
30+ except AwsAccessError as e :
31+ # NOTE: Do not raise here, instead just log warning (prevent issues w/ Ape API)
32+ logger .warning (str (e ))
33+ return {}
34+
2335 @property
2436 def aliases (self ) -> Iterator [str ]:
2537 yield from iter (self .keys )
0 commit comments