o
    ¢ØÆh i  ã                   @   sª  d dl mZ d dlZd dlZd dlZd dlmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZ d dlmZmZmZmZmZmZmZmZmZ d dlmZ ddlmZ ded	ed
eeeedf f fdd„Z de!d
eee!ee! f  fdd„Z"ded
dfdd„Z#ded
dfdd„Z$deeee!ef e!f d
e!fdd„Z%ded
e!fdd„Z&de!ded
ee fdd„Z'ede
d  ded
ee fd!d"„ƒZ(ede
d# ded
ee fd$d"„ƒZ(ede
d% ded
ee fd&d"„ƒZ(ede
d' ded
ee fd(d"„ƒZ(ede
d) ded
ee fd*d"„ƒZ(ede
d+ ded
ee fd,d"„ƒZ(de
d- ded
eeeeeeeef  fd.d"„Z(ded
ee fd/d0„Z)ded
ee fd1d2„Z*ded3eee  d4eee!ef  d
eedf fd5d6„Z+ded7eeedf eeef f d
eee!df eedf f fd8d9„Z,ded
e	ee!  fd:d;„Z-ded
e	e! fd<d=„Z.ded
e	ee!  fd>d?„Z/ded
e	e! fd@dA„Z0dBe!d
e1fdCdD„Z2ded
e1fdEdF„Z3dGe!d
e1fdHdI„Z4dJed
e1fdKdL„Z5dS )Mé    )ÚabcN)ÚAnyÚDictÚIterableÚListÚLiteralÚMappingÚOptionalÚSequenceÚTupleÚUnionÚcastÚoverload)	ÚABIÚABIComponentÚABIConstructorÚ
ABIElementÚABIErrorÚABIEventÚABIFallbackÚABIFunctionÚ
ABIReceive)Úis_list_likeé   )ÚkeccakÚarg_abiÚnormalized_argÚreturn.c           
         sî   t |  dd¡ƒ}|du rˆ S |\}}|du r"ttt |  dg ¡ƒ}n| d¡}t | ¡}|d|d   |d< t |¡}t	ˆ t
