Get human-readable error message for a contract error signature.
4-byte error signature (e.g., “0xb0cfa447”)
Human-readable error message, or the signature if not found
def get_error_message(error_signature: str) -> str:
if not error_signature.startswith('0x'):
error_signature = f'0x{error_signature}'
error_signature = error_signature.lower()
return CONTRACT_ERROR_MESSAGES.get(error_signature, error_signature)