
    eiK                         d dl mZmZ ddlmZ ddlmZ deeef         defdZdeeef         defd	Z	d
ede
fdZdeeef         de
fdZd
ede
fdZdeeef         de
fdZdS )    )AnyDict   )to_bytes   )SHA3abireturnc                 :   | d         }t          |t                    s/t          dt          |           dt	          |                     |                    d          s|S d                    d | d         D                       }|dd	         }d
| d| }|S )a  
    Converts a tuple from a dict to a parenthesized list of its types.

    >>> from eth_utils.abi import collapse_if_tuple
    >>> collapse_if_tuple(
    ...     {
    ...         'components': [
    ...             {'name': 'anAddress', 'type': 'address'},
    ...             {'name': 'anInt', 'type': 'uint256'},
    ...             {'name': 'someBytes', 'type': 'bytes'},
    ...         ],
    ...         'type': 'tuple',
    ...     }
    ... )
    '(address,uint256,bytes)'
    typez%The 'type' must be a string, but got z	 of type tuple,c              3   4   K   | ]}t          |          V  d S Ncollapse_if_tuple).0cs     i/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/static_dependencies/ethereum/utils/abi.py	<genexpr>z$collapse_if_tuple.<locals>.<genexpr>(   s+      II!*1--IIIIII    
components   N())
isinstancestr	TypeErrorreprr   
startswithjoin)r	   typ	delimited	array_dim	collapseds        r   r   r      s    " f+Cc3 SDIISSS		SS
 
 	
 ^^G$$ 
IIs<7HIIIIII ABBI+I++	++Ir   c                     d                     d |                     dg           D                       }| d          d| d}|S )Nr   c                 ,    g | ]}t          |          S  r   )r   	abi_inputs     r   
<listcomp>z%_abi_to_signature.<locals>.<listcomp>3   s!    MMM)	9	%	%MMMr   inputsnamer   r   )r!   get)r	   fn_input_typesfunction_signatures      r   _abi_to_signaturer0   1   sW    XXMMswwx7L7LMMM N  K;;.;;;r   event_signaturec                 t    t          t          |                     dd                              d d         S )N  text   keccakr   replacer1   s    r   $function_signature_to_4byte_selectorr<   9   s4    ( 7 7R @ @AAABB2A2FFr   function_abic                 >    t          |           }t          |          S r   )r0   r<   )r=   r/   s     r   function_abi_to_4byte_selectorr?   =   s    *<88/0BCCCr   c                 d    t          t          |                     dd                              S )Nr3   r4   r5   r8   r;   s    r   event_signature_to_log_topicrA   B   s+    ( 7 7R @ @AAABBBr   	event_abic                 >    t          |           }t          |          S r   )r0   rA   )rB   r1   s     r   event_abi_to_log_topicrD   F   s    '	22O'888r   N)typingr   r   conversionsr   r9   r   r   r   r0   bytesr<   r?   rA   rD   r(   r   r   <module>rH      sr         
          
4S> c    D4S> c    G# G% G G G GDc3h DE D D D D
C# C% C C C C9d38n 9 9 9 9 9 9 9r   