jƒrMt‡ fdd	„|D ƒƒ}nˆ }t|ƒs`td
|  d¡› d|› �ƒ‚t	|tƒrgtnt|ƒ}	|	dd	„ t||ƒD ƒƒS )z“
    Aligns the values of any mapping at any level of nesting in ``normalized_arg``
    according to the layout of the corresponding abi spec.
    ÚtypeÚ NÚ
componentsú[z[]r   c                 3   ó   � | ]	}ˆ |d   V  qdS ©ÚnameN© ©Ú.0Úabi©r   r%   úZ/var/www/html/HyperOracle/crypto_trader/venv/lib/python3.10/site-packages/eth_utils/abi.pyÚ	<genexpr>I   s   € z#_align_abi_input.<locals>.<genexpr>z"Expected non-string sequence for "z" component type: got c                 s   ó   � | ]
\}}t ||ƒV  qd S ©N©Ú_align_abi_input)r'   Úsub_abiÚsub_argr%   r%   r*   r+   V   ó
   € ÿ
ÿ)Ú_get_tuple_type_str_and_dimsÚgetr   r   r   ÚcountÚcopyÚ	itertoolsÚrepeatÚ
isinstancer   r   Útupler   Ú	TypeErrorr   Úzip)
r   r   Útuple_partsÚtuple_prefixÚ
tuple_dimsÚsub_abisÚnum_dimsÚnew_abiÚaligned_argÚtypingr%   r)   r*   r/   +   s.   


ÿÿþr/   Úsc                 C   s<   d}t  |¡ | ¡}|dur| d¡}| d¡}||fS dS )z¦
    Takes a JSON ABI type string.  For tuple type strings, returns the separated
    prefix and array dimension parts.  For all other strings, returns ``None``.
    z^(tuple)((\[([1-9]\d*)?])*)??$Nr   é   )ÚreÚcompileÚmatchÚgroup)rE   Útuple_type_str_rerI   r>   r?   r%   r%   r*   r3   \   s   

r3   Úabi_elementc                 C   s2   | d dkrt d|  d¡› d|  d¡› d�ƒ‚d S )Nr   ÚfunctionzGOutputs only supported for ABI type `function`. Provided ABI type was `z` and outputs were `Úoutputsú`.©Ú
ValueErrorr4   ©rL   r%   r%   r*   Ú_raise_if_not_function_abim   s   ÿþÿÿrS   c                 C   s>   | d dks| d dkrt d|  d¡› d|  d¡› d�ƒ‚d S )Nr   ÚfallbackÚreceivezXInputs not supported for function types `fallback` or `receive`. Provided ABI type was `z` with inputs `ÚinputsrO   rP   rR   r%   r%   r*   Ú!_raise_if_fallback_or_receive_abiv   s   ÿþÿÿrW   r(   c                 C   s„   t | tƒr| S |  d¡}t |tƒstdt|ƒ› dt|ƒ› �ƒ‚| d¡s&|S d dd„ | d D ƒ¡}|d	d
… }d|› d|› �}|S )aV  
    Extract argument types from a function or event ABI parameter.

    With tuple argument types, return a Tuple of each type.
    Returns the param if `abi` is an instance of str or another non-tuple
    type.

    :param abi: A Function or Event ABI component or a string with type info.
    :type abi: `Union[ABIComponent, Dict[str, Any], str]`
    :return: Type(s) for the function or event ABI param.
    :rtype: `str`

    .. doctest::

        >>> from eth_utils.abi import collapse_if_tuple
        >>> abi = {
        ...   'components': [
        ...     {'name': 'anAddress', 'type': 'address'},
        ...     {'name': 'anInt', 'type': 'uint256'},
        ...     {'name': 'someBytes', 'type': 'bytes'},
        ...   ],
        ...   'type': 'tuple',
        ... }
        >>> collapse_if_tuple(abi)
        '(address,uint256,bytes)'
    r   z%The 'type' must be a string, but got z	 of type r:   ú,c                 s   ó   � | ]}t |ƒV  qd S r-   ©Úcollapse_if_tuple)r'   Úcr%   r%   r*   r+   ¦   ó   € z$collapse_if_tuple.<locals>.<genexpr>r    é   Nú(ú))r9   Ústrr4   r;   Úreprr   Ú
startswithÚjoin)r(   Úelement_typeÚ	delimitedÚ	array_dimÚ	collapsedr%   r%   r*   r[      s   


ÿÿ
r[   c                 C   sh   d}t |  dd¡ƒ}|dks|dkr|j|dd�S |dkr |}nt |  d|¡ƒ}|j|d	 t| ƒ¡d�S )
a5  
    Returns a string signature representation of the function or event ABI
    and arguments.

    Signatures consist of the name followed by a list of arguments.

    :param abi_element: ABI element.
    :type abi_element: `ABIElement`
    :return: Stringified ABI signature
    :rtype: `str`

    .. doctest::

        >>> from eth_utils import abi_to_signature
        >>> abi_element = {
        ...   'constant': False,
        ...   'inputs': [
        ...     {
        ...       'name': 's',
        ...       'type': 'uint256'
        ...     }
        ...   ],
        ...   'name': 'f',
        ...   'outputs': [],
        ...   'payable': False,
        ...   'stateMutability': 'nonpayable',
        ...   'type': 'function'
        ... }
        >>> abi_to_signature(abi_element)
        'f(uint256)'
    z{name}({input_types})r   r   rT   rU   )r$   Úinput_typesÚconstructorr$   rX   )ra   r4   Úformatrd   Úget_abi_input_types)rL   Ú	signatureÚabi_typeÚfn_namer%   r%   r*   Úabi_to_signature¯   s    ÿrp   Úabi_nameÚcontract_abic                    s   ‡ fdd„|D ƒS )aì  
    Get one or more function and event ABIs by name.

    :param abi_name: Name of the function, event or error.
    :type abi_name: `str`
    :param contract_abi: Contract ABI.
    :type contract_abi: `ABI`
    :return: Function or event ABIs with matching name.
    :rtype: `Sequence[ABIElement]`

    .. doctest::

            >>> from eth_utils.abi import filter_abi_by_name
            >>> abi = [
            ...     {
            ...         "constant": False,
            ...         "inputs": [],
            ...         "name": "func_1",
            ...         "outputs": [],
            ...         "type": "function",
            ...     },
            ...     {
            ...         "constant": False,
            ...         "inputs": [
            ...             {"name": "a", "type": "uint256"},
            ...         ],
            ...         "name": "func_2",
            ...         "outputs": [],
            ...         "type": "function",
            ...     },
            ...     {
            ...         "constant": False,
            ...         "inputs": [
            ...             {"name": "a", "type": "uint256"},
            ...             {"name": "b", "type": "uint256"},
            ...         ],
            ...         "name": "func_3",
            ...         "outputs": [],
            ...         "type": "function",
            ...     },
            ...     {
            ...         "constant": False,
            ...         "inputs": [
            ...             {"name": "a", "type": "uint256"},
            ...             {"name": "b", "type": "uint256"},
            ...             {"name": "c", "type": "uint256"},
            ...         ],
            ...         "name": "func_4",
            ...         "outputs": [],
            ...         "type": "function",
            ...     },
            ... ]
            >>> filter_abi_by_name("func_1", abi)
            [{'constant': False, 'inputs': [], 'name': 'func_1', 'outputs': [], 'type': 'function'}]
    c                    s@   g | ]}|d  dks|d  dks|d  dkr|d ˆ kr|‘qS )r   rM   ÚeventÚerrorr$   r%   r&   ©rq   r%   r*   Ú
