
    (i                         d dl mZmZmZmZ d dlmZ d dlmZ d dl	m
Z
mZ d dlmZ d dlmZmZ d dlmZ d dlmZ d d	lmZmZ  G d
 de      Zy)    )AnyDictOptionalcast)KDFType)
PrivateKey)ChecksumAddressHash32)AccountLocalActions)SignedMessageSignedTransaction)SignableMessage)BaseAccount)BlobsTransactionDictTypec                   J   e Zd ZdZdedefdZdefdZe	de
fd       Ze	defd       Z	 	 dd
edee   dee   deeef   fdZdedefdZdedefdZ	 ddedee   defdZ	 	 	 	 ddeeeef      deeeef      deeeef      deeeef      def
dZdeeef   defdZy	)LocalAccounta  
    A collection of convenience methods to sign and encrypt, with an
    embedded private key.

    :var bytes key: the 32-byte private key data

    .. code-block:: python

        >>> my_local_account.address
        "0xF0109fC8DF283027b6285cc889F5aA624EaC1F55"
        >>> my_local_account.key
        b"\x01\x23..."

    You can also get the private key by casting the account to :class:`bytes`:

    .. code-block:: python

        >>> bytes(my_local_account)
        b"\\x01\\x23..."
    keyaccountc                     || _         |j                  j                         | _        |j	                         }|| _        || _        y)z
        Initialize a new account with the given private key.

        :param eth_keys.PrivateKey key: to prefill in private key execution
        :param ~eth_account.account.Account account: the key-unaware management API
        N)
_publicapi
public_keyto_checksum_address_addressto_bytes_private_key_key_obj)selfr   r   key_raws       J/var/www/br/venv/lib/python3.12/site-packages/eth_account/signers/local.py__init__zLocalAccount.__init__<   s9     07),)K)K)M#$'    returnc                     | j                   S N)r   r   s    r    	__bytes__zLocalAccount.__bytes__L   s    xxr"   c                     | j                   S r%   )r   r&   s    r    addresszLocalAccount.addressO   s    }}r"   c                     | j                   S )z&
        Get the private key.
        )r   r&   s    r    r   zLocalAccount.keyS   s    
    r"   Npasswordkdf
iterationsc                 T    | j                   j                  | j                  |||      S )z
        Generate a string with the encrypted key.

        This uses the same structure as in
        :meth:`~eth_account.account.Account.encrypt`, but without a
        private key argument.
        )r,   r-   )r   encryptr   )r   r+   r,   r-   s       r    r/   zLocalAccount.encryptZ   s-     &&HHhCJ ' 
 	
r"   message_hashc                 l    t        t        | j                  j                  || j                              S Nprivate_key)r   r   r   unsafe_sign_hashr   )r   r0   s     r    r5   zLocalAccount.unsafe_sign_hashk   s3    OO,, HH - 
 	
r"   signable_messagec                 l    t        t        | j                  j                  || j                              S )z
        Generate a string with the encrypted key.

        This uses the same structure as in
        :meth:`~eth_account.account.Account.sign_message`, but without a
        private key argument.
        r3   )r   r   r   sign_messager   )r   r6   s     r    r8   zLocalAccount.sign_messaget   s0     OO(()9txx(P
 	
r"   transaction_dictblobsc                 n    t        t        | j                  j                  || j                  |            S )N)r:   )r   r   r   sign_transactionr   )r   r9   r:   s      r    r<   zLocalAccount.sign_transaction   s2     OO,,-=txxu,U
 	
r"   domain_datamessage_typesmessage_datafull_messagec           
      r    t        t        | j                  j                  | j                  ||||            S )z
        Sign the provided EIP-712 message with the local private key.

        This uses the same structure as in
        :meth:`~eth_account.account.Account.sign_typed_data`, but without a
        private key argument.
        )r4   r=   r>   r?   r@   )r   r   r   sign_typed_datar   )r   r=   r>   r?   r@   s        r    rB   zLocalAccount.sign_typed_data   s>     OO++ HH'+)) , 	
 		
r"   authorizationc                 l    t        t        | j                  j                  || j                              S r2   )r   r   r   sign_authorizationr   )r   rC   s     r    rE   zLocalAccount.sign_authorization   s-    OO..}$((.S
 	
r"   )NNr%   )NNNN)__name__
__module____qualname____doc__r   r   r!   bytesr'   propertyr	   r)   r   strr   r   intr   r   r/   r
   r   r5   r   r8   r   r   r   r<   rB   rE    r"   r    r   r   &   s   *(J (1D ( 5     !U ! ! "&$(	

 g
 SM	

 
c3h
"
V 
 

_ 
 
 OS
 3
<DUO
	
 15261515
d38n-
  S#X/
 tCH~.	

 tCH~.
 

2
S#X 
= 
r"   r   N)typingr   r   r   r   eth_keyfile.keyfiler   eth_keys.datatypesr   
eth_typingr	   r
   !eth_account.account_local_actionsr   eth_account.datastructuresr   r   eth_account.messagesr   eth_account.signers.baser   eth_account.typesr   r   r   rN   r"   r    <module>rX      sE    
@
; @
r"   