o
    ¢ØÆh¨  ã                   @   s˜   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„ deƒZdS )é    )ÚAnyÚDictÚOptionalÚcast)ÚKDFType)Ú
PrivateKey)ÚChecksumAddressÚHash32)ÚAccountLocalActions)ÚSignedMessageÚSignedTransaction)ÚSignableMessage)ÚBaseAccount)ÚBlobsÚTransactionDictTypec                   @   s8  e Zd ZdZdedefdd„Zdefdd„Ze	de
fd	d
„ƒZe	defdd„ƒZ		d&dedee dee deeef fdd„Zdedefdd„Zdedefdd„Z	d'dedee defd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!d"„Zd#eeef defd$d%„ZdS ))Ú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                 C   s*   || _ |j ¡ | _| ¡ }|| _|| _dS )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_raw© r   úf/var/www/html/HyperOracle/crypto_trader/venv/lib/python3.10/site-packages/eth_account/signers/local.pyÚ__init__<   s
   
zLocalAccount.__init__Úreturnc                 C   ó   | j S ©N)r   ©r   r   r   r   Ú	__bytes__L   s   zLocalAccount.__bytes__c                 C   r!   r"   )r   r#   r   r   r   ÚaddressO   s   zLocalAccount.addressc                 C   r!   )z&
        Get the private key.
        )r   r#   r   r   r   r   S   s   zLocalAccount.keyNÚpasswordÚkdfÚ
iterationsc                 C   s   | j j| j|||d�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(   r   r   r   r)   Z   s   
ÿzLocalAccount.encryptÚmessage_hashc                 C   ó   t t| jj|| jd�ƒS ©N©Úprivate_key)r   r   r   Úunsafe_sign_hashr   )r   r*   r   r   r   r/   k   s   þþzLocalAccount.unsafe_sign_hashÚsignable_messagec                 C   r+   )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.
        r-   )r   r   r   Úsign_messager   )r   r0   r   r   r   r1   t   s   þzLocalAccount.sign_messageÚtransaction_dictÚblobsc                 C   s   t t| jj|| j|d�ƒS )N)r3   )r   r   r   Úsign_transactionr   )r   r2   r3   r   r   r   r4   �   s   þzLocalAccount.sign_transactionÚdomain_dataÚmessage_typesÚmessage_dataÚfull_messagec              	   C   s   t t| jj| j||||d�ƒ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.
        )r.   r5   r6   r7   r8   )r   r   r   Úsign_typed_datar   )r   r5   r6   r7   r8   r   r   r   r9   ‰   s   ûþzLocalAccount.sign_typed_dataÚauthorizationc                 C   r+   r,   )r   r   r   Úsign_authorizationr   )r   r:   r   r   r   r;   ¢   s   þzLocalAccount.sign_authorization)NNr"   )NNNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r
   r   Úbytesr$   Úpropertyr   r%   r   Ústrr   r   Úintr   r   r)   r	   r   r/   r   r1   r   r   r   r4   r9   r;   r   r   r   r   r   &   sZ    	üþýü

û	ÿÿÿ
þ
ûþýüû
ú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   r   r   r   r   Ú<module>   s    