<listcomp>  s    øz&filter_abi_by_name.<locals>.<listcomp>r%   )rq   rr   r%   ru   r*   Úfilter_abi_by_nameß   s   
9þrw   rn   rM   c                 C   ó   d S r-   r%   ©rn   rr   r%   r%   r*   Úfilter_abi_by_type&  ó   rz   rj   c                 C   rx   r-   r%   ry   r%   r%   r*   rz   .  r{   rT   c                 C   rx   r-   r%   ry   r%   r%   r*   rz   6  r{   rU   c                 C   rx   r-   r%   ry   r%   r%   r*   rz   >  r{   rs   c                 C   rx   r-   r%   ry   r%   r%   r*   rz   F  r{   rt   c                 C   rx   r-   r%   ry   r%   r%   r*   rz   N  r{   )rM   rj   rT   rU   rs   rt   c                 C   sÚ   | t d ks
| dkrdd„ |D ƒS | t d ks| dkr"dd„ |D ƒS | t d ks,| dkr3dd„ |D ƒS | t d ks=| dkrDd	d„ |D ƒS | t d
 ksN| d
krUdd„ |D ƒS | t d ks_| dkrfdd„ |D ƒS td| › �ƒ‚)as  
    Return a list of each ``ABIElement`` that is of type ``abi_type``.

    For mypy, function overloads ensures the correct type is returned based on the
    ``abi_type``. For example, if ``abi_type`` is "function", the return type will be
    ``Sequence[ABIFunction]``.

    :param abi_type: Type of ABI element to filter by.
    :type abi_type: `str`
    :param contract_abi: Contract ABI.
    :type contract_abi: `ABI`
    :return: List of ABI elements of the specified type.
    :rtype: `Sequence[Union[ABIFunction, ABIConstructor, ABIFallback, ABIReceive, ABIEvent, ABIError]]`

    .. doctest::

        >>> from eth_utils import filter_abi_by_type
        >>> abi = [
        ...   {"type": "function", "name": "myFunction", "inputs": [], "outputs": []},
        ...   {"type": "function", "name": "myFunction2", "inputs": [], "outputs": []},
        ...   {"type": "event", "name": "MyEvent", "inputs": []}
        ... ]
        >>> filter_abi_by_type("function", abi)
        [{'type': 'function', 'name': 'myFunction', 'inputs': [], 'outputs': []}, {'type': 'function', 'name': 'myFunction2', 'inputs': [], 'outputs': []}]
    rM   c                 S   ó   g | ]
}|d  dkr|‘qS )r   rM   r%   r&   r%   r%   r*   rv   z  ó    z&filter_abi_by_type.<locals>.<listcomp>rj   c                 S   r|   )r   rj   r%   r&   r%   r%   r*   rv   |  r}   rT   c                 S   r|   )r   rT   r%   r&   r%   r%   r*   rv   ~  r}   rU   c                 S   r|   )r   rU   r%   r&   r%   r%   r*   rv   €  r}   rs   c                 S   r|   )r   rs   r%   r&   r%   r%   r*   rv   ‚  r}   rt   c                 S   r|   )r   rt   r%   r&   r%   r%   r*   rv   „  r}   zUnsupported ABI type: )r   rQ   ry   r%   r%   r*   rz   V  s   #c                 C   ó
   t d| ƒS )a  
    Return interfaces for each function in the contract ABI.

    :param contract_abi: Contract ABI.
    :type contract_abi: `ABI`
    :return: List of ABIs for each function interface.
    :rtype: `Sequence[ABIFunction]`

    .. doctest::

        >>> from eth_utils import get_all_function_abis
        >>> contract_abi = [
        ...   {"type": "function", "name": "myFunction", "inputs": [], "outputs": []},
        ...   {"type": "function", "name": "myFunction2", "inputs": [], "outputs": []},
        ...   {"type": "event", "name": "MyEvent", "inputs": []}
        ... ]
        >>> get_all_function_abis(contract_abi)
        [{'type': 'function', 'name': 'myFunction', 'inputs': [], 'outputs': []}, {'type': 'function', 'name': 'myFunction2', 'inputs': [], 'outputs': []}]
    rM   ©rz   ©rr   r%   r%   r*   Úget_all_function_abis‰  s   
