
    (i                     v   d dl mZmZmZmZmZmZmZmZ d dl	Z	d dl
mZ d dlmZ d dlmZ d dlmZ d dlmZmZmZmZ d dlmZ d d	lmZmZmZmZ d d
lmZm Z   G d d eddefdefde!fde!fde!fg            Z" G d d eddefde!fde!fde!fdefg            Z# G d de      Z$ G d de      Z% G d de%      Z&y)    )AnyDict
NamedTupleSupportsIndexTupleTypeUnionoverloadN)	Signature)ChecksumAddressto_checksum_address)HexBytes)	BaseModel
ConfigDictFieldfield_serializer)to_camel)DEFAULT_REF_TEMPLATEGenerateJsonSchemaJsonSchemaModeJsonSchemaValue)
CoreSchemaPydanticOmitc                        e Zd Zededefd       Zededeedf   fd       Zede	defd       Zde
eee	f   def fdZ xZS )SignedTransactionindexreturnc                      y N selfr   s     K/var/www/br/venv/lib/python3.12/site-packages/eth_account/datastructures.py__getitem__zSignedTransaction.__getitem__:           .c                      y r    r!   r"   s     r$   r%   zSignedTransaction.__getitem__>   r&   r'   c                      y r    r!   r"   s     r$   r%   zSignedTransaction.__getitem__B   r&   r'   c                     t        |t        t        f      rt        |   |      S t        |t
              rt        | |      S t        d      Nz*Index must be an integer, slice, or string
isinstanceintslicesuperr%   strgetattr	TypeErrorr#   r   	__class__s     r$   r%   zSignedTransaction.__getitem__F   D    ec5\*7&u--s#4''HIIr'   __name__
__module____qualname__r
   r   r   r%   r/   r   r1   r	   __classcell__r5   s   @r$   r   r   .         3    5c?      J}eS'@!A Jc J Jr'   r   raw_transactionhashrsvc                        e Zd Zededefd       Zededeedf   fd       Zede	defd       Zde
eee	f   def fdZ xZS )SignedMessager   r   c                      y r    r!   r"   s     r$   r%   zSignedMessage.__getitem__[   r&   r'   .c                      y r    r!   r"   s     r$   r%   zSignedMessage.__getitem___   r&   r'   c                      y r    r!   r"   s     r$   r%   zSignedMessage.__getitem__c   r&   r'   c                     t        |t        t        f      rt        |   |      S t        |t
              rt        | |      S t        d      r+   r,   r4   s     r$   r%   zSignedMessage.__getitem__g   r6   r'   r7   r<   s   @r$   rD   rD   O   r=   r'   rD   message_hash	signaturec                        e Zd ZdededefdZy)OmitJsonSchemaschema
error_infor   c                     t         r    )r   )r#   rM   rN   s      r$   handle_invalid_for_json_schemaz-OmitJsonSchema.handle_invalid_for_json_schemaq   s
     r'   N)r8   r9   r:   r   r1   r   rP   r!   r'   r$   rL   rL   p   s     .1	r'   rL   c                   ~     e Zd ZdZ edde      ZdefdZe	de
edfdeded	ee   d
edeeef   f
 fd       Z xZS )CustomPydanticModelaP  
    A base class for eth-account pydantic models that provides custom JSON-RPC
    serialization configuration. JSON-RPC serialization is configured to use
    camelCase keys and to exclude fields that are marked as ``exclude=True``. To
    serialize a model to the expected JSON-RPC format, use
    ``model_dump(by_alias=True)``.
    T)arbitrary_types_allowedpopulate_by_namealias_generatorr   c                 ^    t        j                  dt        d       | j                  d      S )NzSrecursive_model_dump() is deprecated. Please use model_dump(by_alias=True) instead.   )
stacklevelT)by_alias)warningswarnDeprecationWarning
model_dumpr#   s    r$   recursive_model_dumpz(CustomPydanticModel.recursive_model_dump   s.     	1		
 --r'   
validationrY   ref_templateschema_generatormodec                 *    t         |   ||||      S )z
        Omits excluded fields from the JSON schema, preventing errors that would
        otherwise be raised by the default schema generator.
        )rY   ra   rb   rc   )r0   model_json_schema)clsrY   ra   rb   rc   r5   s        r$   re   z%CustomPydanticModel.model_json_schema   s(     w(%-	 ) 
 	
r'   )r8   r9   r:   __doc__r   r   model_configr   r_   classmethodr   rL   boolr1   r   r   r   r   re   r;   r<   s   @r$   rR   rR   w   s      $ L
.c 
.  05C+

 

 12
 
 
c3h
 
r'   rR   c                       e Zd ZU eed<   eed<   eed<   eed<   eed<   eed<    ed      Zeed	<    ed      Z	e
ed
<    ed      ededefd              Zedefd       Zy)SignedSetCodeAuthorizationchain_idaddressnoncey_parityr@   rA   T)excluderJ   authorization_hashvaluer   c                     t        |      S r    r   )rf   rs   s     r$   serialize_addressz,SignedSetCodeAuthorization.serialize_address   s     #5))r'   c                 h    | j                   j                  | j                        j                         S )ay  
        Return the address of the authority that signed the authorization.

        In order to prevent any potential confusion or mal-intent, the authority is
        always derived from the signature and the authorization hash, rather than
        statically assigned. This value should be verified against the expected
        authority for a signed authorization.
        )rJ    recover_public_key_from_msg_hashrr   to_canonical_addressr^   s    r$   	authorityz$SignedSetCodeAuthorization.authority   s-     ~~>>##



 	!r'   N)r8   r9   r:   r.   __annotations__bytesr   rJ   r   rr   r   r   ri   r   ru   propertyry   r!   r'   r$   rl   rl      s    MNJM
F
F .Iy.#(#66i *e * *  !* !5 ! !r'   rl   )'typingr   r   r   r   r   r   r	   r
   rZ   eth_keys.datatypesr   
eth_typingr   	eth_utilsr   hexbytesr   pydanticr   r   r   r   pydantic.alias_generatorsr   pydantic.json_schemar   r   r   r   pydantic_corer   r   r.   r   rD   rL   rR   rl   r!   r'   r$   <module>r      s   	 	 	   J)X#J#J#J	
	JBJX&#J#J#J(#	
	JB' -
) -
`!!4 !r'   