r�   c                 C   r~   )a§  
    Return interfaces for each event in the contract ABI.

    :param contract_abi: Contract ABI.
    :type contract_abi: `ABI`
    :return: List of ABIs for each event interface.
    :rtype: `Sequence[ABIEvent]`

    .. doctest::

        >>> from eth_utils import get_all_event_abis
        >>> contract_abi = [
        ...   {"type": "function", "name": "myFunction", "inputs": [], "outputs": []},
        ...   {"type": "function", "name": "myFunction2", "inputs": [], "outputs": []},
        ...   {"type": "event", "name": "MyEvent", "inputs": []}
        ... ]
        >>> get_all_event_abis(contract_abi)
        [{'type': 'event', 'name': 'MyEvent', 'inputs': []}]
    rs   r   r€   r%   r%   r*   Úget_all_event_abis¡  s   
r‚   ÚargsÚkwargsc           
         s„  t | ƒ ttt |  dg ¡ƒ}t|ƒt|ƒ t|ƒkr.tdt|ƒ› dt|ƒt|ƒ › d�ƒ‚|s9tttdf |ƒS t	| 
¡ ƒ}tdd„ |D ƒƒ‰ ttˆ |ƒƒ}| | 
¡ ¡}|rht|  d¡› d	d
 |¡› d�ƒ‚tt| ˆ ¡ƒƒ}|r�d}|  d¡r‹t| |  d¡› d�d
 |¡¡ƒ‚t| d|  d¡› d�d
 |¡¡ƒ‚tttt | ¡ | ¡ ¡‡ fdd„d�Ž ƒ}	t|	ƒdkr¿t|	d ƒS tƒ S )aå  
    Flattens positional args (``args``) and keyword args (``kwargs``) into a Tuple and
    uses the ``abi_element`` for validation.

    Checks to ensure that the correct number of args were given, no duplicate args were
    given, and no unknown args were given.  Returns a list of argument values aligned
    to the order of inputs defined in ``abi_element``.

    :param abi_element: ABI element.
    :type abi_element: `ABIElement`
    :param args: Positional arguments for the function.
    :type args: `Optional[Sequence[Any]]`
    :param kwargs: Keyword arguments for the function.
    :type kwargs: `Optional[Dict[str, Any]]`
    :return: Arguments list.
    :rtype: `Tuple[Any, ...]`

    .. doctest::

        >>> from eth_utils import get_normalized_abi_inputs
        >>> abi = {
        ...   'constant': False,
        ...   'inputs': [
        ...     {
        ...       'name': 'name',
        ...       'type': 'string'
        ...     },
        ...     {
        ...       'name': 's',
        ...       'type': 'uint256'
        ...     },
        ...     {
        ...       'name': 't',
        ...       'components': [
        ...         {'name': 'anAddress', 'type': 'address'},
        ...         {'name': 'anInt', 'type': 'uint256'},
        ...         {'name': 'someBytes', 'type': 'bytes'},
        ...       ],
        ...       'type': 'tuple'
        ...     }
        ...   ],
        ...   'name': 'f',
        ...   'outputs': [],
        ...   'payable': False,
        ...   'stateMutability': 'nonpayable',
        ...   'type': 'function'
        ... }
        >>> get_normalized_abi_inputs(
        ...   abi, *('myName', 123), **{'t': ('0x1', 1, b'\x01')}
        ... )
        ('myName', 123, ('0x1', 1, b'\x01'))
    rV   z$Incorrect argument count. Expected 'z', got 'z'..c                 s   s   � | ]}|d  V  qdS r#   r%   )r'   r   r%   r%   r*   r+   ÿ  r]   z,get_normalized_abi_inputs.<locals>.<genexpr>r$   z(() got multiple values for argument(s) 'z, z+{} got unexpected keyword argument(s) '{}'.z()zType: 'r   ú'c                    s   ˆ   | d ¡S )Nr   )Úindex)Úkv©Úsorted_arg_namesr%   r*   Ú<lambda>  s    z+get_normalized_abi_inputs.<locals>.<lambda>)Úkeyr   r   )rW   r   r
   r   r4   Úlenr;   r   r   ÚsetÚkeysr:   Údictr<   Úintersectionrd   ÚsortedÚ
differencerk   r7   ÚchainÚitems)
rL   rƒ   r„   Úfunction_inputsÚkwarg_namesÚargs_as_kwargsÚduplicate_argsÚunknown_argsÚmessageÚsorted_argsr%   rˆ   r*   Úget_normalized_abi_inputs¸  sV   9ÿÿÿÿ
ÿÿÿ
þÿÿ	rœ   Únormalized_argsc                    sn   t | ƒ ttt |  dg ¡ƒ}tˆ tjƒr t‡ fdd„|D ƒƒ‰ tdd„ |D ƒƒt	ˆ ƒdd„ t
|ˆ ƒD ƒƒfS )a6  
    Returns a pair of nested Tuples containing a list of types and a list of input
    values sorted by the order specified by the ``abi``.

    ``normalized_args`` can be obtained by using
    :py:meth:`eth_utils.abi.get_normalized_abi_inputs`, which returns nested mappings
    or sequences corresponding to tuple-encoded values in ``abi``.

    :param abi_element: ABI element.
    :type abi_element: `ABIElement`
    :param normalized_args: Normalized arguments for the function.
    :type normalized_args: `Union[Tuple[Any, ...], Mapping[Any, Any]]`
    :return: Tuple of types and aligned arguments.
    :rtype: `Tuple[Tuple[str, ...], Tuple[Any, ...]]`

    .. doctest::

        >>> from eth_utils import get_aligned_abi_inputs
        >>> abi = {
        ...   'constant': False,
        ...   'inputs': [
        ...     {
        ...       'name': 'name',
        ...       'type': 'string'
        ...     },
        ...     {
        ...       'name': 's',
        ...       'type': 'uint256'
        ...     }
        ...   ],
        ...   'name': 'f',
        ...   'outputs': [],
        ...   'payable': False,
        ...   'stateMutability': 'nonpayable',
        ...   'type': 'function'
        ... }
        >>> get_aligned_abi_inputs(abi, ('myName', 123))
        (('string', 'uint256'), ('myName', 123))
    rV   c                 3   r"   r#   r%   r&   ©r�   r%   r*   r+   Z  s   € 
ÿz)get_aligned_abi_inputs.<locals>.<genexpr>c                 s   rY   r-   rZ   r&   r%   r%   r*   r+   _  r]   c                 s   r,   r-   r.   )r'   r(   Úargr%   r%   r*   r+   `  r2   )rW   r   r
   r   r4   r9   r   r   r:   r   r<   )rL   r�   Úabi_element_inputsr%   rž   r*   Úget_aligned_abi_inputs*  s   +ÿþþr¡   c                 C   ó(   t | ƒ dd„ ttt |  dg ¡ƒD ƒS )aê  
    Return names for each input from the function or event ABI.

    :param abi_element: ABI element.
    :type abi_element: `ABIElement`
    :return: Names for each input in the function or event ABI.
    :rtype: `List[Optional[str]]`

    .. doctest::

        >>> from eth_utils import get_abi_input_names
        >>> abi = {
        ...   'constant': False,
        ...   'inputs': [
        ...     {
        ...       'name': 's',
        ...       'type': 'uint256'
        ...     }
        ...   ],
        ...   'name': 'f',
        ...   'outputs': [],
        ...   'payable': False,
        ...   'stateMutability': 'nonpayable',
        ...   'type': 'function'
        ... }
        >>> get_abi_input_names(abi)
        ['s']
    c                 S   ó   g | ]}|  d d¡‘qS r#   ©r4   ©r'   rŸ   r%   r%   r*   rv   …  ó    
ÿÿz'get_abi_input_names.<locals>.<listcomp>rV   ©rW   r   r
   r   r4   rR   r%   r%   r*   Úget_abi_input_namesg  ó   þr¨   c                 C   r¢   )aæ  
    Return types for each input from the function or event ABI.

    :param abi_element: ABI element.
    :type abi_element: `ABIElement`
    :return: Types for each input in the function or event ABI.
    :rtype: `List[str]`

    .. doctest::

        >>> from eth_utils import get_abi_input_types
        >>> abi = {
        ...   'constant': False,
        ...   'inputs': [
        ...     {
        ...       'name': 's',
        ...       'type': 'uint256'
        ...     }
        ...   ],
        ...   'name': 'f',
        ...   'outputs': [],
        ...   'payable': False,
        ...   'stateMutability': 'nonpayable',
        ...   'type': 'function'
        ... }
        >>> get_abi_input_types(abi)
        ['uint256']
    c                 S   ó   g | ]}t |ƒ‘qS r%   rZ   r¥   r%   r%   r*   rv   ©  ó    ÿÿz'get_abi_input_types.<locals>.<listcomp>rV   r§   rR   r%   r%   r*   rl   ‹  r©   rl   c                 C   r¢   )aÌ  
    Return names for each output from the ABI element.

    :param abi_element: ABI element.
    :type abi_element: `ABIElement`
    :return: Names for each function output in the function ABI.
    :rtype: `List[Optional[str]]`

    .. doctest::

        >>> from eth_utils import get_abi_output_names
        >>> abi = {
        ...   'constant': False,
        ...   'inputs': [
        ...     {
        ...       'name': 's',
        ...       'type': 'uint256'
        ...     }
        ...   ],
        ...   'name': 'f',
        ...   'outputs': [
        ...     {
        ...       'name': 'name',
        ...       'type': 'string'
        ...     },
        ...     {
        ...       'name': 's',
        ...       'type': 'uint256'
        ...     }
        ...   ],
        ...   'payable': False,
        ...   'stateMutability': 'nonpayable',
        ...   'type': 'function'
        ... }
        >>> get_abi_output_names(abi)
        ['name', 's']
    c                 S   r£   r#   r¤   r¥   r%   r%   r*   rv   Ö  r¦   z(get_abi_output_names.<locals>.<listcomp>rN   ©rS   r   r
   r   r4   rR   r%   r%   r*   Úget_abi_output_names¯  s   &þr­   c                 C   r¢   )aÌ  
    Return types for each output from the function ABI.

    :param abi_element: ABI element.
    :type abi_element: `ABIElement`
    :return: Types for each function output in the function ABI.
    :rtype: `List[str]`

    .. doctest::

        >>> from eth_utils import get_abi_output_types
        >>> abi = {
        ...   'constant': False,
        ...   'inputs': [
        ...     {
        ...       'name': 's',
        ...       'type': 'uint256'
        ...     }
        ...   ],
        ...   'name': 'f',
        ...   'outputs': [
        ...     {
        ...       'name': 'name',
        ...       'type': 'string'
        ...     },
        ...     {
        ...       'name': 's',
        ...       'type': 'uint256'
        ...     }
        ...   ],
        ...   'payable': False,
        ...   'stateMutability': 'nonpayable',
        ...   'type': 'function'
        ... }
        >>> get_abi_output_types(abi)
        ['string', 'uint256']

    c                 S   rª   r%   rZ   r¥   r%   r%   r*   rv     r«   z(get_abi_output_types.<locals>.<listcomp>rN   r¬   rR   r%   r%   r*   Úget_abi_output_typesÜ  s   'þr®   Úfunction_signaturec                 C   s   t |  dd¡d�dd… S )a·  
    Return the 4-byte function selector from a function signature string.

    :param function_signature: String representation of the function name and arguments.
    :type function_signature: `str`
    :return: 4-byte function selector.
    :rtype: `bytes`

    .. doctest::

        >>> from eth_utils import function_signature_to_4byte_selector
        >>> function_signature_to_4byte_selector('myFunction()')
        b'\xc3x\n:'
    Ú r   ©ÚtextNé   ©r   Úreplace)r¯   r%   r%   r*   Ú$function_signature_to_4byte_selector
  s   r¶   c                 C   ó   t | ƒ}t|ƒS )a  
    Return the 4-byte function signature of the provided function ABI.

    :param abi_element: ABI element.
    :type abi_element: `ABIElement`
    :return: 4-byte function signature.
    :rtype: `bytes`

    .. doctest::

        >>> from eth_utils import function_abi_to_4byte_selector
        >>> abi_element = {
        ...   'type': 'function',
        ...   'name': 'myFunction',
        ...   'inputs': [],
        ...   'outputs': []
        ... }
        >>> function_abi_to_4byte_selector(abi_element)
        b'\xc3x\n:'
    )rp   r¶   )rL   r¯   r%   r%   r*   Úfunction_abi_to_4byte_selector  ó   r¸   Úevent_signaturec                 C   s   t |  dd¡d�S )aî  
    Return the 32-byte keccak signature of the log topic for an event signature.

    :param event_signature: String representation of the event name and arguments.
    :type event_signature: `str`
    :return: Log topic bytes.
    :rtype: `bytes`

    .. doctest::

        >>> from eth_utils import event_signature_to_log_topic
        >>> event_signature_to_log_topic('MyEvent()')
        b'M\xbf\xb6\x8bC\xdd\xdf\xa1+Q\xeb\xe9\x9a\xb8\xfd\xedb\x0f\x9a\n\xc21B\x87\x9aO\x19*\x1byR\xd2'
    r°   r   r±   r´   )rº   r%   r%   r*   Úevent_signature_to_log_topic5  s   r»   Ú	event_abic                 C   r·   )aA  
    Return the 32-byte keccak signature of the log topic from an event ABI.

    :param event_abi: Event ABI.
    :type event_abi: `ABIEvent`
    :return: Log topic bytes.
    :rtype: `bytes`

    .. doctest::

        >>> from eth_utils import event_abi_to_log_topic
        >>> abi = {
        ...   'type': 'event',
        ...   'anonymous': False,
        ...   'name': 'MyEvent',
        ...   'inputs': []
        ... }
        >>> event_abi_to_log_topic(abi)
        b'M\xbf\xb6\x8bC\xdd\xdf\xa1+Q\xeb\xe9\x9a\xb8\xfd\xedb\x0f\x9a\n\xc21B\x87\x9aO\x19*\x1byR\xd2'
    )rp   r»   )r¼   rº   r%   r%   r*   Úevent_abi_to_log_topicG  r¹   r½   )6Úcollectionsr   r6   r7   rG   rD   r   r   r   r   r   r   r	   r
   r   r   r   r   Ú
eth_typingr   r   r   r   r   r   r   r   r   Úeth_utils.typesr   Úcryptor   r/   ra   r3   rS   rW   r[   rp   rw   rz   r�   r‚   rœ   r¡   r¨   rl   r­   r®   Úbytesr¶   r¸   r»   r½   r%   r%   r%   r*   Ú<module>   sÔ    8,ÿÿ
þ"1	$	00Gÿþýÿþýÿþýÿþýÿþýÿþýÿÿüÿ
û3ÿ
þý

ürÿþ
ý=$$-.